001 /**
002 * Copyright 2012 The Kuali Foundation Licensed under the
003 * Educational Community License, Version 2.0 (the "License"); you may
004 * not use this file except in compliance with the License. You may
005 * obtain a copy of the License at
006 *
007 * http://www.osedu.org/licenses/ECL-2.0
008 *
009 * Unless required by applicable law or agreed to in writing,
010 * software distributed under the License is distributed on an "AS IS"
011 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
012 * or implied. See the License for the specific language governing
013 * permissions and limitations under the License.
014 *
015 * Created by vgadiyak on 9/10/12
016 */
017 package org.kuali.student.enrollment.class2.scheduleofclasses.service.impl;
018
019 import org.apache.commons.lang.StringUtils;
020 import org.kuali.rice.core.api.criteria.PredicateFactory;
021 import org.kuali.rice.core.api.criteria.QueryByCriteria;
022 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
023 import org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl;
024 import org.kuali.rice.krad.util.GlobalVariables;
025 import org.kuali.student.enrollment.class2.courseoffering.util.CourseOfferingResourceLoader;
026 import org.kuali.student.enrollment.class2.scheduleofclasses.dto.ActivityOfferingDisplayWrapper;
027 import org.kuali.student.enrollment.class2.scheduleofclasses.dto.CourseOfferingDisplayWrapper;
028 import org.kuali.student.enrollment.class2.scheduleofclasses.form.ScheduleOfClassesSearchForm;
029 import org.kuali.student.enrollment.class2.scheduleofclasses.service.ScheduleOfClassesViewHelperService;
030 import org.kuali.student.enrollment.class2.scheduleofclasses.util.ScheduleOfClassesConstants;
031 import org.kuali.student.enrollment.courseoffering.dto.ActivityOfferingDisplayInfo;
032 import org.kuali.student.enrollment.courseoffering.dto.CourseOfferingDisplayInfo;
033 import org.kuali.student.enrollment.courseoffering.service.CourseOfferingService;
034 import org.kuali.student.enrollment.lpr.service.LprService;
035 import org.kuali.student.r2.common.constants.CommonServiceConstants;
036 import org.kuali.student.r2.common.dto.ContextInfo;
037 import org.kuali.student.r2.common.dto.KeyNameInfo;
038 import org.kuali.student.r2.common.util.ContextUtils;
039 import org.kuali.student.r2.common.util.constants.CourseOfferingServiceConstants;
040 import org.kuali.student.r2.common.util.constants.LprServiceConstants;
041 import org.kuali.student.r2.common.util.constants.LuiServiceConstants;
042 import org.kuali.student.r2.core.organization.service.OrganizationService;
043 import org.kuali.student.r2.core.room.service.RoomService;
044 import org.kuali.student.r2.core.scheduling.constants.SchedulingServiceConstants;
045 import org.kuali.student.r2.core.scheduling.infc.ScheduleComponentDisplay;
046 import org.kuali.student.r2.core.scheduling.service.SchedulingService;
047 import org.kuali.student.r2.lum.util.constants.LrcServiceConstants;
048
049 import javax.xml.namespace.QName;
050 import java.text.SimpleDateFormat;
051 import java.util.ArrayList;
052 import java.util.Calendar;
053 import java.util.GregorianCalendar;
054 import java.util.List;
055
056 /**
057 * This class //TODO ...
058 *
059 * @author Kuali Student Team
060 */
061 public class ScheduleOfClassesViewHelperServiceImpl extends ViewHelperServiceImpl implements ScheduleOfClassesViewHelperService {
062
063 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ScheduleOfClassesViewHelperServiceImpl.class);
064
065 private CourseOfferingService coService;
066 private LprService lprService;
067 private SchedulingService schedulingService;
068 private RoomService roomService;
069 private OrganizationService organizationService;
070
071 public void loadCourseOfferingsByTermAndCourseCode (String termId, String courseCode, ScheduleOfClassesSearchForm form) throws Exception{
072
073 ContextInfo contextInfo = ContextUtils.createDefaultContextInfo();
074
075 // Building a query
076 QueryByCriteria.Builder qbcBuilder = QueryByCriteria.Builder.create();
077 qbcBuilder.setPredicates(PredicateFactory.and(
078 PredicateFactory.like("courseOfferingCode", courseCode + "%"),
079 PredicateFactory.equalIgnoreCase("atpId", termId)));
080 QueryByCriteria criteria = qbcBuilder.build();
081 List<String> courseOfferingIds = getCourseOfferingService().searchForCourseOfferingIds(criteria, contextInfo);
082
083 if(courseOfferingIds.size() > 0){
084 form.getCoDisplayWrapperList().clear();
085 List<CourseOfferingDisplayInfo> coDisplayInfoList = getCourseOfferingService().getCourseOfferingDisplaysByIds(courseOfferingIds, contextInfo);
086 List<CourseOfferingDisplayWrapper> coDisplayWrapperList = new ArrayList<CourseOfferingDisplayWrapper>();
087 for (CourseOfferingDisplayInfo coDisplayInfo : coDisplayInfoList) {
088 CourseOfferingDisplayWrapper coDisplayWrapper = new CourseOfferingDisplayWrapper();
089 coDisplayWrapper.setCoDisplayInfo(coDisplayInfo);
090
091 // Adding Information (icons)
092 String information = "";
093 if (coDisplayInfo.getIsHonorsOffering() != null && coDisplayInfo.getIsHonorsOffering()) {
094 information = "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HONORS_COURSE_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_HONORS_COURSE + "\"> ";
095 }
096 if (coDisplayInfo.getGradingOption() != null && coDisplayInfo.getGradingOption().getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_SATISFACTORY)) {
097 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_SATISFACTORY_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_SATISFACTORY + "\"> ";
098 } else if (coDisplayInfo.getGradingOption() != null && coDisplayInfo.getGradingOption().getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PERCENTAGE)) {
099 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_PERCENT_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_PERCENT + "\"> ";
100 }
101 if (!coDisplayInfo.getStudentRegistrationGradingOptions().isEmpty()) {
102 for (KeyNameInfo stuRegOption : coDisplayInfo.getStudentRegistrationGradingOptions()) {
103 if (stuRegOption.getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
104 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_PASSFAIL_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_PASSFAIL + "\">";
105 } else if (stuRegOption.getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
106 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_AUDIT_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_AUDIT + "\">";
107 }
108 }
109 }
110 coDisplayWrapper.setInformation(information);
111
112 coDisplayWrapperList.add(coDisplayWrapper);
113 }
114 form.setCoDisplayWrapperList(coDisplayWrapperList);
115 } else {
116 LOG.error("Error: Can't find any Course Offering for a Course Code: " + courseCode + " in term: " + termId);
117 GlobalVariables.getMessageMap().putError("Term & courseCode", ScheduleOfClassesConstants.SOC_MSG_ERROR_NO_COURSE_OFFERING_IS_FOUND, "courseCode", courseCode, termId);
118 form.getCoDisplayWrapperList().clear();
119 }
120 }
121
122 @Override
123 public void loadCourseOfferingsByTermAndInstructor(String termId, String instructorId, ScheduleOfClassesSearchForm form) throws Exception {
124
125 ContextInfo contextInfo = ContextUtils.createDefaultContextInfo();
126
127 //this is a cross service search between LPR and LUI, so it is inefficient (no join)
128 //First get all the luiIds that the instructor is teaching
129 //TODO TENTATIVE_STATE_KEY should be active in the code below, but it is hardcoded as such
130 List<String> luiIds = getLprService().getLuiIdsByPersonAndTypeAndState(instructorId, LprServiceConstants.INSTRUCTOR_MAIN_TYPE_KEY, LprServiceConstants.TENTATIVE_STATE_KEY, contextInfo);
131
132 List<String> courseOfferingIds = null;
133
134 if(luiIds != null && !luiIds.isEmpty()){
135 //Now find all the COs with Aos that are attached to that instructor.
136
137 // Build a query
138 QueryByCriteria.Builder qbcBuilder = QueryByCriteria.Builder.create();
139 qbcBuilder.setPredicates(PredicateFactory.and(
140 PredicateFactory.in("aoid", luiIds.toArray()),
141 PredicateFactory.equalIgnoreCase("atpId", termId)));
142 QueryByCriteria criteria = qbcBuilder.build();
143 courseOfferingIds = getCourseOfferingService().searchForCourseOfferingIds(criteria, contextInfo);
144
145 if(courseOfferingIds.size() > 0){
146 form.getCoDisplayWrapperList().clear();
147 List<CourseOfferingDisplayInfo> coDisplayInfoList = getCourseOfferingService().getCourseOfferingDisplaysByIds(courseOfferingIds, contextInfo);
148 List<CourseOfferingDisplayWrapper> coDisplayWrapperList = new ArrayList<CourseOfferingDisplayWrapper>();
149 for (CourseOfferingDisplayInfo coDisplayInfo : coDisplayInfoList) {
150 CourseOfferingDisplayWrapper coDisplayWrapper = new CourseOfferingDisplayWrapper();
151 coDisplayWrapper.setCoDisplayInfo(coDisplayInfo);
152
153 // Adding Information (icons)
154 String information = "";
155 if (coDisplayInfo.getIsHonorsOffering() != null && coDisplayInfo.getIsHonorsOffering()) {
156 information = "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HONORS_COURSE_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_HONORS_COURSE + "\"> ";
157 }
158 if (coDisplayInfo.getGradingOption() != null && coDisplayInfo.getGradingOption().getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_SATISFACTORY)) {
159 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_SATISFACTORY_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_SATISFACTORY + "\"> ";
160 } else if (coDisplayInfo.getGradingOption() != null && coDisplayInfo.getGradingOption().getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PERCENTAGE)) {
161 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_PERCENT_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_PERCENT + "\"> ";
162 }
163 if (!coDisplayInfo.getStudentRegistrationGradingOptions().isEmpty()) {
164 for (KeyNameInfo stuRegOption : coDisplayInfo.getStudentRegistrationGradingOptions()) {
165 if (stuRegOption.getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
166 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_PASSFAIL_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_PASSFAIL + "\">";
167 } else if (stuRegOption.getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
168 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_AUDIT_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_AUDIT + "\">";
169 }
170 }
171 }
172 coDisplayWrapper.setInformation(information);
173
174 coDisplayWrapperList.add(coDisplayWrapper);
175 }
176 form.setCoDisplayWrapperList(coDisplayWrapperList);
177 }
178 }
179
180 //If nothing was found then error
181 if(courseOfferingIds == null || courseOfferingIds.isEmpty()) {
182 LOG.error("Error: Can't find any Course Offering for selected Instructor in term: " + termId);
183 GlobalVariables.getMessageMap().putError("Term & Instructor", ScheduleOfClassesConstants.SOC_MSG_ERROR_NO_COURSE_OFFERING_IS_FOUND, "instructor", instructorId, termId);
184 form.getCoDisplayWrapperList().clear();
185 }
186 }
187
188 public void loadCourseOfferingsByTermAndDepartment(String termId, String organizationId, String organizationName, ScheduleOfClassesSearchForm form) throws Exception{
189 ContextInfo contextInfo = ContextUtils.createDefaultContextInfo();
190
191 QueryByCriteria.Builder qbcBuilder = QueryByCriteria.Builder.create();
192
193 // Search ID based on organizationName
194 if (organizationId == null || organizationId.isEmpty()) {
195 QueryByCriteria.Builder qBuilder = QueryByCriteria.Builder.create();
196 qBuilder.setPredicates(PredicateFactory.equal("longName", organizationName));
197 QueryByCriteria query = qBuilder.build();
198 OrganizationService organizationService = getOrganizationService();
199 List<String> orgIDs = organizationService.searchForOrgIds(query, ContextUtils.createDefaultContextInfo());
200 if (orgIDs.isEmpty()) {
201 LOG.error("Error: Can't find any Department for selected Department in term: " + termId);
202 GlobalVariables.getMessageMap().putError("Term & Department", ScheduleOfClassesConstants.SOC_MSG_ERROR_NO_COURSE_OFFERING_IS_FOUND, "department", organizationName, termId);
203 form.getCoDisplayWrapperList().clear();
204 } else if (orgIDs.size() > 1) {
205 LOG.error("Error: There is more than one departments with the same long name in term: " + termId);
206 GlobalVariables.getMessageMap().putError("Term & Department", ScheduleOfClassesConstants.SOC_MSG_ERROR_MULTIPLE_DEPARTMENT_IS_FOUND, organizationName);
207 organizationId = null;
208 form.getCoDisplayWrapperList().clear();
209 } else {
210 organizationId = orgIDs.get(0);
211 }
212 }
213
214 if (organizationId != null) {
215 qbcBuilder.setPredicates(PredicateFactory.and(
216 PredicateFactory.equal("luiContentOwner", organizationId),
217 PredicateFactory.equal("atpId", termId),
218 PredicateFactory.equal("luiType", LuiServiceConstants.COURSE_OFFERING_TYPE_KEY)));
219 QueryByCriteria criteria = qbcBuilder.build();
220 List<String> courseOfferingIds = getCourseOfferingService().searchForCourseOfferingIds(criteria, contextInfo);
221
222 if(courseOfferingIds.size() > 0){
223 form.getCoDisplayWrapperList().clear();
224 List<CourseOfferingDisplayInfo> coDisplayInfoList = getCourseOfferingService().getCourseOfferingDisplaysByIds(courseOfferingIds, contextInfo);
225 List<CourseOfferingDisplayWrapper> coDisplayWrapperList = new ArrayList<CourseOfferingDisplayWrapper>();
226 for (CourseOfferingDisplayInfo coDisplayInfo : coDisplayInfoList) {
227 CourseOfferingDisplayWrapper coDisplayWrapper = new CourseOfferingDisplayWrapper();
228 coDisplayWrapper.setCoDisplayInfo(coDisplayInfo);
229
230 // Adding Information (icons)
231 String information = "";
232 if (coDisplayInfo.getIsHonorsOffering() != null && coDisplayInfo.getIsHonorsOffering()) {
233 information = "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HONORS_COURSE_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_HONORS_COURSE + "\"> ";
234 }
235 if (coDisplayInfo.getGradingOption() != null && coDisplayInfo.getGradingOption().getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_SATISFACTORY)) {
236 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_SATISFACTORY_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_SATISFACTORY + "\"> ";
237 } else if (coDisplayInfo.getGradingOption() != null && coDisplayInfo.getGradingOption().getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PERCENTAGE)) {
238 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_GRADING_PERCENT_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_GRADING_PERCENT + "\"> ";
239 }
240 if (!coDisplayInfo.getStudentRegistrationGradingOptions().isEmpty()) {
241 for (KeyNameInfo stuRegOption : coDisplayInfo.getStudentRegistrationGradingOptions()) {
242 if (stuRegOption.getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_PASSFAIL)) {
243 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_PASSFAIL_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_PASSFAIL + "\">";
244 } else if (stuRegOption.getKey().equals(LrcServiceConstants.RESULT_GROUP_KEY_GRADE_AUDIT)) {
245 information = information + "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_STUREG_AUDIT_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_STUREG_AUDIT + "\">";
246 }
247 }
248 }
249 coDisplayWrapper.setInformation(information);
250
251 coDisplayWrapperList.add(coDisplayWrapper);
252 }
253 form.setCoDisplayWrapperList(coDisplayWrapperList);
254 }
255
256 //If nothing was found then error
257 if(courseOfferingIds == null || courseOfferingIds.isEmpty()) {
258 LOG.error("Error: Can't find any Course Offering for selected Department in term: " + termId);
259 GlobalVariables.getMessageMap().putError("Term & Department", ScheduleOfClassesConstants.SOC_MSG_ERROR_NO_COURSE_OFFERING_IS_FOUND, "department", organizationName, termId);
260 form.getCoDisplayWrapperList().clear();
261 }
262 }
263 }
264
265 public void loadActivityOfferingsByCourseOfferingId(String courseOfferingId, ScheduleOfClassesSearchForm form) throws Exception {
266
267 ContextInfo contextInfo = ContextUtils.createDefaultContextInfo();
268 Calendar calendar = new GregorianCalendar();
269
270 List<ActivityOfferingDisplayWrapper> aoDisplayWrapperList = new ArrayList<ActivityOfferingDisplayWrapper>();
271 List<ActivityOfferingDisplayInfo> aoDisplayInfoList = getCourseOfferingService().getActivityOfferingDisplaysForCourseOffering(courseOfferingId, contextInfo);
272
273 for (ActivityOfferingDisplayInfo aoDisplayInfo : aoDisplayInfoList) {
274 ActivityOfferingDisplayWrapper aoDisplayWrapper = new ActivityOfferingDisplayWrapper();
275 aoDisplayWrapper.setAoDisplayInfo(aoDisplayInfo);
276
277 // Adding Information (icons)
278 String information = "";
279 if (aoDisplayInfo.getIsHonorsOffering() != null && aoDisplayInfo.getIsHonorsOffering()) {
280 information = "<img src=" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HONORS_COURSE_IMG + " title=\"" + ScheduleOfClassesConstants.SOC_RESULT_PAGE_HELP_HONORS_ACTIVITY + "\"> ";
281 }
282 aoDisplayWrapper.setInformation(information);
283
284 if(!aoDisplayInfo.getScheduleDisplay().getScheduleComponentDisplays().isEmpty()){
285 //TODO handle TBA state
286 ScheduleComponentDisplay scheduleComponentDisplay = aoDisplayInfo.getScheduleDisplay().getScheduleComponentDisplays().get(0);
287 if(scheduleComponentDisplay.getBuilding() != null){
288 aoDisplayWrapper.setBuildingName(scheduleComponentDisplay.getBuilding().getBuildingCode());
289 }
290 if(scheduleComponentDisplay.getRoom() != null){
291 aoDisplayWrapper.setRoomName(scheduleComponentDisplay.getRoom().getRoomCode());
292 }
293 if(!scheduleComponentDisplay.getTimeSlots().isEmpty()){
294 if(scheduleComponentDisplay.getTimeSlots().get(0).getStartTime() != null){
295 aoDisplayWrapper.setStartTimeDisplay(millisToTime(scheduleComponentDisplay.getTimeSlots().get(0).getStartTime().getMilliSeconds()));
296 }
297 if(scheduleComponentDisplay.getTimeSlots().get(0).getEndTime() != null){
298 aoDisplayWrapper.setEndTimeDisplay(millisToTime(scheduleComponentDisplay.getTimeSlots().get(0).getEndTime().getMilliSeconds()));
299 }
300 aoDisplayWrapper.setDaysDisplayName(getDays(scheduleComponentDisplay.getTimeSlots().get(0).getWeekdays()));
301 }
302 }
303
304 aoDisplayWrapperList.add(aoDisplayWrapper);
305 }
306
307 form.setAoDisplayWrapperList(aoDisplayWrapperList);
308 }
309
310 private String millisToTime(long milliseconds){
311 final Calendar cal = Calendar.getInstance();
312 cal.setTimeInMillis(milliseconds);
313 return new SimpleDateFormat("hh:mm a").format(cal.getTime());
314
315 }
316
317
318 private CourseOfferingService getCourseOfferingService() {
319 if (coService == null) {
320 coService = (CourseOfferingService) GlobalResourceLoader.getService(new QName(CourseOfferingServiceConstants.NAMESPACE,
321 CourseOfferingServiceConstants.SERVICE_NAME_LOCAL_PART));
322 }
323 return coService;
324 }
325
326 private LprService getLprService() {
327 if (lprService == null) {
328 lprService = (LprService) GlobalResourceLoader.getService(new QName(LprServiceConstants.NAMESPACE,
329 LprServiceConstants.SERVICE_NAME_LOCAL_PART));
330 }
331 return lprService;
332 }
333
334 public SchedulingService getSchedulingService() {
335 if(schedulingService == null) {
336 schedulingService = CourseOfferingResourceLoader.loadSchedulingService();
337 }
338 return schedulingService;
339 }
340
341 public RoomService getRoomService(){
342 if (roomService == null){
343 roomService = CourseOfferingResourceLoader.loadRoomService();
344 }
345 return roomService;
346 }
347
348 private OrganizationService getOrganizationService(){
349 if(organizationService == null) {
350 organizationService = (OrganizationService) GlobalResourceLoader.getService(new QName(CommonServiceConstants.REF_OBJECT_URI_GLOBAL_PREFIX + "organization", "OrganizationService"));
351 }
352 return organizationService;
353 }
354
355 private String convertIntoDaysDisplay(int day) {
356 String dayOfWeek;
357 switch (day) {
358 case 1:
359 dayOfWeek = SchedulingServiceConstants.SUNDAY_TIMESLOT_DISPLAY_DAY_CODE;
360 break;
361 case 2:
362 dayOfWeek = SchedulingServiceConstants.MONDAY_TIMESLOT_DISPLAY_DAY_CODE;
363 break;
364 case 3:
365 dayOfWeek = SchedulingServiceConstants.TUESDAY_TIMESLOT_DISPLAY_DAY_CODE;
366 break;
367 case 4:
368 dayOfWeek = SchedulingServiceConstants.WEDNESDAY_TIMESLOT_DISPLAY_DAY_CODE;
369 break;
370 case 5:
371 dayOfWeek = SchedulingServiceConstants.THURSDAY_TIMESLOT_DISPLAY_DAY_CODE;
372 break;
373 case 6:
374 dayOfWeek = SchedulingServiceConstants.FRIDAY_TIMESLOT_DISPLAY_DAY_CODE;
375 break;
376 case 7:
377 dayOfWeek = SchedulingServiceConstants.SATURDAY_TIMESLOT_DISPLAY_DAY_CODE;
378 break;
379 default:
380 dayOfWeek = StringUtils.EMPTY;
381 }
382 // TODO implement TBA when service stores it.
383 return dayOfWeek;
384 }
385
386 private String getDays(List<Integer> intList) {
387
388 StringBuilder sb = new StringBuilder();
389 if(intList == null){
390 return sb.toString();
391 }
392
393 for(Integer d : intList) {
394 sb.append(convertIntoDaysDisplay(d));
395 }
396
397 return sb.toString();
398 }
399
400 }