Examples of MessagePart


Examples of nexj.core.meta.integration.MessagePart

      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

Examples of nexj.core.meta.integration.MessagePart

    */
   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

Examples of nexj.core.meta.integration.MessagePart

         {
            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

Examples of nexj.core.meta.integration.MessagePart

         {
            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

Examples of nexj.core.meta.integration.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

Examples of nexj.core.meta.integration.MessagePart

      if (root.getPartCount() == 0)
      {
         return null;
      }

      MessagePart hdr = root.getPart(0);
      HL7MessagePartMapping mapping = (HL7MessagePartMapping)hdr.getMapping();

      return (mapping.getLevel() == HL7MessagePartMapping.LEVEL_SEGMENT &&
         mapping.getName().equals("MSH")) ? (CompositeMessagePart)hdr : null;
   }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      {
         throw new MetadataException("err.meta.integration.xml.inapplicableSubtype",
            new Object[]{SUBTYPE_NAMES[m_nSubtype], part.getFullPath()});
      }

      MessagePart rootPart = part.getRoot();
      RootXMLMessagePartMapping rootMapping = (RootXMLMessagePartMapping)rootPart.getMapping();

      // Ensure XSI namespace is used on message root if nillable elements are used
      if (m_bNillable && rootMapping != null)
      {
         rootMapping.addNamespace(XMLNamespace.XSI_NAME, XMLNamespace.XSI, null, false);
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

         boolean bInstance = part instanceof CompositeMessagePartInstance;
         CompositeMessagePart composite = (CompositeMessagePart)part;

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

            if (mapping != null)
            {
               if (bInstance)
               {
                  mapping.finish(child);
               }

               if (child.isRequired()
                     && ((XMLMessagePartMapping)mapping).getNodeType() == XMLMessagePartMapping.ATTRIBUTE)
               {
                  m_bHasRequiredAttributes = true;
               }
            }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

    * @param msg The message part metadata.
    * @throws IntegrationException if an error occurs.
    */
   protected Object transfer1(Object obj, MessagePart msg) throws IntegrationException
   {
      MessagePart processedPart = msg;
      String sMessageName = null;
      Metaclass metaclass;
      Instance instance = (obj instanceof Instance) ? (Instance)obj : null;
      TransferObject srcTobj = (obj instanceof TransferObject) ? (TransferObject)obj : null;
      Message message = null;

      if (instance != null || srcTobj != null)
      {
         if (msg instanceof CompositeMessagePartRef)
         {
            CompositeMessagePartRef ref = (CompositeMessagePartRef)msg;
            CompositeMessagePart referencedPart = ref.getRefPart();

            message = ((ObjectMessagePartMapping)referencedPart.getMapping()).getMessage();
         }
         else if (msg.getParent() == null)
         {
            message = ((ObjectMessagePartMapping)msg.getRoot().getMapping()).getMessage();
         }
      }

      // Process inheritance
      if (message != null)
      {
         metaclass = (instance != null) ? instance.getMetaclass() :
            m_context.getMetadata().getMetaclass(srcTobj.getClassName());

         Message derivedMessage = findDerivedMessage(message, metaclass);

         if (derivedMessage == null)
         {
            throw new IntegrationException("err.integration.object.missingMapping",
               new Object[]{metaclass.getName(), message.getName(), msg.getFullPath()});
         }

         Message.validatePolymorphism(message, derivedMessage, msg);
         msg = derivedMessage.getRoot();
         message = derivedMessage;
         sMessageName = message.getName();
      }

      ObjectMessagePartMapping mapping = (ObjectMessagePartMapping)msg.getMapping();

      if (m_context.isSecure())
      {
         if (mapping.getAttribute() != null)
         {
            mapping.getAttribute().checkReadAccess(m_context.getPrivilegeSet());
         }
         else
         {
            mapping.getMetaclass().checkReadAccess(m_context.getPrivilegeSet());
         }
      }

      if (obj == null)
      {
         if (msg.isRequired())
         {
            throw new IntegrationException("err.integration.minPartCount", new Object[]{msg.getFullPath()});
         }
        
         return null;
      }
     
      if (msg instanceof PrimitiveMessagePart)
      {
         return ((PrimitiveMessagePart)msg).convertValue(obj);
      }

      CompositeMessagePart composite = (CompositeMessagePart)msg;
      int nCount = composite.getPartCount();
     
      if (obj instanceof TransferObject)
      {
         if (isFetchInstance())
         {
            instance = (Instance)RPCUtil.instantiateClean(srcTobj, new HashTab(), m_context);
         }
         else
         {
            TransferObject tobj = new TransferObject(sMessageName, composite.getPartCount());

            tobj.setEventName(srcTobj.getEventName());
            tobj.setOID(srcTobj.getOID());
  
            for (int i = 0; i < nCount; ++i)
            {
               MessagePart part = composite.getPart(i);
               ObjectMessagePartMapping objectMessagePartMapping = (ObjectMessagePartMapping)part.getMapping();
               Attribute attribute = objectMessagePartMapping.getAttribute();
               Object value = null;

               if (attribute != null)
               {
                  value = transfer(srcTobj.findValue(attribute.getName()), part);
               }
               else
               {
                  switch (objectMessagePartMapping.getSystemAttribute())
                  {
                     case ObjectMessagePartMapping.ATTR_OID:
                        value = srcTobj.getOID().toBinary();
                        break;

                     case ObjectMessagePartMapping.ATTR_CLASS:
                        value = srcTobj.getClassName();
                        break;

                     case ObjectMessagePartMapping.ATTR_EVENT:
                        value = srcTobj.getEventName();
                        break;
                  }
               }

               tobj.setValue(part.getName(), value);
            }
  
            return tobj;
         }
      }

      if (m_context.isSecure() && !instance.isReadable())
      {
         return null;
      }

      metaclass = instance.getMetaclass();

      TransferObject tobj = new TransferObject(sMessageName, composite.getPartCount());
     
      if (!mapping.getMetaclass().isUpcast(metaclass))
      {
         throw new IntegrationException("err.integration.object.partClass",
            new Object[]{mapping.getMetaclass().getName(), composite.getFullPath()});
      }

      String sEvent = null;
      boolean bProcessed = m_processedSet.put(instance, processedPart, Boolean.TRUE) != null;
     
      m_instanceMap.put(instance, tobj);
      tobj.setOID(instance.getOID());

      if (srcTobj != null)
      {
         sEvent = srcTobj.getEventName();
      }
      else
      {
         switch (instance.getState())
         {
            case Instance.NEW:
               sEvent = "create";
               break;

            case Instance.DIRTY:
               sEvent = "update";
               break;

            case Instance.DELETED:
               sEvent = "delete";
               break;
         }
      }

      tobj.setEventName(sEvent);

      for (int i = 0; i < nCount; ++i)
      {
         MessagePart part = composite.getPart(i);
         ObjectMessagePartMapping objectMessagePartMapping = (ObjectMessagePartMapping)part.getMapping();
         Attribute attribute = objectMessagePartMapping.getAttribute();
         Object value = null;

         if (attribute != null)
         {
            if (bProcessed && objectMessagePartMapping.isKey() && !(part instanceof PrimitiveMessagePart))
            {
               throw new IntegrationException("err.integration.object.recursive", new Object[]{msg.getName()});
            }
           
            if (!bProcessed || objectMessagePartMapping.isKey())
            {
               value = transfer(instance.getValue(attribute.getOrdinal()), part);
               tobj.setValue(part.getName(), value);
            }
         }
         else
         {
            switch (objectMessagePartMapping.getSystemAttribute())
            {
               case ObjectMessagePartMapping.ATTR_OID:
                   value = (instance.getOID() == null) ? null : instance.getOID().toBinary();
                   break;

               case ObjectMessagePartMapping.ATTR_CLASS:
                  value = instance.getMetaclass().getName();
                  break;

               case ObjectMessagePartMapping.ATTR_EVENT:
                  value = sEvent;
                  break;
            }

            tobj.setValue(part.getName(), value);
         }
      }

      if (!bProcessed)
      {
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

    */
   protected Object instantiate1(Object obj, MessagePart part)
   {
      ObjectMessagePartMapping mapping = (ObjectMessagePartMapping)part.getMapping();
      Metaclass derivedClass = (mapping == null) ? null : mapping.getMetaclass();
      MessagePart derivedPart = part;

      if (part instanceof CompositeMessagePart)
      {
         derivedPart = getPolymorphic((CompositeMessagePart)part, (TransferObject)obj);

         if (derivedPart != part)
         {
            ObjectMessagePartMapping derivedMapping = (ObjectMessagePartMapping)derivedPart.getMapping();

            if (mapping == null)
            {
               mapping = derivedMapping;
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.