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