View Javadoc

1   /**
2    * 2007, Digitalis Informatica. All rights reserved. Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos
3    * num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 http://www.digitalis.pt
4    */
5   package pt.digitalis.dif.controller.security.objects;
6   
7   import java.util.List;
8   import java.util.Map;
9   import java.util.Set;
10  
11  import pt.digitalis.dif.exception.InternalFrameworkException;
12  import pt.digitalis.dif.exception.security.IdentityManagerException;
13  import pt.digitalis.utils.common.collections.CaseInsensitiveHashMap;
14  
15  /**
16   * Defines the DIF user features interface
17   * 
18   * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a>
19   * @author Rodrigo Gon�alves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a><br/>
20   * @created Dec 3, 2007
21   */
22  public interface IDIFUser extends IUserAuthorization {
23  
24      /**
25       * Adds the temporary group. This user group has the session life expectancy
26       * 
27       * @param groupId
28       *            the group id
29       */
30      public void addTempGroup(String groupId);
31  
32      /**
33       * Clears any existing cache
34       */
35      public void cleanCache();
36  
37      /**
38       * Searches for a given attribute
39       * 
40       * @param id
41       *            the id of the attribute to search
42       * @return T if the attribute is present
43       */
44      public boolean containsAttribute(String id);
45  
46      /**
47       * Searches for a given parameter
48       * 
49       * @param id
50       *            the id of the parameter to search
51       * @return T if the parameter is present
52       */
53      public boolean containsParameter(String id);
54  
55      /**
56       * Gets the user attribute.
57       * 
58       * @param id
59       *            the id of the attribute
60       * @return the user attribute
61       */
62      public Object getAttribute(String id);
63  
64      /**
65       * Gets the user attribute list.
66       * 
67       * @return the user attribute list
68       */
69      public CaseInsensitiveHashMap<Object> getAttributes();
70  
71      /**
72       * Inspector for the 'attributesToRemove' attribute.
73       * 
74       * @return the attributesToRemove value
75       */
76      public List<String> getAttributesToRemove();
77  
78      /**
79       * Returns the user e-mail address.
80       * 
81       * @return the user e-mail
82       */
83      public String getEmail();
84  
85      /**
86       * Retrieves the list of group ids associated with this user
87       * 
88       * @return the groups
89       * @throws IdentityManagerException
90       *             if the users can't be found on the identity manager
91       */
92      public Set<String> getGroupIDs() throws IdentityManagerException;
93  
94      /**
95       * Retrieves the list of groups associated with this user
96       * 
97       * @return the groups
98       * @throws IdentityManagerException
99       *             if the groups can't be found on the identity manager
100      */
101     public Map<String, IDIFGroup> getGroups() throws IdentityManagerException;
102 
103     /**
104      * Returns the user id.
105      * 
106      * @return the user id
107      */
108     public String getID();
109 
110     /**
111      * Returns the user full name.
112      * 
113      * @return the user's full name
114      */
115     public String getName();
116 
117     /**
118      * Returns the user's nick name.
119      * 
120      * @return the user's nick name
121      */
122     public String getNick();
123 
124     /**
125      * Gets a user parameter.
126      * 
127      * @param id
128      *            the id of the parameter
129      * @return the user parameter
130      */
131     public Object getParameter(String id);
132 
133     /**
134      * Gets the user parameter list.
135      * 
136      * @return the user parameter list
137      */
138     public Map<String, Object> getParameters();
139 
140     /**
141      * Retrieves the user profile or default group
142      * 
143      * @return the profile group
144      * @throws IdentityManagerException
145      *             if the profile can't be found on the identity manager
146      */
147     public IDIFGroup getProfile() throws IdentityManagerException;
148 
149     /**
150      * Retrieves the user profile or default group ID
151      * 
152      * @return the profile group
153      * @throws IdentityManagerException
154      *             if the profile can't be accessed
155      */
156     public String getProfileID() throws IdentityManagerException;
157 
158     /**
159      * @param attrs
160      *            the new attributes to set
161      */
162     public void initializeAttributes(Map<String, Object> attrs);
163 
164     /**
165      * A default user is a user that is created by the default configuration of the application. As such it cannot be
166      * deleted. Only disabled.
167      * 
168      * @return T if the user is a default user
169      */
170     public boolean isDefault();
171 
172     /**
173      * A disabled user will not be able to log on
174      * 
175      * @return T if the user is enabled
176      */
177     public boolean isEnabled();
178 
179     /**
180      * Refreshes the current user from the persistent layer
181      */
182     public void refresh();
183 
184     /**
185      * Removes the user attribute.
186      * 
187      * @param id
188      *            the id of the attribute
189      */
190     public void removeAttribute(String id);
191 
192     /**
193      * Removes the user parameter.
194      * 
195      * @param id
196      *            the id of the parameter
197      */
198     public void removeParameter(String id);
199 
200     /**
201      * Removes the temporary group.
202      * 
203      * @param groupId
204      *            the group id
205      */
206     public void removeTempGroup(String groupId);
207 
208     /**
209      * Sets the user attribute.
210      * 
211      * @param id
212      *            the id of the attribute
213      * @param attribute
214      *            the attribute to set
215      * @throws InternalFrameworkException
216      *             if the attribute can't be set
217      */
218     public void setAttribute(String id, Object attribute) throws InternalFrameworkException;
219 
220     /**
221      * Sets the attributes.
222      * 
223      * @param attributes
224      *            the attributes to set
225      * @throws InternalFrameworkException
226      *             if the attribute can't be set
227      */
228     public void setAttributes(Map<String, Object> attributes) throws InternalFrameworkException;
229 
230     /**
231      * Sets the user as a default user.
232      * 
233      * @param isDefault
234      */
235     public void setDefault(boolean isDefault);
236 
237     /**
238      * Sets the user e-mail address.
239      * 
240      * @param email
241      *            the email to set
242      */
243     public void setEmail(String email);
244 
245     /**
246      * @param enabled
247      *            the enabled to set
248      */
249     public void setEnabled(boolean enabled);
250 
251     /**
252      * Sets the user id.
253      * 
254      * @param id
255      *            the id to set
256      */
257     public void setID(String id);
258 
259     /**
260      * Sets the user full name.
261      * 
262      * @param name
263      *            the name to set
264      */
265     public void setName(String name);
266 
267     /**
268      * Sets the user nick name.
269      * 
270      * @param nick
271      *            the nick name to set
272      */
273     public void setNick(String nick);
274 
275     /**
276      * Sets the user parameters.
277      * 
278      * @param id
279      *            the id of the parameter
280      * @param parameter
281      *            the parameter to set
282      */
283     public void setParameter(String id, Object parameter);
284 
285     /**
286      * Sets the parameters.
287      * 
288      * @param parameters
289      *            the parameters to set
290      */
291     public void setParameters(Map<String, Object> parameters);
292 
293     /**
294      * Sets the user password.
295      * 
296      * @param password
297      *            the password to set
298      */
299     public void setPassword(String password);
300 
301     /**
302      * Sets the profile ID or default group of the user
303      * 
304      * @param profileGroupID
305      *            the group to set as the profile
306      */
307     public void setProfileID(String profileGroupID);
308 
309 }