Package com.agiletec.plugins.jpwtt.aps.system.services.ticket.model

Examples of com.agiletec.plugins.jpwtt.aps.system.services.ticket.model.Ticket


    try {
      conn = this.getConnection();
      stat = conn.createStatement();
      res = stat.executeQuery(LOAD_ALL_TICKETS);
      while(res.next()) {
        Ticket ticket = this.loadTicket(res);
        tickets.add(ticket);
      }
    } catch (Throwable t) {
      processDaoException(t, "Errore in caricamento tickets", "loadTickets");
    } finally {
View Full Code Here


  @Override
  public Ticket loadTicket(String code) throws ApsSystemException {
    Connection conn = null;
    PreparedStatement stat = null;
    ResultSet res = null;
    Ticket ticket = null;
    try {
      conn = this.getConnection();
      stat = conn.prepareStatement(LOAD_TICKET);
      stat.setString(1, code);
      res = stat.executeQuery();
View Full Code Here

   * @param ctx Il contesto di sistema
   * @return Il ticket.
   * @throws ApsSystemException
   */
  private Ticket loadTicket(ResultSet res) throws ApsSystemException {
    Ticket ticket = new Ticket();
    try {
      ticket.setCode(res.getString(1));
      ticket.setCreationDate(res.getTimestamp(2));
      ticket.setNome(res.getString(3));
      ticket.setCognome(res.getString(4));
      ticket.setCodFisc(res.getString(5));
      ticket.setComune(res.getString(6));
      ticket.setLocalita(res.getString(7));
      ticket.setTipoIndirizzo(res.getString(8));
      ticket.setIndirizzo(res.getString(9));
      ticket.setNumeroIndirizzo(res.getString(10));
      ticket.setTelefono(res.getString(11));
      ticket.setEmail(res.getString(12));
      ticket.setMessage(res.getString(13));
      ticket.setAuthor(res.getString(14));
      ticket.setUserInterventionType(res.getInt(15));
      ticket.setOpInterventionType(res.getInt(16));
      ticket.setPriority(res.getInt(17));
      ticket.setWttRole(res.getString(18));
      ticket.setWttOperator(res.getString(19));
      ticket.setStatus(res.getInt(20));
      ticket.setClosingDate(res.getTimestamp(21));
      int resolved = res.getInt(22);
      ticket.setResolved(resolved==1);
    } catch (Throwable t) {
      throw new ApsSystemException("Errore in caricamento ticket", t);
    }
    return ticket;
  }
View Full Code Here

    }
    return ticketIds;
  }
 
  public Ticket getTicket(String code) {
    Ticket ticket = null;
    try {
      ticket = this.getTicketManager().getTicket(code);
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "getTicket");
      throw new RuntimeException("Error searching ticket", t);
View Full Code Here

 
  public String view() {
    try {
      String code = this.getCode();
      ITicketManager ticketManager = this.getTicketManager();
      Ticket ticket = ticketManager.getTicket(code);
      if (ticket!=null && this.isAccessAllowed(ticket)) {
        this.setTicket(ticket);
        List<TicketOperation> ticketOperations = ticketManager.getTicketOperations(code);
        this.setTicketOperations(ticketOperations);
      } else {
View Full Code Here

    return ticket;
  }

  public Ticket createTicket(String code, Date creationDate, String email, String message, String author,
      int interventionType, int priority, String operator, String wttRole, int status, Date closingDate, boolean resolved) {
    Ticket ticket = new Ticket();
    ticket.setCode(code);
    ticket.setCreationDate(creationDate);
    ticket.setEmail(email);
    ticket.setMessage(message);
    ticket.setAuthor(author);
    ticket.setUserInterventionType(interventionType);
    ticket.setOpInterventionType(interventionType);
    ticket.setPriority(priority);
    ticket.setWttOperator(operator);
    ticket.setWttRole(wttRole);
    ticket.setStatus(status);
    ticket.setClosingDate(closingDate);
    ticket.setResolved(resolved);
    return ticket;
  }
View Full Code Here

    super.setUp();
    this.init();
  }

  public void testAddGetTicket() throws Throwable {
    Ticket ticket = this._helper.createTicket(null, new Date(), "nome", "cognome", "codFisc", "comune", "localita", "indT",
        "indirizzo", "numInd", "telefono", "email@email.itte", "message", "mainEditor", 0, 0, 0, null, null, Ticket.STATES_OPENED, null, false);
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      this._ticketManager.addTicket(ticket);

      assertEquals(1, this._ticketManager.searchTicketIds(null).size());
      Ticket addedTicket = this._ticketManager.getTicket(ticket.getCode());
      this.compareTickets(ticket, addedTicket);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._helper.deleteTickets();
View Full Code Here

      this._helper.deleteTickets();
    }
  }

  public void testUpdateTicketWithOperation() throws Throwable {
    Ticket ticket = this._helper.createTicket(null, new Date(), "nome", "cognome", "codFisc", "comune", "localita", "indT",
        "indirizzo", "numInd", "telefono", "email@email.itte", "message", "mainEditor", 0, 0, 0, null, null, Ticket.STATES_OPENED, null, false);
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      this._ticketManager.addTicket(ticket);
      String code = ticket.getCode();
      this.compareTickets(this._ticketManager.getTicket(code), ticket);
      assertEquals(1, this._ticketManager.searchTicketIds(null).size());

      TicketOperation operation1 = this._helper.createTicketOperation(1, code, "editorCustomers", TicketOperation.OPERATIONS_ANSWER, "note1", 0, 0, null, new Date());
      this._ticketManager.updateTicketWithOperation(ticket, operation1);
      this.compareTickets(this._ticketManager.getTicket(code), ticket);

      Ticket modifiedTicket = this._helper.createTicket(code, new Date(), "nome2", "cognome2", "codFisc2", "comune2",
          "localita2", "ind2", "indirizzo2", "num2", "telefono2", "email2@email.itte", "message2", "editorCustomers",
          1, 0, 1, "mainEditor", null, Ticket.STATES_WORKING, new Date(), true);
      TicketOperation operation2 = this._helper.createTicketOperation(2, code, "mainEditor", TicketOperation.OPERATIONS_UPDATE, "note2", 0, 0, null, new Date());
      this._ticketManager.updateTicketWithOperation(modifiedTicket, operation2);
      this.compareTickets(this._ticketManager.getTicket(code), modifiedTicket);
View Full Code Here

  }

  public void testGetTickets() throws Throwable {
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket(null, new Date(), "nome1", "cognome1", "codFisc1", "comune1",
          "localita1", "ind1", "indirizzo1", "num1", "telefono1", "email1@email.itte", "message1",
          "mainEditor", 0, 0, 0, "pageManagerCustomers", null, Ticket.STATES_OPENED, null, false);
      this._ticketManager.addTicket(t1);
      Ticket t2 = this._helper.createTicket(null, new Date(), null, "message2", "editorCustomers", 1, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), false);
      this._ticketManager.addTicket(t2);
      Ticket t3 = this._helper.createTicket(null, new Date(), null, "message3", "mainEditor", 2, 2, "editorCustomers", null, Ticket.STATES_CLOSED, null, false);
      this._ticketManager.addTicket(t3);
      Ticket t4 = this._helper.createTicket(null, new Date(), null, "message4", "pageManagerCustomers", 1, 0, "editorCustomers", null, Ticket.STATES_WORKING, new Date(), true);
      this._ticketManager.addTicket(t4);

      List<Ticket> tickets = this._ticketManager.getTickets();
      assertEquals(4, tickets.size());
      for (Ticket ticket : tickets) {
        String code = ticket.getCode();
        if (t1.getCode().equals(code)) {
          this.compareTickets(t1, ticket);
        } else if (t2.getCode().equals(code)) {
          this.compareTickets(t2, ticket);
        } else if (t3.getCode().equals(code)) {
          this.compareTickets(t3, ticket);
        } else if (t4.getCode().equals(code)) {
          this.compareTickets(t4, ticket);
        } else {
          fail();
        }
      }
View Full Code Here

  }

  public void testSearchTicketIds() throws Throwable {
    try {
      assertEquals(0, this._ticketManager.searchTicketIds(null).size());
      Ticket t1 = this._helper.createTicket("code1", new Date(), null, "message1", "mainEditor",
          0, 0, "pageManagerCustomers", null, Ticket.STATES_OPENED, null, false);
      this._ticketManager.addTicket(t1);
      Ticket t2 = this._helper.createTicket("code2", new Date(), null, "message2", "editorCustomers",
          1, 1, "mainEditor", null, Ticket.STATES_ASSIGNED, new Date(), false);
      this._ticketManager.addTicket(t2);
      Ticket t3 = this._helper.createTicket("code3", new Date(), null, "message3", "mainEditor",
          2, 2, "editorCustomers", null, Ticket.STATES_CLOSED, null, false);
      this._ticketManager.addTicket(t3);
      Ticket t4 = this._helper.createTicket("code4", new Date(), null, "message4", "pageManagerCustomers",
          1, 0, "editorCustomers", null, Ticket.STATES_WORKING, new Date(), true);
      this._ticketManager.addTicket(t4);

      // subject = 'subject2'
      TicketSearchBean searchBean = this._helper.createSearchBean("message2", null, null, null, null, null, null, null, null);
      List<String> ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t2.getCode() }, ticketIds);

      // Tutti i subject
      searchBean.setMessage("ess");
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t1.getCode(), t2.getCode(), t3.getCode(), t4.getCode() }, ticketIds);

      // author = 'mainEditor'
      searchBean.setAuthor("mainEditor");
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t1.getCode(), t3.getCode() }, ticketIds);

      // author = 'mainEditor', operator = 'editorCustomers'
      searchBean.setOperator("editorCustomers");
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t3.getCode() }, ticketIds);

      // operator = 'editorCustomers', priority = 0, status = RESOLVED
      searchBean.setAuthor(null);
      searchBean.setPriority(0);
      searchBean.setStates(new int[] { Ticket.STATES_WORKING });
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t4.getCode() }, ticketIds);

      // operator = 'editorCustomers', priority = 0
      searchBean.setStates(null);
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t4.getCode() }, ticketIds);

      // priority = 0
      searchBean.setOperator(null);
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t1.getCode(), t4.getCode() }, ticketIds);

      // priority = 0, interventionType = 1
      searchBean.setUserInterventionType(1);
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t4.getCode() }, ticketIds);

      // interventionType = 1
      searchBean.setPriority(null);
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t2.getCode(), t4.getCode() }, ticketIds);

      // interventionType = 1, resolved = true
      searchBean.setResolved(new Boolean(true));
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t4.getCode() }, ticketIds);

      // interventionType = 1, resolved = false
      searchBean.setResolved(new Boolean(false));
      ticketIds = this._ticketManager.searchTicketIds(searchBean);
      this.verifyTicketIds(new String[] { t2.getCode() }, ticketIds);
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpwtt.aps.system.services.ticket.model.Ticket

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.