001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-api/api/src/java/org/sakaiproject/metaobj/shared/mgt/ContentEntityWrapper.java $
003: * $Id: ContentEntityWrapper.java 22318 2007-03-08 11:06:43Z jimeng@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.metaobj.shared.mgt;
021:
022: import java.io.InputStream;
023: import java.util.Collection;
024: import java.util.Stack;
025:
026: import org.sakaiproject.component.cover.ServerConfigurationService;
027: import org.sakaiproject.content.api.ContentCollection;
028: import org.sakaiproject.content.api.ContentEntity;
029: import org.sakaiproject.content.api.ContentHostingHandler;
030: import org.sakaiproject.content.api.ContentResource;
031: import org.sakaiproject.entity.api.ResourceProperties;
032: import org.sakaiproject.exception.ServerOverloadException;
033: import org.sakaiproject.time.api.Time;
034: import org.w3c.dom.Document;
035: import org.w3c.dom.Element;
036:
037: /**
038: * Created by IntelliJ IDEA.
039: * User: John Ellis Date: Nov 7, 2005 Time: 3:12:50 PM
040: */
041: public class ContentEntityWrapper implements ContentResource {
042: private ContentResource base;
043:
044: private String reference;
045:
046: public ContentEntityWrapper(ContentResource base, String reference) {
047: this .base = base;
048: this .reference = reference;
049: }
050:
051: public int getContentLength() {
052: return base.getContentLength();
053: }
054:
055: public String getContentType() {
056: return base.getContentType();
057: }
058:
059: public byte[] getContent() throws ServerOverloadException {
060: return base.getContent();
061: }
062:
063: public InputStream streamContent() throws ServerOverloadException {
064: return base.streamContent();
065: }
066:
067: public String getUrl() {
068: return ServerConfigurationService.getAccessUrl()
069: + getReference();
070: }
071:
072: public String getReference() {
073: return reference;
074: }
075:
076: public String getId() {
077: return base.getId();
078: }
079:
080: public ResourceProperties getProperties() {
081: return base.getProperties();
082: }
083:
084: public Element toXml(Document doc, Stack stack) {
085: return base.toXml(doc, stack);
086: }
087:
088: public String getUrl(String rootProperty) {
089: return base.getUrl(rootProperty);
090: }
091:
092: public String getReference(String rootProperty) {
093: return base.getUrl(rootProperty);
094: }
095:
096: public ContentResource getBase() {
097: return base;
098: }
099:
100: public void setBase(ContentResource base) {
101: this .base = base;
102: }
103:
104: public Collection getGroups() {
105: return base.getGroups();
106: }
107:
108: public AccessMode getAccess() {
109: return base.getAccess();
110: }
111:
112: public Time getReleaseDate() {
113: return base.getReleaseDate();
114: }
115:
116: public Time getRetractDate() {
117: return base.getRetractDate();
118: }
119:
120: public boolean isResource() {
121: return base.isResource();
122: }
123:
124: public boolean isCollection() {
125: return base.isCollection();
126: }
127:
128: public ContentCollection getContainingCollection() {
129: return base.getContainingCollection();
130: }
131:
132: public Collection getGroupObjects() {
133: return base.getGroupObjects();
134: }
135:
136: public AccessMode getInheritedAccess() {
137: return base.getInheritedAccess();
138: }
139:
140: public Collection getInheritedGroupObjects() {
141: return base.getInheritedGroupObjects();
142: }
143:
144: public Collection getInheritedGroups() {
145: return base.getInheritedGroups();
146: }
147:
148: public boolean isHidden() {
149: return base.isHidden();
150: }
151:
152: public boolean isAvailable() {
153: return base.isAvailable();
154: }
155:
156: public String getResourceType() {
157: return base.getResourceType();
158: }
159:
160: public ContentHostingHandler getContentHandler() {
161: return base.getContentHandler();
162: }
163:
164: public ContentEntity getMember(String nextId) {
165: return base.getMember(nextId);
166: }
167:
168: public ContentEntity getVirtualContentEntity() {
169: return base.getVirtualContentEntity();
170: }
171:
172: public void setContentHandler(ContentHostingHandler chh) {
173: base.setContentHandler(chh);
174: }
175:
176: public void setVirtualContentEntity(ContentEntity ce) {
177: base.setVirtualContentEntity(ce);
178: }
179:
180: /* (non-Javadoc)
181: * @see org.sakaiproject.content.api.ContentEntity#getUrl(boolean)
182: */
183: public String getUrl(boolean relative) {
184: return base.getUrl(relative);
185: }
186:
187: }
|