View Javadoc

1   /**
2    * Copyright (C) 2005-2009 Alfresco Software Limited.
3    *
4    * This file is part of the Spring Surf Extension project.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *  http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  package org.springframework.extensions.surf.types;
20  
21  import java.util.Map;
22  
23  import org.springframework.extensions.surf.ModelObject;
24  import org.springframework.extensions.surf.RequestContext;
25  import org.springframework.extensions.webscripts.Description.RequiredAuthentication;
26  
27  /**
28   * Interface for a Page object type
29   * 
30   * @author muzquiano
31   */
32  public interface Page extends ModelObject
33  {
34      // type
35      public static String TYPE_ID = "page";
36      
37      // properties
38      public static String PROP_TEMPLATE_INSTANCE = "template-instance";
39      public static String ATTR_FORMAT_ID = "format-id";
40      public static String PROP_PAGE_TYPE_ID = "page-type-id";
41      public static String PROP_AUTHENTICATION = "authentication";
42      public static String DEFAULT_PAGE_TYPE_ID = "generic";
43          
44      /**
45       * Gets the template id.
46       * 
47       * @return the template id
48       */
49      public String getTemplateId();
50  
51      /**
52       * Gets the template id.
53       * 
54       * @param formatId the format id
55       * 
56       * @return the template id
57       */
58      public String getTemplateId(String formatId);
59  
60      /**
61       * Sets the template id.
62       * 
63       * @param templateId the new template id
64       */
65      public void setTemplateId(String templateId);
66  
67      /**
68       * Sets the template id.
69       * 
70       * @param templateId the template id
71       * @param formatId the format id
72       */
73      public void setTemplateId(String templateId, String formatId);
74  
75      /**
76       * Removes the template id.
77       * 
78       * @param formatId the format id
79       */
80      public void removeTemplateId(String formatId);
81  
82      /**
83       * Gets the templates.
84       * 
85       * @param context the context
86       * 
87       * @return the templates
88       */
89      public Map<String, TemplateInstance> getTemplates(RequestContext context);
90  
91      /**
92       * Gets the template.
93       * 
94       * @param context the context
95       * 
96       * @return the template
97       */
98      public TemplateInstance getTemplate(RequestContext context);
99  
100     /**
101      * Gets the template.
102      * 
103      * @param context the context
104      * @param formatId the format id
105      * 
106      * @return the template
107      */
108     public TemplateInstance getTemplate(RequestContext context, String formatId);
109 
110     /**
111      * Gets the child pages.
112      * 
113      * @param context the context
114      * 
115      * @return the child pages
116      */
117     public Page[] getChildPages(RequestContext context);
118     
119     /**
120      * Gets the page type id.
121      * 
122      * @return the page type id
123      */
124     public String getPageTypeId();
125     
126     /**
127      * Sets the page type id.
128      * 
129      * @param pageTypeId the new page type id
130      */
131     public void setPageTypeId(String pageTypeId);
132     
133     /**
134      * @return the Authentication required for this page
135      */
136     public RequiredAuthentication getAuthentication();
137 
138     /**
139      * @param authentication    the authentication level to set
140      */
141     public void setAuthentication(String authentication);
142 
143     /**
144      * Gets the page type.
145      * 
146      * @param context the context
147      * 
148      * @return the page type
149      */
150     public PageType getPageType(RequestContext context);
151 }