1 /* 2 * Copyright 2008 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 1.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl1.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.student.r1.common.assembly; 17 18 import org.kuali.student.r1.common.assembly.BaseDTOAssemblyNode.NodeOperation; 19 import org.kuali.student.r2.common.assembler.AssemblyException; 20 import org.kuali.student.r2.common.dto.ContextInfo; 21 import org.kuali.student.r2.common.exceptions.*; 22 23 24 /** 25 * An assembler that provides assembly and disassembly of business DTO from/to 26 * their base DTO. 27 * 28 * During disassembly of business DTO, it is required that all implementations 29 * generate the id (if newly created base DTO) from UUID and use that in mapping 30 * relations. 31 * 32 * Generic Mapping: 33 * E -> Business DTO e.g. CourseInfo 34 * T -> Base DTO e.g. CluInfo 35 * 36 * It is a good practice to propagate state from the parent objects through to the children 37 * 38 * @author Kuali Student Team 39 * 40 */ 41 public interface BOAssembler<E, T> { 42 43 /** 44 * 45 * This method assembles the business DTO from its base DTO. 46 * 47 * @param baseDTO 48 * Base DTO that corresponds to the business DTO 49 * @param businessDTO 50 * Reference to Business DTO 51 * @param shallowBuild 52 * boolean flag to indicate if the assembly should be shallow or deep 53 * @return Assembled business DTO 54 * @throws AssemblyException 55 */ 56 public E assemble(T baseDTO, E businessDTO, boolean shallowBuild, ContextInfo contextInfo) throws AssemblyException, PermissionDeniedException; 57 58 /** 59 * 60 * This method returns a collection of base DTOs and the operations that 61 * need to be performed on them in a given order 62 * 63 * 64 * @param businessDTO 65 * Business DTO to be disassembled 66 * @param isCreate 67 * Is the disassembly done for create 68 * 69 * @return A sorted map of BaseDTOAssemblyNodes to be processed in the given 70 * order. The key (Integer) is the sequence in which the nodes have 71 * to be processed 72 * @throws AssemblyException 73 * @throws PermissionDeniedException 74 */ 75 public BaseDTOAssemblyNode<E, T> disassemble( 76 E businessDTO, NodeOperation operation, ContextInfo contextInfo) throws AssemblyException, PermissionDeniedException, InvalidParameterException, MissingParameterException, DoesNotExistException, OperationFailedException; 77 }