Package nexj.core.meta.integration.format.hl7

Examples of nexj.core.meta.integration.format.hl7.HL7MessagePartMapping


    * @param parentComposite The parent message part.
    */
   protected void append(TransferObject tobj, CompositeMessagePart composite,
         CompositeMessagePart parentComposite) throws IOException
   {
      HL7MessagePartMapping mapping = (HL7MessagePartMapping)composite.getMapping();
      int nLevel = mapping.getLevel();
      int nSeqSaved = m_nSeq;

      if (nLevel >= HL7MessagePartMapping.LEVEL_FIELD)
      {
         nLevel = Math.max(nLevel, ((HL7MessagePartMapping)parentComposite.getMapping()).getLevel() + 1);
      }

      m_nSeq = 1;

      // Open a segment

      if (nLevel == HL7MessagePartMapping.LEVEL_SEGMENT && composite != m_msh)
      {
         m_writer.write(mapping.getName());
         m_writer.write('|');
      }

      for (int i = 0, n = composite.getPartCount(); i < n; ++i)
      {
         MessagePart part = composite.getPart(i);
         Object value = tobj.findValue(part.getName(), Undefined.VALUE);

         if (composite == m_msh)
         {
            if (((HL7MessagePartMapping)part.getMapping()).getSeq() <= 2)
            {
               m_nSeq = 3;

               continue;
            }

            if (value == Undefined.VALUE)
            {
               value = getDefaultMSHValue(part);
            }
         }

         if (value != Undefined.VALUE)
         {
            HL7MessagePartMapping partMapping = (HL7MessagePartMapping)part.getMapping();

            if (value == null)
            {
               if (part.isRequired())
               {
                  throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
               }

               if (partMapping.getLevel() >= HL7MessagePartMapping.LEVEL_FIELD)
               {
                  appendSeparators(partMapping, nLevel);
                  m_writer.write("\"\"");
               }
            }
            else
            {
               appendSeparators(partMapping, nLevel);

               if (part.isCollection())
               {
                  List list = (List)value;

                  if (list.size() < part.getMinCount())
                  {
                     throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
                  }

                  if (list.size() > part.getMaxCount())
                  {
                     throw new IntegrationException("err.integration.maxPartCount", new Object[]{part.getFullPath()});
                  }

                  for (int k = 0, m = list.size(); k < m; ++k)
                  {
                     if (k != 0 && partMapping.getLevel() >= HL7MessagePartMapping.LEVEL_FIELD)
                     {
                        m_writer.write('~');
                     }

                     if (part instanceof CompositeMessagePart)
View Full Code Here


      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()});
View Full Code Here

    * @return True if the part was found.
    */
   protected boolean parse(final MessagePart msgPart, final CompositeMessagePart parentMsgPart,
      final CompositeMessagePart grandParentMsgPart, TransferObject parent)
   {
      HL7MessagePartMapping mapping = (HL7MessagePartMapping)msgPart.getMapping();
      int nLevel = mapping.getLevel();
      List list = null;
      int nCount = 0;

      if (nLevel >= HL7MessagePartMapping.LEVEL_FIELD)
      {
         nLevel = Math.max(nLevel, ((HL7MessagePartMapping)parentMsgPart.getMapping()).getLevel() + 1);
      }

   loop:
      for (;;)
      {
         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);

View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.format.hl7.HL7MessagePartMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.