%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.om.page.ContentFragmentImpl$ContentFragmentList |
|
|
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.om.page; |
|
18 | ||
19 | import java.io.Serializable; |
|
20 | import java.util.Collection; |
|
21 | import java.util.Iterator; |
|
22 | import java.util.List; |
|
23 | import java.util.ListIterator; |
|
24 | import java.util.Map; |
|
25 | ||
26 | import org.apache.commons.logging.Log; |
|
27 | import org.apache.commons.logging.LogFactory; |
|
28 | import org.apache.jetspeed.aggregator.PortletContent; |
|
29 | import org.apache.jetspeed.decoration.Decoration; |
|
30 | import org.apache.jetspeed.om.common.SecurityConstraint; |
|
31 | import org.apache.jetspeed.om.common.SecurityConstraints; |
|
32 | import org.apache.jetspeed.page.impl.DatabasePageManagerUtils; |
|
33 | ||
34 | public class ContentFragmentImpl implements ContentFragment |
|
35 | { |
|
36 | ||
37 | ||
38 | private final Fragment fragment; |
|
39 | private StringBuffer overridenContent; |
|
40 | private PortletContent portletContent; |
|
41 | private List contentFragments; |
|
42 | private static final Log log = LogFactory.getLog(ContentFragmentImpl.class); |
|
43 | private final Map cachedFragments; |
|
44 | private Decoration decoration; |
|
45 | ||
46 | ||
47 | public ContentFragmentImpl(Fragment fragment, Map cachedFagments) |
|
48 | { |
|
49 | this.fragment = fragment; |
|
50 | this.cachedFragments = cachedFagments; |
|
51 | } |
|
52 | ||
53 | /* (non-Javadoc) |
|
54 | * @see org.apache.jetspeed.om.page.ContentFragment#getContentFragments() |
|
55 | */ |
|
56 | public List getContentFragments() |
|
57 | { |
|
58 | if(contentFragments == null) |
|
59 | { |
|
60 | contentFragments = new ContentFragmentList(); |
|
61 | } |
|
62 | return contentFragments; |
|
63 | } |
|
64 | ||
65 | /* (non-Javadoc) |
|
66 | * @see org.apache.jetspeed.om.page.ContentFragment#getFragments() |
|
67 | */ |
|
68 | public List getFragments() |
|
69 | { |
|
70 | return getContentFragments(); |
|
71 | } |
|
72 | ||
73 | /* (non-Javadoc) |
|
74 | * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent() |
|
75 | */ |
|
76 | public String getOverriddenContent() |
|
77 | { |
|
78 | return overridenContent != null ? overridenContent.toString() : class="keyword">null; |
|
79 | } |
|
80 | ||
81 | /* (non-Javadoc) |
|
82 | * @see org.apache.jetspeed.om.page.ContentFragment#getRenderedContent() |
|
83 | */ |
|
84 | public String getRenderedContent() throws IllegalStateException |
|
85 | { |
|
86 | if(overridenContent != null) |
|
87 | { |
|
88 | return overridenContent.toString(); |
|
89 | } |
|
90 | ||
91 | ||
92 | if (portletContent != null) |
|
93 | { |
|
94 | //TODO are you sure? Intellij warns, synchronization on a non-final field is |
|
95 | //unlikely to have useful semantics. |
|
96 | synchronized (portletContent) |
|
97 | { |
|
98 | if (portletContent.isComplete()) |
|
99 | { |
|
100 | return portletContent.getContent(); |
|
101 | } |
|
102 | else |
|
103 | { |
|
104 | try |
|
105 | { |
|
106 | log.debug("Waiting on content for Fragment " + getId()); |
|
107 | portletContent.wait(); |
|
108 | return portletContent.getContent(); |
|
109 | } |
|
110 | catch (InterruptedException e) |
|
111 | { |
|
112 | return e.getMessage(); |
|
113 | } |
|
114 | finally |
|
115 | { |
|
116 | log.debug("Been notified that Faragment " + getId() + " is complete"); |
|
117 | } |
|
118 | } |
|
119 | } |
|
120 | } |
|
121 | else |
|
122 | { |
|
123 | throw new IllegalStateException("You cannot invoke getRenderedContent() until the content has been set."); |
|
124 | } |
|
125 | } |
|
126 | ||
127 | /* (non-Javadoc) |
|
128 | * @see org.apache.jetspeed.om.page.ContentFragment#overrideRenderedContent(java.lang.String) |
|
129 | */ |
|
130 | public void overrideRenderedContent(String contnent) |
|
131 | { |
|
132 | if ( contnent != null ) |
|
133 | { |
|
134 | if(overridenContent == null) |
|
135 | { |
|
136 | overridenContent = new StringBuffer(); |
|
137 | } |
|
138 | // prevent repeated storing of the same error message |
|
139 | if (!contnent.equals(overridenContent.toString())) |
|
140 | { |
|
141 | overridenContent.append(contnent); |
|
142 | } |
|
143 | } |
|
144 | ||
145 | } |
|
146 | ||
147 | /* (non-Javadoc) |
|
148 | * @see org.apache.jetspeed.om.page.ContentFragment#setPortletContent(org.apache.jetspeed.aggregator.PortletContent) |
|
149 | */ |
|
150 | public void setPortletContent(PortletContent portletContent) |
|
151 | { |
|
152 | this.portletContent = portletContent; |
|
153 | } |
|
154 | ||
155 | /* (non-Javadoc) |
|
156 | * @see org.apache.jetspeed.om.page.Fragment#getDecorator() |
|
157 | */ |
|
158 | public String getDecorator() |
|
159 | { |
|
160 | ||
161 | return fragment.getDecorator(); |
|
162 | } |
|
163 | ||
164 | /* (non-Javadoc) |
|
165 | * @see org.apache.jetspeed.om.page.Fragment#getName() |
|
166 | */ |
|
167 | public String getName() |
|
168 | { |
|
169 | ||
170 | return fragment.getName(); |
|
171 | } |
|
172 | ||
173 | /* (non-Javadoc) |
|
174 | * @see org.apache.jetspeed.om.page.Fragment#getProperties() |
|
175 | */ |
|
176 | public Map getProperties() |
|
177 | { |
|
178 | ||
179 | return fragment.getProperties(); |
|
180 | } |
|
181 | ||
182 | /* (non-Javadoc) |
|
183 | * @see org.apache.jetspeed.om.page.Fragment#getProperty(java.lang.String) |
|
184 | */ |
|
185 | public String getProperty(String propName) |
|
186 | { |
|
187 | ||
188 | return fragment.getProperty(propName); |
|
189 | } |
|
190 | ||
191 | /* (non-Javadoc) |
|
192 | * @see org.apache.jetspeed.om.page.Fragment#getIntProperty(java.lang.String) |
|
193 | */ |
|
194 | public int getIntProperty(String propName) |
|
195 | { |
|
196 | ||
197 | return fragment.getIntProperty(propName); |
|
198 | } |
|
199 | ||
200 | /* (non-Javadoc) |
|
201 | * @see org.apache.jetspeed.om.page.Fragment#getFloatProperty(java.lang.String) |
|
202 | */ |
|
203 | public float getFloatProperty(String propName) |
|
204 | { |
|
205 | ||
206 | return fragment.getFloatProperty(propName); |
|
207 | } |
|
208 | ||
209 | /* (non-Javadoc) |
|
210 | * @see org.apache.jetspeed.om.page.Fragment#getSkin() |
|
211 | */ |
|
212 | public String getSkin() |
|
213 | { |
|
214 | ||
215 | return fragment.getSkin(); |
|
216 | } |
|
217 | ||
218 | /* (non-Javadoc) |
|
219 | * @see org.apache.jetspeed.om.page.Fragment#getState() |
|
220 | */ |
|
221 | public String getState() |
|
222 | { |
|
223 | ||
224 | return fragment.getState(); |
|
225 | } |
|
226 | ||
227 | /* (non-Javadoc) |
|
228 | * @see org.apache.jetspeed.om.page.Fragment#getMode() |
|
229 | */ |
|
230 | public String getMode() |
|
231 | { |
|
232 | ||
233 | return fragment.getMode(); |
|
234 | } |
|
235 | ||
236 | /* (non-Javadoc) |
|
237 | * @see org.apache.jetspeed.om.page.Fragment#getType() |
|
238 | */ |
|
239 | public String getType() |
|
240 | { |
|
241 | ||
242 | return fragment.getType(); |
|
243 | } |
|
244 | ||
245 | /* (non-Javadoc) |
|
246 | * @see org.apache.jetspeed.om.page.Fragment#isReference() |
|
247 | */ |
|
248 | public boolean isReference() |
|
249 | { |
|
250 | ||
251 | return fragment.isReference(); |
|
252 | } |
|
253 | ||
254 | /* (non-Javadoc) |
|
255 | * @see org.apache.jetspeed.om.page.Fragment#setDecorator(java.lang.String) |
|
256 | */ |
|
257 | public void setDecorator(String decoratorName) |
|
258 | { |
|
259 | ||
260 | fragment.setDecorator(decoratorName); |
|
261 | } |
|
262 | ||
263 | /* (non-Javadoc) |
|
264 | * @see org.apache.jetspeed.om.page.Fragment#setName(java.lang.String) |
|
265 | */ |
|
266 | public void setName(String name) |
|
267 | { |
|
268 | ||
269 | fragment.setName(name); |
|
270 | } |
|
271 | ||
272 | /* (non-Javadoc) |
|
273 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutRow() |
|
274 | */ |
|
275 | public int getLayoutRow() |
|
276 | { |
|
277 | return fragment.getLayoutRow(); |
|
278 | } |
|
279 | ||
280 | /* (non-Javadoc) |
|
281 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutColumn() |
|
282 | */ |
|
283 | public int getLayoutColumn() |
|
284 | { |
|
285 | return fragment.getLayoutColumn(); |
|
286 | } |
|
287 | ||
288 | /* (non-Javadoc) |
|
289 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutSizes() |
|
290 | */ |
|
291 | public String getLayoutSizes() |
|
292 | { |
|
293 | return fragment.getLayoutSizes(); |
|
294 | } |
|
295 | ||
296 | /* (non-Javadoc) |
|
297 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutX() |
|
298 | */ |
|
299 | public float getLayoutX() |
|
300 | { |
|
301 | return fragment.getLayoutX(); |
|
302 | } |
|
303 | ||
304 | /* (non-Javadoc) |
|
305 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutY() |
|
306 | */ |
|
307 | public float getLayoutY() |
|
308 | { |
|
309 | return fragment.getLayoutY(); |
|
310 | } |
|
311 | ||
312 | /* (non-Javadoc) |
|
313 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutZ() |
|
314 | */ |
|
315 | public float getLayoutZ() |
|
316 | { |
|
317 | return fragment.getLayoutZ(); |
|
318 | } |
|
319 | ||
320 | /* (non-Javadoc) |
|
321 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutWidth() |
|
322 | */ |
|
323 | public float getLayoutWidth() |
|
324 | { |
|
325 | return fragment.getLayoutWidth(); |
|
326 | } |
|
327 | ||
328 | /* (non-Javadoc) |
|
329 | * @see org.apache.jetspeed.om.page.Fragment#getLayoutHeight() |
|
330 | */ |
|
331 | public float getLayoutHeight() |
|
332 | { |
|
333 | return fragment.getLayoutHeight(); |
|
334 | } |
|
335 | ||
336 | /* (non-Javadoc) |
|
337 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutRow(int) |
|
338 | */ |
|
339 | public void setLayoutRow(int row) |
|
340 | { |
|
341 | fragment.setLayoutRow(row); |
|
342 | } |
|
343 | ||
344 | /* (non-Javadoc) |
|
345 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutColumn(int) |
|
346 | */ |
|
347 | public void setLayoutColumn(int column) |
|
348 | { |
|
349 | fragment.setLayoutColumn(column); |
|
350 | } |
|
351 | ||
352 | /* (non-Javadoc) |
|
353 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutSizes(java.lang.String) |
|
354 | */ |
|
355 | public void setLayoutSizes(String sizes) |
|
356 | { |
|
357 | fragment.setLayoutSizes(sizes); |
|
358 | } |
|
359 | ||
360 | /* (non-Javadoc) |
|
361 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutX(float) |
|
362 | */ |
|
363 | public void setLayoutX(float x) |
|
364 | { |
|
365 | fragment.setLayoutX(x); |
|
366 | } |
|
367 | ||
368 | /* (non-Javadoc) |
|
369 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutY(float) |
|
370 | */ |
|
371 | public void setLayoutY(float y) |
|
372 | { |
|
373 | fragment.setLayoutY(y); |
|
374 | } |
|
375 | ||
376 | /* (non-Javadoc) |
|
377 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutZ(float) |
|
378 | */ |
|
379 | public void setLayoutZ(float z) |
|
380 | { |
|
381 | fragment.setLayoutZ(z); |
|
382 | } |
|
383 | ||
384 | /* (non-Javadoc) |
|
385 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutWidth(float) |
|
386 | */ |
|
387 | public void setLayoutWidth(float width) |
|
388 | { |
|
389 | fragment.setLayoutWidth(width); |
|
390 | } |
|
391 | ||
392 | /* (non-Javadoc) |
|
393 | * @see org.apache.jetspeed.om.page.Fragment#setLayoutHeight(float) |
|
394 | */ |
|
395 | public void setLayoutHeight(float height) |
|
396 | { |
|
397 | fragment.setLayoutHeight(height); |
|
398 | } |
|
399 | ||
400 | /* (non-Javadoc) |
|
401 | * @see org.apache.jetspeed.om.page.Fragment#setSkin(java.lang.String) |
|
402 | */ |
|
403 | public void setSkin(String skinName) |
|
404 | { |
|
405 | ||
406 | fragment.setSkin(skinName); |
|
407 | } |
|
408 | ||
409 | /* (non-Javadoc) |
|
410 | * @see org.apache.jetspeed.om.page.Fragment#setState(java.lang.String) |
|
411 | */ |
|
412 | public void setState(String state) |
|
413 | { |
|
414 | ||
415 | fragment.setState(state); |
|
416 | } |
|
417 | ||
418 | /* (non-Javadoc) |
|
419 | * @see org.apache.jetspeed.om.page.Fragment#setMode(java.lang.String) |
|
420 | */ |
|
421 | public void setMode(String mode) |
|
422 | { |
|
423 | ||
424 | fragment.setMode(mode); |
|
425 | } |
|
426 | ||
427 | /* (non-Javadoc) |
|
428 | * @see org.apache.jetspeed.om.page.Fragment#setType(java.lang.String) |
|
429 | */ |
|
430 | public void setType(String type) |
|
431 | { |
|
432 | ||
433 | fragment.setType(type); |
|
434 | } |
|
435 | ||
436 | /* (non-Javadoc) |
|
437 | * @see org.apache.jetspeed.om.page.BaseElement#getId() |
|
438 | */ |
|
439 | public String getId() |
|
440 | { |
|
441 | ||
442 | return fragment.getId(); |
|
443 | } |
|
444 | ||
445 | /* (non-Javadoc) |
|
446 | * @see org.apache.jetspeed.om.page.BaseElement#getShortTitle() |
|
447 | */ |
|
448 | public String getShortTitle() |
|
449 | { |
|
450 | ||
451 | return fragment.getShortTitle(); |
|
452 | } |
|
453 | ||
454 | /* (non-Javadoc) |
|
455 | * @see org.apache.jetspeed.om.page.BaseElement#getTitle() |
|
456 | */ |
|
457 | public String getTitle() |
|
458 | { |
|
459 | ||
460 | return fragment.getTitle(); |
|
461 | } |
|
462 | ||
463 | /* (non-Javadoc) |
|
464 | * @see org.apache.jetspeed.om.page.BaseElement#setShortTitle(java.lang.String) |
|
465 | */ |
|
466 | public void setShortTitle(String title) |
|
467 | { |
|
468 | ||
469 | fragment.setShortTitle(title); |
|
470 | } |
|
471 | ||
472 | /* (non-Javadoc) |
|
473 | * @see org.apache.jetspeed.om.page.BaseElement#setTitle(java.lang.String) |
|
474 | */ |
|
475 | public void setTitle(String title) |
|
476 | { |
|
477 | ||
478 | fragment.setTitle(title); |
|
479 | } |
|
480 | ||
481 | /* (non-Javadoc) |
|
482 | * @see org.apache.jetspeed.om.common.SecuredResource#checkAccess(java.lang.String) |
|
483 | */ |
|
484 | public void checkAccess(String actions) throws SecurityException |
|
485 | { |
|
486 | ||
487 | fragment.checkAccess(actions); |
|
488 | } |
|
489 | ||
490 | /* (non-Javadoc) |
|
491 | * @see org.apache.jetspeed.om.common.SecuredResource#checkConstraints(java.lang.String) |
|
492 | */ |
|
493 | public void checkConstraints(String actions) throws SecurityException |
|
494 | { |
|
495 | ||
496 | fragment.checkConstraints(actions); |
|
497 | } |
|
498 | ||
499 | /* (non-Javadoc) |
|
500 | * @see org.apache.jetspeed.om.common.SecuredResource#checkPermissions(int) |
|
501 | */ |
|
502 | public void checkPermissions(int mask) throws SecurityException |
|
503 | { |
|
504 | ||
505 | fragment.checkPermissions(mask); |
|
506 | } |
|
507 | ||
508 | /* (non-Javadoc) |
|
509 | * @see org.apache.jetspeed.om.common.SecuredResource#getConstraintsEnabled() |
|
510 | */ |
|
511 | public boolean getConstraintsEnabled() |
|
512 | { |
|
513 | ||
514 | return fragment.getConstraintsEnabled(); |
|
515 | } |
|
516 | ||
517 | /* (non-Javadoc) |
|
518 | * @see org.apache.jetspeed.om.common.SecuredResource#getPermissionsEnabled() |
|
519 | */ |
|
520 | public boolean getPermissionsEnabled() |
|
521 | { |
|
522 | ||
523 | return fragment.getPermissionsEnabled(); |
|
524 | } |
|
525 | ||
526 | /* (non-Javadoc) |
|
527 | * @see org.apache.jetspeed.om.common.SecuredResource#getSecurityConstraints() |
|
528 | */ |
|
529 | public SecurityConstraints getSecurityConstraints() |
|
530 | { |
|
531 | ||
532 | return fragment.getSecurityConstraints(); |
|
533 | } |
|
534 | ||
535 | /* (non-Javadoc) |
|
536 | * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraints() |
|
537 | */ |
|
538 | public SecurityConstraints newSecurityConstraints() |
|
539 | { |
|
540 | ||
541 | return fragment.newSecurityConstraints(); |
|
542 | } |
|
543 | ||
544 | /* (non-Javadoc) |
|
545 | * @see org.apache.jetspeed.om.common.SecuredResource#newSecurityConstraint() |
|
546 | */ |
|
547 | public SecurityConstraint newSecurityConstraint() |
|
548 | { |
|
549 | ||
550 | return fragment.newSecurityConstraint(); |
|
551 | } |
|
552 | ||
553 | /* (non-Javadoc) |
|
554 | * @see org.apache.jetspeed.om.common.SecuredResource#setSecurityConstraints(org.apache.jetspeed.om.common.SecurityConstraints) |
|
555 | */ |
|
556 | public void setSecurityConstraints(SecurityConstraints constraints) |
|
557 | { |
|
558 | fragment.setSecurityConstraints(constraints); |
|
559 | } |
|
560 | ||
561 | ||
562 | /** |
|
563 | * Checks the ContentFragment cache for a ContentFragment |
|
564 | * that matches the <code>Id</code> of this fragment. If |
|
565 | * one is found, it returned. If no matches are found, a new |
|
566 | * <code>ContentFragment</code> represnentive of the {@link Fragment} |
|
567 | * argument is subsequently created, stored into the cahce and returned. |
|
568 | * |
|
569 | * @param f |
|
570 | * @return ContentFrament |
|
571 | */ |
|
572 | protected ContentFragment getContentFragment(Fragment f) |
|
573 | { |
|
574 | ContentFragment cf; |
|
575 | if(cachedFragments.containsKey(f.getId())) |
|
576 | { |
|
577 | cf = (ContentFragment) cachedFragments.get(f.getId()); |
|
578 | } |
|
579 | else |
|
580 | { |
|
581 | cf = new ContentFragmentImpl(f, cachedFragments); |
|
582 | cachedFragments.put(f.getId(), cf); |
|
583 | } |
|
584 | return cf; |
|
585 | } |
|
586 | ||
587 | ||
588 | 0 | protected final class ContentFragmentList implements List, Serializable |
589 | { |
|
590 | 0 | private List baseList = fragment.getFragments(); |
591 | ||
592 | /* (non-Javadoc) |
|
593 | * @see java.util.List#add(int, java.lang.Object) |
|
594 | */ |
|
595 | public void add(int index, Object element) |
|
596 | { |
|
597 | 0 | if (element instanceof ContentFragmentImpl) |
598 | 0 | element = ((ContentFragmentImpl)element).fragment; |
599 | 0 | baseList.add(index, element); |
600 | 0 | } |
601 | ||
602 | /* (non-Javadoc) |
|
603 | * @see java.util.List#add(java.lang.Object) |
|
604 | */ |
|
605 | public boolean add(Object o) |
|
606 | { |
|
607 | 0 | if (o instanceof ContentFragmentImpl) |
608 | 0 | o = ((ContentFragmentImpl)o).fragment; |
609 | 0 | return baseList.add(o); |
610 | } |
|
611 | ||
612 | /* (non-Javadoc) |
|
613 | * @see java.util.List#addAll(int, java.util.Collection) |
|
614 | */ |
|
615 | public boolean addAll(int index, Collection c) |
|
616 | { |
|
617 | ||
618 | 0 | return baseList.addAll(index, c); |
619 | } |
|
620 | ||
621 | /* (non-Javadoc) |
|
622 | * @see java.util.List#addAll(java.util.Collection) |
|
623 | */ |
|
624 | public boolean addAll(Collection c) |
|
625 | { |
|
626 | ||
627 | 0 | return baseList.addAll(c); |
628 | } |
|
629 | ||
630 | /* (non-Javadoc) |
|
631 | * @see java.util.List#clear() |
|
632 | */ |
|
633 | public void clear() |
|
634 | { |
|
635 | ||
636 | 0 | baseList.clear(); |
637 | 0 | } |
638 | ||
639 | /* (non-Javadoc) |
|
640 | * @see java.util.List#contains(java.lang.Object) |
|
641 | */ |
|
642 | public boolean contains(Object o) |
|
643 | { |
|
644 | ||
645 | 0 | return baseList.contains(o); |
646 | } |
|
647 | ||
648 | /* (non-Javadoc) |
|
649 | * @see java.util.List#containsAll(java.util.Collection) |
|
650 | */ |
|
651 | public boolean containsAll(Collection c) |
|
652 | { |
|
653 | ||
654 | 0 | return baseList.containsAll(c); |
655 | } |
|
656 | ||
657 | /* (non-Javadoc) |
|
658 | * @see java.util.List#equals(java.lang.Object) |
|
659 | */ |
|
660 | public boolean equals(Object o) |
|
661 | { |
|
662 | ||
663 | 0 | return baseList.equals(o); |
664 | } |
|
665 | ||
666 | /* (non-Javadoc) |
|
667 | * @see java.util.List#get(int) |
|
668 | */ |
|
669 | public Object get(int index) |
|
670 | { |
|
671 | 0 | Fragment f= (Fragment) baseList.get(index); |
672 | 0 | return getContentFragment(f); |
673 | } |
|
674 | ||
675 | /* (non-Javadoc) |
|
676 | * @see java.util.List#hashCode() |
|
677 | */ |
|
678 | public int hashCode() |
|
679 | { |
|
680 | ||
681 | 0 | return baseList.hashCode(); |
682 | } |
|
683 | ||
684 | /* (non-Javadoc) |
|
685 | * @see java.util.List#indexOf(java.lang.Object) |
|
686 | */ |
|
687 | public int indexOf(Object o) |
|
688 | { |
|
689 | ||
690 | 0 | return baseList.indexOf(o); |
691 | } |
|
692 | ||
693 | /* (non-Javadoc) |
|
694 | * @see java.util.List#isEmpty() |
|
695 | */ |
|
696 | public boolean isEmpty() |
|
697 | { |
|
698 | ||
699 | 0 | return baseList.isEmpty(); |
700 | } |
|
701 | ||
702 | /* (non-Javadoc) |
|
703 | * @see java.util.List#iterator() |
|
704 | */ |
|
705 | public Iterator iterator() |
|
706 | { |
|
707 | 0 | return duplicateList().iterator(); |
708 | } |
|
709 | ||
710 | /* (non-Javadoc) |
|
711 | * @see java.util.List#lastIndexOf(java.lang.Object) |
|
712 | */ |
|
713 | public int lastIndexOf(Object o) |
|
714 | { |
|
715 | ||
716 | 0 | return baseList.lastIndexOf(o); |
717 | } |
|
718 | ||
719 | /* (non-Javadoc) |
|
720 | * @see java.util.List#listIterator() |
|
721 | */ |
|
722 | public ListIterator listIterator() |
|
723 | { |
|
724 | 0 | return duplicateList().listIterator(); |
725 | } |
|
726 | ||
727 | /* (non-Javadoc) |
|
728 | * @see java.util.List#listIterator(int) |
|
729 | */ |
|
730 | public ListIterator listIterator(int index) |
|
731 | { |
|
732 | 0 | return duplicateList().listIterator(index); |
733 | } |
|
734 | ||
735 | /* (non-Javadoc) |
|
736 | * @see java.util.List#remove(int) |
|
737 | */ |
|
738 | public Object remove(int index) |
|
739 | { |
|
740 | ||
741 | 0 | return baseList.remove(index); |
742 | } |
|
743 | ||
744 | /* (non-Javadoc) |
|
745 | * @see java.util.List#remove(java.lang.Object) |
|
746 | */ |
|
747 | public boolean remove(Object o) |
|
748 | { |
|
749 | ||
750 | 0 | return baseList.remove(o); |
751 | } |
|
752 | ||
753 | /* (non-Javadoc) |
|
754 | * @see java.util.List#removeAll(java.util.Collection) |
|
755 | */ |
|
756 | public boolean removeAll(Collection c) |
|
757 | { |
|
758 | ||
759 | 0 | return baseList.removeAll(c); |
760 | } |
|
761 | ||
762 | /* (non-Javadoc) |
|
763 | * @see java.util.List#retainAll(java.util.Collection) |
|
764 | */ |
|
765 | public boolean retainAll(Collection c) |
|
766 | { |
|
767 | ||
768 | 0 | return baseList.retainAll(c); |
769 | } |
|
770 | ||
771 | /* (non-Javadoc) |
|
772 | * @see java.util.List#set(int, java.lang.Object) |
|
773 | */ |
|
774 | public Object set(int index, Object element) |
|
775 | { |
|
776 | ||
777 | 0 | return baseList.set(index, element); |
778 | } |
|
779 | ||
780 | /* (non-Javadoc) |
|
781 | * @see java.util.List#size() |
|
782 | */ |
|
783 | public int size() |
|
784 | { |
|
785 | ||
786 | 0 | return baseList.size(); |
787 | } |
|
788 | ||
789 | /* (non-Javadoc) |
|
790 | * @see java.util.List#subList(int, int) |
|
791 | */ |
|
792 | public List subList(int fromIndex, class="keyword">int toIndex) |
|
793 | { |
|
794 | 0 | return duplicateList().subList(fromIndex, toIndex); |
795 | } |
|
796 | ||
797 | ||
798 | ||
799 | /* (non-Javadoc) |
|
800 | * @see java.util.List#toArray() |
|
801 | */ |
|
802 | public Object[] toArray() |
|
803 | { |
|
804 | 0 | return duplicateList().toArray(); |
805 | } |
|
806 | ||
807 | /* (non-Javadoc) |
|
808 | * @see java.util.List#toArray(java.lang.Object[]) |
|
809 | */ |
|
810 | public Object[] toArray(Object[] a) |
|
811 | { |
|
812 | 0 | return duplicateList().toArray(a); |
813 | } |
|
814 | ||
815 | private List duplicateList() |
|
816 | { |
|
817 | 0 | List rFragList = DatabasePageManagerUtils.createList(); |
818 | 0 | for(int i=0; i < baseList.size(); i++) |
819 | { |
|
820 | 0 | Fragment f = (Fragment)baseList.get(i); |
821 | 0 | ContentFragment cf = getContentFragment(f); |
822 | 0 | rFragList.add(cf); |
823 | } |
|
824 | 0 | return rFragList; |
825 | } |
|
826 | ||
827 | ||
828 | ||
829 | } |
|
830 | ||
831 | /* (non-Javadoc) |
|
832 | * @see org.apache.jetspeed.om.page.Fragment#getPreferences() |
|
833 | */ |
|
834 | public List getPreferences() |
|
835 | { |
|
836 | return fragment.getPreferences(); |
|
837 | } |
|
838 | ||
839 | public Decoration getDecoration() |
|
840 | { |
|
841 | return decoration; |
|
842 | } |
|
843 | ||
844 | /* (non-Javadoc) |
|
845 | * @see org.apache.jetspeed.om.page.Fragment#setPreferences(java.util.List) |
|
846 | */ |
|
847 | public void setPreferences(List preferences) |
|
848 | { |
|
849 | fragment.setPreferences(preferences); |
|
850 | } |
|
851 | ||
852 | ||
853 | public void setDecoration(Decoration decoration) |
|
854 | { |
|
855 | this.decoration = decoration; |
|
856 | ||
857 | } |
|
858 | ||
859 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |