83 lines
2.0 KiB
Java
Executable File
83 lines
2.0 KiB
Java
Executable File
package com.plannaplan.responses.models;
|
|
|
|
import com.plannaplan.entities.Exchange;
|
|
|
|
import io.swagger.annotations.ApiModel;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
/**
|
|
* Exchange proposal api repsonse
|
|
*/
|
|
@ApiModel(description = "Response shows information about user exchanges", value = "CourseWithGroupsResponse")
|
|
public class ExchangeResponse {
|
|
@ApiModelProperty(value = "Database id")
|
|
private Long id;
|
|
@ApiModelProperty(value = "Assignmetn that user want to trade")
|
|
private GroupDefaultResponse ownedAssignment;
|
|
@ApiModelProperty(value = "Group that user want to get")
|
|
private GroupDefaultResponse desiredGroup;
|
|
private String courseName;
|
|
|
|
/**
|
|
* creat new instance
|
|
*
|
|
* @param exchange entity to map to api repsone
|
|
*/
|
|
public ExchangeResponse(Exchange exchange) {
|
|
this.id = exchange.getId();
|
|
this.ownedAssignment = new GroupDefaultResponse(exchange.getOwnedAssignment().getGroup());
|
|
this.desiredGroup = new GroupDefaultResponse(exchange.getDesiredAssignment());
|
|
this.courseName = exchange.getOwnedAssignment().getGroup().getCourseId().getName();
|
|
}
|
|
|
|
/**
|
|
* @return name of course related to exchange
|
|
*/
|
|
public String getCourseName() {
|
|
return courseName;
|
|
}
|
|
|
|
/**
|
|
* @return get api respondse of wanted byt user group
|
|
*/
|
|
public GroupDefaultResponse getDesiredGroup() {
|
|
return desiredGroup;
|
|
}
|
|
|
|
/**
|
|
* @param desiredGroup set api respondse of wanted byt user group
|
|
*/
|
|
public void setDesiredGroup(GroupDefaultResponse desiredGroup) {
|
|
this.desiredGroup = desiredGroup;
|
|
}
|
|
|
|
/**
|
|
* @return get api respondse of owned user group
|
|
*/
|
|
public GroupDefaultResponse getOwnedAssignment() {
|
|
return ownedAssignment;
|
|
}
|
|
|
|
/**
|
|
* @param ownedAssignment set api respondse of owned user group
|
|
*/
|
|
public void setOwnedAssignment(GroupDefaultResponse ownedAssignment) {
|
|
this.ownedAssignment = ownedAssignment;
|
|
}
|
|
|
|
/**
|
|
* @return database id
|
|
*/
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* @param id set database id
|
|
*/
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
}
|