Package br.com.procempa.modus.entity

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


    private EntityManager em;

  @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
  public ExceptionLog log(ExceptionLog exceptionLog) {
   
    ExceptionLog eLog = null;
    try {
      Logger.getLogger("ExceptionLog").info("Executando ExceptionLog...");
      eLog = em.merge(exceptionLog);
    } catch (Exception e) {
      // TODO: handle exception
View Full Code Here


      e.printStackTrace();     

      String msg = "Falha na persist�ncia do objeto do tipo "
          + p.getClass() + ". ";
      msg += p.getId() != null ? "Id do objeto: " + p.getId() : "";
      ExceptionLog log = ExceptionLogService.log(e, msg);

      throw new PersistException(log);
    }
    return this.persistent;
  }
View Full Code Here

    return null;
  }

  @Override
  public void buildTabs() {
    ExceptionLog exceptionLog = (ExceptionLog) getSelectedData();

    if (exceptionLog != null) {
      stackTraceField.setText(exceptionLog.getStackTrace());
      stackTraceScroll = new JScrollPane(stackTraceField,
          JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
          JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
      userDescriptionField.setText(exceptionLog.getUserDescription());
      try {
        addTab("Descri��o", IconFactory.createCurso16(),
            DescriptionPanel.getInstance(exceptionLog));
        addTab("Stack Trace", IconFactory.createClose(),
            new JScrollPane(StackTraceView.getInstance(exceptionLog
                .getStackTrace()),
                JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                JScrollPane.HORIZONTAL_SCROLLBAR_NEVER));
        addTab("Descri��o do Usu�rio", IconFactory.createClose(),
            userDescriptionScroll);
View Full Code Here

          .setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
    } catch (Exception e) {
      // Likely PlasticXP is not in the class path; ignore.
   
   
    ExceptionLog log = new ExceptionLog();
    log.setException("TestException\nTrace3\nTrace3\nTrace3\nTrace3");
    log.setStackTrace("Trace1\nTrace2\nTrace3\nTrace3\nTrace3\nTrace3\nTrace3\nTrace3\nTrace3");

    ErrorView.getInstance(log).setVisible(true);
    System.exit(0);
  }
View Full Code Here

  public static ExceptionLog log(ExceptionLog exception) {
    return logger.log(exception);
  }

  public static ExceptionLog log(Exception e, String contextMessage, String user, String telecentro) {
    ExceptionLog eLog = new ExceptionLog();
           
    eLog.setContextMessage(contextMessage);
    eLog.setException(e.getClass().getName());
    eLog.setMessage(e.getMessage());

    StringBuffer buffer = new StringBuffer();
    int length = e.getStackTrace().length;
    for (int i = 0; i < length; i++) {
      buffer.append(e.getStackTrace()[i].getClassName() + STACK_DELIMITER);
      buffer.append(e.getStackTrace()[i].getMethodName() + STACK_DELIMITER);
     
      String tmpFileName = e.getStackTrace()[i].getFileName();
      buffer.append( (tmpFileName == null ? "" : tmpFileName) + STACK_DELIMITER);

      int tmpLineNumber = e.getStackTrace()[i].getLineNumber();
      buffer.append(tmpLineNumber < 1 ? "" : tmpLineNumber);
     
      buffer.append(i < length ? "\n" : "");
    }
   
    eLog.setStackTrace(buffer.toString());

    eLog.setUser(user);
    eLog.setTelecentro(telecentro);
   
    return log(eLog);
  }
View Full Code Here

        .search(
            "FROM ExceptionLog WHERE timestamp >= :dataInicio AND timestamp <= :dataFim",
            params);

    for (Persistent persistent : list) {
      ExceptionLog excecao = (ExceptionLog) persistent;
      RelatorioExcecaoVO excecaoVO = new RelatorioExcecaoVO();
      excecaoVO.setId(excecao.getId());
      excecaoVO.setUsuario(excecao.getUser());
      excecaoVO.setTelecentro(excecao.getTelecentro());
      excecaoVO.setExcecao(excecao.getException());
      excecaoVO.setData(excecao.getTimestamp().getTime());
      excecaoVO.setMensagem(excecao.getMessage());
      excecoes.add(excecaoVO);
    }
    return excecoes;
  }
View Full Code Here

      } else {
        throw new ValidationException(validationList);
      }
    } catch (NamingException e) {
      e.printStackTrace();
      ExceptionLog log = ExceptionLogService.log(e,
          "Falha na obten��o do PersistentAccess.");
      throw new PersistException(log);
    //TODO Trocar Exception por PersistException quando for resolvido o problema
    //da serializa��o de arrays no ejb 3
    } catch (Exception e) {
      if (e instanceof ValidationException) {
        throw (ValidationException) e;
      }
     
      e.printStackTrace();
      ExceptionLog log = ExceptionLogService.log(e,
          "Falha na persist�ncia do Equipamento.");
      throw new PersistException(log);
    }

    return equipamento;
View Full Code Here

import br.com.procempa.modus.services.ExceptionLogService;

public class ExceptionLoggerTest extends TestCase {
 
  public void testLogger() {
    ExceptionLog e = new ExceptionLog();
    e.setException("Teste do Log usando EJB");
    e.setMessage("Objeto n�o inicializado");
    e.setStackTrace("Esse � o texto do trace");
    e.setUserDescription("Tentei salvar o registro e me deu esta tela!");
    e.setUserName("Petrillo");
    e.setTelecentro("Cibernarium");
    e = ExceptionLogService.log(e);
    assertTrue(e.getId()!=null);
  }
View Full Code Here

    e = ExceptionLogService.log(e);
    assertTrue(e.getId()!=null);
  }
 
  public void testContextLog(){
    ExceptionLog eLog = null;
    Exception e = new Exception("Minha mensagem de exce��o");
    eLog  = ExceptionLogService.log(e, "Context Message");
    assertTrue(eLog.getId()!=null);
  }
View Full Code Here

import br.com.procempa.modus.services.ExceptionLogService;

public class ExceptionLoggerTest extends TestCase {
 
  public void testLogger() {
    ExceptionLog e = new ExceptionLog();
    e.setException("Teste do Log usando EJB");
    e.setMessage("Objeto n�o inicializado");
    e.setStackTrace("Esse � o texto do trace");
    e.setUserDescription("Tentei salvar o registro e me deu esta tela!");
    e.setUser("Petrillo");
    e.setTelecentro("Cibernarium");
    e = ExceptionLogService.log(e);
    assertTrue(e.getId()!=null);
  }
View Full Code Here

TOP

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

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.