Exemplo n.º 1
0
  public MessageDVO createMessageDVO(AS2Message message, boolean isIncoming)
      throws AS2MessageException, DAOException {
    MessageDAO dao = createMessageDAO();
    MessageDVO daoData = (MessageDVO) dao.createDVO();
    daoData.setMessageId(message.getMessageID());
    daoData.setMessageBox(isIncoming ? MessageDVO.MSGBOX_IN : MessageDVO.MSGBOX_OUT);
    daoData.setAs2From(message.getFromPartyID());
    daoData.setAs2To(message.getToPartyID());
    daoData.setTimeStamp(new Date());

    daoData.setStatus(MessageDVO.STATUS_PENDING);
    daoData.setPrincipalId(principal == null ? "nobody" : principal.getName());

    if (message.isDispositionNotification()) {
      DispositionNotification dn = message.getDispositionNotification();
      daoData.setIsReceipt(true);
      daoData.setIsReceiptRequested(false);
      daoData.setMicValue(dn.getReceivedContentMIC());
      daoData.setOriginalMessageId(dn.getOriginalMessageID());
    } else {
      daoData.setIsReceipt(false);
      daoData.setIsReceiptRequested(message.isReceiptRequested());
      daoData.setReceiptUrl(message.getHeader(AS2Header.RECEIPT_DELIVERY_OPTION));
    }
    return daoData;
  }
Exemplo n.º 2
0
  public PartnershipDVO findPartnership(AS2Message message, boolean isIncoming)
      throws AS2Exception, DAOException {
    String fromParty, toParty;
    if (isIncoming) {
      fromParty = message.getToPartyID();
      toParty = message.getFromPartyID();
    } else {
      fromParty = message.getFromPartyID();
      toParty = message.getToPartyID();
    }

    try {
      return findPartnership(fromParty, toParty);
    } catch (Exception e) {
      throw new AS2Exception("No partnership for message: " + message, e);
    }
  }