public RepositoryDVO createRepositoryDVO(AS2Message message, boolean isIncoming) throws AS2MessageException, DAOException { RepositoryDAO dao = createRepositoryDAO(); RepositoryDVO daoData = (RepositoryDVO) dao.createDVO(); daoData.setMessageBox(isIncoming ? MessageDVO.MSGBOX_IN : MessageDVO.MSGBOX_OUT); daoData.setMessageId(message.getMessageID()); daoData.setContent(message.toByteArray()); return daoData; }
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); } }
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; }