Revision 6721
Added by ben leinfelder over 12 years ago
GenerateSystemMetadata.java | ||
---|---|---|
41 | 41 |
import org.dataone.service.types.v1.SystemMetadata; |
42 | 42 |
|
43 | 43 |
import edu.ucsb.nceas.metacat.AccessionNumberException; |
44 |
import edu.ucsb.nceas.metacat.DBUtil; |
|
45 |
import edu.ucsb.nceas.metacat.DocumentImpl; |
|
44 | 46 |
import edu.ucsb.nceas.metacat.IdentifierManager; |
45 | 47 |
import edu.ucsb.nceas.metacat.McdbDocNotFoundException; |
46 | 48 |
import edu.ucsb.nceas.metacat.admin.AdminException; |
47 | 49 |
import edu.ucsb.nceas.metacat.dataone.SystemMetadataFactory; |
48 | 50 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
51 |
import edu.ucsb.nceas.metacat.util.DocumentUtil; |
|
49 | 52 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException; |
50 | 53 |
import edu.ucsb.nceas.utilities.SortedProperties; |
51 | 54 |
|
... | ... | |
96 | 99 |
NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException |
97 | 100 |
{ |
98 | 101 |
//get the list of ids with no SM |
99 |
List<String> idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true); |
|
102 |
//List<String> idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true); |
|
103 |
List<String> idList = DBUtil.getAllDocidsByType(null, true); |
|
100 | 104 |
for (String localId : idList) { |
101 | 105 |
//for each id, add a system metadata doc |
102 | 106 |
try { |
107 |
log.debug("generating missing system metadata for " + localId); |
|
103 | 108 |
generateMissingSystemMetadata(localId, includeOre); |
104 | 109 |
} catch (Exception e) { |
105 | 110 |
log.error("Error generating system metadata for: " + localId, e); |
106 | 111 |
} |
107 | 112 |
} |
108 |
log.info("generateMissingSystemMetadata(token)");
|
|
113 |
log.info("done generating missing system metadata");
|
|
109 | 114 |
} |
110 | 115 |
|
111 | 116 |
/** |
... | ... | |
149 | 154 |
throw sf; |
150 | 155 |
} |
151 | 156 |
|
152 |
//insert the systemmetadata object or just update it |
|
153 |
boolean exists = IdentifierManager.getInstance().identifierExists(sm.getIdentifier().getValue());
|
|
157 |
//insert the systemmetadata object or just update it as needed
|
|
158 |
boolean exists = IdentifierManager.getInstance().systemMetadataExists(sm.getIdentifier().getValue());
|
|
154 | 159 |
if (!exists) { |
155 | 160 |
IdentifierManager.getInstance().createSystemMetadata(sm); |
156 | 161 |
} |
Also available in: Unified diff
generating ORE maps and creating/updating system metadata now. There are some Permission conversion issues to be worked out yet