Skip to content
Snippets Groups Projects

publication link comment

Merged Homada.Boumedane requested to merge hbo-publication-link-comment into master
6 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
36 @RequestMapping(UrlPath.ADMIN_PUBLICATIONS + SolidifyConstants.URL_PARENT_ID + ResourceName.COMMENTS)
37 public class PublicationCommentController extends CompositionController<Publication, Comment> {
38
39 private PersonService personService;
40
41 public PublicationCommentController(PersonService personService) {
42 this.personService = personService;
43 }
44
45 @GetMapping
46 @Override
47 public HttpEntity<Collection<Comment>> list(@PathVariable String parentid, @ModelAttribute Comment comment, Pageable pageable) {
48 return super.list(parentid, comment, pageable);
49 }
50
51 @GetMapping({"/{id}"})
  • 52 @Override
    53 public HttpEntity<Comment> get(@PathVariable String parentid, @PathVariable String id) {
    54 return super.get(parentid, id);
    55 }
    56
    57 @PostMapping
    58 @Override
    59 public HttpEntity<Comment> create(@PathVariable final String parentid, @Valid @RequestBody final Comment comment) {
    60 String authenticatedPersonId = this.personService.getLinkedPersonId(SecurityContextHolder.getContext().getAuthentication());
    61 Person person = this.personService.findOne(authenticatedPersonId);
    62 //set Person
    63 comment.setPerson(person);
    64 return super.create(parentid, comment);
    65 }
    66
    67 @PatchMapping({"/{id}"})
  • 58 @Override
    59 public HttpEntity<Comment> create(@PathVariable final String parentid, @Valid @RequestBody final Comment comment) {
    60 String authenticatedPersonId = this.personService.getLinkedPersonId(SecurityContextHolder.getContext().getAuthentication());
    61 Person person = this.personService.findOne(authenticatedPersonId);
    62 //set Person
    63 comment.setPerson(person);
    64 return super.create(parentid, comment);
    65 }
    66
    67 @PatchMapping({"/{id}"})
    68 @Override
    69 public HttpEntity<Comment> update(@PathVariable final String parentid, @PathVariable final String id, @RequestBody final Comment comment) {
    70 String authenticatedPersonId = this.personService.getLinkedPersonId(SecurityContextHolder.getContext().getAuthentication());
    71 Person person = this.personService.findOne(authenticatedPersonId);
    72 //set Person
    73 comment.setPerson(person);
  • 62 //set Person
    63 comment.setPerson(person);
    64 return super.create(parentid, comment);
    65 }
    66
    67 @PatchMapping({"/{id}"})
    68 @Override
    69 public HttpEntity<Comment> update(@PathVariable final String parentid, @PathVariable final String id, @RequestBody final Comment comment) {
    70 String authenticatedPersonId = this.personService.getLinkedPersonId(SecurityContextHolder.getContext().getAuthentication());
    71 Person person = this.personService.findOne(authenticatedPersonId);
    72 //set Person
    73 comment.setPerson(person);
    74 return super.update(parentid, id, comment);
    75 }
    76
    77 @DeleteMapping({"/{id}"})
  • 122 147 }
    123 148 }
    124 149
    150 protected void createPublicationFixture() {
  • 7 import javax.persistence.criteria.Predicate;
    8 import javax.persistence.criteria.Root;
    9 import java.util.List;
    10
    11 import ch.unige.solidify.specification.SolidifySpecification;
    12
    13 public class CommentSpecification extends SolidifySpecification<Comment> {
    14
    15 public CommentSpecification(Comment criteria) {
    16 super(criteria);
    17 }
    18
    19 @Override
    20 protected void completePredicatesList(Root<Comment> root, CriteriaQuery<?> query, CriteriaBuilder builder, List<Predicate> predicatesList) {
    21 if (this.criteria.getText() != null) {
    22 predicatesList.add(builder.like(root.get("code"), "%" + this.criteria.getText() + "%"));
  • added 1 commit

    • 1c46d9dc - refactor: reorganize import + replace string by constant inside controller

    Compare with previous version

  • added 1 commit

    • b5200ce9 - refactor: add verification of person on updating comment

    Compare with previous version

  • Homada.Boumedane added 18 commits

    added 18 commits

    Compare with previous version

  • Homada.Boumedane marked as a Work In Progress from 3b160365

    marked as a Work In Progress from 3b160365

  • Homada.Boumedane added 12 commits

    added 12 commits

    • faef00a3 - 1 commit from branch master
    • 95dad1b4 - feat: publication/comment
    • 8a192330 - wip
    • 52c85972 - test(aou): publication IT tests
    • 9bdc666d - test: publication
    • 9e6b718f - test: publication
    • 1b24672b - test: publication
    • 684faf89 - refactor: publication/comment
    • fce4eee2 - test: publication/comment
    • f56be9f0 - refactor: reorganize import + replace string by constant inside controller
    • d9dacf03 - refactor: add verification of person on updating comment
    • da8475c8 - refactor: refactor code after rebase with master

    Compare with previous version

  • Homada.Boumedane approved this merge request

    approved this merge request

  • Homada.Boumedane unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Please register or sign in to reply
    Loading