- Add the "isControllerAlive"-endpoint.
- Change the data-type of the "UrlReport.status" to be "enum StatusType", in order to increase consistency and comparability. - Change the "Date" datatype in "Payload" to have the SQL's version. - Fix the project's name inside "settings.gradle". - Code cleanup.springify_project
parent
983b900da7
commit
d931315ced
@ -0,0 +1,24 @@
|
||||
package eu.openaire.urls_controller.controllers;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("")
|
||||
public class GeneralController {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GeneralController.class);
|
||||
|
||||
|
||||
@GetMapping("isAlive")
|
||||
public ResponseEntity<?> isControllerAlive() {
|
||||
|
||||
logger.info("Received an \"isAlive\" request.");
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package eu.openaire.urls_controller.exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public class BadRequestException extends RuntimeException {
|
||||
|
||||
public BadRequestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public BadRequestException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
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;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"id",
|
||||
"original_url",
|
||||
"actual_url",
|
||||
"date",
|
||||
"status",
|
||||
"error"
|
||||
})
|
||||
public class DownloadAttempt {
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
@JsonProperty("original_url")
|
||||
private String original_url;
|
||||
|
||||
@JsonProperty("date")
|
||||
private Date date;
|
||||
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
@JsonProperty("error")
|
||||
private Error error;
|
||||
|
||||
public DownloadAttempt(String id, String original_url, Date date, String status, Error error) {
|
||||
this.id = id;
|
||||
this.original_url = original_url;
|
||||
this.date = date;
|
||||
this.status = status;
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOriginal_url() {
|
||||
return original_url;
|
||||
}
|
||||
|
||||
public void setOriginal_url(String original_url) {
|
||||
this.original_url = original_url;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Error getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(Error error) {
|
||||
this.error = error;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
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",
|
||||
"link_to_payload"
|
||||
})
|
||||
public class FullText {
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
@JsonProperty("link_to_payload")
|
||||
private String link_to_payload;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLink_to_payload() {
|
||||
return link_to_payload;
|
||||
}
|
||||
|
||||
public void setLink_to_payload(String link_to_payload) {
|
||||
this.link_to_payload = link_to_payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FullText{" +
|
||||
"id='" + id + '\'' +
|
||||
", link_to_payload='" + link_to_payload + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
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.List;
|
||||
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"id",
|
||||
"dedupid",
|
||||
"pids",
|
||||
"urls",
|
||||
"datasource",
|
||||
"termsOfReuse"
|
||||
})
|
||||
public class Publication {
|
||||
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
|
||||
@JsonProperty("dedupid")
|
||||
private String dedupid;
|
||||
|
||||
@JsonProperty("pids")
|
||||
private List<String> pids;
|
||||
|
||||
@JsonProperty("urls")
|
||||
private List<String> urls;
|
||||
|
||||
@JsonProperty("datasource")
|
||||
private Datasource datasource;
|
||||
|
||||
@JsonProperty("termsOfReuse")
|
||||
private String termsOfReuse; // Takes values from the TermsOfReuseEnum.
|
||||
|
||||
public Publication(String id, String dedupid, List<String> pids, List<String> urls, Datasource datasource, String termsOfReuse) {
|
||||
this.id = id;
|
||||
this.dedupid = dedupid;
|
||||
this.pids = pids;
|
||||
this.urls = urls;
|
||||
this.datasource = datasource;
|
||||
this.termsOfReuse = termsOfReuse;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDedupid() {
|
||||
return dedupid;
|
||||
}
|
||||
|
||||
public void setDedupid(String dedupid) {
|
||||
this.dedupid = dedupid;
|
||||
}
|
||||
|
||||
public List<String> getPids() {
|
||||
return pids;
|
||||
}
|
||||
|
||||
public void setPids(List<String> pids) {
|
||||
this.pids = pids;
|
||||
}
|
||||
|
||||
public List<String> getUrls() {
|
||||
return urls;
|
||||
}
|
||||
|
||||
public void setUrls(List<String> urls) {
|
||||
this.urls = urls;
|
||||
}
|
||||
|
||||
public Datasource getDatasource() {
|
||||
return datasource;
|
||||
}
|
||||
|
||||
public void setDatasource(Datasource datasource) {
|
||||
this.datasource = datasource;
|
||||
}
|
||||
|
||||
public String getTermsOfReuse() {
|
||||
return termsOfReuse;
|
||||
}
|
||||
|
||||
public void setTermsOfReuse(String termsOfReuse) {
|
||||
this.termsOfReuse = termsOfReuse;
|
||||
}
|
||||
|
||||
public enum TermsOfReuseEnum {
|
||||
Full, Mining, Internal
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue