public void onCompartmentUpdate(Organism organism, CvTerm oldType) { if (oldType == null){ organismChangeListener.log(Level.INFO, "The compartment has been initialised for the organism " + organism.toString()); } else if (organism.getCompartment() == null){ organismChangeListener.log(Level.INFO, "The compartment has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The compartment "+oldType.toString()+" has been replaced with " + organism.getCompartment().toString() + " in the organism " + organism.toString()); } }
CvTerm compartment1 = organism1.getCompartment(); CvTerm compartment2 = organism2.getCompartment();
CvTerm compartment1 = organism1.getCompartment(); CvTerm compartment2 = organism2.getCompartment();
/*** * This method will copy properties of organism source in organism target and will override all the other properties of Target organism. * @param source * @param target */ public static void copyAndOverrideOrganismProperties(Organism source, Organism target){ if (source != null && target != null){ target.setCommonName(source.getCommonName()); target.setScientificName(source.getScientificName()); target.setCellType(source.getCellType()); target.setTissue(source.getTissue()); target.setCompartment(source.getCompartment()); target.setTaxId(source.getTaxId()); // copy collections target.getAliases().clear(); target.getAliases().addAll(source.getAliases()); } } }
/** * * @param organism * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Organism organism){ if (unambiguousOrganismComparator == null){ unambiguousOrganismComparator = new UnambiguousOrganismComparator(); } if (organism == null){ return 0; } int hashcode = 31; hashcode = 31*hashcode + organism.getTaxId(); CvTerm cellType = organism.getCellType(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(cellType); CvTerm tissue = organism.getTissue(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(tissue); CvTerm compartment = organism.getCompartment(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(compartment); return hashcode; } }
@Override protected void writeOtherProperties(Organism object) throws IOException { if (object.getCellType() != null){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("cellType", getWriter()); getCvWriter().write(object.getCellType()); } if (object.getTissue() != null){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("tissue", getWriter()); getCvWriter().write(object.getTissue()); } if (object.getCompartment() != null){ MIJsonUtils.writeSeparator(getWriter()); MIJsonUtils.writePropertyKey("compartment", getWriter()); getCvWriter().write(object.getCompartment()); } } }