Package br.com.procempa.modus.entity

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


  public static JComponent getInstance(Usuario u) {
    panel = new VisitaForm(IconFactory.createVisita16(),
        "Registrar Visita");
    panel.usuario = u;
    panel.visita = new Visita();
    panel.visita.setDataInicio(new Date());
   
//    try {
//      PersistentAccess pa = PersistentAccessFactory.getInstance();
//      panel.visita.setDataInicio(pa.getServerDate());
View Full Code Here


      private static final long serialVersionUID = 8212678574091610500L;

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

    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);
        try {
          visita = VisitaDataServices.getVisita(visita.getId());
          VisitaDataServices.activeWaitList(visita);
          itemsClock.remove(visita.getId());
          VisitaTimer.cancel(visita.getId());
         
          // Thread para atualiza��o da lista de equipamentos
//          new Thread(new Runnable() {
//            public void run() {
//              EquipamentoSearch.getInstance().refresh();
//            }
//          }).start();
          refresh();
          //remake();
        } catch (Exception e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
      }
    };
    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) {

        final ArrayList<Visita> visitas = new ArrayList<Visita>();
        for (int row : table.getSelectedRows()) {
          Visita visita = (Visita) table.getValueAt(row, -1);
          visita.setDataFim(new Date());
          visitas.add(visita);
        }

        Logger.info("Encerrando visitas ativas....");
        try {
          VisitaDataServices.terminate(visitas);
        } catch (Exception e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
        Logger.info("Visitas encerradas...");

        for (Visita visita : visitas) {
          getTableModel().removeItem(visita);
          itemsClock.remove(visita.getId());
          VisitaTimer.cancel(visita.getId());         
        }
       
        // Reconstroi a table para remontar os
        // timers corretamente
        //remake();
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

    @Override
    public void setValueAt(Object aValue, int row, int column) {
      if (column == COLUMN_EQUIPAMENTO) {
        try {
          Visita visita = (Visita) getList().get(row);

          Equipamento eq = EquipamentoDataServices
              .getRotulo((String) aValue);
          visita.setEquipamento(eq);

          visita = (Visita) VisitaDataServices
              .persist((Visita) getList().get(row));
          getList().set(row,
              VisitaDataServices.getVisita(visita.getId()));
        } catch (Exception e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      } else {
View Full Code Here

  class ClockCellRenderer implements TableCellRenderer {

    public Component getTableCellRendererComponent(JTable t, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
      Visita visita = ((Visita) t.getValueAt(row, -1));
      Long id = visita.getId();

      if (!itemsClock.containsKey(id)) {
        ClockLabel clockLabel = new ClockLabel();
        itemsClock.put(id,clockLabel);
       
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

        .search(
            "FROM Visita WHERE dataInicio >= :dataInicio AND dataFim <= :dataFim AND telecentro=:telecentro ORDER BY dataInicio",
            params);

    for (Persistent persistent : list) {
      Visita visita = (Visita) persistent;
      items.add(visita);
    }

    return items;
  }
View Full Code Here

    Integer numVisitas = new Integer(0);

    if (!list.isEmpty()) {
      Persistent persistent = list.get(0);
      Visita v = (Visita) persistent;
      idAnterior = v.getUsuario().getId();
    }

    for (Persistent persistent : list) {
      Visita visita = (Visita) persistent;
      if (visita.getUsuario().getId() == idAnterior) {
        numVisitas++;
        totalHoras += visita.getDataFim().getTime()
            - visita.getDataInicio().getTime();
      } else {
        RelatorioVisitaVO relatorio = new RelatorioVisitaVO();
        relatorio.setNome(UsuarioDataServices.getUsuario(idAnterior)
            .getNome());
        relatorio.setNumeroVisitas(numVisitas);
        relatorio.setTotalHoras(totalHoras);
        items.add(relatorio);
        idAnterior = visita.getUsuario().getId();
        numVisitas = 1;
        totalHoras = visita.getDataFim().getTime()
            - visita.getDataInicio().getTime();
      }

    }

    if (!list.isEmpty()) {
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.