001    /*
002     * Copyright 2008 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 1.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/ecl1.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.student.r1.common.assembly;
017    
018    import org.kuali.student.r1.common.assembly.BaseDTOAssemblyNode.NodeOperation;
019    import org.kuali.student.r2.common.assembler.AssemblyException;
020    import org.kuali.student.r2.common.dto.ContextInfo;
021    import org.kuali.student.r2.common.exceptions.*;
022    
023    
024    /**
025     * An assembler that provides assembly and disassembly of business DTO from/to
026     * their base DTO.
027     * 
028     * During disassembly of business DTO, it is required that all implementations
029     * generate the id (if newly created base DTO) from UUID and use that in mapping
030     * relations.
031     * 
032     * Generic Mapping:
033     * E -> Business DTO e.g. CourseInfo
034     * T -> Base DTO e.g. CluInfo
035     * 
036     * It is a good practice to propagate state from the parent objects through to the children
037     * 
038     * @author Kuali Student Team
039     * 
040     */
041    @Deprecated
042    public interface BOAssembler<E, T> {
043    
044            /**
045             * 
046             * This method assembles the business DTO from its base DTO.
047             * 
048             * @param baseDTO
049             *            Base DTO that corresponds to the business DTO
050             * @param businessDTO
051             *                        Reference to Business DTO
052             * @param shallowBuild
053             *                        boolean flag to indicate if the assembly should be shallow or deep 
054             * @return Assembled business DTO
055             * @throws AssemblyException 
056             */
057            public E assemble(T baseDTO, E businessDTO, boolean shallowBuild, ContextInfo contextInfo) throws AssemblyException, PermissionDeniedException;
058    
059            /**
060             * 
061             * This method returns a collection of base DTOs and the operations that
062             * need to be performed on them in a given order
063             * 
064             * 
065             * @param businessDTO
066             *            Business DTO to be disassembled
067             * @param isCreate
068             *            Is the disassembly done for create
069             * 
070             * @return A sorted map of BaseDTOAssemblyNodes to be processed in the given
071             *         order. The key (Integer) is the sequence in which the nodes have
072             *         to be processed
073             * @throws AssemblyException 
074             * @throws PermissionDeniedException 
075             */
076            public BaseDTOAssemblyNode<E,        T> disassemble(
077                            E businessDTO, NodeOperation operation, ContextInfo contextInfo) throws AssemblyException, PermissionDeniedException, InvalidParameterException, MissingParameterException, DoesNotExistException, OperationFailedException;
078    }