001/*
002 $Id: MeasuredBioMaterialData.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 measured biomaterials, ie biomaterials for
032 * where the quantity is tracked.
033 * 
034 * @author Nicklas
035 * @version 2.0
036 * @see org.proteios.core.MeasuredBioMaterial
037 * @see <a
038 *      href="../../../../../../../development/overview/data/biomaterial.html">Biomaterials
039 *      overview</a>
040 * @base.modified $Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $
041 * @hibernate.subclass discriminator-value="-1" lazy="false"
042 */
043public abstract class MeasuredBioMaterialData
044                extends BioMaterialData
045{
046        public MeasuredBioMaterialData()
047        {}
048
049        private BioMaterialData parent;
050
051
052        /**
053         * Get the parent biomaterial. Used for non-pooled biomaterials. The core
054         * must add logic to check that only a biomaterial of the parent type is
055         * linked.
056         * 
057         * @hibernate.many-to-one column="`parent_id`" not-null="false"
058         *                        outer-join="false"
059         */
060        public BioMaterialData getParent()
061        {
062                return parent;
063        }
064
065
066        public void setParent(BioMaterialData parent)
067        {
068                this.parent = parent;
069        }
070
071        private Float concentration;
072
073
074        /**
075         * Get the concentration of the biomaterial. Normally this is the protein concentration in g/l
076         * 
077         * @hibernate.property column="`concentration`" type="float"
078         *                     not-null="false"
079         */
080        public Float getConcentrationInGramsPerLiter()
081        {
082                return concentration;
083        }
084
085
086        public void setConcentrationInGramsPerLiter(Float concentration)
087        {
088                this.concentration = concentration;
089        }
090
091        private Float originalQuantity;
092
093
094        /**
095         * Get the original quantity of the biomaterial measured in microliters.
096         * 
097         * @hibernate.property column="`original_quantity`" type="float"
098         *                     not-null="false"
099         */
100        public Float getOriginalQuantityInMicroLiters()
101        {
102                return originalQuantity;
103        }
104
105
106        public void setOriginalQuantityInMicroLiters(Float originalQuantity)
107        {
108                this.originalQuantity = originalQuantity;
109        }
110
111        private Float remainingQuantity;
112
113
114        /**
115         * Get the remaining quantity of the biomaterial measured in microliters.
116         * 
117         * @hibernate.property column="`remaining_quantity`" type="float"
118         *                     not-null="false"
119         */
120        public Float getRemainingQuantityInMicroLiters()
121        {
122                return remainingQuantity;
123        }
124
125
126        public void setRemainingQuantityInMicroLiters(Float remainingQuantity)
127        {
128                this.remainingQuantity = remainingQuantity;
129        }
130
131        private boolean pooled;
132
133
134        /**
135         * If the biomaterial was created by pooling other biomaterials of the same
136         * type or not.
137         * 
138         * @hibernate.property column="`pooled`" type="boolean" not-null="false"
139         */
140        public boolean isPooled()
141        {
142                return pooled;
143        }
144
145
146        public void setPooled(boolean pooled)
147        {
148                this.pooled = pooled;
149        }
150
151        private CreationEventData creationEvent;
152
153
154        /**
155         * @hibernate.many-to-one class="org.proteios.core.data.CreationEventData"
156         *                        column="`creationEventId`"
157         * @return Returns the creationEvent.
158         */
159        public CreationEventData getCreationEvent()
160        {
161                return creationEvent;
162        }
163
164
165        /**
166         * @param creationEvent The creationEvent to set.
167         */
168        public void setCreationEvent(CreationEventData creationEvent)
169        {
170                this.creationEvent = creationEvent;
171        }
172
173        private Set<BioMaterialEventData> events;
174
175
176        /**
177         * These are the events that have used this biomaterial. This is the inverse
178         * end.
179         * 
180         * @hibernate.set table="`BioMaterialEventSources`" lazy="true"
181         *                inverse="true"
182         * @hibernate.collection-key column="`biomaterial_id`"
183         * @hibernate.collection-many-to-many column="`event_id`"
184         *                                    class="org.proteios.core.data.BioMaterialEventData"
185         */
186        public Set<BioMaterialEventData> getEvents()
187        {
188                if (events == null)
189                {
190                        events = new HashSet<BioMaterialEventData>();
191                }
192                return events;
193        }
194
195
196        public void setEvents(Set<BioMaterialEventData> events)
197        {
198                this.events = events;
199        }
200}