View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.wcm.publication;
18  
19  import java.util.HashMap;
20  import java.util.List;
21  
22  import javax.jcr.Node;
23  
24  import org.exoplatform.services.jcr.ext.common.SessionProvider;
25  import org.exoplatform.services.wcm.core.NodeLocation;
26  
27  /**
28   * Gets content inside WCM.
29   * In general, this service stands between publication and cache,
30   * so you should not access content directly from the JCR on the front side.
31   *
32   * @LevelAPI Experimental
33   */
34  public interface WCMComposer {
35  
36    /** Filter parameter to filter results by state. For example: draft, staged, published. */
37    public final static String FILTER_STATE = "filter-state";
38  
39    /** Filter parameter to filter results by primary type. For example: exo:webContent. */
40    public final static String FILTER_PRIMARY_TYPE = "filter-primary-type";
41  
42    /** Filter parameter to order results. For example: exo:title, dc:title. */
43    public final static String FILTER_ORDER_BY = "filter-order-by";
44  
45    /** Filter parameter to order results in ascending or descending order. Its values are: ASC and DESC. */
46    public final static String FILTER_ORDER_TYPE = "filter-order-type";
47  
48    /** Filter parameter to filter results by target mode. For example: editing, approving, live. */
49    public final static String FILTER_MODE = "filter-mode";
50  
51    /** Filter parameter to search recursively or not. For example: recursive.*/
52    public final static String FILTER_RECURSIVE = "filter-recursive";
53  
54    /** Filter parameter to filter results by a dedicated version. For example: base, 1, 2, 3, and more.*/
55    public final static String FILTER_VERSION = "filter-version";
56  
57    /** Filter parameter to filter results by site. For example: ACME. */
58    public final static String FILTER_SITE_NAME = "filter-site";
59  
60    /** Filter parameter to filter results by user. This means only content authored by this user is returned. */
61    public final static String FILTER_REMOTE_USER = "filter-remote-user";
62  
63    /** Filter parameter to filter results by language. This means only content in this language is returned. For example: fr, en, de. */
64    public final static String FILTER_LANGUAGE = "filter-language";
65  
66    /** Filter parameter to add a parameter to the executed query. For example: "AND exo:myproperty like 'cat1%'".*/
67    public final static String FILTER_QUERY = "filter-query";
68  
69    /** Filter parameter to execute a specific query. For example: "SELECT * from nt:base".*/
70    public final static String FILTER_QUERY_FULL = "filter-query-full";
71  
72    /** Filter parameter to limit the result size. */
73    public final static String FILTER_LIMIT = "filter-limit";
74  
75    /** Filter parameter to return results with an offset delimiter. */
76    public final static String FILTER_OFFSET = "filter-offset";
77  
78    /** Total number of content. */
79    public final static String FILTER_TOTAL = "filter-total-number";
80  
81    /** Filter parameter to filter results by visibility. For example: public, user. */
82    public final static String FILTER_VISIBILITY = "filter-visibility";
83  
84    /** Mode of portlet. **/
85    public final static String PORTLET_MODE = "portlet-mode";
86  
87    /** The constant MODE_EDIT. */
88    public final static String MODE_EDIT = "Edit";
89  
90    /** The constant MODE_LIVE. */
91    public final static String MODE_LIVE = "Live";
92  
93    /** The constant IS_RECURSIVE. */
94    public final static String IS_RECURSIVE = "rec";
95  
96    /** The constant for base version. */
97    public final static String BASE_VERSION = "base";
98  
99    /** The constant VISIBILITY PUBLIC. */
100   public final static String VISIBILITY_PUBLIC = "public";
101 
102   /** The constant VISIBILITY USER. */
103   public final static String VISIBILITY_USER = "user";
104 
105   /**
106    * Gets a content node at a specified path based on given filters.
107    *
108    * @param workspace The workspace that includes the content node.
109    * @param nodeIdentifier Identifier of the content node.
110    * @param filters The given filters.
111    * @param sessionProvider The session provider.
112    * @return The content node.
113    * @throws Exception The exception
114    */
115   public Node getContent(String workspace,
116                          String nodeIdentifier,
117                          HashMap<String, String> filters,
118                          SessionProvider sessionProvider) throws Exception;
119 
120   /**
121    * Gets content nodes at a specified path based on given filters.
122    * 
123    * @param workspace The workspace that includes the content nodes.
124    * @param path The path.
125    * @param filters The given filters.
126    * @param sessionProvider The session provider.
127    * @return The list of content nodes.
128    * @throws Exception The exception
129    */
130   public List<Node> getContents(String workspace,
131                                 String path,
132                                 HashMap<String, String> filters,
133                                 SessionProvider sessionProvider) throws Exception;
134 
135   /**
136    * Gets content nodes that are paginated at a specified path based on given filters.
137    *
138    * @param nodeLocation Location of the content nodes.
139    * @param filters The given filters.
140    * @param sessionProvider The session provider.
141    * @return The list of content nodes.
142    * @throws Exception The exception
143    */
144  public Result getPaginatedContents(NodeLocation nodeLocation,
145                                                              HashMap<String, String> filters,
146                                                              SessionProvider sessionProvider) throws Exception ;
147 															 
148   /**
149    * Gets the allowed states for a given mode.
150    *
151    * @param mode The given mode.
152    * @return The list of states.
153    * @throws Exception The exception
154    */
155   public List<String> getAllowedStates(String mode) throws Exception ;
156 
157   /**
158    * Resets the template filters.
159    *
160    * @throws Exception the exception
161    */
162   public void cleanTemplates() throws Exception ;
163 
164   /**
165    * Updates the SQL filter of templates.
166    *
167    * @return A part of the query that allows to search all document nodes and taxonomy links. It returns "null" if there is any exception.
168    * @throws Exception the exception
169    */
170   public String updateTemplatesSQLFilter() throws Exception;
171 }