/** * Creates a new persistency object to store the meta-data of the given message unit that is sent by Holodeck * B2B. * * @param <T> Limits the <code>messageUnit</code> to message units types * @param <V> Only entity objects will be returned, V and T will be of the same message type * @param messageUnit The meta-data on message unit that should be stored in the new persistent object * @return The created persistency object. * @throws PersistenceException If an error occurs when saving the new message unit to the database. */ public <T extends IMessageUnit, V extends IMessageUnitEntity> V storeOutGoingMessageUnit(T messageUnit) throws PersistenceException { MessageUnit tempObject = createTempObject(messageUnit); // Set correct direction tempObject.setDirection(Direction.OUT); if (messageUnit instanceof IUserMessage || messageUnit instanceof IPullRequest) tempObject.setProcessingState(ProcessingState.SUBMITTED); else tempObject.setProcessingState(ProcessingState.CREATED); if (Utils.isNullOrEmpty(tempObject.getMessageId())) tempObject.setMessageId(MessageIdUtils.createMessageId()); if (tempObject.getTimestamp() == null) tempObject.setTimestamp(new Date()); V storedObject = parent.storeMessageUnit(tempObject); parent.setLeg(storedObject, ILeg.Label.REQUEST); return storedObject; }
msgUnit.setTimestamp(Utils.fromXMLDateTime(miElement.getFirstChildWithName(Q_TIMESTAMP).getText())); } catch (final OMException | ParseException e) { msgUnit.setTimestamp(null); msgUnit.setMessageId(messageId.getText()); else msgUnit.setMessageId(null); msgUnit.setRefToMessageId(refToMsgId.getText());
/** * Creates a new persistency object to store the meta-data of the given message unit that is received by Holodeck * B2B. * * @param <T> Limits the <code>messageUnit</code> to message units types * @param <V> Only entity objects will be returned, V and T will be of the same message type * @param messageUnit The meta-data on message unit that should be stored in the new persistent object * @return The created persistency object. * @throws PersistenceException If an error occurs when saving the new message unit to the database. */ public <T extends IMessageUnit, V extends IMessageUnitEntity> V storeIncomingMessageUnit(T messageUnit) throws PersistenceException { MessageUnit tempObject = createTempObject(messageUnit); // Set correct direction tempObject.setDirection(Direction.IN); tempObject.setProcessingState(ProcessingState.RECEIVED); return parent.storeMessageUnit(tempObject); }
/** * Create a new <code>M</code> object for the user message unit described by the given * {@link IUserMessage} object. * * @param sourceMessageUnit The meta data of the message unit to copy to the new object */ public MessageUnit(final IMessageUnit sourceMessageUnit) { if (sourceMessageUnit == null) return; this.direction = sourceMessageUnit.getDirection(); this.messageId = sourceMessageUnit.getMessageId(); this.timestamp = sourceMessageUnit.getTimestamp(); this.refToMessageId = sourceMessageUnit.getRefToMessageId(); this.pmodeId = sourceMessageUnit.getPModeId(); if (!Utils.isNullOrEmpty(sourceMessageUnit.getProcessingStates())) { for (IMessageUnitProcessingState state : sourceMessageUnit.getProcessingStates()) setProcessingState(state); } }