parent
b012e65bfa
commit
098549fe9e
@ -1,7 +1,14 @@
|
|||||||
package main.java.SAE.ApiREST.Client;
|
package main.java.SAE.ApiREST.Client;
|
||||||
|
|
||||||
public class TestArticleApi {
|
public class TestArticleApi {
|
||||||
|
private RestTemplate restTemplate = new RestTemplate();
|
||||||
|
private String baseURI = "http://localhost:8080/ArticleWebService/";
|
||||||
|
|
||||||
public TestArticleApi() {
|
public TestArticleApi() {
|
||||||
|
testPost();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void testPost() {
|
||||||
|
restTemplate.postForObject(baseURI + "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,100 @@
|
|||||||
|
package SAE.ApiREST.Client;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
public class Article {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
Integer id;
|
||||||
|
String title;
|
||||||
|
String url;
|
||||||
|
LocalDate dateAdded;
|
||||||
|
LocalDate datePublished;
|
||||||
|
Boolean visible;
|
||||||
|
Integer type;
|
||||||
|
// ArrayList<Keyword> keywords = new ArrayList<>();
|
||||||
|
|
||||||
|
public Article() {}
|
||||||
|
|
||||||
|
public Article(String title, String url, LocalDate dateAdded, LocalDate datePublished, Boolean visibility, Integer type) {
|
||||||
|
this.id = 1;
|
||||||
|
this.title = title;
|
||||||
|
this.url = url;
|
||||||
|
this.dateAdded = dateAdded;
|
||||||
|
this.datePublished = datePublished;
|
||||||
|
this.visible = visibility;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return this.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return this.url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getDateAdded() {
|
||||||
|
return this.dateAdded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateAdded(String dateAdded) {
|
||||||
|
this.dateAdded = LocalDate.parse(dateAdded, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalDate getDatePublished() {
|
||||||
|
return this.datePublished;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatePublished(String datePublished) {
|
||||||
|
this.datePublished = LocalDate.parse(datePublished, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getVisible() {
|
||||||
|
return this.visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVisibility(Boolean visible) {
|
||||||
|
this.visible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(Integer type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public List<Keyword> getKeywords() {
|
||||||
|
return this.keywords;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKeywords(List<Keyword> keywords) {
|
||||||
|
this.keywords = keywords;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package SAE.ApiREST.Client;
|
||||||
|
|
||||||
|
public class Response {
|
||||||
|
|
||||||
|
Integer id;
|
||||||
|
String statusMessage;
|
||||||
|
|
||||||
|
public Response() {}
|
||||||
|
|
||||||
|
public Response(Integer id, String statusMessage) {
|
||||||
|
this.id = id;
|
||||||
|
this.statusMessage = statusMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatusMessage() {
|
||||||
|
return this.statusMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusMessage(String statusMessage) {
|
||||||
|
this.statusMessage = statusMessage;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue