/** ************* Ticket Operations ***************** */
 @Override
 public int createTicket(Ticket ticket) {
   validateTicket(ticket);
   if (ticket.getStatus() == null || ticket.getStatus() != TicketStatus.OPEN)
     ticket.setStatus(TicketStatus.OPEN);
   if (ticket.getCreator() == null) ticket.setCreator(userManager.getLoggedInUser());
   ticket.setCreatedDate(new Timestamp(System.currentTimeMillis()));
   int id = (Integer) getHibernateTemplate().save(ticket);
   return id;
 }
 @RequestMapping(
     value = {"", "/", "manage"},
     method = RequestMethod.GET)
 public ModelAndView showOverview() {
   ResultModel model = new ResultModel("account/overview");
   User user = userManager.getCurrentUser();
   Overview overview = accountManager.getOverview(user).encodeAccountNo();
   model.addObject("accountDetails", overview.getAccountDetails());
   model.addObject("paymentHistory", overview.getPaymentDetails());
   return model.getSuccess();
 }
 @RequestMapping(value = "activity", method = RequestMethod.GET)
 public ModelAndView showActivity() {
   ResultModel model = new ResultModel("account/activity");
   User user = userManager.getCurrentUser();
   Overview overview = accountManager.getOverview(user).encodeAccountNo();
   int numAccounts = overview.getAccountDetails().size();
   List<AccountDetail> accountList = overview.getAccountDetails();
   List<AccountDetail> firstAccount =
       numAccounts > 0
           ? overview.getAccountDetails().subList(0, 1)
           : new ArrayList<AccountDetail>();
   model.addObject("numAccounts", numAccounts);
   model.addObject("accountList", accountList);
   model.addObject("accountDetails", firstAccount);
   model.addObject("encodedAccountNumber", firstAccount.get(0).getEncodedAccountNum());
   return model.getSuccess();
 }
  @RequestMapping(value = "activity/{encodedAccountNum}/{page}", method = RequestMethod.GET)
  public ModelAndView showAccountActivity(
      @PathVariable("encodedAccountNum") String encodedAccountNum, @PathVariable("page") int page) {
    ResultModel model = new ResultModel("account/activity");
    User user = userManager.getCurrentUser();
    Overview overview = accountManager.getOverview(user).encodeAccountNo();
    int numAccounts = overview.getAccountDetails().size();
    int accountNum = SessionEncrypter.decryptId(encodedAccountNum);
    List<AccountDetail> accountList = overview.getAccountDetails();
    overview.getAccountDetail(accountNum).getUsageHistory().setCurrentPageNum(page);

    List<AccountDetail> accountDetails = new ArrayList<AccountDetail>();
    accountDetails.add(overview.getAccountDetail(accountNum));
    model.addObject("numAccounts", numAccounts);
    model.addObject("accountList", accountList);
    model.addObject("accountDetails", accountDetails);
    model.addObject("encodedAccountNumber", encodedAccountNum);
    return model.getSuccess();
  }
 public void updateTicketNote(TicketNote ticketNote) {
   if (ticketNote.getAuthor() == null) {
     ticketNote.setAuthor(userManager.getCurrentUser());
   }
   getHibernateTemplate().saveOrUpdate(ticketNote);
 }