Commit 3300aee0 authored by Matija Obreza's avatar Matija Obreza
Browse files

FIX: Don't split COLLNUMB, ACCENAME

parent 4254684d
...@@ -414,10 +414,10 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -414,10 +414,10 @@ public class BatchRESTServiceImpl implements BatchRESTService {
genesysService.removeRemarks(toRemoveRemarks); genesysService.removeRemarks(toRemoveRemarks);
} }
updateAccessionAliases(acceNames, AliasType.ACCENAME); updateAccessionAliases(acceNames, AliasType.ACCENAME, false);
updateAccessionAliases(otherNumbs, AliasType.OTHERNUMB); updateAccessionAliases(otherNumbs, AliasType.OTHERNUMB, true);
updateAccessionAliases(donorNumbs, AliasType.DONORNUMB); updateAccessionAliases(donorNumbs, AliasType.DONORNUMB, true);
updateAccessionAliases(collNumbs, AliasType.COLLNUMB); updateAccessionAliases(collNumbs, AliasType.COLLNUMB, false);
return toSave.size() > 0 || toSaveColl.size() > 0 || toSaveGeo.size() > 0 || toSaveBreed.size() > 0 || toSaveExch.size() > 0; return toSave.size() > 0 || toSaveColl.size() > 0 || toSaveGeo.size() > 0 || toSaveBreed.size() > 0 || toSaveExch.size() > 0;
} }
...@@ -663,7 +663,7 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -663,7 +663,7 @@ public class BatchRESTServiceImpl implements BatchRESTService {
* *
* @param acceNames * @param acceNames
*/ */
private void updateAccessionAliases(Map<Accession, ArrayNode> acceNames, AliasType aliasType) { private void updateAccessionAliases(Map<Accession, ArrayNode> acceNames, AliasType aliasType, boolean splitInstCode) {
final List<AccessionAlias> toSave = new ArrayList<AccessionAlias>(); final List<AccessionAlias> toSave = new ArrayList<AccessionAlias>();
final List<AccessionAlias> toRemove = new ArrayList<AccessionAlias>(); final List<AccessionAlias> toRemove = new ArrayList<AccessionAlias>();
...@@ -674,13 +674,13 @@ public class BatchRESTServiceImpl implements BatchRESTService { ...@@ -674,13 +674,13 @@ public class BatchRESTServiceImpl implements BatchRESTService {
for (final JsonNode item : acceName) { for (final JsonNode item : acceName) {
if (item.isTextual() && StringUtils.isNotBlank(item.textValue())) { if (item.isTextual() && StringUtils.isNotBlank(item.textValue())) {
final AccessionAliasJson alias = new AccessionAliasJson(); final AccessionAliasJson alias = new AccessionAliasJson();
final String val = item.textValue(); final String val = item.textValue().trim();
if (val.contains(":")) { if (splitInstCode && val.contains(":")) {
final String[] s = val.split(":", 2); final String[] s = val.split(":", 2);
alias.usedBy = s[0].trim(); alias.usedBy = s[0].trim();
alias.name = s[1].trim(); alias.name = s[1].trim();
} else { } else {
alias.name = item.textValue().trim(); alias.name = val;
} }
alias.type = aliasType.getId(); alias.type = aliasType.getId();
aliases.add(alias); aliases.add(alias);
......
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