View Javadoc

1   package org.kuali.student.enrollment.class2.acal.service.assembler;
2   
3   import org.kuali.student.enrollment.acal.dto.KeyDateInfo;
4   import org.kuali.student.r2.common.assembler.AssemblyException;
5   import org.kuali.student.r2.common.assembler.DTOAssembler;
6   import org.kuali.student.r2.common.dto.ContextInfo;
7   import org.kuali.student.r2.core.atp.dto.MilestoneInfo;
8   
9   public class KeyDateAssembler implements DTOAssembler<KeyDateInfo, MilestoneInfo> {
10  
11      @Override
12      public KeyDateInfo assemble(MilestoneInfo baseDTO, ContextInfo context) throws AssemblyException {
13          KeyDateInfo keyDateInfo = new KeyDateInfo();
14  
15          keyDateInfo.setAttributes(baseDTO.getAttributes());
16          keyDateInfo.setDescr(baseDTO.getDescr());
17          keyDateInfo.setEndDate(baseDTO.getEndDate());
18          keyDateInfo.setId(baseDTO.getId());
19          keyDateInfo.setIsAllDay(baseDTO.getIsAllDay());
20          keyDateInfo.setIsDateRange(baseDTO.getIsDateRange());
21          keyDateInfo.setIsRelativeToKeyDate(baseDTO.getIsRelative());
22          keyDateInfo.setMeta(baseDTO.getMeta());
23          keyDateInfo.setName(baseDTO.getName());
24          keyDateInfo.setRelativeAnchorKeyDateId (baseDTO.getRelativeAnchorMilestoneId());
25          keyDateInfo.setStartDate(baseDTO.getStartDate());
26          keyDateInfo.setStateKey(baseDTO.getStateKey());
27          keyDateInfo.setTypeKey(baseDTO.getTypeKey());
28  
29          return keyDateInfo;
30      }
31  
32      @Override
33      public MilestoneInfo disassemble(KeyDateInfo businessDTO, ContextInfo context) throws AssemblyException {
34          MilestoneInfo milestone = new MilestoneInfo();
35          
36          milestone.setAttributes(businessDTO.getAttributes());
37          milestone.setDescr(businessDTO.getDescr() );
38          milestone.setEndDate(businessDTO.getEndDate());
39          milestone.setId(businessDTO.getId());
40          milestone.setIsAllDay(businessDTO.getIsAllDay());
41          milestone.setIsDateRange(businessDTO.getIsDateRange());
42          milestone.setIsRelative(businessDTO.getIsRelativeToKeyDate());
43          milestone.setIsInstructionalDay(false);
44          milestone.setMeta(businessDTO.getMeta());
45          milestone.setName(businessDTO.getName());
46          milestone.setRelativeAnchorMilestoneId(businessDTO.getRelativeAnchorKeyDateId());
47          milestone.setStartDate(businessDTO.getStartDate());
48          milestone.setStateKey(businessDTO.getStateKey());
49          milestone.setTypeKey(milestone.getTypeKey());
50          
51          return milestone;
52      }
53  }