From 7abb96dd977997d9aabf0c7c6ded81350506aad7 Mon Sep 17 00:00:00 2001 From: j-dimension Date: Sun, 27 Oct 2024 20:31:30 +0100 Subject: [PATCH] use dedicated service for retrieving email template names. issue #2623 --- .../java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java | 8 +++++--- .../jlawyer/services/IntegrationServiceLocal.java | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java index 45c92d208..f87cc09be 100644 --- a/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java +++ b/j-lawyer-server/j-lawyer-io/src/java/org/jlawyer/io/rest/v6/TemplatesEndpointV6.java @@ -670,6 +670,7 @@ You should also get your employer (if you work as a programmer) or school, import com.jdimension.jlawyer.services.ArchiveFileServiceLocal; import com.jdimension.jlawyer.services.FormsServiceLocal; import com.jdimension.jlawyer.pojo.PartiesTriplet; +import com.jdimension.jlawyer.services.IntegrationServiceLocal; import com.jdimension.jlawyer.services.SystemManagementLocal; import java.util.ArrayList; import java.util.Collections; @@ -712,6 +713,7 @@ public class TemplatesEndpointV6 implements TemplatesEndpointLocalV6 { private static final String LOOKUP_SYSMAN="java:global/j-lawyer-server/j-lawyer-server-ejb/SystemManagement!com.jdimension.jlawyer.services.SystemManagementLocal"; private static final String LOOKUP_CASESVC="java:global/j-lawyer-server/j-lawyer-server-ejb/ArchiveFileService!com.jdimension.jlawyer.services.ArchiveFileServiceLocal"; private static final String LOOKUP_FORMSSVC="java:global/j-lawyer-server/j-lawyer-server-ejb/FormsService!com.jdimension.jlawyer.services.FormsServiceLocal"; + private static final String LOOKUP_INTEGRATIONSVC="java:global/j-lawyer-server/j-lawyer-server-ejb/IntegrationService!com.jdimension.jlawyer.services.IntegrationServiceLocal"; /** * Returns the folder structure holding document templates. @@ -922,15 +924,15 @@ public Response addDocumentFromTemplate(@PathParam("caseId") String caseId, @Pat */ @Override @GET - @Path("email/templates") + @Path("email") @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8") @RolesAllowed({"loginRole"}) public Response listEmailTemplates() { try { InitialContext ic = new InitialContext(); - SystemManagementLocal system = (SystemManagementLocal) ic.lookup(LOOKUP_SYSMAN); + IntegrationServiceLocal intSvc = (IntegrationServiceLocal) ic.lookup(LOOKUP_INTEGRATIONSVC); - List templates = system.getTemplatesByPath(SystemManagementLocal.TEMPLATE_TYPE_EMAIL, "/"); + Collection templates = intSvc.getAllEmailTemplateNames(); List> resultList = new ArrayList<>(); for (String templateName : templates) { diff --git a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/IntegrationServiceLocal.java b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/IntegrationServiceLocal.java index 4d8658b46..705029c75 100644 --- a/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/IntegrationServiceLocal.java +++ b/j-lawyer-server/j-lawyer-server-ejb/src/java/com/jdimension/jlawyer/services/IntegrationServiceLocal.java @@ -663,6 +663,7 @@ */ package com.jdimension.jlawyer.services; +import java.util.Collection; import javax.ejb.Local; /** @@ -672,4 +673,6 @@ @Local public interface IntegrationServiceLocal { + Collection getAllEmailTemplateNames(); + }