1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.r2.lum.clu.dto; |
17 | |
|
18 | |
import org.kuali.student.r2.common.dto.IdNamelessEntityInfo; |
19 | |
import org.kuali.student.r2.lum.clu.infc.CluPublication; |
20 | |
import org.kuali.student.r2.lum.clu.infc.Field; |
21 | |
|
22 | |
import javax.xml.bind.Element; |
23 | |
import javax.xml.bind.annotation.XmlAccessType; |
24 | |
import javax.xml.bind.annotation.XmlAccessorType; |
25 | |
import javax.xml.bind.annotation.XmlAnyElement; |
26 | |
import javax.xml.bind.annotation.XmlElement; |
27 | |
import javax.xml.bind.annotation.XmlType; |
28 | |
import java.io.Serializable; |
29 | |
import java.util.ArrayList; |
30 | |
import java.util.Date; |
31 | |
import java.util.List; |
32 | |
|
33 | |
@XmlAccessorType(XmlAccessType.FIELD) |
34 | |
@XmlType(name = "CluPublicationInfo", propOrder = {"id", "typeKey", "stateKey", "cluId", "variants", "startCycle", "endCycle", "effectiveDate", |
35 | |
"expirationDate", "meta", "attributes", "_futureElements"}) |
36 | |
public class CluPublicationInfo extends IdNamelessEntityInfo implements Serializable, CluPublication { |
37 | |
|
38 | |
private static final long serialVersionUID = 1L; |
39 | |
|
40 | |
@XmlElement |
41 | |
private String cluId; |
42 | |
|
43 | |
@XmlElement |
44 | |
private List<FieldInfo> variants; |
45 | |
|
46 | |
@XmlElement |
47 | |
private String startCycle; |
48 | |
|
49 | |
@XmlElement |
50 | |
private String endCycle; |
51 | |
|
52 | |
@XmlElement |
53 | |
private Date effectiveDate; |
54 | |
|
55 | |
@XmlElement |
56 | |
private Date expirationDate; |
57 | |
|
58 | |
@XmlAnyElement |
59 | |
private List<Element> _futureElements; |
60 | |
|
61 | 0 | public CluPublicationInfo() { |
62 | |
|
63 | 0 | } |
64 | |
|
65 | |
public CluPublicationInfo(CluPublication cluPublication) { |
66 | 0 | super(cluPublication); |
67 | 0 | if (null != cluPublication) { |
68 | 0 | this.cluId = cluPublication.getCluId(); |
69 | 0 | this.variants = new ArrayList<FieldInfo>(); |
70 | 0 | for (Field field : cluPublication.getVariants()) { |
71 | 0 | this.variants.add(new FieldInfo(field)); |
72 | |
} |
73 | 0 | this.startCycle = cluPublication.getStartCycle(); |
74 | 0 | this.endCycle = cluPublication.getEndCycle(); |
75 | 0 | this.effectiveDate = (null != cluPublication.getEffectiveDate()) ? new Date(cluPublication.getEffectiveDate().getTime()) : null; |
76 | 0 | this.expirationDate = (null != cluPublication.getExpirationDate()) ? new Date(cluPublication.getExpirationDate().getTime()) : null; |
77 | |
} |
78 | 0 | } |
79 | |
|
80 | |
@Override |
81 | |
public String getCluId() { |
82 | 0 | return cluId; |
83 | |
} |
84 | |
|
85 | |
public void setCluId(String cluId) { |
86 | 0 | this.cluId = cluId; |
87 | 0 | } |
88 | |
|
89 | |
@Override |
90 | |
public List<FieldInfo> getVariants() { |
91 | 0 | if (variants == null) { |
92 | 0 | variants = new ArrayList<FieldInfo>(0); |
93 | |
} |
94 | 0 | return variants; |
95 | |
} |
96 | |
|
97 | |
public void setVariants(List<FieldInfo> variants) { |
98 | 0 | this.variants = variants; |
99 | 0 | } |
100 | |
|
101 | |
@Override |
102 | |
public String getStartCycle() { |
103 | 0 | return startCycle; |
104 | |
} |
105 | |
|
106 | |
public void setStartCycle(String startCycle) { |
107 | 0 | this.startCycle = startCycle; |
108 | 0 | } |
109 | |
|
110 | |
@Override |
111 | |
public String getEndCycle() { |
112 | 0 | return endCycle; |
113 | |
} |
114 | |
|
115 | |
public void setEndCycle(String endCycle) { |
116 | 0 | this.endCycle = endCycle; |
117 | 0 | } |
118 | |
|
119 | |
@Override |
120 | |
public Date getEffectiveDate() { |
121 | 0 | return effectiveDate; |
122 | |
} |
123 | |
|
124 | |
public void setEffectiveDate(Date effectiveDate) { |
125 | 0 | this.effectiveDate = effectiveDate; |
126 | 0 | } |
127 | |
|
128 | |
@Override |
129 | |
public Date getExpirationDate() { |
130 | 0 | return expirationDate; |
131 | |
} |
132 | |
|
133 | |
public void setExpirationDate(Date expirationDate) { |
134 | 0 | this.expirationDate = expirationDate; |
135 | 0 | } |
136 | |
|
137 | |
@Override |
138 | |
public String toString() { |
139 | 0 | return "CluPublicationInfo[id=" + this.getId() + ", cluId=" + this.getCluId() + ", type=" + this.getTypeKey() + "]"; |
140 | |
} |
141 | |
} |