{
try
{
if(!entryContext.getMessageEntry().isMimeContent())
{
throw new AssertionNotApplicableException();
}
// get message mime parts
MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
BindingOperation bindingOperation = validator.getOperationMatch(
entryContext.getEntry().getEntryType(),
entryContext.getMessageEntryDocument());
// If there is no matched operation, the assertion is not applicable
if (bindingOperation == null)
throw new AssertionNotApplicableException();
// Finding operation extensibility elems
// in the binding depending on message type
List extElems = null;
if (entryContext.getMessageEntry().getType().equals(
MessageEntry.TYPE_REQUEST)
&& bindingOperation.getBindingInput() != null)
{
extElems = bindingOperation
.getBindingInput().getExtensibilityElements();
}
else if (entryContext.getMessageEntry().getType().equals(
MessageEntry.TYPE_RESPONSE)
&& bindingOperation.getBindingOutput() != null)
{
extElems = bindingOperation
.getBindingOutput().getExtensibilityElements();
}
// check list for the first element
if((extElems == null) || (extElems.size() == 0) ||
!(extElems.get(0) instanceof MIMEMultipartRelated))
throw new AssertionNotApplicableException();
// get list mime parts from definition
MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0);
List parts = mime.getMIMEParts();
if(mimeParts.getRootPart() == null || mimeParts.count()==0)
throw new AssertionNotApplicableException();
// skip root part
for (int i = 1; i < parts.size(); i++)
{
String partName = getMIMEContentPart((MIMEPart) parts.get(i));
// find the corresponding MIME part