--- /dev/null
+/**
+ * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+
+package com.pentila.entSavoie.cdt.service.impl;
+
+import java.util.List;
+
+import com.liferay.portal.kernel.log.Log;
+import com.liferay.portal.kernel.log.LogFactoryUtil;
+import com.pentila.entSavoie.cdt.model.DailySchedule;
+import com.pentila.entSavoie.cdt.service.base.DailyScheduleLocalServiceBaseImpl;
+import com.pentila.entSavoie.cdt.service.persistence.DailySchedulePK;
+
+/**
+ * The implementation of the daily schedule local service.
+ *
+ * <p>
+ * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.pentila.entSavoie.cdt.service.DailyScheduleLocalService} interface.
+ *
+ * <p>
+ * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
+ * </p>
+ *
+ * @author Cedric Lecarpentier
+ * @see com.pentila.entSavoie.cdt.service.base.DailyScheduleLocalServiceBaseImpl
+ * @see com.pentila.entSavoie.cdt.service.DailyScheduleLocalServiceUtil
+ */
+public class DailyScheduleLocalServiceImpl
+ extends DailyScheduleLocalServiceBaseImpl {
+
+ private static Log logger = LogFactoryUtil.getLog(DailyScheduleLocalServiceImpl.class);
+
+ /**
+ * Delete daily school configuration
+ * @param schoolId
+ */
+ public void deleteSchoolDailySchedule(long schoolId) {
+
+ try {
+ List<DailySchedule> dailyScheduleList = dailySchedulePersistence.findByschoolId(schoolId);
+ if (dailyScheduleList != null) {
+ for (DailySchedule dailySchedule : dailyScheduleList) {
+ dailySchedulePersistence.remove(dailySchedule);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while deleting the daily schedule configuration for schoolId "+schoolId, e);
+ }
+ }
+
+
+ /**
+ * Add school daily configuration for 1 given session Id
+ * @param schoolId
+ * @param sessionId
+ * @param sessionStartHour
+ * @param sessionEndHour
+ */
+ public void addSchoolDailySchedule(long schoolId, int sessionId, String sessionStartHour, String sessionEndHour) {
+
+ try {
+ DailySchedule dailySchedule = dailySchedulePersistence.create(new DailySchedulePK(schoolId, sessionId));
+ dailySchedule.setSessionStartHour(sessionStartHour);
+ dailySchedule.setSessionEndHour(sessionEndHour);
+ dailySchedulePersistence.update(dailySchedule, false);
+ } catch (Exception e) {
+ logger.error("Error while creating the daily schedule configuration for schoolId "+schoolId + "and sessionId "+sessionId, e);
+ }
+ }
+
+
+}
\ No newline at end of file