From 23a46b4be35277e06ec89f48730eeb694e686be8 Mon Sep 17 00:00:00 2001
From: Kenmegne <stephanie.kenmegne@gmail.com>
Date: Thu, 18 Jun 2026 15:40:06 +0000
Subject: [PATCH] add fdx-commons and fdx-consultation
---
fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/TableauBordHandler.java | 94 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 94 insertions(+), 0 deletions(-)
diff --git a/fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/TableauBordHandler.java b/fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/TableauBordHandler.java
new file mode 100644
index 0000000..7011d3a
--- /dev/null
+++ b/fdx-consultation/fdxconsultation-core-ifaces/src/main/java/com/megatim/fdxconsultation/core/ifaces/helper/TableauBordHandler.java
@@ -0,0 +1,94 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
+ */
+package com.megatim.fdxconsultation.core.ifaces.helper;
+
+import com.megatim.fdxcommons.model.pojo.BetweenOperatorValues;
+import com.megatim.fdxcommons.model.pojo.CriteriaEntityFromView;
+import com.megatim.fdxcommons.model.referentiel.Referentiel;
+import com.megatim.fdxconsultation.model.dto.stats.TableConfigurationDto;
+import com.megatim.fdxconsultation.model.dto.stats.TableauBordDto;
+import com.megatim.fdxconsultation.model.stats.CriteriaEntityPersisted;
+import com.megatim.fdxconsultation.model.stats.TableConfiguration;
+import com.megatim.fdxconsultation.model.stats.TableauBord;
+import java.util.Set;
+
+/**
+ *
+ * @author ASUS
+ */
+public interface TableauBordHandler {
+
+ TableauBordDto tableauBordToTableauBordDto(TableauBord tableauBord);
+
+ TableauBord tableauBordDtoToTableauBord(TableauBordDto dto, Referentiel referentiel);
+
+ TableConfigurationDto tableConfigurationToTableConfigurationDto(TableConfiguration tableConf);
+
+ void reconduireTableauBordValides(Referentiel previousRef, Referentiel newRef, Set<String> typeFichiersToMigrate);
+
+ void stopIfUserSpecificTableauBordExists(String codeTypeFichier, String referentielVersion, String userName) throws Exception;
+
+ void stopIfGlobaleTableauBordExists(String codeTypeFichier, String referentielVersion) throws Exception;
+
+ public default CriteriaEntityFromView criteriaEntityPersistedToCriteriaEntityFromView(CriteriaEntityPersisted persisted) {
+ if (persisted != null) {
+ CriteriaEntityFromView mainCriterion = new CriteriaEntityFromView();
+
+ if (persisted.getSubCriterias() != null && !persisted.getSubCriterias().isEmpty()) {
+ mainCriterion.setCriteriaLogicConnector(persisted.getCriteriaLogicConnector());
+ persisted.getSubCriterias().stream().forEach(c -> {
+ CriteriaEntityFromView criterionfromView = criteriaEntityPersistedToCriteriaEntityFromView(c);
+
+ if (criterionfromView != null) {
+ mainCriterion.getSubCriterias().add(criterionfromView);
+ }
+
+ });
+ return mainCriterion;
+ } else {
+ mainCriterion.setNomColonne(persisted.getNomColonne());
+ mainCriterion.setOperateur(persisted.getOperateur());
+ mainCriterion.setCriteriaValue(getCriteriaValue(persisted));
+ return mainCriterion;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ public default Object getCriteriaValue(CriteriaEntityPersisted persisted) {
+
+ if (persisted.getCriteriaDateListValue() != null && !persisted.getCriteriaDateListValue().isEmpty()) {
+ return persisted.getCriteriaDateListValue();
+
+ } else if (persisted.getCriteriaDateLowerBound() != null && persisted.getCriteriaDateUpperBound() != null) {
+ return new BetweenOperatorValues(persisted.getCriteriaDateLowerBound(), persisted.getCriteriaDateUpperBound());
+
+ } else if (persisted.getCriteriaDateValue() != null) {
+ return persisted.getCriteriaDateValue();
+
+ } else if (persisted.getCriteriaNumericListValue() != null && !persisted.getCriteriaNumericListValue().isEmpty()) {
+ return persisted.getCriteriaNumericListValue();
+
+ } else if (persisted.getCriteriaNumericLowerBound() != null && persisted.getCriteriaNumericUpperBound() != null) {
+ return new BetweenOperatorValues(persisted.getCriteriaNumericLowerBound(), persisted.getCriteriaNumericUpperBound());
+
+ } else if (persisted.getCriteriaNumericValue() != null) {
+ return persisted.getCriteriaNumericValue();
+
+ } else if (persisted.getCriteriaStringListValue() != null && !persisted.getCriteriaStringListValue().isEmpty()) {
+ return persisted.getCriteriaStringListValue();
+
+ } else if (persisted.getCriteriaStringLowerBound() != null && persisted.getCriteriaStringUpperBound() != null) {
+ return new BetweenOperatorValues(persisted.getCriteriaStringLowerBound(), persisted.getCriteriaStringUpperBound());
+
+ } else if (persisted.getCriteriaStringValue() != null) {
+ return persisted.getCriteriaStringValue();
+
+ } else {
+ return null;
+ }
+ }
+}
--
Gitblit v1.10.0