dteDataSet.setDataSource( modelDataSet.getDataSourceName() );
dteDataSet.setDataSource( modelDataSet.getDataSource().getQualifiedName() );
    void adaptBaseDataSet( DataSetHandle modelDataSet,            				BaseDataSetDesign dteDataSet ) throws EngineException    {        dteDataSet.setDataSource( modelDataSet.getDataSourceName() );        dteDataSet.setBeforeOpenScript( modelDataSet.getBeforeOpen() );        dteDataSet.setAfterOpenScript( modelDataSet.getAfterOpen() );        dteDataSet.setOnFetchScript( modelDataSet.getOnFetch() );        dteDataSet.setBeforeCloseScript( modelDataSet.getBeforeClose() );        dteDataSet.setAfterCloseScript( modelDataSet.getAfterClose() );        // dataset parameters definition        HashMap paramBindingCandidates = new HashMap();                Iterator elmtIter = modelDataSet.parametersIterator();        if ( elmtIter != null )        {            while ( elmtIter.hasNext() )            {            	DataSetParameterHandle modelParam = (DataSetParameterHandle ) elmtIter.next();				dteDataSet.addParameter( newParam( modelParam ) );				// collect input parameter default values as				// potential parameter binding if no explicit ones are				// defined for a parameter				if ( modelParam.isInput( ) )				{				    String defaultValueExpr = modelParam.getDefaultValue( );				    if ( defaultValueExpr != null )				        paramBindingCandidates.put( modelParam.getName(), defaultValueExpr );				}            }        }        // input parameter bindings        elmtIter = modelDataSet.paramBindingsIterator();        if ( elmtIter != null )        {            while ( elmtIter.hasNext() )            {                ParamBindingHandle modelParamBinding = (ParamBindingHandle) elmtIter.next();                // replace default value of the same parameter, if defined		        paramBindingCandidates.put( modelParamBinding.getParamName(), modelParamBinding.getExpression() );            }        }                // assign merged parameter bindings to the data set        if ( paramBindingCandidates.size() > 0 )        {            elmtIter = paramBindingCandidates.keySet().iterator();            while ( elmtIter.hasNext() )            {                Object paramName = elmtIter.next();                assert( paramName != null && paramName instanceof String );                String expression = (String) paramBindingCandidates.get( paramName );				dteDataSet.addInputParamBinding( 				        newInputParamBinding( (String) paramName, expression ) );            }        }                // computed columns        elmtIter = modelDataSet.computedColumnsIterator();        if ( elmtIter != null )        {            while ( elmtIter.hasNext() )            {                ComputedColumnHandle modelCmptdColumn =                     (ComputedColumnHandle) elmtIter.next();                IComputedColumn dteCmptdColumn = newComputedColumn( modelCmptdColumn );                dteDataSet.addComputedColumn( dteCmptdColumn );            }        }        // filter conditions        elmtIter = modelDataSet.filtersIterator();        if ( elmtIter != null )        {            while ( elmtIter.hasNext() )            {                FilterConditionHandle modelFilter = (FilterConditionHandle) elmtIter.next();                IFilterDefinition dteFilter = newFilter( modelFilter );                dteDataSet.addFilter( dteFilter );            }        }        // merge ResultSetHints and ColumnHints, the order is important.        // ResultSetHints will give each column a unique name, and         // column hints should base on the result of ResultSet hint.        // So in ResultSetHint list, the order of items should be         // ResultSetColumn and then ColumnHint.                // now merge model's result set column info into existing columnDefn         // with same column name, otherwise create new columnDefn        // based on the model's result set column                elmtIter = modelDataSet.resultSetIterator();        if ( elmtIter != null )        {            while ( elmtIter.hasNext() )            {                ResultSetColumnHandle modelColumn = (ResultSetColumnHandle) elmtIter.next();                dteDataSet.addResultSetHint( newColumnDefn( modelColumn ) );            }        }                // merging result set column and column hints into DtE columnDefn;        // first create new columnDefn based on model's column hints        elmtIter = modelDataSet.columnHintsIterator();        if ( elmtIter != null )        {        	List columnDefns = dteDataSet.getResultSetHints();            while ( elmtIter.hasNext() )            {                ColumnHintHandle modelColumnHint = (ColumnHintHandle) elmtIter.next();                ColumnDefinition existDefn = findColumnDefn( columnDefns, modelColumnHint.getColumnName() );                if ( existDefn != null )                    updateColumnDefn( existDefn, modelColumnHint );                else                    dteDataSet.addResultSetHint( newColumnDefn( modelColumnHint ) );            }        }    }