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-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/documents/DocumentRSImpl.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/documents/DocumentRSImpl.java b/fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/documents/DocumentRSImpl.java
new file mode 100644
index 0000000..91e4551
--- /dev/null
+++ b/fdx-consultation/fdxconsultation-service-impl/src/main/java/com/megatim/fdxconsultation/service/impl/documents/DocumentRSImpl.java
@@ -0,0 +1,58 @@
+package com.megatim.fdxconsultation.service.impl.documents;
+
+import com.megatim.fdxconsultation.core.ifaces.administration.UserManager;
+import com.megatim.fdxconsultation.core.ifaces.documents.DocumentManager;
+import com.megatim.fdxconsultation.model.administration.User;
+import com.megatim.fdxconsultation.model.documents.Document;
+import com.megatim.fdxconsultation.model.mappers.MapStructMapper;
+import com.megatim.fdxconsultation.service.ifaces.documents.DocumentRS;
+import com.megatim.fdxconsultation.tools.context.AppCommonContext;
+import com.mgt.rs.security.core.common.AuthenticatedUser;
+import com.mgt.rs.security.core.common.SecuredClass;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import javax.ws.rs.Path;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+
+/**
+ *
+ * @author Gabuntu
+ */
+@SecuredClass(module = AppCommonContext.MODULE_DOCUMENTATION, path = "Documents", description = "Documents")
+@Path("document")
+public class DocumentRSImpl implements DocumentRS {
+
+ @Inject
+ private DocumentManager documentManager;
+
+ @Inject
+ private UserManager userManager;
+
+ @Inject
+ private MapStructMapper mapper;
+
+ private User connectedUser;
+
+ public void handleAuthenticationEvent(@Observes @AuthenticatedUser String username) {
+ connectedUser = userManager.recuperUtilisateur(username);
+ }
+
+ @Override
+ public Response save(HttpHeaders headers, Long categoryId, Document entity) {
+ Document document = documentManager.add(categoryId, entity, connectedUser);
+ return Response.ok(mapper.documentToDocumentDto(document)).build();
+ }
+
+ @Override
+ public Response update(HttpHeaders headers, Long id, Document entity) {
+ Document document = documentManager.update(id, entity, connectedUser);
+ return Response.ok(mapper.documentToDocumentDto(document)).build();
+ }
+
+ @Override
+ public void delete(HttpHeaders headers, Long id) {
+ documentManager.delete(id, connectedUser);
+ }
+
+}
--
Gitblit v1.10.0