Update the "WorkerReport" request and the "UrlReport" and "Payload" models.

This commit is contained in:
Lampros Smyrnaios 2021-06-19 07:07:36 +03:00
parent c194af167f
commit 40763ec146
3 changed files with 66 additions and 33 deletions

View File

@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.Date;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
@ -14,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
"mime_type",
"size",
"more_info",
"hash",
"md5",
"location",
"provenance"
})
@ -27,22 +29,22 @@ public class Payload {
private String original_url;
@JsonProperty("actual_url")
private String actual_url; // The url of the full-text itself.
private String actual_url;
@JsonProperty("date_acquired")
private String date_acquired;
private Date date_acquired;
@JsonProperty("mime_type")
private String mime_type;
@JsonProperty("size")
private String size;
private Long size; // In bytes.
@JsonProperty("more_info")
private String more_info;
@JsonProperty("hash")
private String hash;
@JsonProperty("md5")
private String md5;
@JsonProperty("location")
private String location;
@ -51,6 +53,19 @@ public class Payload {
private String provenance;
public Payload(String id, String original_url, String actual_url, Date date_acquired, String mime_type, Long size, String more_info, String md5, String location, String provenance) {
this.id = id;
this.original_url = original_url;
this.actual_url = actual_url;
this.date_acquired = date_acquired;
this.mime_type = mime_type;
this.size = size;
this.more_info = more_info;
this.md5 = md5;
this.location = location;
this.provenance = provenance;
}
public String getId() {
return id;
}
@ -75,11 +90,11 @@ public class Payload {
this.actual_url = actual_url;
}
public String getDate_acquired() {
public Date getDate_acquired() {
return date_acquired;
}
public void setDate_acquired(String date_acquired) {
public void setDate_acquired(Date date_acquired) {
this.date_acquired = date_acquired;
}
@ -91,11 +106,11 @@ public class Payload {
this.mime_type = mime_type;
}
public String getSize() {
public Long getSize() {
return size;
}
public void setSize(String size) {
public void setSize(Long size) {
this.size = size;
}
@ -107,12 +122,12 @@ public class Payload {
this.more_info = more_info;
}
public String getHash() {
return hash;
public String getMd5() {
return md5;
}
public void setHash(String hash) {
this.hash = hash;
public void setMd5(String md5) {
this.md5 = md5;
}
public String getLocation() {
@ -141,7 +156,7 @@ public class Payload {
", mime_type='" + mime_type + '\'' +
", size='" + size + '\'' +
", more_info='" + more_info + '\'' +
", hash='" + hash + '\'' +
", md5='" + md5 + '\'' +
", location='" + location + '\'' +
", provenance='" + provenance + '\'' +
'}';

View File

@ -7,42 +7,30 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"task",
"status",
"payload"
})
public class UrlReport {
@JsonProperty("task")
private Task task;
@JsonProperty("status")
private String Status;
private String status;
@JsonProperty("payload")
private Payload payload;
public UrlReport(Task task, String status, Payload payload) {
this.task = task;
Status = status;
public UrlReport(String status, Payload payload) {
this.status = status;
this.payload = payload;
}
public Task getTask() {
return task;
}
public void setTask(Task task) {
this.task = task;
}
public String getStatus() {
return Status;
return this.status;
}
public void setStatus(String status) {
Status = status;
this.status = status;
}
public Payload getPayload() {
@ -52,4 +40,12 @@ public class UrlReport {
public void setPayload(Payload payload) {
this.payload = payload;
}
@Override
public String toString() {
return "UrlReport{" +
"status='" + status + '\'' +
", payload=" + payload +
'}';
}
}

View File

@ -11,6 +11,7 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"workerId",
"assignmentId",
"urlReports"
})
public class WorkerReport {
@ -18,11 +19,15 @@ public class WorkerReport {
@JsonProperty("workerId")
private String workerId;
@JsonProperty("assignmentId")
private int assignmentId;
@JsonProperty("urlReports")
private List<UrlReport> urlReports;
public WorkerReport(String workerId, List<UrlReport> urlReports) {
public WorkerReport(String workerId, int assignmentId, List<UrlReport> urlReports) {
this.workerId = workerId;
this.assignmentId = assignmentId;
this.urlReports = urlReports;
}
@ -34,6 +39,14 @@ public class WorkerReport {
this.workerId = workerId;
}
public int getAssignmentId() {
return this.assignmentId;
}
public void setAssignmentId(int assignmentId) {
this.assignmentId = assignmentId;
}
public List<UrlReport> getUrlReports() {
return this.urlReports;
}
@ -41,4 +54,13 @@ public class WorkerReport {
public void setUrlReports(List<UrlReport> urlReports) {
this.urlReports = urlReports;
}
@Override
public String toString() {
return "WorkerReport{" +
"workerId='" + workerId + '\'' +
", assignmentId=" + assignmentId +
", urlReports=" + urlReports +
'}';
}
}