Project

General

Profile

« Previous | Next » 

Revision 7358

create docid-guid mapping during replication if it does not exist. we were [incorrectly] assuming that there would be SM coming with the document info that would fill this information in, but for traditional non-MN Metacat deployments there is no SM to provide a mapping. In this case we use the docid as the guid.

View differences:

ReplicationHandler.java
72 72
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService;
73 73
import edu.ucsb.nceas.metacat.properties.PropertyService;
74 74
import edu.ucsb.nceas.metacat.shared.HandlerException;
75
import edu.ucsb.nceas.metacat.util.DocumentUtil;
75 76
import edu.ucsb.nceas.metacat.util.MetacatUtil;
76 77
import edu.ucsb.nceas.metacat.util.ReplicationUtil;
77 78
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
......
459 460
      ReplicationService.updateUserOwner(dbConn, accNumber, user, updated);
460 461
      
461 462
      //process extra access rules 
463
      try {
464
      	// check if we had a guid -> docid mapping
465
      	String docid = DocumentUtil.getDocIdFromAccessionNumber(accNumber);
466
      	int rev = DocumentUtil.getRevisionFromAccessionNumber(accNumber);
467
      	IdentifierManager.getInstance().getGUID(docid, rev);
468
      	// no need to create the mapping if we have it
469
      } catch (McdbDocNotFoundException mcdbe) {
470
      	// create mapping if we don't
471
      	IdentifierManager.getInstance().createMapping(accNumber, accNumber);
472
      }
462 473
      Vector<XMLAccessDAO> xmlAccessDAOList = dih.getAccessControlList();
463 474
      if (xmlAccessDAOList != null) {
464 475
      	AccessControlForSingleFile acfsf = new AccessControlForSingleFile(accNumber);
......
617 628
        ReplicationService.updateUserOwner(dbConn, accNumber, user, updated);
618 629
        
619 630
        //process extra access rules
631
        try {
632
        	// check if we had a guid -> docid mapping
633
        	String docid = DocumentUtil.getDocIdFromAccessionNumber(accNumber);
634
        	int rev = DocumentUtil.getRevisionFromAccessionNumber(accNumber);
635
        	IdentifierManager.getInstance().getGUID(docid, rev);
636
        	// no need to create the mapping if we have it
637
        } catch (McdbDocNotFoundException mcdbe) {
638
        	// create mapping if we don't
639
        	IdentifierManager.getInstance().createMapping(accNumber, accNumber);
640
        }
620 641
        Vector<XMLAccessDAO> xmlAccessDAOList = dih.getAccessControlList();
621 642
        if (xmlAccessDAOList != null) {
622 643
        	AccessControlForSingleFile acfsf = new AccessControlForSingleFile(accNumber);

Also available in: Unified diff