Ejemplo n.º 1
0
 public void addSuggestion(SuggestionDTO dto) throws Exception {
   Suggestion suggestion = null;
   if (null == dto.getId()) {
     suggestion = new Suggestion();
   } else {
     suggestion = dao.getSuggestionById(dto.getId());
   }
   suggestion.setUserId(dto.getUserId());
   suggestion.setRole(dto.getRole());
   suggestion.setUserName(dto.getUserName());
   suggestion.setSubject(dto.getSubject());
   suggestion.setContent(dto.getContent());
   suggestion.setAccepted(dto.isAccepted());
   suggestion.setRejected(dto.isRejected());
   suggestion.setReasonForRejection(dto.getReasonForRejection());
   suggestion.setImplemented(dto.isImplemented());
   suggestion.setLastModified(dto.getLastModified());
   dao.addSuggestion(suggestion);
 }
Ejemplo n.º 2
0
 public void addComment(CommentDTO dto) throws Exception {
   Suggestion s = new Suggestion();
   s.setId(dto.getSuggestionId());
   Comment comment = new Comment();
   comment.setSuggestion(s);
   comment.setComments(dto.getComments());
   comment.setLastModified(dto.getLastModified());
   comment.setCommentedBy(dto.getCommentedBy());
   dao.addComment(comment);
 }
Ejemplo n.º 3
0
 public List<SuggestionDTO> getSuggestionList() throws Exception {
   List<Suggestion> suggestion = dao.getSuggestList();
   List<SuggestionDTO> dto = new ArrayList<SuggestionDTO>();
   for (Suggestion s : suggestion) {
     SuggestionDTO sdto = new SuggestionDTO();
     sdto.setId(s.getId());
     sdto.setUserId(s.getUserId());
     sdto.setRole(s.getRole());
     sdto.setUserName(s.getUserName());
     sdto.setSubject(s.getSubject());
     sdto.setContent(s.getContent());
     sdto.setAccepted(s.isAccepted());
     sdto.setRejected(s.isRejected());
     sdto.setReasonForRejection(s.getReasonForRejection());
     sdto.setImplemented(s.isImplemented());
     sdto.setLastModified(s.getLastModified());
     sdto.setListofComments(convertEntityToDTO(dao.getCommentListBySuggestionId(s)));
     dto.add(sdto);
   }
   return dto;
 }