Package nexj.core.meta

Examples of nexj.core.meta.MetadataException


      String sServiceName = XMLUtil.getReqStringAttr(element, "service");
      final Service service = (Service)m_globalMap.get(sServiceName);

      if (service == null)
      {
         throw new MetadataException("err.meta.soa.unknownService", new Object[] {sServiceName});
      }

      final Implementation impl = new Implementation(service);

      if (m_implementationMap.put(impl.getNamePrefix(), impl) != null)
      {
         throw new MetadataException("err.meta.soa.implementationDup",
            new Object[] {impl.getNamePrefix(), service.getName(), service.getDefinition().getNamePrefix()});
      }

      XMLUtil.forEachChildElement(element, "Interface", new XMLUtil.ElementHandler()
      {
         public void handleElement(Element interfaceElement)
         {
            String sInterfaceName = XMLUtil.getReqStringAttr(interfaceElement, "name");
            final Interface iface = service.getInterface(sInterfaceName);

            if (iface == null)
            {
               throw new MetadataException("err.meta.soa.implementation.undefinedInterface",
                  new Object[] {sInterfaceName, service.getName(), service.getDefinition().getNamePrefix()});
            }

            final InterfaceImplementation ifaceImpl = new InterfaceImplementation(impl, iface);

            if (!impl.addInterface(ifaceImpl))
            {
               throw new MetadataException("err.meta.soa.implementation.interfaceDup",
                  new Object[] {iface.getGlobalName(), service.getGlobalName()});
            }

            XMLUtil.forEachChildElement(interfaceElement, "Method", new XMLUtil.ElementHandler()
            {
               public void handleElement(Element methodElement)
               {
                  MethodImplementation method = new MethodImplementation();

                  method.setName(XMLUtil.getReqStringAttr(methodElement, "name"));
                  method.setArgs(XMLUtil.getStringAttr(methodElement, "args"));

                  if (!ifaceImpl.addMethod(method))
                  {
                     throw new MetadataException("err.meta.soa.implementation.methodDup",
                        new Object[] {method.getName(), method.getArgString(), iface.getName(), impl.getService().getGlobalName()});
                  }

                  if (iface.getMethod(method.getName(), method.getArgCount()) == null)
                  {
                     throw new MetadataException("err.meta.soa.implementation.unknownMethod",
                        new Object[] {method.getName(), method.getArgString(), iface.getName(), impl.getService().getGlobalName()});
                  }

                  Element scriptElement = XMLUtil.findChildElement(methodElement, "Script");
View Full Code Here


            {
               mapping.setValue(ZipMessagePartMapping.VALUE_TIME);
            }
            else
            {
               throw new MetadataException("err.meta.integration.zip.unknownValueMapping",
                  new Object[]{sValue, part.getFullPath()});
            }
         }
      }
View Full Code Here

   {
      verifyNotReadOnly();

      if (association.getReverse() == null)
      {
         throw new MetadataException("err.meta.workflow.association",
            new Object[]{association.getName(), association.getMetaclass().getName(), getFullName()});
      }
     
      if (association.getReverse().isCollection())
      {
         throw new MetadataException("err.meta.workflow.associationMultiplicity",
            new Object[]{association.getName(), association.getMetaclass().getName(), getFullName()});
      }

      if (m_associationList == null)
      {
View Full Code Here

    */
   public void setEvent(String sName, int nArgCount)
   {
      if (nArgCount < 0)
      {
         throw new MetadataException("err.meta.workflow.negativeEventArgCount",
            new Object[]{sName, getFullName()});
      }

      Member member = getTarget().getSelector(sName).getMember(nArgCount);

      if (!(member instanceof Event))
      {
         throw new MetadataException("err.meta.workflow.invalidEvent",
            new Object[]{sName, member.getMetaclass().getName(), getFullName()});
      }

      setEvent((Event)member);
   }
View Full Code Here

      if (event != null)
      {
         if (event.isStatic())
         {
            throw new MetadataException("err.meta.workflow.staticActionEvent",
               new Object[]{event.getName(), event.getMetaclass().getName(),
                  getFullName(), m_metaclass.getName()});
         }
      }
     
View Full Code Here

         if (parentMapping.getType() == TYPE_GROUP)
         {
            if (m_nType == TYPE_PARAMETER)
            {
               throw new MetadataException("err.meta.integration.vcard.invalidParameterPlacement",
                  new Object[]{part.getFullPath()});
            }
         }

         if (parentMapping.getName().length() > 0)
         {
            m_sFullName = parentMapping.getFullName() + '.' + m_sName;
         }
      }

      if (part instanceof PrimitiveMessagePart)
      {
         if (m_nType == TYPE_GROUP)
         {
            throw new MetadataException("err.meta.integration.vcard.groupMappedPrimitive",
               new Object[]{part.getFullPath()});
         }
      }
      else if (part instanceof CompositeMessagePart)
      {
         if (m_nType == TYPE_PARAMETER)
         {
            throw new MetadataException("err.meta.integration.vcard.parameterMappedComposite",
               new Object[]{part.getFullPath()});
         }
      }

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

         if (m_nType == VCardMessagePartMapping.TYPE_VALUE)
         {
            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++)
View Full Code Here

         {
            mapping.setSubtype(HL7MessagePartMapping.SUBTYPE_TM);
         }
         else
         {
            throw new MetadataException("err.meta.integration.hl7.invalidSubtype",
               new Object[]{sSubtype, part.getFullPath()});
         }
      }

      return mapping;
View Full Code Here

         }
      }

      if (m_nLevel == LEVEL_GROUP && nParentLevel > m_nLevel)
      {
         throw new MetadataException("err.meta.integration.hl7.missingMapping");
      }

      if (m_nLevel < 0)
      {
         if (nParentLevel < LEVEL_SEGMENT)
         {
            m_nLevel = (m_sName == null) ? LEVEL_FIELD : LEVEL_SEGMENT;
         }
         else
         {
            m_nLevel = nParentLevel + 1;
         }
      }

      if (m_nLevel > LEVEL_SUBCOMPONENT)
      {
         throw new MetadataException("err.meta.integration.hl7.levels");
      }

      if (m_sName != null)
      {
         if (m_nLevel == LEVEL_MESSAGE && m_nSeq != 0)
         {
            throw new MetadataException("err.meta.integration.hl7.naSeq");
         }

         if (nParentLevel >= LEVEL_SEGMENT)
         {
            throw new MetadataException("err.meta.integration.hl7.misplacedSeg", new Object[]{m_sName});
         }

         if (m_nLevel != LEVEL_MESSAGE)
         {
            m_nLevel = LEVEL_SEGMENT;
         }
      }
      else
      {
         if (m_nLevel > LEVEL_GROUP && m_nSeq <= 0)
         {
            throw new MetadataException("err.meta.integration.hl7.missingSeq");
         }
      }

      if (m_nLevel > LEVEL_FIELD && part.getMaxCount() > 1)
      {
         throw new MetadataException("err.meta.integration.hl7.maxCount", new Object[]{m_sName});
      }

      if (m_nSubtype != SUBTYPE_DEFAULT)
      {
         if (!(part instanceof PrimitiveMessagePart) ||
            ((PrimitiveMessagePart)part).getType() != Primitive.TIMESTAMP)
         {
            throw new MetadataException("err.meta.integration.hl7.inapplicableSubtype",
               new Object[]{new String[]{"DTM", "DT", "TM"}[m_nSubtype - 1], part.getFullPath()});
         }
      }
   }
View Full Code Here

      MessagePartMapping mapping = (parent == null) ? null : parent.getMapping();

      if (mapping != null &&
         ((HL7MessagePartMapping)mapping).getLevel() >= ((m_nLevel == LEVEL_GROUP) ? LEVEL_SEGMENT : m_nLevel))
      {
         throw new MetadataException("err.meta.integration.hl7.refLevel", new Object[]{ref.getFullPath()});
      }
   }
View Full Code Here

                  int n = ((HL7MessagePartMapping)((MessagePart)o1).getMapping()).getSeq() -
                     ((HL7MessagePartMapping)((MessagePart)o2).getMapping()).getSeq();

                  if (n == 0)
                  {
                     throw new MetadataException("err.meta.integration.hl7.dupSeq",
                        new Object[]{((MessagePart)o2).getFullPath()});
                  }

                  return n;
               }
View Full Code Here

TOP

Related Classes of nexj.core.meta.MetadataException

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.