64 lines
1.6 KiB
Java
Executable File
64 lines
1.6 KiB
Java
Executable File
package com.plannaplan.responses.models;
|
|
|
|
import com.plannaplan.entities.Assignment;
|
|
import com.plannaplan.entities.Groups;
|
|
import io.swagger.annotations.ApiModel;
|
|
|
|
/**
|
|
* Group api response featuring group capacity
|
|
*/
|
|
@ApiModel(description = "Response shows information about group with included capacity.", value = "GroupWithCapacityResponse")
|
|
public class GroupWithCapacityResponse extends GroupDefaultResponse {
|
|
|
|
private int capacity;
|
|
|
|
/**
|
|
* create new instance
|
|
*
|
|
* @param group entity to map to api response
|
|
*/
|
|
public GroupWithCapacityResponse(Groups group) {
|
|
super(group);
|
|
this.capacity = group.getCapacity();
|
|
}
|
|
|
|
/**
|
|
* create new instance
|
|
*
|
|
* @param group entity to map to api response
|
|
* @param takenPlaces group taken places
|
|
*/
|
|
public GroupWithCapacityResponse(Groups group, int takenPlaces) {
|
|
super(group, takenPlaces);
|
|
this.capacity = group.getCapacity();
|
|
}
|
|
|
|
/**
|
|
* create new instance
|
|
*
|
|
* @param assignment entity to map to api response
|
|
*/
|
|
public GroupWithCapacityResponse(Assignment assignment) {
|
|
this(assignment.getGroup());
|
|
}
|
|
|
|
/**
|
|
* create new instance
|
|
*
|
|
* @param assignment entity to map to api response
|
|
* @param takenPlaces group taken places
|
|
*/
|
|
public GroupWithCapacityResponse(Assignment assignment, int takenPlaces) {
|
|
super(assignment, takenPlaces);
|
|
this.capacity = assignment.getGroup().getCapacity();
|
|
}
|
|
|
|
/**
|
|
* @return group taken places
|
|
*/
|
|
public int getCapacity() {
|
|
return capacity;
|
|
}
|
|
|
|
}
|