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

View File

@ -7,42 +7,30 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ @JsonPropertyOrder({
"task",
"status", "status",
"payload" "payload"
}) })
public class UrlReport { public class UrlReport {
@JsonProperty("task")
private Task task;
@JsonProperty("status") @JsonProperty("status")
private String Status; private String status;
@JsonProperty("payload") @JsonProperty("payload")
private Payload payload; private Payload payload;
public UrlReport(Task task, String status, Payload payload) { public UrlReport(String status, Payload payload) {
this.task = task; this.status = status;
Status = status;
this.payload = payload; this.payload = payload;
} }
public Task getTask() {
return task;
}
public void setTask(Task task) {
this.task = task;
}
public String getStatus() { public String getStatus() {
return Status; return this.status;
} }
public void setStatus(String status) { public void setStatus(String status) {
Status = status; this.status = status;
} }
public Payload getPayload() { public Payload getPayload() {
@ -52,4 +40,12 @@ public class UrlReport {
public void setPayload(Payload payload) { public void setPayload(Payload payload) {
this.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) @JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({ @JsonPropertyOrder({
"workerId", "workerId",
"assignmentId",
"urlReports" "urlReports"
}) })
public class WorkerReport { public class WorkerReport {
@ -18,11 +19,15 @@ public class WorkerReport {
@JsonProperty("workerId") @JsonProperty("workerId")
private String workerId; private String workerId;
@JsonProperty("assignmentId")
private int assignmentId;
@JsonProperty("urlReports") @JsonProperty("urlReports")
private List<UrlReport> 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.workerId = workerId;
this.assignmentId = assignmentId;
this.urlReports = urlReports; this.urlReports = urlReports;
} }
@ -34,6 +39,14 @@ public class WorkerReport {
this.workerId = workerId; this.workerId = workerId;
} }
public int getAssignmentId() {
return this.assignmentId;
}
public void setAssignmentId(int assignmentId) {
this.assignmentId = assignmentId;
}
public List<UrlReport> getUrlReports() { public List<UrlReport> getUrlReports() {
return this.urlReports; return this.urlReports;
} }
@ -41,4 +54,13 @@ public class WorkerReport {
public void setUrlReports(List<UrlReport> urlReports) { public void setUrlReports(List<UrlReport> urlReports) {
this.urlReports = urlReports; this.urlReports = urlReports;
} }
@Override
public String toString() {
return "WorkerReport{" +
"workerId='" + workerId + '\'' +
", assignmentId=" + assignmentId +
", urlReports=" + urlReports +
'}';
}
} }