001/**
002 * Copyright 2005-2015 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.dao;
017
018import java.util.List;
019import java.util.Map;
020
021import org.kuali.rice.kim.api.identity.entity.Entity;
022import org.kuali.rice.kim.api.identity.entity.EntityDefault;
023import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
024import org.kuali.rice.kim.api.identity.principal.Principal;
025import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferences;
026import org.kuali.rice.kim.util.Constants;
027import org.springframework.ldap.core.ContextMapper;
028import org.springframework.ldap.core.LdapTemplate;
029
030
031/**
032 * Interface class with public methods for accessing LDAP data store for entity information
033 *
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036public interface LdapPrincipalDao {
037    LdapTemplate getLdapTemplate();
038
039    void setLdapTemplate(LdapTemplate template);
040
041    /**
042     * In EDS, the principalId, principalName, and entityId will all be the same.
043     */
044    Principal getPrincipal(String principalId);
045
046    /**
047     * In EDS, the principalId, principalName, and entityId will all be the same.
048     */
049    Principal getPrincipalByName(String principalName);
050
051    <T> List<T> search(Class<T> type, Map<String, Object> criteria);
052
053        /** Find entity objects based on the given criteria. */
054        EntityDefault getEntityDefault(String entityId);
055
056        Entity getEntity(String entityId);
057        
058        /**
059     * Fetches full entity info, populated from EDS, based on the Entity's principal id
060     * @param principalId the principal id to look the entity up for
061     * @return the corresponding entity info
062     */
063    Entity getEntityByPrincipalId(String principalId);
064
065        Entity getEntityByPrincipalName(String principalName);
066
067    /**
068     * entityid and principalId are treated as the same.
069     * 
070     * @see #getEntityDefault(String)
071     */
072        EntityDefault getEntityDefaultByPrincipalId(String principalId);
073
074        EntityDefault getEntityDefaultByPrincipalName(String principalName);
075
076        List<String> lookupEntityIds(Map<String,String> searchCriteria);
077
078        EntityPrivacyPreferences getEntityPrivacyPreferences(String entityId);
079        
080    Map<String, EntityNamePrincipalName> getDefaultNamesForPrincipalIds(List<String> principalIds);
081
082    Map<String, EntityNamePrincipalName> getDefaultNamesForEntityIds(List<String> entityIds);
083
084    Map<String, ContextMapper> getContextMappers();
085    
086    Constants getKimConstants();
087}