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.lum.course.dto.CourseInfo;
24  import org.kuali.student.r2.common.util.constants.LuiServiceConstants;
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 CreditOptionInfo creditOption;
51      private boolean creditOptionFixed;
52      private boolean isChecked;
53  
54      private String gradingOption;
55  
56      public CourseOfferingEditWrapper(){
57          coInfo = new CourseOfferingInfo();
58          formatOfferingList = new ArrayList<FormatOfferingInfo>();
59          studentRegOptions = new ArrayList<String>();
60      }
61  
62      public CourseOfferingEditWrapper(CourseOfferingInfo info){
63          super();
64          coInfo = info;
65      }
66  
67      public CourseOfferingInfo getCoInfo() {
68          return coInfo;
69      }
70  
71      public void setCoInfo(CourseOfferingInfo coInfo) {
72          this.coInfo = coInfo;
73      }
74  
75      public List<FormatOfferingInfo> getFormatOfferingList() {
76          return formatOfferingList;
77      }
78  
79      public void setFormatOfferingList(List<FormatOfferingInfo> formatOfferingList) {
80          if (formatOfferingList == null) {
81              formatOfferingList = new ArrayList<FormatOfferingInfo>();
82          }
83          this.formatOfferingList = formatOfferingList;
84      }
85  
86      public List<String> getStudentRegOptions() {
87          return studentRegOptions;
88      }
89  
90      public void setStudentRegOptions(List<String> studentRegOptions) {
91          if (studentRegOptions == null) {
92              studentRegOptions = new ArrayList<String>();
93          }
94          this.studentRegOptions = studentRegOptions;
95      }
96  
97      public List<String> getCrsGradingOptions() {
98          if (crsGradingOptions == null) {
99              crsGradingOptions = new ArrayList<String>();
100         }
101         return crsGradingOptions;
102     }
103 
104     public void setCrsGradingOptions(List<String> crsGradingOptions) {
105         this.crsGradingOptions = crsGradingOptions;
106     }
107 
108     public List<OrganizationInfoWrapper> getOrganizationNames() {
109         return organizationNames;
110     }
111 
112     public void setOrganizationNames(List<OrganizationInfoWrapper> organizationNames) {
113         this.organizationNames = organizationNames;
114     }
115 
116 
117     public String getSelectedGradingOptionName() {
118         return selectedGradingOptionName;
119     }
120 
121     public void setSelectedGradingOptionName(String selectedGradingOptionName) {
122         this.selectedGradingOptionName = selectedGradingOptionName;
123     }
124 
125     public String getSelectedStudentRegOpts() {
126         return selectedStudentRegOpts;
127     }
128 
129     public void setSelectedStudentRegOpts(String selectedStudentRegOpts) {
130         this.selectedStudentRegOpts = selectedStudentRegOpts;
131     }
132 
133     public CourseInfo getCourse() {
134         return course;
135     }
136 
137     public void setCourse(CourseInfo course) {
138         this.course = course;
139     }
140 
141     public CreditOptionInfo getCreditOption() {
142         return creditOption;
143     }
144 
145     public void setCreditOption(CreditOptionInfo creditOption) {
146         this.creditOption = creditOption;
147     }
148 
149     public boolean getCreditOptionFixed() {
150         return creditOptionFixed;
151     }
152 
153     public void setCreditOptionFixed(boolean creditOptionFixed) {
154         this.creditOptionFixed = creditOptionFixed;
155     }
156 
157     public String getTermStartEnd() {
158         return termStartEnd;
159     }
160 
161     public void setTermStartEnd(String termStartEnd) {
162         this.termStartEnd = termStartEnd;
163     }
164 
165     public List<OfferingInstructorWrapper> getInstructors() {
166         return instructors;
167     }
168 
169     public void setInstructors(List<OfferingInstructorWrapper> instructors) {
170         this.instructors = instructors;
171     }
172 
173     public boolean getIsChecked() {
174         return isChecked;
175     }
176 
177     public void setIsChecked(boolean checked) {
178         this.isChecked = checked;
179     }
180 
181     public String getGradingOption() {
182         return gradingOption;
183     }
184 
185     public void setGradingOption(String gradingOption) {
186         this.gradingOption = gradingOption;
187     }
188 
189     public String getStateName() {
190         return stateName;
191     }
192 
193     public void setStateName(String stateName) {
194         this.stateName = stateName;
195     }
196 
197     public boolean isLegalToDelete() {
198 
199         if(StringUtils.equals(coInfo.getStateKey(), LuiServiceConstants.LUI_DRAFT_STATE_KEY) ||
200                 StringUtils.equals(coInfo.getStateKey(), LuiServiceConstants.LUI_CO_STATE_DRAFT_KEY) ||
201                 StringUtils.equals(coInfo.getStateKey(), LuiServiceConstants.LUI_CO_STATE_PLANNED_KEY)) {
202             return true;
203         }
204 
205         return false;
206     }
207 
208 }
209