KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > om > ScarabUser


1 package org.tigris.scarab.om;
2
3 /* ================================================================
4  * Copyright (c) 2000-2002 CollabNet. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * 3. The end-user documentation included with the redistribution, if
18  * any, must include the following acknowlegement: "This product includes
19  * software developed by Collab.Net <http://www.Collab.Net/>."
20  * Alternately, this acknowlegement may appear in the software itself, if
21  * and wherever such third-party acknowlegements normally appear.
22  *
23  * 4. The hosted project names must not be used to endorse or promote
24  * products derived from this software without prior written
25  * permission. For written permission, please contact info@collab.net.
26  *
27  * 5. Products derived from this software may not use the "Tigris" or
28  * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
29  * prior written permission of Collab.Net.
30  *
31  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
32  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
33  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
34  * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
35  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
37  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
39  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
40  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
41  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  * ====================================================================
44  *
45  * This software consists of voluntary contributions made by many
46  * individuals on behalf of Collab.Net.
47  */

48 import java.util.List JavaDoc;
49 import java.util.Locale JavaDoc;
50 import java.util.Map JavaDoc;
51 import java.util.Calendar JavaDoc;
52
53 import org.apache.fulcrum.security.entity.User;
54 import org.apache.torque.om.ObjectKey;
55 import org.apache.torque.TorqueException;
56
57 import org.tigris.scarab.reports.ReportBridge;
58 import org.tigris.scarab.util.ScarabException;
59
60 /**
61  * This is an interface which describes what a ScarabUser is...
62  *
63  * @author <a HREF="mailto:jon@collab.net">Jon S. Stevens</a>
64  * @version $Id: ScarabUser.java 9340 2004-12-29 00:29:51Z jorgeuriarte $
65  */

66 public interface ScarabUser extends User
67 {
68     public static String JavaDoc DELETED = "DELETED";
69     /**
70      * This method is responsible for creating a new user. It will throw an
71      * exception if there is any sort of error (such as a duplicate login id)
72      * and place the error message into e.getMessage(). This also creates a
73      * uniqueid and places it into this object in the perm table under the
74      * Visitor.CONFIRM_VALUE key. It will use the current instance of this
75      * object as the basis to create the new User.
76      */

77     void createNewUser() throws Exception JavaDoc;
78
79     /**
80      * Gets all modules the user has permissions to edit.
81      * The default is to not show global modules if you have
82      * the permission to edit it.
83      * @see #getEditableModules(Module)
84      */

85     List JavaDoc getEditableModules() throws Exception JavaDoc;
86
87     /**
88      * Gets all modules the user has permissions to edit.
89      * @param currEditModule the module we are currently editing
90      */

91     List JavaDoc getEditableModules(Module currEditModule) throws Exception JavaDoc;
92
93     /**
94      * Gets an issue stored in the temp hash under key.
95      *
96      * @param key a <code>String</code> used as the key to retrieve the issue
97      * @return an <code>Issue</code> value
98      * @exception Exception if an error occurs
99      */

100     Issue getReportingIssue(String JavaDoc key)
101         throws Exception JavaDoc;
102
103     /**
104      * Places an issue into the session that can be retrieved using the key
105      * that is returned from the method.
106      *
107      * @param issue an <code>Issue</code> to store in the session under a
108      * new key
109      * @return a <code>String</code> value that can be used to retrieve
110      * the issue
111      * @exception ScarabException if issue is null.
112      */

113     String JavaDoc setReportingIssue(Issue issue)
114         throws ScarabException;
115
116     /**
117      * Places an issue into the session under the given key. If another issue
118      * was already using that key, it will be overwritten. Giving a null issue
119      * removes any issue stored using key. This method is primarily used to
120      * remove the issue from storage. Inserting a new issue would be most
121      * likely done with setReportingIssue(Issue issue).
122      *
123      * @param key a <code>String</code> value under which to store the issue
124      * @param issue an <code>Issue</code> value to store, null removes any
125      * issue already stored under key.
126      */

127     void setReportingIssue(String JavaDoc key, Issue issue);
128
129     /**
130      * Gets an report stored in the temp hash under key.
131      *
132      * @param key a <code>String</code> used as the key to retrieve the report
133      * @return an <code>Report</code> value
134      * @exception Exception if an error occurs
135      */

136     ReportBridge getCurrentReport(String JavaDoc key)
137         throws Exception JavaDoc;
138
139     /**
140      * Places an report into the session that can be retrieved using the key
141      * that is returned from the method.
142      *
143      * @param report an <code>ReportBridge</code> to store in the session under a
144      * new key
145      * @return a <code>String</code> value that can be used to retrieve
146      * the report
147      * @exception ScarabException if report is null.
148      */

149     String JavaDoc setCurrentReport(ReportBridge report)
150         throws ScarabException;
151
152     /**
153      * Places an report into the session under the given key. If another report
154      * was already using that key, it will be overwritten. Giving a null report
155      * removes any report stored using key. This method is primarily used to
156      * remove the report from storage. Inserting a new report would be most
157      * likely done with setCurrentReport(ReportBridge report).
158      *
159      * @param key a <code>String</code> value under which to store the report
160      * @param report an <code>ReportBridge</code> value to store, null removes any
161      * report already stored under key.
162      */

163     void setCurrentReport(String JavaDoc key, ReportBridge report);
164
165     /** Used for the password management features */
166     boolean isPasswordExpired() throws Exception JavaDoc;
167     /** Used for the password management features */
168     void setPasswordExpire() throws Exception JavaDoc;
169     /** Used for the password management features */
170     void setPasswordExpire(Calendar JavaDoc expire) throws Exception JavaDoc;
171     
172     Integer JavaDoc getUserId();
173     void setUserId(Integer JavaDoc v) throws Exception JavaDoc;
174     ObjectKey getPrimaryKey();
175     void setPrimaryKey(ObjectKey v) throws Exception JavaDoc;
176
177     /**
178      * Returns list of RModuleUserAttribute objects for this
179      * User and Module -- the attributes the user has selected
180      * To appear on the IssueList for this module.
181      */

182     List JavaDoc getRModuleUserAttributes(Module module,
183                                          IssueType issueType)
184             throws Exception JavaDoc;
185
186     /**
187      * Returns an RModuleUserAttribute object.
188      */

189     RModuleUserAttribute getRModuleUserAttribute(Module module,
190                                                         Attribute attribute,
191                                                         IssueType issueType)
192             throws Exception JavaDoc;
193
194     /**
195      * Implementation of the Retrievable interface because this object
196      * is used with Intake
197      */

198     String JavaDoc getQueryKey();
199
200     /**
201      * Implementation of the Retrievable interface because this object
202      * is used with Intake
203      */

204     void setQueryKey(String JavaDoc key) throws Exception JavaDoc;
205
206     /**
207      * Returns true if this user has the given permission within the given
208      * module, false otherwise.
209      *
210      * @param permission a <code>String</code> permission value, which should
211      * be a constant in this interface.
212      * @param module a <code>Module</code> value
213      * @return true if the permission exists for the user within the
214      * given module, false otherwise
215      */

216     boolean hasPermission(String JavaDoc permission, Module module);
217
218     /**
219      * Returns true if this user has the given permission within all the given
220      * modules, false otherwise. If the list is null or empty
221      */

222     boolean hasPermission(String JavaDoc permission, List JavaDoc modules);
223
224     /**
225      * Gets all modules which are currently associated with this user
226      * (relationship has not been deleted.)
227      */

228     List JavaDoc getModules() throws Exception JavaDoc;
229
230     /**
231      * Gets all modules which are currently associated with this user.
232      * @param showDeletedModules show modules which have been marked as deleted
233      */

234     List JavaDoc getModules(boolean showDeletedModules) throws Exception JavaDoc;
235
236     /**
237      * Get a list of <code>Module</code>'s that where a user has
238      * the specified permission. Does not show deleted modules.
239      * (showDeleted = false)
240      * @param permission a <code>String</code> value
241      * @return a <code>Module[]</code> value
242      */

243     Module[] getModules(String JavaDoc permission)
244         throws Exception JavaDoc;
245
246     /**
247      * Get a list of <code>Module</code>'s that where a user has
248      * at least one of the permissions given. Does not show deleted modules.
249      * (showDeleted = false)
250      * @param permissions a <code>String[]</code> value
251      * @return a <code>Module[]</code> value
252      */

253     Module[] getModules(String JavaDoc[] permissions)
254         throws Exception JavaDoc;
255
256     /**
257      * Get a list of <code>Module</code>'s that where a user has
258      * at least one of the permissions given. Does not show deleted modules.
259      *
260      * @param permissions a <code>String[]</code> value
261      * @param showDeleted a <code>boolean</code> value
262      * @return a <code>Module[]</code> value
263      */

264     Module[] getModules(String JavaDoc[] permissions, boolean showDeleted)
265         throws Exception JavaDoc;
266
267     List JavaDoc getCopyToModules(Module currentModule)
268         throws Exception JavaDoc;
269     List JavaDoc getCopyToModules(Module currentModule, String JavaDoc action)
270         throws Exception JavaDoc;
271     List JavaDoc getCopyToModules(Module currentModule, String JavaDoc action, String JavaDoc searchString)
272         throws Exception JavaDoc;
273
274
275     /**
276      * Determine whether the user has any role in the given module.
277      * This only checks roles directly in this module, not in the "Global"
278      * module.
279      *
280      * @param module a <code>Module</code> value
281      * @return a <code>boolean</code> value
282      */

283     boolean hasAnyRoleIn(Module module)
284         throws Exception JavaDoc;
285
286     /**
287      * The user's full name.
288      */

289     String JavaDoc getName();
290
291     /**
292      * Sets integer representing user preference for
293      * Which screen to return to after entering an issue.
294      */

295     void setEnterIssueRedirect(int templateCode)
296         throws Exception JavaDoc;
297
298     /**
299      * Returns integer representing user preference for
300      * Which screen to return to after entering an issue.
301      */

302     int getEnterIssueRedirect()
303         throws Exception JavaDoc;
304
305     /**
306      * The template/tab to show for the home page using the current module.
307      */

308     String JavaDoc getHomePage()
309         throws Exception JavaDoc;
310     
311     /**
312      * The template/tab to show for the home page in the given module.
313      */

314     String JavaDoc getHomePage(Module module)
315         throws Exception JavaDoc;
316
317     /**
318      * The template/tab to show for the home page.
319      */

320     void setHomePage(String JavaDoc homePage)
321         throws Exception JavaDoc;
322
323     /**
324      * The template to show if the user is going to start a new query.
325      * if the user has not selected a set of issue types it will return
326      * IssueTypeList.vm. If a list is already selected, then it will go to
327      * AdvancedQuery.vm unless the list is only one issue type and the user
328      * has last selected Custom query for that issue type.
329      */

330     public String JavaDoc getQueryTarget();
331
332     /**
333      * Setup the users preference when entering a query for the given
334      * issue type. Valid values of target are AdvancedQuery.vm
335      * and Search.vm (Custom query).
336      */

337     public void setSingleIssueTypeQueryTarget(IssueType type, String JavaDoc target);
338
339
340     List JavaDoc getMITLists()
341         throws TorqueException;
342
343     /**
344      * Checks if the user can search for issues of at least one issue type
345      * in one module.
346      */

347     public boolean hasAnySearchableRMITs()
348         throws Exception JavaDoc;
349
350     /**
351      * Returns a List of RModuleIssueTypes for which the user has the
352      * permission to search for issues.
353      *
354      * @param skipModule do not include issue types for this module. Useful
355      * for separating the current module.
356      * @return a <code>List</code> value
357      * @exception Exception if an error occurs
358      */

359     List JavaDoc getSearchableRMITs(String JavaDoc searchField, String JavaDoc searchString,
360                             String JavaDoc sortColumn, String JavaDoc sortPolarity,
361                             Module skipModule)
362         throws Exception JavaDoc;
363
364     /**
365      * returns a list of RModuleIssueTypes for the given module, excluding
366      * any that that have a corresponding MITListItem in the CurrentMITList.
367      */

368     public List JavaDoc getUnusedRModuleIssueTypes(Module module)
369         throws Exception JavaDoc;
370
371     void addRMITsToCurrentMITList(List JavaDoc rmits)
372         throws TorqueException;
373
374     MITList getCurrentMITList();
375     void setCurrentMITList(MITList list);
376     void removeItemsFromCurrentMITList(String JavaDoc[] ids);
377
378     Object JavaDoc lastEnteredIssueTypeOrTemplate();
379     void setLastEnteredIssueType(IssueType type);
380     void setLastEnteredTemplate(Issue template);
381
382     /**
383      * The most recent query entered. This method has the effect of loading
384      * the MITList used for the query (if one exists) as the CurrentMITList
385      * so it should only be called if the query is to be used.
386      * Use @see #hasMostRecentQuery() to determine existence.
387      */

388     String JavaDoc getMostRecentQuery();
389
390     /**
391      * The most recent query entered.
392      */

393     void setMostRecentQuery(String JavaDoc queryString);
394
395     /**
396      * Check if the user has a previous query
397      */

398     boolean hasMostRecentQuery();
399
400     /**
401      * key used to keep concurrent activities by the same
402      * user from overwriting each others state.
403      */

404     Object JavaDoc getThreadKey();
405
406     /**
407      * key used to keep concurrent activities by the same
408      * user from overwriting each others state.
409      */

410     void setThreadKey(Integer JavaDoc key);
411
412     /**
413      * Get the working list of associated users
414      * For the AssignIssue screen
415      */

416     Map JavaDoc getAssociatedUsersMap()
417         throws Exception JavaDoc;
418
419     /**
420      * Set the working list of associated users
421      * For the AssignIssue screen
422      */

423     void setAssociatedUsersMap(Map JavaDoc associatedUsers)
424         throws Exception JavaDoc;
425
426     /**
427      * Get the working list of associated users
428      * For the AssignIssue screen
429      */

430     Map JavaDoc getSelectedUsersMap()
431         throws Exception JavaDoc;
432
433     /**
434      * Set the working list of associated users
435      * For the AssignIssue screen
436      */

437     void setSelectedUsersMap(Map JavaDoc selectedUsers)
438         throws Exception JavaDoc;
439     
440     /**
441      * The current module which represents the module
442      * selected by the user within a request.
443      */

444     Module getCurrentModule();
445     
446     /**
447      * The current module which represents the module
448      * selected by the user within a request.
449      */

450     void setCurrentModule(Module v);
451      
452     /**
453      * The current issue type which represents the issue type
454      * selected by the user within a request.
455      */

456     IssueType getCurrentIssueType()
457         throws Exception JavaDoc;
458
459     /**
460      * The current issue type which represents the issue type
461      * selected by the user within a request.
462      */

463     void setCurrentIssueType(IssueType v);
464
465     /**
466      * The current RModuleIssueType which represents the module and issue type
467      * selected by the user within a request.
468      */

469     RModuleIssueType getCurrentRModuleIssueType()
470         throws Exception JavaDoc;
471
472     /**
473      * Updates the attributes shown in IssueList.vm
474      * Removes any saved preferences for the current mit list or current module
475      * and issue type. And replaces them with the attributes given.
476      * The order of the attributes is preserved.
477      */

478     void updateIssueListAttributes(List JavaDoc attributes)
479         throws Exception JavaDoc;
480
481     List JavaDoc getRoleNames(Module module)
482        throws Exception JavaDoc;
483
484     /**
485      * Set the user's locale to a new value.
486      */

487     void setLocale(Locale JavaDoc newLocale);
488
489     /**
490      * Get the user's current locale.
491      */

492     Locale JavaDoc getLocale();
493
494     /**
495      * Get the user's preferred locale.
496      */

497     Locale JavaDoc getPreferredLocale();
498
499     /**
500      * Get the ShowOtherModulesInIssueTypeList value.
501      * toggle switch for show/hide the cross module section of the
502      * issue type selection widget.
503      * @return the ShowOtherModulesInIssueTypeList value.
504      */

505     public boolean isShowOtherModulesInIssueTypeList();
506
507     /**
508      * Set the ShowOtherModulesInIssueTypeList value.
509      * toggle switch for show/hide the cross module section of the
510      * issue type selection widget.
511      * @param newShowOtherModulesInIssueTypeList The new
512      * ShowOtherModulesInIssueTypeList value.
513      */

514     public void setShowOtherModulesInIssueTypeList(
515         boolean newShowOtherModulesInIssueTypeList);
516
517     /**
518      * Returns true if the user is the one set in scarab.anonymous.username, and
519      * false otherwise.
520      * @return
521      */

522     public boolean isUserAnonymous();
523 }
524
Popular Tags