1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.jetspeed.components.portletentity;
18  
19  import java.util.HashMap;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.apache.jetspeed.aggregator.PortletContent;
24  import org.apache.jetspeed.decoration.Decoration;
25  import org.apache.jetspeed.om.common.SecurityConstraint;
26  import org.apache.jetspeed.om.common.SecurityConstraints;
27  import org.apache.jetspeed.om.page.ContentFragment;
28  import org.apache.jetspeed.om.page.Fragment;
29  
30  /***
31   * <p>
32   * ContentFramgentTestImpl
33   * </p>
34   * 
35   * Dummy ContentFragment wrapper around Fragment as using the real ContentFragmentImpl would introduce a circular
36   * dependency between the registry and page-manager components. Probably should be replaced by a Mock but I don't
37   * know how to setup that quickly and the whole ContentFragment construction is bound to be replaced soon anyway...
38   *
39   * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
40   * @version $Id$
41   */
42  class ContentFragmentTestImpl implements Fragment, ContentFragment
43  {
44      private Fragment f;
45  
46      /***
47       * @param f
48       * @param list
49       */
50      public ContentFragmentTestImpl(Fragment f, HashMap list)
51      {
52          super();
53          this.f = f;
54      }
55  
56      /***
57       * @param actions
58       * @throws SecurityException
59       */
60      public void checkAccess(String actions) throws SecurityException
61      {
62          f.checkAccess(actions);
63      }
64  
65      /***
66       * @param actions
67       * @throws SecurityException
68       */
69      public void checkConstraints(String actions) throws SecurityException
70      {
71          f.checkConstraints(actions);
72      }
73  
74      /***
75       * @param mask
76       * @throws SecurityException
77       */
78      public void checkPermissions(int mask) throws SecurityException
79      {
80          f.checkPermissions(mask);
81      }
82          
83      public SecurityConstraint newSecurityConstraint()
84      {
85          return f.newSecurityConstraint();
86      }
87  
88      public SecurityConstraints newSecurityConstraints()
89      {
90          return f.newSecurityConstraints();
91      }
92  
93      /*** 
94       * @see java.lang.Object#equals(java.lang.Object)
95       */
96      public boolean equals(Object obj)
97      {
98          return f.equals(obj);
99      }
100 
101     /***
102      * @return contraints enabled
103      */
104     public boolean getConstraintsEnabled()
105     {
106         return f.getConstraintsEnabled();
107     }
108 
109     /***
110      * @return decorator name
111      */
112     public String getDecorator()
113     {
114         return f.getDecorator();
115     }
116 
117     /***
118      * @return list of fragments
119      */
120     public List getFragments()
121     {
122         return f.getFragments();
123     }
124 
125     /***
126      * @return id
127      */
128     public String getId()
129     {
130         return f.getId();
131     }
132 
133     /***
134      * @return name
135      */
136     public String getName()
137     {
138         return f.getName();
139     }
140 
141     /***
142      * @return permissions enabled
143      */
144     public boolean getPermissionsEnabled()
145     {
146         return f.getPermissionsEnabled();
147     }
148 
149 
150     /***
151      * @return security constraints
152      */
153     public SecurityConstraints getSecurityConstraints()
154     {
155         return f.getSecurityConstraints();
156     }
157 
158     /***
159      * @return  short title
160      */
161     public String getShortTitle()
162     {
163         return f.getShortTitle();
164     }
165 
166     /***
167      * @return skin name
168      */
169     public String getSkin()
170     {
171         return f.getSkin();
172     }
173 
174     /***
175      * @return state string
176      */
177     public String getState()
178     {
179         return f.getState();
180     }
181 
182     /***
183      * @return state string
184      */
185     public String getMode()
186     {
187         return f.getMode();
188     }
189 
190     /***
191      * @return title
192      */
193     public String getTitle()
194     {
195         return f.getTitle();
196     }
197 
198     /***
199      * @return type string
200      */
201     public String getType()
202     {
203         return f.getType();
204     }
205 
206     /*** 
207      * @see java.lang.Object#hashCode()
208      */
209     public int hashCode()
210     {
211         return f.hashCode();
212     }
213 
214     /***
215      * @return if its a reference
216      */
217     public boolean isReference()
218     {
219         return f.isReference();
220     }
221 
222     /***
223      * @param decoratorName
224      */
225     public void setDecorator(String decoratorName)
226     {
227         f.setDecorator(decoratorName);
228     }
229 
230     /***
231      * @param name
232      */
233     public void setName(String name)
234     {
235         f.setName(name);
236     }
237 
238     /***
239      * @param constraints
240      */
241     public void setSecurityConstraints(SecurityConstraints constraints)
242     {
243         f.setSecurityConstraints(constraints);
244     }
245 
246     /***
247      * @param title
248      */
249     public void setShortTitle(String title)
250     {
251         f.setShortTitle(title);
252     }
253 
254     /***
255      * @param skinName
256      */
257     public void setSkin(String skinName)
258     {
259         f.setSkin(skinName);
260     }
261 
262     /***
263      * @param state
264      */
265     public void setState(String state)
266     {
267         f.setState(state);
268     }
269 
270     /***
271      * @param mode
272      */
273     public void setMode(String mode)
274     {
275         f.setMode(mode);
276     }
277 
278     /***
279      * @param title
280      */
281     public void setTitle(String title)
282     {
283         f.setTitle(title);
284     }
285 
286     /***
287      * @param type
288      */
289     public void setType(String type)
290     {
291         f.setType(type);
292     }
293 
294     /*** 
295      * @see java.lang.Object#toString()
296      */
297     public String toString()
298     {
299         return f.toString();
300     }
301 
302     /*** 
303      * @see org.apache.jetspeed.om.page.ContentFragment#getContentFragments()
304      */
305     public List getContentFragments()
306     {
307         return null;
308     }
309 
310     /*** 
311      * @see org.apache.jetspeed.om.page.ContentFragment#getRenderedContent()
312      */
313     public String getRenderedContent() throws IllegalStateException
314     {
315         return null;
316     }
317 
318     /*** 
319      * @see org.apache.jetspeed.om.page.ContentFragment#overrideRenderedContent(java.lang.String)
320      */
321     public void overrideRenderedContent(String contnent)
322     {
323     }
324     
325     /* (non-Javadoc)
326      * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent()
327      */
328     public String getOverriddenContent()
329     {
330         return null;
331     }
332 
333     /*** 
334      * @see org.apache.jetspeed.om.page.ContentFragment#setPortletContent(org.apache.jetspeed.aggregator.PortletContent)
335      */
336     public void setPortletContent(PortletContent portletContent)
337     {
338     }
339 
340     /***
341      * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow()
342      */
343     public int getLayoutRow()
344     {
345         return -1;
346     }
347 
348     /***
349      * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn()
350      */
351     public int getLayoutColumn()
352     {
353         return -1;
354     }
355 
356     /***
357      * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes()
358      */
359     public String getLayoutSizes()
360     {
361         return null;
362     }
363 
364     /***
365      * @see org.apache.jetspeed.om.page.Fragment#getLayoutX()
366      */
367     public float getLayoutX()
368     {
369         return -1.0F;
370     }
371 
372     /***
373      * @see org.apache.jetspeed.om.page.Fragment#getLayoutY()
374      */
375     public float getLayoutY()
376     {
377         return -1.0F;
378     }
379 
380     /***
381      * @see org.apache.jetspeed.om.page.Fragment#getLayoutZ()
382      */
383     public float getLayoutZ()
384     {
385         return -1.0F;
386     }
387 
388     /***
389      * @see org.apache.jetspeed.om.page.Fragment#getLayoutWidth()
390      */
391     public float getLayoutWidth()
392     {
393         return -1.0F;
394     }
395 
396     /***
397      * @see org.apache.jetspeed.om.page.Fragment#getLayoutHeight()
398      */
399     public float getLayoutHeight()
400     {
401         return -1.0F;
402     }
403 
404     /***
405      * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int)
406      */
407     public void setLayoutRow(int row)
408     {            
409     }
410 
411     /***
412      * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int)
413      */
414     public void setLayoutColumn(int column)
415     {            
416     }
417 
418     /***
419      * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String)
420      */
421     public void setLayoutSizes(String sizes)
422     {            
423     }
424 
425     /***
426      * @see org.apache.jetspeed.om.page.Fragment#setLayoutX(float)
427      */
428     public void setLayoutX(float x)
429     {            
430     }
431 
432     /***
433      * @see org.apache.jetspeed.om.page.Fragment#setLayoutY(float)
434      */
435     public void setLayoutY(float y)
436     {            
437     }
438 
439     /***
440      * @see org.apache.jetspeed.om.page.Fragment#setLayoutZ(float)
441      */
442     public void setLayoutZ(float z)
443     {            
444     }
445 
446     /***
447      * @see org.apache.jetspeed.om.page.Fragment#setLayoutWidth(float)
448      */
449     public void setLayoutWidth(float width)
450     {            
451     }
452 
453     /***
454      * @see org.apache.jetspeed.om.page.Fragment#setLayoutHeight(float)
455      */
456     public void setLayoutHeight(float height)
457     {            
458     }
459 
460     /***
461      * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String)
462      */
463     public int getIntProperty(String propName)
464     {
465         return -1;
466     }
467 
468     /***
469      * @see org.apache.jetspeed.om.page.Fragment#getFloatProperty(java.lang.String)
470      */
471     public float getFloatProperty(String propName)
472     {
473         return -1.0F;
474     }
475 
476     /***
477      * @see org.apache.jetspeed.om.page.Fragment#getPreferences()
478      */
479     public List getPreferences()
480     {
481         return null;
482     }
483 
484     /***
485      * @see org.apache.jetspeed.om.page.Fragment#setPreferences(java.util.List)
486      */
487     public void setPreferences(List preferences)
488     {
489     }
490 
491     /***
492      * @see org.apache.jetspeed.om.page.Fragment#getProperties()
493      */
494     public Map getProperties()
495     {
496         return null;
497     }
498 
499     /***
500      * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String)
501      */
502     public String getProperty(String propName)
503     {
504         return null;
505     }
506 
507     public Decoration getDecoration()
508     {
509         // TODO Auto-generated method stub
510         return null;
511     }
512 
513     public void setDecoration(Decoration decoration)
514     {
515         // TODO Auto-generated method stub
516             
517     }        
518 }