Revision 6704
Added by ben leinfelder almost 13 years ago
src/edu/ucsb/nceas/metacat/admin/upgrade/GenerateSystemMetadata.java | ||
---|---|---|
94 | 94 |
throws ServiceFailure, McdbDocNotFoundException, PropertyNotFoundException, InvalidToken, NotAuthorized, |
95 | 95 |
NotFound, NotImplemented, InvalidRequest, NoSuchAlgorithmException, AccessionNumberException, SQLException |
96 | 96 |
{ |
97 |
IdentifierManager im = IdentifierManager.getInstance(); |
|
98 | 97 |
//get the list of ids with no SM |
99 |
List<String> idList = im.getLocalIdsWithNoSystemMetadata();
|
|
98 |
List<String> idList = IdentifierManager.getInstance().getLocalIdsWithNoSystemMetadata(true);
|
|
100 | 99 |
for (String localId : idList) { |
101 | 100 |
//for each id, add a system metadata doc |
102 | 101 |
try { |
src/edu/ucsb/nceas/metacat/IdentifierManager.java | ||
---|---|---|
624 | 624 |
* return all local ids in the object store that do not have associated |
625 | 625 |
* system metadata |
626 | 626 |
*/ |
627 |
public List<String> getLocalIdsWithNoSystemMetadata() |
|
627 |
public List<String> getLocalIdsWithNoSystemMetadata(boolean includeRevisions)
|
|
628 | 628 |
{ |
629 | 629 |
Vector<String> ids = new Vector<String>(); |
630 | 630 |
String sql = "select docid, rev from xml_documents " + |
631 | 631 |
"where docid not in " + |
632 | 632 |
"(select docid from identifier where guid in (select guid from systemmetadata)))"; |
633 |
|
|
634 |
String revisionSql = "select docid, revisionid from xml_revisions " + |
|
635 |
"where docid not in " + |
|
636 |
"(select docid from identifier where guid in (select guid from systemmetadata)))"; |
|
637 |
|
|
638 |
if (includeRevisions) { |
|
639 |
sql = sql + " UNION ALL " + revisionSql; |
|
640 |
} |
|
641 |
|
|
633 | 642 |
DBConnection dbConn = null; |
634 | 643 |
int serialNumber = -1; |
635 | 644 |
try |
Also available in: Unified diff
include all document revisions when generating "missing" system metadata
TODO: revision graph captured in obsoletes/obsoletedBy