Revision 6079
Added by ben leinfelder almost 13 years ago
ReplicationService.java | ||
---|---|---|
576 | 576 |
logReplication.info("ZZZZZZZZZZZZ docName: " + docName); |
577 | 577 |
if(docName.trim().equals("systemMetadata")) |
578 | 578 |
{ |
579 |
logReplication.info("creating mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
580 |
idman.createSystemMetadataMapping(guid, docinfoHash.get("docid")); |
|
581 |
logReplication.info("handleForceReplicateRequest: updating SM with additional info"); |
|
582 |
System.out.println("!!!!!!!!!!!!!handleForceReplicateRequest: updating SM with additional info"); |
|
583 |
Long dateUploadedLong = new Long(docinfoHash.get("date_uploaded")); |
|
584 |
Long dateModifiedLong = new Long(docinfoHash.get("date_modified")); |
|
579 |
if (dbaction.equalsIgnoreCase("UPDATE")) { |
|
580 |
logReplication.info("update mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
581 |
idman.updateSystemMetadataMapping(guid, docinfoHash.get("docid")); |
|
582 |
logReplication.info("handleForceReplicateRequest: updating SM with additional info"); |
|
583 |
} else { // insert |
|
584 |
logReplication.info("creating mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
585 |
idman.createSystemMetadataMapping(guid, docinfoHash.get("docid")); |
|
586 |
} |
|
587 |
logReplication.info("handleForceReplicateRequest: updating SM with additional info"); |
|
588 |
Long dateUploadedLong = new Long(docinfoHash.get("date_uploaded")); |
|
589 |
Long dateModifiedLong = new Long(docinfoHash.get("date_modified")); |
|
585 | 590 |
idman.insertAdditionalSystemMetadataFields( |
586 | 591 |
dateUploadedLong.longValue(), |
587 | 592 |
docinfoHash.get("rights_holder"), |
... | ... | |
597 | 602 |
} |
598 | 603 |
else |
599 | 604 |
{ |
600 |
logReplication.info("creating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
601 |
idman.createMapping(guid, docinfoHash.get("docid")); |
|
605 |
if (dbaction.equalsIgnoreCase("UPDATE")) { |
|
606 |
logReplication.info("updating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
607 |
idman.updateMapping(guid, docinfoHash.get("docid")); |
|
608 |
} else { // insert |
|
609 |
logReplication.info("creating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid")); |
|
610 |
idman.createMapping(guid, docinfoHash.get("docid")); |
|
611 |
} |
|
602 | 612 |
} |
603 | 613 |
} |
604 | 614 |
else |
... | ... | |
639 | 649 |
serialNumber = dbConn.getCheckOutSerialNumber(); |
640 | 650 |
// write the document to local database |
641 | 651 |
DocumentImplWrapper wrapper = new DocumentImplWrapper(parserBase, false); |
642 |
//try this independently so we can set |
|
643 |
// Exception writeException = null; |
|
652 |
//try this independently so we can set access even if the update action is invalid (i.e docid has not changed) |
|
644 | 653 |
try { |
645 | 654 |
wrapper.writeReplication(dbConn, xmldoc, null, null, |
646 | 655 |
dbaction, docid, null, null, homeServer, server, createdDate, |
647 | 656 |
updatedDate); |
648 | 657 |
} finally { |
649 |
// writeException = e; |
|
650 | 658 |
|
651 | 659 |
//process extra access rules before dealing with the write exception (doc exist already) |
652 | 660 |
Vector<XMLAccessDAO> accessControlList = dih.getAccessControlList(); |
... | ... | |
682 | 690 |
docid + ":"); |
683 | 691 |
} |
684 | 692 |
} |
685 |
EventLog.getInstance().log(request.getRemoteAddr(), REPLICATIONUSER, docid, |
|
686 |
dbaction); |
|
693 |
EventLog.getInstance().log(request.getRemoteAddr(), REPLICATIONUSER, docid, dbaction); |
|
687 | 694 |
} |
688 | 695 |
} catch (SQLException sqle) { |
689 | 696 |
logMetacat.error("ReplicationService.handleForceReplicateRequest - " + ReplicationService.METACAT_REPL_ERROR_MSG); |
Also available in: Unified diff
use update method to update the mapping between local and guid (d1) when we get a force replication request that is an "update