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;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.Date;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"tasks",
"workerId",
"date"
})
public class Assignment {
@JsonProperty("tasks")
List<Task> tasks;
private List<Task> tasks;
@JsonProperty("workerId")
String workerId;
private String workerId;
@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() {
return tasks;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,16 @@
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 java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UrlsRequest {
@JsonProperty("payloads")
private List<Payload> payloads;
public void UrlsResponse() {