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

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


      Ticket ticket = this._ticketManager.getTicket(current.getCode());
      assertEquals(Ticket.STATES_CLOSED, ticket.getStatus());
      assertEquals(false, ticket.isResolved());
      List<TicketOperation> operations = this._ticketManager.getTicketOperations(current.getCode());
      assertEquals(1, operations.size());
      TicketOperation operation = operations.get(0);
      assertEquals(TicketOperation.OPERATIONS_CLOSE, operation.getOperationCode());

      current = t4;
      result = this.executeAction("admin", actionCode, current.getCode(), params);
      assertEquals("opNotAllowed", result);
      assertEquals(1, this.getAction().getActionErrors().size());

      params.put("resolved", "true");
      result = this.executeAction("mainEditor", actionCode, current.getCode(), params);
      assertEquals(Action.SUCCESS, result);
      ticket = this._ticketManager.getTicket(current.getCode());
      assertEquals(Ticket.STATES_CLOSED, ticket.getStatus());
      assertEquals(true, ticket.isResolved());
      operations = this._ticketManager.getTicketOperations(current.getCode());
      assertEquals(1, operations.size());
      operation = operations.get(0);
      assertEquals(TicketOperation.OPERATIONS_CLOSE, operation.getOperationCode());

      current = t5;
      result = this.executeAction("admin", actionCode, current.getCode(), params);
      assertEquals("opNotAllowed", result);
      assertEquals(1, this.getAction().getActionErrors().size());
View Full Code Here


      assertEquals(1, this._ticketDAO.searchTicketIds(null).size());

      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_ASSIGNED, new Date(), true);
      TicketOperation operation1 = this._helper.createTicketOperation(1, code, "editorCustomers", TicketOperation.OPERATIONS_ANSWER, "note1", 0, 0, "pageManager", new Date());
      this._ticketDAO.updateTicketWithOperation(modifiedTicket, operation1);
      Ticket updatedTicket = this._ticketDAO.loadTicket(code);
      this.compareTickets(modifiedTicket, updatedTicket);

      TicketOperation operation2 = this._helper.createTicketOperation(2, code, "mainEditor", TicketOperation.OPERATIONS_UPDATE, "note2", 0, 0, null, new Date());
      this._ticketDAO.updateTicketWithOperation(ticket, operation2);
      updatedTicket = this._ticketDAO.loadTicket(code);
      this.compareTickets(ticket, updatedTicket);

      List<TicketOperation> operations = this._ticketDAO.loadTicketOperations(code);
View Full Code Here

      conn = this.getConnection();
      stat = conn.prepareStatement(LOAD_TICKETOPERATIONS);
      stat.setString(1, code);
      res = stat.executeQuery();
      while (res.next()) {
        TicketOperation operation = this.loadTicketOperation(res);
        operations.add(operation);
      }
    } catch (Throwable t) {
      processDaoException(t, "Errore in caricamento ticket operations", "loadTicketOperations");
    } finally {
View Full Code Here

    }
    return ticket;
  }
 
  private TicketOperation loadTicketOperation(ResultSet res) throws SQLException {
    TicketOperation ticketOperation = new TicketOperation();
    ticketOperation.setId(res.getInt(1));
    ticketOperation.setTicketCode(res.getString(2));
    ticketOperation.setOperator(res.getString(3));
    ticketOperation.setOperationCode(res.getInt(4));
    ticketOperation.setInterventionType(res.getInt(5));
    ticketOperation.setPriority(res.getInt(6));
    ticketOperation.setWttRole(res.getString(7));
    ticketOperation.setNote(res.getString(8));
    ticketOperation.setDate(res.getTimestamp(9));
    return ticketOperation;
  }
View Full Code Here

    return ticket;
  }

  public TicketOperation createTicketOperation(int id, String ticketCode,
      String operator, int operationCode, String note, int interventionType, int priority, String wttRole, Date date) {
    TicketOperation operation = new TicketOperation();
    operation.setId(id);
    operation.setTicketCode(ticketCode);
    operation.setOperator(operator);
    operation.setOperationCode(operationCode);
    operation.setNote(note);
    operation.setInterventionType(interventionType);
    operation.setPriority(priority);
    operation.setWttRole(wttRole);
    operation.setDate(date);
    return operation;
  }
View Full Code Here

      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);

      List<TicketOperation> operations = this._ticketManager.getTicketOperations(code);
      assertEquals(2, operations.size());
      for (TicketOperation operation : operations) {
        if (operation.getId()==operation1.getId()) {
          this.compareTicketOperations(operation1, operation);
        } else if (operation.getId()==operation2.getId()) {
          this.compareTicketOperations(operation2, operation);
        } else {
          fail();
        }
      }
View Full Code Here

          return "opNotAllowed";
        } else if (!validated) {
          return INPUT;
        } else {
          Ticket newTicket = this.createTicketForUpdate(ticket, operationCode);
          TicketOperation operation = this.createTicketOperation(operationCode);
          ticketManager.updateTicketWithOperation(newTicket, operation);
          this.addActionMessage(this.getText("Message.ticketOperation.completed"));
        }
      } else {
        this.addActionError(this.getText("Errors.ticketOperation.ticketNotFound"));
View Full Code Here

    }
    return allowed;
  }
 
  protected TicketOperation createTicketOperation(int operationCode) {
    TicketOperation operation = new TicketOperation();
    operation.setTicketCode(this.getCode());
    operation.setOperator(this.getCurrentUser().getUsername());
    operation.setOperationCode(operationCode);
    operation.setDate(new Date());
    if (TicketOperation.OPERATIONS_ANSWER==operationCode) {
      operation.setNote(this.getMessage());
    } else if (TicketOperation.OPERATIONS_UPDATE==operationCode) {
      int priority = this.getPriority()!=null ? this.getPriority().intValue() : 0;
      operation.setPriority(priority);
      int interventionType = this.getInterventionType()!=null ? this.getInterventionType().intValue() : 0;
      operation.setInterventionType(interventionType);
      operation.setNote(this.getNote());
    } else if (TicketOperation.OPERATIONS_SETASSIGNABLE==operationCode) {
      operation.setWttRole(this.getRoleName());
    }
    return operation;
  }
View Full Code Here

  public void testView() throws Throwable {
    assertEquals(0, this._ticketManager.searchTicketIds(null).size());
    Ticket t1 = this._helper.createTicket(null, new Date(), null, "message1", "mainEditor", 0, 0, "pageManagerCustomers", null, Ticket.STATES_ASSIGNED, null, false);
    this._ticketManager.addTicket(t1);
    String ticketCode = t1.getCode();
    TicketOperation op1 = this._helper.createTicketOperation(0, ticketCode, "pageManagerCustomers", TicketOperation.OPERATIONS_TAKEINCHARGE, "notw", 0, 0, null, new Date());
    this._ticketManager.updateTicketWithOperation(t1, op1);

    String result = this.executeAction("pageManagerCoach", "view", ticketCode);
    assertEquals(BaseAction.USER_NOT_ALLOWED, result);
View Full Code Here

    Ticket ticket = this._ticketManager.getTicket(current.getCode());
    assertEquals(Ticket.STATES_ASSIGNED, ticket.getStatus());
    assertEquals("admin", ticket.getWttOperator());
    List<TicketOperation> operations = this._ticketManager.getTicketOperations(current.getCode());
    assertEquals(1, operations.size());
    TicketOperation operation = operations.get(0);
    assertEquals(TicketOperation.OPERATIONS_TAKEINCHARGE, operation.getOperationCode());
    assertEquals("admin", operation.getOperator());

    // t2 ASSIGNABLE
    current = t2;
    result = this.executeAction("admin", actionCode, current.getCode());
    assertEquals("opNotAllowed", result);
    ticket = this._ticketManager.getTicket(current.getCode());
    this.compareTickets(current, ticket);
    assertEquals(0, this._ticketManager.getTicketOperations(current.getCode()).size());

    // t3 ASSIGNED
    current = t3;
    result = this.executeAction("admin", actionCode, current.getCode());
    assertEquals("opNotAllowed", result);
    ticket = this._ticketManager.getTicket(current.getCode());
    this.compareTickets(current, ticket);
    assertEquals(0, this._ticketManager.getTicketOperations(current.getCode()).size());

    // t4 ASSIGNABLE
    current = t4;
    result = this.executeAction("mainEditor", actionCode, current.getCode());
    assertEquals(Action.SUCCESS, result);
    ticket = this._ticketManager.getTicket(current.getCode());
    assertEquals(Ticket.STATES_ASSIGNED, ticket.getStatus());
    assertEquals("mainEditor", ticket.getWttOperator());
    operations = this._ticketManager.getTicketOperations(current.getCode());
    assertEquals(1, operations.size());
    operation = operations.get(0);
    assertEquals(TicketOperation.OPERATIONS_TAKEINCHARGE, operation.getOperationCode());
    assertEquals("mainEditor", operation.getOperator());

    // t5 CLOSED
    current = t5;
    result = this.executeAction("admin", actionCode, current.getCode());
    assertEquals("opNotAllowed", result);
View Full Code Here

TOP

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

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.