Coverage Report - org.kuali.student.core.statement.service.assembler.StatementTreeViewAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
StatementTreeViewAssembler
0%
0/18
0%
0/8
4
 
 1  
 package org.kuali.student.core.statement.service.assembler;
 2  
 
 3  
 import org.apache.commons.beanutils.BeanUtils;
 4  
 import org.apache.log4j.Logger;
 5  
 import org.kuali.student.common.assembly.BOAssembler;
 6  
 import org.kuali.student.common.assembly.BaseDTOAssemblyNode;
 7  
 import org.kuali.student.common.assembly.BaseDTOAssemblyNode.NodeOperation;
 8  
 import org.kuali.student.common.assembly.data.AssemblyException;
 9  
 import org.kuali.student.common.service.impl.BaseAssembler;
 10  
 import org.kuali.student.core.statement.dto.StatementTreeViewInfo;
 11  
 
 12  
 
 13  
 /**
 14  
  * CRUD operations for StatementTreeViewInfo
 15  
  * <p/>
 16  
  * NOTE: the Natural Language field is NOT filled in. This has be done further up the calling stack.
 17  
  *
 18  
  * @author glindholm
 19  
  *
 20  
  */
 21  0
 public class StatementTreeViewAssembler extends BaseAssembler implements BOAssembler<StatementTreeViewInfo, StatementTreeViewInfo>{
 22  0
     final static Logger LOG = Logger.getLogger(StatementTreeViewAssembler.class);
 23  
 
 24  
 
 25  
         @Override
 26  
         public StatementTreeViewInfo assemble(StatementTreeViewInfo baseDTO,
 27  
                         StatementTreeViewInfo businessDTO, boolean shallowBuild)
 28  
                         throws AssemblyException {
 29  0
                 StatementTreeViewInfo stmtTree = (null != businessDTO) ? businessDTO
 30  
                                 : new StatementTreeViewInfo();
 31  
                 try {
 32  0
                         BeanUtils.copyProperties(stmtTree, baseDTO);
 33  0
                 } catch (Exception e) {
 34  0
                         throw new AssemblyException("Error assembling StatementTree",e);
 35  0
                 }
 36  
                 
 37  0
                 return stmtTree;
 38  
         }
 39  
 
 40  
 
 41  
         @Override
 42  
         public BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo> disassemble(
 43  
                         StatementTreeViewInfo newTree, NodeOperation operation)
 44  
                         throws AssemblyException {
 45  
 
 46  0
         if (newTree == null) {
 47  
                         // FIXME Unsure now if this is an exception or just return null or
 48  
                         // empty assemblyNode
 49  0
                     LOG.error("StatementTreeView to disassemble is null!");
 50  0
                         throw new AssemblyException("StatementTreeView can not be null");
 51  
                 }
 52  
 
 53  0
                 BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo> result = new BaseDTOAssemblyNode<StatementTreeViewInfo, StatementTreeViewInfo>(this);
 54  0
                 if(newTree.getId()==null|newTree.getId().isEmpty()){
 55  0
                         result.setOperation(NodeOperation.CREATE);
 56  
                 }else{
 57  0
                         result.setOperation(operation);
 58  
                 }
 59  0
                 result.setBusinessDTORef(newTree);
 60  0
                 result.setNodeData(newTree);
 61  0
                 return result;
 62  
         }
 63  
 
 64  
 
 65  
 
 66  
 
 67  
 }