Package es.emergya.comunications.exceptions

Examples of es.emergya.comunications.exceptions.MessageGeneratingException


  public static Outbox sendMessage(Integer codigo, Integer tipo,
      Integer prioridad, String cuerpo, String destino)
      throws MessageGeneratingException {

    if (destino == null) {
      throw new MessageGeneratingException("Destino nulo.");
    }
    if (codigo == null) {
      throw new MessageGeneratingException("Mensaje sin codigo.");
    }
    if (tipo == null) {
      throw new MessageGeneratingException("Mensaje sin tipo.");
    }
    if (prioridad == null) {
      throw new MessageGeneratingException("Prioridad nula");
    }
    if (cuerpo == null) {
      cuerpo = "";
    }

    log.info("sendMessage(" + codigo + "," + tipo + "," + prioridad + ","
        + cuerpo + "," + destino + ")");

    try {
      Integer tipo_tetra = TipoMensajeConsultas.getTipoByCode(codigo)
          .getTipoTetra();

      // Limpiamos las comillas:
      cuerpo = StringUtils.remove(cuerpo, "'");

      String datagramaTetra = getDatagrama(codigo, tipo, cuerpo);

      Outbox out = new Outbox();
      out.setMarcaTemporal(Calendar.getInstance().getTime());
      out.setDatagramaTetra(datagramaTetra);
      out.setPrioridad(prioridad);
      out.setDestino(StringUtils.leftPad(destino, LogicConstants.getInt(
          "LONGITUD_ISSI", 8), '0'));
      out.setTipo(tipo_tetra);

      log.info("Enviamos el mensaje " + datagramaTetra + " a " + destino
          + " con prioridad " + prioridad);

      out = bandejaSalidaDAO.save(out);
      log.info("Enviando " + out);
      return out;
    } catch (Exception e) {
      throw new MessageGeneratingException("Error al generar mensaje", e);
    }
  }
View Full Code Here

TOP

Related Classes of es.emergya.comunications.exceptions.MessageGeneratingException

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.