001/**
002 * Copyright 2005-2014 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.impl.identity;
017
018import org.kuali.rice.kim.api.identity.entity.EntityDefault;
019
020/**
021 * 
022 * This service archives EntityDefault.  It's purpose is to provide long term 
023 * storage for basic identity data that may be removed from the IdentityService implementation's
024 * backing store.
025 * 
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 *
028 */
029public interface IdentityArchiveService {
030
031    /**
032     * Gets a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} with an id from the archive.
033     * {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} is a condensed version of {@link org.kuali.rice.kim.api.identity.entity.Entity} that contains
034     * default values of its subclasses
035     *
036     * <p>
037     *   This method will return null if the Entity does not exist.
038     * </p>
039     *
040     * @param id the unique id to retrieve the entity by. cannot be null.
041     * @return a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} or null
042     * @throws IllegalArgumentException if the id is blank
043     */
044    EntityDefault getEntityDefaultFromArchive(String id ) throws IllegalArgumentException;
045
046        /**
047     * Gets a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} with an principalId from the archive.
048     * {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} is a condensed version of {@link org.kuali.rice.kim.api.identity.entity.Entity} that contains
049     * default values of its subclasses
050     *
051     * <p>
052     *   This method will return null if the Entity does not exist.
053     * </p>
054     *
055     * @param principalId the unique principalId to retrieve the entity by. cannot be null.
056     * @return a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} or null
057     * @throws IllegalArgumentException if the principalId is blank
058     */
059    EntityDefault getEntityDefaultFromArchiveByPrincipalId(String principalId) throws IllegalArgumentException;
060
061        /**
062     * Gets a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} with an principalName from the archive.
063     * {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} is a condensed version of {@link org.kuali.rice.kim.api.identity.entity.Entity} that contains
064     * default values of its subclasses
065     *
066     * <p>
067     *   This method will return null if the Entity does not exist.
068     * </p>
069     *
070     * @param principalName the unique principalName to retrieve the entity by. cannot be null.
071     * @return a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} or null
072     * @throws IllegalArgumentException if the principalName is blank
073     */
074        EntityDefault getEntityDefaultFromArchiveByPrincipalName(String principalName) throws IllegalArgumentException;
075        
076    /**
077     * Gets a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} with an employeeId from the archive.
078     * {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} is a condensed version of {@link org.kuali.rice.kim.api.identity.entity.Entity} that contains
079     * default values of its subclasses
080     *
081     * <p>
082     *   This method will return null if the Entity does not exist.
083     * </p>
084     *
085     * @param employeeId the unique employeeId to retrieve the entity by. cannot be null.
086     * @return a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} or null
087     * @throws IllegalArgumentException if the employeeId is blank
088     */
089    EntityDefault getEntityDefaultFromArchiveByEmployeeId(String employeeId) throws IllegalArgumentException;
090    
091        /**
092     * Saves a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} to the archive.
093     * {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} is a condensed version of {@link org.kuali.rice.kim.api.identity.entity.Entity} that contains
094     * default values of its subclasses
095     *
096     * <p>
097     *   This method will return the saved EntityDefault object
098     * </p>
099     *
100     * @param entityDefault the unique principalName to retrieve the entity by. cannot be null.
101     * @return a {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} or null
102     * @throws IllegalArgumentException if the entityDefault is null
103     */
104    //TODO: this should probably return some kind of Future<EntityDefault> if we can find a way to remote that
105        void saveEntityDefaultToArchive(EntityDefault entityDefault) throws IllegalArgumentException;
106
107    /**
108     * Flushes {@link org.kuali.rice.kim.api.identity.entity.EntityDefault} to the archive.
109     *
110     * <p>
111     *   This method flushes the "saved" entities to the database
112     * </p>
113     *
114     * @return void
115     */
116    void flushToArchive() throws IllegalArgumentException;
117        
118}