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:

src/edu/ucsb/nceas/metacat/replication/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);
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java
609 609
						updatedDate);
610 610
			} finally {
611 611

  
612
				//process extra access rules before dealing with the write exception (doc exist already)			
612
				//process extra access rules before dealing with the write exception (doc exist already)
613
				try {
614
		        	// check if we had a guid -> docid mapping
615
		        	String docidNoRev = DocumentUtil.getDocIdFromAccessionNumber(docid);
616
		        	int rev = DocumentUtil.getRevisionFromAccessionNumber(docid);
617
		        	IdentifierManager.getInstance().getGUID(docid, rev);
618
		        	// no need to create the mapping if we have it
619
		        } catch (McdbDocNotFoundException mcdbe) {
620
		        	// create mapping if we don't
621
		        	IdentifierManager.getInstance().createMapping(docid, docid);
622
		        }
613 623
		        Vector<XMLAccessDAO> accessControlList = dih.getAccessControlList();
614 624
		        if (accessControlList != null) {
615 625
		        	AccessControlForSingleFile acfsf = new AccessControlForSingleFile(docid);
......
851 861
	        }
852 862
	        
853 863
	        // process the access control
864
	        try {
865
	        	// check if we had a guid -> docid mapping
866
	        	String docidNoRev = DocumentUtil.getDocIdFromAccessionNumber(docid);
867
	        	int rev = DocumentUtil.getRevisionFromAccessionNumber(docidNoRev);
868
	        	IdentifierManager.getInstance().getGUID(docid, rev);
869
	        	// no need to create the mapping if we have it
870
	        } catch (McdbDocNotFoundException mcdbe) {
871
	        	// create mapping if we don't
872
	        	IdentifierManager.getInstance().createMapping(docid, docid);
873
	        }
854 874
	        Vector<XMLAccessDAO> accessControlList = dih.getAccessControlList();
855 875
	        if (accessControlList != null) {
856 876
	        	AccessControlForSingleFile acfsf = new AccessControlForSingleFile(docid);

Also available in: Unified diff