/**
* @see nexj.core.integration.MessageParser#initializeMessageTable(nexj.core.meta.integration.MessageTable)
*/
public void initializeMessageTable(MessageTable table) throws IntegrationException
{
Lookup2D map = new HashTab2D();
for (Iterator itr = table.getMessageIterator(); itr.hasNext();)
{
Message message = (Message)itr.next();
HL7MessagePartMapping mapping = (HL7MessagePartMapping)message.getRoot().getMapping();
if (mapping.getLevel() != HL7MessagePartMapping.LEVEL_MESSAGE)
{
throw new MetadataException("err.meta.integration.hl7.messageLevel",
new Object[]{message.getName()});
}
String sName = mapping.getName();
if (sName == null)
{
throw new MetadataException("err.meta.integration.hl7.missingMessageType",
new Object[]{message.getName()});
}
String sType;
String sEvent;
int i = sName.indexOf('^');
if (i < 0)
{
sType = sName;
sEvent = "";
}
else
{
sType = sName.substring(0, i);
int k = sName.indexOf('^', i + 1);
if (k < 0)
{
sEvent = sName.substring(i + 1);
}
else
{
sEvent = sName.substring(i + 1, k);
}
}
Message old = (Message)map.put(sType, sEvent, message);
if (old != null)
{
throw new MetadataException("err.meta.integration.hl7.dupMessageType",
new Object[]{sType, sEvent, old.getName(), message.getName()});