View Javadoc

1   package org.kuali.student.enrollment.class2.acal.service.assembler;
2   
3   import org.kuali.student.enrollment.acal.dto.AcalEventInfo;
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   import org.kuali.student.r2.core.atp.service.AtpService;
9   
10  public class AcalEventAssembler  implements DTOAssembler<AcalEventInfo, MilestoneInfo> {
11      
12      private AtpService atpService;
13      
14      @Override
15      public AcalEventInfo assemble(MilestoneInfo milestoneInfo, ContextInfo context) throws AssemblyException {
16          
17          if (milestoneInfo == null) {
18              return null;
19          }
20  
21          AcalEventInfo acalEventInfo = new AcalEventInfo();
22          acalEventInfo.setId(milestoneInfo.getId());
23          acalEventInfo.setName(milestoneInfo.getName());
24          acalEventInfo.setDescr(milestoneInfo.getDescr());
25  
26          acalEventInfo.setStartDate(milestoneInfo.getStartDate());
27          acalEventInfo.setEndDate(milestoneInfo.getEndDate());
28          acalEventInfo.setIsAllDay(milestoneInfo.getIsAllDay());
29          acalEventInfo.setIsDateRange(milestoneInfo.getIsDateRange());
30  
31          acalEventInfo.setStateKey(milestoneInfo.getStateKey());
32          acalEventInfo.setTypeKey(milestoneInfo.getTypeKey());
33  
34          acalEventInfo.setMeta(milestoneInfo.getMeta());
35          acalEventInfo.setAttributes(milestoneInfo.getAttributes());
36  
37          return acalEventInfo;
38      }
39  
40      @Override
41      public MilestoneInfo disassemble(AcalEventInfo acalEventInfo, ContextInfo context) throws AssemblyException {
42          
43          if (acalEventInfo == null) {
44              return null;
45          }
46  
47          MilestoneInfo msInfo = new MilestoneInfo();
48  
49          msInfo.setId(acalEventInfo.getId());
50          msInfo.setName(acalEventInfo.getName());
51          msInfo.setDescr(acalEventInfo.getDescr());
52  
53          msInfo.setStartDate(acalEventInfo.getStartDate());
54          msInfo.setEndDate(acalEventInfo.getEndDate());
55          msInfo.setIsAllDay(acalEventInfo.getIsAllDay());
56          msInfo.setIsDateRange(acalEventInfo.getIsDateRange());
57          msInfo.setIsRelative(false);
58  
59          msInfo.setStateKey(acalEventInfo.getStateKey());
60          msInfo.setTypeKey(acalEventInfo.getTypeKey());
61  
62          msInfo.setMeta(acalEventInfo.getMeta());
63          msInfo.setAttributes(acalEventInfo.getAttributes());
64  
65          return msInfo;
66      }
67  
68      public AtpService getAtpService() {
69          return atpService;
70      }
71  
72      public void setAtpService(AtpService atpService) {
73          this.atpService = atpService;
74      }
75  }