Package br.com.procempa.modus.entity

Examples of br.com.procempa.modus.entity.Visita


    ImageIcon waitIcon = IconFactory.createEquipamentoFree16();
    Action actionWait = new AbstractAction("", waitIcon) {
      private static final long serialVersionUID = 8212678574091610500L;

      public void actionPerformed(ActionEvent e) {
        Visita visita = (Visita) table.getValueAt(table
            .getSelectedRow(), -1);
        VisitaDataServices.activeWaitList(visita);
        // Thread para atualiza��o da lista de equipamentos
        new Thread(new Runnable() {
          public void run() {
            EquipamentoSearch.getInstance().refresh();
          }
        }).start();
        remake();
      }
    };
    waitButton.setAction(actionWait);
    waitButton.setToolTipText("Libera equipameto para lista de espera");
    waitButton.setEnabled(false);

    ImageIcon saveIcon = IconFactory.createEncerraVisita();
    Action actionSave = new AbstractAction("", saveIcon) {

      private static final long serialVersionUID = 8212678574091610500L;

      public void actionPerformed(ActionEvent e) {
        // TODO � poss�vel acelerar o encerramento de lotes
        // de visitas colocando da encerramento em threads
        // separadas ou enviando o pacote de visitas ativas
        // para o application server.
        // ArrayList<Thread> threadList = new ArrayList<Thread>();

        for (int row : table.getSelectedRows()) {
          try {
            Visita v = (Visita) table.getValueAt(row, -1);
            Logger.debug("Encerrando visita ativa....");
            v = VisitaDataServices.terminate(v.getId());
            VisitaSearch.getInstance().getTableModel().replaceItem(
                v);
            Logger.debug("Visita ativa encerrada...");
          } catch (Exception e1) {
            e1.printStackTrace();
View Full Code Here


    MouseListener tableMouseListener = new MouseListener() {

      public void mouseClicked(MouseEvent e) {
        saveButton.setEnabled(table.getSelectedRowCount() > 0);
        Visita v = (Visita) table
            .getValueAt(table.getSelectedRow(), -1);
        if (v != null) {
          waitButton.setEnabled(v.isListaEspera());
        } else {
          waitButton.setEnabled(false);
        }
      }
View Full Code Here

public class VisitaDataServices implements DataServices {

  public static Visita getVisita(Long id) throws Exception {
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    Visita v = (Visita) pa.find(Visita.class, id);
    return v;
  }
View Full Code Here

    return true;
  }

  public static void remove(Long id) throws Exception {
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    Visita v = (Visita) pa.find(Visita.class, id);
    pa.remove(v);
  }
View Full Code Here

    pa.remove(v);
  }

  public static Visita terminate(Long id) throws Exception {
    PersistentAccess pa = PersistentAccessFactory.getInstance();
    Visita v = (Visita) pa.find(Visita.class, id);
    v.setDataFim(new Date());
    v = (Visita) pa.persist(v);
    if (!v.isListaEspera()) {
      Equipamento eq = v.getEquipamento();
      EquipamentoDataServices.closeStation(eq);
    }
    return v;
  }
View Full Code Here

  class ClockCellRenderer implements TableCellRenderer {

    public Component getTableCellRendererComponent(JTable t, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
      if (itemsClock.size() <= row) {
        Visita visita = ((Visita) t.getValueAt(row, -1));
        ClockLabel clockLabel = new ClockLabel();
        itemsClock.add(clockLabel);
        ClockTimerTask task = new ClockTimerTask(visita, clockLabel, t);

        timer.schedule(task, 0, 1000);
View Full Code Here

  protected void setUp() throws Exception {
    pa = PersistentAccessFactory.getInstance();
  }

  public void testInsertVisita() throws Exception {
    Visita v = createVisitaCompleto();
   
    Visita v2 = (Visita) pa.persist(v);
   
    assertTrue(v2.getId() > 0);
  }
View Full Code Here

  /**
   * @return
   * @throws CreateException
   */
  private Visita createVisitaCompleto() throws Exception {
    Visita v = (Visita) pa.create(Visita.class);
    Motivo m = new Motivo();
    m.setChat(Boolean.TRUE);
    v.setMotivo(m);
    v.setDataInicio(new Date());
    v.setEquipamento(EquipamentoDataServices.getList().get(0));
    try {
      v.setUsuario(UsuarioDataServices.getList().get(0));
      v.setTelecentro(TelecentroDataServices.getList().get(0));
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
View Full Code Here

   
    return v;
  }
 
  public void testInsertFail() throws CreateException {
    Visita v;
    try {
      v = (Visita) pa.create(Visita.class);
      pa.persist(v);
      fail("A persist�ncia de Visita com fields null deveria gerar uma exception.");
    } catch (Exception e) {
View Full Code Here

      //Ok. Persistencia com erro n�o realizada;
    }
  }
 
  public void testFindVisita() throws Exception {
    Visita v = createVisitaCompleto();
    Visita v2 = (Visita) pa.persist(v);
    Visita v3 = (Visita) pa.find(Visita.class,v2.getId());
    assertEquals(v2.getId(),v3.getId());
  }
View Full Code Here

TOP

Related Classes of br.com.procempa.modus.entity.Visita

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.