Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
TermInfo |
|
| 1.1818181818181819;1.182 | ||||
TermInfo$Builder |
|
| 1.1818181818181819;1.182 |
1 | /** | |
2 | * Copyright 2010 The Kuali Foundation Licensed under the | |
3 | * Educational Community License, Version 2.0 (the "License"); you may | |
4 | * not use this file except in compliance with the License. You may | |
5 | * obtain a copy of the License at | |
6 | * | |
7 | * http://www.osedu.org/licenses/ECL-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, | |
10 | * software distributed under the License is distributed on an "AS IS" | |
11 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
12 | * or implied. See the License for the specific language governing | |
13 | * permissions and limitations under the License. | |
14 | */ | |
15 | ||
16 | package org.kuali.student.core.academiccalendar.dto; | |
17 | ||
18 | import java.io.Serializable; | |
19 | import java.util.Date; | |
20 | import java.util.List; | |
21 | import org.w3c.dom.Element; | |
22 | ||
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.XmlAttribute; | |
27 | import javax.xml.bind.annotation.XmlElement; | |
28 | import javax.xml.bind.annotation.XmlType; | |
29 | import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; | |
30 | ||
31 | import org.kuali.student.common.infc.ModelBuilder; | |
32 | import org.kuali.student.r2.common.dto.KeyEntityInfo; | |
33 | import org.kuali.student.core.academiccalendar.infc.Term; | |
34 | ||
35 | ||
36 | /** | |
37 | * Information about a Term. | |
38 | * | |
39 | * @Author tom | |
40 | * @Since Tue Apr 05 14:22:34 EDT 2011 | |
41 | */ | |
42 | ||
43 | @XmlAccessorType(XmlAccessType.FIELD) | |
44 | @XmlType(name = "TermCalendarInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "startDate", "endDate", "metaInfo", "attributes", "_futureElements"}) | |
45 | public class TermInfo extends KeyEntityInfo implements Term, Serializable { | |
46 | ||
47 | private static final long serialVersionUID = 1L; | |
48 | ||
49 | @XmlElement | |
50 | private final Date startDate; | |
51 | ||
52 | @XmlElement | |
53 | private final Date endDate; | |
54 | ||
55 | @XmlAnyElement | |
56 | private final List<Element> _futureElements; | |
57 | ||
58 | 0 | private TermInfo() { |
59 | 0 | startDate = null; |
60 | 0 | endDate = null; |
61 | 0 | _futureElements = null; |
62 | 0 | } |
63 | ||
64 | /** | |
65 | * Constructs a new TermInfo from another | |
66 | * Term. | |
67 | * | |
68 | * @paramterm the Term to copy | |
69 | */ | |
70 | public TermInfo(Term term) { | |
71 | 0 | super(term); |
72 | ||
73 | 0 | this.startDate = null != term.getStartDate() ? new Date(term.getStartDate().getTime()) : null; |
74 | 0 | this.endDate = null != term.getEndDate() ? new Date(term.getEndDate().getTime()) : null; |
75 | ||
76 | 0 | _futureElements = null; |
77 | 0 | } |
78 | ||
79 | /** | |
80 | * Date and time the term becomes effective. This does not provide | |
81 | * a bound on date ranges or milestones associated with this time | |
82 | * period, but instead indicates the time period proper. This is a | |
83 | * similar concept to the effective date on enumerated | |
84 | * values. When an end date has been specified, this field must be | |
85 | * less than or equal to the end date. | |
86 | * | |
87 | * @return the Term start date | |
88 | */ | |
89 | @Override | |
90 | public Date getStartDate() { | |
91 | 0 | return startDate; |
92 | } | |
93 | ||
94 | /** | |
95 | * Date and time the term becomes ineffective. This does not | |
96 | * provide a bound on date ranges or milestones associated with | |
97 | * this time period, but instead indicates the time period | |
98 | * proper. If specified, this must be greater than or equal to the | |
99 | * start date. If this field is not specified, then no end date | |
100 | * has been currently defined and should automatically be | |
101 | * considered greater than the effective date. | |
102 | * | |
103 | * @return the Term end date | |
104 | */ | |
105 | @Override | |
106 | public Date getEndDate() { | |
107 | 0 | return endDate; |
108 | } | |
109 | ||
110 | /** | |
111 | * The builder class for this TermInfo. | |
112 | */ | |
113 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<TermInfo>, Term { |
114 | ||
115 | private Date startDate; | |
116 | private Date endDate; | |
117 | ||
118 | /** | |
119 | * Constructs a new builder. | |
120 | */ | |
121 | 0 | public Builder() {} |
122 | ||
123 | /** | |
124 | * Constructs a new builder initialized from another Term | |
125 | */ | |
126 | public Builder(Term term) { | |
127 | 0 | super(term); |
128 | 0 | this.startDate = term.getStartDate(); |
129 | 0 | this.startDate = term.getEndDate(); |
130 | 0 | } |
131 | ||
132 | /** | |
133 | * Builds the Term. | |
134 | * | |
135 | * @return a new Term | |
136 | */ | |
137 | public TermInfo build() { | |
138 | 0 | return new TermInfo(this); |
139 | } | |
140 | ||
141 | /** | |
142 | * Gets the start date. | |
143 | * | |
144 | * @return the Term start date | |
145 | */ | |
146 | @Override | |
147 | public Date getStartDate() { | |
148 | 0 | return startDate; |
149 | } | |
150 | ||
151 | /** | |
152 | * Sets the Term start date. | |
153 | * | |
154 | * @param startDate the start date for the Term | |
155 | */ | |
156 | public void setStartDate(Date startDate) { | |
157 | 0 | this.startDate = startDate; |
158 | 0 | } |
159 | ||
160 | /** | |
161 | * Gets the start date. | |
162 | * | |
163 | * @return the Term end date | |
164 | */ | |
165 | @Override | |
166 | public Date getEndDate() { | |
167 | 0 | return endDate; |
168 | } | |
169 | ||
170 | /** | |
171 | * Sets the Term end date. | |
172 | * | |
173 | * @param endDate the end date for the Term | |
174 | */ | |
175 | ||
176 | public void setEndDate(Date endDate) { | |
177 | 0 | this.endDate = endDate; |
178 | 0 | } |
179 | } | |
180 | } |