Commit 46b9d85f authored by redmitry@list.ru's avatar redmitry@list.ru

fix typeRole ("string" -> "array")

parent d9c458d2
......@@ -393,7 +393,7 @@ public class BiotoolsConverter {
}
private static void addCredits(Tool tool, JsonObject jtool) {
JsonArray jcredits = jtool.getJsonArray("credit");
final JsonArray jcredits = jtool.getJsonArray("credit");
if (jcredits != null) {
final List<Credit> credits = new ArrayList<>(jcredits.size());
tool.setCredits(credits);
......@@ -417,12 +417,19 @@ public class BiotoolsConverter {
}
}
final String role = jcredit.getString("typeRole", null);
if (role != null) {
try {
credit.setTypeRole(RoleType.fromValue(role));
} catch(IllegalArgumentException ex) {
Logger.getLogger(BiotoolsConverter.class.getName()).log(Level.INFO, "unrecognized role role: {0}", type);
final JsonArray jtypeRoles = jcredit.getJsonArray("typeRole");
if (jtypeRoles != null) {
final List<RoleType> typeRoles = new ArrayList<>(jtypeRoles.size());
credit.setTypeRoles(typeRoles);
for (int j = 0, m = jtypeRoles.size(); j < n; j++) {
final String role = jtypeRoles.getString(j, null);
if (role != null) {
try {
typeRoles.add(RoleType.fromValue(role));
} catch(IllegalArgumentException ex) {
Logger.getLogger(BiotoolsConverter.class.getName()).log(Level.INFO, "unrecognized role role: {0}", type);
}
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment