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.cms.util;
35
36 import info.magnolia.cms.core.Content;
37 import info.magnolia.cms.core.HierarchyManager;
38 import info.magnolia.cms.core.NodeData;
39 import info.magnolia.cms.security.AccessDeniedException;
40
41 import java.io.InputStream;
42 import java.util.Calendar;
43 import java.util.Collection;
44
45 import javax.jcr.ItemNotFoundException;
46 import javax.jcr.PathNotFoundException;
47 import javax.jcr.Property;
48 import javax.jcr.RepositoryException;
49 import javax.jcr.Value;
50
51
52
53
54
55
56
57 @Deprecated
58 public abstract class NodeDataWrapper implements NodeData {
59
60 private NodeData wrappedNodeData;
61
62 public NodeDataWrapper() {
63 }
64
65 public NodeDataWrapper(NodeData wrappedNodeData) {
66 this.wrappedNodeData = wrappedNodeData;
67 }
68
69 public NodeData getWrappedNodeData() {
70 return this.wrappedNodeData;
71 }
72
73 public void setWrappedNodeData(NodeData wrappedNodeData) {
74 this.wrappedNodeData = wrappedNodeData;
75 }
76
77 @Override
78 public String toString() {
79 final StringBuilder builder = new StringBuilder();
80 builder.append(getClass().getSimpleName());
81 builder.append(" for ");
82 builder.append(getWrappedNodeData().toString());
83 return builder.toString();
84 }
85
86
87
88
89 protected Content wrap(Content content) {
90 return content;
91 }
92
93
94 @Override
95 public void delete() throws RepositoryException {
96 getWrappedNodeData().delete();
97 }
98
99 @Override
100 public String getAttribute(String name) {
101 return getWrappedNodeData().getAttribute(name);
102 }
103
104 @Override
105 public Collection<String> getAttributeNames() throws RepositoryException {
106 return getWrappedNodeData().getAttributeNames();
107 }
108
109 @Override
110 public boolean getBoolean() {
111 return getWrappedNodeData().getBoolean();
112 }
113
114 @Override
115 public long getContentLength() {
116 return getWrappedNodeData().getContentLength();
117 }
118
119 @Override
120 public Calendar getDate() {
121 return getWrappedNodeData().getDate();
122 }
123
124 @Override
125 public double getDouble() {
126 return getWrappedNodeData().getDouble();
127 }
128
129 @Override
130 public String getHandle() {
131 return getWrappedNodeData().getHandle();
132 }
133
134 @Override
135 public HierarchyManager getHierarchyManager() {
136 return getWrappedNodeData().getHierarchyManager();
137 }
138
139 @Override
140 public Property getJCRProperty() throws PathNotFoundException {
141 return getWrappedNodeData().getJCRProperty();
142 }
143
144 @Override
145 public long getLong() {
146 return getWrappedNodeData().getLong();
147 }
148
149 @Override
150 public String getName() {
151 return getWrappedNodeData().getName();
152 }
153
154 @Override
155 public Content getParent() throws AccessDeniedException, ItemNotFoundException, javax.jcr.AccessDeniedException, RepositoryException {
156 return wrap(getWrappedNodeData().getParent());
157 }
158
159 @Override
160 public Content getReferencedContent() throws RepositoryException, PathNotFoundException, RepositoryException {
161 return wrap(getWrappedNodeData().getReferencedContent());
162 }
163
164 @Override
165 public Content getReferencedContent(String repositoryId) throws PathNotFoundException, RepositoryException {
166 return wrap(getWrappedNodeData().getReferencedContent(repositoryId));
167 }
168
169 @Override
170 public InputStream getStream() {
171 return getWrappedNodeData().getStream();
172 }
173
174 @Override
175 public String getString() {
176 return getWrappedNodeData().getString();
177 }
178
179 @Override
180 public String getString(String lineBreak) {
181 return getWrappedNodeData().getString(lineBreak);
182 }
183
184 @Override
185 public int getType() {
186 return getWrappedNodeData().getType();
187 }
188
189 @Override
190 public Value getValue() {
191 return getWrappedNodeData().getValue();
192 }
193
194 @Override
195 public Value[] getValues() {
196 return getWrappedNodeData().getValues();
197 }
198
199 @Override
200 public boolean isExist() {
201 return getWrappedNodeData().isExist();
202 }
203
204 @Override
205 public boolean isGranted(long permissions) {
206 return getWrappedNodeData().isGranted(permissions);
207 }
208
209 @Override
210 public int isMultiValue() {
211 return getWrappedNodeData().isMultiValue();
212 }
213
214 @Override
215 public void refresh(boolean keepChanges) throws RepositoryException {
216 getWrappedNodeData().refresh(keepChanges);
217 }
218
219 @Override
220 public void save() throws RepositoryException {
221 getWrappedNodeData().save();
222 }
223
224 @Override
225 public void setAttribute(String name, Calendar value) throws RepositoryException, AccessDeniedException, UnsupportedOperationException {
226 getWrappedNodeData().setAttribute(name, value);
227 }
228
229 @Override
230 public void setAttribute(String name, String value) throws RepositoryException, AccessDeniedException, UnsupportedOperationException {
231 getWrappedNodeData().setAttribute(name, value);
232 }
233
234 @Override
235 public void setValue(boolean value) throws RepositoryException, AccessDeniedException {
236 getWrappedNodeData().setValue(value);
237 }
238
239 @Override
240 public void setValue(Calendar value) throws RepositoryException, AccessDeniedException {
241 getWrappedNodeData().setValue(value);
242 }
243
244 @Override
245 public void setValue(double value) throws RepositoryException, AccessDeniedException {
246 getWrappedNodeData().setValue(value);
247 }
248
249 @Override
250 public void setValue(InputStream value) throws RepositoryException, AccessDeniedException {
251 getWrappedNodeData().setValue(value);
252 }
253
254 @Override
255 public void setValue(int value) throws RepositoryException, AccessDeniedException {
256 getWrappedNodeData().setValue(value);
257 }
258
259 @Override
260 public void setValue(long value) throws RepositoryException, AccessDeniedException {
261 getWrappedNodeData().setValue(value);
262 }
263
264 @Override
265 public void setValue(String value) throws RepositoryException, AccessDeniedException {
266 getWrappedNodeData().setValue(value);
267 }
268
269 @Override
270 public void setValue(Content value) throws RepositoryException, AccessDeniedException {
271 getWrappedNodeData().setValue(value);
272 }
273
274 @Override
275 public void setValue(Value value) throws RepositoryException, AccessDeniedException {
276 getWrappedNodeData().setValue(value);
277 }
278
279 @Override
280 public void setValue(Value[] value) throws RepositoryException, AccessDeniedException {
281 getWrappedNodeData().setValue(value);
282 }
283
284 }