Merged changes from 513 to OpenESB fixes_root uml_release60_visualcomponent
authorrnithya@netbeans.org
Sat, 03 Nov 2007 08:22:12 +0000
changeset 14176cb8f5111fb9
parent 1416 e9b1e3c64e0d
child 1418 18f1c0ea01ad
Merged changes from 513 to OpenESB
etl.editor/src/org/netbeans/modules/etl/codegen/impl/StagingStrategyBuilder.java
etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferPanel.java
     1.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/StagingStrategyBuilder.java	Fri Nov 02 23:11:30 2007 +0000
     1.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/StagingStrategyBuilder.java	Sat Nov 03 08:22:12 2007 +0000
     1.3 @@ -63,6 +63,7 @@
     1.4  import com.sun.sql.framework.jdbc.SQLPart;
     1.5  import com.sun.sql.framework.utils.AttributeMap;
     1.6  import com.sun.sql.framework.utils.Logger;
     1.7 +import com.sun.sql.framework.utils.StringUtil;
     1.8  
     1.9  /**
    1.10   * @author Girish Patil
    1.11 @@ -77,6 +78,21 @@
    1.12          super(model);
    1.13      }
    1.14  
    1.15 +    private String getTargetTableUserDefinedSchema(TargetTable tt)
    1.16 +    {
    1.17 +    	String schemaName = null;
    1.18 +    	// If User has defined Schema name use it.
    1.19 +        String uSchema = tt.getUserDefinedSchemaName();
    1.20 +        if (StringUtil.isNullString(uSchema)){
    1.21 +            if (!StringUtil.isNullString(tt.getSchema())){
    1.22 +                schemaName = tt.getSchema().toUpperCase();
    1.23 +            }
    1.24 +        }else{
    1.25 +            schemaName = uSchema.toUpperCase();
    1.26 +        }
    1.27 +        
    1.28 +        return schemaName;
    1.29 +    }
    1.30      /**
    1.31       * Before calling apply appropriate applyConnections
    1.32       */
    1.33 @@ -135,6 +151,7 @@
    1.34          ETLTaskNode xformPredecessor = null;
    1.35          List sourceTables = context.getTargetTable().getSourceTableList();
    1.36          String dropSQLStr = "";
    1.37 +        String truncateSql = "";
    1.38  
    1.39          // Loop Thru the source tables to generate
    1.40          if (sourceTables == null || sourceTables.isEmpty()) {
    1.41 @@ -162,7 +179,7 @@
    1.42                  // same DB as the target table.
    1.43                  if (isExtractionRequired(sourceTable, targetTable)) {
    1.44                      ETLTaskNode extractorTask = createExtractorNode(sourceTable, targetDB, waitTaskId, waitTaskId, getTargetConnName(),
    1.45 -                        targetTable.getSchema().toUpperCase());
    1.46 +                    		getTargetTableUserDefinedSchema(targetTable));
    1.47  
    1.48                      // Add staging table to the drop list only if user specifies
    1.49                      // that it is deleteable - otherwise preserve the contents of the
    1.50 @@ -177,6 +194,18 @@
    1.51                          }
    1.52                          dropSQLStr += dropSQLPartTemp.getSQL();
    1.53                      }
    1.54 +                    if(sourceTable.isTruncateStagingTable()) {
    1.55 +                       // User has specified the "Staging Table Name" property. Use it and truncate the data.
    1.56 +                        StatementContext trcontext = new StatementContext();
    1.57 +                        trcontext.setUsingTempTableName(sourceTable, true);
    1.58 +                        trcontext.putClientProperty(StatementContext.IF_EXISTS, Boolean.TRUE);
    1.59 +                        SQLPart doTruncate = getTargetStatements().getTruncateStatement(sourceTable, trcontext);
    1.60 +                        if(truncateSql.length() > 0 ) {
    1.61 +                            truncateSql += SQLPart.STATEMENT_SEPARATOR;
    1.62 +                        }
    1.63 +                        truncateSql += doTruncate.getSQL().trim();
    1.64 +                        
    1.65 +                     }
    1.66  
    1.67                      context.getPredecessorTask().addNextETLTaskNode(ETLTask.SUCCESS, extractorTask.getId());
    1.68                      if (dependentTasks.length() > 0) {
    1.69 @@ -204,6 +233,11 @@
    1.70              SQLPart etlSQLPart = dropSQLPart;
    1.71              context.getNextTaskOnException().addStatement(etlSQLPart);
    1.72          }
    1.73 +        
    1.74 +        if(truncateSql != null && truncateSql.trim().length() != 0 ) {
    1.75 +            SQLPart truncateSQLPart = new SQLPart(truncateSql, SQLPart.STMT_TRUNCATEBEFOREPROCESS, getTargetConnName()); // NOI18N
    1.76 +            context.getNextTaskOnException().addStatement(truncateSQLPart);
    1.77 +        }
    1.78  
    1.79          // Set dependent list for predecessor to transform nodes
    1.80          xformPredecessor.addNextETLTaskNode(ETLTask.SUCCESS, transformerTask.getId());
     2.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferPanel.java	Fri Nov 02 23:11:30 2007 +0000
     2.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferPanel.java	Sat Nov 03 08:22:12 2007 +0000
     2.3 @@ -1386,8 +1386,24 @@
     2.4       * Called whenever the value of the selection changes.
     2.5       *
     2.6       * @param e the event that characterizes the change.
     2.7 +	 * To be included in the TODO list-to be implemented
     2.8       */
     2.9      public void valueChanged(ListSelectionEvent e) {
    2.10 +     //   Object src = e.getSource();
    2.11 +
    2.12 +        // Enforce mutually exclusive focus between source and destination
    2.13 +        // lists.
    2.14 +//        if (sourceList.equals(src)) {
    2.15 +       //     if (!destList.isSelectionEmpty()) {
    2.16 +       //         destList.clearSelection();
    2.17 +       //     }
    2.18 +       // } else if (destList.equals(src)) {
    2.19 +         //   if (!sourceList.isSelectionEmpty()) {
    2.20 +         //       sourceList.clearSelection();
    2.21 +         //   }
    2.22 +       // } else {
    2.23 +            // TODO Log unhandled ListSelectionEvent as DEBUG message.
    2.24 +        // }
    2.25      }
    2.26      
    2.27      /**