1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.jcr.wrapper;
35
36 import java.io.InputStream;
37 import java.math.BigDecimal;
38 import java.util.Calendar;
39 import javax.jcr.AccessDeniedException;
40 import javax.jcr.Binary;
41 import javax.jcr.InvalidItemStateException;
42 import javax.jcr.Item;
43 import javax.jcr.ItemExistsException;
44 import javax.jcr.ItemNotFoundException;
45 import javax.jcr.ItemVisitor;
46 import javax.jcr.Node;
47 import javax.jcr.Property;
48 import javax.jcr.ReferentialIntegrityException;
49 import javax.jcr.RepositoryException;
50 import javax.jcr.Session;
51 import javax.jcr.Value;
52 import javax.jcr.ValueFormatException;
53 import javax.jcr.lock.LockException;
54 import javax.jcr.nodetype.ConstraintViolationException;
55 import javax.jcr.nodetype.NoSuchNodeTypeException;
56 import javax.jcr.nodetype.PropertyDefinition;
57 import javax.jcr.version.VersionException;
58
59
60
61
62
63
64 public abstract class DelegatePropertyWrapper implements Property {
65
66 private Property wrapped;
67
68 public DelegatePropertyWrapper(Property wrapped) {
69 this.wrapped = wrapped;
70 }
71
72 protected Property getWrappedProperty() {
73 return wrapped;
74 }
75
76 protected void setWrappedProperty(Property property) {
77 this.wrapped = property;
78 }
79
80 @Override
81 public String toString() {
82 return wrapped != null ? wrapped.toString() : "";
83 }
84
85
86
87
88
89
90
91 @Override
92 public void setValue(Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
93 getWrappedProperty().setValue(value);
94 }
95
96 @Override
97 public void setValue(Value[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
98 getWrappedProperty().setValue(values);
99 }
100
101 @Override
102 public void setValue(String value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
103 getWrappedProperty().setValue(value);
104 }
105
106 @Override
107 public void setValue(String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
108 getWrappedProperty().setValue(values);
109 }
110
111 @Override
112 public void setValue(InputStream value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
113 getWrappedProperty().setValue(value);
114 }
115
116 @Override
117 public void setValue(Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
118 getWrappedProperty().setValue(value);
119 }
120
121 @Override
122 public void setValue(long value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
123 getWrappedProperty().setValue(value);
124 }
125
126 @Override
127 public void setValue(double value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
128 getWrappedProperty().setValue(value);
129 }
130
131 @Override
132 public void setValue(BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
133 getWrappedProperty().setValue(value);
134 }
135
136 @Override
137 public void setValue(Calendar value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
138 getWrappedProperty().setValue(value);
139 }
140
141 @Override
142 public void setValue(boolean value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
143 getWrappedProperty().setValue(value);
144 }
145
146 @Override
147 public void setValue(Node value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
148 getWrappedProperty().setValue(value);
149 }
150
151 @Override
152 public Value getValue() throws ValueFormatException, RepositoryException {
153 return getWrappedProperty().getValue();
154 }
155
156 @Override
157 public Value[] getValues() throws ValueFormatException, RepositoryException {
158 return getWrappedProperty().getValues();
159 }
160
161 @Override
162 public String getString() throws ValueFormatException, RepositoryException {
163 return getWrappedProperty().getString();
164 }
165
166 @Override
167 public InputStream getStream() throws ValueFormatException, RepositoryException {
168 return getWrappedProperty().getStream();
169 }
170
171 @Override
172 public Binary getBinary() throws ValueFormatException, RepositoryException {
173 return getWrappedProperty().getBinary();
174 }
175
176 @Override
177 public long getLong() throws ValueFormatException, RepositoryException {
178 return getWrappedProperty().getLong();
179 }
180
181 @Override
182 public double getDouble() throws ValueFormatException, RepositoryException {
183 return getWrappedProperty().getDouble();
184 }
185
186 @Override
187 public BigDecimal getDecimal() throws ValueFormatException, RepositoryException {
188 return getWrappedProperty().getDecimal();
189 }
190
191 @Override
192 public Calendar getDate() throws ValueFormatException, RepositoryException {
193 return getWrappedProperty().getDate();
194 }
195
196 @Override
197 public boolean getBoolean() throws ValueFormatException, RepositoryException {
198 return getWrappedProperty().getBoolean();
199 }
200
201 @Override
202 public Node getNode() throws ItemNotFoundException, ValueFormatException, RepositoryException {
203 return getWrappedProperty().getNode();
204 }
205
206 @Override
207 public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException {
208 return getWrappedProperty().getProperty();
209 }
210
211 @Override
212 public long getLength() throws ValueFormatException, RepositoryException {
213 return getWrappedProperty().getLength();
214 }
215
216 @Override
217 public long[] getLengths() throws ValueFormatException, RepositoryException {
218 return getWrappedProperty().getLengths();
219 }
220
221 @Override
222 public PropertyDefinition getDefinition() throws RepositoryException {
223 return getWrappedProperty().getDefinition();
224 }
225
226 @Override
227 public int getType() throws RepositoryException {
228 return getWrappedProperty().getType();
229 }
230
231 @Override
232 public boolean isMultiple() throws RepositoryException {
233 return getWrappedProperty().isMultiple();
234 }
235
236 @Override
237 public String getPath() throws RepositoryException {
238 return getWrappedProperty().getPath();
239 }
240
241 @Override
242 public String getName() throws RepositoryException {
243 return getWrappedProperty().getName();
244 }
245
246 @Override
247 public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException {
248 return getWrappedProperty().getAncestor(depth);
249 }
250
251 @Override
252 public Node getParent() throws ItemNotFoundException, AccessDeniedException, RepositoryException {
253 return getWrappedProperty().getParent();
254 }
255
256 @Override
257 public int getDepth() throws RepositoryException {
258 return getWrappedProperty().getDepth();
259 }
260
261 @Override
262 public Session getSession() throws RepositoryException {
263 return getWrappedProperty().getSession();
264 }
265
266 @Override
267 public boolean isNode() {
268 return getWrappedProperty().isNode();
269 }
270
271 @Override
272 public boolean isNew() {
273 return getWrappedProperty().isNew();
274 }
275
276 @Override
277 public boolean isModified() {
278 return getWrappedProperty().isModified();
279 }
280
281 @Override
282 public boolean isSame(Item otherItem) throws RepositoryException {
283 return getWrappedProperty().isSame(otherItem);
284 }
285
286 @Override
287 public void accept(ItemVisitor visitor) throws RepositoryException {
288 getWrappedProperty().accept(visitor);
289 }
290
291 @Override
292 public void save() throws AccessDeniedException, ItemExistsException, ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, VersionException, LockException, NoSuchNodeTypeException, RepositoryException {
293 getWrappedProperty().save();
294 }
295
296 @Override
297 public void refresh(boolean keepChanges) throws InvalidItemStateException, RepositoryException {
298 getWrappedProperty().refresh(keepChanges);
299 }
300
301 @Override
302 public void remove() throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException {
303 getWrappedProperty().remove();
304 }
305 }