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