*
* @see nexj.core.meta.integration.MessagePartMapping#finish(nexj.core.meta.integration.MessagePart)
*/
public void finish(MessagePart part)
{
CompositeMessagePart parentPart = part.getParent();
m_sFullName = m_sName;
if (parentPart != null)
{
VCardMessagePartMapping parentMapping = (VCardMessagePartMapping)parentPart.getMapping();
if (parentMapping.getType() == TYPE_GROUP)
{
if (m_nType == TYPE_PARAMETER)
{
throw new MetadataException("err.meta.integration.vcard.invalidParameterPlacement",
new Object[]{part.getFullPath()});
}
}
if (parentMapping.getName().length() > 0)
{
m_sFullName = parentMapping.getFullName() + '.' + m_sName;
}
}
if (part instanceof PrimitiveMessagePart)
{
if (m_nType == TYPE_GROUP)
{
throw new MetadataException("err.meta.integration.vcard.groupMappedPrimitive",
new Object[]{part.getFullPath()});
}
}
else if (part instanceof CompositeMessagePart)
{
if (m_nType == TYPE_PARAMETER)
{
throw new MetadataException("err.meta.integration.vcard.parameterMappedComposite",
new Object[]{part.getFullPath()});
}
}
if (part instanceof CompositeMessagePartInstance)
{
CompositeMessagePart composite = (CompositeMessagePart)part;
if (m_nType == VCardMessagePartMapping.TYPE_VALUE)
{
int nChildCount = composite.getPartCount();
for (int i = 0; i < nChildCount; i++)
{
MessagePart childPart = (MessagePart)composite.getPart(i);
VCardMessagePartMapping childMapping = (VCardMessagePartMapping)childPart.getMapping();
if (childMapping.getType() == TYPE_VALUE || childMapping.getType() == TYPE_GROUP)
{
if (m_valuePart != null)
{
throw new MetadataException("err.meta.integration.vcard.singleValueChildRequired",
new Object[]{part.getFullPath()});
}
m_valuePart = childPart;
}
}
if (m_valuePart == null)
{
throw new MetadataException("err.meta.integration.vcard.singleValueChildRequired",
new Object[]{part.getFullPath()});
}
}
for (int i = 0, nCount = composite.getPartCount(); i < nCount; i++)
{
MessagePart child = composite.getPart(i);
MessagePartMapping mapping = child.getMapping();
if (mapping != null)
{
mapping.finish(child);