Search in sources :

Example 1 with CandidatCompteMinimaWindow

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);
}
Also used : CptMinMailBean(fr.univlorraine.ecandidat.utils.bean.mail.CptMinMailBean) CandidatCompteMinimaWindow(fr.univlorraine.ecandidat.views.windows.CandidatCompteMinimaWindow)

Example 2 with CandidatCompteMinimaWindow

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);
}
Also used : CompteMinima(fr.univlorraine.ecandidat.entities.ecandidat.CompteMinima) PeopleLdap(fr.univlorraine.ecandidat.services.ldap.PeopleLdap) CandidatCompteMinimaWindow(fr.univlorraine.ecandidat.views.windows.CandidatCompteMinimaWindow)

Aggregations

CandidatCompteMinimaWindow (fr.univlorraine.ecandidat.views.windows.CandidatCompteMinimaWindow)2 CompteMinima (fr.univlorraine.ecandidat.entities.ecandidat.CompteMinima)1 PeopleLdap (fr.univlorraine.ecandidat.services.ldap.PeopleLdap)1 CptMinMailBean (fr.univlorraine.ecandidat.utils.bean.mail.CptMinMailBean)1