obj = Undefined.VALUE;
}
else
{
CompositeMessagePart composite = (CompositeMessagePart)part;
TransferObject tobj = (TransferObject)m_stack.getTopObject();
int nPartCount = composite.getPartCount();
boolean bMatch = false;
boolean bRequired = false;
if (tobj != null)
{
for (int nIndex = 0; nIndex < nPartCount; ++nIndex)
{
MessagePart child = composite.getPart(nIndex);
int nNodeType = ((XMLMessagePartMapping)child.getMapping()).getNodeType();
if (!m_bNilElement && nNodeType == XMLMessagePartMapping.ELEMENT) // ignore counts for nil elements
{
if (composite.getAggregation() == CompositeMessagePart.SINGLE)
{
if (tobj.hasValue(child.getName()))
{
if (bMatch)
{
throw new IntegrationException("err.integration.multipleParts",
new Object[]{composite.getFullPath()});
}
validatePartCount(child);
bMatch = true;
}
bRequired |= child.isRequired();
}
else
{
validatePartCount(child);
}
}
else if (nNodeType == XMLMessagePartMapping.VALUE)
{
Object value = null;
if ((value = getAnyTypeValue()) != null)
{
// Value-mapped part for literal XML will have just one element when collection
if (child.isCollection())
{
ArrayList list = new ArrayList(1);
list.add(value);
value = list;
}
}
else
{
value = m_stack.getTopValue();
if (value instanceof StringBuilder)
{
value = value.toString();
}
if (value instanceof String)
{
value = convert((PrimitiveMessagePart)child, (String)value);
}
}
tobj.setValue(child.getName(), value);
validatePartCount(child);
}
}
if (bRequired && !bMatch)
{
throw new IntegrationException("err.integration.missingPart",
new Object[]{composite.getFullPath()});
}
}
if (!m_bNilElement || tobj.getValueCount() > 0)
{
obj = tobj;
}
else
{