throws UnsupportedAssertion
{
if (assertions.size() == 0)
{
// use default one
RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
deliveryMD.setInOrder("false");
deliveryMD.setQuality("AtLeastOnce");
return deliveryMD;
}
if (assertions.size() == 1)
{
QName assertionQN = assertions.get(0).getName();
assertIsWSRMPAssertion(assertionQN);
RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
deliveryMD.setInOrder(FALSE);
deliveryMD.setQuality(assertionQN.getLocalPart());
return deliveryMD;
}
if (assertions.size() == 2)
{
QName firstAssertionQN = assertions.get(0).getName();
assertIsWSRMPAssertion(firstAssertionQN);
QName secondAssertionQN = assertions.get(1).getName();
assertIsWSRMPAssertion(secondAssertionQN);
boolean firstIsInOrder = firstAssertionQN.equals(IN_ORDER);
RMDeliveryAssuranceConfig deliveryMD = new RMDeliveryAssuranceConfig();
deliveryMD.setInOrder(TRUE);
if (firstIsInOrder)
{
deliveryMD.setQuality(secondAssertionQN.getLocalPart());
}
else
{
deliveryMD.setQuality(firstAssertionQN.getLocalPart());
}
return deliveryMD;
}