From 7e45da13061d172d8c862d3f4f5980e67a05fa7f Mon Sep 17 00:00:00 2001 From: BuildTools Date: Tue, 1 Dec 2020 17:21:54 +0100 Subject: [PATCH] Not null group response --- .../src/main/java/com/plannaplan/services/GroupService.java | 3 --- .../plannaplan/responses/models/GroupDefaultResponse.java | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/GroupService.java b/buisnesslogic/src/main/java/com/plannaplan/services/GroupService.java index 29673ec..615c9d8 100755 --- a/buisnesslogic/src/main/java/com/plannaplan/services/GroupService.java +++ b/buisnesslogic/src/main/java/com/plannaplan/services/GroupService.java @@ -64,9 +64,6 @@ public class GroupService { public HashMap getTakenPlaces(List groups) { HashMap response = new HashMap<>(); - // List respoonses = this.repo.getAssignedAmounts( - // groups.stream().filter(Objects::nonNull).map(Groups::getId).collect(Collectors.toList())); - List respoonses = this.repo .getAssignedAmounts(groups.stream().filter(Objects::nonNull).map(new Function() { @Override diff --git a/restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java b/restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java index 50329eb..c182343 100755 --- a/restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java +++ b/restservice/src/main/java/com/plannaplan/responses/models/GroupDefaultResponse.java @@ -1,5 +1,6 @@ package com.plannaplan.responses.models; +import com.fasterxml.jackson.annotation.JsonInclude; import com.plannaplan.entities.Assignment; import com.plannaplan.entities.Groups; import com.plannaplan.types.GroupType; @@ -7,6 +8,7 @@ import com.plannaplan.types.GroupType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +@JsonInclude(JsonInclude.Include.NON_NULL) @ApiModel(description = "Response shows information about given group.", value = "GroupDefaultResponse") public class GroupDefaultResponse { @@ -29,7 +31,7 @@ public class GroupDefaultResponse { private GroupType type; @ApiModelProperty(value = "Value shows how many places is already taken by other students.") - private int takenPlaces; + private Integer takenPlaces; public GroupDefaultResponse(Groups group) { this.id = group.getId() != null ? group.getId() : null; @@ -73,7 +75,7 @@ public class GroupDefaultResponse { return id; } - public int getTakenPlaces() { + public Integer getTakenPlaces() { return this.takenPlaces; }