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 vgadiyak on 5/25/12
16   */
17  package org.kuali.student.enrollment.class2.courseoffering.dto;
18  
19  import org.apache.commons.lang.StringUtils;
20  import org.kuali.student.enrollment.class2.scheduleofclasses.dto.ActivityOfferingDisplayWrapper;
21  import org.kuali.student.r2.common.util.constants.LuiServiceConstants;
22  
23  import java.io.Serializable;
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  /* TODO : This class needs refactoring; should inherit from CourseOfferingWrapper; see https://jira.kuali.org/browse/KSENROLL-5931
28   * (note: not sure whether this class should actually be part of the refactoring or not)
29   */
30  
31  /**
32   * This wrapper is used to display a list of {@link org.kuali.student.enrollment.courseoffering.dto.CourseOfferingInfo} at
33   * Manage CO View.
34   *
35   * @author Kuali Student Team
36   */
37  public class CourseOfferingListSectionWrapper implements Serializable{
38  
39      private String courseOfferingId;
40      private String courseOfferingCode;
41      private String courseOfferingDesc;
42      private String courseOfferingFormatedDesc;
43      private String courseOfferingStateKey;
44      private String courseOfferingStateDisplay;
45      private String courseOfferingCreditOptionKey;
46      private String courseOfferingGradingOptionKey;
47      private String courseOfferingCreditOptionDisplay;
48      private String courseOfferingGradingOptionDisplay;
49      private String subjectArea;
50      private String adminOrg;
51  
52      private boolean studentSelectablePassFail;
53      private boolean auditCourse;
54      private boolean honorsCourse;
55  
56      private List<String> alternateCOCodes;
57      private String ownerCode;
58      private List<String> ownerAliases;
59  
60      private boolean isCrossListed;
61      private boolean isColocated;
62      private boolean isJointDefined;
63  
64      private boolean isLegalToDelete = true;
65      private boolean isChecked = false;
66  
67      //hidden columns for toolbar
68      private boolean enableAddButton = false;
69      private boolean enableApproveButton = false;
70      private boolean enableSuspendButton = false;
71      private boolean enableCancelButton = false;
72      private boolean enableReinstateButton = false;
73      private boolean enableDeleteButton = false;
74      private boolean enableCopyCOActionLink = false;
75      private boolean enableEditCOActionLink = false;
76  
77      private String crossListedCoList;
78  
79      private String colocatedCoCode = "";
80      private String jointDefinedCoCode = "";
81  
82      List<ActivityOfferingDisplayWrapper> aoToBeDeletedList;
83      private boolean coHasAoToDelete = true;
84  
85      public CourseOfferingListSectionWrapper () {
86          this.alternateCOCodes = new ArrayList<String>();
87          this.ownerAliases = new ArrayList<String>();
88          aoToBeDeletedList =  new ArrayList<ActivityOfferingDisplayWrapper>();
89      }
90  
91      public List<ActivityOfferingDisplayWrapper> getAoToBeDeletedList() {
92          return aoToBeDeletedList;
93      }
94  
95      public void setAoToBeDeletedList(List<ActivityOfferingDisplayWrapper> aoToBeDeletedList) {
96          this.aoToBeDeletedList = aoToBeDeletedList;
97      }
98  
99      public boolean isCoHasAoToDelete() {
100         return coHasAoToDelete;
101     }
102 
103     public void setCoHasAoToDelete(boolean coHasAoToDelete) {
104         this.coHasAoToDelete = coHasAoToDelete;
105     }
106 
107     public boolean isEnableAddButton() {
108         return enableAddButton;
109     }
110 
111     public void setEnableAddButton(boolean enableAddButton) {
112         this.enableAddButton = enableAddButton;
113     }
114 
115     public boolean isEnableApproveButton() {
116         return enableApproveButton;
117     }
118 
119     public void setEnableApproveButton(boolean enableApproveButton) {
120         this.enableApproveButton = enableApproveButton;
121     }
122 
123     public boolean isEnableSuspendButton() {
124         return enableSuspendButton;
125     }
126 
127     public void setEnableSuspendButton(boolean enableSuspendButton) {
128         this.enableSuspendButton = enableSuspendButton;
129     }
130 
131     public boolean isEnableCancelButton() {
132         return enableCancelButton;
133     }
134 
135     public void setEnableCancelButton(boolean enableCancelButton) {
136         this.enableCancelButton = enableCancelButton;
137     }
138 
139     public boolean isEnableReinstateButton() {
140         return enableReinstateButton;
141     }
142 
143     public void setEnableReinstateButton(boolean enableReinstateButton) {
144         this.enableReinstateButton = enableReinstateButton;
145     }
146 
147     public boolean isEnableDeleteButton() {
148         return enableDeleteButton;
149     }
150 
151     public void setEnableDeleteButton(boolean enableDeleteButton) {
152         this.enableDeleteButton = enableDeleteButton;
153     }
154 
155     public boolean getIsChecked() {
156         return isChecked;
157     }
158 
159     public void setIsChecked(boolean checked) {
160         isChecked = checked;
161     }
162 
163 
164     public boolean isLegalToDelete() {
165 
166         if (this.getCourseOfferingStateKey() != null &&
167                 StringUtils.equals(this.getCourseOfferingStateKey(), LuiServiceConstants.LUI_DRAFT_STATE_KEY) ||
168                 StringUtils.equals(this.getCourseOfferingStateKey(), LuiServiceConstants.LUI_CO_STATE_DRAFT_KEY) ||
169                 StringUtils.equals(this.getCourseOfferingStateKey(), LuiServiceConstants.LUI_CO_STATE_PLANNED_KEY) ||
170                 StringUtils.equals(this.getCourseOfferingStateKey(), LuiServiceConstants.LUI_AO_STATE_OFFERED_KEY) ||
171                 StringUtils.equals(this.getCourseOfferingStateKey(), LuiServiceConstants.LUI_CO_STATE_OFFERED_KEY) ) {
172             return true;
173         }
174 
175         return false;
176     }
177 
178     public void setLegalToDelete(boolean legalToDelete) {
179         isLegalToDelete = legalToDelete;
180     }
181 
182     public boolean isEnableCopyCOActionLink() {
183         return enableCopyCOActionLink;
184     }
185 
186     public void setEnableCopyCOActionLink(boolean enableCopyCOActionLink) {
187         this.enableCopyCOActionLink = enableCopyCOActionLink;
188     }
189 
190     public boolean isEnableEditCOActionLink() {
191         return enableEditCOActionLink;
192     }
193 
194     public void setEnableEditCOActionLink(boolean enableEditCOActionLink) {
195         this.enableEditCOActionLink = enableEditCOActionLink;
196     }
197 
198     public String getCourseOfferingCode() {
199         return courseOfferingCode;
200     }
201 
202     public void setCourseOfferingCode(String courseOfferingCode) {
203         this.courseOfferingCode = courseOfferingCode;
204     }
205 
206     public String getCourseOfferingCreditOptionKey() {
207         return courseOfferingCreditOptionKey;
208     }
209 
210     public void setCourseOfferingCreditOptionKey(String courseOfferingCreditOptionKey) {
211         this.courseOfferingCreditOptionKey = courseOfferingCreditOptionKey;
212     }
213 
214     public String getCourseOfferingDesc() {
215         return courseOfferingDesc;
216     }
217 
218     public void setCourseOfferingDesc(String courseOfferingDesc) {
219         this.courseOfferingDesc = courseOfferingDesc;
220     }
221 
222     public String getCourseOfferingGradingOptionKey() {
223         return courseOfferingGradingOptionKey;
224     }
225 
226     public void setCourseOfferingGradingOptionKey(String courseOfferingGradingOptionKey) {
227         this.courseOfferingGradingOptionKey = courseOfferingGradingOptionKey;
228     }
229 
230     public String getCourseOfferingStateKey() {
231         return courseOfferingStateKey;
232     }
233 
234     public void setCourseOfferingStateKey(String courseOfferingStateKey) {
235         this.courseOfferingStateKey = courseOfferingStateKey;
236     }
237 
238     public String getCourseOfferingId() {
239         return courseOfferingId;
240     }
241 
242     public void setCourseOfferingId(String courseOfferingId) {
243         this.courseOfferingId = courseOfferingId;
244     }
245 
246     public String getSubjectArea() {
247         return subjectArea;
248     }
249 
250     public void setSubjectArea(String subjectArea) {
251         this.subjectArea = subjectArea;
252     }
253 
254     public String getCrossListedCoList() {
255         return crossListedCoList;
256     }
257 
258     public void setCrossListedCoList(String crossListedCoList) {
259         this.crossListedCoList = crossListedCoList;
260     }
261 
262     public String getCourseOfferingStateDisplay() {
263         return courseOfferingStateDisplay;
264     }
265 
266     public void setCourseOfferingStateDisplay(String courseOfferingStateDisplay) {
267         this.courseOfferingStateDisplay = courseOfferingStateDisplay;
268     }
269 
270     public String getCourseOfferingCreditOptionDisplay() {
271         return courseOfferingCreditOptionDisplay;
272     }
273 
274     public void setCourseOfferingCreditOptionDisplay(String courseOfferingCreditOptionDisplay) {
275         this.courseOfferingCreditOptionDisplay = courseOfferingCreditOptionDisplay;
276     }
277 
278     public String getCourseOfferingGradingOptionDisplay() {
279         return courseOfferingGradingOptionDisplay;
280     }
281 
282     public void setCourseOfferingGradingOptionDisplay(String courseOfferingGradingOptionDisplay) {
283         this.courseOfferingGradingOptionDisplay = courseOfferingGradingOptionDisplay;
284     }
285 
286     /**
287      * @see #setCrossListed(boolean)
288      * @return
289      */
290     public boolean isCrossListed() {
291         return isCrossListed;
292     }
293 
294     /**
295      * Sets true is this wrapper is for a cross listed course
296      *
297      * @param crossListed
298      */
299     public void setCrossListed(boolean crossListed) {
300         isCrossListed = crossListed;
301     }
302 
303     public boolean isColocated() {
304         return isColocated;
305     }
306 
307     public void setColocated(boolean colocated) {
308         isColocated = colocated;
309     }
310 
311     public String getJointDefinedCoCode() {
312         return jointDefinedCoCode;
313     }
314 
315     public void setJointDefinedCoCode(String jointDefinedCoCode) {
316         this.jointDefinedCoCode = jointDefinedCoCode;
317     }
318 
319     public boolean isJointDefined() {
320         return isJointDefined;
321     }
322 
323     public void setJointDefined(boolean jointDefined) {
324         isJointDefined = jointDefined;
325     }
326 
327     /**
328      * @see #setAlternateCOCodes(List<String>)
329      * @return
330      */
331     public List<String> getAlternateCOCodes() {
332         return alternateCOCodes;
333     }
334 
335     /**
336      * List of alternate Course offering codes (either cross list or owner).
337      * @param alternateCOCodes
338      */
339     public void setAlternateCOCodes(List<String> alternateCOCodes) {
340         this.alternateCOCodes = alternateCOCodes;
341     }
342 
343     public String getOwnerCode() {
344         return ownerCode;
345     }
346 
347     public void setOwnerCode(String ownerCode) {
348         this.ownerCode = ownerCode;
349     }
350 
351     public List<String> getOwnerAliases() {
352         return ownerAliases;
353     }
354 
355     public void setOwnerAliases(List<String> ownerAliases) {
356         this.ownerAliases = ownerAliases;
357     }
358 
359     public String getColocatedCoCode() {
360         return colocatedCoCode;
361     }
362 
363     public void setColocatedCoCode(String colocatedCoCode) {
364         this.colocatedCoCode = colocatedCoCode;
365     }
366 
367     /**
368      * This method returns a list of crosslisted/official course code for a course. This will
369      * be displayed as the tooltip (if crosslisted cos exists) at Manage CO screen.
370      *
371      * @return
372      */
373     @SuppressWarnings("unused")
374     public String getCrossListedCodesUI(){
375 
376         //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
377         StringBuilder sb = new StringBuilder();
378         sb.append("This course is crosslisted with:<br>");
379         for (String code : alternateCOCodes){
380             sb.append(code + ",");
381         }
382         return StringUtils.removeEnd(sb.toString(),",");
383     }
384 
385     /**
386      * This method returns a list of crosslisted/official course code for a course. This will
387      * be displayed as the tooltip (if crosslisted cos exists) at Manage CO screen.
388      *
389      * @return
390      */
391     @SuppressWarnings("unused")
392     public String getJointDefinedCodesUI(){
393 
394         //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
395         StringBuilder sb = new StringBuilder();
396         sb.append("This course is joint defined with:<br>");
397         sb.append(jointDefinedCoCode + "<br>");
398 
399         return StringUtils.removeEnd(sb.toString(),"<br>");
400     }
401 
402     /**
403      * This method returns a coocated official course code for a course. This will
404      * be displayed as the tooltip (if colocated co exists) at Manage CO screen.
405      *
406      * @return
407      */
408     @SuppressWarnings("unused")
409     public String getColocatedInfoUI(){
410         //JIRA FIX : KSENROLL-8731 - Replaced StringBuffer with StringBuilder
411         StringBuilder sb = new StringBuilder();
412         sb.append("One or more activities in this course is colocated with activities in:<br>");
413         sb.append(colocatedCoCode + "<br>");
414 
415         return StringUtils.removeEnd(sb.toString(),"<br>");
416     }
417 
418     public String getAdminOrg(){
419         return adminOrg;
420     }
421 
422     public void setAdminOrg(String adminOrg){
423         this.adminOrg=adminOrg;
424     }
425 
426     public String getCourseOfferingFormatedDesc() {
427         return courseOfferingFormatedDesc;
428     }
429 
430     public void setCourseOfferingFormatedDesc(String courseOfferingFormatedDesc) {
431         this.courseOfferingFormatedDesc = courseOfferingFormatedDesc;
432     }
433 
434     public boolean isStudentSelectablePassFail() {
435         return studentSelectablePassFail;
436     }
437 
438     public void setStudentSelectablePassFail(boolean studentSelectablePassFail) {
439         this.studentSelectablePassFail = studentSelectablePassFail;
440     }
441 
442     public boolean isAuditCourse() {
443         return auditCourse;
444     }
445 
446     public void setAuditCourse(boolean auditCourse) {
447         this.auditCourse = auditCourse;
448     }
449 
450     public boolean isHonorsCourse() {
451         return honorsCourse;
452     }
453 
454     public void setHonorsCourse(boolean honorsCourse) {
455         this.honorsCourse = honorsCourse;
456     }
457 
458 }
459