KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > library > right > LibraryRights


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: LibraryRights.java,v $
31  * Revision 1.4 2005/04/29 02:48:16 colinmacleod
32  * Data bugfixes.
33  * Changed primary key back to Integer.
34  *
35  * Revision 1.3 2005/04/10 20:09:45 colinmacleod
36  * Added new themes.
37  * Changed id type to String.
38  * Changed i tag to em and b tag to strong.
39  * Improved PicoContainerFactory with NanoContainer scripts.
40  *
41  * Revision 1.2 2005/04/09 17:19:46 colinmacleod
42  * Changed copyright text to GPL v2 explicitly.
43  *
44  * Revision 1.1.1.1 2005/03/10 17:51:59 colinmacleod
45  * Restructured ivata op around Hibernate/PicoContainer.
46  * Renamed ivata groupware.
47  *
48  * Revision 1.3 2004/11/12 18:16:05 colinmacleod
49  * Ordered imports.
50  *
51  * Revision 1.2 2004/11/12 15:57:16 colinmacleod
52  * Removed dependencies on SSLEXT.
53  * Moved Persistence classes to ivata masks.
54  *
55  * Revision 1.1 2004/07/13 19:47:29 colinmacleod
56  * Moved project to POJOs from EJBs.
57  * Applied PicoContainer to services layer (replacing session EJBs).
58  * Applied Hibernate to persistence layer (replacing entity EJBs).
59  * -----------------------------------------------------------------------------
60  */

61 package com.ivata.groupware.business.library.right;
62
63 import java.util.Collection JavaDoc;
64
65 import com.ivata.groupware.admin.security.server.SecuritySession;
66 import com.ivata.groupware.business.library.comment.CommentDO;
67 import com.ivata.mask.util.SystemException;
68
69 /**
70  * <p>
71  * TODO: add a comment for this type.
72  * </p>
73  *
74  * @author Colin MacLeod
75  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
76  * @since Jun 19, 2004
77  * @version $Revision: 1.4 $
78  */

79
80 public interface LibraryRights {
81
82     /**
83      * <p>
84      * This method changes ADD rights. Users in the specified groups will be
85      * able to add ITEMS with this TOPIC.
86      * </p>
87      *
88      * <p>
89      * It's works only with those groups which can be seen by the user.
90      * if I am adding ADD right for a group and the user has not VIEW right
91      * -> also create a VIEW right for that group.
92      * </p>
93      *
94      * @param id of TOPIC
95      * @param userName user vhich is goin to change rights
96      * @param rights collection of groups for which we will set up ADD right
97      */

98     public abstract void amendAddRightsForItem(SecuritySession securitySession,
99             Integer JavaDoc id, Collection JavaDoc rights)
100             throws SystemException;
101
102     /**
103      * <p>This method changing AMEND rights. Users in those groups will be able to amend ITEMS with this TOPIC.
104      * It's working only with those groups which can be see by user.
105      * if I am adding AMEND right for group and there is not VIEW right -> so create VIEW right for that group.</p>
106      *
107      * @param id of TOPIC
108      * @param userName user vhich is goin to change rights
109      * @param rights collection of groups for which we will set up AMEND right
110      */

111     public abstract void amendAmendRightsForItem(
112             SecuritySession securitySession, Integer JavaDoc id,
113             Collection JavaDoc rights) throws SystemException;
114
115     /**
116      * <p>This method changing AMEND rights of TOPIC. It's working only with those groups which can be see by user.
117      * if I am adding AMEND right for group and there is not VIEW right -> so create VIEW right for that group.</p>
118      *
119      * @param id of TOPIC
120      * @param userName user which is chaning
121      * @param rights collection of groups for which we will set up AMEND right
122      */

123     public abstract void amendAmendRightsForTopic(
124             SecuritySession securitySession, Integer JavaDoc id,
125             Collection JavaDoc rights) throws SystemException;
126
127     /**
128      * <p>This method changing REMOVE rights. Users in those groups will be able to remove ITEMS with this TOPIC.
129      * It's working only with those groups which can be see by user.
130      * if I am adding REMOVE right for group and there is not VIEW right -> so create VIEW right for that group.</p>
131      *
132      * @param id of TOPIC
133      * @param userName user vhich is goin to change rights
134      * @param rights collection of groups for which we will set up REMOVE right
135      */

136     public abstract void amendRemoveRightsForItem(
137             SecuritySession securitySession, Integer JavaDoc id,
138             Collection JavaDoc rights) throws SystemException;
139
140     /**
141      * <p>This method changing REMOVE rights of TOPIC. It's working only with those groups which can be see by user.
142      * if I am adding REMOVE right for group and there is not VIEW right -> so create VIEW right for that group.</p>
143      *
144      * @param id of TOPIC
145      * @param userName user vhich is going to change
146      * @param rights collection of groups for which we will set up REMOVE right
147      */

148     public abstract void amendRemoveRightsForTopic(
149             SecuritySession securitySession, Integer JavaDoc id,
150             Collection JavaDoc rights) throws SystemException;
151
152     /**
153      * <p>This method changing VIEW rights of ITEMS. Users in those groups will be albe to see ITEMS with this TOPIC.
154      * It's working only with those groups which can be see by user.</p>
155      *
156      * @param id of TOPIC
157      * @param userName user vhich is goin to change rights
158      * @param rights collection of groups for which we will set up VIEW right
159      */

160     public abstract void amendViewRightsForItem(
161             SecuritySession securitySession, Integer JavaDoc id,
162             Collection JavaDoc rights) throws SystemException;
163
164     /**
165      * <p>This method changing VIEW rights of TOPIC. It's working only with those groups which can be see by user.</p>
166      *
167      * @param id of TOPIC
168      * @param userName user which is changing
169      * @param rights collection of groupIds for which we will set up VIEW right
170      */

171     public abstract void amendViewRightsForTopic(
172             SecuritySession securitySession, Integer JavaDoc id,
173             Collection JavaDoc rights) throws SystemException;
174
175     /**
176      * <p>Find out if a user is allowed to add a new comment.</p>
177      *
178      * @param userName the name of the user to check the user rights for.
179      * @param comment the comment check.
180      * @return <code>true</code> if the user is entitled to add this comment,
181      * otherwise <code>false</code>.
182      */

183     public abstract boolean canAddComment(SecuritySession securitySession,
184             CommentDO comment) throws SystemException;
185
186     /**
187      * <p>Find out if a user is allowed to add a new topic.</p>
188      *
189      * @param userName the name of the user to check the user rights for.
190      * @param topicId the unique identifier of the topic to check.
191      * @return <code>true</code> if the user is entitled to add new topics,
192      * otherwise <code>false</code>.
193      */

194     public abstract boolean canAddTopic(SecuritySession securitySession)
195             throws SystemException;
196
197     /**
198      * <p>Find out if a user is allowed to add items to a given topic.</p>
199      *
200      * @param userName the name of the user to check the user rights for.
201      * @param topicId the unique identifier of the topic to check.
202      * @return <code>true</code> if the user is entitled to add items to the
203      * topic, otherwise <code>false</code>.
204      */

205     public abstract boolean canAddToTopic(SecuritySession securitySession,
206             Integer JavaDoc topicId) throws SystemException;
207
208     /**
209      * <p>Find out if a user is allowed to change an existing comment.</p>
210      *
211      * @param userName the name of the user to check the user rights for.
212      * @param comment the comment check.
213      * @return <code>true</code> if the user is entitled to change this comment,
214      * otherwise <code>false</code>.
215      */

216     public abstract boolean canAmendComment(SecuritySession securitySession,
217             CommentDO comment) throws SystemException;
218
219     /**
220      * <p>Find out if a user is allowed to amend items in a given topic.</p>
221      *
222      * @param userName the name of the user to check the user rights for.
223      * @param integerParam the unique identifier of the topic to check.
224      * @return <code>true</code> if the user is entitled to amend items in the
225      * topic, otherwise <code>false</code>.
226      */

227     public abstract boolean canAmendInTopic(SecuritySession securitySession,
228             Integer JavaDoc integerParam) throws SystemException;
229
230     /**
231      * <p>Find out if a user is allowed to amend an existing new topic.</p>
232      *
233      * @param userName the name of the user to check the user rights for.
234      * @param topicId the unique identifier of the topic to check.
235      * @return <code>true</code> if the user is entitled to amend the
236      * topic, otherwise <code>false</code>.
237      */

238     public abstract boolean canAmendTopic(SecuritySession securitySession,
239             Integer JavaDoc id) throws SystemException;
240
241     /**
242      * <p>Find out if a user is allowed to remove an existing comment.</p>
243      *
244      * @param userName the name of the user to check the user rights for.
245      * @param comment the comment check.
246      * @return <code>true</code> if the user is entitled to remove this comment,
247      * otherwise <code>false</code>.
248      */

249     public abstract boolean canRemoveComment(SecuritySession securitySession,
250             CommentDO comment) throws SystemException;
251
252     /**
253      * <p>Find out if a user is allowed to remove items from a given topic.</p>
254      *
255      * @param userName the name of the user to check the user rights for.
256      * @param topicId the unique identifier of the topic to check.
257      * @return <code>true</code> if the user is entitled to remove items from
258      * the topic, otherwise <code>false</code>.
259      */

260     public abstract boolean canRemoveFromTopic(SecuritySession securitySession,
261             Integer JavaDoc topicId) throws SystemException;
262
263     /**
264      * <p>Find out if a user is allowed to remove a topic.</p>
265      *
266      * @param userName the name of the user to check the user rights for.
267      * @param topicId the unique identifier of the topic to check.
268      * @return <code>true</code> if the user is entitled to remove the
269      * topic, otherwise <code>false</code>.
270      */

271     public abstract boolean canRemoveTopic(SecuritySession securitySession,
272             Integer JavaDoc id) throws SystemException;
273
274     /**
275      * <p>Internal helper method. Find out if a user is allowed to access
276      * entries in a given group.</p>
277      *
278      * @param securitySession Security session to check the rights for.
279      * @param topicId Unique identifier of the topic to check.
280      * @param access The access level as defined in {@link
281      * com.ivata.groupware.business.addressbook.person.group.right.RightConstants
282      * RightConstants}.
283      * @return <code>true</code> if the user is entitled to access entries in the
284      * topic, otherwise <code>false</code>.
285      */

286     public abstract boolean canUser(SecuritySession securitySession,
287             Integer JavaDoc topicId, Integer JavaDoc detail, Integer JavaDoc access)
288             throws SystemException;
289
290     /**
291      * <p>Find out if a user is allowed to view items to a given topic.</p>
292      *
293      * @param userName the name of the user to check the user rights for.
294      * @param topicId the unique identifier of the topic to check.
295      * @return <code>true</code> if the user is entitled to view items in the
296      * topic, otherwise <code>false</code>.
297      */

298     public abstract boolean canViewInTopic(SecuritySession securitySession,
299             Integer JavaDoc topicId) throws SystemException;
300
301     /**
302      * <p>Find groups which have <code>access</code> to items with topic.
303      * Return only those groups which can be see by that user.</p>
304      *
305      * @param id of TOPIC
306      * @param userName user which is trying to find rights
307      * @param access find rights with this access
308      * @return Collection of IDS of groups which have <code>access</code> to that items wuth that topic
309      */

310     public abstract Collection JavaDoc findRightsForItemsInTopic(
311             SecuritySession securitySession, Integer JavaDoc id, Integer JavaDoc access)
312             throws SystemException;
313
314     /**
315      * <p>Find groups which have <code>access</code> to topic.
316      * Return only those groups which can be see by that user.</p>
317      *
318      * @param id of TOPIC
319      * @param userName user which is trying to find rights
320      * @param access find rights with this access
321      * @return Collection of IDS of groups which have <code>access</code> to that topic
322      */

323     public abstract Collection JavaDoc findRightsForTopic(
324             SecuritySession securitySession, Integer JavaDoc id, Integer JavaDoc access)
325             throws SystemException;
326
327     /**
328      * <p>Find the unique identifiers of all library topics for which the items
329      * can be accessed by the group specified, with the access level given.</p>
330      *
331      * @param groupId unique identifier of the group for which to search for
332      * library topics.
333      * @param access the access level as defined in {@link
334      * com.ivata.groupware.business.addressbook.person.group.right.RightConstants
335      * RightConstants}.
336      * @return a <code>Collection</code> of <code>Integer</code> instances,
337      * matching all topics which can be access with this level of access
338      * by the group specified.
339      */

340     public abstract Collection JavaDoc findTopicsByGroupAccess(
341             SecuritySession securitySession,
342             Integer JavaDoc groupId,
343             Integer JavaDoc access) throws SystemException;
344 }
Popular Tags