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

FIX: Don't split COLLNUMB, ACCENAME

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