--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie 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
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot.absences.saisie.absencejournee
+
+import org.lilie.services.eliot.absences.AppelLigne
+import org.lilie.services.eliot.temps.DateUtil
+import org.lilie.services.eliot.absences.AbsenceJournee
+import org.lilie.services.eliot.absences.Sanction
+import org.lilie.services.eliot.absences.Punition
+
+/**
+ * classe utilitaire pour la gestion des absences journée
+ */
+class AbsenceJourneeUtils {
+
+ /**
+ * Retourne la date et heure de début d'absence
+ * @return une Date
+ */
+ public static Date calculeDateDebutLigne(AppelLigne appelLigne) {
+ return DateUtil.calculeDateHeureForDateEtHeure(
+ appelLigne.absenceJournee.date,
+ appelLigne.heureDebut
+ )
+ }
+
+/**
+ * Retourne la date et heure de fin d'absence
+ * @return une Date
+ */
+ public static Date calculeDateFinLigne(AppelLigne appelLigne) {
+ return DateUtil.calculeDateHeureForDateEtHeure(
+ appelLigne.absenceJournee.date,
+ appelLigne.heureFin
+ )
+ }
+
+ /**
+ * Retourne la date et l'heure de début de journée de l'AbsenceJournee
+ * @return la date et l'heure de début de journée de l'AbsenceJournee
+ */
+ public static Date calculeHeureDebutDeJournee(AbsenceJournee absenceJournee) {
+ Calendar cal = Calendar.getInstance()
+ cal.setTime(absenceJournee.date)
+ DateUtil.setDebutJour(cal)
+ return cal.getTime()
+ }
+
+/**
+ * Indique si l'AbsenceJournee correspond au dernier jour de l'absence
+ * associée à la sanction
+ * @return un Boolean
+ */
+ public static boolean isDernierJour(AbsenceJournee absenceJournee, Sanction sanction) {
+ return DateUtil.isJoursIdentiques(absenceJournee.date, sanction.finAbsence)
+ }
+
+ /**
+ * Indique si l'AbsenceJournee correspond au premier jour de l'absence
+ * associée à la sanction
+ * @return un Boolean
+ */
+ public static boolean isPremierJour(AbsenceJournee absenceJournee, Sanction sanction) {
+ return DateUtil.isJoursIdentiques(absenceJournee.date, sanction.debutAbsence)
+ }
+
+/**
+ * Indique si l'AbsenceJournee correspond au dernier jour de l'absence
+ * associée à la punition
+ * @return un Boolean
+ */
+ public static boolean isDernierJour(AbsenceJournee absenceJournee, Punition punition) {
+ return DateUtil.isJoursIdentiques(absenceJournee.date, punition.finAbsence)
+ }
+
+/**
+ * Indique si l'AbsenceJournee correspond au premier jour de l'absence
+ * associée à la punition
+ * @return un Boolean
+ */
+ public static boolean isPremierJour(AbsenceJournee absenceJournee, Punition punition) {
+ return DateUtil.isJoursIdentiques(absenceJournee.date, punition.debutAbsence)
+ }
+
+ /**
+ * Retourne la date et l'heure de fin de journée de l'AbsenceJournee
+ * @return la date et l'heure de fin de journée de l'AbsenceJournee
+ */
+ public static Date calculeHeureFinDeJournee(AbsenceJournee absenceJournee) {
+ Calendar cal = Calendar.getInstance()
+ cal.setTime(absenceJournee.date)
+ DateUtil.setFinJour(cal)
+ return cal.getTime()
+ }
+
+}