Search in sources :

Example 1 with PrivilegeObject

use of pl.morecraft.dev.settler.domain.PrivilegeObject in project Settler by EmhyrVarEmreis.

the class CommentService method getByPrivilegeObject.

public ResponseEntity<List<CommentDTO>> getByPrivilegeObject(Long objectId) {
    PrivilegeObject privilegeObject = privilegeObjectRepository.findOne(objectId);
    if (privilegeObject == null) {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
    List<Comment> commentList = getByPrivilegeObject(privilegeObject);
    List<CommentDTO> commentDTOList = getListPageConverter().convert(commentList, CommentDTO.class);
    return new ResponseEntity<>(commentDTOList, HttpStatus.OK);
}
Also used : PrivilegeObject(pl.morecraft.dev.settler.domain.PrivilegeObject) Comment(pl.morecraft.dev.settler.domain.Comment) QComment(pl.morecraft.dev.settler.domain.QComment) ResponseEntity(org.springframework.http.ResponseEntity) CommentDTO(pl.morecraft.dev.settler.web.dto.CommentDTO)

Example 2 with PrivilegeObject

use of pl.morecraft.dev.settler.domain.PrivilegeObject in project Settler by EmhyrVarEmreis.

the class CommentService method deleteByPrivilegeObject.

public ResponseEntity<List<CommentDTO>> deleteByPrivilegeObject(Long objectId) {
    PrivilegeObject privilegeObject = privilegeObjectRepository.findOne(objectId);
    if (privilegeObject == null) {
        return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
    }
    commentRepository.delete(objectId);
    return new ResponseEntity<>(HttpStatus.OK);
}
Also used : PrivilegeObject(pl.morecraft.dev.settler.domain.PrivilegeObject) ResponseEntity(org.springframework.http.ResponseEntity)

Aggregations

ResponseEntity (org.springframework.http.ResponseEntity)2 PrivilegeObject (pl.morecraft.dev.settler.domain.PrivilegeObject)2 Comment (pl.morecraft.dev.settler.domain.Comment)1 QComment (pl.morecraft.dev.settler.domain.QComment)1 CommentDTO (pl.morecraft.dev.settler.web.dto.CommentDTO)1