/* Copyright (c) 2009 The Regents of the University of California. All rights reserved. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.. */ package org.clothocad.hibernate.data; // Generated Jun 1, 2010 8:47:54 PM by Hibernate Tools 3.2.1.GA import java.util.Date; import java.util.HashSet; import java.util.Set; import org.clothocore.api.data.Format; import org.clothocore.api.data.ObjBase; import org.clothocore.api.data.ObjBase.ObjBaseDatum; import org.clothocore.api.data.ObjType; import org.clothocore.api.data.Part; import org.clothocore.api.data.Plasmid; import org.clothocore.api.data.Plasmid.PlasmidDatum; import org.clothocore.api.data.Vector; import org.clothocad.hibernate.hibernateDatum; /** * PlasmidTable generated by hbm2java */ public class PlasmidTable implements java.io.Serializable, hibernateDatum { public static ObjType getType( Enum field ) { if ( field.getDeclaringClass() != Plasmid.Fields.class ) { return null; } Plasmid.Fields f = (Plasmid.Fields) field; switch ( f ) { case AUTHOR: return ObjType.PERSON; case PART: return ObjType.PART; case VECTOR: return ObjType.VECTOR; case FORMAT: return ObjType.FORMAT; default: return null; } } public PlasmidTable( Plasmid p ) { this.idPlasmid = p.getUUID(); this.name = p.getName(); this.dateCreated = p.getDateCreated(); this.lastModified = p.getLastModified(); this.riskGroup = p.getRiskGroup(); if ( p.getAuthorUUID() != null ) { this.personTable = new PersonTable( p.getAuthorUUID() ); } Part apart = p.getPart(); if ( apart != null ) { this.partTable = new PartTable( apart.getUUID() ); } Vector vec = p.getVector(); if ( vec != null ) { this.vectorTable = new VectorTable( vec.getUUID() ); } Format f = p.getFormat(); if ( f != null ) { this.formatTable = new FormatTable( f.getUUID() ); } this.constructionFile = p.getConstructionFileAsString(); } @Override public void runSecondaryProcessing(ObjBase obj) { } @Override public boolean needsSecondaryProcessing() { return false; } @Override public ObjBase getObject() { Plasmid.PlasmidDatum d = (PlasmidDatum) getObjBaseDatum(); Plasmid p = new Plasmid( d ); return p; } @Override public ObjBaseDatum getObjBaseDatum() { if ( riskGroup == null ) { riskGroup = -1; } Plasmid.PlasmidDatum d = new Plasmid.PlasmidDatum(); d.uuid = idPlasmid; d.name = name; d.dateCreated = dateCreated; d.lastModified = lastModified; d._riskGroup = riskGroup; d._authorUUID = personTable.getIdPerson(); d._partUUID = partTable.getIdPart(); d._vectorUUID = vectorTable.getIdVector(); d._formatUUID = formatTable.getIdformat(); d._constructionFile = constructionFile; return d; } @Override public String getUUID() { return idPlasmid; } public static String translate( Enum field ) { if ( field.getDeclaringClass() != Plasmid.Fields.class ) { return null; } Plasmid.Fields f = (Plasmid.Fields) field; switch ( f ) { case NAME: return "name"; case DATE_CREATED: return "dateCreated"; case LAST_MODIFIED: return "lastModified"; case CONSTRUCTION_FILE: return "constructionFile"; case PART: return "partId"; case VECTOR: return "vectorId"; case AUTHOR: return "personTable"; case FORMAT: return "formatTable"; case RISK_GROUP: return "riskGroup"; default: return null; } } /***** AUTO-GENERATED CODE *****/ private String idPlasmid; private PersonTable personTable; private FormatTable formatTable; private VectorTable vectorTable; private PartTable partTable; private String name; private String constructionFile; private Short riskGroup; private Date dateCreated; private Date lastModified; private Set strainPlasmidXrefs = new HashSet( 0 ); private Set sampleTables = new HashSet( 0 ); public PlasmidTable() { } public PlasmidTable( String idPlasmid ) { this.idPlasmid = idPlasmid; } public PlasmidTable( String idPlasmid, PersonTable personTable, FormatTable formatTable, VectorTable vectorTable, PartTable partTable, String name, String constructionFile, Short riskGroup, Date dateCreated, Date lastModified, Set strainPlasmidXrefs, Set sampleTables ) { this.idPlasmid = idPlasmid; this.personTable = personTable; this.formatTable = formatTable; this.vectorTable = vectorTable; this.partTable = partTable; this.name = name; this.constructionFile = constructionFile; this.riskGroup = riskGroup; this.dateCreated = dateCreated; this.lastModified = lastModified; this.strainPlasmidXrefs = strainPlasmidXrefs; this.sampleTables = sampleTables; } public String getIdPlasmid() { return this.idPlasmid; } public void setIdPlasmid( String idPlasmid ) { this.idPlasmid = idPlasmid; } public PersonTable getPersonTable() { return this.personTable; } public void setPersonTable( PersonTable personTable ) { this.personTable = personTable; } public FormatTable getFormatTable() { return this.formatTable; } public void setFormatTable( FormatTable formatTable ) { this.formatTable = formatTable; } public VectorTable getVectorTable() { return this.vectorTable; } public void setVectorTable( VectorTable vectorTable ) { this.vectorTable = vectorTable; } public PartTable getPartTable() { return this.partTable; } public void setPartTable( PartTable partTable ) { this.partTable = partTable; } public String getName() { return this.name; } public void setName( String name ) { this.name = name; } public String getConstructionFile() { return this.constructionFile; } public void setConstructionFile( String constructionFile ) { this.constructionFile = constructionFile; } public Short getRiskGroup() { return this.riskGroup; } public void setRiskGroup( Short riskGroup ) { this.riskGroup = riskGroup; } public Date getDateCreated() { return this.dateCreated; } public void setDateCreated( Date dateCreated ) { this.dateCreated = dateCreated; } public Date getLastModified() { return this.lastModified; } public void setLastModified( Date lastModified ) { this.lastModified = lastModified; } public Set getStrainPlasmidXrefs() { return this.strainPlasmidXrefs; } public void setStrainPlasmidXrefs( Set strainPlasmidXrefs ) { this.strainPlasmidXrefs = strainPlasmidXrefs; } public Set getSampleTables() { return this.sampleTables; } public void setSampleTables( Set sampleTables ) { this.sampleTables = sampleTables; } }