Package br.com.procempa.modus.entity

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


  }


  private static void runModusControl() {
    try {
      Equipamento eq = null;

      String rotulo = System.getProperty("rotulo");

      if (StringUtils.isEmpty(rotulo)) {
        Login.show();

        JPanel panel = new JPanel(new BorderLayout());
        JLabel text = new JLabel(
            "Selecione o equipamento a ser controlado:");

        List<Equipamento> eqs = EquipamentoDataServices
            .getNaoControlados(UserContext.getInstance()
                .getTelecentro());

        if (eqs.isEmpty()) {
          MessageView
              .showWarning(
                  "N�o existem nenhum equipamento dispon�vel. Por favor, "
                      + "cadastre est� m�quina para torn�-la dispon�vel.",
                  "Sem m�quinas dispon�veis.");
          throw new Exception("Sem m�quinas dispon�veis.");
        }
        JComboBox stationComboBox = new JComboBox(
            new EquipamentoComboBoxModel(eqs));
        panel.add(text, BorderLayout.NORTH);
        panel.add(stationComboBox, BorderLayout.SOUTH);

        JOptionPane.showMessageDialog(null, panel,
            "Monitor de Esta��o", JOptionPane.INFORMATION_MESSAGE);
        eq = (Equipamento) stationComboBox.getSelectedItem();

      } else {
        eq = EquipamentoDataServices.getRotulo(rotulo);
      }

      if (eq != null) {
        String ip = System.getProperty("ip");
        Logger.info("Local IP: " + ip);

        if (ip == null) {
          MessageView.showWarning("Por favor, informe um endere�o "
              + "ip v�lido da m�quina no arquivo modus.conf.",
              "Informe um endere�o IP inv�lido");
          throw new Exception("Informe o ip da m�quina no arquivo modus.conf");
        }

        try {
          InetAddress.getByName(ip);
        } catch (Exception e) {
          MessageView.showWarning("Por favor, informe um endere�o "
              + "ip v�lido da m�quina no arquivo modus.conf.",
              "Informe um endere�o IP inv�lido");
          throw new Exception("Informe o ip da m�quina no arquivo modus.conf");
        }
        TimerScreen.setSessionTime(eq.getTelecentro().getTempo());

        BlockScreen.splash();
       
        // Associa o ip ao equipamento
        eq.setIpAddress(ip);
        MonitorServerSocket.createServer(eq);

      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
View Full Code Here


import junit.framework.TestCase;

public class EquipamentoServicesTest extends TestCase {

    public void testEquipamentoById(){
        Equipamento eq = EquipamentoDataServices.getEquipamento(new Long(1));
        assertNotNull(eq);
       
        eq = EquipamentoDataServices.getEquipamento(new Long(-1));
        assertNull(eq);       
    }
View Full Code Here

   
    public void actionPerformed(ActionEvent e) {
        JPanel appPanel = Main.getInstance().getAppPanel();
        appPanel.removeAll();
        JXTable table = EquipamentoSearch.getInstance().getTable();
        Equipamento t = (Equipamento) table.getValueAt(table.getSelectedRows()[0], -1);
        JComponent form = EquipamentoForm.getInstance(t);
        appPanel.add(form);
        appPanel.validate();
        appPanel.repaint();
    }   
View Full Code Here

    private EquipamentoNewAction() {
        super("Equipamento", IconFactory.createEquipamento16());
    }
   
    public void actionPerformed(ActionEvent e) {
        Equipamento equipamento = new Equipamento();
        Main.getInstance().buildPanel(EquipamentoForm.getInstance(equipamento));
    }
View Full Code Here

    Action actionStation = new AbstractAction("", IconFactory
        .createEquipamentoFree16()) {
      private static final long serialVersionUID = 4680946165447301272L;

      public void actionPerformed(ActionEvent e) {
        Equipamento eq = (Equipamento) getTable().getValueAt(
            getTable().getSelectedRow(), -1);
        // Atualiza equipamento
        eq = EquipamentoDataServices.getEquipamento(eq.getId());
        if (eq.isOpened()) {
          EquipamentoDataServices.closeStation(eq);
        } else if (eq.isClosed()) {
          EquipamentoDataServices.openStation(eq);
        }
        refresh();
        stationButton.setEnabled(false);
        downMonitorButton.setEnabled(false);       
      }
    };

    stationButton.setAction(actionStation);
    stationButton.setToolTipText("Libera/bloqueia equipamento");
    addToolBarButton(stationButton);
    stationButton.setEnabled(false);

    Action actionMonitorDown = new AbstractAction("", IconFactory
        .createDown16()) {

      private static final long serialVersionUID = -489877560767758884L;

      public void actionPerformed(ActionEvent e) {
        Equipamento eq = (Equipamento) getTable().getValueAt(
            getTable().getSelectedRow(), -1);
        // Atualiza equipamento
        eq = EquipamentoDataServices.getEquipamento(eq.getId());
        if (eq.isControled()) {
          EquipamentoDataServices.downMonitor(eq);
        }
        refresh();
        stationButton.setEnabled(false);
        downMonitorButton.setEnabled(false);
View Full Code Here

    MouseListener tableMouseListener = new TableMouseListener(this) {

      public void mouseClicked(MouseEvent e) {
        super.mouseClicked(e);
        if (panel.getTable().getSelectedRowCount() == 1) {
          Equipamento eq = (Equipamento) getTable().getValueAt(
              getTable().getSelectedRow(), -1);
          stationButton.setEnabled(true);
          downMonitorButton.setEnabled(true);
          if (eq.isOpened()) {
            stationButton.setIcon(IconFactory
                .createEquipamentoBlock16());
            stationButton.setToolTipText("Bloqueia Equipamento");

          } else if (eq.isClosed() || eq.isReady()) {
            stationButton.setIcon(IconFactory
                .createEquipamentoFree16());
            stationButton.setToolTipText("Libera Equipamento");
          } else {
            stationButton.setEnabled(false);
View Full Code Here

  /**
   * Teste de inser��o de equipamento, sem valida��es
   * @throws Exception
   */
  public void testInsertEquipamento() throws Exception {
    Equipamento e = new Equipamento();
    e.setRotulo("Maquina2");
    e.setMarca("Dell");
    e.setProcessador("Pentium 4");
    e.setMemoria("512 MB");
    e.setDiscoRigido("16 GB");
   
    Equipamento e2 = (Equipamento) pa.persist(e);
    assertTrue(e2.getId() > 0);
    assertTrue(StringUtils.isNotEmpty(e2.getRotulo()));
    assertTrue(StringUtils.isNotEmpty(e2.getMarca()));
 
View Full Code Here

    new Thread(new Runnable() {
      public void run() {
        for (Visita visita : visitas) {
          if (!visita.isListaEspera()) {
            Equipamento eq = visita.getEquipamento();
            EquipamentoDataServices.closeStation(eq);
          }
        }
      }
View Full Code Here

    try {
      Telecentro telecentro = UserContext.getInstance().getTelecentro();
      List<Equipamento> eqs = EquipamentoDataServices
          .getLivres(telecentro);
      if (!eqs.isEmpty()) {
        Equipamento eq = eqs.get(0);
        if (visita.isListaEspera()) {
          visita.setEquipamento(eq);
          visita.setDataInicio(new Date());
          persist(visita);
          EquipamentoDataServices.openStation(eq);
View Full Code Here

   * @param id
   *            identificador do equipamento
   * @return inst�ncia de Equipamento
   */
  public static Equipamento getEquipamento(Long id) {
    Equipamento eq = null;
    try {
      PersistentAccess pa = PersistentAccessFactory.getInstance();
      eq = (Equipamento) pa.find(Equipamento.class, id);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

TOP

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

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.