From afcae503bced1b8ef086eac447a18aec9bb42b39 Mon Sep 17 00:00:00 2001 From: Yves Peter Date: Thu, 22 Jul 2021 10:59:58 +0200 Subject: [PATCH] template rest: return template content on list, add ownerResourceId --- .../java/ch/mobi/itc/mobiliar/rest/dtos/TemplateDTO.java | 6 +++++- .../rest/resources/ResourceRelationTemplatesRest.java | 1 - .../itc/mobiliar/rest/resources/ResourceTemplatesRest.java | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/TemplateDTO.java b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/TemplateDTO.java index ad82e46e9..47dd1324e 100644 --- a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/TemplateDTO.java +++ b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/dtos/TemplateDTO.java @@ -40,6 +40,7 @@ public class TemplateDTO { private Integer id; private String relatedResourceIdentifier; + private Integer ownerResourceId; private String name; private String targetPath; private Set targetPlatforms; @@ -48,10 +49,13 @@ public class TemplateDTO { public TemplateDTO(TemplateDescriptorEntity template){ this.id = template.getId(); this.relatedResourceIdentifier = template.getRelatedResourceIdentifier(); + if (template.getOwnerResource() != null) { + this.ownerResourceId = template.getOwnerResource().getId(); + } this.name = template.getName(); this.targetPath = template.getTargetPath(); targetPlatforms = new HashSet<>(); - if(template.getTargetPlatforms() != null) { + if (template.getTargetPlatforms() != null) { for (ResourceGroupEntity pf : template.getTargetPlatforms()) { targetPlatforms.add(pf.getName()); } diff --git a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceRelationTemplatesRest.java b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceRelationTemplatesRest.java index 906752796..f00c300bd 100644 --- a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceRelationTemplatesRest.java +++ b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceRelationTemplatesRest.java @@ -78,7 +78,6 @@ public List getResourceRelationTemplates(@PathParam("resourceGroupN List templateDTOs = new ArrayList<>(); for (TemplateDescriptorEntity template : templates) { TemplateDTO temp = new TemplateDTO(template); - temp.setFileContent(null); templateDTOs.add(temp); } return templateDTOs; diff --git a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceTemplatesRest.java b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceTemplatesRest.java index a3245eb96..e115dacb1 100644 --- a/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceTemplatesRest.java +++ b/AMW_rest/src/main/java/ch/mobi/itc/mobiliar/rest/resources/ResourceTemplatesRest.java @@ -73,7 +73,6 @@ public List getResourceTemplates(@PathParam("resourceGroupName") St for (TemplateDescriptorEntity template : templates) { TemplateDTO temp = new TemplateDTO(template); - temp.setFileContent(null); templateDTOs.add(temp); } return templateDTOs;