/* 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.Container; import org.clothocore.api.data.Container.ContainerDatum; import org.clothocore.api.data.ObjBase; import org.clothocore.api.data.ObjBase.ObjBaseDatum; import org.clothocore.api.data.ObjType; import org.clothocad.hibernate.hibernateDatum; /** * ContainerTable generated by hbm2java */ public class ContainerTable implements java.io.Serializable, hibernateDatum { public static ObjType getType( Enum field ) { if ( field.getDeclaringClass() != Container.Fields.class ) { return null; } Container.Fields f = (Container.Fields) field; switch ( f ) { case PLATE: return ObjType.PLATE; case SAMPLE: return ObjType.SAMPLE; default: return null; } } public ContainerTable( Container c ) { this.idContainer = c.getUUID(); this.name = c.getName(); this.dateCreated = c.getDateCreated(); this.lastModified = c.getLastModified(); this.row = (short) c.getRowAsInt(); this.column = (short) c.getCol(); this.barcode = c.getBarcode(); this.isFixed = c.isFixed(); if ( c.getPlateLink() != null ) { this.plateTable = new PlateTable( c.getPlateLink() ); } } @Override public void runSecondaryProcessing(ObjBase obj) { } @Override public boolean needsSecondaryProcessing() { return false; } @Override public ObjBase getObject() { Container.ContainerDatum d = (ContainerDatum) getObjBaseDatum(); Container c = new Container( d ); return c; } @Override public ObjBaseDatum getObjBaseDatum() { String sampleid = null; if ( sampleTables.size() == 1 ) { sampleid = ((SampleTable) this.sampleTables.iterator().next()).getUUID(); } String idplate = null; if ( plateTable != null ) { idplate = plateTable.getIdPlate(); } Container.ContainerDatum d = new Container.ContainerDatum(); d.uuid = idContainer; d.name = name; d.dateCreated = dateCreated; d.lastModified = lastModified; d._row = row; d._col = column; d._containerBarcode = barcode; d._isFixed = isFixed; d._plateUUID = idplate; d._sampleUUID = sampleid; return d; } @Override public String getUUID() { return idContainer; } public static String translate( Enum field ) { if ( field.getDeclaringClass() != Container.Fields.class ) { return null; } Container.Fields f = (Container.Fields) field; switch ( f ) { case NAME: return "name"; case DATE_CREATED: return "dateCreated"; case LAST_MODIFIED: return "lastModified"; case ROW: return "row"; case COL: return "column"; case BARCODE: return "barcode"; case IS_FIXED: return "isFixed"; case PLATE: return "plateTable"; case SAMPLE: return "sampleTables"; default: return null; } } /***** AUTO-GENERATED CODE *****/ private String idContainer; private PlateTable plateTable; private String name; private Short row; private Short column; private String barcode; private Boolean isFixed; private Date dateCreated; private Date lastModified; private Set sampleTables = new HashSet( 0 ); public ContainerTable() { } public ContainerTable( String idContainer ) { this.idContainer = idContainer; } public ContainerTable( String idContainer, PlateTable plateTable, String name, Short row, Short column, String barcode, Boolean isFixed, Date dateCreated, Date lastModified, Set sampleTables ) { this.idContainer = idContainer; this.plateTable = plateTable; this.name = name; this.row = row; this.column = column; this.barcode = barcode; this.isFixed = isFixed; this.dateCreated = dateCreated; this.lastModified = lastModified; this.sampleTables = sampleTables; } public String getIdContainer() { return this.idContainer; } public void setIdContainer( String idContainer ) { this.idContainer = idContainer; } public PlateTable getPlateTable() { return this.plateTable; } public void setPlateTable( PlateTable plateTable ) { this.plateTable = plateTable; } public String getName() { return this.name; } public void setName( String name ) { this.name = name; } public Short getRow() { return this.row; } public void setRow( Short row ) { this.row = row; } public Short getColumn() { return this.column; } public void setColumn( Short column ) { this.column = column; } public String getBarcode() { return this.barcode; } public void setBarcode( String barcode ) { this.barcode = barcode; } public Boolean getIsFixed() { return this.isFixed; } public void setIsFixed( Boolean isFixed ) { this.isFixed = isFixed; } 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 getSampleTables() { return this.sampleTables; } public void setSampleTables( Set sampleTables ) { this.sampleTables = sampleTables; } }