View Javadoc

1   /**
2    * Copyright 2013 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   */
16  package org.kuali.student.enrollment.class2.courseoffering.dto;
17  
18  import org.kuali.student.enrollment.courseoffering.dto.FormatOfferingInfo;
19  import org.kuali.student.r2.lum.course.dto.FormatInfo;
20  
21  import java.io.Serializable;
22  
23  /**
24   * Wrapper class around {@link FormatOfferingInfo}. This wrapper can represent a format offering
25   * for a regular course as well as the joint courses. This is used in displaying the format
26   * offerings at the create co screen.
27   *
28   * @author Kuali Student Team
29   */
30  public class FormatOfferingWrapper implements Serializable{
31  
32      private FormatOfferingInfo formatOfferingInfo;
33      private JointCourseWrapper jointCreateWrapper;
34      private String courseCode;
35      private FormatInfo formatInfo;
36  
37      private boolean isJointOffering;
38      private boolean selectedToCopy;
39  
40      private String activitesUI;
41      private String gradeRosterUI;
42      private String finalExamUI;
43  
44      private RenderHelper renderHelper;
45  
46      public FormatOfferingWrapper(){
47          formatOfferingInfo = new FormatOfferingInfo();
48          isJointOffering = false;
49          renderHelper = new RenderHelper();
50      }
51  
52      /**
53       *
54       * @param formatInfo format info associated with this wrapper
55       * @param courseCode course code of the associated format
56       * @param jointCreateWrapper joint course wrapper
57       */
58      public FormatOfferingWrapper(FormatInfo formatInfo, String courseCode, JointCourseWrapper jointCreateWrapper){
59          this();
60          this.formatInfo = formatInfo;
61          this.courseCode = courseCode;
62          this.formatOfferingInfo.setFormatId(formatInfo.getId());
63          this.jointCreateWrapper = jointCreateWrapper;
64          if (jointCreateWrapper != null){
65              this.isJointOffering = true;
66          }
67      }
68  
69      /**
70       * Returns the <code>FormatOfferingInfo</code> dto for this wrapper
71       *
72       * @return formatOfferingInfo
73       */
74      public FormatOfferingInfo getFormatOfferingInfo() {
75          return formatOfferingInfo;
76      }
77  
78      /**
79       * Format Offering dto associated with this wrapper
80       *
81       * @param formatOfferingInfo format offering dto
82       */
83      public void setFormatOfferingInfo(FormatOfferingInfo formatOfferingInfo) {
84          this.formatOfferingInfo = formatOfferingInfo;
85      }
86  
87      /**
88       * Returns the course wrapper for a joint course
89       *
90       * @return jointCreateWrapper joint course wrapper
91       */
92      public JointCourseWrapper getJointCreateWrapper() {
93          return jointCreateWrapper;
94      }
95  
96      public void setJointCreateWrapper(JointCourseWrapper jointCreateWrapper) {
97          this.jointCreateWrapper = jointCreateWrapper;
98      }
99  
100     public String getFormatId() {
101         return formatOfferingInfo.getFormatId();
102     }
103 
104     /**
105      * Format id associated with a format offering
106      *
107      * @param formatId
108      */
109     public void setFormatId(String formatId) {
110         this.formatOfferingInfo.setFormatId(formatId);
111     }
112 
113     public String getGradeRosterLevelTypeKey() {
114         return this.formatOfferingInfo.getGradeRosterLevelTypeKey();
115     }
116 
117     /**
118      * Grade roster level for a format offering
119      *
120      * @param gradeRosterLevelTypeKey
121      */
122     public void setGradeRosterLevelTypeKey(String gradeRosterLevelTypeKey) {
123         this.formatOfferingInfo.setGradeRosterLevelTypeKey(gradeRosterLevelTypeKey);
124     }
125 
126     public String getFinalExamLevelTypeKey() {
127         return this.formatOfferingInfo.getFinalExamLevelTypeKey();
128     }
129 
130     /**
131      * Final exam level type for a format offering
132      *
133      * @param finalExamLevelTypeKey
134      */
135     public void setFinalExamLevelTypeKey(String finalExamLevelTypeKey) {
136         this.formatOfferingInfo.setFinalExamLevelTypeKey(finalExamLevelTypeKey);
137     }
138 
139     /**
140      * Returns true if this is for a format offering associated with a joint course
141      *
142      * @return
143      */
144     public boolean isJointOffering() {
145         return isJointOffering;
146     }
147 
148     /**
149      * If this wrapper is for a joint course, this indicates that
150      * @param jointOffering
151      */
152     public void setJointOffering(boolean jointOffering) {
153         isJointOffering = jointOffering;
154     }
155 
156     /**
157      * Used at the ui
158      *
159      * @return
160      */
161     @SuppressWarnings("unused")
162     public String getCourseCode() {
163         return courseCode;
164     }
165 
166     /**
167      * Course code for a format offering
168      *
169      * @param courseCode
170      */
171     public void setCourseCode(String courseCode) {
172         this.courseCode = courseCode;
173     }
174 
175     /**
176      * Reference at the xml.
177      *
178      * @return
179      */
180     @SuppressWarnings("unused")
181     public String getActivitesUI() {
182         return activitesUI;
183     }
184 
185     /**
186      * This displays all the activities type for a format.
187      * Ex: Lecture / Lab
188      *
189      * @param activitesUI
190      */
191     public void setActivitesUI(String activitesUI) {
192         this.activitesUI = activitesUI;
193     }
194 
195     /**
196      *
197      * @see #setSelectedToCopy(boolean)
198      * @return
199      */
200     public boolean isSelectedToCopy() {
201         return selectedToCopy;
202     }
203 
204     /**
205      * If user selects a format offering to copy, this flag will be set.
206      * @param selectedToCopy whether it's selected or not to copy
207      */
208     @SuppressWarnings("unused")
209     public void setSelectedToCopy(boolean selectedToCopy) {
210         this.selectedToCopy = selectedToCopy;
211     }
212 
213     /**
214      * @see #setFormatInfo(org.kuali.student.r2.lum.course.dto.FormatInfo)
215      * @return
216      */
217     public FormatInfo getFormatInfo() {
218         return formatInfo;
219     }
220 
221     /**
222      * Format dto associated with a format offering.
223      *
224      * @param formatInfo
225      */
226     public void setFormatInfo(FormatInfo formatInfo) {
227         this.formatInfo = formatInfo;
228     }
229 
230     /**
231      *
232      * @see #setGradeRosterUI(String)
233      * @return
234      */
235     @SuppressWarnings("unused")
236     public String getGradeRosterUI() {
237         return gradeRosterUI;
238     }
239 
240     /**
241      * Grade Roster text to display at the ui. This is a activity type name.
242      *
243      * This is set at {@link org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingCreateMaintainableImpl::loadCourseJointInfos()}
244      *
245      * @param gradeRosterUI
246      */
247     public void setGradeRosterUI(String gradeRosterUI) {
248         this.gradeRosterUI = gradeRosterUI;
249     }
250 
251     /**
252      * @see #setFinalExamUI(String)
253      * @return
254      */
255     @SuppressWarnings("unused")
256     public String getFinalExamUI() {
257         return finalExamUI;
258     }
259 
260     /**
261      * Final Exam driver text to display at the ui. This is set at
262      * {@link org.kuali.student.enrollment.class2.courseoffering.service.impl.CourseOfferingCreateMaintainableImpl::loadCourseJointInfos()}
263      *
264      * @param finalExamUI
265      */
266     public void setFinalExamUI(String finalExamUI) {
267         this.finalExamUI = finalExamUI;
268     }
269 
270     public RenderHelper getRenderHelper() {
271         return renderHelper;
272     }
273 
274     public void setRenderHelper(RenderHelper renderHelper) {
275         this.renderHelper = renderHelper;
276     }
277 
278 
279     /**
280      * This is a helper model to render formats at the ui. Only the UI rendering related properties
281      * should go here.
282      */
283 
284     public class RenderHelper implements Serializable{
285 
286         private boolean isNewRow;
287 
288         RenderHelper(){
289         }
290 
291         public boolean isNewRow() {
292             return isNewRow;
293         }
294 
295         public void setNewRow(boolean newRow) {
296             isNewRow = newRow;
297         }
298 
299 
300     }
301 
302 
303 }