Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.MessagePart


      assertEquals(3, cPart.getPart("areaCode").getMinCount());
      assertTrue(msg.getRoot().getAggregation() != CompositeMessagePart.SINGLE);
      msg = (Message)msgRegistry.get("phoneNumberA");
      assertTrue(msg.getRoot().getAggregation() != CompositeMessagePart.SINGLE);

      MessagePart p = msg.getRoot().getPart("phoneNumber");
     
      assertEquals(0, p.getMinCount());
      p = msg.getRoot().getPart("areaCode");
      assertEquals(0, p.getMinCount());
      p = msg.getRoot().getPart("number");
      assertEquals(0, p.getMinCount());

      msg = (Message)msgRegistry.get("sequencechoice");
      p = msg.getRoot().getPart("externalAct");
      assertEquals(0, p.getMinCount());

      msg = (Message)msgRegistry.get("unboundedChoice");
      p = msg.getRoot().getPart("th");
      assertEquals(0, p.getMinCount());

      msg = (Message)msgRegistry.get("wierdBoolean");
      p = msg.getRoot().getPart("ba");
      assertEquals(((XMLMessagePartMapping)p.getMapping()).getFormat(), "true;false");
   }
View Full Code Here


      //System.err.println(XMLUtil.formatXML(writer.toString()));
     
      Message recursiveElement = getMessage("recursiveElement");
     
      MessagePart elem2 = recursiveElement.getRoot().getPart("recursiveElement2");
     
      assertTrue(elem2 instanceof CompositeMessagePartRef);
     
      CompositeMessagePartRef msgRef = (CompositeMessagePartRef)elem2;
     
View Full Code Here

     
      msgA.getRoot().getPart("booleanA");
      msgA.getRoot().getPart("stringA");
     
      Message msgB = (Message)msgRegistry.get("elementB");
      MessagePart childB = msgB.getRoot().getPart("childB");
     
      assertTrue(childB instanceof CompositeMessagePartRef);
      assertEquals(((CompositeMessagePartRef)childB).getRefPart().getName(), "elementA");
   }
View Full Code Here

      codeType.getRoot().getPart("code");
      codeType.getRoot().getPart("description");
     
      Message msgA = (Message)msgRegistry.get("elementA");
     
      MessagePart codeA = msgA.getRoot().getPart("codeA");
     
      assertTrue(codeA instanceof CompositeMessagePartRef);
      assertEquals(((CompositeMessagePartRef)codeA).getRefPart().getName(), "CodeType");
     
      msgA.getRoot().getPart("stringA");
     
      Message msgB = (Message)msgRegistry.get("elementB");
      MessagePart codeB = msgB.getRoot().getPart("codeB");
      MessagePart childB = msgB.getRoot().getPart("childB");
     
      assertTrue(codeB instanceof CompositeMessagePartRef);
      assertEquals(((CompositeMessagePartRef)codeB).getRefPart().getName(), "CodeType");
     
      assertTrue(childB instanceof CompositeMessagePartRef);
View Full Code Here

      {
         assertNotNull(e);
      }
     
      Message myBaseType = (Message)msgRegistry.get("myBaseType");
      MessagePart part = myBaseType.getRoot().getPart("baseElement");
        
      assertTrue(part instanceof PrimitiveMessagePart);

      Message parent = (Message)msgRegistry.get("parent");
      MessagePart child = parent.getRoot().getPart("child");

      assertTrue(child instanceof CompositeMessagePartRef);
     
      Message childMsg = (Message)msgRegistry.get("parent_child");
     
View Full Code Here

      Message msg = (Message)msgLookup.get("PRPA_IN101103CA");
     
      assertNull(msg.getRoot().getDescription());

      Message msgBase = (Message)msgLookup.get("PRPA_IN101103CA_MCCI_MT002100CA_Message");
      MessagePart part = msgBase.getRoot().getPart("id");

      String sDescription = part.getDescription();
     
      assertTrue(sDescription.startsWith("A unique identifier for the message."));
      assertTrue(sDescription.endsWith("A root component is required or else the II value is NULL."));
     
      msg = (Message)msgLookup.get("II");
View Full Code Here

         if (obj != null)
         {
            CompositeMessagePart composite = (CompositeMessagePart)part;
            TransferObject tobj = (TransferObject)obj;
            RootXMLMessagePartMapping rootMapping = null;
            MessagePart headersPart = null;
            boolean bEnvelopeStarted = false;

            // append the namespace and the schema
            if (parentPart == null)
            {
View Full Code Here

      boolean bRequired = false;
      boolean bSingle = part.getAggregation() == CompositeMessagePart.SINGLE;

      for (int i = 0, nPartCount = part.getPartCount(); i < nPartCount; ++i)
      {
         MessagePart childPart = part.getPart(i);
         XMLMessagePartMapping childMapping = (XMLMessagePartMapping)childPart.getMapping();
         byte nNodeType = childMapping.getNodeType();

         // Skip the header
         if (childPart == headersPart)
         {
            continue;
         }

         if (nNodeType == XMLMessagePartMapping.ELEMENT)
         {
            if (bSingle)
            {
               bRequired |= childPart.isRequired();
            }

            if (childMapping.isNillable() || tobj.hasValue(childPart.getName()))
            {
               if (bSingle)
               {
                  if (bMatch)
                  {
                     throw new IntegrationException("err.integration.multipleParts",
                           new Object[]{part.getFullPath()});
                  }

                  bMatch = true;
               }

               if (bEmpty)
               {
                  m_writer.closeElement();
               }

               bEmpty = false;
               append(tobj.findValue(childPart.getName()), childPart, part);
            }
            else if (!bSingle && childPart.isRequired())
            {
               throw new IntegrationException("err.integration.minPartCount", new Object[]{childPart.getFullPath()});
            }
         }
         else if (nNodeType == XMLMessagePartMapping.VALUE)
         {
            PrimitiveMessagePart contentPart = (PrimitiveMessagePart)childPart;
View Full Code Here

    */
   protected void appendAttributes(TransferObject tobj, CompositeMessagePart part) throws IOException
   {
      for (int i = 0, nPartCount = part.getPartCount(); i < nPartCount; ++i)
      {
         MessagePart childPart = part.getPart(i);
         XMLMessagePartMapping childMapping = (XMLMessagePartMapping)childPart.getMapping();
         int nChildNodeType = childMapping.getNodeType();

         if (nChildNodeType == XMLMessagePartMapping.ATTRIBUTE)
         {
            if (tobj.hasValue(childPart.getName()))
            {
               m_writer.setNamespace((childMapping.getNamespace() == null) ? null : childMapping.getNamespace().getName());
               m_writer.writeAttribute(childMapping.getNodeName(), toString((PrimitiveMessagePart)childPart, tobj.getValue(childPart.getName())));
            }
            else
            {
               if (childPart.isRequired())
               {
                  throw new IntegrationException("err.integration.minPartCount", new Object[]{childPart.getFullPath()});
               }
            }
         }
      }

      XMLMessagePartMapping mapping = (XMLMessagePartMapping)part.getMapping();
      MessagePart valuePart = mapping.getValuePart();

      if (valuePart != null && mapping.isNillable() && tobj.findValue(valuePart.getName()) == null)
      {
         m_writer.setNamespace(XMLNamespace.XSI_NAME);
         m_writer.writeAttribute("nil", "1");
      }
   }
View Full Code Here

      m_writer.setNamespace(sEnvelopeNamespace);
      m_writer.openElement("Envelope");
      appendNamespaces(rootMapping, true, false);
      m_writer.closeElement();

      MessagePart headersPart = rootMapping.getHeaderPart();

      if (headersPart != null)
      {
         Object value = tobj.findValue(headersPart.getName());

         if (value != null || headersPart.isRequired())
         {
            append(value, headersPart, (CompositeMessagePart)rootMapping.getMessagePart());
         }
      }
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.