View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.identity.service;
17  
18  import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
19  import org.kuali.rice.kew.actionrequest.Recipient;
20  import org.kuali.rice.kew.api.user.UserId;
21  import org.kuali.rice.kew.workgroup.GroupId;
22  import org.kuali.rice.kim.api.identity.Person;
23  import org.kuali.rice.kim.api.identity.principal.Principal;
24  import org.kuali.rice.kim.api.group.Group;
25  
26  /**
27   * A simple helper service in KEW for interacting with the KIM identity
28   * management services.  Some of the methods on here exist solely for
29   * the purpose of assisting with the piece-by-piece migration of
30   * KEW to use the KIM services.
31   *
32   * @author Kuali Rice Team (rice.collab@kuali.org)
33   */
34  public interface IdentityHelperService {
35  
36  	public String getIdForPrincipalName(String principalName);
37  
38  	public String getIdForGroupName(String namespace, String groupName);
39  
40  	/**
41  	 * Returns the KimPrincipal for the given principal id.  Throws an exception
42  	 * if the principal id cannot be resolved to a principal.
43  	 * 
44  	 * @throws RiceIllegalArgumentException if the principal id cannot be resolved to a principal.
45  	 */
46  	public Principal getPrincipal(String principalId);
47  
48  	/**
49  	 * Returns the KimPrincipal for the given principal name.  Throws an exception
50  	 * if the principal name cannot be resolved to a principal.
51  	 * 
52  	 * @throws RiceIllegalArgumentException if the principal name cannot be resolved to a principal
53  	 */
54  	public Principal getPrincipalByPrincipalName(String principalName);
55  
56  	/**
57  	 * Returns the Person for the given principal id.  Throws an exception
58  	 * if the principal id cannot be resolved to a person.
59  	 * 
60  	 * @throws RiceIllegalArgumentException if the principal id cannot be resolved to a person.
61  	 */
62  	public Person getPerson(String principalId);
63  
64  	/**
65  	 * Returns the Person for the given principal name.  Throws an exception
66  	 * if the principal name cannot be resolved to a person.
67  	 * 
68  	 * @throws RiceIllegalArgumentException if the principal name cannot be resolved to a person.
69  	 */
70  	public Person getPersonByPrincipalName(String principalName);
71  
72  	/**
73  	 * Returns the Person for the given employee id.  Throws an exception
74  	 * if the principal name cannot be resolved to a person.
75  	 * 
76  	 * @throws RiceIllegalArgumentException if the principal name cannot be resolved to a person.
77  	 */
78  	public Person getPersonByEmployeeId(String employeeId);
79  
80  	/**
81  	 * Checks that the given principalId is valid.  Throws a RiceRuntimeException if it is not.
82  	 * 
83  	 * @throws RiceIllegalArgumentException if the given principalId is valid
84  	 */
85  	public void validatePrincipalId(String principalId);
86  
87  	/**
88  	 * Returns the principal for the given UserId.
89  	 * 
90  	 * @throws RiceIllegalArgumentException if the given UserId does not resolve to a valid principal
91  	 */
92  	public Principal getPrincipal(UserId userId);
93  
94  	/**
95  	 * Returns the Group for the given groupId.  Throws an exception
96  	 * if the groupId cannot be resolved to a group.
97  	 * 
98  	 * @throws RiceIllegalArgumentException if the groupId cannot be resolved to a group.
99  	 */
100 	public Group getGroup(String groupId);
101 
102 	/**
103 	 * Returns the Group for the given GroupId.  Throws an exception
104 	 * if the groupId cannot be resolved to a group.
105 	 * 
106 	 * @throws RiceIllegalArgumentException if the GroupId cannot be resolved to a group.
107 	 */
108 	public Group getGroup(GroupId groupId);
109 
110 	/**
111 	 * Returns the Group for the given namespaceCode and name.  Throws an exception
112 	 * if the namespaceCode and name cannot be resolved to a group.
113 	 * 
114 	 * @throws RiceIllegalArgumentException if the namespaceCode and name cannot be resolved to a group.
115 	 */
116 	public Group getGroupByName(String namespaceCode, String name);
117 
118 	/**
119 	 * Returns the Recipient for the given principalId.  Throws an exception
120 	 * if the principalId cannot be resolved to a recipient.
121 	 * 
122 	 * @throws RiceIllegalArgumentException if the principalId cannot be resolved to a recipient
123 	 */
124 	public Recipient getPrincipalRecipient(String principalId);
125 
126 	/**
127 	 * Returns the principal for the "system user".  This is a user
128 	 * that can be used in the cases where an actual user cannot be
129 	 * determined.
130 	 */
131 	public Principal getSystemPrincipal();
132 }