Object value = null;
boolean bMatch = false;
if (msgPart instanceof PrimitiveMessagePart)
{
PrimitiveMessagePart part = (PrimitiveMessagePart)msgPart;
String s = getCurToken();
if (s.length() != 0)
{
if (s.equals("\"\""))
{
value = null;
}
else
{
value = convert(part, s);
}
bMatch = true;
}
}
else
{
if (nLevel == HL7MessagePartMapping.LEVEL_SEGMENT)
{
String sName = getCurToken();
if (!mapping.getName().equals(sName))
{
if (parentMsgPart.isLax() && nCount == 0 && sName.length() != 0 && sName.charAt(0) == 'Z')
{
skipTokens(nLevel, 1);
continue;
}
break;
}
skipTokens(nLevel + 1, 1);
bMatch = true;
}
final CompositeMessagePart composite = (CompositeMessagePart)msgPart;
TransferObject tobj = (parentMsgPart == null) ? parent : null;
int nSeq = 1;
if (msgPart == m_msh)
{
m_buf.append(m_sepArray[SEP_COMPONENT]);
for (;;)
{
int ch = getNextChar();
if (ch == m_sepArray[SEP_FIELD])
{
break;
}
m_buf.append((char)ch);
}
m_nSepLevel = HL7MessagePartMapping.LEVEL_FIELD;
nSeq = 2;
}
for (int nPart = 0, nPartCount = composite.getPartCount(); nPart != nPartCount; ++nPart)
{
MessagePart part = composite.getPart(nPart);
if (nLevel > HL7MessagePartMapping.LEVEL_GROUP)
{
int nNextSeq = ((HL7MessagePartMapping)part.getMapping()).getSeq();
if (msgPart == m_msh && nNextSeq <= 2)
{
if (nNextSeq == 1)
{
m_sToken = new String(m_sepArray, SEP_FIELD, 1);
}
else
{
m_sToken = m_buf.toString();
}
nNextSeq = 2;
}
skipTokens(nLevel + 1, nNextSeq - nSeq);
nSeq = nNextSeq;
}
if (parse(part, composite, parentMsgPart, tobj))
{
bMatch = true;
if (tobj == null)
{
value = tobj = m_tobj;
}
}
else
{
if (part.isRequired())
{
if (bMatch ||
nLevel == HL7MessagePartMapping.LEVEL_SEGMENT ||
nLevel > HL7MessagePartMapping.LEVEL_SEGMENT && m_nSepLevel > nLevel)
{
throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
}
else
{
break loop;
}