Exemple #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);
 }
Exemple #2
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;
 }