Пример #1
0
  @Override
  public CommentDto addComment(final String comment, final Integer taskId, final Integer userId) {

    if (!StringUtils.isEmpty(comment) && taskId != null) {
      final CommentEntity entity = new CommentEntity();
      entity.setContent(comment);
      entity.setTask(new TaskEntity(taskId));
      entity.setCreator(new UserEntity(userId));
      entity.setCreationDate(new Date());
      commentDAO.persist(entity);
      return dozer.map(entity, CommentDto.class);
    } else {
      return null;
    }
  }
Пример #2
0
 @Override
 public void deleteComment(final Integer id) {
   if (id != null) {
     commentDAO.delete(id);
   }
 }