001    /**
002     * Copyright 2005-2012 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     */
016    package org.kuali.rice.kim.dao;
017    
018    import java.util.List;
019    import java.util.Map;
020    
021    import org.kuali.rice.kim.api.identity.entity.Entity;
022    import org.kuali.rice.kim.api.identity.entity.EntityDefault;
023    import org.kuali.rice.kim.api.identity.name.EntityName;
024    import org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName;
025    import org.kuali.rice.kim.api.identity.principal.Principal;
026    import org.kuali.rice.kim.api.identity.privacy.EntityPrivacyPreferences;
027    
028    import org.springframework.ldap.core.DirContextOperations;
029    import org.springframework.ldap.core.LdapTemplate;
030    
031    
032    /**
033     *
034     * @author Kuali Rice Team (rice.collab@kuali.org)
035     */
036    public interface PrincipalDao {
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 getEntityDefaultInfo(String entityId);
055    
056            Entity getEntityInfo(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        public abstract Entity getEntityInfoByPrincipalId(String principalId);
064    
065        /**
066         * entityid and principalId are treated as the same.
067         * 
068         * @see #getEntityDefaultInfo(String)
069         */
070            EntityDefault getEntityDefaultInfoByPrincipalId(String principalId);
071    
072            EntityDefault getEntityDefaultInfoByPrincipalName(String principalName);
073    
074            List<EntityDefault> lookupEntityDefaultInfo(Map<String,String> searchCriteria, boolean unbounded);
075    
076            List<Entity> lookupEntityInfo(Map<String,String> searchCriteria, boolean unbounded);
077    
078            EntityPrivacyPreferences getEntityPrivacyPreferences(String entityId);
079            
080        Map<String, EntityNamePrincipalName> getDefaultNamesForPrincipalIds(List<String> principalIds);
081    
082        Map<String, EntityName> getDefaultNamesForEntityIds(List<String> entityIds);
083    }