String defaultValueExpr = modelParam.getDefaultValue( );
String defaultValueExpr = null; if ( modelParam instanceof OdaDataSetParameterHandle && ( (OdaDataSetParameterHandle) modelParam ).getParamName( ) != null ) { defaultValueExpr = PARAMS_PREFIX + "[\"" + ( (OdaDataSetParameterHandle) modelParam ).getParamName( ) + "\"]"; } else defaultValueExpr = modelParam.getDefaultValue( );
	public static void adaptBaseDataSet( DataSetHandle modelDataSet,			BaseDataSetDesign dteDataSet ) throws BirtException	{		if ( ( !( modelDataSet instanceof JointDataSetHandle ) )				&& modelDataSet.getDataSource( ) == null )		{			throw new AdapterException( ResourceConstants.DATASOURCE_NULL_ERROR );		}				if ( !( modelDataSet instanceof JointDataSetHandle ) )		{			dteDataSet.setDataSource( modelDataSet.getDataSource( )					.getQualifiedName( ) );			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( new ParameterAdapter( 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( new InputParamBindingAdapter(							( String ) paramName, expression ) );				}			}			// cache row count			dteDataSet.setCacheRowCount( modelDataSet.getCachedRowCount( ) );		}			// computed columns		Iterator elmtIter = modelDataSet.computedColumnsIterator( );		if ( elmtIter != null )		{			while ( elmtIter.hasNext( ) )			{				ComputedColumnHandle modelCmptdColumn = ( ComputedColumnHandle ) elmtIter						.next( );				dteDataSet.addComputedColumn( new ComputedColumnAdapter( modelCmptdColumn ));			}		}		// filter conditions		elmtIter = modelDataSet.filtersIterator( );		if ( elmtIter != null )		{			while ( elmtIter.hasNext( ) )			{				FilterConditionHandle modelFilter = ( FilterConditionHandle ) elmtIter						.next( );				dteDataSet.addFilter( new FilterAdapter( modelFilter ) );			}		}		// 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.resultSetHintsIterator( );		if ( elmtIter != null )		{			while ( elmtIter.hasNext( ) )			{				ResultSetColumnHandle modelColumn = ( ResultSetColumnHandle ) elmtIter						.next( );				dteDataSet.addResultSetHint( new ColumnAdapter( 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( new ColumnAdapter( modelColumnHint ) );			}		}	}