Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.MessagePart


         if (rawRow[nNameIndex] == Invalid.VALUE)
         {
            continue;
         }

         MessagePart part = rootMapping.getPartByFieldName((String)rawRow[nNameIndex]);

         result[nNameIndex] = part;

         if (part == null)
         {
            continue;
         }

         CSVMessagePartMapping partMapping = (CSVMessagePartMapping)part.getMapping();

         if (!partEncounteredArray[partMapping.getOrdinal()-1])
         {
            partEncounteredArray[partMapping.getOrdinal()-1] = true;
         }
View Full Code Here


    */
   protected static int computeRequired(MessagePart[] parts)
   {
      for (int nPartIndex = 0; nPartIndex < parts.length; nPartIndex++)
      {
         MessagePart part = parts[nPartIndex];

         if (part != null && !part.isRequired())
         {
            return nPartIndex;
         }
      }

View Full Code Here

         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)
                     {
                        append((TransferObject)list.get(k), (CompositeMessagePart)part, composite);
                     }
                     else
                     {
                        append(list.get(k), (PrimitiveMessagePart)part);
                     }
                  }
               }
               else
               {
                  if (part instanceof CompositeMessagePart)
                  {
                     append((TransferObject)value, (CompositeMessagePart)part, composite);
                  }
                  else
                  {
                     append(value, (PrimitiveMessagePart)part);
                  }
               }
            }
         }
         else
         {
            if (part.isRequired())
            {
               throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
            }
         }
      }

      // Close a segment
View Full Code Here

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

      }
      else
      {
         for (int i = 0, n = composite.getPartCount(); i != n; ++i)
         {
            MessagePart part = composite.getPart(i);
  
            if (part instanceof CompositeMessagePart)
            {
               getObjectParts(tobj.findValue(part.getName()), (CompositeMessagePart)part, objectParts);
            }
         }
      }
   }
View Full Code Here

         }
      }

      for (int i = 0, n = derivedComposite.getPartCount(); i != n; ++i)
      {
         MessagePart part = derivedComposite.getPart(i);

         if (part instanceof CompositeMessagePart)
         {
            findInstance(tobj.findValue(part.getName()), (CompositeMessagePart)part, tobj, derivedComposite);
         }
      }

      return instance;
   }
View Full Code Here

    */
   private boolean isKeyAvailable(TransferObject tobj, CompositeMessagePart derivedComposite)
   {
      for (int i = 0, n = derivedComposite.getPartCount(); i < n; ++i)
      {
         MessagePart part = derivedComposite.getPart(i);

         if (part instanceof CompositeMessagePart && !part.isCollection())
         {
            ObjectMessagePartMapping mapping = (ObjectMessagePartMapping)part.getMapping();

            if (mapping != null && mapping.isKey())
            {
               Object childObj = tobj.findValue(part.getName());

               if (!(childObj instanceof TransferObject))
               {
                  return false;
               }
View Full Code Here

      }
      else
      {
         for (int i = 0, n = derivedComposite.getPartCount(); i != n; ++i)
         {
            MessagePart part = derivedComposite.getPart(i);
            ObjectMessagePartMapping partMapping = (ObjectMessagePartMapping)part.getMapping();

            if (bRoot && partMapping.isKey() || !bRoot && partMapping.isSubKey())
            {
               if (!tobj.hasValue(part.getName()))
               {
                  return EMPTY;
               }

               Object obj = tobj.getValue(part.getName());
               Pair expr = null;

               if (part instanceof CompositeMessagePart)
               {
                  expr = getWhere(obj, (CompositeMessagePart)part, tobj, composite, assoc, false);
View Full Code Here

            }
           
            bOnRequired = m_cachedPartsArray[nPartIndex].isRequired();
           
            CSVMessagePartMapping partMapping = (CSVMessagePartMapping)m_cachedPartsArray[nPartIndex].getMapping();
            MessagePart partWithSameFieldName = (MessagePart)fieldNames.get(partMapping.getField());
           
            if (partWithSameFieldName != null)
            {
               throw new MetadataException("err.meta.integration.csv.duplicateFieldNames",
                  new Object[]{
                     partWithSameFieldName.getFullPath(),
                     m_cachedPartsArray[nPartIndex].getFullPath(),
                     partMapping.getField()
                  });
            }
            else
View Full Code Here

      CompositeMessagePart compositePart = (CompositeMessagePart)part;
      int nChildren = compositePart.getPartCount();
     
      for (int nChild = 0; nChild < nChildren; nChild++)
      {
         MessagePart childPart = compositePart.getPart(nChild);
         CSVMessagePartMapping childMapping = (CSVMessagePartMapping)childPart.getMapping();
        
         if (childPart instanceof PrimitiveMessagePart)
         {
            if (childMapping.m_nOrdinal <= 0)
            {
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.MessagePart

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.