if (!items || !autorites) {
return []
}
- String hql = """
- select item from Autorisation aut
- where aut.item in (:items)
- and aut.autorite in (:autorites)
- and (aut.proprietaire = true
- or (mod(aut.valeurPermissionsExplicite, (:permission * 2)) >= :permission))
- """
return (List<Item>) Autorisation.executeQuery(
- hql,
+ AutorisationServiceHql.HQL_GET_ITEMS,
[items: items, autorites: autorites, permission: permission]
)
}
--- /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
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par AutorisationService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class AutorisationServiceHql {
+
+ public static final String HQL_GET_ITEMS = """
+ select item from Autorisation aut
+ where aut.item in (:items)
+ and aut.autorite in (:autorites)
+ and (aut.proprietaire = true
+ or (mod(aut.valeurPermissionsExplicite, (:permission * 2)) >= :permission))
+ """
+}
DistantStructureEnseignementService distantStructureEnseignementService
def sessionFactory
- public static final String IDEXTERNE_ANONYME = "anonyme";
-
/**
* Retourne l'autorité de type 'type' et d'IdExterne 'idExterne'
* Si le flag forceCreation est positionné à true, l'autorité est
*/
void supprimeTous(List<Item> items) {
if (items?.size() > 0) {
- String query = """
- delete Item i
- where i in (:items)
- """
- Item.executeUpdate(query,
+ Item.executeUpdate(ItemServiceHql.HQL_DELETE_ITEMS,
[
items: items
]
--- /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
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par ItemService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class ItemServiceHql {
+
+ public static final String HQL_DELETE_ITEMS = """
+ delete Item i
+ where i in (:items)
+ """
+}
*/
void supprimeToutes(List<Autorite> autorites) {
if (autorites?.size() > 0) {
- String query = """
- delete Autorite a
- where a in (:autorites)
- """
- Autorite.executeUpdate(query,
+ Autorite.executeUpdate(LocalAutoriteServiceHql.HQL_DELETE_AUTORITES,
[
autorites: autorites
]
--- /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
+
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par LocalAutoriteService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class LocalAutoriteServiceHql {
+
+ public static final String HQL_DELETE_AUTORITES = """
+ delete Autorite a
+ where a in (:autorites)
+ """
+}
Date date,
int rayonIntervalle = 1
) {
- String hql = """select activite
- from DateActivite da
- where da.activite.cahierDeTextes.service.structureEnseignement.id = :structId
- and da.activite.contexteActivite.code = :codeContexte
- and da.dateEcheance between :dateDebut and :dateFin"""
- return Activite.executeQuery(hql, [
+ return Activite.executeQuery(ActiviteAdjacenteServiceHql.HQL_GET_ACTIVITES, [
structId: struct.id,
codeContexte: ContexteActivite.CODE_MAISON,
dateDebut: date - rayonIntervalle,
--- /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.applications.textes
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par ActiviteAdjacenteService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class ActiviteAdjacenteServiceHql {
+
+ public static final String HQL_GET_ACTIVITES = """select activite
+ from DateActivite da
+ where da.activite.cahierDeTextes.service.structureEnseignement.id = :structId
+ and da.activite.contexteActivite.code = :codeContexte
+ and da.dateEcheance between :dateDebut and :dateFin"""
+}
Etablissement etablissement,
AnneeScolaire anneeScolaire) {
- String updateCdtHql = """
- UPDATE CahierDeTextes cdtPrive
- SET etablissement = :etablissement,
- anneeScolaire =:anneeScolaire
- WHERE id in (:cdtIds)
- """
-
- CahierDeTextes.executeUpdate(updateCdtHql, [
+ CahierDeTextes.executeUpdate(CahierDeTextesServiceHql.HQL_UPDATE_CDT, [
etablissement: etablissement,
anneeScolaire: anneeScolaire,
cdtIds: cahiers*.id
--- /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.applications.textes
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par CahierDeTextesService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class CahierDeTextesServiceHql {
+
+ public static final String HQL_UPDATE_CDT = """
+ UPDATE CahierDeTextes cdtPrive
+ SET etablissement = :etablissement,
+ anneeScolaire =:anneeScolaire
+ WHERE id in (:cdtIds)
+ """
+}
def res = []
if (typeFonctionnalite == null) {
if (systeme) {
- String hql = """select td
- from
- TemplateDocument td
- left join td.templateEliot
- order by
- td.templateEliot.typeFonctionnalite, td.nom
- """
-
- res = TemplateDocument.executeQuery(hql)
+ res =
+ TemplateDocument.executeQuery(ImpressionTemplateDocumentServiceHql.HQL_GET_TEMPLATE)
} else {
-
- String hql = """select td
- from
- TemplateDocument td
- left join td.templateEliot
- where
- td.etablissement=? and
- td.systeme=false and
- td.actif=true
- order by
- td.templateEliot.typeFonctionnalite, td.nom
-
- """
- res = TemplateDocument.executeQuery(hql, [etablissement])
+ res =
+ TemplateDocument.executeQuery(
+ ImpressionTemplateDocumentServiceHql.HQL_GET_TEMPLATE_ETAB,
+ [etablissement])
}
} else {
if (systeme) {
- String hql = """
- from
- TemplateDocument td
- where
- td.actif=true and
- td.templateEliot.typeFonctionnalite=?
- order by
- td.nom
-
- """
-
- res += TemplateDocument.executeQuery(hql, [typeFonctionnalite])
+ res += TemplateDocument.executeQuery(
+ ImpressionTemplateDocumentServiceHql.HQL_GET_TEMPLATE_TYPE_FONCTIONNALITE,
+ [typeFonctionnalite])
}
else {
-
- String hql = """
- from
- TemplateDocument td
- where
- td.actif=true and
- td.etablissement=? and
- td.systeme=false and
- td.templateEliot.typeFonctionnalite=?
- order by
- td.nom
-
- """
- res += TemplateDocument.executeQuery(hql, [etablissement, typeFonctionnalite])
+ res += TemplateDocument.executeQuery(
+ ImpressionTemplateDocumentServiceHql.HQL_GET_TEMPLATE_TYPE_FONCTIONNALITE_ETAB,
+ [etablissement, typeFonctionnalite])
}
"templateUtilisateur ne devrait pas etre null"
)
}
-
- String hql = """
- select count(*)
- from
- PublipostageSuivi td
- where
- td.templateDocument=?
-
- """
def nombreUsageTemplate =
- TemplateDocument.executeQuery(hql, [templateDocument])
+ TemplateDocument.executeQuery(
+ ImpressionTemplateDocumentServiceHql.HQL_COUNT_PUBLIPOSTAGESUIVI,
+ [templateDocument])
if (nombreUsageTemplate[0] == 0) {
// Le template n'est pas utilisé donc on peut le supprimer
--- /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.impression.template
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par ImpressionTemplateDocumentService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class ImpressionTemplateDocumentServiceHql {
+
+ public static final String HQL_GET_TEMPLATE = """select td
+ from
+ TemplateDocument td
+ left join td.templateEliot
+ order by
+ td.templateEliot.typeFonctionnalite, td.nom
+
+ """
+
+ public static final String HQL_GET_TEMPLATE_ETAB = """select td
+ from
+ TemplateDocument td
+ left join td.templateEliot
+ where
+ td.etablissement=? and
+ td.systeme=false and
+ td.actif=true
+ order by
+ td.templateEliot.typeFonctionnalite, td.nom"""
+
+ public static final String HQL_GET_TEMPLATE_TYPE_FONCTIONNALITE = """
+ from
+ TemplateDocument td
+ where
+ td.actif=true and
+ td.templateEliot.typeFonctionnalite=?
+ order by
+ td.nom
+
+ """
+
+ public static final String HQL_GET_TEMPLATE_TYPE_FONCTIONNALITE_ETAB = """
+ from
+ TemplateDocument td
+ where
+ td.actif=true and
+ td.etablissement=? and
+ td.systeme=false and
+ td.templateEliot.typeFonctionnalite=?
+ order by
+ td.nom
+
+ """
+
+ public static final String HQL_COUNT_PUBLIPOSTAGESUIVI = """
+ select count(*)
+ from
+ PublipostageSuivi td
+ where
+ td.templateDocument=?
+
+ """
+
+}
* @return un Long
*/
Long findCount(List<Enseignement> enseignements, AppelsOubliesCommand command) {
- String hql = """select count(evt)
- from Evenement evt
- where evt.enseignement in (:enseignements)
- and not exists (
- from Appel a where a.evenement = evt
- )
- and evt.dateHeureDebut >= :debutJour
- and evt.dateHeureFin <= :finJour
- """
Calendar cal = Calendar.getInstance()
cal.setTime(command.parsedDate)
def result = Evenement.executeQuery(
- hql,
+ AppelsOubliesServiceHql.HQL_COUNT_EVENEMENTS,
[
enseignements: enseignements,
debutJour: DateUtil.getDebutJour(cal).getTime(),
* @return
*/
List findDatas(List<Enseignement> enseignements, AppelsOubliesCommand command) {
- //Recherche des événements associés à ces enseignements et n'ayant pas
- //d'appel associé
- String hql = """select evt, pers
- from Evenement evt, Personne pers
- left join fetch evt.enseignement ens
- left join fetch ens.service serv
- left join fetch serv.matiere
- where evt.enseignement in (:enseignements)
- and not exists (
- from Appel a where a.evenement = evt
- )
- and pers.autorite = evt.enseignement.enseignant
- and evt.dateHeureDebut >= :debutJour
- and evt.dateHeureFin <= :finJour
- order by pers.nom, pers.prenom, evt.dateHeureDebut
- """
Calendar cal = Calendar.getInstance()
cal.setTime(command.parsedDate)
return Evenement.executeQuery(
- hql,
+ AppelsOubliesServiceHql.HQL_GET_EVENEMENTS_ENSEIGNANTS,
[
enseignements: enseignements,
debutJour: DateUtil.getDebutJour(cal).getTime(),
--- /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.consultation.appelsoublies
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par AppelsOubliesService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class AppelsOubliesServiceHql {
+
+ public static final String HQL_COUNT_EVENEMENTS = """select count(evt)
+ from Evenement evt
+ where evt.enseignement in (:enseignements)
+ and not exists (
+ from Appel a where a.evenement = evt
+ )
+ and evt.dateHeureDebut >= :debutJour
+ and evt.dateHeureFin <= :finJour
+ """
+ //Recherche des événements associés à ces enseignements et n'ayant pas
+ //d'appel associé
+ public static final String HQL_GET_EVENEMENTS_ENSEIGNANTS = """select evt, pers
+ from Evenement evt, Personne pers
+ left join fetch evt.enseignement ens
+ left join fetch ens.service serv
+ left join fetch serv.matiere
+ where evt.enseignement in (:enseignements)
+ and not exists (
+ from Appel a where a.evenement = evt
+ )
+ and pers.autorite = evt.enseignement.enseignant
+ and evt.dateHeureDebut >= :debutJour
+ and evt.dateHeureFin <= :finJour
+ order by pers.nom, pers.prenom, evt.dateHeureDebut
+ """
+}
Calendar cal = Calendar.getInstance()
cal.setTime(jour)
DateUtil.setDebutJour(cal)
-
- String hql = '''select al.heureDebut, al.heureFin, al.retard,
-al.departAnticipe,al.presence, al.absenceJustifiee, al.absencePrevisionnelle,
-al.heureArrivee, al.heureDepart, al.commentaireArrivee, al.commentaireDepart,
-pers, al.motif, al.id
-from AppelLigne al,
-PersonneProprietesScolarite persProp,
-Personne pers
-where persProp.personne = pers
-and pers.autorite = al.autorite
-and persProp.proprietesScolarite.structureEnseignement = :structure
-and al.absenceJournee.date = :jour
-'''
- def lignes = AppelLigne.executeQuery(hql, [
- structure: structure,
- jour: cal.getTime()
- ])
+ def lignes =
+ AppelLigne.executeQuery(AbsenceJourneeServiceHql.HQL_GET_APPELS_LIGNE, [
+ structure: structure,
+ jour: cal.getTime()
+ ])
AbsenceJourneeInfo result = new AbsenceJourneeInfo(jour: cal.getTime())
lignes.each {
--- /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
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par AbsenceJourneeService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class AbsenceJourneeServiceHql {
+
+ public static final String HQL_GET_APPELS_LIGNE = '''select al.heureDebut, al.heureFin, al.retard,
+al.departAnticipe,al.presence, al.absenceJustifiee, al.absencePrevisionnelle,
+al.heureArrivee, al.heureDepart, al.commentaireArrivee, al.commentaireDepart,
+pers, al.motif, al.id
+from AppelLigne al,
+PersonneProprietesScolarite persProp,
+Personne pers
+where persProp.personne = pers
+and pers.autorite = al.autorite
+and persProp.proprietesScolarite.structureEnseignement = :structure
+and al.absenceJournee.date = :jour
+'''
+}
if (droitsService.getTypeRolePourAccesAppel(
securiteSession,
structureEnseignement)) {
-
- String hql = """
- select distinct appel from Appel as appel
- where appel.evenement.agendaMaitre.structureEnseignement = :structureEnseignement
- """
- List<Appel> appels = Appel.executeQuery(hql, [
- structureEnseignement: structureEnseignement,
- ])
+ List<Appel> appels =
+ Appel.executeQuery(AppelServiceHql.HQL_GET_APPEL_BY_STRUCTURE, [
+ structureEnseignement: structureEnseignement,
+ ])
List<AppelInfo> result = []
appels.each {Appel appel ->
cal.set(Calendar.MILLISECOND, 999)
Date dateFin = cal.getTime()
- // torefac fais un select count () au lieu de select complet
-
- String hql = """
- select distinct appel from Appel as appel
- join appel.plageHoraires as plage
- where appel.evenement.agendaMaitre.structureEnseignement = :structure
- and appel.dateHeureDebut >= :debutJour
- and appel.dateHeureDebut <= :finJour
- and plage in (:listePlages)
- """
- List<Appel> appels = Appel.executeQuery(hql, [
+ List<Appel> appels = Appel.executeQuery(AppelServiceHql.HQL_GET_APPEL, [
structure: structureEnseignement,
debutJour: dateDebut,
finJour: dateFin,
List<Enseignement> enseignements
- String hql = """select distinct enseignement from Enseignement as enseignement
- join enseignement.service as service
- join enseignement.enseignant as enseignant
- join service.structureEnseignement as structure
- where enseignant =:enseignant
- and structure = :structure"""
-
- enseignements = Enseignement.executeQuery(hql, [
+ enseignements = Enseignement.executeQuery(AppelServiceHql.HQL_GET_ENSEIGNEMENT, [
structure: structureEnseignement,
enseignant: enseignant
])
Map getAbsencesJournesParEleve(Appel appel, StructureEnseignement structure) {
Map absencesJourneeTriees = [:]
- String hqlAppelLignes = """
- select appelLigne from AppelLigne as appelLigne
- where appelLigne.appel is null
- and appelLigne.autorite in (:listeEleves)
- and appelLigne.absenceJournee.date = :dateAppel
- and appelLigne.heureDebut between :heureDebutAppel and :heureFinAppel
- and appelLigne.heureFin between :heureDebutAppel and :heureFinAppel
- order by appelLigne.autorite
- """
-
Calendar dateAppel = Calendar.getInstance()
dateAppel.setTime(appel.dateHeureDebut)
- SecuriteSession sessionAbsence =
- DefaultSecuriteSessionFactory.getEliotAbsencesSecuriteSessionForCodePorteurENT(
- structure.etablissement.codePorteurENT
- )
-
List<Autorite> eleves = localStructureEnseignementService.
findAllElevesForStructure(
structure
]
if (eleves.size() > 0) {
- List resultats = AppelLigne.executeQuery(hqlAppelLignes, params)
+ List resultats =
+ AppelLigne.executeQuery(AppelServiceHql.HQL_GET_APPEL_LIGNE, params)
resultats.each { AppelLigne appelLigne ->
if (!absencesJourneeTriees[appelLigne.autorite]) {
absencesJourneeTriees[appelLigne.autorite] = []
--- /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.appel
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par AppelService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class AppelServiceHql {
+
+ public static final String HQL_GET_APPEL_BY_STRUCTURE = """
+ select distinct appel from Appel as appel
+ where appel.evenement.agendaMaitre.structureEnseignement = :structureEnseignement
+ """
+
+ // TOREFACT fais un select count () au lieu de select complet
+ public static final String HQL_GET_APPEL = """
+ select distinct appel from Appel as appel
+ join appel.plageHoraires as plage
+ where appel.evenement.agendaMaitre.structureEnseignement = :structure
+ and appel.dateHeureDebut >= :debutJour
+ and appel.dateHeureDebut <= :finJour
+ and plage in (:listePlages)
+ """
+
+ public static final String HQL_GET_ENSEIGNEMENT =
+ """select distinct enseignement from Enseignement as enseignement
+ join enseignement.service as service
+ join enseignement.enseignant as enseignant
+ join service.structureEnseignement as structure
+ where enseignant =:enseignant
+ and structure = :structure"""
+
+ public static final String HQL_GET_APPEL_LIGNE = """
+ select appelLigne from AppelLigne as appelLigne
+ where appelLigne.appel is null
+ and appelLigne.autorite in (:listeEleves)
+ and appelLigne.absenceJournee.date = :dateAppel
+ and appelLigne.heureDebut between :heureDebutAppel and :heureFinAppel
+ and appelLigne.heureFin between :heureDebutAppel and :heureFinAppel
+ order by appelLigne.autorite
+ """
+}
if(rechercheAbsenceExistanteParams.eleveAutorites.empty){
return []
}
-
- String hql = """
- from AppelLigne al
- left join fetch al.appel appel
- left join fetch al.absenceJournee aj
- where al.autorite.id in (:autoriteIds)
- and (
- (
- appel.id is not null
- and al.appel.dateHeureDebut < :dateFin
- and al.appel.dateHeureFin > :dateDebut
- ) or (
- aj.id is not null
- and (aj.date + al.heureDebut) < :dateFin
- and (aj.date + al.heureFin) > :dateDebut
- )
- )
- """
List<AppelLigne> appelLignes = AppelLigne.executeQuery(
- hql,
+ RechercheAbsenceExistanteServiceHql.HQL_GET_APPEL_LIGNE,
[
autoriteIds: rechercheAbsenceExistanteParams.eleveAutorites*.id,
dateDebut: DateUtil.setDebutJour(rechercheAbsenceExistanteParams.debut),
--- /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.dateadate
+
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par RechercheAbsenceExistanteService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class RechercheAbsenceExistanteServiceHql {
+
+ public static final String HQL_GET_APPEL_LIGNE = """
+ from AppelLigne al
+ left join fetch al.appel appel
+ left join fetch al.absenceJournee aj
+ where al.autorite.id in (:autoriteIds)
+ and (
+ (
+ appel.id is not null
+ and al.appel.dateHeureDebut < :dateFin
+ and al.appel.dateHeureFin > :dateDebut
+ ) or (
+ aj.id is not null
+ and (aj.date + al.heureDebut) < :dateFin
+ and (aj.date + al.heureFin) > :dateDebut
+ )
+ )
+ """
+}
}
} else {
- String appelLignesPensionsHql = """
- select al from AppelLigne as al
- inner join al.autorite
- where al.autorite in (:autorites)
- and al.dateSaisie = :date
- and al.demiPension = :demiPension
- and al.internat = :internat
- """
-
if (eleves.size() > 0) {
appelLignes = AppelLigne.executeQuery(
- appelLignesPensionsHql,
+ DemiPensionInternatServiceHql.HQL_GET_APPEL_LIGNE_PENSION,
[
autorites: eleves*.autorite,
date: AbsencesDateUtil.getDay(date),
--- /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.demipensioninternat
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par DemiPensionInternatService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class DemiPensionInternatServiceHql {
+
+ public static final String HQL_GET_APPEL_LIGNE_PENSION = """
+ select al from AppelLigne as al
+ inner join al.autorite
+ where al.autorite in (:autorites)
+ and al.dateSaisie = :date
+ and al.demiPension = :demiPension
+ and al.internat = :internat
+"""
+}
private List<AppelLigne> findAbsencesJourneesForEleveAndPeriode(Personne eleve,
Date dateDebut,
Date dateFin) {
- String hql = """
- from AppelLigne al
- inner join fetch al.absenceJournee j
- inner join fetch al.motif
- where j.date <= :dateFin
- and j.date >= :dateDebut
- and al.autorite = :autoriteEleve
- """
- return AppelLigne.executeQuery(hql, [
+ return AppelLigne.executeQuery(SaisieHebdomadaireServiceHql.HQL_GET_ABSENCES_JOURNEE, [
dateFin: dateFin,
dateDebut: dateDebut,
autoriteEleve: eleve.autorite
private List<AppelLigne> findAbsencesAppelsForEleveAndPeriode(Personne eleve,
Date dateDebut,
Date dateFin) {
- String hql = """
- from AppelLigne al
- inner join fetch al.appel a
- inner join fetch al.motif
- where a.dateHeureDebut <= :dateFin
- and a.dateHeureFin >= :dateDebut
- and al.autorite = :autoriteEleve
- """
- return AppelLigne.executeQuery(hql, [
+ return AppelLigne.executeQuery(SaisieHebdomadaireServiceHql.HQL_GET_ABSENCES_APPEL, [
dateFin: dateFin,
dateDebut: dateDebut,
autoriteEleve: eleve.autorite
private List findAppelsDatasForClasseAndPeriode(StructureEnseignement classe,
Date dateDebut,
Date dateFin) {
- String hql = """
- select p.id, a.id, a.dateHeureDebut
- from Appel a
- inner join a.plageHoraires p
- where a.evenement.agendaMaitre.structureEnseignement = :classe
- and a.dateHeureDebut < :dateFin
- and a.dateHeureFin > :dateDebut
- """
- return Appel.executeQuery(hql, [
+ return Appel.executeQuery(SaisieHebdomadaireServiceHql.HQL_GET_APPEL_DATAS, [
classe: classe,
dateFin: dateFin,
dateDebut: dateDebut
--- /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.hebdomadaire
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par SaisieHebdomadaireService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class SaisieHebdomadaireServiceHql {
+
+ public static final String HQL_GET_ABSENCES_JOURNEE = """
+ from AppelLigne al
+ inner join fetch al.absenceJournee j
+ inner join fetch al.motif
+ where j.date <= :dateFin
+ and j.date >= :dateDebut
+ and al.autorite = :autoriteEleve
+ """
+
+ public static final String HQL_GET_ABSENCES_APPEL = """
+ from AppelLigne al
+ inner join fetch al.appel a
+ inner join fetch al.motif
+ where a.dateHeureDebut <= :dateFin
+ and a.dateHeureFin >= :dateDebut
+ and al.autorite = :autoriteEleve
+ """
+
+ public static final String HQL_GET_APPEL_DATAS = """
+ select p.id, a.id, a.dateHeureDebut
+ from Appel a
+ inner join a.plageHoraires p
+ where a.evenement.agendaMaitre.structureEnseignement = :classe
+ and a.dateHeureDebut < :dateFin
+ and a.dateHeureFin > :dateDebut
+ """
+}
}
private Integer calculeTotalDemiPensionOrInternatForEleves(
- TableauDeBordParams criteres,
- boolean isDemiPension,
- TableauDeBord tableauDeBord) {
+ TableauDeBordParams criteres,
+ boolean isDemiPension,
+ TableauDeBord tableauDeBord) {
if(tableauDeBord.lignes){
- String hql = """
- select count(al.id)
- from AppelLigne al
- where al.demiPension = :demiPension
- and al.internat = :internat
- and al.autorite.id in (:autoriteIds)
- and al.dateSaisie >= :dateDebut
- and al.dateSaisie <= :dateFin
- """
- List result = AppelLigne.executeQuery(hql, [
- autoriteIds: tableauDeBord.lignesSansPagination*.autoriteEleveId,
- dateDebut: criteres.dateDebut,
- dateFin: criteres.dateFin,
- demiPension: isDemiPension,
- internat: !isDemiPension
- ])
+ List result =
+ AppelLigne.executeQuery(
+ TableauDeBordDemiPensionInternatServiceHql.HQL_COUNT_APPELS_LIGNE, [
+ autoriteIds: tableauDeBord.lignesSansPagination*.autoriteEleveId,
+ dateDebut: criteres.dateDebut,
+ dateFin: criteres.dateFin,
+ demiPension: isDemiPension,
+ internat: !isDemiPension
+ ])
return (Integer) result[0]
} else {
return 0
* @return un Integer
*/
private Integer calculeTotalDemiPensionOrInternatForCriteres(TableauDeBordParams criteres, boolean isDemiPension) {
- String hql = """
- select count(al.id)
- from AppelLigne al,
- PersonneProprietesScolarite persProp
- where al.demiPension = :demiPension
- and al.internat = :internat
- and al.autorite = persProp.personne.autorite
- and persProp.proprietesScolarite.structureEnseignement in (:structures)
- and al.dateSaisie >= :dateDebut
- and al.dateSaisie <= :dateFin
- """
- List result = AppelLigne.executeQuery(hql, [
- structures: criteres.classes,
- dateDebut: criteres.dateDebut,
- dateFin: criteres.dateFin,
- demiPension: isDemiPension,
- internat: !isDemiPension
- ])
+ List result =
+ AppelLigne.executeQuery(
+ TableauDeBordDemiPensionInternatServiceHql.HQL_COUNT_APPELS_LIGNE_FOR_CRITERES, [
+ structures: criteres.classes,
+ dateDebut: criteres.dateDebut,
+ dateFin: criteres.dateFin,
+ demiPension: isDemiPension,
+ internat: !isDemiPension
+ ])
return (Integer) result[0]
}
void calculeLignesAbsencesInternat(TableauDeBordParams criteres,
TableauDeBord tableauDeBord
) {
- String hql = """select al.autorite.id, count(*)
- from AppelLigne al
- where al.demiPension = false
- and al.internat = true
- and al.autorite.id in (:eleveIds)
- and al.absenceJournee.date <= :critereFin
- and al.absenceJournee.date >= :critereDebut
- group by al.autorite.id
- """
- List datas = AppelLigne.executeQuery(hql, [
- eleveIds: tableauDeBord.lignes*.autoriteEleveId,
- critereDebut: criteres.dateDebut,
- critereFin: criteres.dateFin
- ])
+ List datas =
+ AppelLigne.executeQuery(
+ TableauDeBordDemiPensionInternatServiceHql.HQL_COUNT_APPELS_LIGNE_INTERNAT, [
+ eleveIds: tableauDeBord.lignes*.autoriteEleveId,
+ critereDebut: criteres.dateDebut,
+ critereFin: criteres.dateFin
+ ])
datas.each {
data ->
TableauDeBordLigne ligne = (TableauDeBordLigne) tableauDeBord.lignes.find {
void calculeLignesAbsencesDemiPension(TableauDeBordParams criteres,
TableauDeBord tableauDeBord
) {
- String hql = """select al.autorite.id, count(*)
- from AppelLigne al
- where al.demiPension = true
- and al.internat = false
- and al.autorite.id in (:eleveIds)
- and al.absenceJournee.date <= :critereFin
- and al.absenceJournee.date >= :critereDebut
- group by al.autorite.id
- """
- List datas = AppelLigne.executeQuery(hql, [
- eleveIds: tableauDeBord.lignes*.autoriteEleveId,
- critereDebut: criteres.dateDebut,
- critereFin: criteres.dateFin
- ])
+ List datas =
+ AppelLigne.executeQuery(
+ TableauDeBordDemiPensionInternatServiceHql.HQL_COUNT_APPELS_LIGNE_DEMIPENSION, [
+ eleveIds: tableauDeBord.lignes*.autoriteEleveId,
+ critereDebut: criteres.dateDebut,
+ critereFin: criteres.dateFin
+ ])
datas.each {
data ->
TableauDeBordLigne ligne = (TableauDeBordLigne) tableauDeBord.lignes.find {
--- /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.statistiques.tableaudebord
+
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par TableauDeBordDemiPensionInternatService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class TableauDeBordDemiPensionInternatServiceHql {
+
+ public static final String HQL_COUNT_APPELS_LIGNE = """
+ select count(al.id)
+ from AppelLigne al
+ where al.demiPension = :demiPension
+ and al.internat = :internat
+ and al.autorite.id in (:autoriteIds)
+ and al.dateSaisie >= :dateDebut
+ and al.dateSaisie <= :dateFin
+ """
+
+ public static final String HQL_COUNT_APPELS_LIGNE_FOR_CRITERES = """
+ select count(al.id)
+ from AppelLigne al,
+ PersonneProprietesScolarite persProp
+ where al.demiPension = :demiPension
+ and al.internat = :internat
+ and al.autorite = persProp.personne.autorite
+ and persProp.proprietesScolarite.structureEnseignement in (:structures)
+ and al.dateSaisie >= :dateDebut
+ and al.dateSaisie <= :dateFin
+ """
+
+ public static final String HQL_COUNT_APPELS_LIGNE_INTERNAT = """
+ select al.autorite.id, count(*)
+ from AppelLigne al
+ where al.demiPension = false
+ and al.internat = true
+ and al.autorite.id in (:eleveIds)
+ and al.absenceJournee.date <= :critereFin
+ and al.absenceJournee.date >= :critereDebut
+ group by al.autorite.id
+ """
+
+ public static final String HQL_COUNT_APPELS_LIGNE_DEMIPENSION = """
+ select al.autorite.id, count(*)
+ from AppelLigne al
+ where al.demiPension = true
+ and al.internat = false
+ and al.autorite.id in (:eleveIds)
+ and al.absenceJournee.date <= :critereFin
+ and al.absenceJournee.date >= :critereDebut
+ group by al.autorite.id
+ """
+}
private Integer calculeTotalPunitionForEleves(TableauDeBordParams criteres,
TableauDeBord tableauDeBord) {
if (tableauDeBord.lignes) {
- String hql = """select count(p.id)
- from Punition p
- where p.eleve.autorite.id in (:autoriteIds)
- and p.date >= :dateDebut
- and p.date <= :dateFin
- """
- List result = Punition.executeQuery(hql, [
- autoriteIds: tableauDeBord.lignesSansPagination*.autoriteEleveId,
- dateDebut: criteres.dateDebut,
- dateFin: criteres.dateFin
- ])
+ List result =
+ Punition.executeQuery(
+ TableauDeBordPunitionServiceHql.HQL_COUNT_PUNITION_ELEVES, [
+ autoriteIds: tableauDeBord.lignesSansPagination*.autoriteEleveId,
+ dateDebut: criteres.dateDebut,
+ dateFin: criteres.dateFin
+ ])
return (Integer) result[0]
} else {
return 0
* @return un Integer
*/
private Integer calculeTotalPunitionForCriteres(TableauDeBordParams criteres) {
- String hql = """select count(p.id)
- from Punition p,
- PersonneProprietesScolarite persProp
- where p.eleve = persProp.personne
- and persProp.proprietesScolarite.structureEnseignement in (:structures)
- and p.date >= :dateDebut
- and p.date <= :dateFin
- """
- List result = Punition.executeQuery(hql, [
+ List result = Punition.executeQuery(TableauDeBordPunitionServiceHql.HQL_COUNT_PUNITION_FOR_CRITERES, [
structures: criteres.classes,
dateDebut: criteres.dateDebut,
dateFin: criteres.dateFin
* @return un Long
*/
Long calculeCount(TableauDeBordParams criteres) {
- String hql = """
- select 1
- from
- Punition p,
- PersonneProprietesScolarite persProp
- where
- p.eleve = persProp.personne
- and persProp.proprietesScolarite.structureEnseignement.id in (:structureIds)
- and p.date >= :dateDebut
- and p.date <= :dateFin
- group by
- p.eleve.id,
- p.eleve.autorite.id,
- persProp.proprietesScolarite.structureEnseignement.code,
- p.eleve.nom,
- p.eleve.prenom
- having count(p.id) >= :seuil
- order by p.eleve.nom, p.eleve.prenom
- """
List datas = Punition.executeQuery(
- hql,
+ TableauDeBordPunitionServiceHql.HQL_COUNT_PUNITION,
[
structureIds: criteres.classes*.id,
dateDebut: criteres.dateDebut,
String sortOrder = criteres.sortAsc ? '' : 'desc'
if (criteres.sortField == TableauDeBord.FIELD_DIVISION_CODE) {
hql += "order by persProp.proprietesScolarite.structureEnseignement.code " +
- "$sortOrder, p.eleve.nom $sortOrder, p.eleve.prenom $sortOrder"
+ "$sortOrder, p.eleve.nom $sortOrder, p.eleve.prenom $sortOrder"
} else {
hql += "order by p.eleve.nom $sortOrder, p.eleve.prenom $sortOrder"
}
--- /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.statistiques.tableaudebord
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par TableauDeBordPunitionService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class TableauDeBordPunitionServiceHql {
+
+ public static final String HQL_COUNT_PUNITION_ELEVES = """select count(p.id)
+from Punition p
+where p.eleve.autorite.id in (:autoriteIds)
+and p.date >= :dateDebut
+and p.date <= :dateFin
+"""
+
+ public static final String HQL_COUNT_PUNITION_FOR_CRITERES = """select count(p.id)
+ from Punition p,
+ PersonneProprietesScolarite persProp
+ where p.eleve = persProp.personne
+ and persProp.proprietesScolarite.structureEnseignement in (:structures)
+ and p.date >= :dateDebut
+ and p.date <= :dateFin
+ """
+
+ public static final String HQL_COUNT_PUNITION = """
+ select 1
+ from
+ Punition p,
+ PersonneProprietesScolarite persProp
+ where
+ p.eleve = persProp.personne
+ and persProp.proprietesScolarite.structureEnseignement.id in (:structureIds)
+ and p.date >= :dateDebut
+ and p.date <= :dateFin
+ group by
+ p.eleve.id,
+ p.eleve.autorite.id,
+ persProp.proprietesScolarite.structureEnseignement.code,
+ p.eleve.nom,
+ p.eleve.prenom
+ having count(p.id) >= :seuil
+ order by p.eleve.nom, p.eleve.prenom
+ """
+}
private Integer calculeTotalSanctionForEleves(TableauDeBordParams criteres,
TableauDeBord tableauDeBord) {
if (tableauDeBord.lignes) {
- String hql = """select count(s.id)
- from Sanction s
- where s.eleve.autorite.id in (:autoriteIds)
- and s.date >= :dateDebut
- and s.date <= :dateFin
- """
- List result = Sanction.executeQuery(hql, [
- autoriteIds: tableauDeBord.lignesSansPagination*.autoriteEleveId,
- dateDebut: criteres.dateDebut,
- dateFin: criteres.dateFin
- ])
+ List result =
+ Sanction.executeQuery(TableauDeBordSanctionServiceHql.HQL_COUNT_SANCTIONS_ELEVES, [
+ autoriteIds: tableauDeBord.lignesSansPagination*.autoriteEleveId,
+ dateDebut: criteres.dateDebut,
+ dateFin: criteres.dateFin
+ ])
return (Integer) result[0]
} else {
return 0
* @return un Integer
*/
private Integer calculeTotalSanctionForCriteres(TableauDeBordParams criteres) {
- String hql = """select count(s.id)
- from Sanction s,
- PersonneProprietesScolarite persProp
- where s.eleve = persProp.personne
- and persProp.proprietesScolarite.structureEnseignement in (:structures)
- and s.date >= :dateDebut
- and s.date <= :dateFin
- """
- List result = Sanction.executeQuery(hql, [
+ List result =
+ Sanction.executeQuery(TableauDeBordSanctionServiceHql.HQL_COUNT_SANCTIONS_FOR_CRITERES, [
structures: criteres.classes,
dateDebut: criteres.dateDebut,
dateFin: criteres.dateFin
* @return un Long
*/
Long calculeCount(TableauDeBordParams criteres) {
- String hql = """
- select 1
- from
- Sanction s,
- PersonneProprietesScolarite persProp
- where
- s.eleve = persProp.personne
- and persProp.proprietesScolarite.structureEnseignement.id in (:structureIds)
- and s.date >= :dateDebut
- and s.date <= :dateFin
- group by
- s.eleve.id,
- s.eleve.autorite.id,
- persProp.proprietesScolarite.structureEnseignement.code,
- s.eleve.nom,
- s.eleve.prenom
- having count(s.id) >= :seuil
- order by s.eleve.nom, s.eleve.prenom
- """
List datas = Sanction.executeQuery(
- hql,
+ TableauDeBordSanctionServiceHql.HQL_GET_SANCTION,
[
structureIds:criteres.classes*.id,
dateDebut: criteres.dateDebut,
--- /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.statistiques.tableaudebord
+
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par TableauDeBordSanctionService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class TableauDeBordSanctionServiceHql {
+
+ public static final String HQL_COUNT_SANCTIONS_ELEVES = """select count(s.id)
+ from Sanction s
+ where s.eleve.autorite.id in (:autoriteIds)
+ and s.date >= :dateDebut
+ and s.date <= :dateFin
+ """
+
+ public static final String HQL_COUNT_SANCTIONS_FOR_CRITERES = """select count(s.id)
+ from Sanction s,
+ PersonneProprietesScolarite persProp
+ where s.eleve = persProp.personne
+ and persProp.proprietesScolarite.structureEnseignement in (:structures)
+ and s.date >= :dateDebut
+ and s.date <= :dateFin
+ """
+
+ public static final String HQL_GET_SANCTION = """
+ select 1
+ from
+ Sanction s,
+ PersonneProprietesScolarite persProp
+ where
+ s.eleve = persProp.personne
+ and persProp.proprietesScolarite.structureEnseignement.id in (:structureIds)
+ and s.date >= :dateDebut
+ and s.date <= :dateFin
+ group by
+ s.eleve.id,
+ s.eleve.autorite.id,
+ persProp.proprietesScolarite.structureEnseignement.code,
+ s.eleve.nom,
+ s.eleve.prenom
+ having count(s.id) >= :seuil
+ order by s.eleve.nom, s.eleve.prenom
+ """
+}
* @author jbui
*/
void calculeTotaux(TableauDeBordParams criteres,
- PreferencesEtablissementAbsences pref,
- TableauDeBord tableauDeBord) {
+ PreferencesEtablissementAbsences pref,
+ TableauDeBord tableauDeBord) {
tableauDeBord.totaux = new TableauDeBordTotaux()
* @return le nombre d'élèves pour la liste de structures passé en paramètre
*/
Long calculeNbEleves(TableauDeBordParams criteres) {
- String hql = """select count(personne.id)
- from PersonneProprietesScolarite persProp
- where persProp.estActive = true
- and persProp.proprietesScolarite.structureEnseignement.id in (:structureIds)
- and persProp.proprietesScolarite.fonction = :fonction
- """
- List result = PersonneProprietesScolarite.executeQuery(hql, [
- structureIds: criteres.classes*.id,
- fonction: Fonction.findByCode(FonctionEnum.ELEVE.getCode())
- ])
+ List result =
+ PersonneProprietesScolarite.executeQuery(TableauDeBordServiceHql.HQL_COUNT_PERSONNES_FROM_PPS, [
+ structureIds: criteres.classes*.id,
+ fonction: Fonction.findByCode(FonctionEnum.ELEVE.getCode())
+ ])
return (Integer) result[0]
}
* @author jbui
*/
private void calculeLignesAbsencesEleves(
- TableauDeBordParams criteres,
- TableauDeBord tableauDeBord,
- PreferencesEtablissementAbsences pref) {
+ TableauDeBordParams criteres,
+ TableauDeBord tableauDeBord,
+ PreferencesEtablissementAbsences pref) {
tableauDeBordAbsencesService.calculeLignesAbsencesSansMotif(
criteres,
Map findPunitionDatasForElevesAndPeriode(List<Long> personneEleveIds,
TableauDeBordParams criteres) {
Map result = [:]
- String hql = """select eleve.id, count(punition.id)
- from Punition punition
- where punition.eleve.id in (:eleveIds)
- and punition.date >= :dateDebut
- and punition.date <= :dateFin
- group by punition.eleve.id
- """
- List liste = Punition.executeQuery(hql, [
- eleveIds: personneEleveIds,
- dateDebut: criteres.dateDebut,
- dateFin: criteres.dateFin
- ])
+ List liste =
+ Punition.executeQuery(TableauDeBordServiceHql.HQL_GET_PUNITION_FOR_ELEVE_PERIODE, [
+ eleveIds: personneEleveIds,
+ dateDebut: criteres.dateDebut,
+ dateFin: criteres.dateFin
+ ])
liste.each {
result.put(it[0], it[1])
Map findSanctionDatasForElevesAndPeriode(List<Long> personneEleveIds,
TableauDeBordParams criteres) {
Map result = [:]
- String hql = """select eleve.id, count(sanction.id)
- from Sanction sanction
- where sanction.eleve.id in (:eleveIds)
- and sanction.date >= :dateDebut
- and sanction.date <= :dateFin
- group by sanction.eleve.id
- """
- List liste = Sanction.executeQuery(hql, [
+ List liste =
+ Sanction.executeQuery(TableauDeBordServiceHql.HQL_GET_SANCTION_FOR_ELEVE_PERIODE, [
eleveIds: personneEleveIds,
dateDebut: criteres.dateDebut,
dateFin: criteres.dateFin
--- /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.statistiques.tableaudebord
+
+
+/**
+ * Cette classe regroupe les requêtes hql utilisées par TableauDeBordService.
+ * Ces requêtes sont définies en static pour permettre un gain de performance.
+ * Au lieu que ces strings soient réinstanciées à chaque appel de la méthode qui
+ * les utilise (cela est coûteux), elles ne seront instanciées qu'une seule fois
+ * (prennent peu de place en mémoire) et réutilisables autant que souhaité.
+ */
+class TableauDeBordServiceHql {
+
+ public static final String HQL_COUNT_PERSONNES_FROM_PPS = """
+ select count(personne.id)
+ from PersonneProprietesScolarite persProp
+ where persProp.estActive = true
+ and persProp.proprietesScolarite.structureEnseignement.id in (:structureIds)
+ and persProp.proprietesScolarite.fonction = :fonction
+ """
+
+ public static final String HQL_GET_PUNITION_FOR_ELEVE_PERIODE = """
+ select eleve.id, count(punition.id)
+ from Punition punition
+ where punition.eleve.id in (:eleveIds)
+ and punition.date >= :dateDebut
+ and punition.date <= :dateFin
+ group by punition.eleve.id
+ """
+
+ public static final String HQL_GET_SANCTION_FOR_ELEVE_PERIODE =
+ """select eleve.id, count(sanction.id)
+ from Sanction sanction
+ where sanction.eleve.id in (:eleveIds)
+ and sanction.date >= :dateDebut
+ and sanction.date <= :dateFin
+ group by sanction.eleve.id
+ """
+
+}