KickJava   Java API By Example, From Geeks To Geeks.

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


1
2 package org.roller.model;
3
4 import org.roller.RollerException;
5 import org.roller.pojos.PageData;
6 import org.roller.pojos.RoleData;
7 import org.roller.pojos.UserData;
8 import org.roller.pojos.WebsiteData;
9
10 import java.io.Serializable JavaDoc;
11 import java.util.Map JavaDoc;
12 import java.util.List JavaDoc;
13
14
15 /**
16  * Manages storage, retrieval, and querying of user, website, and page data.
17  *
18  * @author David M Johnson
19  */

20 public interface UserManager extends Serializable JavaDoc
21 {
22     /**
23      * Release all resources associated with Roller session.
24      */

25     public void release();
26     
27     //--------------------------------------------------------------- UserData
28

29     /** Get all enabled users */
30     public List JavaDoc getUsers() throws RollerException;
31     
32     /** Get all users, optionally include dis-enabled users */
33     public List JavaDoc getUsers(boolean enabledOnly) throws RollerException;
34
35     /** Get user object by user name (only enabled users) */
36     public UserData getUser( String JavaDoc userName ) throws RollerException;
37
38     /** Get user object by user name, optionally include dis-enabled users */
39     public UserData getUser( String JavaDoc userName, boolean enabledOnly ) throws RollerException;
40
41     /** Add a new user with pages, bookmarks, folders...
42      * @param user New user object to be added to database
43      * @param themeDir Directory containing theme for user
44      */

45     public void addUser( UserData user, Map JavaDoc page, String JavaDoc theme,
46             String JavaDoc locale, String JavaDoc timezone)
47         throws RollerException;
48
49     /**
50      * Get user by ID
51      */

52     public UserData retrieveUser(String JavaDoc id)throws RollerException;
53     /**
54      * Store user.
55      */

56     public void storeUser( UserData data ) throws RollerException;
57
58     /**
59      * Get all user roles.
60      */

61     public List JavaDoc getUserRoles(UserData user) throws RollerException;
62     /**
63      * Get role by ID
64      */

65     public RoleData retrieveRole(String JavaDoc id) throws RollerException;
66     /**
67      * Store role.
68      */

69     public void storeRole( RoleData data ) throws RollerException;
70     /**
71      * Remove role by ID.
72      */

73     public void removeRole( String JavaDoc id ) throws RollerException;
74
75     //------------------------------------------------------------ WebsiteData
76

77     /** Get website object by user name */
78     public WebsiteData getWebsite(String JavaDoc userName) throws RollerException;
79     /**
80      * Get website by username.
81      * @param userName Username of website's owner
82      * @param enabledOnly Only return enabled websites.
83      * @throws org.roller.RollerException
84      * @return
85      */

86     public WebsiteData getWebsite(String JavaDoc userName, boolean enabledOnly) throws RollerException;
87
88     /**
89      * Get website by ID
90      */

91     public WebsiteData retrieveWebsite(String JavaDoc id) throws RollerException;
92     /**
93      * Store website
94      */

95     public void storeWebsite(WebsiteData data) throws RollerException;
96     /**
97      * Remove website by ID.
98      */

99     public void removeWebsite(String JavaDoc id) throws RollerException;
100
101     //--------------------------------------------------------------- PageData
102

103     /** Get user's page by name */
104     public PageData getPageByName(WebsiteData w, String JavaDoc p) throws RollerException;
105
106     /** Get user's page by link */
107     public PageData getPageByLink(WebsiteData w, String JavaDoc p) throws RollerException;
108
109     /** Fix page link using page name */
110     public String JavaDoc fixPageLink(PageData data) throws RollerException;
111
112     /** Get users pages */
113     public List JavaDoc getPages(WebsiteData w) throws RollerException;
114
115     /**
116      * Get page by ID
117      */

118     public PageData retrievePage(String JavaDoc id) throws RollerException;
119     /**
120      * Store page
121      */

122     public void storePage(PageData data) throws RollerException;
123     /**
124      * Remove page by ID
125      */

126     public void removePage(String JavaDoc id) throws RollerException;
127
128
129     /**
130      * Remove page safely. This will throw an exception on attempts to remove mandatory website pages such as the
131      * website's default page.
132      * @param id id of the page to be removed
133      * @throws RollerException with root cause <code>IllegalArgumentException</code> if the page id is that of
134      * a page that will not be removed by this method.
135      */

136     public void removePageSafely(String JavaDoc id) throws RollerException;
137
138     /**
139      * Retrieve the Page in read-only mode (does hibernate support this?).
140      */

141     public PageData retrievePageReadOnly(String JavaDoc id) throws RollerException;
142     
143     /**
144      * Validates a user based on a cookie value. If successful, it returns
145      * a new cookie String. If not, then it returns null.
146      *
147      * @param value (in format username|guid)
148      * @return indicator that this is a valid login
149      * @throws Exception
150      */

151     public String JavaDoc checkLoginCookie(String JavaDoc value) throws RollerException;
152  
153     /**
154      * Creates a cookie string using a username - designed for use when
155      * a user logs in and wants to be remembered.
156      *
157      * @param username
158      * @return String to put in a cookie for remembering user
159      * @throws Exception
160      */

161     public String JavaDoc createLoginCookie(String JavaDoc username) throws RollerException;
162     
163     /**
164      * Deletes all cookies for user.
165      * @param username
166      */

167     public void removeLoginCookies(String JavaDoc username) throws RollerException;
168
169     /**
170      * Remove website(s) associated with user.
171      */

172     public void removeUserWebsites(UserData data) throws RollerException;
173
174     /**
175      * Remove contents of website.
176      */

177     public void removeWebsiteContents(WebsiteData data) throws RollerException;
178 }
179
180
181
182
Popular Tags