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-commons/fdxcommons-model/src/main/java/com/megatim/fdxcommons/model/camel/LocalConfiguration.java |   80 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/fdx-commons/fdxcommons-model/src/main/java/com/megatim/fdxcommons/model/camel/LocalConfiguration.java b/fdx-commons/fdxcommons-model/src/main/java/com/megatim/fdxcommons/model/camel/LocalConfiguration.java
new file mode 100644
index 0000000..2b9ac03
--- /dev/null
+++ b/fdx-commons/fdxcommons-model/src/main/java/com/megatim/fdxcommons/model/camel/LocalConfiguration.java
@@ -0,0 +1,80 @@
+package com.megatim.fdxcommons.model.camel;
+
+import java.io.IOException;
+
+/**
+ *
+ * @author Gabuntu
+ */
+public class LocalConfiguration {
+
+    private final FileProperties fileProperties;
+
+    public LocalConfiguration(FileProperties fileProperties) {
+        this.fileProperties = fileProperties;
+    }
+
+    public String referentielRouteURI() throws IOException {
+        return "file:" + referentielLocalPath() + "?include=.*.zip" + routeParameters();
+    }
+
+    public String fichierRouteURI() throws IOException {
+        return "file:" + fichierLocalPath() + "?include=.*\\.(csv|txt)$" + routeParameters();
+    }
+
+    public String standaloneTmpRouteURI() throws IOException {
+        return "file:" + standaloneTmpDir() + "?include=.*\\.(csv|txt)$&delete=true" + routeParameters();
+    }
+
+    public String standaloneRouteURI() throws IOException {
+        return "file:" + standaloneDestinationDir() + "?include=.*\\.(csv|txt)$" + routeParameters();
+    }
+
+    public String standaloneTmpDir() throws IOException {
+        return fileProperties.properties().getProperty(CamelProperties.STANDALONE_TMP_DIR_PROPERTY);
+    }
+
+    public String consultationTmpRouteURI() throws IOException {
+        return "file:" + consultationTmpDir() + "?include=.*\\.(csv|txt)$&delete=true" + routeParameters();
+    }
+
+    public String consultationRouteURI() throws IOException {
+        return "file:" + consultationDestinationDir() + "?include=.*\\.(csv|txt)$" + routeParameters();
+    }
+
+    public String consultationTmpDir() throws IOException {
+        return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_TMP_DIR);
+    }
+
+    public boolean isStandaloneCorrect() throws IOException {
+        return referentielLocalPath() != null
+                && fichierLocalPath() != null
+                && standaloneTmpDir() != null
+                && standaloneDestinationDir() != null;
+    }
+
+    public boolean isConsultationCorrect() throws IOException {
+        return consultationTmpDir() != null && consultationDestinationDir() != null;
+    }
+
+    private String routeParameters() {
+        return "&moveFailed=" + CamelProperties.ERROR_DIR + "&noop=true&readLock=rename";
+    }
+
+    public String referentielLocalPath() throws IOException {
+        return fileProperties.properties().getProperty(CamelProperties.REFERENTIEL_LOCAL_PATH_PROPERTY);
+    }
+
+    public String fichierLocalPath() throws IOException {
+        return fileProperties.properties().getProperty(CamelProperties.FICHIER_LOCAL_PATH_PROPERTY);
+    }
+
+    private String standaloneDestinationDir() throws IOException {
+        return fileProperties.properties().getProperty(CamelProperties.STANDALONE_DESTINATION_DIR_PROPERTY);
+    }
+
+    public String consultationDestinationDir() throws IOException {
+        return fileProperties.properties().getProperty(CamelProperties.CONSULTATION_DESTINATION_DIR_PROPERTY);
+    }
+
+}

--
Gitblit v1.10.0