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 9/18/12
16   */
17  package org.kuali.student.enrollment.class2.scheduleofclasses.dto;
18  
19  import org.apache.commons.lang.StringUtils;
20  import org.kuali.student.enrollment.courseoffering.dto.ActivityOfferingDisplayInfo;
21  
22  /**
23   * Wraps {@link ActivityOfferingDisplayInfo} and provides storage for text descriptions for related objects (primarily
24   * scheduling info).
25   */
26  public class ActivityOfferingDisplayWrapper {
27  
28      private ActivityOfferingDisplayInfo aoDisplayInfo;
29      private String information;
30      private String startTimeDisplay;
31      private String endTimeDisplay;
32      private String daysDisplayName;
33      private String buildingName;
34      private String buildingCode;
35      private String roomName;
36      private String tbaDisplayName;
37      private String instructorDisplayNames;
38      private String colocatedAoInfo = "";
39      private String subTermName;
40      private String termStartEndDate;
41  
42      public static final String BR = "<br/>";
43  
44      public ActivityOfferingDisplayWrapper(){
45          aoDisplayInfo = new ActivityOfferingDisplayInfo();
46      }
47  
48      public ActivityOfferingDisplayInfo getAoDisplayInfo() {
49          return aoDisplayInfo;
50      }
51  
52      public void setAoDisplayInfo(ActivityOfferingDisplayInfo aoDisplayInfo) {
53          this.aoDisplayInfo = aoDisplayInfo;
54      }
55  
56      public String getInformation() {
57          return information;
58      }
59  
60      public void setInformation(String information) {
61          this.information = information;
62      }
63  
64      public String getStartTimeDisplay() {
65          return startTimeDisplay;
66      }
67  
68      public void setStartTimeDisplay(String startTimeDisplay) {
69          this.startTimeDisplay = startTimeDisplay;
70      }
71  
72      public void setStartTimeDisplay(String startTimeDisplay,boolean appendForDisplay) {
73          if (appendForDisplay && this.startTimeDisplay!=null){
74              this.startTimeDisplay = this.startTimeDisplay + BR + StringUtils.defaultString(startTimeDisplay);
75          } else {
76              this.startTimeDisplay = StringUtils.defaultString(startTimeDisplay);
77          }
78      }
79  
80      public String getEndTimeDisplay() {
81          return endTimeDisplay;
82      }
83  
84      public void setEndTimeDisplay(String endTimeDisplay) {
85          this.endTimeDisplay = endTimeDisplay;
86      }
87  
88      public void setEndTimeDisplay(String endTimeDisplay,boolean appendForDisplay) {
89          if (appendForDisplay && this.endTimeDisplay!=null){
90              this.endTimeDisplay = this.endTimeDisplay + BR + StringUtils.defaultString(endTimeDisplay);
91          } else {
92              this.endTimeDisplay = StringUtils.defaultString(endTimeDisplay);
93          }
94      }
95  
96      public String getDaysDisplayName() {
97          return daysDisplayName;
98      }
99  
100     public void setDaysDisplayName(String daysDisplayName) {
101         this.daysDisplayName = daysDisplayName;
102     }
103 
104     public void setDaysDisplayName(String daysDisplayName,boolean appendForDisplay) {
105         if (appendForDisplay && this.daysDisplayName!=null){
106             this.daysDisplayName = this.daysDisplayName + BR + StringUtils.defaultString(daysDisplayName);
107         } else {
108             this.daysDisplayName = StringUtils.defaultString(daysDisplayName);
109         }
110 
111     }
112 
113     public String getBuildingName() {
114         return buildingName;
115     }
116 
117     public void setBuildingName(String buildingName) {
118         this.buildingName = buildingName;
119     }
120 
121     public void setBuildingName(String buildingName,boolean appendForDisplay) {
122         if (appendForDisplay && this.buildingName!=null){
123             this.buildingName = this.buildingName + BR + StringUtils.defaultString(buildingName);
124         } else {
125             this.buildingName = StringUtils.defaultString(buildingName);
126         }
127     }
128 
129     public String getBuildingCode() {
130         return buildingCode;
131     }
132 
133     public void setBuildingCode(String buildingCode) {
134         this.buildingCode = buildingCode;
135     }
136 
137     public void setBuildingCode(String buildingCode, boolean appendForDisplay) {
138         if (appendForDisplay && this.buildingCode!=null){
139             this.buildingCode = this.buildingCode + BR + StringUtils.defaultString(buildingCode);
140         } else {
141             this.buildingCode = StringUtils.defaultString(buildingCode);
142         }
143     }
144 
145     public String getRoomName() {
146         return roomName;
147     }
148 
149     public void setRoomName(String roomName) {
150         this.roomName = roomName;
151     }
152 
153     public void setRoomName(String roomName,boolean appendForDisplay) {
154         if (appendForDisplay && this.roomName!=null){
155             this.roomName = this.roomName + BR + StringUtils.defaultString(roomName);
156         } else {
157             this.roomName = StringUtils.defaultString(roomName);
158         }
159     }
160 
161     public String getInstructorDisplayNames() {
162         return instructorDisplayNames;
163     }
164 
165     public void setInstructorDisplayNames(String instructorDisplayNames) {
166         this.instructorDisplayNames = instructorDisplayNames;
167     }
168 
169     public void setInstructorDisplayNames(String instructorDisplayNames,boolean appendForDisplay) {
170         if (appendForDisplay && this.instructorDisplayNames!=null){
171             this.instructorDisplayNames = this.instructorDisplayNames + BR + StringUtils.defaultString(instructorDisplayNames);
172         } else {
173             this.instructorDisplayNames = StringUtils.defaultString(instructorDisplayNames);
174         }
175     }
176 
177     public String getTbaDisplayName() {
178         return tbaDisplayName;
179     }
180 
181     public void setTbaDisplayName(boolean tba) {
182         tbaDisplayName = StringUtils.EMPTY;
183         if (tba){
184             tbaDisplayName =  "TBA";
185         }
186     }
187 
188     public String getColocatedAoInfo() {
189         return colocatedAoInfo;
190     }
191 
192     public void setColocatedAoInfo(String colocatedAoInfo) {
193         this.colocatedAoInfo = colocatedAoInfo;
194     }
195 
196     /**
197      * This method return a colocated AO code for current course. This will
198      * be displayed as the tooltip (if colocated AO exists) at manage and delete AO screen.
199      *
200      * @return
201      */
202     @SuppressWarnings("unused")
203     public String getColocatedAoInfoUI() {
204         return StringUtils.removeEnd("This activity is colocated with:" + BR + colocatedAoInfo, BR);
205     }
206 
207     public String getSubTermName() {
208         return subTermName;
209     }
210 
211     public void setSubTermName(String subTermName) {
212         this.subTermName = subTermName;
213     }
214 
215     public String getTermStartEndDate() {
216         return termStartEndDate;
217     }
218 
219     public void setTermStartEndDate(String termStartEndDate) {
220         this.termStartEndDate = termStartEndDate;
221     }
222 
223 }