fix(organisations): corriger executeWithRetry, accesseurs statut et XHTML détail
- OrganisationsBean : executeWithRetrySupplier → executeWithRetry (méthode correcte, compatible ECJ — Callable<T> au lieu de Supplier<T> non capturé) - OrganisationDetailBean : utiliser statutLibelle/statutSeverity si présents avant fallback sur statut brut ; supprimer revenirAListe() (redirect manuel inutile) ; propager typeLibelle en plus de typeOrganisationLibelle - detail.xhtml : remplacer les panneaux adresseComplete/dateFondation/niveauHierarchique (champs absents du DTO) par nombreEvenements qui existe dans OrganisationSummaryResponse
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package dev.lions.unionflow.client.view;
|
||||
|
||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationResponse;
|
||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationSummaryResponse;
|
||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationResponse;
|
||||
import dev.lions.unionflow.server.api.dto.organisation.response.OrganisationSummaryResponse;
|
||||
import dev.lions.unionflow.server.api.dto.common.PagedResponse;
|
||||
@@ -20,7 +18,6 @@ import jakarta.inject.Named;
|
||||
import org.eclipse.microprofile.rest.client.inject.RestClient;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -89,7 +86,9 @@ public class OrganisationDetailBean implements Serializable {
|
||||
"chargement des détails d'une organisation"
|
||||
);
|
||||
if (organisation != null) {
|
||||
organisation.setTypeOrganisationLibelle(typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation()));
|
||||
String libelle = typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation());
|
||||
organisation.setTypeOrganisationLibelle(libelle);
|
||||
organisation.setTypeLibelle(libelle);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.errorf(e, "Erreur lors du chargement de l'organisation");
|
||||
@@ -131,7 +130,9 @@ public class OrganisationDetailBean implements Serializable {
|
||||
);
|
||||
organisation = maj;
|
||||
if (organisation != null) {
|
||||
organisation.setTypeOrganisationLibelle(typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation()));
|
||||
String libelle = typeCatalogueService.resolveLibelle(organisation.getTypeOrganisation());
|
||||
organisation.setTypeOrganisationLibelle(libelle);
|
||||
organisation.setTypeLibelle(libelle);
|
||||
}
|
||||
modeEdition = false;
|
||||
errorHandler.showSuccess("Succès", "Organisation modifiée avec succès.");
|
||||
@@ -248,13 +249,6 @@ public class OrganisationDetailBean implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void revenirAListe() throws IOException {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(
|
||||
ctx.getExternalContext().getRequestContextPath() + "/pages/secure/organisation/liste.xhtml"
|
||||
);
|
||||
}
|
||||
|
||||
// ── Données pour le formulaire (DRY : même interface que OrganisationsBean) ──
|
||||
|
||||
public List<SelectItem> getTypesSelectItemsForForm() {
|
||||
@@ -338,7 +332,10 @@ public class OrganisationDetailBean implements Serializable {
|
||||
}
|
||||
|
||||
public String getStatutLibelle() {
|
||||
if (organisation == null || organisation.getStatut() == null) return "Non renseigné";
|
||||
if (organisation == null) return "Non renseigné";
|
||||
if (organisation.getStatutLibelle() != null && !organisation.getStatutLibelle().isBlank())
|
||||
return organisation.getStatutLibelle();
|
||||
if (organisation.getStatut() == null) return "Non renseigné";
|
||||
return switch (organisation.getStatut()) {
|
||||
case "ACTIVE" -> "Active";
|
||||
case "INACTIVE" -> "Inactive";
|
||||
@@ -349,7 +346,10 @@ public class OrganisationDetailBean implements Serializable {
|
||||
}
|
||||
|
||||
public String getStatutSeverity() {
|
||||
if (organisation == null || organisation.getStatut() == null) return "secondary";
|
||||
if (organisation == null) return "secondary";
|
||||
if (organisation.getStatutSeverity() != null && !organisation.getStatutSeverity().isBlank())
|
||||
return organisation.getStatutSeverity();
|
||||
if (organisation.getStatut() == null) return "secondary";
|
||||
return switch (organisation.getStatut()) {
|
||||
case "ACTIVE" -> "success";
|
||||
case "INACTIVE" -> "warning";
|
||||
|
||||
@@ -434,7 +434,7 @@ public class OrganisationsBean implements Serializable {
|
||||
}
|
||||
|
||||
try {
|
||||
retryService.executeWithRetrySupplier(
|
||||
retryService.executeWithRetry(
|
||||
() -> {
|
||||
organisationService.supprimer(organisation.getId());
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user