merge Collection Branch

Maxime
Maxime POINT 1 year ago
commit c133ac27e1

@ -1,16 +1,21 @@
package SAE.ApiREST.WebService.controller; package SAE.ApiREST.WebService.controller;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import SAE.ApiREST.WebService.Response;
import SAE.ApiREST.WebService.exception.ArticleException; import SAE.ApiREST.WebService.exception.ArticleException;
import SAE.ApiREST.WebService.model.Article; import SAE.ApiREST.WebService.model.Article;
import SAE.ApiREST.WebService.service.IArticleService; import SAE.ApiREST.WebService.service.IArticleService;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
@Controller @Controller
@RequestMapping("/ArticleWebService") @RequestMapping("/ArticleWebService")
@ -19,147 +24,561 @@ public class ArticleControler {
IArticleService articleService; IArticleService articleService;
// region POST // region POST
@PostMapping(
value = "/addArticle",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> addArticle(
@RequestBody Article article
) {
Response results = articleService.addArticle(article);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).addArticle(article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
// endregion // endregion
// region PUT // region PUT
@PutMapping(
value = "/updateTitle/{title}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> updateTitle(
@PathVariable("title") String title,
@RequestBody Article article
) {
Article results = articleService.updateTitle(article, title);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).updateTitle(title, article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).getArticlesByTitle(article.getTitle())).withRel("getArticlesByTitle"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
@PutMapping(
value = "/updateUrl/{url}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> updateUrl(
@PathVariable("url") String url,
@RequestBody Article article
) {
Article results = articleService.updateUrl(article, url);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).updateUrl(url, article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).getArticlesByUrl(article.getUrl())).withRel("getArticlesByUrl"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
@PutMapping(
value = "/updateDatePublished/{datePublished}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> updateDatePublished(
@PathVariable("datePublished") String datePublished,
@RequestBody Article article
) {
Article results = articleService.updateDatePublished(article, datePublished);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).updateDatePublished(datePublished, article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).getArticlesPublishedBefore(article.getDatePublished().toString())).withRel("getArticlesPublishedBefore"),
linkTo(methodOn(ArticleControler.class).getArticlesPublishedAfter(article.getDatePublished().toString())).withRel("getArticlesPublishedAfter"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
@PutMapping(
value = "/updateDateAdded/{dateAdded}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> updateDateAdded(
@PathVariable("dateAdded") String dateAdded,
@RequestBody Article article
) {
Article results = articleService.updateDateAdded(article, dateAdded);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).updateDateAdded(dateAdded, article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).getArticlesAddedBefore(article.getDateAdded().toString())).withRel("getArticlesAddedBefore"),
linkTo(methodOn(ArticleControler.class).getArticlesAddedAfter(article.getDateAdded().toString())).withRel("getArticlesAddedAfter"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
@PutMapping(
value = "/changeVisibility",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> changeVisibility(
@RequestBody Article article
) {
Article results = articleService.changeVisibility(article);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).changeVisibility(article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).getVisibleArticles()).withRel("getVisibleArticle"),
linkTo(methodOn(ArticleControler.class).getInvisibleArticles()).withRel("getInvisibleArticle"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
@PutMapping(
value = "/updateType/{type}",
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> updateType(
@PathVariable("type") Integer type,
@RequestBody Article article
) {
Article results = articleService.updateType(article, type);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).updateType(type, article)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("allArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(article.getId())).withRel("getArticleById"),
linkTo(methodOn(ArticleControler.class).getArticlesByType(article.getType())).withRel("getArticlesByType"),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(article.getId())).withRel("deleteArticle")
);
}
// endregion // endregion
// region GET // region GET
@GetMapping(
@GetMapping(value = "/getAllArticle", produces = MediaType.APPLICATION_JSON_VALUE) value = "/getAllArticle",
public @ResponseBody List<Article> getAllArticles() { produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getAllArticles() {
ArrayList<Article> results = (ArrayList<Article>) articleService.getAllArticles(); ArrayList<Article> results = (ArrayList<Article>) articleService.getAllArticles();
if(results.isEmpty()) { if(results.isEmpty()) {
throw new ArticleException("No articles available"); throw new ArticleException("No articles available");
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getAllArticles()).withSelfRel()
);
} }
@GetMapping(value = "/getArticleById/{id}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody Article getArticlesById(@PathVariable(value = "id") Integer id) { value = "/getArticleById/{id}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Article> getArticleById(@PathVariable(value = "id") Integer id) {
Article results = articleService.getArticlesById(id); Article results = articleService.getArticlesById(id);
if(results == null) { if(results == null) {
throw new ArticleException("Undefined id"); throw new ArticleException("Undefined id");
} }
return results; return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticleById(id)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(id)).withRel("deleteArticleFromUrl")
);
} }
@GetMapping(value = "/getArticlesByTitle/{title}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesByTitle(@PathVariable(value = "title") String title) { value = "/getArticlesByTitle/{title}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesByTitle(@PathVariable(value = "title") String title) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesByTitle(title); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesByTitle(title);
if(results.isEmpty()) { if(results.isEmpty()) {
throw new ArticleException("Undefined title"); throw new ArticleException("Undefined title");
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesByTitle(title)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleFromTitle(title)).withRel("deleteArticleFromTitle")
);
}
@GetMapping(
value = "/getArticlesByUrl/{url}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesByUrl(@PathVariable(value = "url") String url) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesByUrl(url);
if(results.isEmpty()) {
throw new ArticleException("Undefined title");
}
return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesByUrl(url)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleFromUrl(url)).withRel("deleteArticleFromId")
);
} }
@GetMapping(value = "/getArticlesByType/{type}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesByType(@PathVariable(value = "type") Integer type) { value = "/getArticlesByType/{type}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesByType(@PathVariable(value = "type") Integer type) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesByType(type); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesByType(type);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No content of type %d", type)); throw new ArticleException(String.format("No content of type %d", type));
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesByType(type)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleFromType(type)).withRel("deleteArticleFromType")
);
} }
@GetMapping(value = "/getVisibleArticles", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getVisibleArticles() { value = "/getVisibleArticles",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getVisibleArticles() {
ArrayList<Article> results = (ArrayList<Article>) articleService.getVisibleArticles(); ArrayList<Article> results = (ArrayList<Article>) articleService.getVisibleArticles();
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException("No visible article"); throw new ArticleException("No visible article");
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getVisibleArticles()).withSelfRel()
);
} }
@GetMapping(value = "/getInvisibleArticles", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getInvisibleArticles() { value = "/getInvisibleArticles",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getInvisibleArticles() {
ArrayList<Article> results = (ArrayList<Article>) articleService.getInvisibleArticles(); ArrayList<Article> results = (ArrayList<Article>) articleService.getInvisibleArticles();
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException("No invisible article"); throw new ArticleException("No invisible article");
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getInvisibleArticles()).withSelfRel()
);
} }
@GetMapping(value = "/getArticlesAddedBefore/{dateAdded}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesAddedBefore(@PathVariable(value = "dateAdded") String dateAdded) { value = "/getArticlesAddedBefore/{dateAdded}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesAddedBefore(@PathVariable(value = "dateAdded") String dateAdded) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesAddedBefore(dateAdded); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesAddedBefore(dateAdded);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No article added before %t", dateAdded)); throw new ArticleException(String.format("No article added before %t", dateAdded));
} }
return results;
return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesAddedBefore(dateAdded)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleAddedBefore(dateAdded)).withRel("deleteArticleAddedBefore")
);
} }
@GetMapping(value = "/getArticlesAddedAfter/{dateAdded}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesAddedAfter(@PathVariable(value = "dateAdded") String dateAdded) { value = "/getArticlesAddedAfter/{dateAdded}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesAddedAfter(@PathVariable(value = "dateAdded") String dateAdded) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesAddedAfter(dateAdded); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesAddedAfter(dateAdded);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No article added after %t", dateAdded)); throw new ArticleException(String.format("No article added after %t", dateAdded));
} }
return results;
return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesAddedAfter(dateAdded)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleAddedAfter(dateAdded)).withRel("deleteArticleAddedAfter")
);
} }
@GetMapping(value = "/getArticlesAddedBetween/{beginning}/{end}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesAddedAfter(@PathVariable(value = "beginning") String beginning, @PathVariable(value = "end") String end) { value = "/getArticlesAddedBetween/{beginning}/{end}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesAddedBetween(@PathVariable(value = "beginning") String beginning, @PathVariable(value = "end") String end) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesAddedBetween(beginning, end); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesAddedBetween(beginning, end);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No article added between %t and %t", beginning, end)); throw new ArticleException(String.format("No article added between %t and %t", beginning, end));
} }
return results;
return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesAddedBetween(beginning, end)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticleAddedBetween(beginning, end)).withRel("deleteArticleAddedBetween")
);
} }
@GetMapping(value = "/getArticlesPublishedBefore/{datePublished}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesPublishedBefore(@PathVariable(value = "datePublished") String datePublished) { value = "/getArticlesPublishedBefore/{datePublished}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesPublishedBefore(@PathVariable(value = "datePublished") String datePublished) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesPublishedBefore(datePublished); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesPublishedBefore(datePublished);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No article published before %t", datePublished)); throw new ArticleException(String.format("No article published before %t", datePublished));
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesPublishedBefore(datePublished)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticlePublishedBefore(datePublished)).withRel("deleteArticlePublishedBefore")
);
} }
@GetMapping(value = "/getArticlesPublishedAfter/{datePublished}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesPublishedAfter(@PathVariable(value = "datePublished") String datePublished) { value = "/getArticlesPublishedAfter/{datePublished}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesPublishedAfter(@PathVariable(value = "datePublished") String datePublished) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesPublishedAfter(datePublished); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesPublishedAfter(datePublished);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No article published after %t", datePublished)); throw new ArticleException(String.format("No article published after %t", datePublished));
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesPublishedAfter(datePublished)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticlePublishedAfter(datePublished)).withRel("deleteArticlePublishedAfter")
);
} }
@GetMapping(value = "/getArticlesPublishedBetween/{beginning}/{end}", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(
public @ResponseBody List<Article> getArticlesPublishedAfter(@PathVariable(value = "beginning") String beginning, @PathVariable(value = "end") String end) { value = "/getArticlesPublishedBetween/{beginning}/{end}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody CollectionModel<Article> getArticlesPublishedBetween(@PathVariable(value = "beginning") String beginning, @PathVariable(value = "end") String end) {
ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesPublishedBetween(beginning, end); ArrayList<Article> results = (ArrayList<Article>) articleService.getArticlesPublishedBetween(beginning, end);
if (results.isEmpty()) { if (results.isEmpty()) {
throw new ArticleException(String.format("No article published between %t and %t", beginning, end)); throw new ArticleException(String.format("No article published between %t and %t", beginning, end));
} }
return results; return CollectionModel.of(
results,
linkTo(methodOn(ArticleControler.class).getArticlesPublishedBetween(beginning, end)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).deleteArticlePublishedBetween(beginning, end)).withRel("getArticlesPublishedBetween")
);
} }
// endregion // endregion
// region DELETE // region DELETE
@DeleteMapping(
value = "/deleteArticleFromId/{id}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleFromId(
@PathVariable("id") Integer id
) {
Response results = articleService.deleteArticleFromId(id);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleFromId(id)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticleById(id)).withRel("getArticleById")
);
}
@DeleteMapping(
value = "/deleteArticleFromTitle/{title}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleFromTitle(
@PathVariable("title") String title
) {
Response results = articleService.deleteArticleFromTitle(title);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleFromTitle(title)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesByTitle(title)).withRel("getArticleByTitle")
);
}
@DeleteMapping(
value = "/deleteArticleFromUrl/{url}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleFromUrl(
@PathVariable("url") String url
) {
Response results = articleService.deleteArticleFromTitle(url);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleFromUrl(url)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesByUrl(url)).withRel("getArticlesByUrl")
);
}
@DeleteMapping(
value = "/deleteArticleFromType/{type}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleFromType(
@PathVariable("type") Integer type
) {
Response results = articleService.deleteArticleFromType(type);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleFromType(type)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesByType(type)).withRel("getArticlesByType")
);
}
@DeleteMapping(
value = "/deleteArticleAddedBefore/{date}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleAddedBefore(
@PathVariable("date") String date
) {
Response results = articleService.deleteArticleAddedBefore(date);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleAddedBefore(date)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesAddedBefore(date)).withRel("getArticlesAddedBefore")
);
}
@DeleteMapping(
value = "/deleteArticleAddedAfter/{date}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleAddedAfter(
@PathVariable("date") String date
) {
Response results = articleService.deleteArticleAddedAfter(date);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleAddedAfter(date)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesAddedAfter(date)).withRel("getArticlesAddedAfter")
);
}
@DeleteMapping(
value = "/deleteArticleAddedBetween/{beginning}/{end}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticleAddedBetween(
@PathVariable("beginning") String beginning,
@PathVariable("end") String end
) {
Response results = articleService.deleteArticleAddedBetween(beginning, end);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticleAddedBetween(beginning, end)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesAddedBetween(beginning, end)).withRel("getArticlesAddedBetween")
);
}
@DeleteMapping(
value = "/deleteArticlePublishedBefore/{date}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticlePublishedBefore(
@PathVariable("date") String date
) {
Response results = articleService.deleteArticlePublishedBefore(date);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticlePublishedBefore(date)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesPublishedBefore(date)).withRel("getArticlesPublishedBefore")
);
}
@DeleteMapping(
value = "/deleteArticlePublishedAfter/{date}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticlePublishedAfter(
@PathVariable("date") String date
) {
Response results = articleService.deleteArticlePublishedBefore(date);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticlePublishedAfter(date)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesPublishedAfter(date)).withRel("getArticlesPublishedAfter")
);
}
@DeleteMapping(
value = "/deleteArticlePublishedBetween/{beginning}/{end}",
produces = MediaType.APPLICATION_JSON_VALUE
)
public @ResponseBody EntityModel<Response> deleteArticlePublishedBetween(
@PathVariable("beginning") String beginning,
@PathVariable("end") String end
) {
Response results = articleService.deleteArticlePublishedBetween(beginning, end);
return EntityModel.of(
results,
linkTo(methodOn(ArticleControler.class).deleteArticlePublishedBetween(beginning, end)).withSelfRel(),
linkTo(methodOn(ArticleControler.class).getAllArticles()).withRel("getAllArticles"),
linkTo(methodOn(ArticleControler.class).getArticlesPublishedBetween(beginning, end)).withRel("getArticlesPublishedBetween")
);
}
// endregion // endregion
} }

@ -201,8 +201,8 @@ public class CollectController {
return EntityModel.of(art, return EntityModel.of(art,
linkTo(methodOn(CollectController.class).getCollectionById(results.getId())).withSelfRel(), linkTo(methodOn(CollectController.class).getCollectionById(results.getId())).withSelfRel(),
//linkTo(methodOn(TeacherController.class).getTeachById(results.getTeacher().getId())).withSelfRel(), linkTo(methodOn(TeacherController.class).getTeachById(results.getTeacher().getId())).withSelfRel(),
//linkTo(methodOn(ArticleControler.class).getArticleById(art.getId())).withSelfRel(), linkTo(methodOn(ArticleControler.class).getArticleById(art.getId())).withSelfRel(),
linkTo(methodOn(CollectController.class).getAllArticlesById(results.getId()) linkTo(methodOn(CollectController.class).getAllArticlesById(results.getId())
).withRel("getAllArticlesById"), ).withRel("getAllArticlesById"),
linkTo(methodOn(CollectController.class).deleteColletionById(results.getId()) linkTo(methodOn(CollectController.class).deleteColletionById(results.getId())

@ -1,8 +1,11 @@
package SAE.ApiREST.WebService.controller; package SAE.ApiREST.WebService.controller;
import SAE.ApiREST.WebService.exception.TeacherException;
import SAE.ApiREST.WebService.model.Teacher; import SAE.ApiREST.WebService.model.Teacher;
import SAE.ApiREST.WebService.service.ITeacherService; import SAE.ApiREST.WebService.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.CollectionModel;
import org.springframework.hateoas.EntityModel;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -12,6 +15,9 @@ import javax.print.attribute.standard.Media;
import java.awt.*; import java.awt.*;
import java.util.List; import java.util.List;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;
@Controller @Controller
@RequestMapping("/ProfWebService") @RequestMapping("/ProfWebService")
public class TeacherController { public class TeacherController {
@ -19,21 +25,77 @@ public class TeacherController {
private ITeacherService iTeacherServ; private ITeacherService iTeacherServ;
public TeacherController() { public TeacherController(ITeacherService iserv) {
this.iTeacherServ = iserv;
} }
@GetMapping(value = "/all", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "/all", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
public @ResponseBody List<Teacher> getAllTeacher(){ public @ResponseBody CollectionModel<Teacher> getAllTeacher(){
return iTeacherServ.getAllTeacher(); return CollectionModel.of(
iTeacherServ.getAllTeacher(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withSelfRel());
} }
@PostMapping(value = "addTeacher",produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
public @ResponseBody Teacher createTeacher( @RequestBody Teacher teach){ public @ResponseBody EntityModel<Teacher> createTeacher( @RequestBody Teacher teach){
return teach;
}
//@GetMapping(value = "/{id}") return EntityModel.of(teach,
//public linkTo(methodOn(TeacherController.class).createTeacher(teach)).withSelfRel(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withRel("all"));
}
@GetMapping(value = "/getid/{id}")
public @ResponseBody EntityModel<Teacher> getTeachById(@PathVariable("id") Integer id){
Teacher tt = iTeacherServ.getTeacherById(id);
if( tt == null ){
throw new TeacherException("No teacher found for this id !");
}
return EntityModel.of(tt,
linkTo(methodOn(TeacherController.class).getTeachById(id)).withSelfRel(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withRel("all"));
}
@GetMapping(value = "/getusername/{username}")
public @ResponseBody EntityModel<Teacher> getTeachByUsername(@PathVariable("username") String username) {
Teacher tt = iTeacherServ.getTeacherByUsername(username);
if (tt == null) {
throw new TeacherException("No teacher found for this username");
}
return EntityModel.of(tt,
linkTo(methodOn(TeacherController.class).getTeachByUsername(username)).withSelfRel(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withRel("all"));
}
@GetMapping( value = "/getmail/{mail}" )
public @ResponseBody EntityModel<Teacher> getTeachByMail(@PathVariable("mail") String mail) {
Teacher tt = iTeacherServ.getTeacherByMail(mail);
if( tt == null ) {
throw new TeacherException("No teacher found for this mail");
}
return EntityModel.of(tt,
linkTo(methodOn(TeacherController.class).getTeachByMail(mail)).withSelfRel(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withRel("all"));
}
@GetMapping( value = "/getdate/{date}" )
public @ResponseBody Teacher getTeachByDate(@PathVariable("date") String date) {
Teacher tt = iTeacherServ.getTeacherByMail(date);
if( tt == null ) {
throw new TeacherException("No teacher found for this mail");
}
return tt;
}
@PutMapping( value = "/modify/{username}" )
public @ResponseBody EntityModel<Teacher> modifyTeachUsername(@PathVariable("username") String username, Teacher tt){
if( username == "" ){
throw new TeacherException("Username provided for modification is empty");
}
iTeacherServ.modifyUsername(tt,username);
return EntityModel.of(tt,
linkTo(methodOn(TeacherController.class).modifyTeachUsername(username,tt)).withSelfRel(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withRel("all"));
}
@DeleteMapping( value = "delete")
public @ResponseBody EntityModel<List<Teacher>> deleteTeacher(Integer id){
return EntityModel.of(iTeacherServ.deleteTeacher(id),
linkTo(methodOn(TeacherController.class).deleteTeacher(id)).withSelfRel(),
linkTo(methodOn(TeacherController.class).getAllTeacher()).withRel("all"));
}
} }

@ -0,0 +1,17 @@
package SAE.ApiREST.WebService.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class TeacherAdvice {
@ResponseBody
@ExceptionHandler(TeacherException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
public String teacherNFHandler( TeacherException e) {
return e.getMessage();
}
}

@ -0,0 +1,7 @@
package SAE.ApiREST.WebService.exception;
public class TeacherException extends RuntimeException {
public TeacherException(String exception) {
super(exception);
}
}

@ -2,6 +2,7 @@ package SAE.ApiREST.WebService.model;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import jakarta.persistence.Entity; import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue; import jakarta.persistence.GeneratedValue;
@ -12,32 +13,41 @@ import jakarta.persistence.Id;
public class Article { public class Article {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
String id; Integer id;
String title; String title;
String URL; String url;
LocalDate dateAdded; LocalDate dateAdded;
LocalDate datePublished; LocalDate datePublished;
Boolean isVisible; Boolean visible;
Integer type; Integer type;
// ArrayList<Keyword> keywords = new ArrayList<>(); // ArrayList<Keyword> keywords = new ArrayList<>();
public Article() {} public Article() {}
public Article(String title, String URL, LocalDate dateAdded, LocalDate datePublished, Boolean visibility, Integer type) { public Article(String title, String url, LocalDate dateAdded, LocalDate datePublished, Boolean visibility, Integer type) {
this.id = "1"; this.id = 1;
this.title = title; this.title = title;
this.URL = URL; this.url = url;
this.dateAdded = dateAdded; this.dateAdded = dateAdded;
this.datePublished = datePublished; this.datePublished = datePublished;
this.isVisible = visibility; this.visible = visibility;
this.type = type; this.type = type;
} }
public String getId() { public Article(String title, String url, String dateAdded, String datePublished, Boolean visibility, Integer type) {
this.id = 1;
this.title = title;
this.url = url;
this.dateAdded = LocalDate.parse(dateAdded, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
this.datePublished = LocalDate.parse(datePublished, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
this.visible = visibility;
this.type = type;
}
public Integer getId() {
return this.id; return this.id;
} }
public void setId(String id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }
@ -49,36 +59,36 @@ public class Article {
this.title = title; this.title = title;
} }
public String getURL() { public String getUrl() {
return this.URL; return this.url;
} }
public void setURL(String URL) { public void setUrl(String url) {
this.URL = URL; this.url = url;
} }
public LocalDate getDateAdded() { public LocalDate getDateAdded() {
return this.dateAdded; return this.dateAdded;
} }
public void setDateAdded(LocalDate dateAdded) { public void setDateAdded(String dateAdded) {
this.dateAdded = dateAdded; this.dateAdded = LocalDate.parse(dateAdded, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
} }
public LocalDate getDatePublished() { public LocalDate getDatePublished() {
return this.datePublished; return this.datePublished;
} }
public void setDatePublished(LocalDate datePublished) { public void setDatePublished(String datePublished) {
this.datePublished = datePublished; this.datePublished = LocalDate.parse(datePublished, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
} }
public Boolean isVisible() { public Boolean getVisible() {
return this.isVisible; return this.visible;
} }
public void setVisibility(Boolean isVisible) { public void setVisibility(Boolean visible) {
this.isVisible = isVisible; this.visible = visible;
} }
public Integer getType() { public Integer getType() {

@ -4,7 +4,6 @@ import jakarta.persistence.Id;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Date;
@Entity @Entity
@ -38,8 +37,8 @@ public class Teacher {
return date; return date;
} }
public void setDate(LocalDate date) { public void setDate(String date) {
this.date = date; this.date = LocalDate.parse(date, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
} }
public String getMail() { public String getMail() {

@ -2,14 +2,29 @@ package SAE.ApiREST.WebService.service;
import java.util.List; import java.util.List;
import SAE.ApiREST.WebService.Response;
import SAE.ApiREST.WebService.model.Article; import SAE.ApiREST.WebService.model.Article;
public interface IArticleService { public interface IArticleService {
// region POST
public Response addArticle(Article article);
// endregion
// region PUT
public Article updateTitle(Article article, String title);
public Article updateUrl(Article article, String url);
public Article updateDatePublished(Article article, String datePublished);
public Article updateDateAdded(Article article, String dateAdded);
public Article changeVisibility(Article article);
public Article updateType(Article article, Integer type);
// endregion
// region GET // region GET
public List<Article> getAllArticles(); public List<Article> getAllArticles();
Article getArticlesById(Integer id); Article getArticlesById(Integer id);
public List<Article> getArticlesByTitle(String title); public List<Article> getArticlesByTitle(String title);
public List<Article> getArticlesByUrl(String url);
public List<Article> getArticlesByType(Integer type); public List<Article> getArticlesByType(Integer type);
public List<Article> getVisibleArticles(); public List<Article> getVisibleArticles();
public List<Article> getInvisibleArticles(); public List<Article> getInvisibleArticles();
@ -21,4 +36,16 @@ public interface IArticleService {
public List<Article> getArticlesPublishedBetween(String beginning, String end); public List<Article> getArticlesPublishedBetween(String beginning, String end);
// endregion // endregion
// region DELETE
public Response deleteArticleFromId(Integer id);
public Response deleteArticleFromTitle(String title);
public Response deleteArticleFromUrl(String url);
public Response deleteArticleFromType(Integer type);
public Response deleteArticleAddedBefore(String date);
public Response deleteArticleAddedAfter(String date);
public Response deleteArticleAddedBetween(String beginning, String end);
public Response deleteArticlePublishedBefore(String date);
public Response deleteArticlePublishedAfter(String date);
public Response deleteArticlePublishedBetween(String beginning, String end);
// endregion
} }

@ -1,21 +1,17 @@
package SAE.ApiREST.WebService.service; package SAE.ApiREST.WebService.service;
import SAE.ApiREST.WebService.Response;
import SAE.ApiREST.WebService.model.Teacher; import SAE.ApiREST.WebService.model.Teacher;
import java.time.LocalDate;
import java.util.List; import java.util.List;
public interface ITeacherService { public interface ITeacherService {
//Todo() by id, by mail, by username, allProf, by date (order), suppression, ajout, FAIRE DES REGIONS!
public List<Teacher> getAllTeacher(); public List<Teacher> getAllTeacher();
public Teacher getTeacherById(Integer id);
Teacher getTeacherById(Integer id);
public Teacher getTeacherByUsername(String username); public Teacher getTeacherByUsername(String username);
public Teacher getTeacherByMail(String mail); public Teacher getTeacherByMail(String mail);
public Teacher getTeacherByDate(String date); public Teacher getTeacherByDate(String date);
public List<Teacher> addTeacher(Teacher t); public List<Teacher> addTeacher(Teacher t);
public List<Teacher> deleteTeacher(Integer id); public List<Teacher> deleteTeacher(Integer id);
public Response modifyUsername(Teacher t, String newUsername);
} }

@ -7,11 +7,66 @@ import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import SAE.ApiREST.WebService.Response;
import SAE.ApiREST.WebService.model.Article; import SAE.ApiREST.WebService.model.Article;
@Service @Service
public class StubArticleService implements IArticleService { public class StubArticleService implements IArticleService {
// region POST
@Override
public Response addArticle(Article article) {
return new Response(
article.getId(),
"Article successfully created"
);
}
// endregion
// region PUT
@Override
public Article updateTitle(Article article, String title) {
Article newArticle = article;
newArticle.setTitle(title);
return newArticle;
}
@Override
public Article updateUrl(Article article, String url) {
Article newArticle = article;
newArticle.setUrl(url);
return newArticle;
}
@Override
public Article updateDatePublished(Article article, String datePublished) {
Article newArticle = article;
newArticle.setDatePublished(datePublished);
return newArticle;
}
@Override
public Article updateDateAdded(Article article, String dateAdded) {
Article newArticle = article;
newArticle.setDateAdded(dateAdded);
return newArticle;
}
@Override
public Article changeVisibility(Article article) {
Article newArticle = article;
newArticle.setVisibility(!article.getVisible());
return newArticle;
}
@Override
public Article updateType(Article article, Integer type) {
Article newArticle = article;
newArticle.setType(type);
return newArticle;
}
// endregion
// region GET // region GET
@Override @Override
public List<Article> getAllArticles() { public List<Article> getAllArticles() {
@ -80,6 +135,22 @@ public class StubArticleService implements IArticleService {
return articles; return articles;
} }
@Override
public List<Article> getArticlesByUrl(String url) {
List<Article> articles = new ArrayList<>();
articles.add(new Article(
"title",
url,
LocalDate.now().minusMonths(1),
LocalDate.now().minusMonths(2),
true,
1)
);
return articles;
}
@Override @Override
public List<Article> getArticlesByType(Integer type) { public List<Article> getArticlesByType(Integer type) {
List<Article> articles = new ArrayList<>(); List<Article> articles = new ArrayList<>();
@ -224,4 +295,86 @@ public class StubArticleService implements IArticleService {
return articles; return articles;
} }
// endregion // endregion
// region DELETE
@Override
public Response deleteArticleFromId(Integer id) {
return new Response(
id,
"Article successfully deleted"
);
}
@Override
public Response deleteArticleFromUrl(String url) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticleFromType(Integer type) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticleFromTitle(String title) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticleAddedBefore(String url) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticleAddedAfter(String url) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticleAddedBetween(String beginning, String end) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticlePublishedBefore(String url) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticlePublishedAfter(String url) {
return new Response(
1,
"Article successfully deleted"
);
}
@Override
public Response deleteArticlePublishedBetween(String beginning, String end) {
return new Response(
1,
"Article successfully deleted"
);
}
// endregion
} }

@ -1,18 +1,16 @@
package SAE.ApiREST.WebService.service; package SAE.ApiREST.WebService.service;
import SAE.ApiREST.WebService.Response;
import SAE.ApiREST.WebService.exception.TeacherException;
import SAE.ApiREST.WebService.model.Teacher; import SAE.ApiREST.WebService.model.Teacher;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
public class TeacherServiceStub implements ITeacherService { public class TeacherServiceStub implements ITeacherService {
//todo() recevoir collections, ajouter collections, supprimer collections
@Override @Override
public List<Teacher> getAllTeacher() { public List<Teacher> getAllTeacher() {
List<Teacher> allTeacher = new ArrayList<Teacher>(); List<Teacher> allTeacher = new ArrayList<Teacher>();
@ -31,9 +29,7 @@ public class TeacherServiceStub implements ITeacherService {
} }
@Override @Override
public Teacher getTeacherByUsername(String username) { public Teacher getTeacherByUsername(String username) { return new Teacher(12, "30-08-2020", "dadadou@gmail.com", username); }
return new Teacher(12, "30-08-2020", "dadadou@gmail.com", username);
}
@Override @Override
public Teacher getTeacherByMail(String mail) { public Teacher getTeacherByMail(String mail) {
@ -59,7 +55,15 @@ public class TeacherServiceStub implements ITeacherService {
allTeacher.add(new Teacher(1,"12-01-2023", "aline.alipres@gmail.com", "MsGarconManque")); allTeacher.add(new Teacher(1,"12-01-2023", "aline.alipres@gmail.com", "MsGarconManque"));
allTeacher.add(new Teacher(2, "20-08-2023", "Viviane.Delvecchio@gmail.com", "MmeMath")); allTeacher.add(new Teacher(2, "20-08-2023", "Viviane.Delvecchio@gmail.com", "MmeMath"));
allTeacher.remove(getTeacherById(id)); if(allTeacher.remove(getTeacherById(id))){
return allTeacher; return allTeacher;
} else {
throw new TeacherException(String.format("Teacher {id} isn't removed", id));
}
}
public Response modifyUsername(Teacher t, String newUsername){
t.setUsername(newUsername);
return new Response(t.getId(),String.format("This user %s has changed username", t.getMail()));
} }
} }

Loading…
Cancel
Save