Add an "assignmentId" field in the "Assignment"-class.
This commit is contained in:
parent
82e12655e7
commit
53ccea869a
|
@ -10,12 +10,16 @@ import java.util.List;
|
|||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"assignmentId",
|
||||
"tasks",
|
||||
"workerId",
|
||||
"date"
|
||||
})
|
||||
public class Assignment {
|
||||
|
||||
@JsonProperty("assignmentId")
|
||||
private int assignmentId;
|
||||
|
||||
@JsonProperty("tasks")
|
||||
private List<Task> tasks;
|
||||
|
||||
|
@ -27,12 +31,21 @@ public class Assignment {
|
|||
|
||||
public Assignment() {}
|
||||
|
||||
public Assignment(List<Task> tasks, String workerId, Date date) {
|
||||
public Assignment(int assignmentId, List<Task> tasks, String workerId, Date date) {
|
||||
this.assignmentId = assignmentId;
|
||||
this.tasks = tasks;
|
||||
this.workerId = workerId;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public int getAssignmentId() {
|
||||
return assignmentId;
|
||||
}
|
||||
|
||||
public void setAssignmentId(int assignmentId) {
|
||||
this.assignmentId = assignmentId;
|
||||
}
|
||||
|
||||
public List<Task> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
@ -60,7 +73,8 @@ public class Assignment {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "Assignment{" +
|
||||
"tasks=" + tasks +
|
||||
"assignmentId=" + assignmentId +
|
||||
", tasks=" + tasks +
|
||||
", workerId='" + workerId + '\'' +
|
||||
", date=" + date +
|
||||
'}';
|
||||
|
|
|
@ -48,9 +48,13 @@ public class AssignmentHandler {
|
|||
System.exit(1);
|
||||
}
|
||||
|
||||
logger.debug(assignmentRequest.toString());
|
||||
//logger.debug(assignmentRequest.toString()); // DEBUG!
|
||||
|
||||
return assignmentRequest.getAssignment();
|
||||
Assignment assignment = assignmentRequest.getAssignment();
|
||||
logger.info("Assignment with id < " + assignment.getAssignmentId() + " > was received and it's ready to be processed.");
|
||||
// TODO - Maybe create a HashSet with these IDs. It may be useful for the Worker to know and report which assignments (and how many) it has processed.
|
||||
|
||||
return assignment;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue