Skip to content

Commit

Permalink
template rest: return template content on list, add ownerResourceId
Browse files Browse the repository at this point in the history
  • Loading branch information
yvespp committed Jul 22, 2021
1 parent 63ae39d commit afcae50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class TemplateDTO {

private Integer id;
private String relatedResourceIdentifier;
private Integer ownerResourceId;
private String name;
private String targetPath;
private Set<String> targetPlatforms;
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public List<TemplateDTO> getResourceRelationTemplates(@PathParam("resourceGroupN
List<TemplateDTO> templateDTOs = new ArrayList<>();
for (TemplateDescriptorEntity template : templates) {
TemplateDTO temp = new TemplateDTO(template);
temp.setFileContent(null);
templateDTOs.add(temp);
}
return templateDTOs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public List<TemplateDTO> getResourceTemplates(@PathParam("resourceGroupName") St

for (TemplateDescriptorEntity template : templates) {
TemplateDTO temp = new TemplateDTO(template);
temp.setFileContent(null);
templateDTOs.add(temp);
}
return templateDTOs;
Expand Down

0 comments on commit afcae50

Please sign in to comment.