KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > security > PersonService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.security;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.Map JavaDoc;
21 import java.util.Set JavaDoc;
22
23 import org.alfresco.service.cmr.repository.NodeRef;
24 import org.alfresco.service.namespace.QName;
25
26 /**
27  * This service encapsulates the management of people and groups.
28  * <p>
29  * <p>
30  * People and groups may be managed entirely in the repository or entirely in
31  * some other implementation such as LDAP or via NTLM. Some properties may in
32  * the repository and some in another store. Individual properties may or may
33  * not be mutable.
34  * <p>
35  *
36  * @author Andy Hind
37  */

38 public interface PersonService
39 {
40     /**
41      * Get a person by userName. The person is store in the repository. The
42      * person may be created as a side effect of this call, depending on
43      * the setting to {@link #setCreateMissingPeople(boolean) create missing people or not}.
44      *
45      * @param userName - the userName key to find the person
46      * @return Returns the person node, either existing or new
47      * @throws NoSuchPersonException if the user doesn't exist and could not be created automatically
48      *
49      * @see #setCreateMissingPeople(boolean)
50      * @see #createMissingPeople()
51      */

52     public NodeRef getPerson(String JavaDoc userName);
53
54     /**
55      * Check if a person exists.
56      *
57      * @param userName the user name
58      * @return Returns true if the user exists, otherwise false
59      */

60     public boolean personExists(String JavaDoc userName);
61     
62     /**
63      * Does this service create people on demand if they are missing. If this is
64      * true, a call to getPerson() will create a person if they are missing.
65      *
66      * @return true if people are created on demand and false otherwise.
67      */

68     public boolean createMissingPeople();
69
70     /**
71      * Set if missing people should be created.
72      *
73      * @param createMissing set to true to create people
74      *
75      * @see #getPerson(String)
76      */

77     public void setCreateMissingPeople(boolean createMissing);
78     
79     /**
80      * Get the list of properties that are mutable. Some service may only allow
81      * a limited list of properties to be changed. This may be those persisted
82      * in the repository or those that can be changed in some other
83      * implementation such as LDAP.
84      *
85      * @return A set of QNames that identify properties that can be changed
86      */

87     public Set JavaDoc<QName> getMutableProperties();
88
89     /**
90      * Set the properties on a person - some of these may be persisted in
91      * different locations.
92      *
93      * @param userName - the user for which the properties should be set.
94      * @param properties - the map of properties to set (as the NodeService)
95      */

96     public void setPersonProperties(String JavaDoc userName, Map JavaDoc<QName, Serializable JavaDoc> properties);
97
98     /**
99      * Can this service create, delete and update person information?
100      *
101      * @return true if this service allows mutation to people.
102      */

103     public boolean isMutable();
104
105     /**
106      * Create a new person with the given properties.
107      * The userName is one of the properties.
108      * Users with duplicate userNames are not allowed.
109      *
110      * @param properties
111      * @return
112      */

113     public NodeRef createPerson(Map JavaDoc<QName, Serializable JavaDoc> properties);
114
115     /**
116      * Delete the person identified by the given user name.
117      *
118      * @param userName
119      */

120     public void deletePerson(String JavaDoc userName);
121     
122     /**
123      * Get all the people we know about.
124      *
125      * @return a set of people in no specific order.
126      */

127     public Set JavaDoc<NodeRef> getAllPeople();
128     
129     /**
130      * Return the container that stores people.
131      *
132      * @return
133      */

134     public NodeRef getPeopleContainer();
135     
136     /**
137      * Are user names case sensitive?
138      *
139      * @return
140      */

141     public boolean getUserNamesAreCaseSensitive();
142 }
143
Popular Tags