44 lines
1.4 KiB
Java
Executable File
44 lines
1.4 KiB
Java
Executable File
package com.plannaplan.responses.models;
|
|
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
|
|
import com.plannaplan.entities.Assignment;
|
|
import com.plannaplan.entities.Commision;
|
|
|
|
import io.swagger.annotations.ApiModel;
|
|
|
|
/**
|
|
* Commision With Groups api Response. It extends CommisionResponse repsone
|
|
*/
|
|
@ApiModel(description = "Response shows information about commision and its groups. It also has info about group state (is accepted or not)", value = "CommisionWithGroupsResponse")
|
|
public class CommisionWithAcceptedGroupsResponse extends CommisionResponse {
|
|
|
|
private List<AssignmentsSingleResponse> groups;
|
|
|
|
/**
|
|
* @param commision commision to map to api response
|
|
*/
|
|
public CommisionWithAcceptedGroupsResponse(Commision commision) {
|
|
super(commision);
|
|
this.groups = commision.getAssignments().stream().filter(Objects::nonNull)
|
|
.map(new Function<Assignment, AssignmentsSingleResponse>() {
|
|
|
|
@Override
|
|
public AssignmentsSingleResponse apply(Assignment arg0) {
|
|
return new AssignmentsSingleResponse(arg0);
|
|
}
|
|
}).collect(Collectors.toList());
|
|
}
|
|
|
|
/**
|
|
* @return lsit of fetured groups informations
|
|
*/
|
|
public List<AssignmentsSingleResponse> getGroups() {
|
|
return groups;
|
|
}
|
|
|
|
}
|