Project

General

Profile

« Previous | Next » 

Revision 8789

restrict DOI updates to DOIs that match our server shoulder -- may consider opening this up to any "doi:" prefix if this is too restrictive. https://projects.ecoinformatics.org/ecoinfo/issues/6440

View differences:

UpdateDOI.java
39 39
import edu.ucsb.nceas.metacat.admin.AdminException;
40 40
import edu.ucsb.nceas.metacat.dataone.DOIService;
41 41
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService;
42
import edu.ucsb.nceas.metacat.properties.PropertyService;
42 43
import edu.ucsb.nceas.metacat.util.DocumentUtil;
44
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
43 45

  
44 46

  
45 47

  
......
67 69
	 * @param identifiers - DOIs to update
68 70
	 */
69 71
	private void updateDOIRegistration(List<String> identifiers) {
72
		
73
		// look up the prefix - NOTE we have used different shoulders over time, so might consider updating anything with "doi:..."
74
		String prefix = "doi:";
75
		try {
76
			prefix = PropertyService.getProperty("guid.ezid.doishoulder." + serverLocation);
77
		} catch (PropertyNotFoundException pnfe) {
78
			log.error("Could not look up the doi shoulder for this server", pnfe);
79
			return;
80
		}
81

  
70 82
		for (String pid: identifiers) {
71 83
			try {
84
				// skip if not a DOI
85
				if (!pid.startsWith(prefix)) {
86
					continue;
87
				}
88
				
72 89
				//Create an identifier and retrieve the SystemMetadata for this guid
73 90
				Identifier identifier = new Identifier();
74 91
				identifier.setValue(pid);

Also available in: Unified diff