Skip to content

Commit

Permalink
correct issue with old ids
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 3, 2024
1 parent d9bce6a commit 7304fdf
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ private void addBioEngine() throws ModelSpecsException {
}
}

private static String findID(Map<String, Object> yamlElements) {
@SuppressWarnings("unchecked")
private static String findID(Map<String, Object> yamlElements) {

if (yamlElements.get("config") != null && yamlElements.get("config") instanceof Map) {
Map<String, Object> configMap = (Map<String, Object>) yamlElements.get("config");
Expand All @@ -276,15 +277,24 @@ private static String findID(Map<String, Object> yamlElements) {
return (String) yamlElements.get("id");
}

private static String findOldID(Map<String, Object> yamlElements) {
@SuppressWarnings("unchecked")
private static String findOldID(Map<String, Object> yamlElements) {

if (yamlElements.get("config") != null && yamlElements.get("config") instanceof Map) {
Map<String, Object> configMap = (Map<String, Object>) yamlElements.get("config");
if (configMap.get("_conceptdoi") != null && configMap.get("_conceptdoi") instanceof String) {
return (String) configMap.get("_conceptdoi");
}
}
return (String) yamlElements.get("id");
if (yamlElements.get("id") != null && yamlElements.get("id") instanceof String) {
String id = (String) yamlElements.get("id");
if (id.length() - id.replace("/", "").length() >= 2
&& id.substring(id.indexOf("/") + 1).indexOf("/") - id.indexOf("/") > 2 )
return id.substring(0, id.indexOf("/") + id.substring(id.indexOf("/") + 1).indexOf("/") + 1);
else
return id;
}
return null;
}

/**
Expand Down

0 comments on commit 7304fdf

Please sign in to comment.