Package nexj.core.meta.persistence.sql.upgrade

Examples of nexj.core.meta.persistence.sql.upgrade.ApplyTableAspectStep


               upgrade.addStep(drop);
            }
            else if (sElement.equals("ApplyTableAspect"))
            {
               final ApplyTableAspectStep apply = new ApplyTableAspectStep();

               apply.setAspectName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_DOT));
               apply.setOverride(XMLUtil.getBooleanAttr(stepElement, "override", apply.isOverride()));

               XMLMetadataLoader.parsePatterns(XMLUtil.getStringAttr(stepElement, "pointcuts"),
                  new XMLMetadataLoader.PatternHandler()
                  {
                     public void handlePattern(String sPattern, boolean bInclusive)
                     {
                        apply.addPointcutPattern(sPattern, bInclusive);
                     }
                  });

               loadSQLScripts(stepElement, apply.getScriptHolder());

               upgrade.addStep(apply);
            }
            else if (sElement.equals("RemoveTableAspect"))
            {
               final RemoveTableAspectStep remove = new RemoveTableAspectStep();

               remove.setAspectName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_DOT));
               remove.setOverride(XMLUtil.getBooleanAttr(stepElement, "override", remove.isOverride()));

               XMLMetadataLoader.parsePatterns(XMLUtil.getStringAttr(stepElement, "pointcuts"),
                  new XMLMetadataLoader.PatternHandler()
                  {
                     public void handlePattern(String sPattern, boolean bInclusive)
                     {
                        remove.addPointcutPattern(sPattern, bInclusive);
                     }
                  });

               upgrade.addStep(remove);
            }
            else if (sElement.equals("CreateColumn"))
            {
               CreateColumnStep create = new CreateColumnStep();

               create.setTableName(XMLMetadataHelper.getNameAttr(stepElement, "table", XMLMetadataHelper.NAME_DOT));

               ColumnOutline outline = new ColumnOutline();

               loadColumnOutline(stepElement, outline, true);
               create.setOutline(outline);

               loadSQLScripts(stepElement, create.getScriptHolder());

               upgrade.addStep(create);
            }
            else if (sElement.equals("AlterColumn"))
            {
               AlterColumnStep alter = new AlterColumnStep();

               alter.setTableName(XMLMetadataHelper.getNameAttr(stepElement, "table", XMLMetadataHelper.NAME_DOT));

               ColumnOutline outline = new ColumnOutline();

               loadColumnOutline(stepElement, outline, false);
               alter.setOutline(outline);

               upgrade.addStep(alter);
            }
            else if (sElement.equals("RenameColumn"))
            {
               RenameColumnStep ren = new RenameColumnStep();

               ren.setTableName(XMLMetadataHelper.getNameAttr(stepElement, "table", XMLMetadataHelper.NAME_DOT));
               ren.setOldName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_ID));
               ren.setNewName(XMLMetadataHelper.getNameAttr(stepElement, "to", XMLMetadataHelper.NAME_ID));

               upgrade.addStep(ren);
            }
            else if (sElement.equals("DropColumn"))
            {
               DropColumnStep drop = new DropColumnStep();

               drop.setTableName(XMLMetadataHelper.getNameAttr(stepElement, "table", XMLMetadataHelper.NAME_DOT));
               drop.setName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_ID));

               upgrade.addStep(drop);
            }
            else if (sElement.equals("CreateIndex"))
            {
               CreateIndexStep create = new CreateIndexStep();

               create.setTableName(XMLMetadataHelper.getNameAttr(stepElement, "table", XMLMetadataHelper.NAME_DOT));

               IndexOutline outline = new IndexOutline();

               loadIndexOutline(stepElement, outline);

               create.setOutline(outline);

               upgrade.addStep(create);
            }
            else if (sElement.equals("RenameIndex"))
            {
               RenameIndexStep ren = new RenameIndexStep();

               ren.setOldName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_DOT));
               ren.setNewName(XMLMetadataHelper.getNameAttr(stepElement, "to", XMLMetadataHelper.NAME_DOT));

               upgrade.addStep(ren);
            }
            else if (sElement.equals("DropIndex"))
            {
               DropIndexStep drop = new DropIndexStep();

               drop.setName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_DOT));

               upgrade.addStep(drop);
            }
            else if (sElement.equals("ApplyIndexAspect"))
            {
               final ApplyIndexAspectStep apply = new ApplyIndexAspectStep();

               apply.setAspectName(XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_DOT));
               apply.setOverride(XMLUtil.getBooleanAttr(stepElement, "override", apply.isOverride()));

               XMLMetadataLoader.parsePatterns(XMLUtil.getStringAttr(stepElement, "pointcuts"),
                  new XMLMetadataLoader.PatternHandler()
                  {
                     public void handlePattern(String sPattern, boolean bInclusive)
                     {
                        apply.addPointcutPattern(sPattern, bInclusive);
                     }
                  });

               upgrade.addStep(apply);
            }
View Full Code Here


      aspect.setName(m_manager.getFullTableName(null, "aspect"));
      aspect.setType(Table.ASPECT);
      column.setType(Primitive.STRING);
      aspect.addColumn(column);

      ApplyTableAspectStep step = new ApplyTableAspectStep();

      step.setAspectName(aspect.getName());
      step.addPointcutPattern(table.getName(), true);
      schema.addTable(aspect);
      schema = upgrade(step, schema, null);
      table = schema.getTable(m_singleColTableStep.getName());
      assertNotNull(table);
      assertEquals(2, table.getColumnCount());
View Full Code Here

TOP

Related Classes of nexj.core.meta.persistence.sql.upgrade.ApplyTableAspectStep

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.