import org.lilie.services.eliot.scolarite.personne.eleve.FicheEleveCommentaireService
import org.lilie.services.eliot.securite.impl.Autorite
import org.lilie.services.eliot.annuaire.SecuriteSession
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.temps.DateUtil
import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
import org.lilie.services.eliot.scolarite.StructureEnseignement
params.commentaire)
result[EliotConstantes.JSON_SUCCESS] = true
- } catch (SauvegardeEchoueException ex) {
- result[EliotConstantes.JSON_SUCCESS] = false
- log.error ex.toString()
- } catch (AutorisationException ex) {
+ }
+ catch (Exception ex) {
result[EliotConstantes.JSON_SUCCESS] = false
log.error ex.toString()
}
+++ /dev/null
-package org.lilie.services.eliot.exception
-
-/**
- * Exception pour marquer qu'un sauvegarde a echoué.
- * @author msan
- */
-class SauvegardeEchoueException extends RuntimeException {
- Object objet // objet de sauvegarde
-
- /**
- * Constructeur
- * @param objet objet de sauvegarde
- * @return l'exception
- */
- SauvegardeEchoueException(Object objet) {
- super("Sauvegarde d'objet $objet a echoué".toString())
- this.objet = objet
- }
-
- /**
- * Constructeur
- * @param objet l'objet de la sauvegarde
- * @param cause la cause de l'exception
- * @return l'exception
- * @author jtra
- */
- SauvegardeEchoueException(Object objet, Throwable cause) {
- super("Sauvegarde d'objet $objet a echoué".toString(), cause)
- this.objet = objet
- }
-}
package org.lilie.services.eliot.scolarite
import org.lilie.services.eliot.scolarite.matiere.MatiereCodeGestionUniqueException
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.securite.AutorisationException
import org.lilie.services.eliot.exception.SuppresionEchoueException
import org.lilie.services.eliot.scolarite.matiere.MatiereNonSupprimableException
/**
* Crée une modalité matière par défaut
- * @param securiteSession
- * @param etablissement
- * @param code
- * @param libelle
- * @return
*/
ModaliteMatiere internalCreeModaliteMatiere(Etablissement etablissement,
String code,
/**
* Verifier si la modalite est utilise dans les services
- * @param modalite
- * @param securiteSession
* @author mjao
*/
boolean isModaliteMatiereUtilise(SecuriteSession securiteSession,
String code,
String libelle)
throws MatiereCodeGestionUniqueException,
- SauvegardeEchoueException,
IllegalArgumentException {
ModaliteMatiere mod = ModaliteMatiere.createCriteria().get {
}
mod = internalCreeModaliteMatiere(etablissement, code, libelle)
- if (mod.hasErrors()) {
- throw new SauvegardeEchoueException(
- "La création de la modalite $code a échoué: " + mod.errors
- )
- }
return mod
}
/**
String code,
String libelle)
throws MatiereCodeGestionUniqueException,
- SauvegardeEchoueException,
IllegalArgumentException {
// verifie l'autorisation de modification
}
catch (Exception e) { // Note (jtra) : Il faudrait préciser l'exception & lever MatiereCodeGestionUniqueException() si c'est ça le pb
log.error("Une erreur inconnue est survenue lors de la modification du ModaliteMatiere.", e)
- throw new SauvegardeEchoueException(modalite)
+ throw e
}
}
/**
package org.lilie.services.eliot.scolarite
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.springframework.dao.DataIntegrityViolationException
import org.lilie.services.eliot.notes.StructureEnseignementNotesService
import org.lilie.services.eliot.constantes.ConstFonct
* @param typeIntervalle : SEMESTRE ou TRIMSTRE
* @throws IllegalArgumentException si le struct est null,
* ou typeIntervalle n'est pas SEMETSRE ou TRIMESTRE
- * @throws SauvegardeEchoueException
* @author bper
*/
void creePeriodesNotationPourStructureEnseignement(StructureEnseignement struct,
TypeIntervalleEnum typeIntervalle = TypeIntervalleEnum.TRIMESTRE)
- throws IllegalArgumentException, IllegalStateException, SauvegardeEchoueException {
+ throws IllegalArgumentException, IllegalStateException {
// Vérifie si la classe n'est pas null
if (struct == null) {
// Sauvgarde avec la géstion des accès concurrents
try {
- if (!periode.save(flush: true)) {
- throw new SauvegardeEchoueException(periode)
- }
+ periode.save(flush: true, failOnError: true)
} catch (DataIntegrityViolationException ex) {
periode = Periode.findByTypePeriodeAndClasse(tp[intervalle], struct)
}
package org.lilie.services.eliot.scolarite
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
-
/**
* Gestion des Sous-Services
*/
static transactional = true
-
- /**
- * Compte tous les sous-services
- */
- Long internalCompteTous() {
- return SousService.count()
- }
-
- /**
- * Sauvegarde un sous-service
- * @param sousService
- */
- SousService save(SousService sousService) throws SauvegardeEchoueException {
- if (!sousService.save(flush: true)) {
- throw new SauvegardeEchoueException(sousService)
- }
- return sousService
- }
-
-
- /**
- * Supprime tous les sous-services
- */
- void internalSupprimeTous() {
- SousService.withSession { session ->
- session.createQuery("delete SousService s").executeUpdate()
- }
- }
-
-
}
package org.lilie.services.eliot.scolarite
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
-
/**
* TypePeriode service
* @author msan
)
// Sauvgarde avec la géstion des accès concurrents
try {
- if (!typePeriode.save(flush: true)) {
- throw new SauvegardeEchoueException(typePeriode)
- }
+ typePeriode.save(flush: true,failOnError: true)
} catch (Exception ex) {// TOREFACT : refaire la gestion de concurrence
typePeriode = TypePeriode.findByIntervalle(intervalle, [cache:true])
}
* <http://www.cecill.info/licences.fr.html>.
*/
-
-
-
-
-
-
package org.lilie.services.eliot.scolarite.matiere
import org.lilie.services.eliot.temps.importsts.info.StsMatiereInfo
import org.hibernate.FetchMode
import org.lilie.services.eliot.securite.impl.Autorite
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.exception.SuppresionEchoueException
import org.lilie.services.eliot.securite.AutorisationException
import org.springframework.dao.DataIntegrityViolationException
-import org.hibernate.exception.ConstraintViolationException
import org.lilie.services.eliot.annuaire.SecuriteSession
-import org.lilie.services.eliot.annuaire.FonctionEnum
import org.lilie.services.eliot.GormUtils
import org.lilie.services.eliot.scolarite.Matiere
import org.lilie.services.eliot.scolarite.Etablissement
* @return la matière créée ou modifiée
* @throws AutorisationException si l'utilisateur n'a pas la permission de
* réaliser l'opération
- * @throws SauvegardeEchoueException si la sauvegarde a échoué
* @author jtra
*/
Matiere insertUpdateMatiere(SecuriteSession securiteSession,
CreeMatiereParam creeMatiereParam)
- throws AutorisationException, SauvegardeEchoueException {
+ throws AutorisationException {
// TOREFACT gérer droits pour fonctionnalités et fonctions paramétrables
// verifieCreeMatiere(securiteSession, creeMatiereParam.etablissement)
* @throws IllegalStateException si la matière n'a pas pu être créée
*/
Matiere creeMatiereFromSTS(StsMatiereInfo matInfo)
- throws SauvegardeEchoueException, MatiereCodeGestionUniqueException {
+ throws MatiereCodeGestionUniqueException {
CreeMatiereParam creeMatiereParam = new CreeMatiereParam(
// idExterne: matInfo.idExterne,
* créer une matière sur l'établissement
* @throws MatiereCodeGestionUniqueException si le codeGestion est déjà
* utilisé pour cet établissement
- * @throws SauvegardeEchoueException si la création de la matière a échouée
- * pour une autre raison
* @author mjao
*/
Matiere creeMatiereManuel(SecuriteSession securiteSession,
Etablissement etablissement,
String codeGestion,
String libelleLong,
- Boolean specialite
- )
+ Boolean specialite)
throws MatiereCodeGestionUniqueException,
- SauvegardeEchoueException,
AutorisationException {
// Vérifier l'autorisation de suppression
String libelleLong,
Boolean specialite)
throws MatiereCodeGestionUniqueException,
- SauvegardeEchoueException,
IllegalArgumentException,
AutorisationException {
* modifier la matière
* @throws MatiereCodeGestionUniqueException si le nouveau codeGestion est
* déjà utilisé pour cet établissement
- * @throws SauvegardeEchoueException si la sauvegarde a échouée pour une
- * autre raison que l'unicité du codeGestion
* @author mjao
*/
Matiere modifieMatiereAutomatique(SecuriteSession securiteSession,
String libelleLong,
Boolean specialite)
throws AutorisationException,
- MatiereCodeGestionUniqueException,
- SauvegardeEchoueException {
+ MatiereCodeGestionUniqueException {
// verifie l'autorisation de modification
// TOREFACT gérer droits pour fonctionnalités et fonctions paramétrables
* @author jtra
* @throws MatiereCodeGestionUniqueException si le code de gestion est
* déjà utilisé pour cet établissement
- * @throws SauvegardeEchoueException si la sauvegarde a échouée pour une autre
- * raison
*/
private Matiere internalCreeMatiere(CreeMatiereParam matiereInfo)
- throws SauvegardeEchoueException, MatiereCodeGestionUniqueException {
+ throws MatiereCodeGestionUniqueException {
Closure action = {
if (!matiereInfo.libelleCourt) {
specialite: matiereInfo.specialite
)
- if (!matiere.save(flush: true)) {
- // Note jtra: il faut créer une exception dédiée
- throw new SauvegardeEchoueException(matiere)
- }
+ matiere.save(flush: true, failOnError: true)
return matiere
}
Closure onDataIntegrityViolation = { DataIntegrityViolationException e ->
- Matiere matiere = new Matiere(
- libelleCourt: matiereInfo.libelleCourt?.toUpperCase(),
- libelleLong: matiereInfo.libelleLong,
- libelleEdition: matiereInfo.libelleEdition,
- codeGestion: matiereInfo.codeGestion,
- codeSts: matiereInfo.codeSts,
- origine: matiereInfo.origine,
- etablissement: matiereInfo.etablissement,
- specialite: matiereInfo.specialite
- )
-
- // Lève l'exception Eliot correspondante
- declencheSauvegardeException(
- e,
- matiere
- )
+ log.error("Enrigistrement de la matière a échoué", e)
+ throw e
}
return (Matiere) GormUtils.withSavepoint(action, onDataIntegrityViolation)
* une raison inconnue
*/
private Matiere internalModifieMatiere(Matiere matiere)
- throws MatiereCodeGestionUniqueException, SauvegardeEchoueException {
+ throws MatiereCodeGestionUniqueException {
Closure action = {
Matiere matiereAModifier = Matiere.get(matiere.id)
matiereAModifier.libelleEdition = matiere.codeGestion
}
- if (!matiereAModifier.save(flush: true)) {
- throw new SauvegardeEchoueException(matiere)
- }
+ matiereAModifier.save(flush: true, failOnError: true)
return matiereAModifier
}
Closure onDataIntegrityViolation = { DataIntegrityViolationException e ->
- // Lève l'exception Eliot correspondante
- declencheSauvegardeException(
- e,
- matiere
- )
+ log.error("Enrigistrement de la matière a échoué", e)
+ throw e
}
return (Matiere)GormUtils.withSavepoint(action, onDataIntegrityViolation)
}
}
- /**
- * Verifier que le directeur de l'etablissement est le seul autorisé pour la modification ou creation
- * @param securiteSession
- * @param Etablissement
- * @author mjao
- */
- void verifieAutorisationModifierMatiereManuel(SecuriteSession securiteSession,
- Etablissement etablissement) throws AutorisationException {
-
- if (!securiteSession.hasFonctionIn([FonctionEnum.DIRECTION], etablissement.id) &&
- !securiteSession.hasFonctionIn([FonctionEnum.ADMIN_LOCAL], etablissement.id)) {
- throw AutorisationException.modificationContenuException()
- }
- }
- /**
- * Verifier que le directeur de l'etablissement est le seul autorisé pour la suppression
- * @param securiteSession
- * @param Etablissement
- * @author mjao
- */
- void verifieAutorisationsupprimeMatiereManuel(SecuriteSession securiteSession,
- Etablissement etablissement) throws AutorisationException {
-
- if (!securiteSession.hasFonctionIn([FonctionEnum.DIRECTION], etablissement.id) &&
- !securiteSession.hasFonctionIn([FonctionEnum.ADMIN_LOCAL], etablissement.id)) {
- throw AutorisationException.suppressionException()
- }
- }
-
- /**
- * Converti une DataIntegrityViolationException levée par une sauvegarde
- * en base d'une Matiere en exception Eliot
- * @param e l'exception à convertir
- * @param matiere l'objet matière
- * @return l'exception Eliot correspondant
- * @author jtra
- */
- private declencheSauvegardeException(DataIntegrityViolationException e,
- Matiere matiere)
- throws MatiereCodeGestionUniqueException, SauvegardeEchoueException {
- Throwable cause = e.getCause()
-
- if (cause instanceof ConstraintViolationException) {
- throw new MatiereCodeGestionUniqueException()
- }
-
- // Cas par défaut
- throw new SauvegardeEchoueException(matiere, e)
- }
-
public Matiere findMatiere(Etablissement etablissement,
String codeGestionMatiere,
AnneeScolaire anneeScolaire){
package org.lilie.services.eliot.scolarite.personne.eleve
import org.lilie.services.eliot.annuaire.SecuriteSession
-import org.lilie.services.eliot.securite.AutorisationException
-import org.lilie.services.eliot.annuaire.FonctionEnum
import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.scolarite.FicheEleveCommentaire
import org.lilie.services.eliot.scolarite.Personne
import org.lilie.services.eliot.scolarite.StructureEnseignement
}
fec.texte = commentaire
- fec.save(flush: true)
-
- if (fec.hasErrors()) {
- throw new SauvegardeEchoueException(fec)
- }
+ fec.save(flush: true, failOnError: true)
return fec
}
package org.lilie.services.eliot.notes
import org.lilie.services.eliot.securite.AutorisationException
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.codehaus.groovy.grails.web.converters.exceptions.ConverterException
import org.lilie.services.eliot.notes.exception.PeriodeVerrouilleException
import org.lilie.services.eliot.notes.exception.PeriodeNonPublieException
}
),
- SAUVEGARDE_ECHOUE_EXCEPTION(
- SauvegardeEchoueException,
- { def controller, Exception e ->
- controller.message(code: 'eliot.notes.message.exception')
- }
- ),
-
CONVERTER_EXCEPTION(
ConverterException,
{ def controller, Exception e ->
import org.lilie.services.eliot.scolarite.Service
import org.lilie.services.eliot.securite.AutorisationException
import org.lilie.services.eliot.securite.impl.Autorite
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.hibernate.FetchMode
import org.lilie.services.eliot.exception.SuppresionEchoueException
import org.lilie.services.eliot.scolarite.Etablissement
import org.lilie.services.eliot.notes.scolarite.NotesSousServiceService
import org.lilie.services.eliot.notes.exception.PeriodeVerrouilleException
import org.lilie.services.eliot.notes.NotesDroitService
-import org.hibernate.exception.ConstraintViolationException
import org.lilie.services.eliot.annuaire.SecuriteSession
import org.lilie.services.eliot.notes.utils.NotesHibernateSessionService
import org.lilie.services.eliot.scolarite.ModaliteMatiere
return evaluationsEvaluables
}
- /**
- * Mis à jour de la moyenne d'évaluation
- * @author msan
- */
- Evaluation internalMAJMoyenne(Evaluation evaluation, BigDecimal moyenne) {
- evaluation.moyenne = moyenne
- try {
- if (!evaluation.save(flush: true)) {
- throw new SauvegardeEchoueException(evaluation)
- }
- } catch (ConstraintViolationException e) {
- throw new SauvegardeEchoueException(evaluation, e)
- }
- return evaluation
- }
/**
* Crée une évaluation
params.typePeriode,
params.modaliteMatiere)
- if (!evaluation.save(flush: true) || evaluation.hasErrors()) {
- throw new SauvegardeEchoueException(evaluation)
- }
+ evaluation.save(flush: true, failOnError: true)
if(evaluation.publiable && grailsApplication.config.eliot.notification.actif) {
notesNotificationService.publieEvaluation(evaluation)
Evaluation modifieEvaluation(EvaluationParams params)
throws AutorisationException,
IllegalArgumentException,
- SauvegardeEchoueException,
PeriodeVerrouilleException,
NoteMaxNonValideException {
evaluation.ramenerSur20 = params.ramenerSur20
}
- if (!evaluation.save(flush: true) || evaluation.hasErrors()) {
- throw new SauvegardeEchoueException(evaluation)
- }
+ evaluation.save(flush: true, failOnError: true)
if(nouvellementPubliable && grailsApplication.config.eliot.notification.actif) {
notesNotificationService.publieEvaluation(evaluation)
// Rattache la periode à l'évaluation
evaluation.addToPeriodes(periode)
- if (!evaluation.save(flush: true)) {
- throw new SauvegardeEchoueException(evaluation)
- }
+ evaluation.save(flush: true, failOnError: true)
}
/**
import org.lilie.services.eliot.scolarite.Periode
import org.lilie.services.eliot.notes.Evaluation
import org.lilie.services.eliot.notes.Note
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.exception.SuppresionEchoueException
import org.hibernate.exception.ConstraintViolationException
import org.lilie.services.eliot.scolarite.SousService
* non numérique sont null la note est supprimée de la base.
* @author bper
*/
- Note internalEnregistreNote(NoteParams params)
- throws IllegalArgumentException, SauvegardeEchoueException {
+ Note internalEnregistreNote(NoteParams params) {
if (!params.eleve) {
throw new IllegalArgumentException("Le paramètre {eleve} ne doit pas être null")
import org.lilie.services.eliot.scolarite.Periode
import org.lilie.services.eliot.scolarite.PeriodeService
import org.lilie.services.eliot.scolarite.StructureEnseignement
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.scolarite.structureenseignement.LocalStructureEnseignementService
import org.lilie.services.eliot.scolarite.Personne
import org.springframework.context.ApplicationContext
* Evaluation modifiée (coefficient)/supprimée. Marque les resultats à recalculer.
*/
void marqueDirtyEvaluation(Evaluation evaluation,
- ModaliteMatiere ancienneModaliteMatiere = null)
- throws SauvegardeEchoueException {
+ ModaliteMatiere ancienneModaliteMatiere = null) {
Enseignement enseignement = evaluation.enseignement
Service service = enseignement.service
void marqueDirtyEleves(List<Autorite> eleves,
Periode periode,
Enseignement enseignement,
- List<ModaliteMatiere> modaliteMatieres)
- throws SauvegardeEchoueException {
+ List<ModaliteMatiere> modaliteMatieres) {
StructureEnseignement classe = periode.classe
* Service a changé. Marque les resultats à recalculer.
* @param marqueServiceResultats - normalement on marque les resultats eleve
* et classe (pas *_service)
- * @throws SauvegardeEchoueException
* @author msan
*/
void marqueDirtyService(Service service,
- Boolean marqueServiceResultats = false)
- throws SauvegardeEchoueException {
+ Boolean marqueServiceResultats = false) {
StructureEnseignement structureEnseignement = service.structureEnseignement
import org.lilie.services.eliot.scolarite.RelPeriodeServiceService
import org.lilie.services.eliot.scolarite.TypeIntervalleEnum
import org.lilie.services.eliot.scolarite.IntervalleEnum
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.scolarite.ServiceService
import org.lilie.services.eliot.scolarite.TypePeriode
* @return true
* @author msan
*/
- private void basculeVersTrimestre(StructureEnseignement classe)
- throws SauvegardeEchoueException {
+ private void basculeVersTrimestre(StructureEnseignement classe) {
List<Periode> periodes = classe.periodes as List
* Set type d'intervalle de période
* @author msan
*/
- private void setTypeIntervalle(Periode periode, IntervalleEnum intervalleEnum)
- throws SauvegardeEchoueException {
+ private void setTypeIntervalle(Periode periode, IntervalleEnum intervalleEnum) {
periode.typePeriode = typePeriodeService.getTypePeriode(intervalleEnum)
periode.save(flush: true, failOnError: true)
}
* @author bper
*/
Periode creePeriodeExamen(PeriodeParams periodeParams)
- throws AutorisationException, IllegalArgumentException, SauvegardeEchoueException {
+ throws AutorisationException, IllegalArgumentException {
TypePeriode typePeriode = periodeParams.typePeriode
StructureEnseignement classe = periodeParams.classe
import org.lilie.services.eliot.scolarite.RelPeriodeService
import org.lilie.services.eliot.scolarite.Periode
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.scolarite.RelPeriodeServiceService
import org.lilie.services.eliot.scolarite.Service
import org.lilie.services.eliot.scolarite.SousService
/**
* Get relations
- * @param periode
- * @param ordre
- * @return
*/
List<RelPeriodeService> getRels(Periode periode, Integer ordre) {
return RelPeriodeService.withCriteria {
/**
* Change l'ordre d'un service.
* Gére le reordonencement si necessaire.
- * @param rel
- * @param ordre
* @return true si reordonencement necessaire
* @author msan
*/
- Boolean internalChangeOrdre(RelPeriodeService rel, Integer ordre)
- throws SauvegardeEchoueException {
+ Boolean internalChangeOrdre(RelPeriodeService rel, Integer ordre) {
Periode periode = rel.periode
Boolean ordreChange = false
/**
* Modifie la relation entre un service & une période
- * @param service
- * @param periode
- * @param notesPeriodeParams
- * @param creationService
- * @return
*/
private ModifieRelPeriodeServiceResultat internalModifieRelPeriodeService(Service service,
Periode periode,
/**
* Désactive les modalité matières
- * @param service
* @return true si besoin de recharger la page
*/
- private Boolean desactiveModaliteMatieres(Service service, Periode periode)
- throws SauvegardeEchoueException {
+ private Boolean desactiveModaliteMatieres(Service service, Periode periode) {
// Vérifie si le service est actif
/*if (!service.actif) {
package org.lilie.services.eliot.notes.scolarite
import org.lilie.services.eliot.securite.AutorisationException
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.hibernate.FetchMode
import org.lilie.services.eliot.scolarite.ServiceService
import org.lilie.services.eliot.scolarite.Service
* @author bper
* @author jtra
*/
- ResultatModification creeService(NotesServiceSaveParams notesServiceSaveParams)
- throws SauvegardeEchoueException {
+ ResultatModification creeService(NotesServiceSaveParams notesServiceSaveParams) {
verifieCreeServiceParams(notesServiceSaveParams.serviceParams)
import org.lilie.services.eliot.scolarite.TypePeriode
import org.lilie.services.eliot.notes.resultat.UptodateService
import org.lilie.services.eliot.notes.notes.NotesEvaluationService
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.scolarite.NaturePeriode
import org.lilie.services.eliot.scolarite.StructureEnseignement
import org.lilie.services.eliot.notes.resultat.eleve.ResultatEleveSousServicePeriodeService
* Trouve ou crée les sous-services pour un service et typePeriode
*/
List<SousService> internalFindAllOrCreeSousServices(Service service,
- TypePeriode typePeriode)
- throws SauvegardeEchoueException {
+ TypePeriode typePeriode) {
List<SousService> sousServices = []
List<ModaliteMatiere> mms = listeModaliteMatieres(service)
if (mms?.size() > 0) {
SousService internalCreeSousService(Service service,
TypePeriode typePeriode,
ModaliteMatiere modaliteMatiere,
- Boolean evaluable = false)
- throws SauvegardeEchoueException {
+ Boolean evaluable = false) {
SousService sousService = new SousService(
modaliteMatiere: modaliteMatiere,
coeff: 1 // par défaut
)
- return this.save(sousService)
+ sousService.save(flush: true, failOnError: true)
+
+ return sousService
}
/**
/**
* Modifie un sous-service
*/
- ResultatModification modifieSousService(NotesModaliteMatiereParams params)
- throws SauvegardeEchoueException {
+ ResultatModification modifieSousService(NotesModaliteMatiereParams params) {
return creeOrModifieSousService(params, false)
}
* Ajout sous-services pour un nouvel typePeriode. Pour chaque modalité
* matière déjà lié au service, on ajoute un sous-service pour le typePeriode
* passé
- * @param services
- * @param typePeriode
* @author msan
*/
void internalAjouteSousServicesPourTypePeriode(List<Service> services,
- TypePeriode typePeriode)
- throws SauvegardeEchoueException {
+ TypePeriode typePeriode) {
List dejaFaitList = [] // pour marquer quel services + mms ont été déjà fait
services.each { Service service ->
SousService ssT3 = internalGetSousService(sousService, tpT3)
ssT3.evaluable = true
ssT3.coeff = 1
- this.save(ssT3)
+ ssT3.save(flush: true, failOnError: true)
ssAajouter << ssT3
mmList.add(sousService.modaliteMatiere.code)
nouvelSS.evaluable = sousService.evaluable
nouvelSS.coeff = sousService.coeff
nouvelSS.ordre = sousService.ordre
- this.save(nouvelSS)
+ nouvelSS.save(flush: true, failOnError: true)
return nouvelSS
}
import org.lilie.services.eliot.scolarite.Etablissement
import org.lilie.services.eliot.scolarite.StructureEnseignement
import org.lilie.services.eliot.scolarite.Periode
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.springframework.dao.DataIntegrityViolationException
import org.lilie.services.eliot.notes.exception.TypePeriodeLibelleNonUniqueException
import org.lilie.services.eliot.scolarite.Service
// Engregistre le type de période
try {
- if (!typePeriode.save(flush: true)) {
- throw new SauvegardeEchoueException(typePeriode)
- }
+ typePeriode.save(flush: true, failOnError: true)
} catch (DataIntegrityViolationException ex) {
throw new TypePeriodeLibelleNonUniqueException(typePeriode, ex)
}
import org.lilie.services.eliot.scolarite.Matiere
import org.lilie.services.eliot.scolarite.AbstractScolariteController
import org.lilie.services.eliot.scolarite.matiere.MatiereCodeGestionUniqueException
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.EliotConstantes
import org.lilie.services.eliot.exception.SuppresionEchoueException
import org.lilie.services.eliot.scolarite.matiere.MatiereNonSupprimableException
msg = message(code: 'eliot.scolarite.messages.matiereCreationcodeGestionNonUnique')
sauvegardeOk = false
- } catch (SauvegardeEchoueException e) {
+ } catch (Exception e) {
msg = message(code: 'eliot.scolarite.messages.matiereSauvegardeEchou')
sauvegardeOk = false
}
} catch (MatiereCodeGestionUniqueException e) {
sauvegardeOk = false
msg = message(code: 'eliot.scolarite.messages.matiereModificationcodeGestionNonUnique')
- } catch (SauvegardeEchoueException e) {
+ } catch (Exception e) {
msg = message(code: 'eliot.scolarite.messages.matiereSauvegardeEchou')
sauvegardeOk = false
}
package org.lilie.services.eliot.scolarite.domaine
import org.lilie.services.eliot.scolarite.matiere.MatiereCodeGestionUniqueException
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.lilie.services.eliot.scolarite.ModaliteMatiereService
import org.lilie.services.eliot.scolarite.AbstractScolariteController
import grails.converters.JSON
} catch (MatiereCodeGestionUniqueException e) {
sauvegardeOk = false
msg = message(code: 'eliot.scolarite.messages.modaliteCreationcodeGestionNonUnique')
- } catch (SauvegardeEchoueException e) {
+ } catch (Exception e) {
msg = message(code: 'eliot.scolarite.messages.matiereSauvegardeEchou')
sauvegardeOk = false
}
} catch (MatiereCodeGestionUniqueException e) {
msg = message(code: 'eliot.scolarite.messages.modaliteModificationcodeGestionNonUnique')
sauvegardeOk = false
- } catch (SauvegardeEchoueException e) {
+ } catch (Exception e) {
msg = message(code: 'eliot.scolarite.messages.matiereSauvegardeEchou')
sauvegardeOk = false
}
package org.lilie.services.eliot
import org.lilie.services.eliot.securite.AutorisationException
-import org.lilie.services.eliot.exception.SauvegardeEchoueException
import org.codehaus.groovy.grails.web.converters.exceptions.ConverterException
import org.lilie.services.eliot.menu.MenuInfo
import org.lilie.services.eliot.textes.page.Page
import org.lilie.services.eliot.textes.CahierDeTextes
import org.lilie.services.eliot.urllabel.aide.AideItemInfo
import org.lilie.services.eliot.breadcrumbs.MenuAideTextesService
-import org.lilie.services.eliot.textes.DateActivite
import org.lilie.services.eliot.textes.activite.TextesActiviteService
import org.lilie.services.eliot.scolarite.Etablissement
import org.lilie.services.eliot.forum.EtatDiscussion
log.error(ERREUR_TEXTES, ex)
errorMsg = message(code: AUTORISATION_EXCEPTION)
}
- catch (SauvegardeEchoueException ex) {
- success = false
- log.error(ERREUR_TEXTES, ex)
- errorMsg = message(code: EXCEPTION)
- }
catch (ConverterException ex) {
success = false
log.error(ERREUR_TEXTES, ex)