Project

General

Profile

« Previous | Next » 

Revision 7045

check whether mapping (

View differences:

src/edu/ucsb/nceas/metacat/IdentifierManager.java
745 745
    
746 746
    /**
747 747
     * Determine if an identifier exists already, returning true if so.
748
     * NOTE: looks in the identifier and system metadata table for a match
749
     * (in that order)
748 750
     * 
749 751
     * @param guid the global identifier to look up
750 752
     * @return boolean true if the identifier exists
......
769 771
    }
770 772
    
771 773
    /**
774
     * Determine if an identifier mapping exists already, 
775
     * returning true if so.
772 776
     * 
777
     * @param guid the global identifier to look up
778
     * @return boolean true if the identifier exists
779
     */
780
    public boolean mappingExists(String guid)
781
    {
782
        boolean idExists = false;
783
        try {
784
            String id = getLocalId(guid);
785
            if (id != null) {
786
                idExists = true;
787
            }
788
        } catch (McdbDocNotFoundException e) {
789
        	// nope!
790
        }
791
        return idExists;
792
    }
793
    
794
    /**
795
     * 
773 796
     * @param guid
774 797
     * @param rev
775 798
     * @return
src/edu/ucsb/nceas/metacat/replication/ReplicationHandler.java
398 398
    				  SystemMetadata.class, 
399 399
    				  new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8")));
400 400
    	  // need the guid-to-docid mapping
401
    	  if (!IdentifierManager.getInstance().identifierExists(sysMeta.getIdentifier().getValue())) {
401
    	  if (!IdentifierManager.getInstance().mappingExists(sysMeta.getIdentifier().getValue())) {
402 402
	      	  IdentifierManager.getInstance().createMapping(sysMeta.getIdentifier().getValue(), accNumber);
403 403
    	  }
404 404
      	  // save the system metadata
......
565 565
    				  SystemMetadata.class, 
566 566
    				  new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8")));
567 567
    	  // need the guid-to-docid mapping
568
    	  if (!IdentifierManager.getInstance().identifierExists(sysMeta.getIdentifier().getValue())) {
568
    	  if (!IdentifierManager.getInstance().mappingExists(sysMeta.getIdentifier().getValue())) {
569 569
	      	  IdentifierManager.getInstance().createMapping(sysMeta.getIdentifier().getValue(), accNumber);
570 570
    	  }
571 571
    	  // save the system metadata
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java
525 525
							new ByteArrayInputStream(systemMetadataXML.getBytes("UTF-8")));
526 526
				// need the guid-to-docid mapping
527 527
				boolean mappingExists = true;
528
		      	mappingExists = IdentifierManager.getInstance().identifierExists(sysMeta.getIdentifier().getValue());
528
		      	mappingExists = IdentifierManager.getInstance().mappingExists(sysMeta.getIdentifier().getValue());
529 529
		      	if (!mappingExists) {
530 530
		      		IdentifierManager.getInstance().createMapping(sysMeta.getIdentifier().getValue(), docid);
531 531
		      	}
......
802 802
	      	  
803 803
	      	  // need the guid-to-docid mapping
804 804
	      	  boolean mappingExists = true;
805
	      	  mappingExists = IdentifierManager.getInstance().identifierExists(sysMeta.getIdentifier().getValue());
805
	      	  mappingExists = IdentifierManager.getInstance().mappingExists(sysMeta.getIdentifier().getValue());
806 806
	      	  if (!mappingExists) {
807 807
	      		  IdentifierManager.getInstance().createMapping(sysMeta.getIdentifier().getValue(), docid);
808 808
	      	  }

Also available in: Unified diff