001/*
002        $Id: BioMaterialData.java 3207 2009-04-09 06:48:11Z gregory $
003
004        Copyright (C) 2006 Gregory Vincic, Olle Mansson
005        Copyright (C) 2007 Gregory Vincic
006
007        This file is part of Proteios.
008        Available at http://www.proteios.org/
009
010        Proteios is free software; you can redistribute it and/or modify it
011        under the terms of the GNU General Public License as published by
012        the Free Software Foundation; either version 2 of the License, or
013        (at your option) any later version.
014
015        Proteios is distributed in the hope that it will be useful, but
016        WITHOUT ANY WARRANTY; without even the implied warranty of
017        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
018        General Public License for more details.
019
020        You should have received a copy of the GNU General Public License
021        along with this program; if not, write to the Free Software
022        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
023        02111-1307, USA.
024*/
025package org.proteios.core.data;
026
027import java.util.HashSet;
028import java.util.Set;
029
030/**
031        This class is the root class for biomaterials.
032
033        @author Nicklas
034        @version 2.0
035        @see org.proteios.core.BioMaterial
036        @see <a href="../../../../../../../development/overview/data/biomaterial.html">Biomaterials overview</a>
037        @base.modified $Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $
038        @hibernate.class table="`BioMaterials`" lazy="false" discriminator-value="-1"
039        @hibernate.discriminator column="`discriminator`" type="int"
040*/
041public abstract class BioMaterialData
042        extends AnnotatedData
043{
044
045        public BioMaterialData()
046        {}
047        
048        /**
049                The maximum length of the external id that can be stored in the database.
050                @see #setExternalId(String)
051        */
052        public static final int MAX_EXTERNAL_ID_LENGTH = 255;
053        private String externalId;
054        /**
055                Get the external id for the biomaterial
056                @hibernate.property column="`external_id`" type="string" length="255" not-null="false"
057        */
058        public String getExternalId()
059        {
060                return externalId;
061        }
062        public void setExternalId(String externalId)
063        {
064                this.externalId = externalId;
065        }
066
067        private Set<FileData> files;
068
069        /**
070         * @hibernate.set table="`BioMaterialFiles`" lazy="true" inverse="true"
071         * @hibernate.collection-key column="`biomaterial_id`"
072         * @hibernate.collection-many-to-many class="org.proteios.core.data.FileData"
073         *                                    column="`file_id`" 
074         * @return Returns the files. Empty Set if no files
075         */
076        public Set<FileData> getFiles()
077        {
078                if (files==null)
079                {
080                        files=new HashSet<FileData>();
081                }
082                return files;
083        }
084        
085        public void setFiles(Set<FileData> files)
086        {
087                this.files=files;
088        }
089
090        
091        /**
092         *      The maximum length of the storage location info that can be
093         *      stored in the database.
094         *      @see #setStorageLocation(String)
095         */
096        public static final int MAX_STORAGE_LOCATION_LENGTH = 255;
097        private String storageLocation;
098        /**
099         *      Get the storage location for the biomaterial
100         *      @hibernate.property column="`storage_location`" type="string" length="255" not-null="false"
101         */
102        public String getStorageLocation()
103        {
104                return storageLocation;
105        }
106        public void setStorageLocation(String storageLocation)
107        {
108                this.storageLocation = storageLocation;
109        }
110}