View Javadoc

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.util.List;
20  
21  /***
22   * PageFragment is a volatile wrapper around a 
23   * {@link org.apache.jetspeed.om.page.Page} metadata
24   * object for use in rendering.  As with 
25   * the {@link org.apache.jetspeed.om.page.Fragment} object,
26   * <code>Page</code> objects are persistent, single-instance 
27   * metadata objects that should not be used to hold per-request
28   * content.  ContentPage solves this by providing a thin, wrapper
29   * interface that can be used for rendering requested content associated
30   * with the wrapped page relative to the currect user-request. 
31   * 
32   * @author weaver@apache.org
33   *
34   */
35  public interface ContentPage extends Page
36  {
37    /***
38     * Provides access to a per-request safe ContentFragment.
39     * ContentFragments add the additional ability to temporarily
40     * store rendered content of the current request along with
41     * original, persistent metadata of the Fragment itself.
42     * 
43     * @return ContentFragment wrapping the actual root Fragment.
44     */
45    ContentFragment getRootContentFragment();
46    
47    void setRootContentFragment(ContentFragment frag);
48  
49    /***
50     * Returns a ContentFragment that wraps the actual
51     * Fragment metadata represented by the id argument.
52     * @param id unique id of the Fragment we want to retrieve.
53     * @return
54     */
55    ContentFragment getContentFragmentById(String id);
56  
57  
58  
59    /***
60     * Returns a list of ContentFragment that wrap the actual
61     * Fragment metadata represented by the name argument.
62     * @param name name of the Fragments we want to retrieve.
63     * @return
64     */
65    List getContentFragmentsByName(String name);
66  
67  
68  
69  /***
70   * Overridden to to indicate that the {@link Fragment} returned
71   * must also be an instance of ContentFragment.
72   *
73   * @param id the fragment id to look for
74   * @return the found ContentFragment object or null if not found
75   */
76   Fragment getFragmentById(String id);
77  
78  
79  
80  /***
81   * Overridden to to indicate that the list of {@link Fragment}
82   * instances returned must also be instances of ContentFragment.
83   *
84   * @param name the fragments name to look for
85   * @return the list of found ContentFragment object or null if not found
86   */
87   List getFragmentsByName(String name);
88  
89  
90  
91  /***
92   * Overridden to to indicate that the {@link Fragment} returned
93   * must also be an instance of ContentFragment.
94   *
95   * @return the base Fragment object for this page.
96   */    
97   Fragment getRootFragment();
98  }