Merge branch 'develop' into stable

This commit is contained in:
Brian Long 2023-11-15 20:00:00 -05:00
commit 3e3cb195b3
2 changed files with 40 additions and 3 deletions

View File

@ -26,6 +26,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.inteligr8.activiti.model.ResultList; import com.inteligr8.activiti.model.ResultList;
import com.inteligr8.alfresco.activiti.model.DocumentTemplateLight; import com.inteligr8.alfresco.activiti.model.DocumentTemplateLight;
import com.inteligr8.alfresco.activiti.model.EmailTemplate; import com.inteligr8.alfresco.activiti.model.EmailTemplate;
@ -38,6 +39,13 @@ import com.inteligr8.alfresco.activiti.model.EmailTemplateLight;
*/ */
@Path("/app/rest") @Path("/app/rest")
public interface TemplatesApi { public interface TemplatesApi {
public enum TemplateSort {
@JsonProperty("sort_by_name_asc")
NameAscending,
@JsonProperty("sort_by_name_desc")
NameDescending
}
@GET @GET
@Path("email-templates/system") @Path("email-templates/system")
@ -56,7 +64,17 @@ public interface TemplatesApi {
@QueryParam("tenantId") Long tenantId); @QueryParam("tenantId") Long tenantId);
@GET @GET
@Path("email-templates/custom/{templateName}") @Path("email-templates/custom")
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<EmailTemplateLight> getCustomEmailTemplates(
@QueryParam("nameFilter") String nameFilter,
@QueryParam("start") Integer start,
@QueryParam("size") Integer size,
@QueryParam("sort") TemplateSort sort,
@QueryParam("tenantId") Long tenantId);
@GET
@Path("email-templates/system/{templateName}")
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public EmailTemplate getSystemEmailTemplate( public EmailTemplate getSystemEmailTemplate(
@PathParam("templateName") String name, @PathParam("templateName") String name,
@ -77,7 +95,7 @@ public interface TemplatesApi {
EmailTemplate template); EmailTemplate template);
@PUT @PUT
@Path("email-templates/custom/{templateName}") @Path("email-templates/system/{templateName}")
@Consumes({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public EmailTemplate updateSystemEmailTemplate( public EmailTemplate updateSystemEmailTemplate(
@ -110,11 +128,27 @@ public interface TemplatesApi {
@QueryParam("sort") String sort, @QueryParam("sort") String sort,
@QueryParam("tenantId") Long tenantId); @QueryParam("tenantId") Long tenantId);
@GET
@Path("document-templates")
@Produces({ MediaType.APPLICATION_JSON })
public ResultList<DocumentTemplateLight> getDocumentTemplates(
@QueryParam("nameFilter") String nameFilter,
@QueryParam("start") Integer start,
@QueryParam("size") Integer size,
@QueryParam("sort") TemplateSort sort,
@QueryParam("tenantId") Long tenantId);
default Response getDocumentTemplate( default Response getDocumentTemplate(
DocumentTemplateLight template) { DocumentTemplateLight template) {
return this.getDocumentTemplate(template.getId(), template.getCreated().toInstant().toEpochMilli()); return this.getDocumentTemplate(template.getId(), System.currentTimeMillis());
} }
@GET
@Path("document-templates/{templateId}")
@Produces({ MediaType.APPLICATION_JSON })
public DocumentTemplateLight getDocumentTemplate(
@PathParam("templateId") long id);
@GET @GET
@Path("document-templates/{templateId}/file") @Path("document-templates/{templateId}/file")
@Produces({ @Produces({

View File

@ -2,9 +2,11 @@ package com.inteligr8.alfresco.activiti.model;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat.Shape;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
@ -15,6 +17,7 @@ public class BaseTemplateLight {
@JsonProperty(required = true) @JsonProperty(required = true)
private String name; private String name;
@JsonProperty @JsonProperty
@JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
private OffsetDateTime created; private OffsetDateTime created;
@JsonProperty @JsonProperty
private UserLight createdBy; private UserLight createdBy;