/** Recursively save all child elements and then call ObjBase to save itself. */ @Override public synchronized boolean save(ClothoConnection conn) { System.out.println("============ Starting plasmidSample save"); if (!isChanged()) { System.out.println("plasmidSample didn't require saving"); return true; } if (Collector.isLocal(_pSampleDatum._plasmidUUID)) { Plasmid plas = getPlasmid(); if (!plas.isInDatabase()) { if (!plas.save(conn)) { return false; } } } if (Collector.isLocal(_pSampleDatum._sourceStrainUUID)) { Strain st = getSourceStrain(); if (!st.isInDatabase()) { if (!st.save(conn)) { return false; } } } return super.save(conn); }
protected static Entry setStrainFields(StrainData strainData, Entry entry) { Strain strain = (Strain) entry; if (strainData == null) return entry; if (strainData.getHost() != null) strain.setHost(strainData.getHost()); if (strainData.getGenotypePhenotype() != null) strain.setGenotypePhenotype(strainData.getGenotypePhenotype()); return entry; }
/** * Private Constructor for a new Sample generated from scratch, use factory method * generatePlasmidSample * * @param myplasmid the Plasmid ("DNA") within the Sample * @param mycell the Strain from which the Plasmid is derived * @param mycontainer the Container the Sample is being put in * @param myvolume how many uL of liquid are in the new Sample * @param author who is creating the Sample */ private PlasmidSample(Plasmid myplasmid, Strain mycell, double myvolume, Person author) { super(myplasmid.getName(), myvolume, author); _pSampleDatum._plasmidUUID = myplasmid.getUUID(); if (mycell != null) { _pSampleDatum._sourceStrainUUID = mycell.getUUID(); } }
public void changeSourceStrain(Strain newstrain) { // NEED TO CHECK IF ITS LOCKED HERE if (newstrain == null) { fireData(new RefreshEvent(this, RefreshEvent.Condition.STRAIN_CHANGED)); return; } _pSampleDatum._sourceStrainUUID = newstrain.getUUID(); setChanged(RefreshEvent.Condition.STRAIN_CHANGED); }
private static Entry infoToStrainForField(Entry entry, String value, EntryField field) { if (!entry.getRecordType().equalsIgnoreCase(EntryType.STRAIN.toString())) return entry; Strain strain = (Strain) entry; switch (field) { case PARENTAL_STRAIN: strain.setHost(value); return strain; case GENOTYPE_OR_PHENOTYPE: strain.setGenotypePhenotype(value); return strain; case PLASMIDS: strain.setPlasmids(value); return strain; default: return strain; } }