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

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


               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);
            }
            else if (sElement.equals("RemoveIndexAspect"))
            {
               final RemoveIndexAspectStep remove = new RemoveIndexAspectStep();

               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("CreateObject"))
            {
               CreateObjectStep create = new CreateObjectStep();
               SQLScript script = new SQLScript();

               create.setName(
                  XMLMetadataHelper.getNameAttr(stepElement, "name", XMLMetadataHelper.NAME_DOT));
               loadSQLScript(stepElement, script);
               create.setScript(script);
               upgrade.addStep(create);
            }
            else if (sElement.equals("DropObject"))
            {
               DropObjectStep drop = new DropObjectStep();
View Full Code Here


      assertNotNull(table);
      assertEquals(0, table.getIndexCount());
      table.setType(Table.MANAGED); // comes in as Table.EXTERNAL from DB

      CreateIndexStep step = new CreateIndexStep();
      IndexOutline outline = new IndexOutline();

      outline.setName("idx01");
      outline.addColumn("id", true);
      step.setTableName(table.getName());
      step.setOutline(outline);
      schema = upgrade(step, schema, null);
      table = schema.getTable(m_singleColTableStep.getName());
      assertNotNull(table);
      assertEquals(1, table.getIndexCount());
View Full Code Here

TOP

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

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.