Loading src/main/java/com/inteligr8/alfresco/activiti/api/TemplatesApi.java +37 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.fasterxml.jackson.annotation.JsonProperty; import com.inteligr8.activiti.model.ResultList; import com.inteligr8.alfresco.activiti.model.DocumentTemplateLight; import com.inteligr8.alfresco.activiti.model.EmailTemplate; Loading @@ -39,6 +40,13 @@ import com.inteligr8.alfresco.activiti.model.EmailTemplateLight; @Path("/app/rest") public interface TemplatesApi { public enum TemplateSort { @JsonProperty("sort_by_name_asc") NameAscending, @JsonProperty("sort_by_name_desc") NameDescending } @GET @Path("email-templates/system") @Produces({ MediaType.APPLICATION_JSON }) Loading @@ -56,7 +64,17 @@ public interface TemplatesApi { @QueryParam("tenantId") Long tenantId); @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 }) public EmailTemplate getSystemEmailTemplate( @PathParam("templateName") String name, Loading @@ -77,7 +95,7 @@ public interface TemplatesApi { EmailTemplate template); @PUT @Path("email-templates/custom/{templateName}") @Path("email-templates/system/{templateName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public EmailTemplate updateSystemEmailTemplate( Loading Loading @@ -110,11 +128,27 @@ public interface TemplatesApi { @QueryParam("sort") String sort, @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( 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 @Path("document-templates/{templateId}/file") @Produces({ Loading src/main/java/com/inteligr8/alfresco/activiti/model/BaseTemplateLight.java +3 −0 Original line number Diff line number Diff line Loading @@ -2,9 +2,11 @@ package com.inteligr8.alfresco.activiti.model; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonFormat.Shape; @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) Loading @@ -15,6 +17,7 @@ public class BaseTemplateLight { @JsonProperty(required = true) private String name; @JsonProperty @JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ") private OffsetDateTime created; @JsonProperty private UserLight createdBy; Loading Loading
src/main/java/com/inteligr8/alfresco/activiti/api/TemplatesApi.java +37 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.fasterxml.jackson.annotation.JsonProperty; import com.inteligr8.activiti.model.ResultList; import com.inteligr8.alfresco.activiti.model.DocumentTemplateLight; import com.inteligr8.alfresco.activiti.model.EmailTemplate; Loading @@ -39,6 +40,13 @@ import com.inteligr8.alfresco.activiti.model.EmailTemplateLight; @Path("/app/rest") public interface TemplatesApi { public enum TemplateSort { @JsonProperty("sort_by_name_asc") NameAscending, @JsonProperty("sort_by_name_desc") NameDescending } @GET @Path("email-templates/system") @Produces({ MediaType.APPLICATION_JSON }) Loading @@ -56,7 +64,17 @@ public interface TemplatesApi { @QueryParam("tenantId") Long tenantId); @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 }) public EmailTemplate getSystemEmailTemplate( @PathParam("templateName") String name, Loading @@ -77,7 +95,7 @@ public interface TemplatesApi { EmailTemplate template); @PUT @Path("email-templates/custom/{templateName}") @Path("email-templates/system/{templateName}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public EmailTemplate updateSystemEmailTemplate( Loading Loading @@ -110,11 +128,27 @@ public interface TemplatesApi { @QueryParam("sort") String sort, @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( 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 @Path("document-templates/{templateId}/file") @Produces({ Loading
src/main/java/com/inteligr8/alfresco/activiti/model/BaseTemplateLight.java +3 −0 Original line number Diff line number Diff line Loading @@ -2,9 +2,11 @@ package com.inteligr8.alfresco.activiti.model; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonFormat.Shape; @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) Loading @@ -15,6 +17,7 @@ public class BaseTemplateLight { @JsonProperty(required = true) private String name; @JsonProperty @JsonFormat(shape = Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ") private OffsetDateTime created; @JsonProperty private UserLight createdBy; Loading