Package nexj.core.integration

Examples of nexj.core.integration.IntegrationException


         m_writer.setWrappingMode(m_nDefaultWrappingMode);
         format(tobj, msgRoot);
      }
      catch (IOException ex)
      {
         throw new IntegrationException("err.integration.format",
            new Object[]{message.getName()}, ex);
      }
   }
View Full Code Here


   {
      if (tobj == null)
      {
         if (part.isRequired())
         {
            throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
         }

         return;
      }
View Full Code Here

      if (valueObj == null && valuePartMapping.getDefault() == null)
      {
         if (valuePart.isRequired())
         {
            throw new IntegrationException("err.integration.minPartCount", new Object[]{valuePart.getFullPath()});
         }

         return;
      }

      m_writer.write((bParameters) ? mapping.getFullName() : valuePartMapping.getFullName());

      int nChildCount = (bParameters) ? parentPart.getPartCount() : 0;

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

         if (childMapping.getType() == VCardMessagePartMapping.TYPE_PARAMETER)
         {
            Object parameterObj = ((TransferObject)obj).findValue(childPart.getName());

            if (parameterObj != null || childMapping.getDefault() != null)
            {
               m_writer.write(';');
               m_writer.write(childMapping.getName());
               m_writer.write('=');
               writeValue((PrimitiveMessagePart)childPart, childMapping, parameterObj);
            }
            else
            {
               if (childPart.isRequired())
               {
                  throw new IntegrationException("err.integration.minPartCount", new Object[]{childPart.getFullPath()});
               }
            }
         }
      }
View Full Code Here

    */
   protected static void checkMultiplicity(int nCount, MessagePart part)
   {
      if (nCount < part.getMinCount())
      {
         throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
      }

      if (nCount > part.getMaxCount())
      {
         throw new IntegrationException("err.integration.maxPartCount", new Object[]{part.getFullPath()});
      }
   }
View Full Code Here

                     return true;

                  case 2: // Body
                     if (m_stateArray[m_nState]++ != 0)
                     {
                        throw new IntegrationException("err.integration.xml.invalidEnvelope",
                           new Object[]{sURI, sLocalName});
                     }

                     if (sLocalName.equals("Fault") && sURI.equals(m_sEnvelopeNamespace))
                     {
                        // If the message is mapped for the SOAP fault, let the main parser handle it
                        if (m_parser.acceptRootElement(sURI, sLocalName, attributes, false))
                        {
                           m_nParsingStatus = STATUS_PARSING_MESSAGE;

                           return true;
                        }

                        m_parser.changeRoot(m_parser.getInvocationContext().getMetadata().getMessage(
                           (m_nEnvelope == RootXMLMessagePartMapping.ENVELOPE_SOAP12) ? "SOAP12Fault" : "SOAP11Fault"));

                        if (m_parser.acceptRootElement(sURI, sLocalName, attributes, false))
                        {
                           m_nParsingStatus = STATUS_PARSING_MESSAGE;
                           m_bFault = true;

                           return true;
                        }

                        return false;
                     }

                     m_nParsingStatus = STATUS_PARSING_MESSAGE;
                     m_parser.acceptRootElement(sURI, sLocalName, attributes, true);

                     return true;
               }

               break;
         }
      }

      throw new IntegrationException("err.integration.xml.invalidEnvelope",
         new Object[]{sURI, sLocalName});
   }
View Full Code Here

      {
         throw e;
      }
      catch (Exception e)
      {
         throw new IntegrationException("err.integration.format",
            new Object[]{message.getName()}, e);
      }
   }
View Full Code Here

            if (value == null)
            {
               if (part.isRequired())
               {
                  throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
               }

               if (partMapping.getLevel() >= HL7MessagePartMapping.LEVEL_FIELD)
               {
                  appendSeparators(partMapping, nLevel);
                  m_writer.write("\"\"");
               }
            }
            else
            {
               appendSeparators(partMapping, nLevel);

               if (part.isCollection())
               {
                  List list = (List)value;

                  if (list.size() < part.getMinCount())
                  {
                     throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
                  }

                  if (list.size() > part.getMaxCount())
                  {
                     throw new IntegrationException("err.integration.maxPartCount", new Object[]{part.getFullPath()});
                  }

                  for (int k = 0, m = list.size(); k < m; ++k)
                  {
                     if (k != 0 && partMapping.getLevel() >= HL7MessagePartMapping.LEVEL_FIELD)
                     {
                        m_writer.write('~');
                     }

                     if (part instanceof CompositeMessagePart)
                     {
                        append((TransferObject)list.get(k), (CompositeMessagePart)part, composite);
                     }
                     else
                     {
                        append(list.get(k), (PrimitiveMessagePart)part);
                     }
                  }
               }
               else
               {
                  if (part instanceof CompositeMessagePart)
                  {
                     append((TransferObject)value, (CompositeMessagePart)part, composite);
                  }
                  else
                  {
                     append(value, (PrimitiveMessagePart)part);
                  }
               }
            }
         }
         else
         {
            if (part.isRequired())
            {
               throw new IntegrationException("err.integration.minPartCount", new Object[]{part.getFullPath()});
            }
         }
      }

      // Close a segment
View Full Code Here

         {
            formatRecords((List)toFormat, recordPart);
         }
         else
         {
            throw new IntegrationException("err.integration.invalidRowCollection",
               new Object[]{(toFormat != null) ? toFormat.getClass().getName() : null});
         }

         m_writer.write(rootMapping.getSuffix());
      }
      catch (IOException innerEx)
      {
         throw new IntegrationException("err.integration.format",
            new Object[]{message.getName()}, innerEx);
      }
   }
View Full Code Here

            throw (IntegrationException)e;
         }

         if (m_stack.getMessagePart(0) == null)
         {
            throw new IntegrationException("err.integration.xml.unparseableMessage", e);
         }

         throw new IntegrationException("err.integration.xml.messageSyntax",
            new Object[]{m_stack.getMessagePart(0).getName()}, e);
      }
   }
View Full Code Here

         return true;
      }

      if (m_stack.isEmpty())
      {
         throw new IntegrationException("err.integration.xml.unexpectedElement",
               new Object[] {sURI, sLocalName});
      }

      MessagePart parentPart = m_stack.getTopMessagePart();

      if (m_bNilElement)
      {
         throw new IntegrationException("err.integration.xml.nilElementNotEmpty",
            new Object[] {parentPart.getFullPath()});
      }

      if (parentPart instanceof CompositeMessagePart)
      {
         CompositeMessagePart parentComposite = (CompositeMessagePart)parentPart;

         for (int nIndex = (parentComposite.getAggregation() == CompositeMessagePart.SEQUENTIAL) ? m_stack.getTopIndex() : 0;
            nIndex < parentComposite.getPartCount(); ++nIndex)
         {
            MessagePart part = parentComposite.getPart(nIndex);
            XMLMessagePartMapping mapping = (XMLMessagePartMapping)part.getMapping();

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

                     if (valuePart != null && valuePart.getType() == Primitive.ANY)
                     {
                        XMLMessagePartMapping valuePartMapping = (XMLMessagePartMapping)valuePart.getMapping();

                        if (valuePartMapping.getInterface() == null)
                        {
                           startParsingAnyType(null)// value part cannot parse to a primitive (attributes not allowed if primitive)
                        }
                     }
                  }

                  m_stack.setTopIndex(nIndex);
                  m_stack.push(part, basePart, tobj, 0, null);

                  return true;
               }
            }
            else if (mapping.getNodeType() == XMLMessagePartMapping.VALUE)
            {
               if (acceptAnyTypeElement(sURI, sLocalName, attributes, (PrimitiveMessagePart)part, nIndex))
               {
                  return true;
               }
            }
         }

         if (parentComposite.isLax())
         {
            s_logger.debug("Ignoring the element");

            m_stack.push(LAX_PART, null, null, 0, null);

            return true;
         }
      }
      else if (parentPart instanceof PrimitiveMessagePart)
      {
         if (acceptAnyTypeElement(sURI, sLocalName, attributes, (PrimitiveMessagePart)parentPart, 0))
         {
            return true;
         }
      }

      throw new IntegrationException("err.integration.xml.invalidElement",
         new Object[]{sURI, sLocalName, parentPart.getFullPath()});
   }
View Full Code Here

TOP

Related Classes of nexj.core.integration.IntegrationException

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.