Package nexj.core.meta

Examples of nexj.core.meta.MetadataValidationException


   {
      int nCount = getArgumentCount();
     
      if (nCount == 0)
      {
         MetadataValidationException e = new MetadataValidationException(
            "err.meta.transformation.sourceRequired", new Object[]{getName()});

         transformation.setProperties(e);
         setProperties(e);

         throw e;
      }
   
      if (getDestinationCount() == 0)
      {
         return;
      }
     
      int nLevel = 0;
      int nOrdinal = 0;
      int nColLevel = -1;
     
      for (int i = 0; i != nCount; ++i)
      {
         TransformationSource src = getArgument(i).getSource();
         int nCollectionLevel = -1;
        
         for (int k = src.getLevel(); k >= 0; --k)
         {
            if (src.getPath(k).getPart().isCollection())
            {
               nCollectionLevel = k;
              
               break;
            }
         }

         if (nCollectionLevel > nColLevel ||
            src.getLevel() > nLevel && nCollectionLevel >= nColLevel)
         {
            nLevel = src.getLevel();
            nOrdinal = i;
            nColLevel = nCollectionLevel;
         }
      }

      TransformationArgument primaryArg = getArgument(nOrdinal);
      TransformationSource primarySource = primaryArg.getSource();

      primaryArg.setStartLevel(primarySource.getLevel());
      primarySource.addMapping(this);

      for (TransformationSource source = primarySource; source != null; source = source.getParent())
      {
         if (source.getPart().isCollection() && !isFixedSource(source))
         {
            m_collectionParent = source;
            break;
         }
      }
     
      for (int i = 0; i != nCount; ++i)
      {
         if (i == nOrdinal)
         {
            continue;
         }

         TransformationArgument arg = getArgument(i);
         TransformationSource src = arg.getSource();

         for (int k = src.getLevel(); k >= 0; --k)
         {
            TransformationSource path = src.getPath(k);

            if (k <= primarySource.getLevel() && path == primarySource.getPath(k))
            {
               arg.setStartLevel(k);
              
               break;
            }

            if (path.getPart().isCollection())
            {
               MetadataValidationException e = new MetadataValidationException(
                  "err.meta.transformation.parentCollection",
                  new Object[]{src.getPart().getName(), getName()});

               transformation.setProperties(e);
               setProperties(e);
View Full Code Here


      if (m_nGeneration != 0)
      {
         if (m_nGeneration == 1)
         {
            MetadataValidationException e = new MetadataValidationException(
               "err.meta.transformation.mappingCircularRef", new Object[]{getName()});

            transformation.setProperties(e);
            setProperties(e);
View Full Code Here

      m_response.addEvent(eventList);

      ValidationException e = new ValidationException("err.validation.requiredAttributes", new Object[]{"Contact"});

      e.addException(new MetadataValidationException("err.meta.x", new Object[]{"a", "b"}));
      e.addException(new QueryTimeoutException());
      e.setClassName("Contact");
      e.setOIDHolder(contact);
      e.setOrdinal(1);
      e.addException("firstName", new ValidationException("err.validation.requiredAttribute", new Object[]{"firstName", "Contact"}));
View Full Code Here

      m_response.addEvent(eventList);
     
      ValidationException e = new ValidationException("err.validation.requiredAttributes",
                                                      new Object[]{"Contact"});

      e.addException(new MetadataValidationException("err.meta.x", new Object[]{"a", "b"}));
      e.addException(new QueryTimeoutException());
      e.setClassName("Contact");
      e.setOIDHolder(contact);
      e.setOrdinal(1);
      e.addException("firstName",
View Full Code Here

         if (typeCode != Undefined.VALUE)
         {
            if (typeCode == null || Primitive.primitiveOf(typeCode) == Primitive.ANY)
            {
               MetadataValidationException e = new MetadataValidationException(
                  "err.meta.typeCodeValue"new Object[]{m_typeCodeAttribute.getName(), m_metaclass.getName()});

               m_typeCodeAttribute.setProperties(e);

               throw e;
            }

            typeCode = ((Primitive)m_typeCodeAttribute.getType()).convert(typeCode);
         }

         try
         {
            if (typeCode != Undefined.VALUE)
            {
               addTypeCode(typeCode, m_metaclass);
            }

            for (; baseMapping != null; baseMapping = baseMapping.getBaseMapping())
            {
               if (baseMapping.m_dataSource != m_dataSource ||
                  baseMapping.m_typeCodeAttribute == null)
               {
                  break;
               }

               if (!m_bTypeCodeFiltered)
               {
                  if (baseMapping.m_typeCodeAttribute.getValue() != Undefined.VALUE ||
                     baseMapping.getMetaclass().getDerivedCount() != 1)
                  {
                     m_bTypeCodeFiltered = true;
                  }
               }

               if (typeCode != Undefined.VALUE)
               {
                  baseMapping.addTypeCode(typeCode, m_metaclass);
                  baseMapping.m_bTypeCodeDispatched = true;
               }
            }
         }
         catch (UncheckedException x)
         {
            MetadataValidationException e = new MetadataValidationException(x);

            m_typeCodeAttribute.setProperties(e);

            throw e;
         }
View Full Code Here

            if (pathToAdd == null)
            {
               ObjectMessagePartMapping partMapping = (ObjectMessagePartMapping)part.getMapping();

               throw new MetadataValidationException("err.meta.integration.object.mapping.associationCodeDup",
                  new Object[]{partMapping.getAssociationCode(), part.getFullPath()});
            }
         }

         m_assocPathByDependentMsgPartMap.put(part, pathToAdd);
View Full Code Here

         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");

            setProperties(e, part);
            warnings.addException(e);
         }

         if (m_bKey && part.isCollection() && !m_bLocal)
         {
            MetadataValidationException e = new MetadataValidationException("err.meta.integration.object.mapping.collectionKeyNeedsSubKey");

            setProperties(e, part);
            warnings.addException(e);
         }

         if (m_bKey && m_bLocal && !m_bSubKeyParent)
         {
            MetadataValidationException e = new MetadataValidationException("err.meta.integration.object.mapping.localKeyNeedsSubKey");

            setProperties(e, part);
            warnings.addException(e);
         }
      }
View Full Code Here

               mapping.setName("");
            }
         }
         else if (sType != null)
         {
            throw new MetadataValidationException("err.meta.integration.vcard.invalidType",
               new Object[]{sType, part.getFullPath()});
         }

         String sQuoting = XMLUtil.getStringAttr(mappingElement, "quoting");

         if ("none".equals(sQuoting))
         {
            mapping.setQuoting(VCardMessagePartMapping.QUOTING_NONE);
         }
         else if ("base64".equals(sQuoting))
         {
            mapping.setQuoting(VCardMessagePartMapping.QUOTING_BASE64);
         }
         else if ("qp".equals(sQuoting))
         {
            mapping.setQuoting(VCardMessagePartMapping.QUOTING_QP);
         }
         else if ("vcard".equals(sQuoting))
         {
            mapping.setQuoting(VCardMessagePartMapping.QUOTING_VCARD);
         }
         else if (sQuoting != null)
         {
            throw new MetadataValidationException("err.meta.integration.vcard.invalidQuoting",
               new Object[]{sQuoting, part.getFullPath()});
         }

         CompositeMessagePart parentPart = part.getParent();
         String sWrapping = XMLUtil.getStringAttr(mappingElement, "wrapping");

         if (parentPart != null && sWrapping == null)
         {
            mapping.setWrapping(((VCardMessagePartMapping)parentPart.getMapping()).getWrapping());
         }
         else if ("whitespace".equals(sWrapping))
         {
            mapping.setWrapping(VCardMessagePartMapping.WRAPPING_WHITESPACE);
         }
         else if ("anywhere".equals(sWrapping))
         {
            mapping.setWrapping(VCardMessagePartMapping.WRAPPING_ANYWHERE);
         }
         else if (sWrapping != null)
         {
            throw new MetadataValidationException("err.meta.integration.vcard.invalidWrapping",
               new Object[]{sWrapping, part.getFullPath()});
         }

         String sSubtype = XMLUtil.getStringAttr(mappingElement, "subtype");

         if (sSubtype == null)
         {
            if ((part instanceof PrimitiveMessagePart) &&
               (((PrimitiveMessagePart)part).getType() == Primitive.TIMESTAMP))
            {
               mapping.setSubtype(VCardMessagePartMapping.SUBTYPE_DATETIME);
            }
         }
         else if ("date".equals(sSubtype))
         {
            mapping.setSubtype(VCardMessagePartMapping.SUBTYPE_DATE);
         }
         else if ("dateTime".equals(sSubtype))
         {
            mapping.setSubtype(VCardMessagePartMapping.SUBTYPE_DATETIME);
         }
         else
         {
            throw new MetadataValidationException("err.meta.integration.vcard.invalidSubtype",
               new Object[]{sSubtype, part.getFullPath()});
         }
      }

      return mapping;
View Full Code Here

                           classMapping.getSourceKey() != baseClassMapping.getSourceKey());
                     }

                     if (bMismatch)
                     {
                        MetadataValidationException e = new MetadataValidationException(
                           "err.meta.persistenceMappingMismatch",
                           new Object[]{derivedAttribute.getName(), m_metaclass.getName(), mapping.getMetaclass().getName()});

                        derivedAttribute.setProperties(e);
View Full Code Here

      if (m_lastVersion != null && !m_metadata.getVersion().equals(m_lastVersion.getName()))
      {
         eh = new MetadataCompoundValidationException();

         MetadataValidationException e = new MetadataValidationException("err.upgrade.lastVersion",
            new Object[]{m_lastVersion.getName(), m_metadata.getVersion()});

         setProperties(e);
         eh.addException(e);
      }
View Full Code Here

TOP

Related Classes of nexj.core.meta.MetadataValidationException

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.