KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > roller > model > UserManager


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. The ASF licenses this file to You
4 * under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. For additional information regarding
15 * copyright in this work, please see the NOTICE file in the top level
16 * directory of this distribution.
17 */

18
19 package org.apache.roller.model;
20
21 import java.util.Date JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24 import org.apache.roller.RollerException;
25 import org.apache.roller.pojos.WeblogTemplate;
26 import org.apache.roller.pojos.PermissionsData;
27 import org.apache.roller.pojos.UserData;
28 import org.apache.roller.pojos.WebsiteData;
29
30 /**
31  * Manages users, weblogs, permissions, and weblog pages.
32  */

33 public interface UserManager {
34         
35     /**
36      * Add new user object to Roller. User will be given the global editor role,
37      * unless it's the first user, who will get the global admin role.
38      * @param user User object to be added, initialized with name, password, etc.
39      */

40     public void addUser(UserData newUser) throws RollerException;
41         
42     /**
43      * Store a single user.
44      */

45     public void saveUser(UserData data) throws RollerException;
46     
47     /**
48      * Remove user.
49      */

50     public void removeUser(UserData user) throws RollerException;
51     
52     /**
53      * Get user by id.
54      */

55     public UserData getUser(String JavaDoc id) throws RollerException;
56     
57     
58     /**
59      * Get user object by user name (only enabled users)
60      */

61     public UserData getUserByUserName(String JavaDoc userName) throws RollerException;
62     
63     /**
64      * Get user object by user name, optionally include dis-enabled users
65      */

66     public UserData getUserByUserName(String JavaDoc userName, Boolean JavaDoc enabled)
67             throws RollerException;
68     
69     /**
70      * Get all enabled users
71      */

72     public List JavaDoc getUsers(int offset, int length) throws RollerException;
73     
74     /**
75      * Get all users, optionally include dis-enabled users.
76      * @param enabled True for enabled only, false for disabled only, null for all
77      * @param startDate Restrict to those created after (or null for all)
78      * @param endDate Restrict to those created before (or null for all)
79      */

80     public List JavaDoc getUsers(
81         Boolean JavaDoc enabled,
82         Date JavaDoc startDate,
83         Date JavaDoc endDate,
84         int offset,
85         int length) throws RollerException;
86     
87     /**
88      * Get all users or a website.
89      *
90      * @param website Get all users of this website (or null for all)
91      * @returns List of UserData objects.
92      */

93     public List JavaDoc getUsers(
94         WebsiteData website,
95         Boolean JavaDoc enabled,
96         int offset,
97         int length) throws RollerException;
98         
99     /**
100      * Returns users whose usernames or email addresses start with a string.
101      * @param startsWith String to match userNames and emailAddresses against
102      * @param offset Offset into results (for paging)
103      * @param length Max to return (for paging)
104      * @param enabled True for only enalbed, false for disabled, null for all
105      * @return List of (up to length) users that match startsWith string
106      */

107     public List JavaDoc getUsersStartingWith(String JavaDoc startsWith,
108             Boolean JavaDoc enabled, int offset, int length) throws RollerException;
109     
110     /**
111      * Get map with 26 entries, one for each letter A-Z and
112      * containing integers reflecting the number of users whose
113      * names start with each letter.
114      */

115     public Map JavaDoc getUserNameLetterMap() throws RollerException;
116     
117     /** Get collection of users whose names begin with specified letter */
118     public List JavaDoc getUsersByLetter(char letter, int offset, int length) throws RollerException;
119     
120     /**
121      * Get map with 26 entries, one for each letter A-Z and
122      * containing integers reflecting the number of weblogs whose
123      * names start with each letter.
124      */

125     public Map JavaDoc getWeblogHandleLetterMap() throws RollerException;
126     
127     /** Get collection of weblogs whose handles begin with specified letter */
128     public List JavaDoc getWeblogsByLetter(char letter, int offset, int length) throws RollerException;
129     
130     /**
131      * Add new website, give creator admin permission, creates blogroll,
132      * creates categories and other objects required for new website.
133      * @param newWebsite New website to be created, must have creator.
134      */

135     public void addWebsite(WebsiteData newWebsite) throws RollerException;
136     
137     /**
138      * Store a single weblog.
139      */

140     public void saveWebsite(WebsiteData data) throws RollerException;
141     
142     /**
143      * Remove website object.
144      */

145     public void removeWebsite(WebsiteData website) throws RollerException;
146     
147     /**
148      * Get website object by name.
149      */

150     public WebsiteData getWebsite(String JavaDoc id) throws RollerException;
151        
152     /**
153      * Get website specified by handle (or null if enabled website not found).
154      * @param handle Handle of website
155      */

156     public WebsiteData getWebsiteByHandle(String JavaDoc handle) throws RollerException;
157     
158     /**
159      * Get website specified by handle with option to return only enabled websites.
160      * @param handle Handle of website
161      */

162     public WebsiteData getWebsiteByHandle(String JavaDoc handle, Boolean JavaDoc enabled)
163             throws RollerException;
164         
165     /**
166      * Get websites optionally restricted by user, enabled and active status.
167      * @param user Get all websites for this user (or null for all)
168      * @param offset Offset into results (for paging)
169      * @param len Maximum number of results to return (for paging)
170      * @param enabled Get all with this enabled state (or null or all)
171      * @param active Get all with this active state (or null or all)
172      * @param startDate Restrict to those created after (or null for all)
173      * @param endDate Restrict to those created before (or null for all)
174      * @returns List of WebsiteData objects.
175      */

176     public List JavaDoc getWebsites(
177         UserData user,
178         Boolean JavaDoc enabled,
179         Boolean JavaDoc active,
180         Date JavaDoc startDate,
181         Date JavaDoc endDate,
182         int offset,
183         int length)
184         throws RollerException;
185     
186     /**
187      * Get websites ordered by descending number of comments.
188      * @param startDate Restrict to those created after (or null for all)
189      * @param endDate Restrict to those created before (or null for all)
190      * @param offset Offset into results (for paging)
191      * @param len Maximum number of results to return (for paging)
192      * @returns List of WebsiteData objects.
193      */

194     public List JavaDoc getMostCommentedWebsites(
195         Date JavaDoc startDate,
196         Date JavaDoc endDate,
197         int offset,
198         int length)
199         throws RollerException;
200     
201     /**
202      * Save permissions object.
203      */

204     public void savePermissions(PermissionsData perms) throws RollerException;
205     
206     /**
207      * Remove permissions object.
208      */

209     public void removePermissions(PermissionsData perms) throws RollerException;
210     
211     /**
212      * Get permissions object by id.
213      */

214     public PermissionsData getPermissions(String JavaDoc id) throws RollerException;
215     
216     /**
217      * Get pending permissions for user.
218      * @param user User (not null)
219      * @returns List of PermissionsData objects.
220      */

221     public List JavaDoc getPendingPermissions(UserData user) throws RollerException;
222     
223     /**
224      * Get pending permissions for website.
225      * @param website Website (not null)
226      * @returns List of PermissionsData objects.
227      */

228     public List JavaDoc getPendingPermissions(WebsiteData user) throws RollerException;
229     
230     /**
231      * Get permissions of user in website.
232      * @param website Website (not null)
233      * @param user User (not null)
234      * @return PermissionsData object
235      */

236     public PermissionsData getPermissions(WebsiteData website, UserData user)
237             throws RollerException;
238     
239     /**
240      * Get all permissions in website
241      * @param website Website (not null)
242      * @return PermissionsData object
243      */

244     public List JavaDoc getAllPermissions(WebsiteData website) throws RollerException;
245     
246     /**
247      * Get all permissions of user
248      * @param user User (not null)
249      * @return PermissionsData object
250      */

251     public List JavaDoc getAllPermissions(UserData user) throws RollerException;
252     
253     /**
254      * Invite user to join a website with specific permissions
255      * @param website Website to be joined (persistent instance)
256      * @param user User to be invited (persistent instance)
257      * @param perms Permissions mask (see statics in PermissionsData)
258      * @return New PermissionsData object, with pending=true
259      */

260     public PermissionsData inviteUser(
261             WebsiteData website, UserData user, short perms)
262             throws RollerException;
263         
264     /**
265      * Retire user from a website
266      * @param website Website to be retired from (persistent instance)
267      * @param user User to be retired (persistent instance)
268      */

269     public void retireUser(WebsiteData website, UserData user)
270             throws RollerException;
271         
272     /**
273      * Store page.
274      */

275     public void savePage(WeblogTemplate data) throws RollerException;
276     
277     /**
278      * Remove page.
279      */

280     public void removePage(WeblogTemplate page) throws RollerException;
281     
282     /**
283      * Get page by id.
284      */

285     public WeblogTemplate getPage(String JavaDoc id) throws RollerException;
286     
287     /**
288      * Get user's page by name.
289      */

290     public WeblogTemplate getPageByName(WebsiteData w, String JavaDoc p) throws RollerException;
291     
292     /**
293      * Get website's page by link.
294      */

295     public WeblogTemplate getPageByLink(WebsiteData w, String JavaDoc p)
296         throws RollerException;
297     
298     /**
299      * Get website's pages
300      */

301     public List JavaDoc getPages(WebsiteData w) throws RollerException;
302     
303     /**
304      * Release any resources held by manager.
305      */

306     public void release();
307     
308 }
309
310
311
312
Popular Tags