View Javadoc

1   /**
2    * This file Copyright (c) 2009-2010 Magnolia International
3    * Ltd.  (http://www.magnolia-cms.com). All rights reserved.
4    *
5    *
6    * This file is dual-licensed under both the Magnolia
7    * Network Agreement and the GNU General Public License.
8    * You may elect to use one or the other of these licenses.
9    *
10   * This file is distributed in the hope that it will be
11   * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
12   * implied warranty of MERCHANTABILITY or FITNESS FOR A
13   * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
14   * Redistribution, except as permitted by whichever of the GPL
15   * or MNA you select, is prohibited.
16   *
17   * 1. For the GPL license (GPL), you can redistribute and/or
18   * modify this file under the terms of the GNU General
19   * Public License, Version 3, as published by the Free Software
20   * Foundation.  You should have received a copy of the GNU
21   * General Public License, Version 3 along with this program;
22   * if not, write to the Free Software Foundation, Inc., 51
23   * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
24   *
25   * 2. For the Magnolia Network Agreement (MNA), this file
26   * and the accompanying materials are made available under the
27   * terms of the MNA which accompanies this distribution, and
28   * is available at http://www.magnolia-cms.com/mna.html
29   *
30   * Any modifications to this file must keep this entire header
31   * intact.
32   *
33   */
34  package info.magnolia.cms.util;
35  
36  import java.io.InputStream;
37  import java.util.Calendar;
38  import java.util.Collection;
39  
40  import javax.jcr.ItemNotFoundException;
41  import javax.jcr.PathNotFoundException;
42  import javax.jcr.Property;
43  import javax.jcr.RepositoryException;
44  import javax.jcr.Value;
45  
46  import info.magnolia.cms.core.Content;
47  import info.magnolia.cms.core.HierarchyManager;
48  import info.magnolia.cms.core.NodeData;
49  import info.magnolia.cms.security.AccessDeniedException;
50  
51  
52  /**
53   *
54   * @author pbracher
55   * @version $Id: NodeDataWrapper.java 32667 2010-03-13 00:37:06Z gjoseph $
56   */
57  public abstract class NodeDataWrapper implements NodeData {
58  
59      private NodeData wrappedNodeData;
60  
61      public NodeDataWrapper() {
62      }
63  
64      public NodeDataWrapper(NodeData wrappedNodeData) {
65          this.wrappedNodeData = wrappedNodeData;
66      }
67  
68      public NodeData getWrappedNodeData() {
69          return this.wrappedNodeData;
70      }
71  
72      public void setWrappedNodeData(NodeData wrappedNodeData) {
73          this.wrappedNodeData = wrappedNodeData;
74      }
75  
76      public String toString() {
77          final StringBuilder buffer = new StringBuilder();
78          buffer.append(getClass().getSimpleName());
79          buffer.append(" for ");
80          buffer.append(getWrappedNodeData().toString());
81          return buffer.toString();
82      }
83  
84      // ---- below are only generated delegate methods
85      public void delete() throws RepositoryException {
86          getWrappedNodeData().delete();
87      }
88  
89      public String getAttribute(String name) {
90          return getWrappedNodeData().getAttribute(name);
91      }
92  
93      public Collection getAttributeNames() throws RepositoryException {
94          return getWrappedNodeData().getAttributeNames();
95      }
96  
97      public boolean getBoolean() {
98          return getWrappedNodeData().getBoolean();
99      }
100 
101     public long getContentLength() {
102         return getWrappedNodeData().getContentLength();
103     }
104 
105     public Calendar getDate() {
106         return getWrappedNodeData().getDate();
107     }
108 
109     public double getDouble() {
110         return getWrappedNodeData().getDouble();
111     }
112 
113     public String getHandle() {
114         return getWrappedNodeData().getHandle();
115     }
116 
117     public HierarchyManager getHierarchyManager() {
118         return getWrappedNodeData().getHierarchyManager();
119     }
120 
121     public Property getJCRProperty() {
122         return getWrappedNodeData().getJCRProperty();
123     }
124 
125     public long getLong() {
126         return getWrappedNodeData().getLong();
127     }
128 
129     public String getName() {
130         return getWrappedNodeData().getName();
131     }
132 
133     public Content getParent() throws AccessDeniedException, ItemNotFoundException, javax.jcr.AccessDeniedException, RepositoryException {
134         return getWrappedNodeData().getParent();
135     }
136 
137     public Content getReferencedContent() throws RepositoryException, PathNotFoundException, RepositoryException {
138         return getWrappedNodeData().getReferencedContent();
139     }
140 
141     public Content getReferencedContent(String repositoryId) throws PathNotFoundException, RepositoryException {
142         return getWrappedNodeData().getReferencedContent(repositoryId);
143     }
144 
145     public InputStream getStream() {
146         return getWrappedNodeData().getStream();
147     }
148 
149     public String getString() {
150         return getWrappedNodeData().getString();
151     }
152 
153     public String getString(String lineBreak) {
154         return getWrappedNodeData().getString(lineBreak);
155     }
156 
157     public int getType() {
158         return getWrappedNodeData().getType();
159     }
160 
161     public Value getValue() {
162         return getWrappedNodeData().getValue();
163     }
164 
165     public Value[] getValues() {
166         return getWrappedNodeData().getValues();
167     }
168 
169     public boolean isExist() {
170         return getWrappedNodeData().isExist();
171     }
172 
173     public boolean isGranted(long permissions) {
174         return getWrappedNodeData().isGranted(permissions);
175     }
176 
177     public int isMultiValue() {
178         return getWrappedNodeData().isMultiValue();
179     }
180 
181     public void refresh(boolean keepChanges) throws RepositoryException {
182         getWrappedNodeData().refresh(keepChanges);
183     }
184 
185     public void save() throws RepositoryException {
186         getWrappedNodeData().save();
187     }
188 
189     public void setAttribute(String name, Calendar value) throws RepositoryException, AccessDeniedException, UnsupportedOperationException {
190         getWrappedNodeData().setAttribute(name, value);
191     }
192 
193     public void setAttribute(String name, String value) throws RepositoryException, AccessDeniedException, UnsupportedOperationException {
194         getWrappedNodeData().setAttribute(name, value);
195     }
196 
197     public void setValue(boolean value) throws RepositoryException, AccessDeniedException {
198         getWrappedNodeData().setValue(value);
199     }
200 
201     public void setValue(Calendar value) throws RepositoryException, AccessDeniedException {
202         getWrappedNodeData().setValue(value);
203     }
204 
205     public void setValue(double value) throws RepositoryException, AccessDeniedException {
206         getWrappedNodeData().setValue(value);
207     }
208 
209     public void setValue(InputStream value) throws RepositoryException, AccessDeniedException {
210         getWrappedNodeData().setValue(value);
211     }
212 
213     public void setValue(int value) throws RepositoryException, AccessDeniedException {
214         getWrappedNodeData().setValue(value);
215     }
216 
217     public void setValue(long value) throws RepositoryException, AccessDeniedException {
218         getWrappedNodeData().setValue(value);
219     }
220 
221     public void setValue(String value) throws RepositoryException, AccessDeniedException {
222         getWrappedNodeData().setValue(value);
223     }
224 
225     public void setValue(Content value) throws RepositoryException, AccessDeniedException {
226         getWrappedNodeData().setValue(value);
227     }
228     
229     public void setValue(Value value) throws RepositoryException, AccessDeniedException {
230         getWrappedNodeData().setValue(value);
231     }
232 
233     public void setValue(Value[] value) throws RepositoryException, AccessDeniedException {
234         getWrappedNodeData().setValue(value);
235     }
236 
237 }