Search in sources :

Example 1 with InfoWindow

use of fr.univlorraine.ecandidat.views.windows.InfoWindow in project esup-ecandidat by EsupPortail.

the class FormulaireController method testConnexionLS.

/**
 * Teste la connexion à LimeSurvey
 */
public void testConnexionLS() {
    final InputWindow inputWindow = new InputWindow(applicationContext.getMessage("version.ls.message", null, UI.getCurrent().getLocale()), applicationContext.getMessage("version.ls.title", null, UI.getCurrent().getLocale()), false, 15);
    inputWindow.addBtnOkListener(text -> {
        if (text instanceof String && !text.isEmpty()) {
            if (text != null) {
                try {
                    final Integer idForm = Integer.valueOf(text);
                    final List<SurveyReponse> listeReponse = getListeReponseDedoublonneCandidat(limeSurveyRest.exportResponse(idForm, "fr"));
                    final StringBuilder sb = new StringBuilder();
                    sb.append("<b>" + applicationContext.getMessage("version.ls.resultTxt", new Object[] { listeReponse.size() }, UI.getCurrent().getLocale()) + "</b>");
                    sb.append("<br><br>");
                    listeReponse.forEach(e -> {
                        sb.append("<b>NumDossier : " + e.getNumDossier() + ", date : " + e.getDatestamp() + "</b><br>");
                        if (e.getMapReponses() != null) {
                            for (final Entry<String, Object> entry : e.getMapReponses().entrySet()) {
                                sb.append(entry.getKey() + " : " + entry.getValue() + "<br>");
                            }
                        }
                        sb.append("<br>");
                    });
                    UI.getCurrent().addWindow(new InfoWindow(applicationContext.getMessage("version.ls.result", null, UI.getCurrent().getLocale()), sb.toString(), 500, 40));
                } catch (final Exception e) {
                    Notification.show(applicationContext.getMessage("version.ls.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                }
            }
        }
    });
    UI.getCurrent().addWindow(inputWindow);
}
Also used : SurveyReponse(fr.univlorraine.ecandidat.controllers.rest.SurveyReponse) InputWindow(fr.univlorraine.ecandidat.views.windows.InputWindow) InfoWindow(fr.univlorraine.ecandidat.views.windows.InfoWindow)

Example 2 with InfoWindow

use of fr.univlorraine.ecandidat.views.windows.InfoWindow in project esup-ecandidat by EsupPortail.

the class SiScolController method testWSPJSiScolInfo.

/**
 * Teste du WS d'info de fichiers
 * @param codEtu
 * @param codTpj
 */
public void testWSPJSiScolInfo(final String codEtu, final String codTpj) {
    try {
        if (urlWsPjApogee == null || urlWsPjApogee.equals("")) {
            Notification.show(applicationContext.getMessage("version.ws.pj.noparam", new Object[] { ConstanteUtils.WS_APOGEE_PJ_URL_SERVICE + ConstanteUtils.WS_APOGEE_SERVICE_SUFFIXE }, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
            return;
        }
        final WSPjInfo info = siScolService.getPjInfoFromApogee(null, codEtu, codTpj);
        String ret = "Pas d'info";
        if (info != null) {
            ret = "<u>PJ Information</u> : <br>" + info;
        }
        UI.getCurrent().addWindow(new InfoWindow(applicationContext.getMessage("version.ws.result", null, UI.getCurrent().getLocale()), ret, 500, 70));
    } catch (final Exception e) {
        Notification.show(applicationContext.getMessage("version.ws.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
    }
}
Also used : WSPjInfo(fr.univlorraine.ecandidat.entities.siscol.WSPjInfo) InfoWindow(fr.univlorraine.ecandidat.views.windows.InfoWindow) SiScolException(fr.univlorraine.ecandidat.services.siscol.SiScolException)

Example 3 with InfoWindow

use of fr.univlorraine.ecandidat.views.windows.InfoWindow in project esup-ecandidat by EsupPortail.

the class SiScolController method testWSSiScolConnnexion.

/**
 * Teste la connexion au WS Apogée
 */
public void testWSSiScolConnnexion() {
    final InputWindow inputWindow = new InputWindow(applicationContext.getMessage("version.ws.message", null, UI.getCurrent().getLocale()), applicationContext.getMessage("version.ws.title", null, UI.getCurrent().getLocale()), false, 15);
    inputWindow.addBtnOkListener(text -> {
        if (text instanceof String && !text.isEmpty()) {
            if (text != null) {
                try {
                    WSIndividu ind;
                    if (demoController.getDemoMode()) {
                        ind = demoController.recupInfoEtudiant("0000000000");
                    } else {
                        ind = siScolService.getIndividu(text, null, null);
                    }
                    String ret = "Pas d'info";
                    if (ind != null) {
                        ret = "<u>Individu</u> : <br>" + ind + "<br><br><u>Adresse</u> : <br>" + ind.getAdresse() + "<br><br><u>Bac</u> : <br>" + ind.getBac() + "<br><br><u>Cursus interne</u> : <br>" + ind.getListCursusInterne();
                    }
                    UI.getCurrent().addWindow(new InfoWindow(applicationContext.getMessage("version.ws.result", null, UI.getCurrent().getLocale()), ret, 500, 70));
                } catch (final Exception e) {
                    Notification.show(applicationContext.getMessage("version.ws.error", null, UI.getCurrent().getLocale()), Type.WARNING_MESSAGE);
                }
            }
        }
    });
    UI.getCurrent().addWindow(inputWindow);
}
Also used : WSIndividu(fr.univlorraine.ecandidat.entities.siscol.WSIndividu) InputWindow(fr.univlorraine.ecandidat.views.windows.InputWindow) InfoWindow(fr.univlorraine.ecandidat.views.windows.InfoWindow) SiScolException(fr.univlorraine.ecandidat.services.siscol.SiScolException)

Aggregations

InfoWindow (fr.univlorraine.ecandidat.views.windows.InfoWindow)3 SiScolException (fr.univlorraine.ecandidat.services.siscol.SiScolException)2 InputWindow (fr.univlorraine.ecandidat.views.windows.InputWindow)2 SurveyReponse (fr.univlorraine.ecandidat.controllers.rest.SurveyReponse)1 WSIndividu (fr.univlorraine.ecandidat.entities.siscol.WSIndividu)1 WSPjInfo (fr.univlorraine.ecandidat.entities.siscol.WSPjInfo)1