1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.prefs.om.impl;
18
19 import java.sql.Timestamp;
20
21 import org.apache.jetspeed.prefs.om.Property;
22
23 /***
24 * <p>
25 * {@link Property} interface implementation.
26 * </p>
27 * <p>
28 * Represents a property key/value pair.
29 * </p>
30 *
31 * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
32 */
33 public class PropertyImpl implements Property
34 {
35 /*** The serial version uid. */
36 private static final long serialVersionUID = 7037975617489867366L;
37
38 private long nodeId;
39
40 private String propertyName;
41
42 private String propertyValue;
43
44 private long propertyValueId;
45
46 /***
47 * <p>
48 * Property implementation default constructor.
49 * </p>
50 */
51 public PropertyImpl()
52 {
53 }
54
55 /***
56 * Property constructor given a property key id, node id and the appropriate
57 * value.
58 *
59 * @param nodeId The node id.
60 * @param propertyName The property name.
61 * @param valueObject The value object.
62 */
63 public PropertyImpl(long nodeId, String propertyName, Object valueObject)
64 {
65 this.nodeId = nodeId;
66 this.propertyName = propertyName;
67 this.creationDate = new Timestamp(System.currentTimeMillis());
68 this.modifiedDate = this.creationDate;
69
70 setPropertyValue((String) valueObject);
71 }
72
73 /***
74 * @see org.apache.jetspeed.prefs.om.Property#getPropertyValue()
75 */
76 public final String getPropertyValue()
77 {
78 return propertyValue;
79 }
80
81 /***
82 * @see org.apache.jetspeed.prefs.om.Property#setPropertyValue(java.lang.String)
83 */
84 public final void setPropertyValue(String valueObject)
85 {
86 this.propertyValue = valueObject;
87 }
88
89 /***
90 * @see org.apache.jetspeed.prefs.om.Property#getPropertyValueId()
91 */
92 public long getPropertyValueId()
93 {
94 return this.propertyValueId;
95 }
96
97 /***
98 * @see org.apache.jetspeed.prefs.om.Property#setPropertyValueId(int)
99 */
100 public void setPropertyValueId(long propertyValueId)
101 {
102 this.propertyValueId = propertyValueId;
103 }
104
105 /***
106 * @see org.apache.jetspeed.prefs.om.Property#getNodeId()
107 */
108 public long getNodeId()
109 {
110 return this.nodeId;
111 }
112
113 /***
114 * @see org.apache.jetspeed.prefs.om.Property#setNodeId(long)
115 */
116 public void setNodeId(long nodeId)
117 {
118 this.nodeId = nodeId;
119 }
120
121 /***
122 * @return Returns the propertyName.
123 */
124 public String getPropertyName()
125 {
126 return propertyName;
127 }
128
129 /***
130 * @param propertyName The propertyName to set.
131 */
132 public void setPropertyName(String propertyName)
133 {
134 this.propertyName = propertyName;
135 }
136
137 private Timestamp creationDate;
138
139 /***
140 * @see org.apache.jetspeed.prefs.om.Property#getCreationDate()
141 */
142 public Timestamp getCreationDate()
143 {
144 return this.creationDate;
145 }
146
147 /***
148 * @see org.apache.jetspeed.ospi.om.prefs.Property#setCreationDate(java.sql.Timestamp)
149 */
150 public void setCreationDate(Timestamp creationDate)
151 {
152 this.creationDate = creationDate;
153 }
154
155 private Timestamp modifiedDate;
156
157 /***
158 * @see org.apache.jetspeed.prefs.om.Property#getModifiedDate()
159 */
160 public Timestamp getModifiedDate()
161 {
162 return this.modifiedDate;
163 }
164
165 /***
166 * @see org.apache.jetspeed.prefs.om.Property#setModifiedDate(java.sql.Timestamp)
167 */
168 public void setModifiedDate(Timestamp modifiedDate)
169 {
170 this.modifiedDate = modifiedDate;
171 }
172
173 /***
174 * <p>
175 * Convert <code>Property</code> to string.
176 * </p>
177 *
178 * @return The Property string value.
179 */
180 public String toString()
181 {
182 String toStringProperty = "[[nodeId, " + this.nodeId + "], " + "[propertyValue, " + getPropertyValue() + "], "
183 + "[creationDate, " + this.creationDate + "], " + "[modifiedDate, " + this.modifiedDate + "]]";
184 return toStringProperty;
185 }
186
187 }