Revision 2605
Added by Jing Tao about 19 years ago
src/edu/ucsb/nceas/metacat/DBSAXHandler.java | ||
---|---|---|
230 | 230 |
if (doctype != null |
231 | 231 |
&& MetaCatUtil.getOptionList( |
232 | 232 |
MetaCatUtil.getOption("packagedoctype")).contains( |
233 |
doctype) && hasTriple) { |
|
233 |
doctype) && hasTriple && !isRevisionDoc) {
|
|
234 | 234 |
try { |
235 |
//initial handler and write into relationdb |
|
236 |
RelationHandler handler = new RelationHandler(docid, doctype, |
|
235 |
//initial handler and write into relationdb only for xml-documents |
|
236 |
if (!isRevisionDoc) |
|
237 |
{ |
|
238 |
RelationHandler handler = new RelationHandler(docid, doctype, |
|
237 | 239 |
connection, tripleList); |
240 |
} |
|
238 | 241 |
} catch (Exception e) { |
239 | 242 |
MetaCatUtil.debugMessage( |
240 | 243 |
"Failed to write triples into relation table" |
... | ... | |
271 | 274 |
|
272 | 275 |
// Get a reference to the parent node for the id |
273 | 276 |
try { |
277 |
|
|
274 | 278 |
parentNode = (DBSAXNode) nodeStack.peek(); |
275 | 279 |
} catch (EmptyStackException e) { |
276 | 280 |
parentNode = null; |
... | ... | |
287 | 291 |
// reset textbuffer |
288 | 292 |
textBuffer = null; |
289 | 293 |
textBuffer = new StringBuffer(); |
290 |
|
|
294 |
|
|
291 | 295 |
} |
292 |
|
|
296 |
|
|
293 | 297 |
// Document representation that points to the root document node |
294 | 298 |
if (atFirstElement) { |
295 | 299 |
atFirstElement = false; |
... | ... | |
312 | 316 |
doctype = docname; |
313 | 317 |
MetaCatUtil.debugMessage("DOCTYPE-b: " + doctype, 30); |
314 | 318 |
} |
319 |
|
|
315 | 320 |
rootNode.writeNodename(docname); |
321 |
|
|
316 | 322 |
try { |
317 | 323 |
// for validated XML Documents store a reference to XML DB |
318 | 324 |
// Catalog |
... | ... | |
324 | 330 |
String catalogid = null; |
325 | 331 |
DBConnection dbConn = null; |
326 | 332 |
int serialNumber = -1; |
327 |
|
|
333 |
|
|
328 | 334 |
if (systemid != null) { |
329 | 335 |
try { |
330 | 336 |
// Get dbconnection |
... | ... | |
353 | 359 |
//create documentImpl object by the constructor which can |
354 | 360 |
// specify |
355 | 361 |
//the revision |
356 |
currentDocument = new DocumentImpl(connection, rootNode |
|
362 |
|
|
363 |
if (!isRevisionDoc) |
|
364 |
{ |
|
365 |
//System.out.println("here!!!!!!!!!!!3"); |
|
366 |
currentDocument = new DocumentImpl(connection, rootNode |
|
357 | 367 |
.getNodeID(), docname, doctype, docid, revision, |
358 | 368 |
action, user, this.pub, catalogid, this.serverCode); |
369 |
//System.out.println("here!!!!!!!!!!!4"); |
|
370 |
} |
|
371 |
else |
|
372 |
{ |
|
373 |
//System.out.println("here!!!!!!!!!!!5"); |
|
374 |
currentDocument = new DeletedDocumentImpl(connection, rootNode |
|
375 |
.getNodeID(), docname, doctype, docid, revision, |
|
376 |
action, user, this.pub, catalogid, this.serverCode); |
|
377 |
//System.out.println("here!!!!!!!!!!!6"); |
|
378 |
} |
|
379 |
//System.out.println("here!!!!!!!!!!!7"); |
|
359 | 380 |
|
360 | 381 |
} catch (Exception ane) { |
382 |
ane.printStackTrace(); |
|
361 | 383 |
throw (new SAXException("Error in DBSaxHandler.startElement " |
362 | 384 |
+ action, ane)); |
363 | 385 |
} |
... | ... | |
420 | 442 |
public void runIndexingThread(){ |
421 | 443 |
boolean useXMLIndex = |
422 | 444 |
(new Boolean(MetaCatUtil.getOption("usexmlindex"))).booleanValue(); |
423 |
if (useXMLIndex) { |
|
445 |
if (useXMLIndex && !isRevisionDoc) {
|
|
424 | 446 |
try { |
425 | 447 |
xmlIndex.start(); |
426 | 448 |
} catch (NullPointerException e) { |
... | ... | |
894 | 916 |
}//if |
895 | 917 |
return nodeId; |
896 | 918 |
} |
919 |
|
|
920 |
public long getRootNodeId() |
|
921 |
{ |
|
922 |
return rootNode.getNodeID(); |
|
923 |
} |
|
897 | 924 |
} |
Also available in: Unified diff
Add code to handle replication deleted docs.