001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kew.identity.service; 017 018import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; 019import org.kuali.rice.kew.actionrequest.Recipient; 020import org.kuali.rice.kew.api.user.UserId; 021import org.kuali.rice.kew.workgroup.GroupId; 022import org.kuali.rice.kim.api.identity.Person; 023import org.kuali.rice.kim.api.identity.principal.Principal; 024import org.kuali.rice.kim.api.group.Group; 025 026/** 027 * A simple helper service in KEW for interacting with the KIM identity 028 * management services. Some of the methods on here exist solely for 029 * the purpose of assisting with the piece-by-piece migration of 030 * KEW to use the KIM services. 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034public interface IdentityHelperService { 035 036 public String getIdForPrincipalName(String principalName); 037 038 public String getIdForGroupName(String namespace, String groupName); 039 040 /** 041 * Returns the KimPrincipal for the given principal id. Throws an exception 042 * if the principal id cannot be resolved to a principal. 043 * 044 * @throws RiceIllegalArgumentException if the principal id cannot be resolved to a principal. 045 */ 046 public Principal getPrincipal(String principalId); 047 048 /** 049 * Returns the KimPrincipal for the given principal name. Throws an exception 050 * if the principal name cannot be resolved to a principal. 051 * 052 * @throws RiceIllegalArgumentException if the principal name cannot be resolved to a principal 053 */ 054 public Principal getPrincipalByPrincipalName(String principalName); 055 056 /** 057 * Returns the Person for the given principal id. Throws an exception 058 * if the principal id cannot be resolved to a person. 059 * 060 * @throws RiceIllegalArgumentException if the principal id cannot be resolved to a person. 061 */ 062 public Person getPerson(String principalId); 063 064 /** 065 * Returns the Person for the given principal name. Throws an exception 066 * if the principal name cannot be resolved to a person. 067 * 068 * @throws RiceIllegalArgumentException if the principal name cannot be resolved to a person. 069 */ 070 public Person getPersonByPrincipalName(String principalName); 071 072 /** 073 * Returns the Person for the given employee id. Throws an exception 074 * if the principal name cannot be resolved to a person. 075 * 076 * @throws RiceIllegalArgumentException if the principal name cannot be resolved to a person. 077 */ 078 public Person getPersonByEmployeeId(String employeeId); 079 080 /** 081 * Checks that the given principalId is valid. Throws a RiceRuntimeException if it is not. 082 * 083 * @throws RiceIllegalArgumentException if the given principalId is valid 084 */ 085 public void validatePrincipalId(String principalId); 086 087 /** 088 * Returns the principal for the given UserId. 089 * 090 * @throws RiceIllegalArgumentException if the given UserId does not resolve to a valid principal 091 */ 092 public Principal getPrincipal(UserId userId); 093 094 /** 095 * Returns the Group for the given groupId. Throws an exception 096 * if the groupId cannot be resolved to a group. 097 * 098 * @throws RiceIllegalArgumentException if the groupId cannot be resolved to a group. 099 */ 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}