From d09f546422352564ea8b7cc57b374fc9b1646963 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 26 Jun 2017 11:49:51 +0200 Subject: [PATCH] AnnotatedObject renamed to BioEntity --- .../services/ImproperAnnotations.java | 10 ++-- .../services/MissingAnnotation.java | 6 +-- .../services/MissingRequiredAnnotations.java | 6 +-- .../annotation/services/ModelAnnotator.java | 36 +++++++------- .../annotators/BiocompendiumAnnotator.java | 4 +- .../services/annotators/ChebiAnnotator.java | 6 +-- .../services/annotators/ElementAnnotator.java | 48 +++++++++---------- .../services/annotators/EnsemblAnnotator.java | 6 +-- .../services/annotators/EntrezAnnotator.java | 6 +-- .../services/annotators/GoAnnotator.java | 4 +- .../services/annotators/HgncAnnotator.java | 4 +- .../services/annotators/ReconAnnotator.java | 6 +-- .../services/annotators/UniprotAnnotator.java | 6 +-- .../services/annotators/package-info.java | 2 +- .../services/ModelAnnotatorTest.java | 8 ++-- .../annotators/ElementAnnotatorTest.java | 4 +- .../annotators/ReconAnnotatorTest.java | 6 +-- .../celldesigner/annotation/NoteField.java | 24 +++++----- .../annotation/RestAnnotationParser.java | 22 ++++----- .../annotation/RestAnnotationParserTest.java | 4 +- .../bioEntity/BioEntityConverter.java | 14 +++--- .../bioEntity/BioEntityConverterImpl.java | 12 ++--- .../graphics/bioEntity/package-info.java | 2 +- .../mapviewer/commands/ColorModelCommand.java | 4 +- .../{AnnotatedObject.java => BioEntity.java} | 4 +- .../lcsb/mapviewer/model/map/MiriamType.java | 14 +++--- .../lcsb/mapviewer/model/map/model/Model.java | 10 ++-- .../model/map/model/ModelFullIndexed.java | 10 ++-- .../model/map/reaction/Reaction.java | 4 +- .../mapviewer/model/map/species/Element.java | 4 +- .../modelutils/map/ElementUtils.java | 28 +++++------ .../modelutils/map/RequireAnnotationMap.java | 8 ++-- .../model/map/model/ModelFullIndexedTest.java | 6 +-- .../mapviewer/model/map/model/ModelTest.java | 6 +-- .../modelutils/map/ElementUtilsTest.java | 4 +- .../wikipathway/XML/ModelToGPML.java | 4 +- .../mapviewer/reactome/utils/ElementUtil.java | 4 +- .../reactome/utils/ReactomeQueryUtil.java | 4 +- .../utils/comparators/ANodeComparator.java | 4 +- .../configuration/ConfigurationRestImpl.java | 6 +-- .../projects/chemicals/ChemicalRestImpl.java | 6 +-- .../api/projects/drugs/DrugRestImpl.java | 6 +-- .../api/projects/mirnas/MiRnaRestImpl.java | 6 +-- .../bioEntities/BioEntitiesRestImpl.java | 4 +- .../publications/PublicationsRestImpl.java | 16 +++---- .../services/impl/ProjectService.java | 6 +-- .../services/impl/SearchService.java | 12 ++--- .../services/interfaces/ISearchService.java | 4 +- .../services/search/ElementMatcher.java | 4 +- .../services/search/db/TargetViewFactory.java | 4 +- .../search/db/chemical/ChemicalService.java | 4 +- .../services/search/db/drug/DrugService.java | 4 +- .../search/db/mirna/MiRNAService.java | 4 +- .../services/utils/CreateProjectParams.java | 18 +++---- .../view/PubmedAnnotatedElementsView.java | 6 +-- .../PubmedAnnotatedElementsViewFactory.java | 6 +-- .../services/impl/ProjectServiceTest.java | 12 ++--- .../services/impl/SearchServiceTest.java | 12 ++--- 58 files changed, 252 insertions(+), 252 deletions(-) rename model/src/main/java/lcsb/mapviewer/model/map/{AnnotatedObject.java => BioEntity.java} (90%) diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ImproperAnnotations.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ImproperAnnotations.java index fdc6a03e96..ab1810dd4e 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ImproperAnnotations.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ImproperAnnotations.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.modelutils.map.ElementUtils; @@ -21,7 +21,7 @@ public class ImproperAnnotations implements ProblematicAnnotation { /** * Object improperly annotated. */ - private AnnotatedObject object; + private BioEntity object; /** * Wrong miriam data. @@ -29,7 +29,7 @@ public class ImproperAnnotations implements ProblematicAnnotation { private List<MiriamData> wrongAnnotations = new ArrayList<>(); /** - * Constructor that initializes the data with {@link #object annotated object} + * Constructor that initializes the data with {@link #object bioEntity} * and list of improper {@link MiriamData}. * * @param list @@ -37,7 +37,7 @@ public class ImproperAnnotations implements ProblematicAnnotation { * @param object * annotated object */ - public ImproperAnnotations(AnnotatedObject object, List<MiriamData> list) { + public ImproperAnnotations(BioEntity object, List<MiriamData> list) { if (list.size() == 0) { throw new InvalidArgumentException("List of improper annotations cannot be null"); } @@ -54,7 +54,7 @@ public class ImproperAnnotations implements ProblematicAnnotation { * @param object * annotated object */ - public ImproperAnnotations(AnnotatedObject object, MiriamData miriamData) { + public ImproperAnnotations(BioEntity object, MiriamData miriamData) { this.object = object; wrongAnnotations.add(miriamData); } diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingAnnotation.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingAnnotation.java index fa0918a248..64aa9a4bc1 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingAnnotation.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingAnnotation.java @@ -1,6 +1,6 @@ package lcsb.mapviewer.annotation.services; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.modelutils.map.ElementUtils; /** @@ -15,7 +15,7 @@ public class MissingAnnotation implements ProblematicAnnotation { /** * Object improperly annotated. */ - private AnnotatedObject object; + private BioEntity object; /** * Constructor that initializes the data with {@link #object annotated object} @@ -24,7 +24,7 @@ public class MissingAnnotation implements ProblematicAnnotation { * @param object * annotated object that miss annotation */ - public MissingAnnotation(AnnotatedObject object) { + public MissingAnnotation(BioEntity object) { this.object = object; } diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotations.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotations.java index 8d42181bf0..c6a40a2e92 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotations.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MissingRequiredAnnotations.java @@ -5,7 +5,7 @@ import java.util.Collection; import java.util.List; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.modelutils.map.ElementUtils; @@ -22,7 +22,7 @@ public class MissingRequiredAnnotations implements ProblematicAnnotation { /** * Object improperly annotated. */ - private AnnotatedObject object; + private BioEntity object; /** * Required miriam type. @@ -38,7 +38,7 @@ public class MissingRequiredAnnotations implements ProblematicAnnotation { * @param object * annotated object */ - public MissingRequiredAnnotations(AnnotatedObject object, Collection<MiriamType> list) { + public MissingRequiredAnnotations(BioEntity object, Collection<MiriamType> list) { if (list.size() == 0) { throw new InvalidArgumentException("List of improper annotations cannot be null"); } diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ModelAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ModelAnnotator.java index f7f3cc8d51..9808ebd014 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/ModelAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/ModelAnnotator.java @@ -27,7 +27,7 @@ import lcsb.mapviewer.annotation.services.annotators.ReconAnnotator; import lcsb.mapviewer.annotation.services.annotators.UniprotAnnotator; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -289,7 +289,7 @@ public class ModelAnnotator { } // annotate all reactions - for (AnnotatedObject element : model.getReactions()) { + for (BioEntity element : model.getReactions()) { List<ElementAnnotator> list = null; if (annotators != null) { list = annotators.get(element.getClass()); @@ -336,7 +336,7 @@ public class ModelAnnotator { * @return list of improper annotations */ public Collection<ImproperAnnotations> findImproperAnnotations(Model m, IProgressUpdater updater, - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> validAnnotations) { + Map<Class<? extends BioEntity>, Set<MiriamType>> validAnnotations) { if (validAnnotations == null) { logger.warn("List of valid annotations is missing. Using default."); validAnnotations = getDefaultValidClasses(); @@ -375,10 +375,10 @@ public class ModelAnnotator { * where we look for improper annotations * @param validClasses * list of {@link MiriamType miriam types} that are valid for a given - * {@link AnnotatedObject} + * {@link BioEntity} * @return list of improper annotations */ - protected List<ImproperAnnotations> findImproperAnnotations(AnnotatedObject element, Collection<MiriamType> validClasses) { + protected List<ImproperAnnotations> findImproperAnnotations(BioEntity element, Collection<MiriamType> validClasses) { List<ImproperAnnotations> result = new ArrayList<>(); for (MiriamData md : element.getMiriamData()) { boolean valid = false; @@ -406,7 +406,7 @@ public class ModelAnnotator { * * @return list of all elements that miss annotation */ - public Collection<ProblematicAnnotation> findMissingAnnotations(Model m, Map<Class<? extends AnnotatedObject>, Set<MiriamType>> requestedAnnotations) { + public Collection<ProblematicAnnotation> findMissingAnnotations(Model m, Map<Class<? extends BioEntity>, Set<MiriamType>> requestedAnnotations) { if (requestedAnnotations == null) { logger.warn("List of requested annotations is missing. Using default."); requestedAnnotations = getDefaultRequiredClasses(); @@ -428,7 +428,7 @@ public class ModelAnnotator { } /** - * Checks if {@link AnnotatedObject} is properly annotated and if not return + * Checks if {@link BioEntity} is properly annotated and if not return * info about missing annotation. * * @param element @@ -440,7 +440,7 @@ public class ModelAnnotator { * miriam * @return list of containing improper annotations about element */ - private List<ProblematicAnnotation> findMissing(AnnotatedObject element, Collection<MiriamType> requestedAnnotations) { + private List<ProblematicAnnotation> findMissing(BioEntity element, Collection<MiriamType> requestedAnnotations) { List<ProblematicAnnotation> result = new ArrayList<>(); // if there are no requested annotations then don't check if (requestedAnnotations == null) { @@ -567,14 +567,14 @@ public class ModelAnnotator { /** * Returns map with informations about default valid {@link MiriamType miriam - * types } for {@link AnnotatedObject} class type. + * types } for {@link BioEntity} class type. * * @return map with informations about valid {@link MiriamType miriam types } - * for {@link AnnotatedObject} class type + * for {@link BioEntity} class type */ @SuppressWarnings("unchecked") - public Map<Class<? extends AnnotatedObject>, Set<MiriamType>> getDefaultValidClasses() { - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> result = new HashMap<Class<? extends AnnotatedObject>, Set<MiriamType>>(); + public Map<Class<? extends BioEntity>, Set<MiriamType>> getDefaultValidClasses() { + Map<Class<? extends BioEntity>, Set<MiriamType>> result = new HashMap<Class<? extends BioEntity>, Set<MiriamType>>(); ElementUtils eu = new ElementUtils(); ClassTreeNode tree = eu.getAnnotatedElementClassTree(); @@ -583,7 +583,7 @@ public class ModelAnnotator { while (!nodes.isEmpty()) { ClassTreeNode node = nodes.poll(); Set<MiriamType> set = new HashSet<MiriamType>(); - Class<? extends AnnotatedObject> clazz = (Class<? extends AnnotatedObject>) node.getClazz(); + Class<? extends BioEntity> clazz = (Class<? extends BioEntity>) node.getClazz(); for (MiriamType mt : MiriamType.values()) { for (Class<?> clazz2 : mt.getValidClass()) { if (clazz2.isAssignableFrom(clazz)) { @@ -601,14 +601,14 @@ public class ModelAnnotator { /** * Returns map with informations about default required {@link MiriamType - * miriam types } for {@link AnnotatedObject} class type. + * miriam types } for {@link BioEntity} class type. * * @return map with informations about required {@link MiriamType miriam types - * * } for {@link AnnotatedObject} class type + * * } for {@link BioEntity} class type */ @SuppressWarnings("unchecked") - public Map<Class<? extends AnnotatedObject>, Set<MiriamType>> getDefaultRequiredClasses() { - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> result = new HashMap<>(); + public Map<Class<? extends BioEntity>, Set<MiriamType>> getDefaultRequiredClasses() { + Map<Class<? extends BioEntity>, Set<MiriamType>> result = new HashMap<>(); ElementUtils eu = new ElementUtils(); ClassTreeNode tree = eu.getAnnotatedElementClassTree(); @@ -617,7 +617,7 @@ public class ModelAnnotator { while (!nodes.isEmpty()) { ClassTreeNode node = nodes.poll(); Set<MiriamType> set = null; - Class<? extends AnnotatedObject> clazz = (Class<? extends AnnotatedObject>) node.getClazz(); + Class<? extends BioEntity> clazz = (Class<? extends BioEntity>) node.getClazz(); if ((Boolean) (node.getData())) { set = new HashSet<>(); for (MiriamType mt : MiriamType.values()) { diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java index 01d78102f9..de59bb3bcf 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/BiocompendiumAnnotator.java @@ -29,7 +29,7 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.converter.model.celldesigner.annotation.RestAnnotationParser; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.Protein; @@ -297,7 +297,7 @@ public class BiocompendiumAnnotator extends ElementAnnotator implements IExterna } @Override - public void annotateElement(AnnotatedObject element) throws AnnotatorException { + public void annotateElement(BioEntity element) throws AnnotatorException { if (isAnnotatable(element)) { try { String annotationString = getAnnotation(new MiriamData(MiriamType.HGNC_SYMBOL, element.getName())); diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java index bc37df5ec1..a95985e339 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ChebiAnnotator.java @@ -20,7 +20,7 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.comparator.StringSetComparator; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -76,7 +76,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length(); /** - * Class used for some simple operations on {@link AnnotatedObject} elements. + * Class used for some simple operations on {@link BioEntity} elements. */ private ElementUtils elementUtils = new ElementUtils(); @@ -438,7 +438,7 @@ public class ChebiAnnotator extends ElementAnnotator implements IExternalService } @Override - public void annotateElement(AnnotatedObject element) throws AnnotatorException { + public void annotateElement(BioEntity element) throws AnnotatorException { if (isAnnotatable(element)) { try { String warnPrefix = elementUtils.getElementTag(element, this); diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java index b47160d555..dde647a3bf 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java @@ -10,7 +10,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.annotation.cache.CachableInterface; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerChemical; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.reaction.Reaction; @@ -19,7 +19,7 @@ import lcsb.mapviewer.model.map.species.Element; import lcsb.mapviewer.model.map.species.Species; /** - * Interface that allows to annotate {@link AnnotatedObject elements} in the + * Interface that allows to annotate {@link BioEntity elements} in the * system. Different implementation use different resources to perform * annotation. They can annotate different types of elements. * @@ -37,7 +37,7 @@ public abstract class ElementAnnotator extends CachableInterface { * List of classes that can be annotated by this {@link IElementAnnotator * annotator}. */ - private final List<Class<? extends AnnotatedObject>> validClasses = new ArrayList<>(); + private final List<Class<? extends BioEntity>> validClasses = new ArrayList<>(); /** * Should be this annotator used as a default annotatior. @@ -58,11 +58,11 @@ public abstract class ElementAnnotator extends CachableInterface { public ElementAnnotator(Class<? extends CachableInterface> clazz, Class<?>[] validClasses, boolean isDefault) { super(clazz); for (Class<?> validClass : validClasses) { - if (AnnotatedObject.class.isAssignableFrom(validClass)) { - addValidClass((Class<? extends AnnotatedObject>) validClass); + if (BioEntity.class.isAssignableFrom(validClass)) { + addValidClass((Class<? extends BioEntity>) validClass); } else { throw new InvalidArgumentException( - "Cannot pass class of type: " + validClass + ". Only classes extending " + AnnotatedObject.class + " are accepted."); + "Cannot pass class of type: " + validClass + ". Only classes extending " + BioEntity.class + " are accepted."); } } this.isDefault = isDefault; @@ -77,14 +77,14 @@ public abstract class ElementAnnotator extends CachableInterface { * thrown when there is a problem with annotating not related to * data */ - public abstract void annotateElement(AnnotatedObject element) throws AnnotatorException; + public abstract void annotateElement(BioEntity element) throws AnnotatorException; /** * Returns a list of all classes that can be annotated using this annotator. * * @return a list of all classes that can be annotated using this annotator */ - public List<Class<? extends AnnotatedObject>> getValidClasses() { + public List<Class<? extends BioEntity>> getValidClasses() { return validClasses; } @@ -97,7 +97,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @return <code>true</code> if object can be annotated by this annotator, * <code>false</code> otherwise */ - public boolean isAnnotatable(AnnotatedObject object) { + public boolean isAnnotatable(BioEntity object) { Class<?> clazz = object.getClass(); for (Class<?> validClazz : getValidClasses()) { if (validClazz.isAssignableFrom(clazz)) { @@ -113,7 +113,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param clazz * class to add */ - private void addValidClass(Class<? extends AnnotatedObject> clazz) { + private void addValidClass(Class<? extends BioEntity> clazz) { validClasses.add(clazz); } @@ -167,7 +167,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param prefix * prefix used in warnings */ - protected void setSymbol(AnnotatedObject element, String symbol, String prefix) { + protected void setSymbol(BioEntity element, String symbol, String prefix) { if (element.getSymbol() == null || element.getSymbol().equals("") || element.getSymbol().equals(symbol)) { element.setSymbol(symbol); } else { @@ -188,7 +188,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param prefix * prefix used in warnings */ - protected void setSynonyms(AnnotatedObject element, Collection<String> synonyms, String prefix) { + protected void setSynonyms(BioEntity element, Collection<String> synonyms, String prefix) { if (element.getSynonyms() == null || element.getSynonyms().size() == 0) { List<String> sortedSynonyms = new ArrayList<>(); sortedSynonyms.addAll(synonyms); @@ -219,14 +219,14 @@ public abstract class ElementAnnotator extends CachableInterface { } /** - * Adds description to {@link AnnotatedObject#getNotes()}. + * Adds description to {@link BioEntity#getNotes()}. * * @param element * element where annotation should be added * @param description * value to set */ - protected void setDescription(AnnotatedObject element, String description) { + protected void setDescription(BioEntity element, String description) { if (element.getNotes() == null || element.getNotes().equals("") || element.getNotes().equals(description)) { element.setNotes(description); } else if (!element.getNotes().toLowerCase().contains(description.toLowerCase())) { @@ -242,7 +242,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param value * annotation identifier */ - protected void addHmdbMiriam(AnnotatedObject element, String value) { + protected void addHmdbMiriam(BioEntity element, String value) { element.addMiriamData(new MiriamData(MiriamType.HMDB, value)); } @@ -311,7 +311,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param value * annotation identifier */ - protected void addChebiMiriam(AnnotatedObject element, String value) { + protected void addChebiMiriam(BioEntity element, String value) { if (!value.startsWith("CHEBI:")) { value = "CHEBI:" + value; } @@ -346,7 +346,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param value * annotation identifier */ - protected void addPubchemMiriam(AnnotatedObject element, String value) { + protected void addPubchemMiriam(BioEntity element, String value) { element.addMiriamData(new MiriamData(MiriamType.PUBCHEM, value)); } @@ -358,7 +358,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param value * annotation identifier */ - protected void addCogMiriam(AnnotatedObject element, String value) { + protected void addCogMiriam(BioEntity element, String value) { element.addMiriamData(new MiriamData(MiriamType.COG, value)); } @@ -388,7 +388,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param value * annotation identifier */ - protected void addEcMiriam(AnnotatedObject element, String value) { + protected void addEcMiriam(BioEntity element, String value) { element.addMiriamData(new MiriamData(MiriamType.EC, value)); } @@ -403,7 +403,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param prefix * prefix used in warnings */ - protected void addKeggMiriam(AnnotatedObject element, String value, String prefix) { + protected void addKeggMiriam(BioEntity element, String value, String prefix) { if (value.startsWith("C")) { MiriamData md = new MiriamData(MiriamType.KEGG_COMPOUND, value); element.addMiriamData(md); @@ -419,7 +419,7 @@ public abstract class ElementAnnotator extends CachableInterface { } /** - * Sets {@link AnnotatedObject#getFormula()}. + * Sets {@link BioEntity#getFormula()}. * * @param element * element where annotation should be added @@ -428,7 +428,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param prefix * prefix used in warnings */ - protected void setFormula(AnnotatedObject element, String value, String prefix) { + protected void setFormula(BioEntity element, String value, String prefix) { if (element.getFormula() == null || element.getFormula().isEmpty() || element.getFormula().equals(value)) { element.setFormula(value); } else { @@ -437,7 +437,7 @@ public abstract class ElementAnnotator extends CachableInterface { } /** - * Sets {@link AnnotatedObject#getAbbreviation()}. + * Sets {@link BioEntity#getAbbreviation()}. * * @param element * element where annotation should be added @@ -446,7 +446,7 @@ public abstract class ElementAnnotator extends CachableInterface { * @param prefix * prefix used in warnings */ - protected void setAbbreviation(AnnotatedObject element, String value, String prefix) { + protected void setAbbreviation(BioEntity element, String value, String prefix) { if (element.getAbbreviation() == null || element.getAbbreviation().isEmpty() || element.getAbbreviation().equals(value)) { element.setAbbreviation(value); } else if (!element.getAbbreviation().contains(value)) { diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java index 3aed48d5ad..61233cb0ac 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EnsemblAnnotator.java @@ -17,7 +17,7 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.Element; @@ -153,7 +153,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi } @Override - public void annotateElement(AnnotatedObject element) throws AnnotatorException { + public void annotateElement(BioEntity element) throws AnnotatorException { if (isAnnotatable(element)) { ElementUtils eu = new ElementUtils(); String prefix = eu.getElementTag(element); @@ -186,7 +186,7 @@ public class EnsemblAnnotator extends ElementAnnotator implements IExternalServi * @throws AnnotatorException * thrown when there is a problem with annotating element */ - private void annotateElement(AnnotatedObject annotatedObject, MiriamData entrezMiriamData, String prefix) throws AnnotatorException { + private void annotateElement(BioEntity annotatedObject, MiriamData entrezMiriamData, String prefix) throws AnnotatorException { String query = REST_SERVICE_URL + entrezMiriamData.getResource() + URL_SUFFIX; try { String content = getWebPageContent(query); diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java index 350037bf73..7b61647b9f 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/EntrezAnnotator.java @@ -23,7 +23,7 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -148,7 +148,7 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic } @Override - public void annotateElement(AnnotatedObject element) throws AnnotatorException { + public void annotateElement(BioEntity element) throws AnnotatorException { if (isAnnotatable(element)) { ElementUtils eu = new ElementUtils(); String prefix = eu.getElementTag(element); @@ -181,7 +181,7 @@ public class EntrezAnnotator extends ElementAnnotator implements IExternalServic * @throws AnnotatorException * thrown when there is a problem with annotating element */ - private void annotateElement(AnnotatedObject element, MiriamData entrezMiriamData, String prefix) throws AnnotatorException { + private void annotateElement(BioEntity element, MiriamData entrezMiriamData, String prefix) throws AnnotatorException { EntrezData data = getEntrezForMiriamData(entrezMiriamData, prefix); if (data != null) { setSymbol(element, data.getSymbol(), prefix); diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java index a6ac2d4c67..c740c3f3fa 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/GoAnnotator.java @@ -21,7 +21,7 @@ import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.MiriamConnector; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -95,7 +95,7 @@ public class GoAnnotator extends ElementAnnotator implements IExternalService { } @Override - public void annotateElement(AnnotatedObject object) throws AnnotatorException { + public void annotateElement(BioEntity object) throws AnnotatorException { if (isAnnotatable(object)) { MiriamData goTerm = null; for (MiriamData md : object.getMiriamData()) { diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java index fdff86ed88..c4e5cb7b25 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/HgncAnnotator.java @@ -16,7 +16,7 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -109,7 +109,7 @@ public class HgncAnnotator extends ElementAnnotator implements IExternalService } @Override - public void annotateElement(AnnotatedObject element) throws AnnotatorException { + public void annotateElement(BioEntity element) throws AnnotatorException { if (isAnnotatable(element)) { ElementUtils eu = new ElementUtils(); String prefix = eu.getElementTag(element); diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java index 5de318adf2..3e26f3006a 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotator.java @@ -19,7 +19,7 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.common.EventStorageLoggerAppender; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Chemical; import lcsb.mapviewer.model.map.species.Element; @@ -46,7 +46,7 @@ public class ReconAnnotator extends ElementAnnotator implements IExternalService private static final String REACTION_ANNOTATION_URL_PREFIX = "http://vmh.uni.lu/_api/reactions/?page_size=10000&format=json&search="; /** - * Class used for some simple operations on {@link AnnotatedObject} elements. + * Class used for some simple operations on {@link BioEntity} elements. */ private ElementUtils elementUtils = new ElementUtils(); @@ -111,7 +111,7 @@ public class ReconAnnotator extends ElementAnnotator implements IExternalService } @Override - public void annotateElement(AnnotatedObject annotatedObject) throws AnnotatorException { + public void annotateElement(BioEntity annotatedObject) throws AnnotatorException { if (isAnnotatable(annotatedObject)) { String id = annotatedObject.getAbbreviation(); if (id == null || id.isEmpty()) { diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java index 583e80f30f..997494bd65 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/UniprotAnnotator.java @@ -17,7 +17,7 @@ import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.annotation.services.IExternalService; import lcsb.mapviewer.annotation.services.WrongResponseCodeIOException; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.Gene; @@ -49,7 +49,7 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi private Pattern uniprotToEntrez = Pattern.compile("DR[\\ ]+GeneID;\\ ([^;\\ ]+)"); /** - * Class used for some simple operations on {@link AnnotatedObject} elements. + * Class used for some simple operations on {@link BioEntity} elements. */ private ElementUtils elementUtils = new ElementUtils(); @@ -85,7 +85,7 @@ public class UniprotAnnotator extends ElementAnnotator implements IExternalServi } @Override - public void annotateElement(AnnotatedObject object) throws AnnotatorException { + public void annotateElement(BioEntity object) throws AnnotatorException { if (isAnnotatable(object)) { String uniprotId = object.getName(); boolean uniprotFound = false; diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/package-info.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/package-info.java index 7df99e6f7e..ceb28e6260 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/package-info.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/package-info.java @@ -1,6 +1,6 @@ /** * This package contains classes that can annotate - * {@link lcsb.mapviewer.model.map.AnnotatedObject} objects. General annotation + * {@link lcsb.mapviewer.model.map.BioEntity} objects. General annotation * interface is defined in * {@link lcsb.mapviewer.annotation.services.annotators.ElementAnnotator} class. * diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java index 77ef6574e8..17af451888 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/ModelAnnotatorTest.java @@ -30,7 +30,7 @@ import lcsb.mapviewer.annotation.services.annotators.ElementAnnotator; import lcsb.mapviewer.annotation.services.annotators.ReconAnnotator; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -287,7 +287,7 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions { public void testFindMissingAnnotations2() throws Exception { try { Model model = getModelForFile("testFiles/annotation/missingAnnotations.xml", false); - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> requestedAnnotations = new HashMap<>();; + Map<Class<? extends BioEntity>, Set<MiriamType>> requestedAnnotations = new HashMap<>();; requestedAnnotations.put(GenericProtein.class, new HashSet<>()); Collection<? extends ProblematicAnnotation> results = modelAnnotator.findMissingAnnotations(model, requestedAnnotations); assertEquals(1, results.size()); @@ -318,7 +318,7 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions { @Test public void testGetDefaultRequired() throws Exception { try { - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> map1 = modelAnnotator.getDefaultRequiredClasses(); + Map<Class<? extends BioEntity>, Set<MiriamType>> map1 = modelAnnotator.getDefaultRequiredClasses(); assertNotNull(map1); } catch (Exception e) { @@ -330,7 +330,7 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions { @Test public void testGetDefaultValid() throws Exception { try { - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> map2 = modelAnnotator.getDefaultValidClasses(); + Map<Class<? extends BioEntity>, Set<MiriamType>> map2 = modelAnnotator.getDefaultValidClasses(); assertNotNull(map2); } catch (Exception e) { diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java index 133858707a..a02974da7d 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotatorTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import lcsb.mapviewer.annotation.AnnotationTestFunctions; import lcsb.mapviewer.annotation.cache.CachableInterface; import lcsb.mapviewer.annotation.cache.SourceNotAvailable; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.GenericProtein; import lcsb.mapviewer.model.map.species.Ion; @@ -25,7 +25,7 @@ public class ElementAnnotatorTest extends AnnotationTestFunctions { } @Override - public void annotateElement(AnnotatedObject element) throws AnnotatorException { + public void annotateElement(BioEntity element) throws AnnotatorException { } @Override diff --git a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java index e7068cb3fa..78fe4d4a99 100644 --- a/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java +++ b/annotation/src/test/java/lcsb/mapviewer/annotation/services/annotators/ReconAnnotatorTest.java @@ -25,7 +25,7 @@ import lcsb.mapviewer.annotation.cache.SourceNotAvailable; import lcsb.mapviewer.annotation.cache.WebPageDownloader; import lcsb.mapviewer.annotation.services.ExternalServiceStatusType; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Ion; import lcsb.mapviewer.model.map.species.SimpleMolecule; @@ -161,11 +161,11 @@ public class ReconAnnotatorTest extends AnnotationTestFunctions { @Test public void testAnnotateUnknownElement() throws Exception { try { - AnnotatedObject obj = Mockito.mock(AnnotatedObject.class); + BioEntity obj = Mockito.mock(BioEntity.class); when(obj.getName()).thenReturn("O16G2e"); ReconAnnotator tweakedReconAnnotator = Mockito.spy(reconAnnotator); - doReturn(true).when(tweakedReconAnnotator).isAnnotatable(any(AnnotatedObject.class)); + doReturn(true).when(tweakedReconAnnotator).isAnnotatable(any(BioEntity.class)); tweakedReconAnnotator.annotateElement(obj); assertEquals(1, getWarnings().size()); diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java index f9ec3e0770..0f045c0b39 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/NoteField.java @@ -2,7 +2,7 @@ package lcsb.mapviewer.converter.model.celldesigner.annotation; import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerElement; import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerSpecies; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Element; @@ -18,37 +18,37 @@ public enum NoteField { /** * List of {@link MiriamType#HGNC} identifiers. */ - HGNC("HGNC_ID", AnnotatedObject.class, MiriamType.HGNC), // + HGNC("HGNC_ID", BioEntity.class, MiriamType.HGNC), // /** * List of {@link MiriamType#REFSEQ} identifiers. */ - REFSEQ("RefSeq_ID", AnnotatedObject.class, MiriamType.REFSEQ), // + REFSEQ("RefSeq_ID", BioEntity.class, MiriamType.REFSEQ), // /** * List of {@link MiriamType#ENTREZ} identifiers. */ - ENTREZ("EntrezGene_ID", AnnotatedObject.class, MiriamType.ENTREZ), // + ENTREZ("EntrezGene_ID", BioEntity.class, MiriamType.ENTREZ), // /** * List of {@link MiriamType#REACTOME} identifiers. */ - REACTOME("Reactome_ID", AnnotatedObject.class, MiriamType.REACTOME), // + REACTOME("Reactome_ID", BioEntity.class, MiriamType.REACTOME), // /** * List of {@link MiriamType#PUBMED} identifiers. */ - PUBMED("Pubmed_ID", AnnotatedObject.class, MiriamType.PUBMED), // + PUBMED("Pubmed_ID", BioEntity.class, MiriamType.PUBMED), // /** * List of {@link MiriamType#KEGG_GENES} identifiers. */ - KEGG_GENES("KEGG_ID", AnnotatedObject.class, MiriamType.KEGG_GENES), // + KEGG_GENES("KEGG_ID", BioEntity.class, MiriamType.KEGG_GENES), // /** * List of {@link MiriamType#PANTHER} identifiers. */ - PANTHER("PANTHER", AnnotatedObject.class, MiriamType.PANTHER), // + PANTHER("PANTHER", BioEntity.class, MiriamType.PANTHER), // /** * {@link Element#symbol}. @@ -63,7 +63,7 @@ public enum NoteField { /** * {@link Element#notes} or {@link Reaction#notes} . */ - DESCRIPTION("Description", AnnotatedObject.class, null), // + DESCRIPTION("Description", BioEntity.class, null), // /** * {@link Element#formerSymbols}. @@ -73,12 +73,12 @@ public enum NoteField { /** * {@link Element#synonyms} or {@link Reaction#synonyms}. */ - SYNONYMS("Synonyms", AnnotatedObject.class, null), // + SYNONYMS("Synonyms", BioEntity.class, null), // /** * {@link Element#abbreviation} or {@link Reaction#abbreviation}. */ - ABBREVIATION("Abbreviation", AnnotatedObject.class, null), // + ABBREVIATION("Abbreviation", BioEntity.class, null), // /** * {@link Reaction#formula}. @@ -123,7 +123,7 @@ public enum NoteField { /** * {@link Element#getSemanticZoomLevelVisibility()}. */ - SEMANTIC_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelVisibility", AnnotatedObject.class, null); // + SEMANTIC_ZOOM_LEVEL_VISIBILITY("SemanticZoomLevelVisibility", BioEntity.class, null); // /** * Name used in the notes to distinguish fields. diff --git a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParser.java b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParser.java index ccec089ae5..6838b61339 100644 --- a/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParser.java +++ b/converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParser.java @@ -24,7 +24,7 @@ import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerElement; import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerSpecies; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -58,7 +58,7 @@ public class RestAnnotationParser extends XmlParser { private XmlAnnotationParser xmlAnnotationParser = new XmlAnnotationParser(); /** - * Class used for some simple operations on {@link AnnotatedObject} elements. + * Class used for some simple operations on {@link BioEntity} elements. */ private ElementUtils elementUtils = new ElementUtils(); @@ -319,7 +319,7 @@ public class RestAnnotationParser extends XmlParser { * @param element * where the structural data should be put */ - public void processNotes(Node node, AnnotatedObject element) { + public void processNotes(Node node, BioEntity element) { String notes = getNotes(node); processNotes(notes, element); } @@ -360,7 +360,7 @@ public class RestAnnotationParser extends XmlParser { * @param annotationString * notes string */ - private void setSynonyms(AnnotatedObject element, String annotationString) { + private void setSynonyms(BioEntity element, String annotationString) { List<String> synonyms = getSynonyms(annotationString); if (synonyms.size() == 0) { return; @@ -433,7 +433,7 @@ public class RestAnnotationParser extends XmlParser { * @param annotationString * notes string */ - private void setAbbreviation(AnnotatedObject element, String annotationString) { + private void setAbbreviation(BioEntity element, String annotationString) { StringComparator stringComparator = new StringComparator(); String abbreviation = getParamByPrefix(annotationString, NoteField.ABBREVIATION.getCommonName() + ":"); if (abbreviation == null) { @@ -499,7 +499,7 @@ public class RestAnnotationParser extends XmlParser { * @param annotationString * notes string */ - private void setFormula(AnnotatedObject element, String annotationString) { + private void setFormula(BioEntity element, String annotationString) { StringComparator stringComparator = new StringComparator(); String formula = getParamByPrefix(annotationString, NoteField.FORMULA.getCommonName() + ":"); if (formula == null) { @@ -618,7 +618,7 @@ public class RestAnnotationParser extends XmlParser { * @param annotationString * notes string */ - private void setSymbol(AnnotatedObject element, String annotationString) { + private void setSymbol(BioEntity element, String annotationString) { String symbol = getParamByPrefix(annotationString, NoteField.SYMBOL.getCommonName() + ":"); if (symbol == null) { return; @@ -638,7 +638,7 @@ public class RestAnnotationParser extends XmlParser { * @param annotationString * notes string */ - private void setSemanticZoomLevelVisibility(AnnotatedObject element, String annotationString) { + private void setSemanticZoomLevelVisibility(BioEntity element, String annotationString) { String zoomLevelVisibility = getParamByPrefix(annotationString, NoteField.SEMANTIC_ZOOM_LEVEL_VISIBILITY.getCommonName() + ":"); if (zoomLevelVisibility == null) { return; @@ -663,7 +663,7 @@ public class RestAnnotationParser extends XmlParser { * @param annotationString * notes string */ - private void setNotes(AnnotatedObject element, String annotationString) { + private void setNotes(BioEntity element, String annotationString) { String description = getParamByPrefix(annotationString, NoteField.DESCRIPTION.getCommonName() + ":"); if (description == null) { return; @@ -685,7 +685,7 @@ public class RestAnnotationParser extends XmlParser { * @param object * where the structural data should be put */ - public void processNotes(String notes, AnnotatedObject object) { + public void processNotes(String notes, BioEntity object) { StringBuilder annotations = new StringBuilder(); String[] string = notes.split("\n"); @@ -747,7 +747,7 @@ public class RestAnnotationParser extends XmlParser { * @throws InvalidXmlSchemaException * thrown when there is a problem with xml */ - void processRdfDescription(AnnotatedObject element) throws InvalidXmlSchemaException { + void processRdfDescription(BioEntity element) throws InvalidXmlSchemaException { String notes = element.getNotes(); Matcher nodeMatcher = rdfNodePattern.matcher(notes); diff --git a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java index 6cca1af6e5..0195858815 100644 --- a/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java +++ b/converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParserTest.java @@ -23,7 +23,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerTestFunctions; import lcsb.mapviewer.converter.model.celldesigner.structure.CellDesignerElement; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -343,7 +343,7 @@ public class RestAnnotationParserTest extends CellDesignerTestFunctions { try { RestAnnotationParser parser = new RestAnnotationParser(); Document node = getXmlDocumentFromFile("testFiles/xmlNodeTestExamples/notes4.xml"); - parser.processNotes(node.getFirstChild(), new AnnotatedObject() { + parser.processNotes(node.getFirstChild(), new BioEntity() { /** * */ diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverter.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverter.java index 18ddccbf22..eaa090e296 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverter.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverter.java @@ -10,7 +10,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.converter.graphics.ConverterParams; import lcsb.mapviewer.converter.graphics.DrawingException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.layout.ColorSchema; import lcsb.mapviewer.model.map.reaction.AbstractNode; @@ -25,14 +25,14 @@ import lcsb.mapviewer.model.map.species.Species; /** * This interface defines what operations should be possible to convert - * {@link AnnotatedObject} into a graphics on Graphics2D object. + * {@link BioEntity} into a graphics on Graphics2D object. * * @author Piotr Gawron * * @param <T> * class of alias to convert */ -public abstract class BioEntityConverter<T extends AnnotatedObject> { +public abstract class BioEntityConverter<T extends BioEntity> { /** * Default class logger. @@ -50,7 +50,7 @@ public abstract class BioEntityConverter<T extends AnnotatedObject> { * This function draw representation of the alias on the graphics object. * * @param bioEntity - * {@link AnnotatedObject} that should be drawn + * {@link BioEntity} that should be drawn * @param graphics * where we want to draw bioEntity * @param params @@ -67,7 +67,7 @@ public abstract class BioEntityConverter<T extends AnnotatedObject> { * This function draw representation of the alias on the graphics object. * * @param bioEntity - * {@link AnnotatedObject} that should be drawn + * {@link BioEntity} that should be drawn * @param graphics * where we want to draw bioEntity * @param params @@ -144,7 +144,7 @@ public abstract class BioEntityConverter<T extends AnnotatedObject> { } /** - * Checks if {@link AnnotatedObject} is visible according to visualization + * Checks if {@link BioEntity} is visible according to visualization * given in params. * * @param bioEntity @@ -153,7 +153,7 @@ public abstract class BioEntityConverter<T extends AnnotatedObject> { * visualization params * @return true if object is visible */ - protected boolean isVisible(AnnotatedObject bioEntity, ConverterParams params) { + protected boolean isVisible(BioEntity bioEntity, ConverterParams params) { if (params.isSemanticZoomingOn()) { boolean result = matchLevel(params.getLevel(), bioEntity.getSemanticZoomLevelVisibility()); if (bioEntity instanceof Element) { diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverterImpl.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverterImpl.java index bb68987a1c..6f71c865dc 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverterImpl.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/BioEntityConverterImpl.java @@ -30,7 +30,7 @@ import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SBGNNucleicAc import lcsb.mapviewer.converter.graphics.bioEntity.element.species.SimpleMoleculeConverter; import lcsb.mapviewer.converter.graphics.bioEntity.element.species.UnknownConverter; import lcsb.mapviewer.converter.graphics.bioEntity.reaction.ReactionConverter; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.compartment.BottomSquareCompartment; import lcsb.mapviewer.model.map.compartment.LeftSquareCompartment; import lcsb.mapviewer.model.map.compartment.OvalCompartment; @@ -64,7 +64,7 @@ import lcsb.mapviewer.modelutils.map.ElementUtils; * @author Piotr Gawron * */ -public class BioEntityConverterImpl extends BioEntityConverter<AnnotatedObject> { +public class BioEntityConverterImpl extends BioEntityConverter<BioEntity> { /** * Default class logger. @@ -82,7 +82,7 @@ public class BioEntityConverterImpl extends BioEntityConverter<AnnotatedObject> * object that helps to convert overlay values into colors * @return converter that can be applied for the given element */ - private BioEntityConverter<? extends AnnotatedObject> getConverterForElement(AnnotatedObject element, ColorExtractor colorExtractor) { + private BioEntityConverter<? extends BioEntity> getConverterForElement(BioEntity element, ColorExtractor colorExtractor) { if (element == null) { throw new InvalidArgumentException("element cannot be null"); } @@ -151,7 +151,7 @@ public class BioEntityConverterImpl extends BioEntityConverter<AnnotatedObject> * @param sbgnFormat * boolean value indicating if SBGN display format should be used */ - public BioEntityConverterImpl(final AnnotatedObject element, final boolean sbgnFormat, ColorExtractor colorExtractor) { + public BioEntityConverterImpl(final BioEntity element, final boolean sbgnFormat, ColorExtractor colorExtractor) { // If element is a nucleic acid feature to be displayed in SBGN if (sbgnFormat && (element instanceof AntisenseRna || element instanceof Rna || element instanceof Gene)) { @@ -181,7 +181,7 @@ public class BioEntityConverterImpl extends BioEntityConverter<AnnotatedObject> @SuppressWarnings("unchecked") @Override - public void drawText(final AnnotatedObject element, final Graphics2D graphics, final ConverterParams params) throws DrawingException { + public void drawText(final BioEntity element, final Graphics2D graphics, final ConverterParams params) throws DrawingException { if (isVisible(element, params)) { elementConverter.drawText(element, graphics, params); } @@ -189,7 +189,7 @@ public class BioEntityConverterImpl extends BioEntityConverter<AnnotatedObject> @SuppressWarnings("unchecked") @Override - public void draw(AnnotatedObject element, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas) { + public void draw(BioEntity element, Graphics2D graphics, ConverterParams params, List<ColorSchema> visualizedLayoutsColorSchemas) { if (isVisible(element, params)) { elementConverter.draw(element, graphics, params, visualizedLayoutsColorSchemas); } diff --git a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/package-info.java b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/package-info.java index 128760d664..1c4360d074 100644 --- a/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/package-info.java +++ b/converter-graphics/src/main/java/lcsb/mapviewer/converter/graphics/bioEntity/package-info.java @@ -1,5 +1,5 @@ /** - * Provides classes that draws {@link lcsb.mapviewer.model.map.AnnotatedObject + * Provides classes that draws {@link lcsb.mapviewer.model.map.BioEntity * BioEntites} on the Graphics2D object. */ package lcsb.mapviewer.converter.graphics.bioEntity; diff --git a/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java b/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java index 427c7f7721..ceb5a31f73 100644 --- a/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java +++ b/model-command/src/main/java/lcsb/mapviewer/commands/ColorModelCommand.java @@ -12,7 +12,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.model.graphics.ArrowTypeData; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -56,7 +56,7 @@ public class ColorModelCommand extends ModelCommand { private ColorExtractor colorExtractor; /** - * Util class for all {@link AnnotatedObject} elements. + * Util class for all {@link BioEntity} elements. */ private ElementUtils eu = new ElementUtils(); diff --git a/model/src/main/java/lcsb/mapviewer/model/map/AnnotatedObject.java b/model/src/main/java/lcsb/mapviewer/model/map/BioEntity.java similarity index 90% rename from model/src/main/java/lcsb/mapviewer/model/map/AnnotatedObject.java rename to model/src/main/java/lcsb/mapviewer/model/map/BioEntity.java index 2a9ec585d0..eb2f82d237 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/AnnotatedObject.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/BioEntity.java @@ -5,12 +5,12 @@ import java.util.Collection; import java.util.List; /** - * Interface that describes object that can be annotated. + * Interface that describes bio entity on the map (like Protein or Reaction). * * @author Piotr Gawron * */ -public interface AnnotatedObject extends Serializable { +public interface BioEntity extends Serializable { /** * Returns list of {@link MiriamData annotations} for the object. * diff --git a/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java b/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java index ad34aaa372..cd8b930f17 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java @@ -306,7 +306,7 @@ public enum MiriamType { PUBMED("PubMed", // "http://www.ncbi.nlm.nih.gov/PubMed/", // new String[] { "urn:miriam:pubmed" }, // - new Class<?>[] { AnnotatedObject.class }, "MIR:00000015", // + new Class<?>[] { BioEntity.class }, "MIR:00000015", // new Class<?>[] { Reaction.class }), // /** @@ -447,13 +447,13 @@ public enum MiriamType { /** * Classes that can be annotated by this resource. */ - private List<Class<? extends AnnotatedObject>> validClass = new ArrayList<>(); + private List<Class<? extends BioEntity>> validClass = new ArrayList<>(); /** * When class from this list is marked as "require at least one annotation" * then annotation of this type is valid. */ - private List<Class<? extends AnnotatedObject>> requiredClass = new ArrayList<>(); + private List<Class<? extends BioEntity>> requiredClass = new ArrayList<>(); /** * Constructor that initialize enum object. @@ -496,10 +496,10 @@ public enum MiriamType { this.uris.add(string); } for (Class<?> clazz : classes) { - this.validClass.add((Class<? extends AnnotatedObject>) clazz); + this.validClass.add((Class<? extends BioEntity>) clazz); } for (Class<?> clazz : requiredClasses) { - this.requiredClass.add((Class<? extends AnnotatedObject>) clazz); + this.requiredClass.add((Class<? extends BioEntity>) clazz); } this.registryIdentifier = registryIdentifier; } @@ -542,7 +542,7 @@ public enum MiriamType { * * @return {@link #validClass} */ - public List<Class<? extends AnnotatedObject>> getValidClass() { + public List<Class<? extends BioEntity>> getValidClass() { return validClass; } @@ -584,7 +584,7 @@ public enum MiriamType { * @return the requiredClass * @see #requiredClass */ - public List<Class<? extends AnnotatedObject>> getRequiredClass() { + public List<Class<? extends BioEntity>> getRequiredClass() { return requiredClass; } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java b/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java index 9d1b4cc137..aaf297002e 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/Model.java @@ -6,7 +6,7 @@ import java.util.List; import java.util.Set; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.compartment.Compartment; @@ -323,7 +323,7 @@ public interface Model { * {@link MiriamData} * @return list of elements */ - Set<AnnotatedObject> getElementsByAnnotation(MiriamData miriamData); + Set<BioEntity> getElementsByAnnotation(MiriamData miriamData); /** * Returns list of elements with given name. @@ -622,10 +622,10 @@ public interface Model { void setId(int id); /** - * Return list od all {@link AnnotatedObject} in the map. This includes all + * Return list od all {@link BioEntity} in the map. This includes all * {@link Reaction reactions} and {@link Element elements}. * - * @return list od all {@link AnnotatedObject} in the map + * @return list od all {@link BioEntity} in the map */ - List<AnnotatedObject> getAnnotatedObjects(); + List<BioEntity> getAnnotatedObjects(); } diff --git a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java index 86704ddf5d..0877d492b8 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/model/ModelFullIndexed.java @@ -14,7 +14,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.OverviewImage; import lcsb.mapviewer.model.map.OverviewImageLink; @@ -312,8 +312,8 @@ public class ModelFullIndexed implements Model { } @Override - public Set<AnnotatedObject> getElementsByAnnotation(MiriamData miriamData) { - Set<AnnotatedObject> result = new HashSet<>(); + public Set<BioEntity> getElementsByAnnotation(MiriamData miriamData) { + Set<BioEntity> result = new HashSet<>(); for (Element element : getElements()) { for (MiriamData md : element.getMiriamData()) { if (md.equals(miriamData)) { @@ -660,8 +660,8 @@ public class ModelFullIndexed implements Model { } @Override - public List<AnnotatedObject> getAnnotatedObjects() { - List<AnnotatedObject> result = new ArrayList<>(); + public List<BioEntity> getAnnotatedObjects() { + List<BioEntity> result = new ArrayList<>(); result.addAll(getElements()); result.addAll(getReactions()); return result; diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java index c1eb4a0944..6a2fafcf6b 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java @@ -38,7 +38,7 @@ import org.hibernate.annotations.IndexColumn; import lcsb.mapviewer.common.exception.NotImplementedException; import lcsb.mapviewer.common.geometry.LineTransformation; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelData; @@ -74,7 +74,7 @@ import lcsb.mapviewer.model.map.species.Element; @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "reaction_type_db", discriminatorType = DiscriminatorType.STRING) @DiscriminatorValue("GENERIC_REACTION") -public class Reaction implements AnnotatedObject { +public class Reaction implements BioEntity { /** * diff --git a/model/src/main/java/lcsb/mapviewer/model/map/species/Element.java b/model/src/main/java/lcsb/mapviewer/model/map/species/Element.java index 8cfbc8cc39..01688104f1 100644 --- a/model/src/main/java/lcsb/mapviewer/model/map/species/Element.java +++ b/model/src/main/java/lcsb/mapviewer/model/map/species/Element.java @@ -38,7 +38,7 @@ import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.IndexColumn; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.SearchIndex; import lcsb.mapviewer.model.map.compartment.Compartment; @@ -61,7 +61,7 @@ import lcsb.mapviewer.model.map.model.ModelData; @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "element_type_db", discriminatorType = DiscriminatorType.STRING) @DiscriminatorValue("GENERIC_ALIAS") -public abstract class Element implements AnnotatedObject, Serializable { +public abstract class Element implements BioEntity, Serializable { /** * diff --git a/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java b/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java index 99b971e274..5b6b011b97 100644 --- a/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java +++ b/model/src/main/java/lcsb/mapviewer/modelutils/map/ElementUtils.java @@ -12,12 +12,12 @@ import org.apache.log4j.Logger; import org.reflections.Reflections; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Element; /** - * Class with some util method for {@link AnnotatedObject} objects. + * Class with some util method for {@link BioEntity} objects. * * @author Piotr Gawron * @@ -25,7 +25,7 @@ import lcsb.mapviewer.model.map.species.Element; public final class ElementUtils { /** - * This object contains inheritance tree for {@link AnnotatedObject} + * This object contains inheritance tree for {@link BioEntity} * interface. */ private static ClassTreeNode annotatedObjectTree = null; @@ -49,19 +49,19 @@ public final class ElementUtils { private final Logger logger = Logger.getLogger(ElementUtils.class); /** - * This method return tag that identifies {@link AnnotatedObject}. This tag + * This method return tag that identifies {@link BioEntity}. This tag * should be used in warning messages. * * @param element * tag for this element is created * @return tag that identifies element */ - public String getElementTag(AnnotatedObject element) { + public String getElementTag(BioEntity element) { return getElementTag(element, null); } /** - * This method return tag that identifies {@link AnnotatedObject}. This tag + * This method return tag that identifies {@link BioEntity}. This tag * should be used in warning messages. * * @param element @@ -71,7 +71,7 @@ public final class ElementUtils { * null (in such situation it will be skipped in the tag) * @return tag that identifies element */ - public String getElementTag(AnnotatedObject element, Object annotator) { + public String getElementTag(BioEntity element, Object annotator) { String id = null; if (element instanceof Element) { id = ((Element) element).getElementId(); @@ -95,14 +95,14 @@ public final class ElementUtils { public ClassTreeNode getAnnotatedElementClassTree() { if (annotatedObjectTree == null) { Reflections reflections = new Reflections("lcsb.mapviewer.model.map"); - Set<Class<? extends AnnotatedObject>> classes = reflections.getSubTypesOf(AnnotatedObject.class); + Set<Class<? extends BioEntity>> classes = reflections.getSubTypesOf(BioEntity.class); - annotatedObjectTree = new ClassTreeNode(AnnotatedObject.class); + annotatedObjectTree = new ClassTreeNode(BioEntity.class); annotatedObjectTree.setData(false); Map<Class<?>, ClassTreeNode> map = new HashMap<Class<?>, ClassTreeNode>(); map.put(Object.class, annotatedObjectTree); - for (Class<? extends AnnotatedObject> class1 : classes) { + for (Class<? extends BioEntity> class1 : classes) { if (map.get(class1) == null) { ClassTreeNode node = new ClassTreeNode(class1); // set information if the class annotation should be required @@ -114,7 +114,7 @@ public final class ElementUtils { map.put(class1, node); } } - for (Class<? extends AnnotatedObject> class1 : classes) { + for (Class<? extends BioEntity> class1 : classes) { ClassTreeNode parent = map.get(class1.getSuperclass()); ClassTreeNode child = map.get(class1); parent.getChildren().add(child); @@ -123,7 +123,7 @@ public final class ElementUtils { // set information if the class annotation should be required for children // classes (if not explicitly set in child then inherit it from parent) - for (Class<? extends AnnotatedObject> class1 : classes) { + for (Class<? extends BioEntity> class1 : classes) { ClassTreeNode child = map.get(class1); Boolean value = (Boolean) child.getData(); if (value == null) { @@ -207,12 +207,12 @@ public final class ElementUtils { } /** - * Returns a {@link Class} that extends {@link AnnotatedObject} for a given + * Returns a {@link Class} that extends {@link BioEntity} for a given * name. * * @param name * name of the class - * @return {@link Class} that extends {@link AnnotatedObject} for a given name + * @return {@link Class} that extends {@link BioEntity} for a given name */ public Class<?> getClassByName(String name) { if (elementClasses == null) { diff --git a/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java b/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java index 2a844090f0..e52647e901 100644 --- a/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java +++ b/model/src/main/java/lcsb/mapviewer/modelutils/map/RequireAnnotationMap.java @@ -1,6 +1,6 @@ package lcsb.mapviewer.modelutils.map; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.AntisenseRna; import lcsb.mapviewer.model.map.species.Chemical; @@ -12,7 +12,7 @@ import lcsb.mapviewer.model.map.species.Protein; import lcsb.mapviewer.model.map.species.Rna; /** - * List of {@link AnnotatedObject} that must be annototed with at least one + * List of {@link BioEntity} that must be annototed with at least one * {@link lcsb.mapviewer.model.map.MiriamData}. * * @author Piotr Gawron @@ -68,7 +68,7 @@ public enum RequireAnnotationMap { /** * Class which should be annotated. */ - private Class<? extends AnnotatedObject> clazz; + private Class<? extends BioEntity> clazz; /** * Default constructor. @@ -76,7 +76,7 @@ public enum RequireAnnotationMap { * @param clazz * {@link #clazz} */ - RequireAnnotationMap(Class<? extends AnnotatedObject> clazz) { + RequireAnnotationMap(Class<? extends BioEntity> clazz) { this.clazz = clazz; } diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java index 10f5c549e4..869ff766de 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelFullIndexedTest.java @@ -22,7 +22,7 @@ import org.mockito.Mockito; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.OverviewImage; @@ -525,7 +525,7 @@ public class ModelFullIndexedTest { reaction.addMiriamData(new MiriamData(MiriamType.CAS, "C")); model.addReaction(reaction); - Set<AnnotatedObject> objects = model.getElementsByAnnotation(new MiriamData()); + Set<BioEntity> objects = model.getElementsByAnnotation(new MiriamData()); assertEquals(0, objects.size()); objects = model.getElementsByAnnotation(new MiriamData(MiriamType.CAS, "C")); assertTrue(objects.contains(reaction)); @@ -850,7 +850,7 @@ public class ModelFullIndexedTest { Species protein = new GenericProtein("2"); model.addElement(protein); - Collection<AnnotatedObject> obj = model.getAnnotatedObjects(); + Collection<BioEntity> obj = model.getAnnotatedObjects(); assertEquals(2, obj.size()); } catch (Exception e) { diff --git a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java index 93808c4c64..2d3078e3da 100644 --- a/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java +++ b/model/src/test/java/lcsb/mapviewer/model/map/model/ModelTest.java @@ -14,7 +14,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -124,10 +124,10 @@ public class ModelTest { try { model = createModel(); - Set<AnnotatedObject> elements = model.getElementsByAnnotation(new MiriamData(MiriamRelationType.BQ_MODEL_IS, MiriamType.CHEMBL_TARGET, "CHEMBL12345")); + Set<BioEntity> elements = model.getElementsByAnnotation(new MiriamData(MiriamRelationType.BQ_MODEL_IS, MiriamType.CHEMBL_TARGET, "CHEMBL12345")); assertNotNull(elements); assertEquals(1, elements.size()); - AnnotatedObject element = elements.iterator().next(); + BioEntity element = elements.iterator().next(); assertTrue(element instanceof Species); Species species = (Species) element; assertEquals("s5", species.getName()); diff --git a/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java b/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java index 41ef01ea86..2d2432d186 100644 --- a/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java +++ b/model/src/test/java/lcsb/mapviewer/modelutils/map/ElementUtilsTest.java @@ -19,7 +19,7 @@ import org.mockito.Mockito; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.reaction.type.UnknownNegativeInfluenceReaction; import lcsb.mapviewer.model.map.species.Element; @@ -99,7 +99,7 @@ public class ElementUtilsTest { try { ElementUtils elementUtils = new ElementUtils(); - AnnotatedObject element = Mockito.mock(AnnotatedObject.class); + BioEntity element = Mockito.mock(BioEntity.class); assertNotNull(elementUtils.getElementTag(element)); fail("Exception expected"); } catch (NotImplementedException e) { diff --git a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelToGPML.java b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelToGPML.java index 8335585644..577b87b38f 100644 --- a/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelToGPML.java +++ b/pathvisio/src/main/java/lcsb/mapviewer/wikipathway/XML/ModelToGPML.java @@ -10,7 +10,7 @@ import org.apache.log4j.Logger; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.converter.ConverterException; import lcsb.mapviewer.model.graphics.PolylineData; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.compartment.Compartment; import lcsb.mapviewer.model.map.compartment.OvalCompartment; @@ -591,7 +591,7 @@ public class ModelToGPML { gpml.append(getComparments(model)); gpml.append(groups); Set<MiriamData> set = new HashSet<>(); - for (AnnotatedObject element : model.getAnnotatedObjects()) { + for (BioEntity element : model.getAnnotatedObjects()) { set.addAll(element.getMiriamData()); } diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java index f8bb0ad229..e348315d22 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ElementUtil.java @@ -12,7 +12,7 @@ import lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator; import lcsb.mapviewer.annotation.services.annotators.ChebiSearchException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.Element; @@ -33,7 +33,7 @@ public class ElementUtil { * element to be identified * @return human readable id of the element from paramter */ - public String getElementTag(AnnotatedObject element) { + public String getElementTag(BioEntity element) { return new ElementUtils().getElementTag(element); } diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactomeQueryUtil.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactomeQueryUtil.java index e73db35d17..6618c911d6 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactomeQueryUtil.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/ReactomeQueryUtil.java @@ -18,7 +18,7 @@ import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -92,7 +92,7 @@ public class ReactomeQueryUtil { * element for which we want id string. * @return human readable id of element */ - public String getElementTag(AnnotatedObject element) { + public String getElementTag(BioEntity element) { return new ElementUtils().getElementTag(element); } diff --git a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ANodeComparator.java b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ANodeComparator.java index a7bf80f52d..1d907e1c4c 100644 --- a/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ANodeComparator.java +++ b/reactome/src/main/java/lcsb/mapviewer/reactome/utils/comparators/ANodeComparator.java @@ -8,7 +8,7 @@ import org.springframework.transaction.annotation.Transactional; import lcsb.mapviewer.annotation.services.annotators.ChebiAnnotator; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.species.Element; import lcsb.mapviewer.modelutils.map.ElementUtils; @@ -239,7 +239,7 @@ public abstract class ANodeComparator<T extends Element, U extends ReactomeDatab * element to be transformed into string id * @return short string description identifing element */ - public String getElementTag(AnnotatedObject element) { + public String getElementTag(BioEntity element) { return new ElementUtils().getElementTag(element); } diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/configuration/ConfigurationRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/configuration/ConfigurationRestImpl.java index 13560acbd5..7d5a66c649 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/configuration/ConfigurationRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/configuration/ConfigurationRestImpl.java @@ -21,7 +21,7 @@ import lcsb.mapviewer.converter.graphics.AbstractImageGenerator; import lcsb.mapviewer.converter.graphics.ImageGenerators; import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser; import lcsb.mapviewer.converter.model.sbgnml.SbgnmlXmlConverter; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Element; import lcsb.mapviewer.modelutils.map.ClassTreeNode; @@ -145,9 +145,9 @@ public class ConfigurationRestImpl { if (!Modifier.isAbstract(clazz.getClazz().getModifiers())) { try { if (elementClass.isAssignableFrom(Reaction.class)) { - result.add(((AnnotatedObject) (clazz.getClazz().getDeclaredConstructor().newInstance())).getStringType()); + result.add(((BioEntity) (clazz.getClazz().getDeclaredConstructor().newInstance())).getStringType()); } else { - result.add(((AnnotatedObject) (clazz.getClazz().getDeclaredConstructor(String.class).newInstance("id"))).getStringType()); + result.add(((BioEntity) (clazz.getClazz().getDeclaredConstructor(String.class).newInstance("id"))).getStringType()); } } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | java.lang.SecurityException e) { diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java index 93febcd23c..44ae848353 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/chemicals/ChemicalRestImpl.java @@ -16,7 +16,7 @@ import lcsb.mapviewer.annotation.services.TaxonomyBackend; import lcsb.mapviewer.api.QueryException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; @@ -172,7 +172,7 @@ public class ChemicalRestImpl { List<Map<String, Object>> targetedObjects = new ArrayList<>(); for (Model model : models) { - for (AnnotatedObject object : model.getAnnotatedObjects()) { + for (BioEntity object : model.getAnnotatedObjects()) { if (elementMatcher.elementMatch(target, object)) { Map<String, Object> elementMapping = new HashMap<>(); @@ -189,7 +189,7 @@ public class ChemicalRestImpl { return result; } - private String getType(AnnotatedObject object) { + private String getType(BioEntity object) { if (object instanceof Reaction) { return ElementIdentifierType.REACTION.getJsName(); } else if (object instanceof Element) { diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/drugs/DrugRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/drugs/DrugRestImpl.java index 75f01d1125..2e779e8261 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/drugs/DrugRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/drugs/DrugRestImpl.java @@ -16,7 +16,7 @@ import lcsb.mapviewer.annotation.services.TaxonomyBackend; import lcsb.mapviewer.api.QueryException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; @@ -166,7 +166,7 @@ public class DrugRestImpl { List<Map<String, Object>> targetedObjects = new ArrayList<>(); for (Model model : models) { - for (AnnotatedObject object : model.getAnnotatedObjects()) { + for (BioEntity object : model.getAnnotatedObjects()) { if (elementMatcher.elementMatch(target, object)) { Map<String, Object> elementMapping = new HashMap<>(); @@ -183,7 +183,7 @@ public class DrugRestImpl { return result; } - private String getType(AnnotatedObject object) { + private String getType(BioEntity object) { if (object instanceof Reaction) { return ElementIdentifierType.REACTION.getJsName(); } else if (object instanceof Element) { diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/mirnas/MiRnaRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/mirnas/MiRnaRestImpl.java index c597bcd689..8ef791e3ad 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/mirnas/MiRnaRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/mirnas/MiRnaRestImpl.java @@ -16,7 +16,7 @@ import lcsb.mapviewer.annotation.services.TaxonomyBackend; import lcsb.mapviewer.api.QueryException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.reaction.Reaction; @@ -159,7 +159,7 @@ public class MiRnaRestImpl { List<Map<String, Object>> targetedObjects = new ArrayList<>(); for (Model model : models) { - for (AnnotatedObject object : model.getAnnotatedObjects()) { + for (BioEntity object : model.getAnnotatedObjects()) { if (elementMatcher.elementMatch(target, object)) { Map<String, Object> elementMapping = new HashMap<>(); @@ -176,7 +176,7 @@ public class MiRnaRestImpl { return result; } - private String getType(AnnotatedObject object) { + private String getType(BioEntity object) { if (object instanceof Reaction) { return ElementIdentifierType.REACTION.getJsName(); } else if (object instanceof Element) { diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/bioEntities/BioEntitiesRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/bioEntities/BioEntitiesRestImpl.java index 599e6256c9..b2b1dd3884 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/bioEntities/BioEntitiesRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/bioEntities/BioEntitiesRestImpl.java @@ -10,7 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import lcsb.mapviewer.api.BaseRestImpl; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.services.SecurityException; import lcsb.mapviewer.services.UserAccessException; @@ -61,7 +61,7 @@ public class BioEntitiesRestImpl extends BaseRestImpl { Model submodel = model.getSubmodelById(modelId); - List<AnnotatedObject> elements = searchService.getClosestElements(submodel, coordinates, count, perfectMatch.equalsIgnoreCase("true")); + List<BioEntity> elements = searchService.getClosestElements(submodel, coordinates, count, perfectMatch.equalsIgnoreCase("true")); for (Object object : elements) { Map<String, Object> result = createMinifiedSearchResult(object); resultMap.add(result); diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/publications/PublicationsRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/publications/PublicationsRestImpl.java index 50f9b69189..23184a3296 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/publications/PublicationsRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/models/publications/PublicationsRestImpl.java @@ -16,7 +16,7 @@ import org.springframework.transaction.annotation.Transactional; import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.api.BaseRestImpl; import lcsb.mapviewer.api.QueryException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -52,13 +52,13 @@ public class PublicationsRestImpl extends BaseRestImpl { @Autowired private OverviewImageViewFactory factory; - public SortedMap<MiriamData, List<AnnotatedObject>> getPublications(List<Model> models) { - SortedMap<MiriamData, List<AnnotatedObject>> publications = new TreeMap<>(); + public SortedMap<MiriamData, List<BioEntity>> getPublications(List<Model> models) { + SortedMap<MiriamData, List<BioEntity>> publications = new TreeMap<>(); for (Model modelData : models) { for (Element element : modelData.getElements()) { for (MiriamData md : element.getMiriamData()) { if (md.getDataType().equals(MiriamType.PUBMED)) { - List<AnnotatedObject> list = publications.get(md); + List<BioEntity> list = publications.get(md); if (list == null) { list = new ArrayList<>(); publications.put(md, list); @@ -70,7 +70,7 @@ public class PublicationsRestImpl extends BaseRestImpl { for (Reaction reaction : modelData.getReactions()) { for (MiriamData md : reaction.getMiriamData()) { if (md.getDataType().equals(MiriamType.PUBMED)) { - List<AnnotatedObject> list = publications.get(md); + List<BioEntity> list = publications.get(md); if (list == null) { list = new ArrayList<>(); publications.put(md, list); @@ -159,16 +159,16 @@ public class PublicationsRestImpl extends BaseRestImpl { Integer start = Math.max(0, Integer.valueOf(startString)); List<Map<String, Object>> resultList = new ArrayList<>(); - SortedMap<MiriamData, List<AnnotatedObject>> publications = getPublications(models); + SortedMap<MiriamData, List<BioEntity>> publications = getPublications(models); int index = 0; Set<String> columns = new HashSet<>(); columns.add("id"); columns.add("type"); columns.add("modelid"); - for (Map.Entry<MiriamData, List<AnnotatedObject>> entry : publications.entrySet()) { + for (Map.Entry<MiriamData, List<BioEntity>> entry : publications.entrySet()) { if (index >= start && index < start + length) { List<Object> elements = new ArrayList<>(); - for (AnnotatedObject object : entry.getValue()) { + for (BioEntity object : entry.getValue()) { elements.add(createMinifiedSearchResult(object)); } diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java b/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java index 212e7360c7..272848fa2a 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/ProjectService.java @@ -58,7 +58,7 @@ import lcsb.mapviewer.converter.zip.ZipEntryFile; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.ProjectStatus; import lcsb.mapviewer.model.log.LogType; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.graph.DataMining; @@ -1328,8 +1328,8 @@ public class ProjectService implements IProjectService { ClassTreeNode top = elementUtils.getAnnotatedElementClassTree(); - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> validMiriam = modelAnnotator.getDefaultValidClasses(); - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> requiredMiriam = modelAnnotator.getDefaultRequiredClasses(); + Map<Class<? extends BioEntity>, Set<MiriamType>> validMiriam = modelAnnotator.getDefaultValidClasses(); + Map<Class<? extends BioEntity>, Set<MiriamType>> requiredMiriam = modelAnnotator.getDefaultRequiredClasses(); Queue<ClassTreeNode> nodes = new LinkedList<ClassTreeNode>(); nodes.add(top); diff --git a/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java b/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java index c99199d01e..fdc2a74e6e 100644 --- a/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java +++ b/service/src/main/java/lcsb/mapviewer/services/impl/SearchService.java @@ -18,7 +18,7 @@ import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidClassException; import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.SearchIndex; @@ -494,7 +494,7 @@ public class SearchService implements ISearchService { */ private List<IHeavyView> searchByMiriam(Model model, MiriamData md, int limit) { List<IHeavyView> result = new ArrayList<>(); - for (AnnotatedObject obj : model.getElementsByAnnotation(md)) { + for (BioEntity obj : model.getElementsByAnnotation(md)) { if (result.size() >= limit) { break; } @@ -527,8 +527,8 @@ public class SearchService implements ISearchService { } @Override - public List<AnnotatedObject> getClosestElements(Model model, Point2D point, int numberOfElements, boolean perfectHit) { - List<AnnotatedObject> result = new ArrayList<>(); + public List<BioEntity> getClosestElements(Model model, Point2D point, int numberOfElements, boolean perfectHit) { + List<BioEntity> result = new ArrayList<>(); // probably this could be improved algorithmitically, right now all objects // are sorted by distance, and numberOfElements closest are chosen as a list @@ -566,7 +566,7 @@ public class SearchService implements ISearchService { /** * Reference to the object. */ - private AnnotatedObject reference; + private BioEntity reference; /** * Distance between the object and some point. @@ -628,7 +628,7 @@ public class SearchService implements ISearchService { * @return the reference * @see #reference */ - public AnnotatedObject getReference() { + public BioEntity getReference() { return reference; } diff --git a/service/src/main/java/lcsb/mapviewer/services/interfaces/ISearchService.java b/service/src/main/java/lcsb/mapviewer/services/interfaces/ISearchService.java index ba82510d70..c32dee9143 100644 --- a/service/src/main/java/lcsb/mapviewer/services/interfaces/ISearchService.java +++ b/service/src/main/java/lcsb/mapviewer/services/interfaces/ISearchService.java @@ -5,7 +5,7 @@ import java.util.List; import org.apache.log4j.Logger; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.ModelSubmodelConnection; @@ -296,7 +296,7 @@ public interface ISearchService { * how many closest elements should be returned * @return list of the closest elements */ - List<AnnotatedObject> getClosestElements(Model model, Point2D point, int numberOfElements, boolean perfectHit); + List<BioEntity> getClosestElements(Model model, Point2D point, int numberOfElements, boolean perfectHit); /** * Returns list of autocomplete strings for the partial query. diff --git a/service/src/main/java/lcsb/mapviewer/services/search/ElementMatcher.java b/service/src/main/java/lcsb/mapviewer/services/search/ElementMatcher.java index fef2d1af65..5e51b690b2 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/ElementMatcher.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/ElementMatcher.java @@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import lcsb.mapviewer.annotation.data.TargetType; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.species.Complex; @@ -47,7 +47,7 @@ public class ElementMatcher { * @return <code>true</code> if drug target can target element, * <code>false</code> otherwise */ - public boolean elementMatch(TargetView target, AnnotatedObject element) { + public boolean elementMatch(TargetView target, BioEntity element) { if (target.getType().equals(TargetType.COMPLEX_PROTEIN.getCommonName())) { MiriamData targetAnnotation = annotationViewFactory.viewToObject(target.getAnnotation()); if (MiriamType.CHEMBL_TARGET.equals(targetAnnotation.getDataType())) { diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/TargetViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/search/db/TargetViewFactory.java index fcc8cc04e4..994ca460ec 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/TargetViewFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/TargetViewFactory.java @@ -16,7 +16,7 @@ import lcsb.mapviewer.annotation.data.TargetType; import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.annotation.services.PubmedSearchException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -87,7 +87,7 @@ public class TargetViewFactory extends AbstractViewFactory<Target, TargetView> { GeneRow geneRow = new GeneRow(); geneRow.setAnnotation(annotationViewFactory.create(md)); if (model != null) { - Set<AnnotatedObject> list = new HashSet<>(); + Set<BioEntity> list = new HashSet<>(); list.addAll(model.getElementsByName(md.getResource())); list.addAll(model.getElementsByAnnotation(md)); diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java b/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java index 388ff0ed7f..aae39c5c6b 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/chemical/ChemicalService.java @@ -23,7 +23,7 @@ import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.IProgressUpdater; import lcsb.mapviewer.common.exception.InvalidArgumentException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -302,7 +302,7 @@ public class ChemicalService implements IChemicalService { models.add(originalModel); models.addAll(originalModel.getSubmodels()); for (Model model : models) { - for (AnnotatedObject element : model.getAnnotatedObjects()) { + for (BioEntity element : model.getAnnotatedObjects()) { for (MiriamData md : element.getMiriamData()) { if (MiriamType.HGNC_SYMBOL.equals(md.getDataType())) { targetMiriams.add(md); diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugService.java b/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugService.java index 9ba9d56733..5de4639967 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugService.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/drug/DrugService.java @@ -20,7 +20,7 @@ import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.IProgressUpdater; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -384,7 +384,7 @@ public class DrugService implements IDrugService { models.add(originalModel); models.addAll(originalModel.getSubmodels()); for (Model model : models) { - for (AnnotatedObject element : model.getAnnotatedObjects()) { + for (BioEntity element : model.getAnnotatedObjects()) { for (MiriamData md : element.getMiriamData()) { if (MiriamType.HGNC_SYMBOL.equals(md.getDataType())) { targetMiriams.add(md); diff --git a/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java b/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java index 4f3359b694..525e4d1529 100644 --- a/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java +++ b/service/src/main/java/lcsb/mapviewer/services/search/db/mirna/MiRNAService.java @@ -20,7 +20,7 @@ import lcsb.mapviewer.annotation.services.MiRNASearchException; import lcsb.mapviewer.annotation.services.annotators.AnnotatorException; import lcsb.mapviewer.annotation.services.annotators.HgncAnnotator; import lcsb.mapviewer.common.IProgressUpdater; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -218,7 +218,7 @@ public class MiRNAService implements IMiRNAService { models.add(originalModel); models.addAll(originalModel.getSubmodels()); for (Model model : models) { - for (AnnotatedObject element : model.getAnnotatedObjects()) { + for (BioEntity element : model.getAnnotatedObjects()) { for (MiriamData md : element.getMiriamData()) { if (MiriamType.HGNC_SYMBOL.equals(md.getDataType())) { targetMiriams.add(md); diff --git a/service/src/main/java/lcsb/mapviewer/services/utils/CreateProjectParams.java b/service/src/main/java/lcsb/mapviewer/services/utils/CreateProjectParams.java index 21df2ed92d..4e1f886cb2 100644 --- a/service/src/main/java/lcsb/mapviewer/services/utils/CreateProjectParams.java +++ b/service/src/main/java/lcsb/mapviewer/services/utils/CreateProjectParams.java @@ -17,7 +17,7 @@ import org.apache.commons.io.IOUtils; import org.primefaces.model.TreeNode; import lcsb.mapviewer.converter.zip.ZipEntryFile; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.services.overlay.AnnotatedObjectTreeRow; import lcsb.mapviewer.services.view.AuthenticationToken; @@ -151,13 +151,13 @@ public class CreateProjectParams { * Map that contains information which {@link MiriamType miriam types} are * valid for which class. */ - private Map<Class<? extends AnnotatedObject>, Set<MiriamType>> validAnnotations = null; + private Map<Class<? extends BioEntity>, Set<MiriamType>> validAnnotations = null; /** * Map that contains information which {@link MiriamType miriam types} are * obigatory for which class. */ - private Map<Class<? extends AnnotatedObject>, Set<MiriamType>> requiredAnnotations = null; + private Map<Class<? extends BioEntity>, Set<MiriamType>> requiredAnnotations = null; /** * @param projectId @@ -534,7 +534,7 @@ public class CreateProjectParams { */ @SuppressWarnings("unchecked") public void validAnnotations(TreeNode annotatorsTree) { - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> map = new HashMap<Class<? extends AnnotatedObject>, Set<MiriamType>>(); + Map<Class<? extends BioEntity>, Set<MiriamType>> map = new HashMap<Class<? extends BioEntity>, Set<MiriamType>>(); Queue<TreeNode> queue = new LinkedList<TreeNode>(); queue.add(annotatorsTree); while (!queue.isEmpty()) { @@ -546,7 +546,7 @@ public class CreateProjectParams { set.addAll(((AnnotatedObjectTreeRow) parent.getData()).getValidAnnotations()); parent = parent.getParent(); } - map.put((Class<? extends AnnotatedObject>) ((AnnotatedObjectTreeRow) node.getData()).getClazz(), set); + map.put((Class<? extends BioEntity>) ((AnnotatedObjectTreeRow) node.getData()).getClazz(), set); for (TreeNode node2 : node.getChildren()) { queue.add(node2); @@ -564,7 +564,7 @@ public class CreateProjectParams { */ @SuppressWarnings("unchecked") public void requiredAnnotations(TreeNode annotatorsTree) { - Map<Class<? extends AnnotatedObject>, Set<MiriamType>> map = new HashMap<Class<? extends AnnotatedObject>, Set<MiriamType>>(); + Map<Class<? extends BioEntity>, Set<MiriamType>> map = new HashMap<Class<? extends BioEntity>, Set<MiriamType>>(); Queue<TreeNode> queue = new LinkedList<TreeNode>(); queue.add(annotatorsTree); while (!queue.isEmpty()) { @@ -583,7 +583,7 @@ public class CreateProjectParams { if (!valid) { set = null; } - map.put((Class<? extends AnnotatedObject>) ((AnnotatedObjectTreeRow) node.getData()).getClazz(), set); + map.put((Class<? extends BioEntity>) ((AnnotatedObjectTreeRow) node.getData()).getClazz(), set); for (TreeNode node2 : node.getChildren()) { queue.add(node2); @@ -597,7 +597,7 @@ public class CreateProjectParams { * * @return {@link #validAnnotations}. */ - public Map<Class<? extends AnnotatedObject>, Set<MiriamType>> getValidAnnotations() { + public Map<Class<? extends BioEntity>, Set<MiriamType>> getValidAnnotations() { return validAnnotations; } @@ -606,7 +606,7 @@ public class CreateProjectParams { * * @return {@link #requiredAnnotations}. */ - public Map<Class<? extends AnnotatedObject>, Set<MiriamType>> getRequiredAnnotations() { + public Map<Class<? extends BioEntity>, Set<MiriamType>> getRequiredAnnotations() { return requiredAnnotations; } diff --git a/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java b/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java index 4be94f3269..fa8eb02646 100644 --- a/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java +++ b/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsView.java @@ -6,7 +6,7 @@ import java.util.List; import lcsb.mapviewer.annotation.data.Article; import lcsb.mapviewer.common.Pair; import lcsb.mapviewer.common.exception.InvalidStateException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.reaction.Reaction; import lcsb.mapviewer.model.map.species.Element; @@ -91,7 +91,7 @@ public class PubmedAnnotatedElementsView extends AbstractView<MiriamData> { * @param annotatedObject * object to add */ - public void addElement(AnnotatedObject annotatedObject) { + public void addElement(BioEntity annotatedObject) { if (annotatedObject instanceof Element) { Element alias = (Element) annotatedObject; elements.add(new Pair<String, String>(alias.getName(), SearchService.SPECIES_SEARCH_PREFIX + ":" + alias.getElementId())); @@ -101,7 +101,7 @@ public class PubmedAnnotatedElementsView extends AbstractView<MiriamData> { new Pair<>( SearchService.REACTION_SEARCH_PREFIX + ":" + reaction.getIdReaction(), SearchService.REACTION_SEARCH_PREFIX + ":" + reaction.getIdReaction())); } else { - throw new InvalidStateException("Unknown subtype of " + AnnotatedObject.class.getName() + ": " + annotatedObject.getClass().getName()); + throw new InvalidStateException("Unknown subtype of " + BioEntity.class.getName() + ": " + annotatedObject.getClass().getName()); } } diff --git a/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsViewFactory.java b/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsViewFactory.java index 54dc5b2e7b..f743b95b3a 100644 --- a/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsViewFactory.java +++ b/service/src/main/java/lcsb/mapviewer/services/view/PubmedAnnotatedElementsViewFactory.java @@ -12,7 +12,7 @@ import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.annotation.services.PubmedSearchException; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.NotImplementedException; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.model.Model; @@ -66,11 +66,11 @@ public class PubmedAnnotatedElementsViewFactory extends AbstractViewFactory<Miri */ public PubmedAnnotatedElementsView create(MiriamData miriamData, Model model) { PubmedAnnotatedElementsView result = create(miriamData); - Set<AnnotatedObject> elements = model.getElementsByAnnotation(miriamData); + Set<BioEntity> elements = model.getElementsByAnnotation(miriamData); for (Model submodel : model.getSubmodels()) { elements.addAll(submodel.getElementsByAnnotation(miriamData)); } - for (AnnotatedObject annotatedObject : elements) { + for (BioEntity annotatedObject : elements) { result.addElement(annotatedObject); } return result; diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java index 95aea93365..93ed9e8c1c 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/ProjectServiceTest.java @@ -35,7 +35,7 @@ import lcsb.mapviewer.converter.zip.ZipEntryFile; import lcsb.mapviewer.converter.zip.ZipEntryFileFactory; import lcsb.mapviewer.model.Project; import lcsb.mapviewer.model.ProjectStatus; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamType; import lcsb.mapviewer.model.map.layout.Layout; import lcsb.mapviewer.model.map.model.Model; @@ -468,7 +468,7 @@ public class ProjectServiceTest extends ServiceTestFunctions { AnnotatedObjectTreeRow dataNode = (AnnotatedObjectTreeRow) tree.getData(); - assertEquals(AnnotatedObject.class, dataNode.getClazz()); + assertEquals(BioEntity.class, dataNode.getClazz()); Queue<TreeNode> nodes = new LinkedList<TreeNode>(); nodes.add(tree); @@ -504,7 +504,7 @@ public class ProjectServiceTest extends ServiceTestFunctions { AnnotatedObjectTreeRow dataNode = (AnnotatedObjectTreeRow) tree.getData(); - assertEquals(AnnotatedObject.class, dataNode.getClazz()); + assertEquals(BioEntity.class, dataNode.getClazz()); Queue<TreeNode> nodes = new LinkedList<TreeNode>(); nodes.add(tree); @@ -543,7 +543,7 @@ public class ProjectServiceTest extends ServiceTestFunctions { AnnotatedObjectTreeRow dataNode = (AnnotatedObjectTreeRow) tree.getData(); - assertEquals(AnnotatedObject.class, dataNode.getClazz()); + assertEquals(BioEntity.class, dataNode.getClazz()); Queue<TreeNode> nodes = new LinkedList<>(); nodes.add(tree); @@ -581,7 +581,7 @@ public class ProjectServiceTest extends ServiceTestFunctions { AnnotatedObjectTreeRow dataNode = (AnnotatedObjectTreeRow) tree.getData(); - assertEquals(AnnotatedObject.class, dataNode.getClazz()); + assertEquals(BioEntity.class, dataNode.getClazz()); Queue<TreeNode> nodes = new LinkedList<TreeNode>(); nodes.add(tree); @@ -622,7 +622,7 @@ public class ProjectServiceTest extends ServiceTestFunctions { AnnotatedObjectTreeRow dataNode = (AnnotatedObjectTreeRow) tree.getData(); - assertEquals(AnnotatedObject.class, dataNode.getClazz()); + assertEquals(BioEntity.class, dataNode.getClazz()); Queue<TreeNode> nodes = new LinkedList<>(); nodes.add(tree); diff --git a/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java b/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java index 64ff5dc2de..a86d4ede01 100644 --- a/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java +++ b/service/src/test/java/lcsb/mapviewer/services/impl/SearchServiceTest.java @@ -18,7 +18,7 @@ import org.junit.Test; import lcsb.mapviewer.common.Configuration; import lcsb.mapviewer.model.Project; -import lcsb.mapviewer.model.map.AnnotatedObject; +import lcsb.mapviewer.model.map.BioEntity; import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamRelationType; import lcsb.mapviewer.model.map.MiriamType; @@ -232,7 +232,7 @@ public class SearchServiceTest extends ServiceTestFunctions { public void testSearchClosest() throws Exception { try { model = getModelForFile("testFiles/graph_path_example3.xml", true); - List<AnnotatedObject> elements = searchService.getClosestElements(model, new Point2D.Double(0, 0), 5, false); + List<BioEntity> elements = searchService.getClosestElements(model, new Point2D.Double(0, 0), 5, false); assertNotNull(elements); assertEquals(5, elements.size()); assertTrue(elements.get(0) instanceof Species); @@ -280,12 +280,12 @@ public class SearchServiceTest extends ServiceTestFunctions { protein3.setY(0); model.addElement(protein3); - List<AnnotatedObject> elements = searchService.getClosestElements(model, new Point2D.Double(10, 10), 5, false); + List<BioEntity> elements = searchService.getClosestElements(model, new Point2D.Double(10, 10), 5, false); assertNotNull(elements); assertEquals(3, elements.size()); - AnnotatedObject sAlias = elements.get(0); + BioEntity sAlias = elements.get(0); assertEquals("s2", sAlias.getName()); - AnnotatedObject reaction = elements.get(1); + BioEntity reaction = elements.get(1); assertEquals("s1", reaction.getName()); sAlias = elements.get(2); assertEquals("s3", sAlias.getName()); @@ -300,7 +300,7 @@ public class SearchServiceTest extends ServiceTestFunctions { public void testSearchClosestWithEmptyModel() throws Exception { try { model = new ModelFullIndexed(null); - List<AnnotatedObject> elements = searchService.getClosestElements(model, new Point2D.Double(0, 0), 5, false); + List<BioEntity> elements = searchService.getClosestElements(model, new Point2D.Double(0, 0), 5, false); assertNotNull(elements); assertEquals(0, elements.size()); -- GitLab