public void onScientificNameUpdate(Organism organism, String oldScientificName) { if (oldScientificName == null){ organismChangeListener.log(Level.INFO, "The scientific name has been initialised for the organism " + organism.toString()); } else if (organism.getScientificName() == null){ organismChangeListener.log(Level.INFO, "The scientific name has been reset for the organism " + organism.toString()); } else { organismChangeListener.log(Level.INFO, "The scientific name "+oldScientificName+" has been updated with " + organism.getScientificName() + " in the organism " + organism.toString()); } }
if (organism.getScientificName() != null){ writer.write(MitabUtils.FIELD_SEPARATOR); writer.write(MitabUtils.TAXID); writer.write(Integer.toString(organism.getTaxId())); writer.write("("); escapeAndWriteString(organism.getScientificName()); writer.write(")"); else if (organism.getScientificName() != null){ writer.write("("); escapeAndWriteString(organism.getScientificName()); writer.write(")");
public void write(Organism object) throws IOException { MIJsonUtils.writeStartObject(writer); MIJsonUtils.writeProperty("taxid", Integer.toString(object.getTaxId()), writer); if (object.getCommonName() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("common", JSONValue.escape(object.getCommonName()), writer); } if (object.getScientificName() != null){ MIJsonUtils.writeSeparator(writer); MIJsonUtils.writeProperty("scientific", JSONValue.escape(object.getScientificName()), writer); } writeOtherProperties(object); MIJsonUtils.writeEndObject(writer); }
/*** * 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()); } } }