use of fr.univlorraine.ecandidat.entities.ecandidat.CandidatCursusPostBac in project esup-ecandidat by EsupPortail.
the class CandidatureCtrCandController method generateExport.
/**
* Exporte les candidatures
* @param liste
* @param allOptions
* @param optionChecked
* @return le fichier
*/
private OnDemandFile generateExport(final String code, final String libelle, final List<Candidature> liste, final LinkedHashSet<ExportListCandidatureOption> allOptions, final Set<ExportListCandidatureOption> optionChecked, final Boolean temFooter) {
if (liste == null || liste.size() == 0) {
return null;
}
final Map<String, Object> beans = new HashMap<>();
/* Traitement des dates */
liste.forEach(candidature -> {
candidature.setDatCreCandStr(candidature.getDatCreCand().format(formatterDateTime));
candidature.getCandidat().setAdresseCandidatExport(generateAdresse(candidature.getCandidat().getAdresse()));
candidature.getCandidat().setDatNaissanceCandidatStr(MethodUtils.formatDate(candidature.getCandidat().getDatNaissCandidat(), formatterDate));
if (candidature.getLastTypeDecision() != null) {
candidature.getLastTypeDecision().setDatValidTypeDecCandStr(MethodUtils.formatDate(candidature.getLastTypeDecision().getDatValidTypeDecCand(), formatterDate));
candidature.getLastTypeDecision().setPreselectStr(getComplementPreselectMail(candidature.getLastTypeDecision()));
candidature.getLastTypeDecision().setPreselectDateTypeDecCandStr(MethodUtils.formatDate(candidature.getLastTypeDecision().getPreselectDateTypeDecCand(), formatterDate));
}
candidature.setDatModTypStatutCandStr(MethodUtils.formatDate(candidature.getDatModTypStatutCand(), formatterDateTime));
candidature.setDatReceptDossierCandStr(MethodUtils.formatDate(candidature.getDatReceptDossierCand(), formatterDate));
candidature.setDatTransDossierCandStr(MethodUtils.formatDate(candidature.getDatTransDossierCand(), formatterDateTime));
candidature.setDatCompletDossierCandStr(MethodUtils.formatDate(candidature.getDatCompletDossierCand(), formatterDate));
candidature.setDatAnnulCandStr(MethodUtils.formatDate(candidature.getDatAnnulCand(), formatterDateTime));
candidature.setDatNewConfirmCandStr(MethodUtils.formatDate(candidature.getDatNewConfirmCand(), formatterDate));
candidature.setDatNewRetourCandStr(MethodUtils.formatDate(candidature.getDatNewRetourCand(), formatterDate));
candidature.setDatIncompletDossierCandStr(MethodUtils.formatDate(candidature.getDatIncompletDossierCand(), formatterDate));
candidature.setDatModPjForm(getDatModPjForm(candidature));
/* Tags */
candidature.setTagsStr(formatLongCellSize(candidature.getTags().stream().map(e -> e.getLibTag()).collect(Collectors.joining(" / "))));
/* Bloc note */
if (parametreController.getIsExportBlocNote()) {
candidature.setBlocNoteStr(formatLongCellSize(getPostIt(candidature).stream().map(e -> e.getMessagePostIt()).collect(Collectors.joining(" / "))));
} else {
allOptions.add(new ExportListCandidatureOption("postItHide", applicationContext.getMessage("export.option.postit", null, UI.getCurrent().getLocale())));
}
/* Exoneration */
if (candidature.getSiScolCatExoExt() != null) {
candidature.setCatExoStr(candidature.getSiScolCatExoExt().getDisplayLibelle());
}
candidature.setMntChargeStr(MethodUtils.parseBigDecimalAsString(candidature.getMntChargeCand()));
/* Opi */
if (candidature.getOpi() != null) {
candidature.setDatPassageOpiStr(MethodUtils.formatDate(candidature.getOpi().getDatPassageOpi(), formatterDateTime));
candidature.setCodOpiStr(candidature.getOpi().getCodOpi());
}
/* Definition du dernier etablissement frequenté */
final Candidat candidat = candidature.getCandidat();
String lastEtab = "";
String lastDiplome = "";
String lastLibelleDiplome = "";
Integer annee = 0;
for (final CandidatCursusInterne cursus : candidat.getCandidatCursusInternes()) {
if (cursus.getAnneeUnivCursusInterne() > annee) {
annee = cursus.getAnneeUnivCursusInterne();
lastEtab = applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale());
lastDiplome = cursus.getLibCursusInterne();
}
}
for (final CandidatCursusPostBac cursus : candidat.getCandidatCursusPostBacs()) {
if (cursus.getAnneeUnivCursus() > annee && cursus.getSiScolEtablissement() != null) {
annee = cursus.getAnneeUnivCursus();
lastEtab = cursus.getSiScolEtablissement().getLibEtb();
lastDiplome = cursus.getSiScolDipAutCur().getLibDac();
lastLibelleDiplome = cursus.getLibCursus();
}
}
candidat.setLastEtab(lastEtab);
candidat.setLastDiplome(lastDiplome);
candidat.setLastLibDiplome(lastLibelleDiplome);
});
if (code != null) {
beans.put("code", code);
}
beans.put("candidatures", liste);
allOptions.stream().forEach(exportOption -> {
addExportOption(exportOption, optionChecked, beans);
});
if (temFooter) {
beans.put("footer", applicationContext.getMessage("export.footer", new Object[] { libelle, liste.size(), formatterDateTime.format(LocalDateTime.now()) }, UI.getCurrent().getLocale()));
} else {
beans.put("footer", "");
}
final String libFile = applicationContext.getMessage("export.nom.fichier", new Object[] { libelle, DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss").format(LocalDateTime.now()) }, UI.getCurrent().getLocale());
return exportController.generateXlsxExport(beans, "candidatures_template", libFile, Arrays.asList(0));
}
use of fr.univlorraine.ecandidat.entities.ecandidat.CandidatCursusPostBac in project esup-ecandidat by EsupPortail.
the class CandidatParcoursController method editCursusPostBac.
/**
* Edition d'un cursus
*/
public void editCursusPostBac(final Candidat candidat, CandidatCursusPostBac cursus, final CandidatCursusExterneListener listener) {
/* Verrou --> normalement le lock est géré en amont mais on vérifie qd même */
final String lockError = candidatController.getLockError(candidat.getCompteMinima(), ConstanteUtils.LOCK_CURSUS_EXTERNE);
if (lockError != null) {
Notification.show(lockError, Type.ERROR_MESSAGE);
return;
}
Boolean nouveau = false;
if (cursus == null) {
cursus = new CandidatCursusPostBac();
cursus.setCandidat(candidat);
nouveau = true;
}
final CandidatCursusExterneWindow window = new CandidatCursusExterneWindow(cursus, nouveau);
window.addCursusPostBacWindowListener(e -> {
candidat.addCursusPostBac(e);
listener.cursusModified(candidat.getCandidatCursusPostBacs());
});
UI.getCurrent().addWindow(window);
}
use of fr.univlorraine.ecandidat.entities.ecandidat.CandidatCursusPostBac in project esup-ecandidat by EsupPortail.
the class CandidatCursusExterneView method init.
/* Composants */
/**
* Initialise la vue
*/
@PostConstruct
public void init() {
super.init();
setNavigationButton((parametreController.getIsGetCursusInterne() ? CandidatCursusInterneView.NAME : CandidatBacView.NAME), CandidatStageView.NAME);
String indication;
if (parametreController.getIsGetCursusInterne()) {
indication = applicationContext.getMessage("cursusexterne.indication", new Object[] { applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale()) }, UI.getCurrent().getLocale());
} else {
indication = applicationContext.getMessage("cursusexterne.indication.withoutCursusInterne", new Object[] { applicationContext.getMessage("universite.title", null, UI.getCurrent().getLocale()) }, UI.getCurrent().getLocale());
}
/*Indications pour le cursus*/
setSubtitle(indication);
OneClickButton btnNewPostBac = new OneClickButton(applicationContext.getMessage("cursusexterne.btn.new", null, UI.getCurrent().getLocale()), FontAwesome.PLUS);
btnNewPostBac.addClickListener(e -> {
candidatParcoursController.editCursusPostBac(candidat, null, this);
});
addGenericButton(btnNewPostBac, Alignment.MIDDLE_LEFT);
OneClickButton btnEditPostBac = new OneClickButton(applicationContext.getMessage("btnModifier", null, UI.getCurrent().getLocale()), FontAwesome.PENCIL);
btnEditPostBac.setEnabled(false);
btnEditPostBac.addClickListener(e -> {
if (postBacTable.getValue() instanceof CandidatCursusPostBac) {
candidatParcoursController.editCursusPostBac(candidat, (CandidatCursusPostBac) postBacTable.getValue(), this);
}
});
addGenericButton(btnEditPostBac, Alignment.MIDDLE_CENTER);
OneClickButton btnDeletePostBac = new OneClickButton(FontAwesome.TRASH_O);
btnDeletePostBac.setEnabled(false);
btnDeletePostBac.setCaption(applicationContext.getMessage("btnDelete", null, UI.getCurrent().getLocale()));
btnDeletePostBac.addClickListener(e -> {
if (postBacTable.getValue() instanceof CandidatCursusPostBac) {
candidatParcoursController.deleteCursusPostBac(candidat, (CandidatCursusPostBac) postBacTable.getValue(), this);
}
});
addGenericButton(btnDeletePostBac, Alignment.MIDDLE_RIGHT);
/*Table post Bac*/
postBacContainer.addNestedContainerProperty(CandidatCursusPostBac_.siScolMention.getName() + "." + SiScolMention_.libMen.getName());
postBacContainer.addNestedContainerProperty(CandidatCursusPostBac_.siScolEtablissement.getName() + "." + SiScolEtablissement_.libEtb.getName());
postBacContainer.addNestedContainerProperty(CandidatCursusPostBac_.siScolPays.getName() + "." + SiScolPays_.libPay.getName());
postBacContainer.addNestedContainerProperty(CandidatCursusPostBac_.siScolDepartement.getName() + "." + SiScolDepartement_.libDep.getName());
postBacContainer.addNestedContainerProperty(CandidatCursusPostBac_.siScolCommune.getName() + "." + SiScolCommune_.libCom.getName());
postBacContainer.addNestedContainerProperty(CandidatCursusPostBac_.siScolDipAutCur.getName() + "." + SiScolDipAutCur_.libDac.getName());
postBacTable.setSizeFull();
postBacTable.setVisibleColumns((Object[]) FIELDS_ORDER_POST_BAC);
for (String fieldName : FIELDS_ORDER_POST_BAC) {
postBacTable.setColumnHeader(fieldName, applicationContext.getMessage("cursusexterne." + fieldName, null, UI.getCurrent().getLocale()));
}
postBacTable.addGeneratedColumn(CandidatCursusPostBac_.obtenuCursus.getName(), new ColumnGenerator() {
/**
*serialVersionUID *
*/
private static final long serialVersionUID = -6382571666110400875L;
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
CandidatCursusPostBac post = (CandidatCursusPostBac) itemId;
return tableRefController.getLibelleObtenuCursusByCode(post.getObtenuCursus());
}
});
postBacTable.setSortContainerPropertyId(CandidatCursusPostBac_.anneeUnivCursus.getName());
postBacTable.setColumnCollapsingAllowed(true);
postBacTable.setColumnReorderingAllowed(true);
postBacTable.setSelectable(true);
postBacTable.setImmediate(true);
postBacTable.addItemSetChangeListener(e -> postBacTable.sanitizeSelection());
postBacTable.addValueChangeListener(e -> {
/* Les boutons d'édition et de suppression de CandidatCursusPostBac sont actifs seulement si une CandidatCursusPostBac est sélectionnée. */
boolean postBacIsSelected = postBacTable.getValue() instanceof CandidatCursusPostBac;
btnEditPostBac.setEnabled(postBacIsSelected);
btnDeletePostBac.setEnabled(postBacIsSelected);
});
postBacTable.addItemClickListener(e -> {
if (e.isDoubleClick() && !isLectureSeule && !isArchive) {
postBacTable.select(e.getItemId());
btnEditPostBac.click();
}
});
addGenericComponent(postBacTable);
setGenericExpandRatio(postBacTable);
}
Aggregations