use of fr.univlorraine.ecandidat.views.windows.CandidatCompteMinimaWindow in project esup-ecandidat by EsupPortail.
the class CandidatController method editMail.
/**
* Edite le mail du candidat
* @param cptMin
*/
public void editMail(final CompteMinima cptMin) {
/* Verrou --> normalement le lock est géré en amont mais on vérifie qd même */
final String lockError = getLockError(cptMin, ConstanteUtils.LOCK_INFOS_PERSO);
if (lockError != null) {
Notification.show(lockError, Type.WARNING_MESSAGE);
return;
}
final CandidatCompteMinimaWindow cptMinWin = new CandidatCompteMinimaWindow(cptMin, true, false);
cptMinWin.addCompteMinimaWindowListener(e -> {
cptMin.setTemValidMailCptMin(false);
compteMinimaRepository.save(cptMin);
final String base64encodedString = Base64.getUrlEncoder().withoutPadding().encodeToString(cptMin.getNumDossierOpiCptMin().getBytes());
final String path = loadBalancingController.getApplicationPathForCandidat() + "rest/candidat/mail/" + base64encodedString;
final CptMinMailBean mailBean = new CptMinMailBean(cptMin.getPrenomCptMin(), cptMin.getNomCptMin(), cptMin.getNumDossierOpiCptMin(), null, path, campagneController.getLibelleCampagne(cptMin.getCampagne(), getCodLangueCptMin(cptMin)), null);
mailController.sendMailByCod(cptMin.getMailPersoCptMin(), NomenclatureUtils.MAIL_CPT_MIN_MOD_MAIL, mailBean, null, getCodLangueCptMin(cptMin));
Notification.show(applicationContext.getMessage("compteMinima.editmail.notif", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
MainUI.getCurrent().reconstructMainMenu();
});
UI.getCurrent().addWindow(cptMinWin);
}
use of fr.univlorraine.ecandidat.views.windows.CandidatCompteMinimaWindow in project esup-ecandidat by EsupPortail.
the class CandidatController method createCompteMinima.
/**
* Creation d'un compte a minima
*/
public void createCompteMinima(final Boolean createByGest) {
final CompteMinima cptMin = new CompteMinima();
if (!createByGest) {
final String login = userController.getCurrentNoDossierCptMinOrLogin();
if (login != null && !login.equals("")) {
cptMin.setLoginCptMin(login);
final PeopleLdap p = ldapController.findByPrimaryKey(login);
if (p != null) {
if (p.getSupannEtuId() != null && !p.getSupannEtuId().equals("")) {
cptMin.setSupannEtuIdCptMin(p.getSupannEtuId());
}
if (p.getSn() != null && !p.getSn().equals("")) {
cptMin.setNomCptMin(p.getSn());
}
if (p.getGivenName() != null && !p.getGivenName().equals("")) {
cptMin.setPrenomCptMin(p.getGivenName());
}
if (p.getMail() != null && !p.getMail().equals("")) {
cptMin.setMailPersoCptMin(p.getMail());
}
}
}
}
final CandidatCompteMinimaWindow cptMinWin = new CandidatCompteMinimaWindow(cptMin, false, createByGest);
cptMinWin.addCompteMinimaWindowListener(compteMinima -> {
final CompteMinima cpt = saveCompteMinima(compteMinima);
if (cpt != null && !createByGest) {
userController.alimenteSecurityUserCptMin(cpt);
MainUI.getCurrent().reconstructMainMenu();
}
});
UI.getCurrent().addWindow(cptMinWin);
}
Aggregations