Revision 5456
Added by berkley over 14 years ago
test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java | ||
---|---|---|
272 | 272 |
String docid = generateDocumentId(); |
273 | 273 |
id.setValue(docid); |
274 | 274 |
|
275 |
cs.insertOrUpdateDocument(testDoc, id, cs.getSessionData(token), "insert");
|
|
275 |
cs.insertOrUpdateDocument(testDoc, id, cs.getSessionData(token), "insert", false);
|
|
276 | 276 |
//try to get its system metadata, should fail |
277 | 277 |
try |
278 | 278 |
{ |
src/edu/ucsb/nceas/metacat/dataone/CrudService.java | ||
---|---|---|
1430 | 1430 |
String smId = IdentifierManager.getInstance().getSystemMetadataLocalId(sm.getIdentifier().getValue()); |
1431 | 1431 |
sm.setDateSysMetadataModified(new Date()); |
1432 | 1432 |
String xml = new String(serializeSystemMetadata(sm).toByteArray()); |
1433 |
Identifier id = new Identifier(); |
|
1434 |
id.setValue(smId); |
|
1435 |
String localId = updateDocument(xml, id, null, sessionData, true); |
|
1433 |
String localId = updateDocument(xml, sm.getIdentifier(), null, sessionData, true); |
|
1436 | 1434 |
IdentifierManager.getInstance().updateSystemMetadataMapping(sm.getIdentifier().getValue(), localId); |
1437 | 1435 |
} |
1438 | 1436 |
catch(Exception e) |
... | ... | |
1520 | 1518 |
//localid should already exist in the identifier table, so just find it |
1521 | 1519 |
try |
1522 | 1520 |
{ |
1523 |
localId = im.getLocalId(guid.getValue()); |
|
1521 |
System.out.println("updating guid " + guid.getValue()); |
|
1522 |
if(!isSystemMetadata) |
|
1523 |
{ |
|
1524 |
System.out.println("looking in identifier table for guid " + guid.getValue()); |
|
1525 |
localId = im.getLocalId(guid.getValue()); |
|
1526 |
} |
|
1527 |
else |
|
1528 |
{ |
|
1529 |
System.out.println("looking in systemmetadata table for guid " + guid.getValue()); |
|
1530 |
localId = im.getSystemMetadataLocalId(guid.getValue()); |
|
1531 |
} |
|
1532 |
System.out.println("localId: " + localId); |
|
1524 | 1533 |
//increment the revision |
1525 | 1534 |
String docid = localId.substring(0, localId.lastIndexOf(".")); |
1526 | 1535 |
String revS = localId.substring(localId.lastIndexOf(".") + 1, localId.length()); |
... | ... | |
1528 | 1537 |
rev++; |
1529 | 1538 |
docid = docid + "." + rev; |
1530 | 1539 |
localId = docid; |
1540 |
System.out.println("incremented localId: " + localId); |
|
1531 | 1541 |
} |
1532 | 1542 |
catch(McdbDocNotFoundException e) |
1533 | 1543 |
{ |
Also available in: Unified diff
fixed update bug I introduced yesterday while fixing replication