View Javadoc

1   /**
2    * Copyright 2012 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   * Created by Charles on 5/7/12
16   */
17  package org.kuali.student.enrollment.class2.courseoffering.form;
18  
19  import org.kuali.rice.krad.web.form.UifFormBase;
20  import org.kuali.student.common.uif.form.KSUifForm;
21  import org.kuali.student.r2.core.acal.dto.TermInfo;
22  import org.kuali.student.enrollment.class2.courseoffering.dto.SocRolloverResultItemWrapper;
23  
24  import java.util.ArrayList;
25  import java.util.List;
26  /**
27   * This class //TODO ...
28   *
29   * @author Kuali Student Team
30   */
31  public class CourseOfferingRolloverManagementForm extends KSUifForm {
32      // Properties of the form
33      private String targetTermCode;
34      private String sourceTermCode;
35      private String displayedTargetTermCode;
36      private String targetTermStartDate;
37      private String targetTermEndDate;
38      private String targetLastRolloverDate;
39      private String displayedSourceTermCode;
40      private String sourceTermStartDate;
41      private String sourceTermEndDate;
42      private String statusField;
43      private List<String> configurationOptions;
44      private TermInfo sourceTerm;
45      private TermInfo targetTerm;
46      private boolean isGoSourceButtonDisabled = true;
47      private boolean isRolloverButtonDisabled = true;
48  
49      // rollover details fields
50      private String rolloverSourceTermDesc;
51      private String rolloverTargetTermCode;
52      private String rolloverTargetTermDesc;
53      private String dateInitiated;
54      private String dateCompleted;
55      private String rolloverDuration; // Printed in hours, minutes, seconds
56      private String courseOfferingsAllowed;
57      private String activityOfferingsAllowed;
58      private List<SocRolloverResultItemWrapper> socRolloverResultItems;
59      private boolean isConfigurationOptionsDisabled = true;
60      private boolean acceptIndicator = false;
61  
62      // release to depts fields
63      private boolean releaseToDeptsDisabled = false;
64      private boolean releaseToDeptsInvalidTerm = false;
65      private boolean socReleasedToDepts = false;
66      private boolean rolloverCompleted = false; // Only true if finished or aborted
67  
68      // display term information below source/target term input box
69      private String sourceTermInfoDisplay;
70      private String targetTermInfoDisplay;
71  
72  
73      public CourseOfferingRolloverManagementForm(){
74          targetTermCode = "";
75          sourceTermCode = "";
76          displayedTargetTermCode = "";
77          targetTermStartDate = "";
78          targetTermEndDate = "";
79          targetLastRolloverDate = "";
80          displayedSourceTermCode = "";
81          sourceTermStartDate = "";
82          sourceTermEndDate = "";
83          statusField = "";
84          //rollover details fields
85          rolloverSourceTermDesc = "";
86          rolloverTargetTermCode = "";
87          rolloverTargetTermDesc = "";
88          dateInitiated = "";
89          dateCompleted = "";
90          rolloverDuration = "";
91          socRolloverResultItems = new ArrayList<SocRolloverResultItemWrapper>();
92          // release to depts fields
93          releaseToDeptsDisabled = false; // this is a dependent field so we don't let it be set externally
94          releaseToDeptsInvalidTerm = false;
95          socReleasedToDepts = false;
96  
97          computeReleaseToDeptsDisabled();
98       }
99  
100     public boolean getRolloverCompleted() {
101         return rolloverCompleted;
102     }
103 
104     public void setRolloverCompleted(boolean rolloverCompleted) {
105         this.rolloverCompleted = rolloverCompleted;
106         computeReleaseToDeptsDisabled();
107     }
108 
109     public String getTargetTermCode() {
110         return targetTermCode;
111     }
112 
113     public void setTargetTermCode(String targetTermCode) {
114         this.targetTermCode = targetTermCode;
115         computeReleaseToDeptsDisabled();
116     }
117 
118     public String getSourceTermCode() {
119         return sourceTermCode;
120     }
121 
122     public void setSourceTermCode(String sourceTermCode) {
123         this.sourceTermCode = sourceTermCode;
124     }
125 
126     public String getDisplayedTargetTermCode() {
127         return displayedTargetTermCode;
128     }
129 
130     public void setDisplayedTargetTermCode(String displayedTargetTermCode) {
131         this.displayedTargetTermCode = displayedTargetTermCode;
132     }
133 
134     public String getTargetTermStartDate() {
135         return targetTermStartDate;
136     }
137 
138     public void setTargetTermStartDate(String targetTermStartDate) {
139         this.targetTermStartDate = targetTermStartDate;
140     }
141 
142     public String getTargetTermEndDate() {
143         return targetTermEndDate;
144     }
145 
146     public void setTargetTermEndDate(String targetTermEndDate) {
147         this.targetTermEndDate = targetTermEndDate;
148     }
149 
150     public String getTargetLastRolloverDate() {
151         return targetLastRolloverDate;
152     }
153 
154     public void setTargetLastRolloverDate(String targetLastRolloverDate) {
155         this.targetLastRolloverDate = targetLastRolloverDate;
156     }
157 
158     public String getDisplayedSourceTermCode() {
159         return displayedSourceTermCode;
160     }
161 
162     public void setDisplayedSourceTermCode(String displayedSourceTermCode) {
163         this.displayedSourceTermCode = displayedSourceTermCode;
164     }
165 
166     public String getSourceTermStartDate() {
167         return sourceTermStartDate;
168     }
169 
170     public void setSourceTermStartDate(String sourceTermStartDate) {
171         this.sourceTermStartDate = sourceTermStartDate;
172     }
173 
174     public String getSourceTermEndDate() {
175         return sourceTermEndDate;
176     }
177 
178     public void setSourceTermEndDate(String sourceTermEndDate) {
179         this.sourceTermEndDate = sourceTermEndDate;
180     }
181 
182     public String getRolloverSourceTermDesc() {
183         return rolloverSourceTermDesc;
184     }
185 
186     public void setRolloverSourceTermDesc(String rolloverSourceTermDesc) {
187         this.rolloverSourceTermDesc = rolloverSourceTermDesc;
188     }
189 
190     public String getRolloverTargetTermDesc() {
191         return rolloverTargetTermDesc;
192     }
193 
194     public void setRolloverTargetTermDesc(String rolloverTargetTermDesc) {
195         this.rolloverTargetTermDesc = rolloverTargetTermDesc;
196     }
197 
198     public String getDateInitiated() {
199         return dateInitiated;
200     }
201 
202     public void setDateInitiated(String dateInitiated) {
203         this.dateInitiated = dateInitiated;
204     }
205 
206     public String getRolloverDuration() {
207         return rolloverDuration;
208     }
209 
210     public void setRolloverDuration(String rolloverDuration) {
211         this.rolloverDuration = rolloverDuration;
212     }
213 
214     public String getRolloverTargetTermCode() {
215         return rolloverTargetTermCode;
216     }
217 
218     public void setRolloverTargetTermCode(String rolloverTargetTermCode) {
219         this.rolloverTargetTermCode = rolloverTargetTermCode;
220     }
221 
222     public String getDateCompleted() {
223         return dateCompleted;
224     }
225 
226     public void setDateCompleted(String dateCompleted) {
227         this.dateCompleted = dateCompleted;
228     }
229 
230     public String getCourseOfferingsAllowed() {
231         return courseOfferingsAllowed;
232     }
233 
234     public void setCourseOfferingsAllowed(String courseOfferingsAllowed) {
235         this.courseOfferingsAllowed = courseOfferingsAllowed;
236     }
237 
238     public String getActivityOfferingsAllowed() {
239         return activityOfferingsAllowed;
240     }
241 
242     public void setActivityOfferingsAllowed(String activityOfferingsAllowed) {
243         this.activityOfferingsAllowed = activityOfferingsAllowed;
244     }
245     
246     public List<SocRolloverResultItemWrapper> getSocRolloverResultItems(){
247         return socRolloverResultItems;
248     }
249     
250     public void setSocRolloverResultItems(List<SocRolloverResultItemWrapper> socRolloverResultItems){
251         this.socRolloverResultItems = socRolloverResultItems;
252     }
253 
254     public String getStatusField() {
255         return statusField;
256     }
257 
258     public void setStatusField(String statusField) {
259         this.statusField = statusField;
260     }
261 
262     public TermInfo getSourceTerm() {
263         return sourceTerm;
264     }
265 
266     public void setSourceTerm(TermInfo sourceTerm) {
267         this.sourceTerm = sourceTerm;
268     }
269 
270     public TermInfo getTargetTerm() {
271         return targetTerm;
272     }
273 
274     public void setTargetTerm(TermInfo targetTerm) {
275         this.targetTerm = targetTerm;
276     }
277 
278     public boolean getIsGoSourceButtonDisabled() {
279         return isGoSourceButtonDisabled;
280     }
281 
282     public void setIsGoSourceButtonDisabled(boolean goSourceButtonDisabled) {
283         isGoSourceButtonDisabled = goSourceButtonDisabled;
284     }
285 
286     public boolean getIsRolloverButtonDisabled() {
287         return isRolloverButtonDisabled;
288     }
289 
290     public void setIsRolloverButtonDisabled(boolean rolloverButtonDisabled) {
291         isRolloverButtonDisabled = rolloverButtonDisabled;
292     }
293 
294     public boolean getIsConfigurationOptionsDisabled() {
295         return isConfigurationOptionsDisabled;
296     }
297 
298     public void setIsConfigurationOptionsDisabled(boolean isConfigurationOptionsDisabled) {
299         this.isConfigurationOptionsDisabled = isConfigurationOptionsDisabled;
300     }
301 
302     public boolean getAcceptIndicator() {
303         return acceptIndicator;
304     }
305 
306     public void setAcceptIndicator(boolean acceptIndicator) {
307         this.acceptIndicator = acceptIndicator;
308     }
309 
310     public boolean getReleaseToDeptsDisabled() {
311         return releaseToDeptsDisabled;
312     }
313 
314     private void _setReleaseToDeptsDisabled(boolean releaseToDeptsDisabled) {
315         this.releaseToDeptsDisabled = releaseToDeptsDisabled;
316     }
317 
318     public boolean computeReleaseToDeptsDisabled() {
319         // Disable release to depts if it's an invalid term or if it's already released
320         this.releaseToDeptsDisabled =
321                 releaseToDeptsInvalidTerm || socReleasedToDepts || targetTermCode == null
322                         || targetTermCode.trim().isEmpty() || !rolloverCompleted;
323         return this.releaseToDeptsDisabled;
324     }
325 
326     public boolean getReleaseToDeptsInvalidTerm() {
327         return releaseToDeptsInvalidTerm;
328     }
329 
330     public void setReleaseToDeptsInvalidTerm(boolean releaseToDeptsInvalidTerm) {
331         this.releaseToDeptsInvalidTerm = releaseToDeptsInvalidTerm;
332         computeReleaseToDeptsDisabled();
333     }
334 
335     public boolean getSocReleasedToDepts() {
336         return socReleasedToDepts;
337     }
338 
339     public void setSocReleasedToDepts(boolean releasedToDepts) {
340         socReleasedToDepts = releasedToDepts;
341     }
342 
343     public List<String> getConfigurationOptions() {
344         if(configurationOptions == null){
345             configurationOptions = new ArrayList<String>();
346         }
347         return configurationOptions;
348     }
349 
350     public void setConfigurationOptions(List<String> configurationOptions) {
351         this.configurationOptions = configurationOptions;
352     }
353 
354     public String getTargetTermInfoDisplay() {
355         return targetTermInfoDisplay;
356     }
357 
358     public void setTargetTermInfoDisplay(String targetTermInfoDisplay) {
359         this.targetTermInfoDisplay = targetTermInfoDisplay;
360     }
361 
362     public String getSourceTermInfoDisplay() {
363         return sourceTermInfoDisplay;
364     }
365 
366     public void setSourceTermInfoDisplay(String sourceTermInfoDisplay) {
367         this.sourceTermInfoDisplay = sourceTermInfoDisplay;
368     }
369 
370     public void resetForm(){
371         displayedTargetTermCode = "";
372         targetTermStartDate = "";
373         targetTermEndDate = "";
374         targetLastRolloverDate = "";
375         displayedSourceTermCode = "";
376         sourceTermStartDate = "";
377         sourceTermEndDate = "";
378         statusField = "";
379         sourceTermInfoDisplay = "";
380         targetTermInfoDisplay = "";
381         //rollover details fields
382         rolloverSourceTermDesc = "";
383         rolloverTargetTermCode = "";
384         rolloverTargetTermDesc = "";
385         dateInitiated = "";
386         dateCompleted = "";
387         socRolloverResultItems = new ArrayList<SocRolloverResultItemWrapper>();
388         isGoSourceButtonDisabled = true;
389         isRolloverButtonDisabled = true;
390         isConfigurationOptionsDisabled = true;
391         // release to depts fields
392         releaseToDeptsDisabled = false;
393         releaseToDeptsInvalidTerm = false;
394         socReleasedToDepts = false;
395         computeReleaseToDeptsDisabled();
396     }
397  }