Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.MessagePart


      CompositeMessagePart composite = (CompositeMessagePart)part;
      Pair attributes = null;

      for (int i = composite.getPartCount() - 1; i >= 0; --i)
      {
         MessagePart childPart = composite.getPart(i);
         ObjectMessagePartMapping childMapping = (ObjectMessagePartMapping)childPart.getMapping();
         Object childAttributes = childMapping.getAttributes(childPart, currPathSet, message);

         if (childAttributes != null)
         {
            attributes = new Pair(childAttributes, attributes);
View Full Code Here


    */
   protected void buildDependentMsgPartsMap(CompositeMessagePart composite, Set currPathSet)
   {
      for (int i = 0, n = composite.getPartCount(); i != n; ++i)
      {
         MessagePart msgPart = composite.getPart(i);

         if (msgPart instanceof CompositeMessagePart)
         {
            CompositeMessagePart part = (CompositeMessagePart)msgPart;
            ObjectMessagePartMapping partMapping = (ObjectMessagePartMapping)part.getMapping();
View Full Code Here

      {
         if (mapping.m_systemPartArray != null)
         {
            for (int i = 0; i < SYSTEM_ATTRIBUTES.length; ++i)
            {
               MessagePart part = mapping.getSystemPart(i);

               if (part != null)
               {
                  setSystemPart(part);
               }
View Full Code Here

   /**
    * @see nexj.core.meta.integration.MessagePartMapping#finish(nexj.core.meta.integration.MessagePart)
    */
   public void finish(MessagePart part)
   {
      MessagePart parent = part.getParent();

      if (m_attribute != null)
      {
         if (m_attribute.isStatic())
         {
            throw new MetadataException("err.meta.integration.object.mapping.staticAttribute",
               new Object[]{part.getFullPath()});
         }

         if ((part instanceof PrimitiveMessagePart) != m_attribute.getType().isPrimitive())
         {
            throw new MetadataException("err.meta.integration.object.mapping.attributeTypeMismatch",
               new Object[]{part.getFullPath()});
         }

         if (m_bLocal && part instanceof CompositeMessagePart && m_attribute.getReverse() == null)
         {
            throw new MetadataException("err.meta.integration.object.mapping.missingLocalReverseAssoc",
               new Object[]{m_attribute.getName(), part.getFullPath()});
         }
      }

      if (m_metaclass != null)
      {
         if (part instanceof PrimitiveMessagePart)
         {
            throw new MetadataException("err.meta.integration.object.mapping.misplacedClass");
         }
        
         if (m_attribute != null && !((Metaclass)m_attribute.getType()).isUpcast(m_metaclass))
         {
            throw new MetadataException("err.meta.integration.object.mapping.classTypeMismatch",
               new Object[]{m_metaclass.getName()});
         }
      }
      else
      {
         if (parent == null)
         {
            if (m_message.getDerivation() != Message.DERIVATION_ABSTRACT)
            {
               throw new MetadataException("err.meta.integration.object.mapping.missingClass");
            }
         }
        
         if (m_attribute != null && !m_attribute.getType().isPrimitive())
         {
            m_metaclass = (Metaclass)m_attribute.getType();
         }
      }

      if (part instanceof PrimitiveMessagePart)
      {
         if (part.isCollection())
         {
            throw new MetadataException("err.meta.integration.object.mapping.primitiveCollection");
         }

         if (m_where != Boolean.TRUE)
         {
            throw new MetadataException("err.meta.integration.object.mapping.primitivePartWhere",
               new Object[]{part.getFullPath()});
         }
      }

      if (parent == null)
      {
         m_bLocal = false;
      }
      else
      {
         ObjectMessagePartMapping mapping = (ObjectMessagePartMapping)parent.getMapping();

         if (mapping != null)
         {
            mapping.setSystemPart(part);
         }
      }

      if (m_bSubKey)
      {
         ObjectMessagePartMapping mapping = (parent == null) ? null : (ObjectMessagePartMapping)parent.getMapping();

         if (mapping != null)
         {
            mapping.m_bSubKeyParent = true;
         }
      }

      if (m_accessAttribute != null && m_accessAttribute.getType() != Primitive.BOOLEAN)
      {
         throw new MetadataException("err.meta.integration.object.mapping.accessAttributeType",
            new Object[]{m_accessAttribute.getName()});
      }

      if (parent == null && m_metaclass != null &&
         (m_message.getBaseMessage() != null || m_message.getDerivedMessageCount() > 0))
      {
         addClassMessage(m_metaclass, m_message);
      }

      if (part instanceof CompositeMessagePartInstance)
      {
         CompositeMessagePart composite = (CompositeMessagePartInstance)part;

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

      if (part.equals(part.getRoot()) && part instanceof CompositeMessagePart)
      {
         CompositeMessagePart rootComposite = (CompositeMessagePart)part;
         ObjectMessagePartMapping rootMapping = (ObjectMessagePartMapping)rootComposite.getMapping();
         MessagePart syncKeyPart = rootMapping.getSystemPart(ATTR_SYNC_KEY);

         if (syncKeyPart != null)
         {
            for (int i = 0, nCount = rootComposite.getPartCount(); i < nCount; i++)
            {
               MessagePart childPart = rootComposite.getPart(i);

               if (syncKeyPart != childPart)
               {
                  ObjectMessagePartMapping childMapping = (ObjectMessagePartMapping)childPart.getMapping();

                  if (childMapping.isKey())
                  {
                     rootMapping.m_bAlternativeSyncKey = true;
                  }
View Full Code Here

            addChildParts(parentPart, modelGroupParticles, childParticle, baseType, (XSModelGroup)term, aggregation);
            break;

         case XSConstants.ELEMENT_DECLARATION:
            final XSElementDeclaration chldElemDecl = (XSElementDeclaration)term;
            MessagePart childPart;
           
            if (m_bReuseRootMessages && isRootElementDeclaration(chldElemDecl))
            {
               String sName = generateDefaultMessageName(chldElemDecl.getName(),
                  new INameConflictChecker()
                  {
                     public boolean conflicts(String sName)
                     {
                        return parentPart.hasPart(sName);
                     }
                  });

               childPart = createRef(parentPart, chldElemDecl, sName);
            }
            else
            {
               childPart = createMessagePart(parentPart, chldElemDecl, null);
            }

            if (childPart == null)
            {
               break;
            }
           
            setMinMaxCount(modelGroupParticles, childPart, childParticle, chldElemDecl);
           
            if (!addPart(parentPart, childPart))
            {
               if (parentPart.getAggregation() == CompositeMessagePart.SEQUENTIAL)
               {
                  MessagePart lastPart = parentPart.getPart(parentPart.getPartCount() - 1);

                  if (lastPart.getName().equals(childPart.getName()))
                  {
                     if (lastPart.getMaxCount() != Integer.MAX_VALUE)
                     {
                        if (childPart.getMaxCount() == Integer.MAX_VALUE)
                        {
                           lastPart.setMaxCount(0);
                        }
                        else
                        {
                           lastPart.setMaxCount(lastPart.getMaxCount() + childPart.getMaxCount());
                        }
                     }

                     return;
                  }
View Full Code Here

      CompositeMessagePart composite = (CompositeMessagePart)part;

      for (int i = composite.getPartCount() - 1; i >= 0; --i)
      {
         MessagePart childPart = composite.getPart(i);
         ObjectMessagePartMapping partMapping = (ObjectMessagePartMapping)childPart.getMapping();

         if (partMapping.getAttribute() != null &&
            partMapping.getAttribute() == m_metaclass.getUpdateAccessAttribute())
         {
            setUpdateAccessPart(childPart);

            break;
         }
      }

      if (composite instanceof CompositeMessagePartInstance)
      {
         for (int i = 0, nSize = composite.getPartCount(); i < nSize; i++)
         {
            MessagePart child = composite.getPart(i);

            ((ObjectMessagePartMapping)child.getMapping()).finish2(child);
         }
      }
   }
View Full Code Here

    */
   public void validate(ContextMetadata metadata, ExceptionHolder warnings, MessagePart part)
   {
      if (warnings != null)
      {
         MessagePart parent = part.getParent();
         ObjectMessagePartMapping mapping = (parent == null) ? null : (ObjectMessagePartMapping)parent.getMapping();

         if (m_bSubKey && (mapping == null || !mapping.isKey() || !mapping.isLocal()))
         {
            MetadataValidationException e = new MetadataValidationException("err.meta.integration.object.mapping.nonKeyLocalSubKey");

View Full Code Here

         {
            CompositeMessagePart composite = (CompositeMessagePart)part;

            for (int i = 0; i < composite.getPartCount(); i++)
            {
               MessagePart childPart = composite.getPart(i);

               if (((ZipMessagePartMapping)childPart.getMapping()).m_nValue == VALUE_NAME)
               {
                  bFoundNamePart = true;

                  break;
               }
            }
         }

         if (!bFoundNamePart)
         {
            throw new MetadataException("err.meta.integration.zip.missingNameChild",
               new Object[]{part.getFullPath()});
         }
      }
      else if (m_nLevel == 2)
      {
         // Check that the parts here are simple, single-valued
         if (!(part instanceof PrimitiveMessagePart) ||
             ((PrimitiveMessagePart)part).isCollection())
         {
            throw new MetadataException("err.meta.integration.zip.nonPrimitive",
               new Object[]{part.getFullPath()});
         }
      }
      else
      {
         throw new IllegalStateException("Message part depth: " + m_nLevel);
      }

      if (part instanceof CompositeMessagePartInstance)
      {
         CompositeMessagePart composite = (CompositeMessagePartInstance)part;

         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

         {
            int nChildCount = composite.getPartCount();

            for (int i = 0; i < nChildCount; i++)
            {
               MessagePart childPart = (MessagePart)composite.getPart(i);
               VCardMessagePartMapping childMapping = (VCardMessagePartMapping)childPart.getMapping();

               if (childMapping.getType() == TYPE_VALUE || childMapping.getType() == TYPE_GROUP)
               {
                  if (m_valuePart != null)
                  {
                     throw new MetadataException("err.meta.integration.vcard.singleValueChildRequired",
                        new Object[]{part.getFullPath()});
                  }

                  m_valuePart = childPart;
               }
            }

            if (m_valuePart == null)
            {
               throw new MetadataException("err.meta.integration.vcard.singleValueChildRequired",
                  new Object[]{part.getFullPath()});
            }
         }

         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

            });
         }

         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

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.