001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.components.portletentity;
018:
019: import java.util.HashMap;
020: import java.util.List;
021: import java.util.Map;
022:
023: import org.apache.jetspeed.aggregator.PortletContent;
024: import org.apache.jetspeed.decoration.Decoration;
025: import org.apache.jetspeed.om.common.SecurityConstraint;
026: import org.apache.jetspeed.om.common.SecurityConstraints;
027: import org.apache.jetspeed.om.page.ContentFragment;
028: import org.apache.jetspeed.om.page.Fragment;
029:
030: /**
031: * <p>
032: * ContentFramgentTestImpl
033: * </p>
034: *
035: * Dummy ContentFragment wrapper around Fragment as using the real ContentFragmentImpl would introduce a circular
036: * dependency between the registry and page-manager components. Probably should be replaced by a Mock but I don't
037: * know how to setup that quickly and the whole ContentFragment construction is bound to be replaced soon anyway...
038: *
039: * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
040: * @version $Id$
041: */
042: class ContentFragmentTestImpl implements Fragment, ContentFragment {
043: private Fragment f;
044: private boolean instantlyRendered;
045:
046: /**
047: * @param f
048: * @param list
049: */
050: public ContentFragmentTestImpl(Fragment f, HashMap list) {
051: this (f, list, false);
052: }
053:
054: public ContentFragmentTestImpl(Fragment f, HashMap list,
055: boolean instantlyRendered) {
056: this .f = f;
057: this .instantlyRendered = instantlyRendered;
058: }
059:
060: /**
061: * @param actions
062: * @throws SecurityException
063: */
064: public void checkAccess(String actions) throws SecurityException {
065: f.checkAccess(actions);
066: }
067:
068: /**
069: * @param actions
070: * @throws SecurityException
071: */
072: public void checkConstraints(String actions)
073: throws SecurityException {
074: f.checkConstraints(actions);
075: }
076:
077: /**
078: * @param mask
079: * @throws SecurityException
080: */
081: public void checkPermissions(int mask) throws SecurityException {
082: f.checkPermissions(mask);
083: }
084:
085: public SecurityConstraint newSecurityConstraint() {
086: return f.newSecurityConstraint();
087: }
088:
089: public SecurityConstraints newSecurityConstraints() {
090: return f.newSecurityConstraints();
091: }
092:
093: /**
094: * @see java.lang.Object#equals(java.lang.Object)
095: */
096: public boolean equals(Object obj) {
097: return f.equals(obj);
098: }
099:
100: /**
101: * @return contraints enabled
102: */
103: public boolean getConstraintsEnabled() {
104: return f.getConstraintsEnabled();
105: }
106:
107: /**
108: * @return decorator name
109: */
110: public String getDecorator() {
111: return f.getDecorator();
112: }
113:
114: /**
115: * @return list of fragments
116: */
117: public List getFragments() {
118: return f.getFragments();
119: }
120:
121: /**
122: * @return id
123: */
124: public String getId() {
125: return f.getId();
126: }
127:
128: /**
129: * @return name
130: */
131: public String getName() {
132: return f.getName();
133: }
134:
135: /**
136: * @return permissions enabled
137: */
138: public boolean getPermissionsEnabled() {
139: return f.getPermissionsEnabled();
140: }
141:
142: /**
143: * @return security constraints
144: */
145: public SecurityConstraints getSecurityConstraints() {
146: return f.getSecurityConstraints();
147: }
148:
149: /**
150: * @return short title
151: */
152: public String getShortTitle() {
153: return f.getShortTitle();
154: }
155:
156: /**
157: * @return skin name
158: */
159: public String getSkin() {
160: return f.getSkin();
161: }
162:
163: /**
164: * @return state string
165: */
166: public String getState() {
167: return f.getState();
168: }
169:
170: /**
171: * @return state string
172: */
173: public String getMode() {
174: return f.getMode();
175: }
176:
177: /**
178: * @return title
179: */
180: public String getTitle() {
181: return f.getTitle();
182: }
183:
184: /**
185: * @return type string
186: */
187: public String getType() {
188: return f.getType();
189: }
190:
191: /**
192: * @see java.lang.Object#hashCode()
193: */
194: public int hashCode() {
195: return f.hashCode();
196: }
197:
198: /**
199: * @return if its a reference
200: */
201: public boolean isReference() {
202: return f.isReference();
203: }
204:
205: /**
206: * @param decoratorName
207: */
208: public void setDecorator(String decoratorName) {
209: f.setDecorator(decoratorName);
210: }
211:
212: /**
213: * @param name
214: */
215: public void setName(String name) {
216: f.setName(name);
217: }
218:
219: /**
220: * @param constraints
221: */
222: public void setSecurityConstraints(SecurityConstraints constraints) {
223: f.setSecurityConstraints(constraints);
224: }
225:
226: /**
227: * @param title
228: */
229: public void setShortTitle(String title) {
230: f.setShortTitle(title);
231: }
232:
233: /**
234: * @param skinName
235: */
236: public void setSkin(String skinName) {
237: f.setSkin(skinName);
238: }
239:
240: /**
241: * @param state
242: */
243: public void setState(String state) {
244: f.setState(state);
245: }
246:
247: /**
248: * @param mode
249: */
250: public void setMode(String mode) {
251: f.setMode(mode);
252: }
253:
254: /**
255: * @param title
256: */
257: public void setTitle(String title) {
258: f.setTitle(title);
259: }
260:
261: /**
262: * @param type
263: */
264: public void setType(String type) {
265: f.setType(type);
266: }
267:
268: /**
269: * @see java.lang.Object#toString()
270: */
271: public String toString() {
272: return f.toString();
273: }
274:
275: /**
276: * @see org.apache.jetspeed.om.page.ContentFragment#getContentFragments()
277: */
278: public List getContentFragments() {
279: return null;
280: }
281:
282: /**
283: * @see org.apache.jetspeed.om.page.ContentFragment#getRenderedContent()
284: */
285: public String getRenderedContent() throws IllegalStateException {
286: return null;
287: }
288:
289: /**
290: * @see org.apache.jetspeed.om.page.ContentFragment#overrideRenderedContent(java.lang.String)
291: */
292: public void overrideRenderedContent(String contnent) {
293: }
294:
295: /* (non-Javadoc)
296: * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent()
297: */
298: public String getOverriddenContent() {
299: return null;
300: }
301:
302: /**
303: * @see org.apache.jetspeed.om.page.ContentFragment#setPortletContent(org.apache.jetspeed.aggregator.PortletContent)
304: */
305: public void setPortletContent(PortletContent portletContent) {
306: }
307:
308: /**
309: * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow()
310: */
311: public int getLayoutRow() {
312: return -1;
313: }
314:
315: /**
316: * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn()
317: */
318: public int getLayoutColumn() {
319: return -1;
320: }
321:
322: /**
323: * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
324: */
325: public String getLayoutSizes() {
326: return null;
327: }
328:
329: /**
330: * @see org.apache.jetspeed.om.page.Fragment#getLayoutX()
331: */
332: public float getLayoutX() {
333: return -1.0F;
334: }
335:
336: /**
337: * @see org.apache.jetspeed.om.page.Fragment#getLayoutY()
338: */
339: public float getLayoutY() {
340: return -1.0F;
341: }
342:
343: /**
344: * @see org.apache.jetspeed.om.page.Fragment#getLayoutZ()
345: */
346: public float getLayoutZ() {
347: return -1.0F;
348: }
349:
350: /**
351: * @see org.apache.jetspeed.om.page.Fragment#getLayoutWidth()
352: */
353: public float getLayoutWidth() {
354: return -1.0F;
355: }
356:
357: /**
358: * @see org.apache.jetspeed.om.page.Fragment#getLayoutHeight()
359: */
360: public float getLayoutHeight() {
361: return -1.0F;
362: }
363:
364: /**
365: * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
366: */
367: public void setLayoutRow(int row) {
368: }
369:
370: /**
371: * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
372: */
373: public void setLayoutColumn(int column) {
374: }
375:
376: /**
377: * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
378: */
379: public void setLayoutSizes(String sizes) {
380: }
381:
382: /**
383: * @see org.apache.jetspeed.om.page.Fragment#setLayoutX(float)
384: */
385: public void setLayoutX(float x) {
386: }
387:
388: /**
389: * @see org.apache.jetspeed.om.page.Fragment#setLayoutY(float)
390: */
391: public void setLayoutY(float y) {
392: }
393:
394: /**
395: * @see org.apache.jetspeed.om.page.Fragment#setLayoutZ(float)
396: */
397: public void setLayoutZ(float z) {
398: }
399:
400: /**
401: * @see org.apache.jetspeed.om.page.Fragment#setLayoutWidth(float)
402: */
403: public void setLayoutWidth(float width) {
404: }
405:
406: /**
407: * @see org.apache.jetspeed.om.page.Fragment#setLayoutHeight(float)
408: */
409: public void setLayoutHeight(float height) {
410: }
411:
412: /**
413: * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
414: */
415: public int getIntProperty(String propName) {
416: return -1;
417: }
418:
419: /**
420: * @see org.apache.jetspeed.om.page.Fragment#getFloatProperty(java.lang.String)
421: */
422: public float getFloatProperty(String propName) {
423: return -1.0F;
424: }
425:
426: /**
427: * @see org.apache.jetspeed.om.page.Fragment#getPreferences()
428: */
429: public List getPreferences() {
430: return null;
431: }
432:
433: /**
434: * @see org.apache.jetspeed.om.page.Fragment#setPreferences(java.util.List)
435: */
436: public void setPreferences(List preferences) {
437: }
438:
439: /**
440: * @see org.apache.jetspeed.om.page.Fragment#getProperties()
441: */
442: public Map getProperties() {
443: return null;
444: }
445:
446: /**
447: * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
448: */
449: public String getProperty(String propName) {
450: return null;
451: }
452:
453: public Decoration getDecoration() {
454: // TODO Auto-generated method stub
455: return null;
456: }
457:
458: public void setDecoration(Decoration decoration) {
459: // TODO Auto-generated method stub
460:
461: }
462:
463: /* (non-Javadoc)
464: * @see org.apache.jetspeed.om.page.ContentFragment#isInstantlyRendered()
465: */
466: public boolean isInstantlyRendered() {
467: return this.instantlyRendered;
468: }
469: }
|