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  
40      public static final String BR = "<br/>";
41  
42      public ActivityOfferingDisplayWrapper(){
43          aoDisplayInfo = new ActivityOfferingDisplayInfo();
44      }
45  
46      public ActivityOfferingDisplayInfo getAoDisplayInfo() {
47          return aoDisplayInfo;
48      }
49  
50      public void setAoDisplayInfo(ActivityOfferingDisplayInfo aoDisplayInfo) {
51          this.aoDisplayInfo = aoDisplayInfo;
52      }
53  
54      public String getInformation() {
55          return information;
56      }
57  
58      public void setInformation(String information) {
59          this.information = information;
60      }
61  
62      public String getStartTimeDisplay() {
63          return startTimeDisplay;
64      }
65  
66      public void setStartTimeDisplay(String startTimeDisplay) {
67          this.startTimeDisplay = startTimeDisplay;
68      }
69  
70      public void setStartTimeDisplay(String startTimeDisplay,boolean appendForDisplay) {
71          if (appendForDisplay && this.startTimeDisplay!=null){
72              this.startTimeDisplay = this.startTimeDisplay + BR + StringUtils.defaultString(startTimeDisplay);
73          } else {
74              this.startTimeDisplay = StringUtils.defaultString(startTimeDisplay);
75          }
76      }
77  
78      public String getEndTimeDisplay() {
79          return endTimeDisplay;
80      }
81  
82      public void setEndTimeDisplay(String endTimeDisplay) {
83          this.endTimeDisplay = endTimeDisplay;
84      }
85  
86      public void setEndTimeDisplay(String endTimeDisplay,boolean appendForDisplay) {
87          if (appendForDisplay && this.endTimeDisplay!=null){
88              this.endTimeDisplay = this.endTimeDisplay + BR + StringUtils.defaultString(endTimeDisplay);
89          } else {
90              this.endTimeDisplay = StringUtils.defaultString(endTimeDisplay);
91          }
92      }
93  
94      public String getDaysDisplayName() {
95          return daysDisplayName;
96      }
97  
98      public void setDaysDisplayName(String daysDisplayName) {
99          this.daysDisplayName = daysDisplayName;
100     }
101 
102     public void setDaysDisplayName(String daysDisplayName,boolean appendForDisplay) {
103         if (appendForDisplay && this.daysDisplayName!=null){
104             this.daysDisplayName = this.daysDisplayName + BR + StringUtils.defaultString(daysDisplayName);
105         } else {
106             this.daysDisplayName = StringUtils.defaultString(daysDisplayName);
107         }
108 
109     }
110 
111     public String getBuildingName() {
112         return buildingName;
113     }
114 
115     public void setBuildingName(String buildingName) {
116         this.buildingName = buildingName;
117     }
118 
119     public void setBuildingName(String buildingName,boolean appendForDisplay) {
120         if (appendForDisplay && this.buildingName!=null){
121             this.buildingName = this.buildingName + BR + StringUtils.defaultString(buildingName);
122         } else {
123             this.buildingName = StringUtils.defaultString(buildingName);
124         }
125     }
126 
127     public String getBuildingCode() {
128         return buildingCode;
129     }
130 
131     public void setBuildingCode(String buildingCode) {
132         this.buildingCode = buildingCode;
133     }
134 
135     public void setBuildingCode(String buildingCode, boolean appendForDisplay) {
136         if (appendForDisplay && this.buildingCode!=null){
137             this.buildingCode = this.buildingCode + BR + StringUtils.defaultString(buildingCode);
138         } else {
139             this.buildingCode = StringUtils.defaultString(buildingCode);
140         }
141     }
142 
143     public String getRoomName() {
144         return roomName;
145     }
146 
147     public void setRoomName(String roomName) {
148         this.roomName = roomName;
149     }
150 
151     public void setRoomName(String roomName,boolean appendForDisplay) {
152         if (appendForDisplay && this.roomName!=null){
153             this.roomName = this.roomName + BR + StringUtils.defaultString(roomName);
154         } else {
155             this.roomName = StringUtils.defaultString(roomName);
156         }
157     }
158 
159     public String getInstructorDisplayNames() {
160         return instructorDisplayNames;
161     }
162 
163     public void setInstructorDisplayNames(String instructorDisplayNames) {
164         this.instructorDisplayNames = instructorDisplayNames;
165     }
166 
167     public void setInstructorDisplayNames(String instructorDisplayNames,boolean appendForDisplay) {
168         if (appendForDisplay && this.instructorDisplayNames!=null){
169             this.instructorDisplayNames = this.instructorDisplayNames + BR + StringUtils.defaultString(instructorDisplayNames);
170         } else {
171             this.instructorDisplayNames = StringUtils.defaultString(instructorDisplayNames);
172         }
173     }
174 
175     public String getTbaDisplayName() {
176         return tbaDisplayName;
177     }
178 
179     public void setTbaDisplayName(boolean tba) {
180         tbaDisplayName = StringUtils.EMPTY;
181         if (tba){
182             tbaDisplayName =  "TBA";
183         }
184     }
185 
186     public String getColocatedAoInfo() {
187         return colocatedAoInfo;
188     }
189 
190     public void setColocatedAoInfo(String colocatedAoInfo) {
191         this.colocatedAoInfo = colocatedAoInfo;
192     }
193 
194     /**
195      * This method return a colocated AO code for current course. This will
196      * be displayed as the tooltip (if colocated AO exists) at manage and delete AO screen.
197      *
198      * @return
199      */
200     @SuppressWarnings("unused")
201     public String getColocatedAoInfoUI() {
202         return StringUtils.removeEnd("This activity is colocated with:" + BR + colocatedAoInfo, BR);
203     }
204 }