use of fr.univlorraine.ecandidat.entities.ecandidat.Parametre in project esup-ecandidat by EsupPortail.
the class NomenclatureController method majParametre.
/**
* Met a jour un type de decision
* @param typeDec
*/
private void majParametre(final Parametre param) {
// MethodUtils.validateBean(param, logger);
final Parametre paramLoad = parametreRepository.findByCodParam(param.getCodParam());
if (paramLoad == null) {
parametreRepository.saveAndFlush(param);
} else {
paramLoad.setLibParam(param.getLibParam());
paramLoad.setTemAffiche(param.getTemAffiche());
paramLoad.setTypParam(param.getTypParam());
parametreRepository.saveAndFlush(paramLoad);
}
}
use of fr.univlorraine.ecandidat.entities.ecandidat.Parametre in project esup-ecandidat by EsupPortail.
the class ParametreController method changeParametreGestionCandidat.
/**
* Modifie le parametre de date SVA
* @param listener
* @param parametreValue
*/
public void changeParametreGestionCandidat(final GestionnaireCandidatListener listener, final String codeParam, final String parametreValue, final String title) {
final Parametre parametre = getParametre(codeParam);
/* Verrou */
if (!lockController.getLockOrNotify(parametre, null)) {
return;
}
if (parametre != null && parametreValue != null && !parametre.getValParam().equals(parametreValue)) {
listener.changeModeGestionnaireCandidat();
Notification.show(applicationContext.getMessage("droitprofilind.gestCandidat.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
lockController.releaseLock(parametre);
return;
}
final ScolGestCandidatWindow win = new ScolGestCandidatWindow(parametre, title);
win.addChangeGestCandidatWindowListener(e -> {
parametreRepository.saveAndFlush(parametre);
cacheController.reloadMapParametre(true);
listener.changeModeGestionnaireCandidat();
});
win.addCloseListener(e -> lockController.releaseLock(parametre));
UI.getCurrent().addWindow(win);
}
use of fr.univlorraine.ecandidat.entities.ecandidat.Parametre in project esup-ecandidat by EsupPortail.
the class ParametreController method changeMaintenanceParam.
/**
* Met en maintenance ou en service l'application-->batch
* @param enMaintenance
*/
public void changeMaintenanceParam(final Boolean enMaintenance) {
final Parametre parametre = cacheController.getMapParametre().get(NomenclatureUtils.COD_PARAM_TECH_IS_MAINTENANCE);
if (parametre != null) {
parametre.setValParam(MethodUtils.getTemoinFromBoolean(enMaintenance));
parametreRepository.saveAndFlush(parametre);
cacheController.reloadMapParametre(true);
}
}
use of fr.univlorraine.ecandidat.entities.ecandidat.Parametre in project esup-ecandidat by EsupPortail.
the class ParametreController method changeMaintenanceStatut.
/**
* Met en maintenance ou en service l'application-->Bouton
* @param enMaintenance
* @param listener
*/
public void changeMaintenanceStatut(final Boolean enMaintenance, final MaintenanceListener listener) {
final Parametre parametre = getParametre(NomenclatureUtils.COD_PARAM_TECH_IS_MAINTENANCE);
final Boolean oldMaintenanceStatut = MethodUtils.getBooleanFromTemoin(parametre.getValParam());
/* Verrou */
if (!lockController.getLockOrNotify(parametre, null)) {
return;
}
if (enMaintenance.equals(oldMaintenanceStatut)) {
String message = "admin.maintenance.nocorrect.";
if (enMaintenance) {
message += "shutdown";
} else {
message += "wakeup";
}
listener.changeModeMaintenance();
Notification.show(applicationContext.getMessage(message, null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
lockController.releaseLock(parametre);
} else {
String message = "admin.maintenance.confirm.";
if (enMaintenance) {
message += "shutdown";
} else {
message += "wakeup";
}
final ConfirmWindow win = new ConfirmWindow(applicationContext.getMessage(message, null, UI.getCurrent().getLocale()));
win.addBtnOuiListener(e -> {
changeMaintenanceParam(enMaintenance);
listener.changeModeMaintenance();
});
win.addCloseListener(e -> lockController.releaseLock(parametre));
UI.getCurrent().addWindow(win);
}
}
use of fr.univlorraine.ecandidat.entities.ecandidat.Parametre in project esup-ecandidat by EsupPortail.
the class NomenclatureController method cleanNomenclature.
/**
* Methode permettant de supprimer des élements déja insérés
*/
public void cleanNomenclature() {
final Version versionNomenclature = versionRepository.findOne(NomenclatureUtils.VERSION_NOMENCLATURE_COD);
if (versionNomenclature == null) {
return;
}
/* Definition locale */
final String localFrString = "fr";
final Locale localFr = new Locale(localFrString);
final RealeaseVersion vNomenclature = new RealeaseVersion(versionNomenclature.getValVersion());
// si inferieur a 2.2.0.6
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_2_0_6))) {
/* Suppression du mail de proposition */
Mail mailLoad = mailRepository.findByCodMail("PROP_CANDIDATURE");
if (mailLoad != null) {
mailRepository.delete(mailLoad);
}
/* Suppression des codes par domaine : CPT_MIN_ et CANDIDATURE_ */
mailLoad = mailRepository.findByCodMail("MOD_MAIL_CPT_MIN");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_CPT_MIN_MOD_MAIL);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("ID_OUBLIE");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_CPT_MIN_ID_OUBLIE);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("COMMISSION_PROP");
if (mailLoad != null) {
mailLoad.setCodMail("CANDIDATURE_COMMISSION_PROP");
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("COMMISSION_ANNUL");
if (mailLoad != null) {
mailLoad.setCodMail("CANDIDATURE_COMMISSION_ANNUL");
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("ANNUL_CANDIDATURE");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_CANDIDATURE_ANNULATION);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("CONFIRM_CANDIDATURE");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_CANDIDATURE_CONFIRM);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("DESIST_CANDIDATURE");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_CANDIDATURE_DESIST);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("CANDIDATURE_COMMISSION_PROP");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_COMMISSION_ALERT_PROPOSITION);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("CANDIDATURE_COMMISSION_ANNUL");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_COMMISSION_ALERT_ANNULATION);
mailRepository.saveAndFlush(mailLoad);
}
mailLoad = mailRepository.findByCodMail("CANDIDATURE_COMMISSION_TRANS");
if (mailLoad != null) {
mailLoad.setCodMail(NomenclatureUtils.MAIL_COMMISSION_ALERT_TRANSMISSION);
mailRepository.saveAndFlush(mailLoad);
}
final Parametre paramLoad = parametreRepository.findByCodParam("NB_VOEUX_CTR_MAX");
if (paramLoad != null) {
parametreRepository.delete(paramLoad);
}
/* Actualisation du code du batch LS */
final Batch batchLS = batchRepository.findOne("BATCH_SYNC_LIMESURVEY");
if (batchLS != null) {
final List<BatchHisto> listeHisto = batchLS.getBatchHistos();
batchLS.setCodBatch(NomenclatureUtils.BATCH_SYNCHRO_LIMESURVEY);
final Batch batchLSNew = batchRepository.save(batchLS);
listeHisto.forEach(e -> {
final BatchHisto newBatchHisto = e.clone(batchLSNew);
batchHistoRepository.saveAndFlush(newBatchHisto);
batchHistoRepository.delete(e);
});
batchRepository.delete("BATCH_SYNC_LIMESURVEY");
}
/* Correction des accents sur preselection */
final String oldLower = applicationContext.getMessage("nomenclature.correction.preselection.lower.old", null, localFr);
final String newLower = applicationContext.getMessage("nomenclature.correction.preselection.lower.new", null, localFr);
final String oldUpper = applicationContext.getMessage("nomenclature.correction.preselection.upper.old", null, localFr);
final String newUpper = applicationContext.getMessage("nomenclature.correction.preselection.upper.new", null, localFr);
// corrige les mails lib + traduction sujet et corps
final List<Mail> listeMail = mailRepository.findAll();
listeMail.forEach(mail -> {
if (mail.getLibMail() != null) {
Boolean find = false;
if (mail.getLibMail().contains(oldLower)) {
mail.setLibMail(mail.getLibMail().replaceAll(oldLower, newLower));
find = true;
}
if (mail.getLibMail().contains(oldUpper)) {
mail.setLibMail(mail.getLibMail().replaceAll(oldUpper, newUpper));
find = true;
}
if (find) {
mailRepository.save(mail);
}
correctionI18n(mail.getI18nCorpsMail(), localFrString, oldLower, newLower);
correctionI18n(mail.getI18nCorpsMail(), localFrString, oldUpper, newUpper);
correctionI18n(mail.getI18nSujetMail(), localFrString, oldLower, newLower);
correctionI18n(mail.getI18nSujetMail(), localFrString, oldUpper, newUpper);
}
});
// corrige les types de decision
final List<TypeDecision> listeTypeDecision = typeDecisionRepository.findAll();
listeTypeDecision.forEach(typeDec -> {
Boolean find = false;
if (typeDec.getLibTypDec().contains(oldLower)) {
typeDec.setLibTypDec(typeDec.getLibTypDec().replaceAll(oldLower, newLower));
find = true;
}
if (typeDec.getLibTypDec().contains(oldUpper)) {
typeDec.setLibTypDec(typeDec.getLibTypDec().replaceAll(oldUpper, newUpper));
find = true;
}
if (find) {
typeDecisionRepository.save(typeDec);
}
correctionI18n(typeDec.getI18nLibTypDec(), localFrString, oldLower, newLower);
correctionI18n(typeDec.getI18nLibTypDec(), localFrString, oldUpper, newUpper);
});
}
/* Ajout du libellé de la campagne */
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_2_0_13))) {
final List<Campagne> listeCampagne = campagneRepository.findAll();
listeCampagne.forEach(campagne -> {
if (campagne.getI18nLibCamp() == null) {
final TypeTraduction typeTrad = typeTraductionRepository.saveAndFlush(new TypeTraduction(NomenclatureUtils.TYP_TRAD_CAMP_LIB, applicationContext.getMessage("nomenclature.typtrad.campLib", null, new Locale("fr")), 500));
final I18n i18n = i18nRepository.saveAndFlush(new I18n(typeTrad));
final I18nTraduction trad = new I18nTraduction(campagne.getLibCamp(), i18n, cacheController.getLangueDefault());
i18nTraductionRepository.saveAndFlush(trad);
campagne.setI18nLibCamp(i18n);
campagneRepository.saveAndFlush(campagne);
}
});
}
/* On supprime les entrées dans la table de reload car les codes ne sont plus bons */
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_2_0_14))) {
loadBalancingReloadRepository.deleteAllInBatch();
}
/* Correction libellé mail oubli */
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_2_3_0))) {
/* Modif libellé du mail d'oubli */
final Mail mailLoad = mailRepository.findByCodMail(NomenclatureUtils.MAIL_CPT_MIN_ID_OUBLIE);
if (mailLoad != null) {
mailLoad.setLibMail(applicationContext.getMessage("nomenclature.mail.idOublie", null, localFr));
mailRepository.save(mailLoad);
}
}
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_2_5_1))) {
/* Ajout de l'info comp de la formation aux i18n */
final TypeTraduction typeTradForm = typeTraductionRepository.saveAndFlush(new TypeTraduction(NomenclatureUtils.TYP_TRAD_FORM_INFO_COMP, applicationContext.getMessage("nomenclature.typtrad.formInfoComp", null, new Locale("fr")), 5000));
final List<Formation> listeFormation = formationRepository.findAll();
listeFormation.forEach(formation -> {
if (formation.getI18nInfoCompForm() == null && formation.getInfoCompForm() != null) {
final I18n i18n = i18nRepository.saveAndFlush(new I18n(typeTradForm));
final I18nTraduction trad = new I18nTraduction(formation.getInfoCompForm(), i18n, cacheController.getLangueDefault());
i18nTraductionRepository.saveAndFlush(trad);
formation.setI18nInfoCompForm(i18n);
formationRepository.saveAndFlush(formation);
}
});
/* Ajout du commentaire retour de la commission aux i18n */
final TypeTraduction typeTradComm = typeTraductionRepository.saveAndFlush(new TypeTraduction(NomenclatureUtils.TYP_TRAD_COMM_COMMENT_RETOUR, applicationContext.getMessage("nomenclature.typtrad.commCommentRetour", null, new Locale("fr")), 5000));
final List<Commission> listeCommission = commissionRepository.findAll();
listeCommission.forEach(commission -> {
if (commission.getI18nCommentRetourComm() == null && commission.getCommentRetourComm() != null) {
final I18n i18n = i18nRepository.saveAndFlush(new I18n(typeTradComm));
final I18nTraduction trad = new I18nTraduction(commission.getCommentRetourComm(), i18n, cacheController.getLangueDefault());
i18nTraductionRepository.saveAndFlush(trad);
commission.setI18nCommentRetourComm(i18n);
commissionRepository.saveAndFlush(commission);
}
});
}
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_2_9_1))) {
// on renomme le parametre COD_SANS_BAC
final Parametre paramCodSansBac = parametreRepository.findByCodParam("COD_SANS_BAC");
if (paramCodSansBac != null) {
final Parametre newParamCodSansBac = new Parametre(NomenclatureUtils.COD_PARAM_SCOL_SISCOL_COD_SANS_BAC, applicationContext.getMessage("parametrage.codParam.siScolCodSansBac", null, localFr), paramCodSansBac.getValParam(), NomenclatureUtils.TYP_PARAM_STRING + "(4)", true, true);
parametreRepository.save(newParamCodSansBac);
parametreRepository.delete(paramCodSansBac);
}
}
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_3_0_0))) {
// on renomme les codes des paramètres
/* Paramètres OPI */
renameCodParam("PREFIXE_OPI", NomenclatureUtils.COD_PARAM_OPI_PREFIXE, localFr);
renameCodParam("IS_UTILISE_OPI", NomenclatureUtils.COD_PARAM_OPI_IS_UTILISE, localFr);
renameCodParam("IS_UTILISE_OPI_ADR", NomenclatureUtils.COD_PARAM_OPI_IS_UTILISE_ADR, localFr);
renameCodParam("NB_OPI_BATCH_MAX", NomenclatureUtils.COD_PARAM_OPI_NB_BATCH_MAX, localFr);
renameCodParam("IS_UTILISE_OPI_PJ", NomenclatureUtils.COD_PARAM_OPI_IS_UTILISE_PJ, localFr);
renameCodParam("IS_OPI_IMMEDIAT", NomenclatureUtils.COD_PARAM_OPI_IS_IMMEDIAT, localFr);
/* Paramètres SVA */
renameCodParam("ALERT_SVA_DAT", NomenclatureUtils.COD_PARAM_SVA_ALERT_DAT, localFr);
renameCodParam("ALERT_SVA_DEFINITIF", NomenclatureUtils.COD_PARAM_SVA_ALERT_DEFINITIF, localFr);
/* Paramètres Compte candidat */
renameCodParam("PREFIXE_NUM_DOSS_CPT", NomenclatureUtils.COD_PARAM_CANDIDAT_PREFIXE_NUM_DOSS, localFr);
renameCodParam("NB_JOUR_KEEP_CPT_MIN", NomenclatureUtils.COD_PARAM_CANDIDAT_NB_JOUR_KEEP_CPT_MIN, localFr);
renameCodParam("IS_INE_OBLI_FR", NomenclatureUtils.COD_PARAM_CANDIDAT_IS_INE_OBLI_FR, localFr);
renameCodParam("IS_GET_CURSUS_INTERNE", NomenclatureUtils.COD_PARAM_CANDIDAT_IS_GET_CURSUS_INTERNE, localFr);
renameCodParam("IS_UTILISE_SYNCHRO_INE", NomenclatureUtils.COD_PARAM_CANDIDAT_IS_UTILISE_SYNCHRO_INE, localFr);
/* Paramètres Candidature */
renameCodParam("NB_VOEUX_MAX", NomenclatureUtils.COD_PARAM_CANDIDATURE_NB_VOEUX_MAX, localFr);
renameCodParam("NB_VOEUX_MAX_IS_ETAB", NomenclatureUtils.COD_PARAM_CANDIDATURE_NB_VOEUX_MAX_IS_ETAB, localFr);
/* Paramètres techniques */
renameCodParam("FILE_MAX_SIZE", NomenclatureUtils.COD_PARAM_TECH_FILE_MAX_SIZE, localFr);
renameCodParam("IS_MAINTENANCE", NomenclatureUtils.COD_PARAM_TECH_IS_MAINTENANCE, localFr);
renameCodParam("IS_UTILISE_DEMAT", NomenclatureUtils.COD_PARAM_TECH_IS_UTILISE_DEMAT, localFr);
renameCodParam("NB_JOUR_KEEP_HISTO_BATCH", NomenclatureUtils.COD_PARAM_TECH_NB_JOUR_KEEP_HISTO_BATCH, localFr);
renameCodParam("IS_DEMAT_MAINTENANCE", NomenclatureUtils.COD_PARAM_TECH_IS_DEMAT_MAINTENANCE, localFr);
/* Paramètres gestionnaire */
renameCodParam("IS_UTILISE_BLOCAGE_AVIS_MASSE", NomenclatureUtils.COD_PARAM_GEST_IS_UTILISE_BLOCAGE_MASSE, localFr);
renameCodParam("IS_LETTRE_ADM_APRES_ACCEPT", "GEST_IS_LETTRE_ADM_APRES_ACCEPT", localFr);
/* Paramètres scol */
renameCodParam("NB_JOUR_ARCHIVAGE", NomenclatureUtils.COD_PARAM_SCOL_NB_JOUR_ARCHIVAGE, localFr);
renameCodParam("IS_APPEL", NomenclatureUtils.COD_PARAM_SCOL_IS_APPEL, localFr);
renameCodParam("GESTION_CANDIDAT_COMM", NomenclatureUtils.COD_PARAM_SCOL_GESTION_CANDIDAT_COMM, localFr);
renameCodParam("GESTION_CANDIDAT_CTR_CAND", NomenclatureUtils.COD_PARAM_SCOL_GESTION_CANDIDAT_CTR_CAND, localFr);
renameCodParam("SISCOL_COD_SANS_BAC", NomenclatureUtils.COD_PARAM_SCOL_SISCOL_COD_SANS_BAC, localFr);
renameCodParam("IS_FORM_COD_APO_OBLI", NomenclatureUtils.COD_PARAM_SCOL_IS_COD_APO_OBLI, localFr);
/* Paramètres téléchargement multiple */
renameCodParam("NB_DOSSIER_TELECHARGEMENT_MAX", NomenclatureUtils.COD_PARAM_DOWNLOAD_MULTIPLE_NB_MAX, localFr);
}
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_3_0_5))) {
// on renomme les codes des paramètres
renameCodParam("GEST_IS_LETTRE_ADM_APRES_ACCEPT", NomenclatureUtils.COD_PARAM_DOWNLOAD_IS_LETTRE_ADM_APRES_CONFIRM, localFr);
}
if (vNomenclature.isLessThan(new RealeaseVersion(NomenclatureUtils.VERSION_NOMENCLATURE_MAJ_2_3_0_6))) {
// on renomme les codes des paramètres
renameCodParam("IS_STATUT_ATT_WHEN_CHANGE_TT", NomenclatureUtils.COD_PARAM_SCOL_IS_STATUT_ATT_WHEN_CHANGE_TT, localFr);
}
}
Aggregations