Update classes: "Assignment", "Task", "Error", "Payload", "UrlsRequest".

This commit is contained in:
Lampros Smyrnaios 2021-04-24 21:05:21 +03:00
parent 89c6a73a30
commit c2ea8a69de
7 changed files with 54 additions and 22 deletions

View File

@ -1,21 +1,35 @@
package eu.openaire.urls_controller.models; package eu.openaire.urls_controller.models;
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 java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"tasks",
"workerId",
"date"
})
public class Assignment { public class Assignment {
@JsonProperty("tasks") @JsonProperty("tasks")
List<Task> tasks; private List<Task> tasks;
@JsonProperty("workerId") @JsonProperty("workerId")
String workerId; private String workerId;
@JsonProperty("date") @JsonProperty("date")
Date date; private Date date;
public Assignment(List<Task> tasks, String workerId, Date date) {
this.tasks = tasks;
this.workerId = workerId;
this.date = date;
}
public List<Task> getTasks() { public List<Task> getTasks() {
return tasks; return tasks;

View File

@ -1,14 +1,21 @@
package eu.openaire.urls_controller.models; package eu.openaire.urls_controller.models;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"type",
"message"
})
public class Error { public class Error {
@JsonProperty("type") @JsonProperty("type")
String type; private String type;
@JsonProperty("message") @JsonProperty("message")
String message; private String message;
public String getType() { public String getType() {
return type; return type;

View File

@ -27,7 +27,7 @@ public class Payload {
private String original_url; private String original_url;
@JsonProperty("actual_url") @JsonProperty("actual_url")
private String actual_url; private String actual_url; // The url of the full-text itself.
@JsonProperty("date_acquired") @JsonProperty("date_acquired")
private String date_acquired; private String date_acquired;
@ -51,6 +51,14 @@ public class Payload {
private String provenance; private String provenance;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOriginal_url() { public String getOriginal_url() {
return original_url; return original_url;
} }
@ -123,15 +131,6 @@ public class Payload {
this.provenance = provenance; this.provenance = provenance;
} }
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@Override @Override
public String toString() { public String toString() {
return "Payload{" + return "Payload{" +

View File

@ -14,11 +14,9 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
}) })
public class Publication { public class Publication {
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@JsonProperty("dedupid") @JsonProperty("dedupid")
private String dedupid; private String dedupid;

View File

@ -1,14 +1,26 @@
package eu.openaire.urls_controller.models; package eu.openaire.urls_controller.models;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"url"
})
public class Task { public class Task {
@JsonProperty("id") @JsonProperty("id")
String id; private String id;
@JsonProperty("url") @JsonProperty("url")
String url; private String url;
public Task(String id, String url) {
this.id = id;
this.url = url;
}
public String getId() { public String getId() {
return id; return id;

View File

@ -13,15 +13,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
}) })
public class UrlToCheck { // This model will not match with a database, public class UrlToCheck { // This model will not match with a database,
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@JsonProperty("url") @JsonProperty("url")
private String url; private String url;
public UrlToCheck() { public UrlToCheck() {
} }

View File

@ -1,11 +1,16 @@
package eu.openaire.urls_controller.payloads.requests; package eu.openaire.urls_controller.payloads.requests;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import eu.openaire.urls_controller.models.Payload; import eu.openaire.urls_controller.models.Payload;
import java.util.List; import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UrlsRequest { public class UrlsRequest {
@JsonProperty("payloads")
private List<Payload> payloads; private List<Payload> payloads;
public void UrlsResponse() { public void UrlsResponse() {