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   * @author Kuali Student Team
16   */
17  
18  package org.kuali.student.cm.course.form.wrapper;
19  
20  import org.kuali.student.cm.common.util.CurriculumManagementConstants;
21  import org.kuali.student.cm.proposal.util.ProposalUtil;
22  import org.kuali.student.r2.lum.course.dto.FormatInfo;
23  
24  import java.io.Serializable;
25  import java.util.ArrayList;
26  import java.util.Date;
27  import java.util.List;
28  
29  /**
30   * Base class for all the wrappers around CourseInfo.
31   */
32  public class CourseInfoWrapper extends CommonCourseDataWrapper implements Serializable {
33  
34      private List<CluInstructorInfoWrapper> instructorWrappers = new ArrayList<CluInstructorInfoWrapper>();
35  
36      private List<CourseJointInfoWrapper> courseJointWrappers = new ArrayList<CourseJointInfoWrapper>();
37      private List<ResultValuesGroupInfoWrapper> creditOptionWrappers;
38  
39      private List<OrganizationInfoWrapper> administeringOrganizations = new ArrayList<OrganizationInfoWrapper>();
40      private ReviewProposalDisplay reviewProposalDisplay = new ReviewProposalDisplay();
41      private List<String> campusLocations;
42  
43      private List<FormatInfo> formats = new ArrayList<FormatInfo>();
44  
45      private String crossListingDisclosureSection;
46      private String unitsContentOwnerToAdd = "";
47      private String finalExamStatus;
48      private boolean audit;
49      private boolean passFail;
50      private String finalExamRationale;
51  
52      // do we need this?
53      private Boolean showAll;
54      private LoDisplayWrapperModel loDisplayWrapperModel = new LoDisplayWrapperModel();
55  
56      // do we need this?
57      private Date effectiveDate;
58      // do we need this?
59      private Date expirationDate;
60  
61      private String previousSubjectCode;
62  
63      private boolean currentVersion = true;
64      private String versionText;
65  
66      private String currentCourseEndTermShortName;
67  
68      private String startTermConstrainingTermId;
69  
70      // decides whether to set default data on the CourseInfo object at the save point
71      private boolean disableCourseDefaulting = false;
72  
73      private boolean supersededCourseFormerlyRetired = false;
74  
75      /**
76       * For modify proposals this is the text for the end term that will be applied to the currently active
77       * course when/if the draft course is made active.
78       */
79      public String getCurrentCourseEndTermShortName() {
80          return currentCourseEndTermShortName;
81      }
82  
83      public void setCurrentCourseEndTermShortName(String currentCourseEndTermShortName) {
84           this.currentCourseEndTermShortName = currentCourseEndTermShortName;
85      }
86  
87      /**
88       * //kscm-2838: Storage for the constraining date based on current version.  This is used on a modify with new version
89       * to constrain the values of the start term on the draft course.
90       */
91      public String getStartTermConstrainingTermId() {
92          return this.startTermConstrainingTermId;
93      }
94  
95      public void setStartTermConstrainingTermId(String startTermConstrainingTermId) {
96           this.startTermConstrainingTermId = startTermConstrainingTermId;
97      }
98  
99      /**
100      * This is a display property for the course version (e.g. "Version 2 (current version)") on View Course compare view.
101      */
102     public String getVersionText() {
103         return versionText;
104     }
105 
106     public void setVersionText(String versionText) {
107         this.versionText = versionText;
108     }
109 
110     public String getHiddenDescr() {
111         return hiddenDescr;
112     }
113 
114     public void setHiddenDescr(String hiddenDescr) {
115         this.hiddenDescr = hiddenDescr;
116     }
117 
118     // do we need this?
119     private String hiddenDescr;
120 
121     public CourseInfoWrapper() {
122         // cannot pass document type in here because this could be Modify or Create
123         super(ProposalUtil.isUserCurriculumSpecialist(), CurriculumManagementConstants.CourseViewSections.COURSE_INFO);
124     }
125 
126     /**
127      * @return True if this is the current version of the course (aka the most recent course in state active). Otherwise, false.
128      */
129     public boolean isCurrentVersion() {
130         return currentVersion;
131     }
132 
133     public void setCurrentVersion(boolean currentVersion) {
134         this.currentVersion = currentVersion;
135     }
136 
137     public Date getEffectiveDate() {
138         return effectiveDate;
139     }
140 
141     public void setEffectiveDate(Date effectiveDate) {
142         this.effectiveDate = effectiveDate;
143     }
144 
145     public Date getExpirationDate() {
146         return expirationDate;
147     }
148 
149     public void setExpirationDate(Date expirationDate) {
150         this.expirationDate = expirationDate;
151     }
152 
153     public boolean isAudit() {
154         return audit;
155     }
156 
157     public void setAudit(boolean audit) {
158         this.audit = audit;
159     }
160 
161     public boolean isPassFail() {
162         return passFail;
163     }
164 
165     public void setPassFail(boolean passFail) {
166         this.passFail = passFail;
167     }
168 
169     public String getFinalExamRationale() {
170         return finalExamRationale;
171     }
172 
173     public void setFinalExamRationale(String finalExamRationale) {
174         this.finalExamRationale = finalExamRationale;
175     }
176 
177     public Boolean getShowAll() {
178         return showAll;
179     }
180 
181     public void setShowAll(Boolean showAll) {
182         this.showAll = showAll;
183     }
184 
185     /**
186      * Since only one organization can be added for the Curriculum Oversight, a newly added one should replace the
187      * existing one. This property is used to remember which was the old one when the time comes to persist.
188      */
189     public String getPreviousSubjectCode() {
190         return previousSubjectCode;
191     }
192 
193     public void setPreviousSubjectCode(String previousSubjectCode) {
194         this.previousSubjectCode = previousSubjectCode;
195     }
196 
197     public LoDisplayWrapperModel getLoDisplayWrapperModel() {
198         return loDisplayWrapperModel;
199     }
200 
201     public void setLoDisplayWrapperModel(LoDisplayWrapperModel loDisplayWrapperModel) {
202         this.loDisplayWrapperModel = loDisplayWrapperModel;
203     }
204 
205     public boolean isDisableCourseDefaulting() {
206         return disableCourseDefaulting;
207     }
208 
209     public void setDisableCourseDefaulting(boolean disableCourseDefaulting) {
210         this.disableCourseDefaulting = disableCourseDefaulting;
211     }
212 
213     /**
214      * Gets the value of finalExamStatus
215      *
216      * @return the value of finalExamStatus
217      */
218     public String getFinalExamStatus() {
219         return this.finalExamStatus;
220     }
221 
222     /**
223      * Sets the value of finalExamStatus
224      *
225      * @param argFinalExamStatus Value to assign to this.finalExamStatus
226      */
227     public void setFinalExamStatus(final String argFinalExamStatus) {
228         this.finalExamStatus = argFinalExamStatus;
229     }
230 
231     public String getCrossListingDisclosureSection() {
232         this.crossListingDisclosureSection = "true";
233 
234         if (getCourseInfo().getCrossListings().isEmpty() && getCourseJointWrappers().isEmpty() && getCourseInfo().getVariations().isEmpty()) {
235             this.crossListingDisclosureSection = "false";
236         }
237         return this.crossListingDisclosureSection;
238     }
239 
240     public void setCrossListingDisclosureSection(String argCrossListingDisclosureSection) {
241         this.crossListingDisclosureSection = argCrossListingDisclosureSection;
242     }
243 
244     public void setUnitsContentOwnerToAdd(final String unitsContentOwnerToAdd) {
245         this.unitsContentOwnerToAdd = unitsContentOwnerToAdd;
246     }
247 
248     public String getUnitsContentOwnerToAdd() {
249         return unitsContentOwnerToAdd;
250     }
251 
252     public List<CluInstructorInfoWrapper> getInstructorWrappers() {
253         return instructorWrappers;
254     }
255 
256     public void setInstructorWrappers(List<CluInstructorInfoWrapper> instructorWrappers) {
257         this.instructorWrappers = instructorWrappers;
258     }
259 
260     public List<CourseJointInfoWrapper> getCourseJointWrappers() {
261         return courseJointWrappers;
262     }
263 
264     public void setCourseJointWrappers(List<CourseJointInfoWrapper> courseJointWrappers) {
265         this.courseJointWrappers = courseJointWrappers;
266     }
267 
268     public List<ResultValuesGroupInfoWrapper> getCreditOptionWrappers() {
269         if (creditOptionWrappers == null) {
270             creditOptionWrappers = new ArrayList<ResultValuesGroupInfoWrapper>();
271         }
272         return creditOptionWrappers;
273     }
274 
275     public void setCreditOptionWrappers(List<ResultValuesGroupInfoWrapper> creditOptionWrappers) {
276         this.creditOptionWrappers = creditOptionWrappers;
277     }
278 
279     public List<OrganizationInfoWrapper> getAdministeringOrganizations() {
280         return administeringOrganizations;
281     }
282 
283     public void setAdministeringOrganizations(List<OrganizationInfoWrapper> administeringOrganizations) {
284         this.administeringOrganizations = administeringOrganizations;
285     }
286 
287     public ReviewProposalDisplay getReviewProposalDisplay() {
288         return reviewProposalDisplay;
289     }
290 
291     public void setReviewProposalDisplay(ReviewProposalDisplay reviewProposalDisplay) {
292         this.reviewProposalDisplay = reviewProposalDisplay;
293     }
294 
295     /**
296      * The purpose of campusLocations in this class is to have a property that returns 'null' when not set.
297      * Unfortunately, the service DTO couseInfo.getCampusLocations() return an empty list. Currently (Rice 2.4)
298      * ExistenceConstraintProcessor interprets only 'null' for requiredness, resulting in ignoring requiredness
299      * validation on campusLocations even when not set.
300      */
301     public List<String> getCampusLocations() {
302         this.campusLocations = this.getCourseInfo().getCampusLocations();
303         if(campusLocations.isEmpty()) {
304             campusLocations = null;
305         }
306         return campusLocations;
307     }
308 
309     /**
310      * Because KRAD the reqired validation doesn't check isEmpty() for Lists and CourseInfo creates an empty List
311      * in the CourseInfo#getGradingOptions() we have to have this pass-thru method to make requiredness work
312      * correctly. Similar to campusLocations above.
313      */
314     public List<String> getGradingOptions() {
315         if (getCourseInfo().getGradingOptions().isEmpty()) {
316             return null;
317         }
318         return getCourseInfo().getGradingOptions();
319     }
320 
321     public void setGradingOptions(List<String> gradingOptions) {
322         getCourseInfo().setGradingOptions(gradingOptions);
323     }
324 
325     public List<FormatInfo> getFormats() {
326         return formats;
327     }
328 
329     public void setCampusLocations(List<String> campusLocations) {
330         this.campusLocations = campusLocations;
331         this.getCourseInfo().setCampusLocations(campusLocations);
332     }
333 
334     public void setFormats(List<FormatInfo> formats) {
335         this.formats = formats;
336     }
337 
338     /**
339      *  Returns true if the course state is superseded which has been previously retired
340      * @return supersededCourseFormerlyRetired
341      */
342     public boolean isSupersededCourseFormerlyRetired() {
343         return supersededCourseFormerlyRetired;
344     }
345 
346     /**
347      * Sets to true if the course state is superseded which has been previously retired
348      * @param supersededCourseFormerlyRetired
349      */
350     public void setSupersededCourseFormerlyRetired(boolean supersededCourseFormerlyRetired) {
351         this.supersededCourseFormerlyRetired = supersededCourseFormerlyRetired;
352     }
353 }