当前位置: 首页>>代码示例>>Java>>正文


Java ScalarParameterHandle.getDataType方法代码示例

本文整理汇总了Java中org.eclipse.birt.report.model.api.ScalarParameterHandle.getDataType方法的典型用法代码示例。如果您正苦于以下问题:Java ScalarParameterHandle.getDataType方法的具体用法?Java ScalarParameterHandle.getDataType怎么用?Java ScalarParameterHandle.getDataType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.birt.report.model.api.ScalarParameterHandle的用法示例。


在下文中一共展示了ScalarParameterHandle.getDataType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ParameterGroupFilter

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
public ParameterGroupFilter( Object[] keyValues,
		CascadingParameterGroupHandle parameterGroup )
{
	this.keyValues = keyValues;
	valueColumnNames = new String[keyValues.length];
	valueTypes = new String[keyValues.length];
	SlotHandle parameterSlots = parameterGroup.getParameters( );
	for ( int i = 0; i < keyValues.length; i++ )
	{
		ScalarParameterHandle tempParameter = (ScalarParameterHandle) parameterSlots
				.get( i );
		valueColumnNames[i] = ParameterHelper.getValueColumnName( tempParameter );
		valueTypes[i] = tempParameter.getDataType( );
	}

}
 
开发者ID:eclipse,项目名称:birt,代码行数:17,代码来源:GetParameterDefinitionTask.java

示例2: getParameterValue

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
/**
 * parse parameter value by string value
 * 
 * @param handle
 * @param field
 * @param value
 * @return
 * @throws Exception
 */
private Object getParameterValue( ScalarParameterHandle handle,
		ParameterField field, String value ) throws Exception
{
	// get parameter data type
	String dataType = handle.getDataType( );

	// if String type, return String value
	if ( DesignChoiceConstants.PARAM_TYPE_STRING
			.equalsIgnoreCase( dataType ) )
	{
		return value;
	}

	// convert parameter to object
	String pattern = field.getPattern( );
	if ( pattern == null || pattern.length( ) <= 0 )
	{
		pattern = handle.getPattern( );
	}

	return DataUtil.validate( handle.getName( ), handle.getDataType( ),
			pattern, value, this.locale, this.timeZone, field.isLocale( ) );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:33,代码来源:ReportTag.java

示例3: getDummyDefaultValue

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
public static Object getDummyDefaultValue( ScalarParameterHandle parameterHandle )
{
	String type = parameterHandle.getDataType( );

	// No default value; if param allows null value, null is used
	if ( !parameterHandle.isRequired( ) )
		return null;

	// Return a fixed default value appropriate for the data type
	if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( type ) )
		return "";
	if ( DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( type ) )
		return new Double( 0 );
	if ( DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( type ) )
		return new BigDecimal( (double) 0 );
	if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( type ) )
		return new Date( 0 );
	if ( DesignChoiceConstants.PARAM_TYPE_DATE.equals( type ) )
		return new java.sql.Date( 0 );
	if ( DesignChoiceConstants.PARAM_TYPE_TIME.equals( type ) )
		return new java.sql.Time( 0 );
	if ( DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals( type ) )
		return Boolean.FALSE;
	if ( DesignChoiceConstants.PARAM_TYPE_INTEGER.equals( type ) )
		return Integer.valueOf( 0 );
	return null;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:28,代码来源:ReportParameterUtil.java

示例4: formatScalarParameter

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
/**
 * Formats scalar parameter value.
 * 
 * @param handle
 * @param inputStr
 * @return formatted value.
 */

private static String formatScalarParameter( ScalarParameterHandle handle,
		String inputStr ) throws BirtException
{
	String pattern = handle.getPattern( );
	String category = handle.getCategory( );

	if ( pattern == null )
	{
		if ( isCustom( category ) )
		{
			return inputStr;
		}
		pattern = category;
	}

	String dataType = handle.getDataType( );
	if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( dataType ) )
	{
		Date date = DataTypeUtil.toDate( inputStr, ULocale.US );
		DateFormatter formatter = new DateFormatter( pattern );
		inputStr = formatter.format( date );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( dataType ) )
	{
		inputStr = new NumberFormatter( pattern ).format( DataTypeUtil.toDouble( inputStr )
				.doubleValue( ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( dataType ) )
	{
		inputStr = new NumberFormatter( pattern ).format( DataTypeUtil.toBigDecimal( inputStr ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( dataType ) )
	{
		inputStr = new StringFormatter( pattern ).format( inputStr );
	}
	return inputStr;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:46,代码来源:FormatUtil.java

示例5: performInsertParameter

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
public static DataItemHandle performInsertParameter(
		ScalarParameterHandle model ) throws SemanticException
{
	// DataItemHandle dataHandle = SessionHandleAdapter.getInstance( )
	// .getReportDesignHandle( )
	// .getElementFactory( )
	// .newDataItem( null );
	DataItemHandle dataHandle = DesignElementFactory.getInstance( )
			.newDataItem( null );

	ComputedColumn bindingColumn = StructureFactory.newComputedColumn( dataHandle,
			model.getName( ) );
	ExpressionUtility.setBindingColumnExpression( model, bindingColumn );

	// hardcode
	// parameter's type datatime is not equals data's.
	String paramType = model.getDataType( );
	if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( paramType ) )
		paramType = DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME;

	if ( DesignChoiceConstants.SCALAR_PARAM_TYPE_MULTI_VALUE.endsWith( model.getParamType( ) ) )
	{
		bindingColumn.setDataType( DesignChoiceConstants.COLUMN_DATA_TYPE_JAVA_OBJECT );
	}
	else
	{
		bindingColumn.setDataType( paramType );
	}

	dataHandle.addColumnBinding( bindingColumn, false );
	dataHandle.setResultSetColumn( bindingColumn.getName( ) );
	return dataHandle;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:34,代码来源:InsertInLayoutUtil.java

示例6: validateDefaultValues

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
private void validateDefaultValues( ) throws BirtException
{
	ArrayList elementsList = new ArrayList( inputParameterGroup.getParameters( )
			.getContents( ) );
	if ( elementsList == null || elementsList.size( ) == 0 )
	{
		return;
	}

	for ( Iterator iter = elementsList.iterator( ); iter.hasNext( ); )
	{
		ScalarParameterHandle handle = (ScalarParameterHandle) iter.next( );
		String tempDefaultValue = handle.getDefaultValue( );
		String tempType = handle.getDataType( );

		if ( DesignChoiceConstants.PARAM_TYPE_STRING.endsWith( tempType )
				|| DesignChoiceConstants.PARAM_TYPE_BOOLEAN.endsWith( tempType ) )
		{
			continue;
		}

		if ( !( ( DesignChoiceConstants.PARAM_TYPE_STRING.endsWith( tempType ) ) || ( DesignChoiceConstants.PARAM_TYPE_BOOLEAN.endsWith( tempType ) ) ) )
		{
			if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( tempType ) )
			{
				tempDefaultValue = convertToStandardFormat( DataTypeUtil.toDate( tempDefaultValue ) );
			}
			else if ( DesignChoiceConstants.PARAM_TYPE_DATE.equals( tempType ) )
			{
				tempDefaultValue = convertToStandardFormat( DataTypeUtil.toSqlDate( tempDefaultValue ) );
			}
			else if ( DesignChoiceConstants.PARAM_TYPE_TIME.equals( tempType ) )
			{
				tempDefaultValue = convertToStandardFormat( DataTypeUtil.toSqlTime( tempDefaultValue ) );
			}

			ParameterValidationUtil.validate( tempType,
					STANDARD_DATE_TIME_PATTERN,
					tempDefaultValue,
					ULocale.getDefault( ) );

		}

	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:46,代码来源:CascadingParametersDialog.java

示例7: matchDataType

import org.eclipse.birt.report.model.api.ScalarParameterHandle; //导入方法依赖的package包/类
private boolean matchDataType( ScalarParameterHandle handle,
		ResultSetColumnHandle columnHandle )
{
	String type = handle.getDataType( );
	if ( handle == selectedParameter && dataTypeChooser.isEnabled( ) )
	{
		type = getSelectedDataType( );
	}
	if ( DesignChoiceConstants.PARAM_TYPE_STRING.equals( type )
			|| DesignChoiceConstants.COLUMN_DATA_TYPE_ANY.equals( columnHandle.getDataType( ) ) )
	{
		return true;
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals( type ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN.equals( columnHandle.getDataType( ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_DATETIME.equals( type ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME.equals( columnHandle.getDataType( ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals( type ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL.equals( columnHandle.getDataType( ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_FLOAT.equals( type ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT.equals( columnHandle.getDataType( ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_INTEGER.equals( type ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER.equals( columnHandle.getDataType( ) );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_DATE.equals( columnHandle.getDataType( ) ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_DATE.equals( type );
	}
	else if ( DesignChoiceConstants.PARAM_TYPE_TIME.equals( columnHandle.getDataType( ) ) )
	{
		return DesignChoiceConstants.COLUMN_DATA_TYPE_TIME.equals( type );
	}
	return false;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:44,代码来源:CascadingParametersDialog.java


注:本文中的org.eclipse.birt.report.model.api.ScalarParameterHandle.getDataType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。