Revision 9583
Added by Jing Tao about 8 years ago
D1NodeService.java | ||
---|---|---|
447 | 447 |
//String objectAsXML = ""; |
448 | 448 |
try { |
449 | 449 |
//objectAsXML = IOUtils.toString(object, "UTF-8"); |
450 |
localId = insertOrUpdateDocument(object,"UTF-8", pid, session, "insert"); |
|
450 |
String formatId = null; |
|
451 |
if(sysmeta.getFormatId() != null) { |
|
452 |
formatId = sysmeta.getFormatId().getValue(); |
|
453 |
} |
|
454 |
localId = insertOrUpdateDocument(object,"UTF-8", pid, session, "insert", formatId); |
|
451 | 455 |
//localId = im.getLocalId(pid.getValue()); |
452 | 456 |
|
453 | 457 |
} catch (IOException e) { |
... | ... | |
1269 | 1273 |
" is science metadata: " + e.getMessage());*/ |
1270 | 1274 |
|
1271 | 1275 |
} catch (NotFound e) { |
1272 |
logMetacat.debug("There was a problem determining if the object identified by" +
|
|
1276 |
logMetacat.warn("There was a problem determining if the object identified by" +
|
|
1273 | 1277 |
sysmeta.getIdentifier().getValue() + |
1274 | 1278 |
" is science metadata: " + e.getMessage()); |
1275 | 1279 |
|
... | ... | |
1303 | 1307 |
* |
1304 | 1308 |
*/ |
1305 | 1309 |
public String insertOrUpdateDocument(InputStream xml, String encoding, Identifier pid, |
1306 |
Session session, String insertOrUpdate) |
|
1310 |
Session session, String insertOrUpdate, String formatId)
|
|
1307 | 1311 |
throws ServiceFailure, IOException { |
1308 | 1312 |
|
1309 | 1313 |
logMetacat.debug("Starting to insert xml document..."); |
... | ... | |
1376 | 1380 |
// do the insert or update action |
1377 | 1381 |
handler = new MetacatHandler(new Timer()); |
1378 | 1382 |
String result = handler.handleInsertOrUpdateAction(request.getRemoteAddr(), request.getHeader("User-Agent"), null, |
1379 |
null, params, username, groupnames, false, false, xmlBytes); |
|
1383 |
null, params, username, groupnames, false, false, xmlBytes, formatId);
|
|
1380 | 1384 |
|
1381 | 1385 |
if(result.indexOf("<error>") != -1) { |
1382 | 1386 |
String detailCode = ""; |
Also available in: Unified diff
If a format id in the system metadata is registered in the xml_catalog table, we will use the schema location for the format id to validate the xml instance;
otherwise, we will use our previous way.