Package nexj.core.rpc

Examples of nexj.core.rpc.TransferObject$Iterator


            if (mapping.getNodeType() == XMLMessagePartMapping.ELEMENT)
            {
               if (matches(part, sURI, sLocalName))
               {
                  TransferObject tobj;
                  MessagePart basePart = part;

                  m_bNilElement = mapping.isNillable() &&
                      (Primitive.toBoolean(attributes.getValue(XMLNamespace.XSI, "nil")) == Boolean.TRUE);

                  if (part instanceof PrimitiveMessagePart)
                  {
                     tobj = null;

                     if (((PrimitiveMessagePart)part).getType() == Primitive.ANY)
                     {
                        if (mapping.getInterface() == null)
                        {
                           startParsingAnyType((mapping.getSubtype() == XMLMessagePartMapping.SUBTYPE_XSI) ?
                              attributes.getValue(XMLNamespace.XSI, "type") : null);
                        }
                     }
                  }
                  else
                  {
                     CompositeMessagePart composite2 = (CompositeMessagePart)part;
                     PrimitiveMessagePart valuePart = mapping.getValuePart();

                     tobj = new TransferObject(composite2.getPartCount());
                     parseAttributes(tobj, composite2, attributes);

                     // Process message inheritance
                     if (composite2 instanceof CompositeMessagePartRef)
                     {
                        CompositeMessagePartRef ref = (CompositeMessagePartRef)composite2;
                        CompositeMessagePart referencedPart = ref.getRefPart();

                        tobj.setClassName(referencedPart.getName());

                        RootXMLMessagePartMapping refRootMapping = (RootXMLMessagePartMapping)referencedPart.getMapping();
                        Message derivedMessage = getDerivedMessage(attributes, refRootMapping, part.getFullPath());

                        if (derivedMessage != null)
                        {
                           Message referencedMessage = refRootMapping.getRootMessage();

                           Message.validatePolymorphism(referencedMessage, derivedMessage, part);
                           tobj.setClassName(derivedMessage.getName());
                           part = derivedMessage.getRoot();
                           valuePart = ((XMLMessagePartMapping)part.getMapping()).getValuePart();
                        }
                     }
View Full Code Here


      {
         return false;
      }

      // No need to check element NS:name against header part--it is already correct (enforced by envelope processor)
      m_stack.push(m_headerPart, m_headerPart, new TransferObject(), 0, null);
      m_bProcessRoot = false;

      return true;
   }
View Full Code Here

            m_headerPart = rootMapping.getHeaderPart();
            m_bRestart = true;
         }
      }

      TransferObject tobj = (TransferObject)m_stack.getTopObject();

      if (!m_bRestart)
      {
         parseAttributes(tobj, (CompositeMessagePart)part, attributes);
      }

      Message derivedMessage = getDerivedMessage(attributes, rootMapping, part.getFullPath());
      Message primaryMessage = rootMapping.getRootMessage();

      tobj.setClassName(primaryMessage.getName());

      if (derivedMessage != null)
      {
         CompositeMessagePart derivedMessageRoot = derivedMessage.getRoot();
         RootXMLMessagePartMapping derivedMessageRootMapping = (RootXMLMessagePartMapping)derivedMessageRoot.getMapping();

         Message.validatePolymorphism(primaryMessage, derivedMessage, derivedMessageRoot);
         m_stack.setTopBaseMessagePart(part);
         part = derivedMessageRoot;
         m_stack.setTopMessagePart(part);
         tobj.setClassName(derivedMessage.getName());

         MessagePart headerPart = derivedMessageRootMapping.getHeaderPart();

         if (m_headerPart != headerPart)
         {
View Full Code Here

               s_logger.debug("Identified the XML anyType message as \"" + msg.getName() + "\"");
            }
         }

         CompositeMessagePart composite = (CompositeMessagePart)part;
         TransferObject tobj = new TransferObject(msg.getName(), composite.getPartCount());

         parseAttributes(tobj, composite, attributes);
         m_stack.setTopIndex(nIndex);
         m_stack.push(part, basePart, tobj, 0, null);
View Full Code Here

         obj = Undefined.VALUE;
      }
      else
      {
         CompositeMessagePart composite = (CompositeMessagePart)part;
         TransferObject tobj = (TransferObject)m_stack.getTopObject();
         int nPartCount = composite.getPartCount();
         boolean bMatch = false;
         boolean bRequired = false;

         if (tobj != null)
         {
            for (int nIndex = 0; nIndex < nPartCount; ++nIndex)
            {
               MessagePart child = composite.getPart(nIndex);
               int nNodeType = ((XMLMessagePartMapping)child.getMapping()).getNodeType();

               if (!m_bNilElement && nNodeType == XMLMessagePartMapping.ELEMENT// ignore counts for nil elements
               {
                  if (composite.getAggregation() == CompositeMessagePart.SINGLE)
                  {
                     if (tobj.hasValue(child.getName()))
                     {
                        if (bMatch)
                        {
                           throw new IntegrationException("err.integration.multipleParts",
                              new Object[]{composite.getFullPath()});
                        }

                        validatePartCount(child);
                        bMatch = true;
                     }

                     bRequired |= child.isRequired();
                  }
                  else
                  {
                     validatePartCount(child);
                  }
               }
               else if (nNodeType == XMLMessagePartMapping.VALUE)
               {
                  Object value = null;

                  if ((value = getAnyTypeValue()) != null)
                  {
                     // Value-mapped part for literal XML will have just one element when collection
                     if (child.isCollection())
                     {
                        ArrayList list = new ArrayList(1);

                        list.add(value);
                        value = list;
                     }
                  }
                  else
                  {
                     value = m_stack.getTopValue();

                     if (value instanceof StringBuilder)
                     {
                        value = value.toString();
                     }

                     if (value instanceof String)
                     {
                        value = convert((PrimitiveMessagePart)child, (String)value);
                     }
                  }

                  tobj.setValue(child.getName(), value);
                  validatePartCount(child);
               }
            }

            if (bRequired && !bMatch)
            {
               throw new IntegrationException("err.integration.missingPart",
                  new Object[]{composite.getFullPath()});
            }
         }

         if (!m_bNilElement || tobj.getValueCount() > 0)
         {
            obj = tobj;
         }
         else
         {
View Full Code Here

      m_bNilElement = false;
      m_stack.pop();

      if (!m_stack.isEmpty() && result != Undefined.VALUE)
      {
         TransferObject tobj = (TransferObject)m_stack.getTopObject();
         MessagePart parentPart = m_stack.getTopMessagePart();

         /* If parent is a referenced message part: should use mapping from referrer,
          * but value part must be taken from referenced message part mapping.
          */
         PrimitiveMessagePart valuePart = ((XMLMessagePartMapping)parentPart.getMapping()).getValuePart();

         if (valuePart != null && childPart.getParent() == null)
         {
            // Handle type=any, value-mapped, with interface.
            //
            // ChildPart has not parent -> root part -> parentPart is any/interface
            // Value Parts are never composite, so cannot be a reference.
            if (valuePart.isCollection())
            {
               List list = (List)m_stack.getTopValue();

               if (list == null)
               {
                  list = new ArrayList();
                  m_stack.setTopValue(list);
               }

               list.add(result);
            }
            else
            {
               m_stack.setTopValue(result);
               m_stack.setTopIndex(m_stack.getTopIndex() + 1);
            }
         }
         else if (parentPart instanceof PrimitiveMessagePart)
         {
            // Handle type=any with interface, when mapped on an element.
            m_stack.setTopObject(result);
         }
         else
         {
            String sChildPartName = childPart.getName();
           
            if (childPart.isCollection())
            {
               List list = (List)tobj.findValue(sChildPartName);

               if (list == null)
               {
                  list = new ArrayList();
                  tobj.setValue(sChildPartName, list);
               }

               list.add(result);
            }
            else
            {
               if (((CompositeMessagePart)parentPart).getAggregation() != CompositeMessagePart.SEQUENTIAL)
               {
                  if (tobj.hasValue(sChildPartName))
                  {
                     throw new IntegrationException("err.integration.maxPartCount", new Object[]{childPart.getFullPath()});
                  }
               }

               tobj.setValue(sChildPartName, result);
               m_stack.setTopIndex(m_stack.getTopIndex() + 1);
            }
         }
      }
   }
View Full Code Here

   /**
    * @see nexj.core.meta.integration.EndpointPart#createObject()
    */
   public TransferObject createObject()
   {
      return new TransferObject();
   }
View Full Code Here

      ArrayList tobjList = new ArrayList(nEnd - nStart);

      for (int i = nStart; i < nEnd; i++)
      {
         Instance instance = workArray[i].getInstance();
         TransferObject tobj = new TransferObject(instance.getOID(), metaclass.getName(), EVENT, nAttributeCount);

         for (int k = 0; k < nAttributeCount; k++)
         {
            if (instance.isDirty(k))
            {
               Attribute attribute = metaclass.getInstanceAttribute(k);
               AttributeMapping attrMapping = m_mapping.getAttributeMapping(attribute);

               if (attrMapping != null)
               {
                  int nKeyPart = (attrMapping instanceof VirtualPrimitiveMapping) ?
                     ((VirtualPrimitiveMapping)attrMapping).getObjectKeyPart() : -1;
                  Object value;

                  if (nKeyPart >= 0 && instance.getOID() != null)
                  {
                     value = instance.getOID().getValue(nKeyPart);
                  }
                  else
                  {
                     value = instance.getValue(k);
                  }

                  setValue(tobj, attribute, value);
               }
            }
         }

         tobjList.add(tobj);
      }

      try
      {
         operation.invoke(tobjList, m_adapter.getInvocationContext().getMachine(), fragment);
      }
      finally
      {
         // Sets the locking value and OID, if provided by the create mapping.
         for (int k = nStart; k < nEnd; k++)
         {
            Instance instance = workArray[k].getInstance();
            TransferObject tobj = (TransferObject)tobjList.get(k - nStart);

            if (nLockingOrdinal >= 0)
            {
               instance.setValueDirect(nLockingOrdinal,
                  tobj.findValue(sLockingAttributeName, instance.getValueDirect(nLockingOrdinal)));
            }

            if (tobj.getOID() != null)
            {
               instance.setOID(tobj.getOID());
            }

            if (instance.getOID() == null)
            {
               throw new PersistenceException("err.persistence.requiredOID", new Object[]{instance.getMetaclass().getName()});
View Full Code Here

         for (int k = nStart; k < nEnd; k++)
         {
            VirtualUpdate work = (VirtualUpdate)workArray[k];
            Instance instance = work.getInstance();
            TransferObject tobj = new TransferObject(instance.getOID(), metaclass.getName(), EVENT, nUpdateAttrCount);

            if (bFull)
            {
               for (int m = 0, nCount = metaclass.getInstanceAttributeCount(); m < nCount; m++)
               {
                  Attribute attribute = metaclass.getInstanceAttribute(m);

                  if (bIgnoreDirty || instance.isDirty(m))
                  {
                     setValue(tobj, attribute, instance.getValue(m));
                  }
               }
            }
            else
            {
               for (int m = updateAttrSet.nextSetBit(0); m >= 0; m = updateAttrSet.nextSetBit(m + 1))
               {
                  Attribute attribute = metaclass.getInstanceAttribute(m);

                  if (bIgnoreDirty || instance.isDirty(m))
                  {
                     setValue(tobj, attribute, instance.getValue(m));
                  }
               }
            }

            if (nLockingOrdinal >= 0)
            {
               tobj.setValue(sLockingAttributeName, instance.getValue(nLockingOrdinal));
            }

            tobjList.add(tobj);
         }

         boolean bError = true;

         try
         {
            update.invoke(tobjList, m_adapter.getInvocationContext().getMachine(), fragment);
            bError = false;
         }
         finally
         {
            // Set new locking values
            if (nLockingOrdinal >= 0)
            {
               for (int k = nStart; k < nEnd; k++)
               {
                  Instance instance = ((VirtualUpdate)workArray[k]).getInstance();
                  TransferObject tobj = (TransferObject)tobjList.get(k - nStart);
                  Object locking = tobj.findValue(sLockingAttributeName);

                  if (locking == null || ObjUtil.equal(locking, instance.getValue(nLockingOrdinal)))
                  {
                     if (!bError)
                     {
View Full Code Here

               return formatChunk(chunk, nRetry + 1);
            }

            if (chunk.size() == 1)
            {
               TransferObject tobj = (TransferObject) chunk.iterator().next();

               m_ex.addException(e, tobj);

               if (s_logger.isDebugEnabled())
               {
View Full Code Here

TOP

Related Classes of nexj.core.rpc.TransferObject$Iterator

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.