%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.prefs.om.impl.NodeImpl |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | package org.apache.jetspeed.prefs.om.impl; |
|
18 | ||
19 | import java.sql.Timestamp; |
|
20 | import java.util.ArrayList; |
|
21 | import java.util.Collection; |
|
22 | ||
23 | import org.apache.jetspeed.prefs.om.Node; |
|
24 | ||
25 | /** |
|
26 | * <p> |
|
27 | * {@link Node}interface implementation. |
|
28 | * </p> |
|
29 | * <p> |
|
30 | * Represents a preferences node. |
|
31 | * </p> |
|
32 | * |
|
33 | * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a> |
|
34 | */ |
|
35 | public class NodeImpl implements Node |
|
36 | { |
|
37 | /** The serial version uid. */ |
|
38 | private static final long serialVersionUID = -5367800007757021163L; |
|
39 | ||
40 | private long nodeId; |
|
41 | ||
42 | private Long parentNodeId; |
|
43 | ||
44 | private Collection nodeProperties; |
|
45 | ||
46 | private Collection nodeKeys; |
|
47 | ||
48 | private String nodeName; |
|
49 | ||
50 | private int nodeType; |
|
51 | ||
52 | private String fullPath; |
|
53 | ||
54 | private Timestamp creationDate; |
|
55 | ||
56 | /** |
|
57 | * <p> |
|
58 | * Preferences node implementation default constructor. |
|
59 | * </p> |
|
60 | */ |
|
61 | public NodeImpl() |
|
62 | 0 | { |
63 | 0 | } |
64 | ||
65 | /** |
|
66 | * <p> |
|
67 | * Node constructor given: |
|
68 | * </p> |
|
69 | * <ul> |
|
70 | * <li>Parent node id,</li> |
|
71 | * <li>Property set definition id: Long so that we can pass null value if |
|
72 | * the node does not have any properties associated to it,</li> |
|
73 | * <li>Node name,</li> |
|
74 | * <li>Node type,</li> |
|
75 | * <li>Full path.</li> |
|
76 | * </ul> |
|
77 | * |
|
78 | * @param parentNodeId The parent node id. |
|
79 | * @param nodeName The node name. |
|
80 | * @param nodeType The node type. |
|
81 | * @param fullPath The full path. |
|
82 | */ |
|
83 | public NodeImpl(Long parentNodeId, String nodeName, int nodeType, String fullPath) |
|
84 | 0 | { |
85 | 0 | this.parentNodeId = parentNodeId; |
86 | 0 | this.nodeName = nodeName; |
87 | 0 | this.nodeType = nodeType; |
88 | 0 | this.fullPath = fullPath; |
89 | 0 | this.nodeKeys = new ArrayList(0); |
90 | 0 | this.nodeProperties = new ArrayList(0); |
91 | 0 | this.creationDate = new Timestamp(System.currentTimeMillis()); |
92 | 0 | this.modifiedDate = class="keyword">this.creationDate; |
93 | 0 | } |
94 | ||
95 | /** |
|
96 | * @see org.apache.jetspeed.prefs.om.Node#getNodeId() |
|
97 | */ |
|
98 | public long getNodeId() |
|
99 | { |
|
100 | 0 | return this.nodeId; |
101 | } |
|
102 | ||
103 | /** |
|
104 | * @see org.apache.jetspeed.prefs.om.Node#setNodeId(int) |
|
105 | */ |
|
106 | public void setNodeId(long nodeId) |
|
107 | { |
|
108 | 0 | this.nodeId = nodeId; |
109 | 0 | } |
110 | ||
111 | /** |
|
112 | * @see org.apache.jetspeed.prefs.om.Node#getParentNodeId() |
|
113 | */ |
|
114 | public Long getParentNodeId() |
|
115 | { |
|
116 | 0 | return this.parentNodeId; |
117 | } |
|
118 | ||
119 | /** |
|
120 | * @see org.apache.jetspeed.prefs.om.Node#setParentNodeId(java.lang.Long) |
|
121 | */ |
|
122 | public void setParentNodeId(Long parentNodeId) |
|
123 | { |
|
124 | 0 | this.parentNodeId = parentNodeId; |
125 | 0 | } |
126 | ||
127 | /** |
|
128 | * @see org.apache.jetspeed.prefs.om.Node#getNodeProperties() |
|
129 | */ |
|
130 | public Collection getNodeProperties() |
|
131 | { |
|
132 | 0 | return this.nodeProperties; |
133 | } |
|
134 | ||
135 | /** |
|
136 | * @see org.apache.jetspeed.prefs.om.Node#setNodeProperties(java.util.Collection) |
|
137 | */ |
|
138 | public void setNodeProperties(Collection nodeProperties) |
|
139 | { |
|
140 | 0 | this.nodeProperties = nodeProperties; |
141 | 0 | } |
142 | ||
143 | /** |
|
144 | * @see org.apache.jetspeed.prefs.om.Node#getNodeKeys() |
|
145 | */ |
|
146 | public Collection getNodeKeys() |
|
147 | { |
|
148 | 0 | return this.nodeKeys; |
149 | } |
|
150 | ||
151 | /** |
|
152 | * @see org.apache.jetspeed.prefs.om.Node#setNodeKeys(java.util.Collection) |
|
153 | */ |
|
154 | public void setNodeKeys(Collection nodeKeys) |
|
155 | { |
|
156 | 0 | this.nodeKeys = nodeKeys; |
157 | 0 | } |
158 | ||
159 | /** |
|
160 | * @see org.apache.jetspeed.prefs.om.Node#getNodeName() |
|
161 | */ |
|
162 | public String getNodeName() |
|
163 | { |
|
164 | 0 | return this.nodeName; |
165 | } |
|
166 | ||
167 | /** |
|
168 | * @see org.apache.jetspeed.prefs.om.Node#setNodeName(java.lang.String) |
|
169 | */ |
|
170 | public void setNodeName(String nodeName) |
|
171 | { |
|
172 | 0 | this.nodeName = nodeName; |
173 | 0 | } |
174 | ||
175 | /** |
|
176 | * @see org.apache.jetspeed.prefs.om.Node#getNodeType() |
|
177 | */ |
|
178 | public int getNodeType() |
|
179 | { |
|
180 | 0 | return this.nodeType; |
181 | } |
|
182 | ||
183 | /** |
|
184 | * @see org.apache.jetspeed.prefs.om.Node#setNodeType(int) |
|
185 | */ |
|
186 | public void setNodeType(int nodeType) |
|
187 | { |
|
188 | 0 | this.nodeType = nodeType; |
189 | 0 | } |
190 | ||
191 | /** |
|
192 | * @see org.apache.jetspeed.prefs.om.Node#getFullPath() |
|
193 | */ |
|
194 | public String getFullPath() |
|
195 | { |
|
196 | 0 | return this.fullPath; |
197 | } |
|
198 | ||
199 | /** |
|
200 | * @see org.apache.jetspeed.prefs.om.Node#setFullPath(java.lang.String) |
|
201 | */ |
|
202 | public void setFullPath(String fullPath) |
|
203 | { |
|
204 | 0 | this.fullPath = fullPath; |
205 | 0 | } |
206 | ||
207 | /** |
|
208 | * @see org.apache.jetspeed.prefs.om.Node#getCreationDate() |
|
209 | */ |
|
210 | public Timestamp getCreationDate() |
|
211 | { |
|
212 | 0 | return this.creationDate; |
213 | } |
|
214 | ||
215 | /** |
|
216 | * @see org.apache.jetspeed.prefs.om.Node#setCreationDate(java.sql.Timestamp) |
|
217 | */ |
|
218 | public void setCreationDate(Timestamp creationDate) |
|
219 | { |
|
220 | 0 | this.creationDate = creationDate; |
221 | 0 | } |
222 | ||
223 | private Timestamp modifiedDate; |
|
224 | ||
225 | /** |
|
226 | * @see org.apache.jetspeed.prefs.om.Node#getModifiedDate() |
|
227 | */ |
|
228 | public Timestamp getModifiedDate() |
|
229 | { |
|
230 | 0 | return this.modifiedDate; |
231 | } |
|
232 | ||
233 | /** |
|
234 | * @see org.apache.jetspeed.prefs.om.Node#setModifiedDate(java.sql.Timestamp) |
|
235 | */ |
|
236 | public void setModifiedDate(Timestamp modifiedDate) |
|
237 | { |
|
238 | 0 | this.modifiedDate = modifiedDate; |
239 | 0 | } |
240 | ||
241 | public boolean equals(Object o) |
|
242 | { |
|
243 | 0 | return fullPath != null && o != class="keyword">null && o instanceof NodeImpl && ((NodeImpl) o).fullPath != class="keyword">null |
244 | && fullPath.equals(((NodeImpl) o).fullPath); |
|
245 | } |
|
246 | ||
247 | /** |
|
248 | * <p> |
|
249 | * Convert <code>Node</code> to string. |
|
250 | * </p> |
|
251 | * |
|
252 | * @return The Node string value. |
|
253 | */ |
|
254 | public String toString() |
|
255 | { |
|
256 | 0 | String toStringNode = "[[parentNodeId, " + this.parentNodeId + "], " + "[nodeName, " + this.nodeName + "], " |
257 | + "[fullPath, " + this.fullPath + "], " + "[nodeType, " + this.nodeType + "], " + "[nodeKeys, " |
|
258 | + this.nodeKeys + "], " + "[nodeProperties, " + this.nodeProperties + "], " + "[creationDate, " |
|
259 | + this.creationDate + "], " + "[modifiedDate, " + this.modifiedDate + "]]"; |
|
260 | 0 | return toStringNode; |
261 | } |
|
262 | ||
263 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |