Package nexj.core.meta

Examples of nexj.core.meta.Aspect


               addAspects();
            }

            for (int i = 0, n = pointcut.getAspectCount(); i < n; ++i)
            {
               Aspect aspect = pointcut.getAspect(i);

               if (m_aspectNameSet.contains(aspect.getName()))
               {
                  aspect.applyTo(pointcut, nPass);
               }
            }
         }

         protected Iterator getAspectIterator()
View Full Code Here


   /**
    * @see nexj.core.meta.Aspect#applyTo(nexj.core.meta.Pointcut, int)
    */
   public void applyTo(Pointcut pointcut, int nPass) throws MetadataException
   {
      Aspect aspect = getAspect();

      if (m_bOverride && nPass == 0)
      {
         int i = pointcut.findAspectOverride(aspect);

         if (i >= 0 && !pointcut.isAspectOverrideInclusive(i))
         {
            pointcut.removeAspectOverride(aspect);
         }
      }

      aspect.applyTo(pointcut, nPass);
   }
View Full Code Here

   /**
    * @see nexj.core.meta.Aspect#removeFrom(nexj.core.meta.Pointcut)
    */
   public boolean removeFrom(Pointcut pointcut)
   {
      Aspect aspect = getAspect();

      if (aspect.removeFrom(pointcut))
      {
         if (m_bOverride)
         {
            int i = pointcut.findAspectOverride(aspect);

View Full Code Here

                     tableFinal.getName(), m_final.getDataSource().getName()}));
            }

            for (int i = 0, n = table.getAspectCount(); i < n; ++i)
            {
               Aspect aspect = m_final.findTable(table.getAspect(i).getName());

               if (aspect != null && !tableFinal.hasAspect(aspect))
               {
                  eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraTableAspect",
                     new Object[]{aspect.getName(), tableFinal.getName(), m_final.getDataSource().getName()}));
               }
            }

            for (int i = 0, n = tableFinal.getAspectCount(); i < n; ++i)
            {
               Aspect aspect = m_schema.findTable(tableFinal.getAspect(i).getName());

               if (aspect != null && !table.hasAspect(aspect))
               {
                  eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingTableAspect",
                     new Object[]{aspect.getName(), tableFinal.getName(), m_final.getDataSource().getName()}));
               }
            }

            for (int i = 0, n = table.getColumnCount(); i < n; ++i)
            {
               Column column = table.getColumn(i);

               if (tableFinal.findColumn(column.getName()) == null)
               {
                  eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraColumn",
                     new Object[]{column.getName(), tableFinal.getName(), m_final.getDataSource().getName()}));
               }
            }

            for (int i = 0, n = tableFinal.getColumnCount(); i < n; ++i)
            {
               Column columnFinal = tableFinal.getColumn(i);
               Column column = table.findColumn(columnFinal.getName());

               if (column == null)
               {
                  eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingColumn",
                     new Object[]{columnFinal.getName(), tableFinal.getName(), m_final.getDataSource().getName()}));
               }
               else
               {
                  if (columnFinal.getType() != column.getType())
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnTypeMismatch",
                        new Object[]{columnFinal.getType().getName(), column.getType().getName(),
                           columnFinal.getName(), tableFinal.getName(), m_final.getDataSource().getName()}));
                  }

                  if (columnFinal.getPrecision() != column.getPrecision())
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnPrecisionMismatch",
                        new Object[]{Primitive.createInteger(columnFinal.getPrecision()),
                           Primitive.createInteger(column.getPrecision()), columnFinal.getName(),
                           tableFinal.getName(), m_final.getDataSource().getName()}));
                  }

                  if (columnFinal.getScale() != column.getScale())
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnScaleMismatch",
                        new Object[]{Primitive.createInteger(columnFinal.getScale()),
                           Primitive.createInteger(column.getScale()), columnFinal.getName(),
                           tableFinal.getName(), m_final.getDataSource().getName()}));
                  }

                  if (columnFinal.getAllocation() != column.getAllocation())
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnAllocationMismatch",
                        new Object[]{columnFinal.getAllocationString(), column.getAllocationString(),
                           columnFinal.getName(), tableFinal.getName(), m_final.getDataSource().getName()}));
                  }

                  if (columnFinal.isNullable() != column.isNullable())
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnNullabilityMismatch",
                        new Object[]{Boolean.valueOf(columnFinal.isNullable()),
                           Boolean.valueOf(column.isNullable()), columnFinal.getName(),
                           tableFinal.getName(), m_final.getDataSource().getName()}));
                  }

                  if (columnFinal.isCaseInsensitive() != column.isCaseInsensitive())
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnCaseInsensitivityMismatch",
                        new Object[]{Boolean.valueOf(columnFinal.isCaseInsensitive()),
                           Boolean.valueOf(column.isCaseInsensitive()), columnFinal.getName(),
                           tableFinal.getName(), m_final.getDataSource().getName()}));
                  }

                  String sConverterFinal = "";
                  String sConverter = "";

                  if (columnFinal.getConverter() != null)
                  {
                     sConverterFinal = columnFinal.getConverter().getName();
                  }

                  if (column.getConverter() != null)
                  {
                     sConverter = column.getConverter().getName();
                  }

                  if (!sConverterFinal.equals(sConverter))
                  {
                     eh = addException(eh, new MetadataException("err.meta.upgrade.sql.columnConverterMismatch",
                        new Object[]{sConverterFinal, sConverter, columnFinal.getName(),
                           tableFinal.getName(), m_final.getDataSource().getName()}));
                  }
               }
            }
         }
      }

      for (Iterator indexItr = m_schema.getIndexIterator(); indexItr.hasNext();)
      {
         Index index = (Index)indexItr.next();

         if (m_final.findIndex(index.getName()) == null)
         {
            eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraIndex",
               new Object[]{index.getName(), index.getTable().getName(), m_final.getDataSource().getName()}));
         }
      }

      for (Iterator indexItrFinal = m_final.getIndexIterator(); indexItrFinal.hasNext();)
      {
         Index indexFinal = (Index)indexItrFinal.next();
         Index index = m_schema.findIndex(indexFinal.getName());

         if (index == null)
         {
            if (indexFinal.getType() >= Index.BTREE)
            {
               eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingIndex",
                  new Object[]{indexFinal.getName(), indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
            }
         }
         else
         {
            if (!indexFinal.getTable().getName().equals(index.getTable().getName()))
            {
               eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexTableMismatch",
                  new Object[]{indexFinal.getTable().getName(), index.getTable().getName(),
                     indexFinal.getName(), m_final.getDataSource().getName()}));
            }

            if (indexFinal.getType() != index.getType())
            {
               eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexTypeMismatch",
                  new Object[]{indexFinal.getTypeString(), index.getTypeString(), indexFinal.getName(),
                     indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
            }

            if (indexFinal.isUnique() != index.isUnique())
            {
               eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexUniquenessMismatch",
                  new Object[]{Boolean.valueOf(indexFinal.isUnique()), Boolean.valueOf(index.isUnique()),
                     indexFinal.getName(), indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
            }

            if (indexFinal.getFill() != index.getFill())
            {
               eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexFillMismatch",
                  new Object[]{Primitive.createInteger(indexFinal.getFill()), Primitive.createInteger(index.getFill()),
                     indexFinal.getName(), indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
            }

            String sRelatedTableFinal = (indexFinal.getRelatedTable() == null) ? "" : indexFinal.getRelatedTable().getName();
            String sRelatedTable = (index.getRelatedTable() == null) ? "" : index.getRelatedTable().getName();

            if (!sRelatedTableFinal.equals(sRelatedTable))
            {
               eh = addException(eh, new MetadataException("err.meta.upgrade.sql.indexRelatedTableMismatch",
                  new Object[]{sRelatedTableFinal, sRelatedTable, indexFinal.getName(),
                     indexFinal.getTable().getName(), m_final.getDataSource().getName()}));
            }

            for (int i = 0, n = index.getAspectCount(); i < n; ++i)
            {
               Aspect aspect = m_final.findIndex(index.getAspect(i).getName());

               if (aspect != null && !indexFinal.hasAspect(aspect))
               {
                  eh = addException(eh, new MetadataException("err.meta.upgrade.sql.extraIndexAspect",
                     new Object[]{aspect.getName(), indexFinal.getName(), indexFinal.getTable().getName(),
                        m_final.getDataSource().getName()}));
               }
            }

            for (int i = 0, n = indexFinal.getAspectCount(); i < n; ++i)
            {
               Aspect aspect = m_schema.findIndex(indexFinal.getAspect(i).getName());

               if (aspect != null && !index.hasAspect(aspect))
               {
                  eh = addException(eh, new MetadataException("err.meta.upgrade.sql.missingIndexAspect",
                     new Object[]{aspect.getName(), indexFinal.getName(), indexFinal.getTable().getName(),
                        m_final.getDataSource().getName()}));
               }
            }

            if (index.getType() != Index.VIRTUAL && index.getType() != Index.QUERY)
View Full Code Here

TOP

Related Classes of nexj.core.meta.Aspect

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.