Skip to content

Commit

Permalink
use dedicated service for retrieving email template names. issue #2623
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Oct 27, 2024
1 parent b2b2ccf commit 7abb96d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<String> templates = system.getTemplatesByPath(SystemManagementLocal.TEMPLATE_TYPE_EMAIL, "/");
Collection<String> templates = intSvc.getAllEmailTemplateNames();
List<Map<String, String>> resultList = new ArrayList<>();

for (String templateName : templates) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
*/
package com.jdimension.jlawyer.services;

import java.util.Collection;
import javax.ejb.Local;

/**
Expand All @@ -672,4 +673,6 @@
@Local
public interface IntegrationServiceLocal {

Collection<String> getAllEmailTemplateNames();

}

0 comments on commit 7abb96d

Please sign in to comment.