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.courseoffering.dto.CourseOfferingInfo;
21  import org.kuali.student.enrollment.courseoffering.dto.CreditOptionInfo;
22  import org.kuali.student.enrollment.courseoffering.dto.FormatOfferingInfo;
23  import org.kuali.student.r2.common.util.constants.LuiServiceConstants;
24  import org.kuali.student.r2.lum.course.dto.CourseInfo;
25  
26  import java.io.Serializable;
27  import java.util.ArrayList;
28  import java.util.List;
29  
30  /**
31   * This class //TODO ...
32   *
33   * @author Kuali Student Team
34   */
35  public class CourseOfferingEditWrapper implements Serializable {
36  
37      private CourseOfferingInfo coInfo;
38      private List<FormatOfferingInfo> formatOfferingList;
39      private List<String> studentRegOptions;
40      private List<String> crsGradingOptions;
41      private List<OrganizationInfoWrapper> organizationNames;
42      private List<OfferingInstructorWrapper> instructors;
43      private CourseInfo course;
44      private String termStartEnd;
45      private String stateName;
46  
47      private String selectedGradingOptionName;
48      private String selectedStudentRegOpts;
49  
50      private boolean passFailStudentRegOpts;//TODO RICE IS BROKEN for checklists so these are here temporarily
51      private boolean auditStudentRegOpts;
52  
53      private CreditOptionInfo creditOption;
54      private boolean creditOptionFixed;
55      private boolean isChecked;
56  
57      private String gradingOption;
58  
59      public CourseOfferingEditWrapper(){
60          coInfo = new CourseOfferingInfo();
61          formatOfferingList = new ArrayList<FormatOfferingInfo>();
62          studentRegOptions = new ArrayList<String>();
63      }
64  
65      public CourseOfferingEditWrapper(CourseOfferingInfo info){
66          super();
67          coInfo = info;
68      }
69  
70      public CourseOfferingInfo getCoInfo() {
71          return coInfo;
72      }
73  
74      public void setCoInfo(CourseOfferingInfo coInfo) {
75          this.coInfo = coInfo;
76      }
77  
78      public List<FormatOfferingInfo> getFormatOfferingList() {
79          return formatOfferingList;
80      }
81  
82      public void setFormatOfferingList(List<FormatOfferingInfo> formatOfferingList) {
83          if (formatOfferingList == null) {
84              formatOfferingList = new ArrayList<FormatOfferingInfo>();
85          }
86          this.formatOfferingList = formatOfferingList;
87      }
88  
89      public List<String> getStudentRegOptions() {
90          return studentRegOptions;
91      }
92  
93      public void setStudentRegOptions(List<String> studentRegOptions) {
94          if (studentRegOptions == null) {
95              studentRegOptions = new ArrayList<String>();
96          }
97          this.studentRegOptions = studentRegOptions;
98      }
99  
100     public List<String> getCrsGradingOptions() {
101         if (crsGradingOptions == null) {
102             crsGradingOptions = new ArrayList<String>();
103         }
104         return crsGradingOptions;
105     }
106 
107     public void setCrsGradingOptions(List<String> crsGradingOptions) {
108         this.crsGradingOptions = crsGradingOptions;
109     }
110 
111     public List<OrganizationInfoWrapper> getOrganizationNames() {
112         return organizationNames;
113     }
114 
115     public void setOrganizationNames(List<OrganizationInfoWrapper> organizationNames) {
116         this.organizationNames = organizationNames;
117     }
118 
119 
120     public String getSelectedGradingOptionName() {
121         return selectedGradingOptionName;
122     }
123 
124     public void setSelectedGradingOptionName(String selectedGradingOptionName) {
125         this.selectedGradingOptionName = selectedGradingOptionName;
126     }
127 
128     public String getSelectedStudentRegOpts() {
129         return selectedStudentRegOpts;
130     }
131 
132     public void setSelectedStudentRegOpts(String selectedStudentRegOpts) {
133         this.selectedStudentRegOpts = selectedStudentRegOpts;
134     }
135 
136     public CourseInfo getCourse() {
137         return course;
138     }
139 
140     public void setCourse(CourseInfo course) {
141         this.course = course;
142     }
143 
144     public CreditOptionInfo getCreditOption() {
145         return creditOption;
146     }
147 
148     public void setCreditOption(CreditOptionInfo creditOption) {
149         this.creditOption = creditOption;
150     }
151 
152     public boolean getCreditOptionFixed() {
153         return creditOptionFixed;
154     }
155 
156     public void setCreditOptionFixed(boolean creditOptionFixed) {
157         this.creditOptionFixed = creditOptionFixed;
158     }
159 
160     public String getTermStartEnd() {
161         return termStartEnd;
162     }
163 
164     public void setTermStartEnd(String termStartEnd) {
165         this.termStartEnd = termStartEnd;
166     }
167 
168     public List<OfferingInstructorWrapper> getInstructors() {
169         return instructors;
170     }
171 
172     public void setInstructors(List<OfferingInstructorWrapper> instructors) {
173         this.instructors = instructors;
174     }
175 
176     public boolean getIsChecked() {
177         return isChecked;
178     }
179 
180     public void setIsChecked(boolean checked) {
181         this.isChecked = checked;
182     }
183 
184     public String getGradingOption() {
185         return gradingOption;
186     }
187 
188     public void setGradingOption(String gradingOption) {
189         this.gradingOption = gradingOption;
190     }
191 
192     public String getStateName() {
193         return stateName;
194     }
195 
196     public void setStateName(String stateName) {
197         this.stateName = stateName;
198     }
199 
200     public boolean isLegalToDelete() {
201 
202         if (StringUtils.equals(coInfo.getStateKey(), LuiServiceConstants.LUI_DRAFT_STATE_KEY) ||
203             StringUtils.equals(coInfo.getStateKey(), LuiServiceConstants.LUI_CO_STATE_DRAFT_KEY) ||
204             StringUtils.equals(coInfo.getStateKey(), LuiServiceConstants.LUI_CO_STATE_PLANNED_KEY)) {
205             return true;
206         }
207 
208         return false;
209     }
210 
211     public String getCreditOptionCreditsUI(){
212         if(creditOption!=null && !creditOption.getAllowedCredits().isEmpty()){
213             return StringUtils.join(creditOption.getAllowedCredits(),",");
214         }
215         return "No Credits Selected";
216     }
217     public String getSelectedStudentRegOptsUI(){
218         return selectedStudentRegOpts;
219     }
220     public boolean getAuditStudentRegOpts() {
221         return auditStudentRegOpts;
222     }
223 
224     public void setAuditStudentRegOpts(boolean auditStudentRegOpts) {
225         this.auditStudentRegOpts = auditStudentRegOpts;
226     }
227 
228     public boolean getPassFailStudentRegOpts() {
229         return passFailStudentRegOpts;
230     }
231 
232     public void setPassFailStudentRegOpts(boolean passFailStudentRegOpts) {
233         this.passFailStudentRegOpts = passFailStudentRegOpts;
234     }
235 }
236