1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.enrollment.class2.acal.dto;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.student.r2.core.acal.dto.KeyDateInfo;
20 import org.kuali.student.r2.common.dto.RichTextInfo;
21 import org.kuali.student.r2.core.class1.type.dto.TypeInfo;
22 import org.kuali.student.r2.core.constants.AtpServiceConstants;
23
24
25
26
27
28
29 public class KeyDateWrapper extends TimeSetWrapper{
30
31 private String keyDateType;
32 private String keyDateNameUI;
33
34 private KeyDateInfo keyDateInfo;
35 private TypeInfo typeInfo;
36
37 public KeyDateWrapper(){
38 setAllDay(true);
39 setDateRange(false);
40 keyDateInfo = new KeyDateInfo();
41 keyDateInfo.setStateKey(AtpServiceConstants.MILESTONE_DRAFT_STATE_KEY);
42 RichTextInfo desc = new RichTextInfo();
43 desc.setPlain("test");
44 keyDateInfo.setDescr(desc);
45 }
46
47 public KeyDateWrapper(KeyDateInfo keydate,boolean isCopy){
48
49 this.setKeyDateType(keydate.getTypeKey());
50
51 if (isCopy){
52 this.setKeyDateInfo(new KeyDateInfo());
53 RichTextInfo desc = new RichTextInfo();
54 desc.setPlain(keydate.getTypeKey());
55 getKeyDateInfo().setDescr(desc);
56 getKeyDateInfo().setStateKey(AtpServiceConstants.MILESTONE_DRAFT_STATE_KEY);
57 }else{
58 this.setStartDate(keydate.getStartDate());
59 this.setEndDate(keydate.getEndDate());
60 this.setAllDay(keydate.getIsAllDay());
61 this.setDateRange(keydate.getIsDateRange());
62 this.setKeyDateInfo(keydate);
63 buildDateAndTime();
64 }
65
66 }
67
68 public String getKeyDateType() {
69 return keyDateType;
70 }
71
72 public void setKeyDateType(String keyDateType) {
73 this.keyDateType = keyDateType;
74 }
75
76 public KeyDateInfo getKeyDateInfo() {
77 return keyDateInfo;
78 }
79
80 public void setKeyDateInfo(KeyDateInfo keyDateInfo) {
81 this.keyDateInfo = keyDateInfo;
82 }
83
84 public String getKeyDateNameUI() {
85 return keyDateNameUI;
86 }
87
88 public void setKeyDateNameUI(String keyDateNameUI) {
89 this.keyDateNameUI = keyDateNameUI;
90 }
91
92 public TypeInfo getTypeInfo() {
93 return typeInfo;
94 }
95
96 public void setTypeInfo(TypeInfo typeInfo) {
97 this.typeInfo = typeInfo;
98 }
99
100 public boolean isNew() {
101 return StringUtils.isBlank(keyDateInfo.getId());
102 }
103
104
105 public String getStartDateUI(){
106 return formatStartDateUI(keyDateInfo.getStartDate());
107 }
108
109
110 public String getEndDateUI(){
111 return formatEndDateUI(keyDateInfo.getEndDate());
112 }
113 }