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.common.util.constants.AtpServiceConstants; |
7 | |
import org.kuali.student.r2.core.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 | 0 | public KeyDateWrapper(){ |
18 | 0 | setAllDay(false); |
19 | 0 | setDateRange(true); |
20 | 0 | keyDateInfo = new KeyDateInfo(); |
21 | 0 | keyDateInfo.setStateKey(AtpServiceConstants.MILESTONE_DRAFT_STATE_KEY); |
22 | 0 | RichTextInfo desc = new RichTextInfo(); |
23 | 0 | desc.setPlain("test"); |
24 | 0 | keyDateInfo.setDescr(desc); |
25 | 0 | } |
26 | |
|
27 | 0 | public KeyDateWrapper(KeyDateInfo keydate,boolean isCopy){ |
28 | |
|
29 | 0 | this.setStartDate(keydate.getStartDate()); |
30 | 0 | this.setEndDate(keydate.getEndDate()); |
31 | 0 | this.setAllDay(keydate.getIsAllDay()); |
32 | 0 | this.setDateRange(keydate.getIsDateRange()); |
33 | 0 | this.setKeyDateType(keydate.getTypeKey()); |
34 | |
|
35 | 0 | if (isCopy){ |
36 | 0 | this.setKeyDateInfo(new KeyDateInfo()); |
37 | 0 | RichTextInfo desc = new RichTextInfo(); |
38 | 0 | desc.setPlain(keydate.getTypeKey()); |
39 | 0 | getKeyDateInfo().setDescr(desc); |
40 | 0 | getKeyDateInfo().setStateKey(AtpServiceConstants.MILESTONE_DRAFT_STATE_KEY); |
41 | 0 | }else{ |
42 | 0 | this.setKeyDateInfo(keydate); |
43 | |
} |
44 | |
|
45 | 0 | buildDateAndTime(); |
46 | 0 | } |
47 | |
|
48 | |
public String getKeyDateType() { |
49 | 0 | return keyDateType; |
50 | |
} |
51 | |
|
52 | |
public void setKeyDateType(String keyDateType) { |
53 | 0 | this.keyDateType = keyDateType; |
54 | 0 | } |
55 | |
|
56 | |
public KeyDateInfo getKeyDateInfo() { |
57 | 0 | return keyDateInfo; |
58 | |
} |
59 | |
|
60 | |
public void setKeyDateInfo(KeyDateInfo keyDateInfo) { |
61 | 0 | this.keyDateInfo = keyDateInfo; |
62 | 0 | } |
63 | |
|
64 | |
public String getKeyDateNameUI() { |
65 | 0 | return keyDateNameUI; |
66 | |
} |
67 | |
|
68 | |
public void setKeyDateNameUI(String keyDateNameUI) { |
69 | 0 | this.keyDateNameUI = keyDateNameUI; |
70 | 0 | } |
71 | |
|
72 | |
public TypeInfo getTypeInfo() { |
73 | 0 | return typeInfo; |
74 | |
} |
75 | |
|
76 | |
public void setTypeInfo(TypeInfo typeInfo) { |
77 | 0 | this.typeInfo = typeInfo; |
78 | 0 | } |
79 | |
|
80 | |
public boolean isNew() { |
81 | 0 | return StringUtils.isBlank(keyDateInfo.getId()); |
82 | |
} |
83 | |
|
84 | |
|
85 | |
public String getStartDateUI(){ |
86 | 0 | return formatStartDateUI(keyDateInfo.getStartDate()); |
87 | |
} |
88 | |
|
89 | |
|
90 | |
public String getEndDateUI(){ |
91 | 0 | return formatEndDateUI(keyDateInfo.getEndDate()); |
92 | |
} |
93 | |
|
94 | |
} |