PullRequestElement { public static org.holodeckb2b.common.messagemodel.PullRequest readElement(final OMElement prElement) { PullRequest prData = new PullRequest(); String mpc = prElement.getAttributeValue(new QName(MPC_ATTR)); prData.setMPC(Utils.isNullOrEmpty(mpc) ? EbMSConstants.DEFAULT_MPC : mpc); final Iterator<OMElement> criteria = prElement.getChildrenWithNamespaceURI(EbMSConstants.EBMS3_NS_URI); if (!Utils.isNullOrEmpty(criteria)) { SelectivePullRequest selectivePR = new SelectivePullRequest(prData); while (criteria.hasNext()) { final OMElement criterion = criteria.next(); if (criterion.hasName(Q_REFTO_MESSAGEID)) selectivePR.setReferencedMessageId(criterion.getText()); else if (criterion.hasName(Q_CONVERSATIONID)) selectivePR.setConversationId(criterion.getText()); else if (criterion.hasName(AgreementRefElement.Q_ELEMENT_NAME)) selectivePR.setAgreementRef(AgreementRefElement.readElement(criterion)); else if (criterion.hasName(ServiceElement.Q_ELEMENT_NAME)) selectivePR.setService(ServiceElement.readElement(criterion)); else if (criterion.hasName(Q_ACTION)) selectivePR.setAction(criterion.getText()); } prData = selectivePR; } MessageInfoElement.readElement( MessageInfoElement.getElement( (OMElement) prElement.getParent()), prData); return prData; }  static org.holodeckb2b.common.messagemodel.PullRequest readElement(final OMElement prElement); static OMElement getElement(final SOAPHeaderBlock messaging); static OMElement createElement(final OMElement messaging, final IPullRequest pullRequest); static final QName Q_ELEMENT_NAME; }
@Test public void testReadElement() throws Exception { PullRequest pullRequest = new PullRequest(); pullRequest.setMPC("some_mpc"); assertEquals("some_mpc", pullRequest.getMPC()); OMElement prSignalElement = PullRequestElement.createElement(headerBlock, pullRequest); pullRequest = PullRequestElement.readElement((OMElement) prSignalElement.getChildrenWithName(PULLREQUEST_ELEMENT_NAME).next()); assertEquals("some_mpc", pullRequest.getMPC()); }