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.kim.service;
017
018import org.kuali.rice.core.api.membership.MemberType;
019import org.kuali.rice.kim.api.group.Group;
020import org.kuali.rice.kim.api.group.GroupMember;
021import org.kuali.rice.kim.api.identity.employment.EntityEmployment;
022import org.kuali.rice.kim.api.identity.entity.Entity;
023import org.kuali.rice.kim.api.identity.entity.EntityDefault;
024import org.kuali.rice.kim.api.permission.Permission;
025import org.kuali.rice.kim.api.identity.principal.Principal;
026import org.kuali.rice.kim.api.role.Role;
027import org.kuali.rice.kim.api.role.RoleMember;
028import org.kuali.rice.kim.api.type.KimAttributeField;
029import org.kuali.rice.kim.bo.ui.KimDocumentRoleMember;
030import org.kuali.rice.kim.document.IdentityManagementGroupDocument;
031import org.kuali.rice.kim.document.IdentityManagementPersonDocument;
032import org.kuali.rice.kim.document.IdentityManagementRoleDocument;
033import org.kuali.rice.kim.impl.common.delegate.DelegateTypeBo;
034import org.kuali.rice.kim.impl.role.RoleMemberBo;
035import org.kuali.rice.kim.impl.role.RoleResponsibilityActionBo;
036import org.kuali.rice.krad.bo.BusinessObject;
037import org.springframework.cache.annotation.CacheEvict;
038
039import java.util.List;
040import java.util.Map;
041
042/**
043 * This is a description of what this class does - shyu don't forget to fill this in. 
044 * 
045 * @author Kuali Rice Team (rice.collab@kuali.org)
046 *
047 */
048public interface UiDocumentService {
049        /**
050         * 
051         * This method to populate Entity tables from person document pending tables when it is approved.
052         *        
053         * @param identityManagementPersonDocument
054         */
055    @CacheEvict(value={Entity.Cache.NAME, EntityDefault.Cache.NAME, Principal.Cache.NAME, GroupMember.Cache.NAME, RoleMember.Cache.NAME}, allEntries = true)
056    void saveEntityPerson(IdentityManagementPersonDocument identityManagementPersonDocument);
057    
058    /**
059     * 
060     * This method is to set up the DD attribute entry map for role qualifiers, so it can be rendered.
061     * 
062     * @param definitions
063     */
064    Map<String,Object> getAttributeEntries( List<KimAttributeField> definitions );
065        /**
066         * 
067         * This method is to load identity to person document pending Bos when user 'initiate' a document for 'editing' identity.
068         * 
069         * @param identityManagementPersonDocument
070         * @param principalId
071         */
072        void loadEntityToPersonDoc(IdentityManagementPersonDocument identityManagementPersonDocument, String principalId);
073
074        /**
075         * 
076         * This method loads a role document
077         * 
078         * @param identityManagementRoleDocument
079         */
080        public void loadRoleDoc(IdentityManagementRoleDocument identityManagementRoleDocument, Role kimRole);
081
082    /**
083     *
084     * This method loads a role document members based on search criteria
085     *
086     * @param identityManagementRoleDocument
087     */
088    public void loadRoleMembersBasedOnSearch(IdentityManagementRoleDocument identityManagementRoleDocument,
089                                             String memberSearchValue);
090
091    /**
092     *
093     * This method loads a document's original role members
094     *
095     * @param identityManagementRoleDocument
096     */
097    public void clearRestrictedRoleMembersSearchResults(IdentityManagementRoleDocument identityManagementRoleDocument);
098
099    /**
100         * 
101         * This method ...
102         * 
103         * @param identityManagementRoleDocument
104         */
105    @CacheEvict(value={Role.Cache.NAME, RoleMember.Cache.NAME, Permission.Cache.NAME}, allEntries = true)
106        public void saveRole(IdentityManagementRoleDocument identityManagementRoleDocument);
107
108
109        /**
110         * 
111         * This method loads a role document
112         * 
113         * @param identityManagementGroupDocument
114         */
115        public void loadGroupDoc(IdentityManagementGroupDocument identityManagementGroupDocument, Group kimGroup);
116        
117        /**
118         * 
119         * This method ...
120         * 
121         * @param identityManagementGroupDocument
122         */
123    @CacheEvict(value={Group.Cache.NAME,GroupMember.Cache.NAME}, allEntries = true)
124        public void saveGroup(IdentityManagementGroupDocument identityManagementGroupDocument);
125
126        public BusinessObject getMember(MemberType memberType, String memberId);
127        
128        public String getMemberName(MemberType memberType, String memberId);
129        
130        public String getMemberNamespaceCode(MemberType memberType, String memberId);
131
132        public String getMemberName(MemberType memberType, BusinessObject member);
133        
134        public String getMemberNamespaceCode(MemberType memberType, BusinessObject member);
135
136        public List<RoleResponsibilityActionBo> getRoleMemberResponsibilityActionImpls(String roleMemberId);
137        
138        public List<DelegateTypeBo> getRoleDelegations(String roleId);
139        
140        public KimDocumentRoleMember getKimDocumentRoleMember(MemberType memberType, String memberId, String roleId);
141        
142        public String getMemberIdByName(MemberType memberType, String memberNamespaceCode, String memberName);
143
144        public void setDelegationMembersInDocument(IdentityManagementRoleDocument identityManagementRoleDocument);
145
146    public void setMembersInDocument(IdentityManagementRoleDocument identityManagementRoleDocument);
147
148    public RoleMemberBo getRoleMember(String roleMemberId);
149        
150        public List<KimDocumentRoleMember> getRoleMembers(Map<String,String> fieldValues);
151        
152        public boolean canModifyEntity( String currentUserPrincipalId, String toModifyPrincipalId );
153        public boolean canOverrideEntityPrivacyPreferences( String currentUserPrincipalId, String toModifyPrincipalId );
154
155        public List<EntityEmployment> getEntityEmploymentInformationInfo(String entityId);
156}