Fix for CR's6671769,6672397,6691131
authorrnithya@netbeans.org
Mon, 21 Apr 2008 22:15:44 +0530
changeset 41989a9939b37002
parent 4197 47062e16120d
child 4199 332d07673183
child 4200 e21125ede473
Fix for CR's6671769,6672397,6691131
etl.editor/src/org/netbeans/modules/sql/framework/common/utils/DBExplorerUtil.java
etl.editor/src/org/netbeans/modules/sql/framework/model/visitors/SQLDBSynchronizationValidationVisitor.java
etl.editor/src/org/netbeans/modules/sql/framework/model/visitors/SQLDBSynchronizationVisitor.java
etl.project/src/org/netbeans/modules/etl/project/EtlproActionProvider.java
     1.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/common/utils/DBExplorerUtil.java	Mon Apr 21 19:34:25 2008 +0530
     1.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/common/utils/DBExplorerUtil.java	Mon Apr 21 22:15:44 2008 +0530
     1.3 @@ -62,6 +62,9 @@
     1.4  import com.sun.sql.framework.utils.StringUtil;
     1.5  import java.util.ArrayList;
     1.6  import java.util.List;
     1.7 +import org.axiondb.AxionException;
     1.8 +import org.axiondb.Database;
     1.9 +import org.axiondb.engine.Databases;
    1.10  import org.netbeans.modules.etl.logger.Localizer;
    1.11  import org.netbeans.modules.etl.ui.ETLEditorSupport;
    1.12  import org.openide.util.Exceptions;
    1.13 @@ -432,4 +435,11 @@
    1.14          }
    1.15          return connName;
    1.16      }
    1.17 +    public static Database getAxionDBFromURL(String url) throws AxionException {
    1.18 +        int initialDBIndex = url.indexOf("axiondb") + 8;
    1.19 +        int endDBIndex = url.indexOf(":", initialDBIndex);
    1.20 +        String dbName = url.substring(initialDBIndex, endDBIndex);
    1.21 +        String dbLoc = url.substring(endDBIndex + 1);
    1.22 +        return (Databases.getOrCreateDatabase(dbName, new File(dbLoc)));
    1.23 +    }
    1.24  }
     2.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/model/visitors/SQLDBSynchronizationValidationVisitor.java	Mon Apr 21 19:34:25 2008 +0530
     2.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/model/visitors/SQLDBSynchronizationValidationVisitor.java	Mon Apr 21 22:15:44 2008 +0530
     2.3 @@ -227,12 +227,22 @@
     2.4  
     2.5              //Check for update and delete
     2.6              for (Iterator itr = collabColumns.iterator(); itr.hasNext();) {
     2.7 -                checkForUpdates((SQLDBColumn) itr.next(), newColumns, collabTable);
     2.8 +                SQLDBColumn oldCol = (SQLDBColumn) itr.next();
     2.9 +                int sqlTypeCode = oldCol.getJdbcType();
    2.10 +                if ((sqlTypeCode == java.sql.Types.DATE || sqlTypeCode == java.sql.Types.TIME || sqlTypeCode == java.sql.Types.TIMESTAMP || sqlTypeCode == java.sql.Types.NUMERIC) && meta.getDBType().equals(DBMetaDataFactory.AXION)) {
    2.11 +                    continue;
    2.12 +                }
    2.13 +                checkForUpdates(oldCol, newColumns, collabTable);
    2.14              }
    2.15  
    2.16              // check for new columns
    2.17              for (Iterator itr = newColumns.iterator(); itr.hasNext();) {
    2.18 -                checkForNewColumns((SQLDBColumn) itr.next(), collabColumns, collabTable);
    2.19 +                SQLDBColumn newCol = (SQLDBColumn) itr.next();
    2.20 +                int sqlTypeCode = newCol.getJdbcType();
    2.21 +                if ((sqlTypeCode == java.sql.Types.DATE || sqlTypeCode == java.sql.Types.TIME || sqlTypeCode == java.sql.Types.TIMESTAMP || sqlTypeCode == java.sql.Types.NUMERIC) && meta.getDBType().equals(DBMetaDataFactory.AXION)) {
    2.22 +                    continue;
    2.23 +                }
    2.24 +                checkForNewColumns(newCol, collabColumns, collabTable);
    2.25              }
    2.26  
    2.27          // TODO: XXXXX We also need to check PK, FK, Index modifications XXXXX
     3.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/model/visitors/SQLDBSynchronizationVisitor.java	Mon Apr 21 19:34:25 2008 +0530
     3.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/model/visitors/SQLDBSynchronizationVisitor.java	Mon Apr 21 22:15:44 2008 +0530
     3.3 @@ -227,7 +227,12 @@
     3.4                  List newColumns = newTable.getColumnList();
     3.5  
     3.6                  for (Iterator itr = collabColumns.iterator(); itr.hasNext();) {
     3.7 -                    mergeUpdates((SQLDBColumn) itr.next(), newColumns, collabTable, tableModel);
     3.8 +                    SQLDBColumn oldCol = (SQLDBColumn) itr.next();
     3.9 +                    int sqlTypeCode = oldCol.getJdbcType();
    3.10 +                    if ((sqlTypeCode == java.sql.Types.DATE || sqlTypeCode == java.sql.Types.TIME || sqlTypeCode == java.sql.Types.TIMESTAMP || sqlTypeCode == java.sql.Types.NUMERIC) && connDef.getDBType().equals(DBMetaDataFactory.AXION)) {
    3.11 +                        continue;
    3.12 +                    }
    3.13 +                    mergeUpdates(oldCol, newColumns, collabTable, tableModel);
    3.14                  }
    3.15                  for (Iterator itr = newColumns.iterator(); itr.hasNext();) {
    3.16                      mergeNewColumns((SQLDBColumn) itr.next(), collabColumns, collabTable, tableModel);
     4.1 --- a/etl.project/src/org/netbeans/modules/etl/project/EtlproActionProvider.java	Mon Apr 21 19:34:25 2008 +0530
     4.2 +++ b/etl.project/src/org/netbeans/modules/etl/project/EtlproActionProvider.java	Mon Apr 21 22:15:44 2008 +0530
     4.3 @@ -21,12 +21,17 @@
     4.4  import java.awt.Dialog;
     4.5  import java.io.IOException;
     4.6  import java.util.HashMap;
     4.7 +import java.util.Iterator;
     4.8 +import java.util.List;
     4.9  import java.util.Map;
    4.10  import java.util.Properties;
    4.11  import org.apache.tools.ant.module.api.support.ActionUtils;
    4.12 +import org.axiondb.AxionException;
    4.13 +import org.netbeans.api.db.explorer.DatabaseConnection;
    4.14  import org.netbeans.spi.project.ActionProvider;
    4.15  import org.netbeans.spi.project.support.ant.AntProjectHelper;
    4.16  import org.openide.filesystems.FileObject;
    4.17 +import org.openide.util.Exceptions;
    4.18  import org.openide.util.NbBundle;
    4.19  import org.openide.util.Lookup;
    4.20  import org.netbeans.modules.compapp.projects.base.ui.customizer.IcanproProjectProperties;
    4.21 @@ -35,6 +40,7 @@
    4.22  
    4.23  import org.netbeans.modules.compapp.projects.base.ui.NoSelectedServerWarning;
    4.24  import org.netbeans.modules.compapp.projects.base.IcanproConstants;
    4.25 +import org.netbeans.modules.sql.framework.common.utils.DBExplorerUtil;
    4.26  import org.netbeans.spi.project.ui.support.DefaultProjectOperations;
    4.27  
    4.28  /** Action provider of the Web project. This is the place where to do
    4.29 @@ -106,10 +112,30 @@
    4.30          }
    4.31  
    4.32          if (COMMAND_RENAME.equals(command)) {
    4.33 +            List<DatabaseConnection> conn = DBExplorerUtil.getDatabasesForCurrentProject();
    4.34 +            Iterator<DatabaseConnection> it = conn.iterator();
    4.35 +            while (it.hasNext()) {
    4.36 +                try {
    4.37 +                    DatabaseConnection dconn = it.next();
    4.38 +                    DBExplorerUtil.getAxionDBFromURL(dconn.getDatabaseURL()).shutdown();
    4.39 +                } catch (AxionException ex) {
    4.40 +                    Exceptions.printStackTrace(ex);
    4.41 +                }
    4.42 +            }
    4.43              DefaultProjectOperations.performDefaultRenameOperation(project, null);
    4.44              return;
    4.45          }
    4.46          if (COMMAND_DELETE.equals(command)) {
    4.47 +            List<DatabaseConnection> conn = DBExplorerUtil.getDatabasesForCurrentProject();
    4.48 +            Iterator<DatabaseConnection> it = conn.iterator();
    4.49 +            while (it.hasNext()) {
    4.50 +                try {
    4.51 +                    DatabaseConnection dconn = it.next();
    4.52 +                    DBExplorerUtil.getAxionDBFromURL(dconn.getDatabaseURL()).shutdown();
    4.53 +                } catch (AxionException ex) {
    4.54 +                    Exceptions.printStackTrace(ex);
    4.55 +                }
    4.56 +            }
    4.57              DefaultProjectOperations.performDefaultDeleteOperation(project);
    4.58              return;
    4.59          }