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.cms.timeline;
18  
19  import java.util.List;
20  
21  import javax.jcr.Node;
22  
23  import org.exoplatform.services.jcr.ext.common.SessionProvider;
24  
25  /**
26   * Supports to get all documents by time frame (days, months and years).
27   * The configuration of this component is found in /core/core-configuration/src/main/webapp/WEB-INF/conf/wcm-core/core-services-configuration.xml.
28   * <p></p>
29   * <pre>
30   * &lt;component&gt;
31   *     &lt;key&gt;org.exoplatform.services.cms.timeline.TimelineService&lt;/key&gt;
32   *     &lt;type&gt;org.exoplatform.services.cms.timeline.impl.TimelineServiceImpl&lt;/type&gt;
33   *     &lt;init-params&gt;
34   *         &lt;value-param&gt;
35   *             &lt;name&gt;itemPerTimeline&lt;/name&gt;
36   *             &lt;value&gt;5&lt;/value&gt;
37   *         &lt;/value-param&gt;
38   *     &lt;/init-params&gt;
39   * &lt;/component&gt;
40   * </pre>
41   *
42   * @LevelAPI Experimental
43   */
44  public interface TimelineService {
45  
46    /**
47     * Gets all documents of today.
48     *
49     * @param nodePath Path of the current node.
50     * @param workspace Name of the workspace.
51     * @param sessionProvider The session provider.
52     * @param userName The logged-in user.
53     * @param byUser Shows documents by current user or by all users.
54     * @return The list of documents.
55     * @throws Exception The exception
56     */
57    public List<Node> getDocumentsOfToday(String nodePath,
58                                          String workspace,
59                                          SessionProvider sessionProvider,
60                                          String userName,
61                                          boolean byUser) throws Exception;
62    
63    /**
64     * Gets all documents of today.
65     *
66     * @param nodePath Path of the current node.
67     * @param workspace Name of the workspace.
68     * @param sessionProvider The session provider.
69     * @param userName The logged-in user.
70     * @param byUser Shows documents by current user or by all users.
71     * @param isLimit Indicates the limitation of query is enabled or not.
72     * @return The list of documents.
73     * @throws Exception The exception
74     */
75    public List<Node> getDocumentsOfToday(String nodePath,
76                                          String workspace,
77                                          SessionProvider sessionProvider,
78                                          String userName,
79                                          boolean byUser,
80                                          boolean isLimit) throws Exception;  
81  
82    /**
83     * Gets all documents of yesterday.
84     * 
85     * @param nodePath Path of the current node.
86     * @param workspace Name of the workspace.
87     * @param sessionProvider The session provider.
88     * @param userName The logged-in user.
89     * @param byUser Shows documents by current user or by all users.
90     * @return The list of documents.
91     * @throws Exception The exception
92     */
93    public List<Node> getDocumentsOfYesterday(String nodePath,
94                                              String workspace,
95                                              SessionProvider sessionProvider,
96                                              String userName,
97                                              boolean byUser) throws Exception;
98    
99    /**
100    * Gets all documents of yesterday.
101    *
102    * @param nodePath Path of the current node.
103    * @param workspace Name of the workspace.
104    * @param sessionProvider The session provider.
105    * @param userName The logged-in user.
106    * @param byUser Shows documents by current user or by all users
107    * @param isLimit Indicates the limitation of query is enabled or not.
108    * @return The list of documents.
109    * @throws Exception The exception
110    */
111   public List<Node> getDocumentsOfYesterday(String nodePath,
112                                             String workspace,
113                                             SessionProvider sessionProvider,
114                                             String userName,
115                                             boolean byUser,
116                                             boolean isLimit) throws Exception;   
117 
118   /**
119    * Gets all documents earlier this week.
120    *
121    * @param nodePath Path of the current node.
122    * @param workspace Name of the workspace.
123    * @param sessionProvider The session provider.
124    * @param userName The logged-in user.
125    * @param byUser Shows documents by current user or by all users.
126    * @return The list of documents.
127    * @throws Exception The exception
128    */
129   public List<Node> getDocumentsOfEarlierThisWeek(String nodePath,
130                                                   String workspace,
131                                                   SessionProvider sessionProvider,
132                                                   String userName,
133                                                   boolean byUser) throws Exception;
134   
135   /**
136    * Gets all documents earlier this week.
137    *
138    * @param nodePath Path of the current node.
139    * @param workspace Name of the workspace.
140    * @param sessionProvider The session provider.
141    * @param userName The logged-in user.
142    * @param byUser Shows documents by current user or by all users
143    * @param isLimit Indicates the limitation of query is enabled or not.
144    * @return The list of documents.
145    * @throws Exception The exception
146    */
147   public List<Node> getDocumentsOfEarlierThisWeek(String nodePath,
148                                                   String workspace,
149                                                   SessionProvider sessionProvider,
150                                                   String userName,
151                                                   boolean byUser,
152                                                   boolean isLimit) throws Exception;
153 
154   /**
155    * Gets all documents earlier this month.
156    *
157    * @param nodePath Path of the current node.
158    * @param workspace Name of the workspace.
159    * @param sessionProvider The session provider.
160    * @param userName The logged-in user.
161    * @param byUser Shows documents by current user or by all users.
162    * @return The list of documents.
163    * @throws Exception The exception
164    */
165   public List<Node> getDocumentsOfEarlierThisMonth(String nodePath,
166                                                    String workspace,
167                                                    SessionProvider sessionProvider,
168                                                    String userName,
169                                                    boolean byUser) throws Exception;
170   
171   /**
172    * Gets all documents earlier this month.
173    *
174    * @param nodePath Path of the current node.
175    * @param workspace Name of the workspace.
176    * @param sessionProvider The session provider.
177    * @param userName The logged-in user.
178    * @param byUser Shows documents by current user or by all users.
179    * @param isLimit Indicates the limitation of query is enabled or not.
180    * @return The list of documents.
181    * @throws Exception The exception
182    */
183   public List<Node> getDocumentsOfEarlierThisMonth(String nodePath,
184                                                    String workspace,
185                                                    SessionProvider sessionProvider,
186                                                    String userName,
187                                                    boolean byUser,
188                                                    boolean isLimit) throws Exception;  
189 
190   /**
191    * Gets all documents earlier this year.
192    *
193    * @param nodePath Path of the current node.
194    * @param workspace Name of the workspace.
195    * @param sessionProvider The session provider.
196    * @param userName The logged-in user.
197    * @param byUser Shows documents by current user or by all users.
198    * @return The list of documents.
199    * @throws Exception The exception
200    */
201   public List<Node> getDocumentsOfEarlierThisYear(String nodePath,
202                                                   String workspace,
203                                                   SessionProvider sessionProvider,
204                                                   String userName,
205                                                   boolean byUser) throws Exception;
206   
207   /**
208    * Gets all documents earlier this year.
209    *
210    * @param nodePath Path of the current node.
211    * @param workspace Name of the workspace.
212    * @param sessionProvider The session provider.
213    * @param userName The logged-in user.
214    * @param byUser Shows documents by current user or by all users
215    * @param isLimit Indicates the limitation of query is enabled or not.
216    * @return The list of documents.
217    * @throws Exception The exception
218    */
219   public List<Node> getDocumentsOfEarlierThisYear(String nodePath,
220                                                   String workspace,
221                                                   SessionProvider sessionProvider,
222                                                   String userName,
223                                                   boolean byUser,
224                                                   boolean isLimit) throws Exception;
225   
226   /**
227    * Gets the number of items per category displayed in the Timeline view.
228    * 
229    * @return The number of items.
230    */
231   public int getItemPerTimeline();
232 }