diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/PdbAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/PdbAnnotator.java index 4d69f2e648439e4cae31bec59aeef2aaf6a5e3b6..f2dca91d0de5a103bcddb2dc0897f576a77492ee 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/PdbAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/PdbAnnotator.java @@ -1,6 +1,7 @@ package lcsb.mapviewer.annotation.services.annotators; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -136,7 +137,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { for (MiriamData md : mds) { try { - Set<Structure> structures = (Set<Structure>)uniProtToPdb(md); + Collection<Structure> structures = uniProtToPdb(md); if (structures.size() == 0) { logger.warn(elementUtils.getElementTag(bioEntity) + " No PDB mapping for UniProt ID: " + md.getResource()); } else { @@ -159,7 +160,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { for (Structure s : structures) { s.setUniprot(ur); } - ur.setStructures(structures); + ur.addStructures(structures); ((Species)bioEntity).getUniprots().add(ur); } } catch (WrongResponseCodeIOException exception) { @@ -259,7 +260,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { */ public Collection<Structure> uniProtToPdb(MiriamData uniprot) throws IOException { if (uniprot == null) { - return null; + return new ArrayList<>(); } if (!MiriamType.UNIPROT.equals(uniprot.getDataType())) { @@ -269,7 +270,7 @@ public class PdbAnnotator extends ElementAnnotator implements IExternalService { String accessUrl = getPdbMappingUrl(uniprot.getResource()); String json = getWebPageContent(accessUrl); - return isJson(json) ? processMappingData(json) : null; + return isJson(json) ? processMappingData(json) : new ArrayList<>(); } @Override diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/field/UniprotRecord.java b/model/src/main/java/lcsb/mapviewer/model/map/species/field/UniprotRecord.java index 92346cb4f25c4a2e9ed39514efc40b5e7bf4a395..ceba7173db97d1996f9151651334e9a3c760ba11 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/field/UniprotRecord.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/species/field/UniprotRecord.java @@ -1,6 +1,7 @@ package lcsb.mapviewer.model.map.species.field; import java.io.Serializable; +import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -178,4 +179,8 @@ public class UniprotRecord implements Serializable { public Set<Structure> getStructures() { return structures; } + + public void addStructures(Collection<Structure> structures) { + this.structures.addAll(structures); + } } diff --git a/persist/src/db/11.0.1/fix_db_20170713.sql b/persist/src/db/11.1.0/fix_db_20170713.sql similarity index 57% rename from persist/src/db/11.0.1/fix_db_20170713.sql rename to persist/src/db/11.1.0/fix_db_20170713.sql index c0f3e49c8e044a0962591e380b566bfca41b1e56..9bac77513333b2683340608cc097f1ff808df748 100644 --- a/persist/src/db/11.0.1/fix_db_20170713.sql +++ b/persist/src/db/11.1.0/fix_db_20170713.sql @@ -1,2 +1,2 @@ -DELETE FROM cache_type WHERE classname = 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator' -INSERT INTO cache_type(validity, classname) VALUES (365, 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator') \ No newline at end of file +DELETE FROM cache_type WHERE classname = 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator'; +INSERT INTO cache_type(validity, classname) VALUES (365, 'lcsb.mapviewer.annotation.services.annotators.PdbAnnotator'); \ No newline at end of file