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-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/DataWithTokenToDataProductionQuery.java | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/DataWithTokenToDataProductionQuery.java b/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/DataWithTokenToDataProductionQuery.java
new file mode 100644
index 0000000..676267d
--- /dev/null
+++ b/fdx-commons/fdxcommons-tools/src/main/java/com/megatim/fdxcommons/tools/database/queries/DataWithTokenToDataProductionQuery.java
@@ -0,0 +1,42 @@
+package com.megatim.fdxcommons.tools.database.queries;
+
+import com.megatim.fdxcommons.model.dataproduction.CommonDataProduction;
+import com.megatim.fdxcommons.tools.database.contrat.QueryMetaData;
+import com.megatim.fdxcommons.tools.database.tables.appcolumns.*;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.Timestamp;
+
+public class DataWithTokenToDataProductionQuery implements QueryMetaData<Void> {
+
+ private final Connection connection;
+ private final CommonDataProduction dataProduction;
+ private final String token;
+ private final String tableName;
+
+ public DataWithTokenToDataProductionQuery(Connection connection, CommonDataProduction dataProduction, String token, String tableName) {
+ this.connection = connection;
+ this.dataProduction = dataProduction;
+ this.token = token;
+ this.tableName = tableName;
+ }
+
+ @Override
+ public Void execute() throws Exception {
+
+ String query = "UPDATE " + tableName + " SET " + new DataProductionIdColumnDefinition().name() + " = ?, " + new DateCreationColumnDefinition().name() + " = ?, "
+ + new TokenColumnDefinition().name() + " = ?" + " WHERE " + new TokenColumnDefinition().name() + " = ?";
+
+ try (PreparedStatement stmt = connection.prepareStatement(query)) {
+ stmt.setLong(1, dataProduction.getId());
+ stmt.setTimestamp(2, Timestamp.valueOf(dataProduction.getDateProduction()));
+ stmt.setString(3, null);
+ stmt.setString(4, token);
+ stmt.executeUpdate();
+ }
+
+ return null;
+ }
+
+}
--
Gitblit v1.10.0