Skip to content

Commit

Permalink
Fixed a bug when we update doi by specifying a format id.
Browse files Browse the repository at this point in the history
  • Loading branch information
taojing2002 committed May 22, 2019
1 parent 22430cc commit 75a362d
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/edu/ucsb/nceas/metacat/admin/upgrade/UpdateDOI.java
Expand Up @@ -171,24 +171,13 @@ public boolean upgradeById(List<String> ids) throws AdminException {
*/
public boolean upgradeByFormatId(List<String> formatIds) throws AdminException {
boolean success = true;
List<String> idList = new ArrayList<String>();

try{
for (String formatId: formatIds) {
//Get all the docids with this formatId
List<String> docids = IdentifierManager.getInstance().getGUIDs(formatId, nodeId, DOISCHEME);

//get the guids for each docid and add to our list
for(String id: docids){
String docid = DocumentUtil.getDocIdFromAccessionNumber(id);
int rev = DocumentUtil.getRevisionFromAccessionNumber(id);
String guid = IdentifierManager.getInstance().getGUID(docid, rev);
idList.add(guid);
}

List<String> idList = IdentifierManager.getInstance().getGUIDs(formatId, nodeId, DOISCHEME);
//Update the registration for all these guids
Collections.sort(idList);
updateDOIRegistration(idList);
Collections.sort(idList);
updateDOIRegistration(idList);
}
} catch (Exception e) {
String msg = "Problem updating DOIs: " + e.getMessage();
Expand Down

0 comments on commit 75a362d

Please sign in to comment.