/**
* Crée un agenda de type ETS
*/
- public Agenda getAgendaEmploiDuTempsForStructure(StructureEnseignement structEnseignement,
- boolean forceCreation = true
+ Agenda getAgendaEmploiDuTempsForStructure(StructureEnseignement structEnseignement,
+ boolean forceCreation = true
) throws EliotTempsException {
TypeAgenda typeAgenda = typeAgendaService.getAgendaTypeFromCode(
)
if (!agenda && forceCreation) {
- agenda = creeAgendaStructure(structEnseignement, typeAgenda, agenda)
+ if (log.infoEnabled) {log.info "Création de l'agenda de la structure $structEnseignement"}
+
+
+ String nom = ET + structEnseignement.code
+ String description = nom + ETABLISSEMENT +
+ structEnseignement.etablissement.nomAffichage
+
+ Item item = new Item(type: ItemService.ITEM_TYPE_AGENDA)
+ item.save(failOnError: true)
+
+ Autorite autoriteTemps =
+ DefaultSecuriteSessionFactory.getAutoriteEliotForIdExterne(
+ AutoriteTypeEliot.IDEXTERNE_ELIOT_AUTORITE_TEMPS,
+ true
+ )
+
+ autorisationService.creeAutorisation(
+ autoriteTemps,
+ item,
+ true,
+ 0
+ )
+
+ agenda = internalCreerAgenda(
+ nom,
+ description,
+ preferencesUtilisateursAgendaService.getCouleur(),
+ typeAgenda,
+ item,
+ structEnseignement,
+ null,
+ null
+ )
+
+ agendaPartageAutoService.partageAgenda(agenda)
}
return agenda
* Crée ou retourne l'agenda d'un enseignant
* attribue les droits nécessaire en cas de la création
*/
- public Agenda getAgendaEmploiDuTempsForEnseignantAndEtablissement(String enseignantIdExterne,
- String etablissementIdExterne,
- Boolean forceCreation = true)
+ Agenda getAgendaEmploiDuTempsForEnseignantAndEtablissement(String enseignantIdExterne,
+ String etablissementIdExterne,
+ Boolean forceCreation = true)
throws EliotTempsException {
Autorite autoriteEnseignant = distantAutoriteService.getAutoriteActeurForIdExterne(
}
if (!agenda && forceCreation) {
- agenda = creeAgendaEnseignantEtablissement(autoriteEnseignant, etablissement, typeAgenda, agenda)
+ String nomAffichage = localPersonneService.getNomAffichage(autoriteEnseignant)
+ if (log.infoEnabled) {log.info "Création de l'agenda de l'enseignant " + nomAffichage}
+
+ String nom = ET + " " + nomAffichage + " ($etablissement.nomAffichage)"
+ String description = nom
+
+ Item item = new Item(type: ItemService.ITEM_TYPE_AGENDA)
+ item.save(failOnError: true)
+
+ Autorite autoriteTemps =
+ DefaultSecuriteSessionFactory.getAutoriteEliotForIdExterne(
+ AutoriteTypeEliot.IDEXTERNE_ELIOT_AUTORITE_TEMPS,
+ true
+ )
+
+ autorisationService.creeAutorisation(
+ autoriteTemps,
+ item,
+ true,
+ 0
+ )
+
+ agenda = internalCreerAgenda(
+ nom,
+ description,
+ preferencesUtilisateursAgendaService.getCouleur(),
+ typeAgenda,
+ item,
+ null,
+ etablissement,
+ autoriteEnseignant
+ )
+
+ agendaPartageAutoService.partageAgenda(agenda)
}
return agenda
}
)
if (!agenda && forceCreation) {
- agenda = creeAgendaEtablissement(etablissement, typeAgenda, agenda)
+ if (log.infoEnabled) {
+ log.info "Création de l'agenda scolaire de l'établissement $etablissement.nomAffichage"
+ }
+
+ String nom = CS + etablissement.nomAffichage
+ String description = CS + etablissement.nomAffichage
+
+ Item item = new Item(type: ItemService.ITEM_TYPE_AGENDA)
+ item.save()
+
+ Autorite autoriteTemps =
+ DefaultSecuriteSessionFactory.getAutoriteEliotForIdExterne(
+ AutoriteTypeEliot.IDEXTERNE_ELIOT_AUTORITE_TEMPS,
+ true)
+
+ autorisationService.creeAutorisation(
+ autoriteTemps,
+ item,
+ true,
+ 0
+ )
+
+ agenda = internalCreerAgenda(nom,
+ description,
+ preferencesUtilisateursAgendaService.getCouleur(),
+ typeAgenda,
+ item,
+ null,
+ etablissement,
+ null
+ )
+
+ agendaPartageAutoService.partageAgenda(agenda)
}
return agenda
}
return agenda
}
-
- private Agenda creeAgendaStructure(StructureEnseignement structEnseignement, TypeAgenda typeAgenda, Agenda agenda) {
-
- if (log.infoEnabled) {
- log.info "Création de l'agenda de la structure $structEnseignement"
- }
-
- String nom = ET + structEnseignement.code
- String description = nom + ETABLISSEMENT +
- structEnseignement.etablissement.nomAffichage
-
- creeAgenda(nom, description, typeAgenda, null, null)
- }
-
- private Agenda creeAgendaEnseignantEtablissement(Autorite autoriteEnseignant,
- Etablissement etablissement,
- TypeAgenda typeAgenda,
- Agenda agenda) {
-
- String nomAffichage = localPersonneService.getNomAffichage(autoriteEnseignant)
-
- if (log.infoEnabled) {
- log.info "Création de l'agenda de l'enseignant " + nomAffichage
- }
-
- String nom = ET + " " + nomAffichage + " ($etablissement.nomAffichage)"
- String description = nom
-
- creeAgenda(nom, description, typeAgenda, etablissement, autoriteEnseignant)
- }
-
-
- private Agenda creeAgendaEtablissement(Etablissement etablissement, TypeAgenda typeAgenda, Agenda agenda) {
-
- if (log.infoEnabled) {
- log.info "Création de l'agenda scolaire de l'établissement $etablissement.nomAffichage"
- }
-
- String nom = CS + etablissement.nomAffichage
- String description = CS + etablissement.nomAffichage
-
- return creeAgenda(nom, description, typeAgenda, etablissement, null)
- }
-
- private void creeAgenda(String nom, String description, TypeAgenda typeAgenda, Etablissement etablissement, Autorite autoriteEnseignant) {
-
- Item item = new Item(type: ItemService.ITEM_TYPE_AGENDA)
- item.save()
-
- Autorite autoriteTemps =
- DefaultSecuriteSessionFactory.getAutoriteEliotForIdExterne(
- AutoriteTypeEliot.IDEXTERNE_ELIOT_AUTORITE_TEMPS,
- true
- )
-
- Agenda agenda
- autorisationService.creeAutorisation(
- autoriteTemps,
- item,
- true,
- 0
- )
-
- agenda = internalCreerAgenda(
- nom,
- description,
- preferencesUtilisateursAgendaService.getCouleur(),
- typeAgenda,
- item,
- null,
- etablissement,
- autoriteEnseignant
- )
-
- agendaPartageAutoService.partageAgenda(agenda)
-
- agenda
- }
-
-
}
\ No newline at end of file