Revision 6931
Added by ben leinfelder almost 13 years ago
src/edu/ucsb/nceas/metacat/dataone/SystemMetadataFactory.java | ||
---|---|---|
133 | 133 |
AccessionNumber accNum = new AccessionNumber(localId, "NONE"); |
134 | 134 |
int rev = Integer.valueOf(accNum.getRev()); |
135 | 135 |
|
136 |
String guid = null; |
|
137 |
try { |
|
138 |
// get the guid if it exists |
|
139 |
guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(), rev); |
|
140 |
} catch (McdbDocNotFoundException dnfe) { |
|
141 |
// otherwise create the mapping |
|
142 |
logMetacat.debug("There was a problem getting the guid from " |
|
143 |
+ "the given localId (docid and revision). The error message was: " |
|
144 |
+ dnfe.getMessage()); |
|
145 |
logMetacat.debug("No guid in the identifier table. adding it for " + localId); |
|
146 |
IdentifierManager.getInstance().createMapping(localId, localId); |
|
147 |
logMetacat.debug("Mapping created for " + localId); |
|
148 |
logMetacat.debug("accessionNumber: " + accNum); |
|
149 |
guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(), rev); |
|
150 |
} |
|
151 |
Identifier identifier = new Identifier(); |
|
152 |
identifier.setValue(guid); |
|
153 |
|
|
154 |
// set the id |
|
155 |
sysMeta.setIdentifier(identifier); |
|
156 |
|
|
157 | 136 |
// get the data or metadata object |
158 | 137 |
InputStream inputStream; |
159 | 138 |
try { |
... | ... | |
188 | 167 |
+ "The error message was: " + ioe.getMessage()); |
189 | 168 |
throw ioe; |
190 | 169 |
|
191 |
} // end try() |
|
170 |
} |
|
171 |
|
|
172 |
// get/make the guid |
|
173 |
String guid = null; |
|
174 |
try { |
|
175 |
// get the guid if it exists |
|
176 |
guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(), rev); |
|
177 |
} catch (McdbDocNotFoundException dnfe) { |
|
178 |
// otherwise create the mapping |
|
179 |
logMetacat.debug("There was a problem getting the guid from " |
|
180 |
+ "the given localId (docid and revision). The error message was: " |
|
181 |
+ dnfe.getMessage()); |
|
182 |
logMetacat.debug("No guid in the identifier table. adding it for " + localId); |
|
183 |
IdentifierManager.getInstance().createMapping(localId, localId); |
|
184 |
logMetacat.debug("Mapping created for " + localId); |
|
185 |
logMetacat.debug("accessionNumber: " + accNum); |
|
186 |
guid = IdentifierManager.getInstance().getGUID(accNum.getDocid(), rev); |
|
187 |
} |
|
188 |
Identifier identifier = new Identifier(); |
|
189 |
identifier.setValue(guid); |
|
192 | 190 |
|
191 |
// set the id |
|
192 |
sysMeta.setIdentifier(identifier); |
|
193 |
|
|
193 | 194 |
// get additional docinfo |
194 | 195 |
Hashtable<String, String> docInfo = ReplicationService.getDocumentInfoMap(localId); |
195 | 196 |
// set the default object format |
Also available in: Unified diff
try to read the local document before making the localid->guid mapping (in cases where we fail to read the data locally like if it is referenced in an EML file but does not exist on this Metacat instance)