View Javadoc

1   /*
2    * Copyright (c) 2004-2005, University Health Network.  All rights reserved. Distributed under the BSD 
3    * license (see http://opensource.org/licenses/bsd-license.php).
4    *  
5    * Record.java
6    *
7    * Created on 15-Dec-2004 at 1:40:53 PM
8    */
9   package ca.uhn.cache.internal.hibernate.impl;
10  
11  import java.io.Serializable;
12  import java.sql.Timestamp;
13  import java.util.Set;
14  import java.util.SortedSet;
15  import java.util.TreeSet;
16  
17  import ca.uhn.cache.VolatilityEnum;
18  
19  
20  /***
21   * Represents a persistent <code>IDataItem</code>. 
22   * 
23   * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
24   * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:40 $ by $Author: bryan_tripp $
25   * 
26   * @hibernate.class table="record"
27   */
28  public class Record extends HibernateObject {
29      
30      private Serializable myValue;
31      private VolatilityEnum myVolatility;
32      private Timestamp myLastUpdate;
33      
34      private SortedSet myFields;
35      
36      private String myDataItemId;
37  
38      /***
39       * 
40       */
41      public Record() {
42          myFields = new TreeSet();
43      }
44  
45      /***
46       * @return Returns the value.
47       * 
48       * @hibernate.property not-null="true" type="serializable" length="16777215"
49       */
50      public Serializable getValue() {
51          return myValue;
52      }
53      /***
54       * @param theValue The value to set.
55       */
56      public void setValue( Serializable theValue ) {
57          myValue = theValue;
58      }
59      /***
60       * @return Returns the lastUpdate.
61       * 
62       * @hibernate.property not-null="true" type="timestamp"
63       */
64      public Timestamp getLastUpdate() {
65          return myLastUpdate;
66      }
67      /***
68       * @param theLastUpdate The lastUpdate to set.
69       */
70      public void setLastUpdate( Timestamp theLastUpdate ) {
71          myLastUpdate = theLastUpdate;
72      }
73      /***
74       * @return Returns the volatility.
75       * 
76       * @hibernate.property not-null="true" type="ca.uhn.cache.internal.hibernate.HibernateVolatilityEnum" 
77       */
78      public VolatilityEnum getVolatility() {
79          return myVolatility;
80      }
81      /***
82       * @param theVolatility The volatility to set.
83       */
84      public void setVolatility( VolatilityEnum theVolatility ) {
85          myVolatility = theVolatility;
86      }
87      /***
88       * @return Returns the fields.
89       * 
90       * @hibernate.set role="fields" cascade="delete" sort="natural"
91       * @hibernate.collection-key column="record_id"
92       * @hibernate.collection-one-to-many class="ca.uhn.cache.internal.hibernate.impl.Field"
93       */
94      public Set getFields() {
95          return myFields;
96      }
97      
98      /***
99       * Adds a field to this record.
100      * @param theField The field to add.
101      */
102     public void addField( Field theField ) {
103         myFields.add( theField );
104     }
105     
106     /***
107      * @param theFields The fields to set.
108      */
109     public void setFields( SortedSet theFields ) {
110         myFields = theFields;
111     }
112     
113     /***
114      * @return Returns the ID of the <code>IDataItem</code> this records maps to.
115      * 
116      * @hibernate.property not-null="true" unique="true"
117      */
118     public String getDataItemId() {
119         return myDataItemId;
120     }
121     /***
122      * @param theDataItemId The dataItemId to set.
123      */
124     public void setDataItemId( String theDataItemId ) {
125         myDataItemId = theDataItemId;
126     }
127 }