Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.MessagePart


      PrimitiveMessagePart[] result = new PrimitiveMessagePart[m_nHighestOrdinal];
      int nChildren = part.getPartCount();
     
      for (int nChildIndex = 0; nChildIndex < nChildren; nChildIndex++)
      {
         MessagePart childPart = part.getPart(nChildIndex);

         if (childPart instanceof PrimitiveMessagePart)
         {
            CSVMessagePartMapping childMapping = (CSVMessagePartMapping)childPart.getMapping();

            if (result[childMapping.getOrdinal() - 1] != null)
            {
               throw new MetadataException("err.meta.integration.csv.duplicateOrdinal",
                  new Object[] {
                     childPart.getFullPath(),
                     result[childMapping.getOrdinal() -1].getFullPath(),
                     Primitive.createInteger(childMapping.getOrdinal())
                  });
            }
           
            result[childMapping.getOrdinal() - 1] = (PrimitiveMessagePart)childPart;
         }
         else
         {
            PrimitiveMessagePart[] merge = ((CSVMessagePartMapping)childPart.getMapping()).makePartsInOrder((CompositeMessagePart)childPart);
           
            //merge[i] -> result[i], for all i, with checking
            for (int nMergeIndex = 0; nMergeIndex < merge.length; nMergeIndex++)
            {
               if (merge[nMergeIndex] != null)
View Full Code Here


     
      //Build the path of keys to use for accessing TransferObject data for this part
      if (part instanceof PrimitiveMessagePart)
      {
         String[] keyPath = new String[getLevel() - 1];
         MessagePart keyPathPart = part;
        
         for (int nKeyPathIndex = getLevel() - 2; nKeyPathIndex >= 0; nKeyPathIndex--)
         {
            keyPath[nKeyPathIndex] = keyPathPart.getName();
            keyPathPart = keyPathPart.getParent();           
         }
        
         m_dataKeyPathArray = keyPath;
      }
      else
View Full Code Here

      {
         CompositeMessagePart composite = (CompositeMessagePartInstance)m_messagePart;

         for (int i = 0, nCount = composite.getPartCount(); i < nCount; i++)
         {
            MessagePart child = composite.getPart(i);
            MessagePartMapping mapping = child.getMapping();

            if (mapping != null)
            {
               mapping.finish(child);
            }
View Full Code Here

      type.setLax(part.isLax());

      for (int i = 0, nCount = part.getPartCount(); i < nCount; i++)
      {
         MessagePart child = part.getPart(i);

         // Omit parts declared in base message
         if (message != null && child.getDeclarator() != message)
         {
            continue;
         }

         boolean bChildEnvelopeHeaders = child.getRoot() == part &&
            child == ((RootXMLMessagePartMapping)mapping).getHeaderPart();
         XMLMessagePartMapping childMapping = (XMLMessagePartMapping)child.getMapping();

         if (child instanceof PrimitiveMessagePart)
         {
            if (bChildEnvelopeHeaders)
            {
               continue;
            }

            if (childMapping.getNodeType() == XMLMessagePartMapping.VALUE)
            {
               type.setValueType(getAtomicType((PrimitiveMessagePart)child));
            }
            else
            {
               Markup markup = createMarkup((PrimitiveMessagePart)child);

               if (!isEnvelopeMarkup(markup))
               {
                  type.addChild(markup);
               }

               if (bEnvelopeHeaders)
               {
                  addEnvelopeHeader(child, (Element)markup, false);
               }
            }
         }
         else if (child instanceof CompositeMessagePart)
         {
            CompositeType childType;
            Element childElement;

            if (child instanceof CompositeMessagePartRef)
            {
               CompositeMessagePart referentPart = ((CompositeMessagePartRef)child).getRefPart();
               Message referentMessage = ((RootXMLMessagePartMapping)referentPart.getMapping()).getRootMessage();

               childType = createCompositeType(referentPart, referentMessage);
               childElement = new Element(childMapping.getNodeName());
               childElement.setType(childType);
               childElement.setDescription(child.getDescription());

               if (bEnvelopeHeaders)
               {
                  addEnvelopeHeader(child, childElement, true);
               }
            }
            else
            {
               XMLNamespace childNamespace = childMapping.getNamespace();
               String sURI = (childNamespace == null) ? null : childNamespace.getURI();

               if (sURI != null && !sURI.equals(m_sNamespaceURI))
               {
                  // Element reference (different namespace)
                  String sCurrentNamespace = m_sNamespaceURI;
                  Schema otherNSSchema = m_universe.getSchema(sURI, childNamespace.getName());

                  m_sNamespaceURI = sURI;
                  childType = createCompositeType((CompositeMessagePart)child, null);

                  Element otherNSElement = new Element(childMapping.getNodeName());

                  setElementProperties(otherNSElement, (CompositeMessagePart)child);
                  otherNSElement.setType(childType);
                  otherNSElement.setDescription(child.getDescription());
                  otherNSSchema.addItem(otherNSElement);

                  childElement = new ElementRef(otherNSElement);
                  m_sNamespaceURI = sCurrentNamespace;

                  if (bEnvelopeHeaders)
                  {
                     addEnvelopeHeader(child, childElement, false);
                  }
               }
               else
               {
                  // Anonymous type (same namespace)
                  childType = createCompositeType((CompositeMessagePart)child, null);
                  childElement = new Element(childMapping.getNodeName());
                  childElement.setType(childType);
                  childElement.setDescription(child.getDescription());

                  if (bEnvelopeHeaders)
                  {
                     addEnvelopeHeader(child, childElement, true);
                  }
View Full Code Here

         {
            m_writer.startElement("Parts");

            for (Iterator iter = message.getPartIterator(); iter.hasNext();)
            {
               MessagePart part = (MessagePart)iter.next();

               if (part instanceof CompositeMessagePart)
               {
                  exportCompositeMessagePart(null, (CompositeMessagePart)part, exporter);
               }
View Full Code Here

   public void setMessagePart(MessagePart part)
   {
      verifyNotReadOnly();
      m_messagePart = part;

      MessagePart rootPart = m_messagePart.getRoot();

      // for the records part, add the root's prefix & suffix lengths to the record length
      if (rootPart != null && rootPart != m_messagePart && m_messagePart instanceof CompositeMessagePart)
      {
         FixedMessagePartMapping map = (FixedMessagePartMapping)m_messagePart.getMapping();
View Full Code Here

            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);
         }
      }
   }
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.