Revision 3827
Added by Jing Tao over 16 years ago
src/edu/ucsb/nceas/metacat/EML201DocumentCorrector.java | ||
---|---|---|
20 | 20 |
* @author tao |
21 | 21 |
* |
22 | 22 |
*/ |
23 |
public class EML201DocumentCorrector implements Runnable
|
|
23 |
public class EML201DocumentCorrector |
|
24 | 24 |
{ |
25 | 25 |
private Logger logMetacat = Logger.getLogger(EML201DocumentCorrector.class); |
26 | 26 |
|
... | ... | |
58 | 58 |
String deletingNode = generateXML_NodeDeletingSQL(); |
59 | 59 |
deletingStatement.execute(deletingNode); |
60 | 60 |
|
61 |
// delete the records in xml_nodes_revisions table |
|
62 |
String deletingNodeRevision = generateXML_Node_RevisionsDeletingSQL(); |
|
63 |
deletingStatement.execute(deletingNodeRevision); |
|
64 |
|
|
61 | 65 |
//close statement and connection |
62 | 66 |
deletingStatement.close(); |
63 | 67 |
dbconn.close(); |
... | ... | |
87 | 91 |
} |
88 | 92 |
|
89 | 93 |
/* |
94 |
* Generate the sql command to delete the records in xml_node table. |
|
95 |
* Since it is leaf node, so we can just delete it without any other side-effect. |
|
96 |
*/ |
|
97 |
private String generateXML_Node_RevisionsDeletingSQL() |
|
98 |
{ |
|
99 |
String sql ="delete from xml_nodes_revisions where nodetype='ATTRIBUTE' and nodename='system' and nodedata='document' "+ |
|
100 |
"and parentnodeid in (select nodeid from xml_nodes where nodetype='ELEMENT' and nodename='references') and docid in "+ |
|
101 |
"(select docid from xml_documents where doctype ='eml://ecoinformatics.org/eml-2.0.1')"; |
|
102 |
return sql; |
|
103 |
} |
|
104 |
|
|
105 |
/* |
|
90 | 106 |
* Generate the sql command to delete the records in xml_nidex table; |
91 | 107 |
*/ |
92 | 108 |
private String generateXML_IndexDeletingSQL() |
... | ... | |
111 | 127 |
|
112 | 128 |
// run the thread |
113 | 129 |
EML201DocumentCorrector correct = new EML201DocumentCorrector(); |
114 |
Thread thread = new Thread(correct); |
|
115 |
thread.start(); |
|
116 |
//correct.run();
|
|
130 |
//Thread thread = new Thread(correct);
|
|
131 |
//thread.start();
|
|
132 |
correct.run(); |
|
117 | 133 |
} |
118 | 134 |
} |
Also available in: Unified diff
Checkin to head. Remove this class from Runnable and add sql to delete extral nodes in xml_nodes_revision table.