*/
public void finish(MessagePart part)
{
if (m_nLevel == 0)
{
CompositeMessagePart rootPart = (CompositeMessagePartInstance)m_messagePart;
FixedMessagePartMapping rootMapping = (FixedMessagePartMapping)rootPart.getMapping();
if (rootMapping != null && rootMapping.getSuffix().length() > 0)
{
throw new MetadataException("err.meta.integration.fixed.suffixNotAllowedOnRoot",
new Object[]{part.getFullPath()});
}
// call finish() on the records part
MessagePart recordsPart = rootPart.getPart(0);
MessagePartMapping recordsMapping = recordsPart.getMapping();
if (recordsMapping != null)
{
recordsMapping.finish(recordsPart);
}
}
else if (m_nLevel == 1)
{
//The second level should have a CompositeMessagePart of 0..* cardinality
if (!part.isCollection())
{
throw new MetadataException("err.meta.integration.fixed.mustHaveTopLevelCollection",
new Object[]{part.getFullPath()});
}
// Call finish() for child mappings
CompositeMessagePart recordPart = (CompositeMessagePartInstance)m_messagePart;
for (int i=0; i < recordPart.getPartCount(); i++)
{
MessagePart fieldPart = recordPart.getPart(i);
MessagePartMapping fieldMapping = fieldPart.getMapping();
fieldMapping.finish(fieldPart);
}
createRecordTemplate();
}
else
{
// Beyond second level, no collections allowed
if (part.isCollection())
{
throw new MetadataException("err.meta.integration.fixed.noNestedCollections",
new Object[]{part.getFullPath()});
}
// fields add their width to the record width
if (m_messagePart != null && m_messagePart instanceof PrimitiveMessagePart)
{
MessagePart recordPart = m_messagePart.getParent();
FixedMessagePartMapping recordMapping = (FixedMessagePartMapping)recordPart.getMapping();
recordMapping.addToRecordWidth(m_nWidth);
}
}
}