if ( type.equalsIgnoreCase( DataType.STRING.getName() ) && theOperator == Operator.EQUAL ) { theOperator = Operator.EXACTLY_MATCHES; if ( !enforceParameters && type.equalsIgnoreCase( DataType.STRING.getName() ) ) { for ( int idx = 0; idx < val.length; idx++ ) { val[idx] = "\"" + val[idx] + "\""; //$NON-NLS-1$ //$NON-NLS-2$ "[" + parentId + "." + elementId + ( StringUtils.isEmpty( selectedAggregation ) ? "" : "." + selectedAggregation ) + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$; if ( type.equals( DataType.DATE.getName() ) ) { if ( enforceParameters ) {
return false; } else if ( !dataType.equals( other.dataType ) ) { return false;
private String getColumnMappingsXml( final List<ColumnMapping> columnMappings ) { final StringBuffer xml = new StringBuffer(); if ( columnMappings != null && !columnMappings.isEmpty() ) { xml.append( " <column-mappings>" ); for ( ColumnMapping columnMapping : columnMappings ) { xml.append( " <column-mapping>" ); xml.append( " " ).append( XMLHandler.addTagValue( "name", columnMapping.getName() ) ); xml.append( " " ).append( XMLHandler.addTagValue( "columnName", columnMapping.getColumnName() ) ); DataType dataType = columnMapping.getColumnDataType(); if ( dataType != null ) { xml.append( " " ) .append( XMLHandler.addTagValue( "dataType", columnMapping.getColumnDataType().name() ) ); } xml.append( " </column-mapping>" ); } xml.append( " </column-mappings>" ); } return xml.toString(); } }
/** * * @param datatype {@link String} representation of {@link DataType} * @param mask * @param data * @return {@link String} - data which was formatted by mask */ public static String getFormatedString( String datatype, String mask, Object data ) { return getFormatedString( DataType.valueOf( datatype ), mask, data ); }
@Bindable public static List<DataType> getAvailableDataTypes() { if ( availableDataTypes == null || availableDataTypes.size() == 0 ) { ArrayList<DataType> types = new ArrayList<DataType>(); DataType[] dt = DataType.values(); for ( DataType dataType : dt ) { // don't support url, binary, unknown, or image in csv switch ( dataType ) { case URL: case BINARY: case IMAGE: case UNKNOWN: break; default: // types.add(dataType.getDescription()); types.add( dataType ); break; } } availableDataTypes = types; } return availableDataTypes; }
} else if ( property instanceof DataType ) { DataType dt = (DataType) property; DataTypeSettings datatypeSettings = DataTypeSettings.types[dt.ordinal()]; ConceptPropertyDataType cpdt = new ConceptPropertyDataType( propertyName, datatypeSettings ); return cpdt;
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( ( aggregateType == null ) ? 0 : aggregateType.hashCode() ); result = prime * result + ( ( dataType == null ) ? 0 : dataType.hashCode() ); result = prime * result + ( ( fieldType == null ) ? 0 : fieldType.hashCode() ); result = prime * result + ( ( format == null ) ? 0 : format.hashCode() ); result = prime * result + ( ( id == null ) ? 0 : id.hashCode() ); result = prime * result + ( ignore ? 1231 : 1237 ); result = prime * result + ( index ? 1231 : 1237 ); result = prime * result + length; result = prime * result + precision; result = prime * result + Arrays.hashCode( samples ); result = prime * result + ( ( title == null ) ? 0 : title.hashCode() ); return result; }
protected void addParameterFromXmlNode( Query query, Element paramElement ) { String name = paramElement.getAttribute( "name" ); //$NON-NLS-1$ String type = paramElement.getAttribute( "type" ); //$NON-NLS-1$ String defaultValue = paramElement.getAttribute( "defaultValue" ); //$NON-NLS-1$ Object defaultVal = null; if ( name != null && type != null && StringUtils.isNotEmpty( defaultValue ) ) { DataType dataType = DataType.valueOf( type.toUpperCase() ); defaultVal = parseDefaultValue( defaultValue, dataType ); } Parameter param = new Parameter( name, DataType.valueOf( type.toUpperCase() ), defaultVal ); query.getParameters().add( param ); }
return null; return DataType.values()[settings.getType()]; } else if ( property instanceof ConceptPropertyAggregationList ) { List<AggregationSettings> orig = (List<AggregationSettings>) property.getValue();
type = "FieldType"; //$NON-NLS-1$ } else if ( val instanceof DataType ) { body = DataTypeSettings.types[( (DataType) val ).ordinal()].getCode(); type = "DataType"; //$NON-NLS-1$ } else if ( val instanceof AggregationType ) {
info.put( "colName", resultSet.getMetaData().getColumnHeaders()[ 0 ][ i ] ); //$NON-NLS-1$ DataType type = (DataType) resultSet.getMetaData().getAttribute( 0, i, IPhysicalColumn.DATATYPE_PROPERTY ); info.put( "colType", type.getName().toUpperCase() ); //$NON-NLS-1$ LocalizedString name = (LocalizedString) resultSet.getMetaData().getAttribute( 0, i, Concept.NAME_PROPERTY ); if ( name != null && locale != null ) {
public void readColumnMappings( final Node dataProviderNode, DataProvider dataProvider ) { if ( dataProviderNode == null || dataProvider == null ) { return; } List<ColumnMapping> columnMappings = new ArrayList<ColumnMapping>(); Node columnMappingNodes = XMLHandler.getSubNode( dataProviderNode, "column-mappings" ); int columnMappingCount = XMLHandler.countNodes( columnMappingNodes, "column-mapping" ); for ( int i = 0; i < columnMappingCount; i++ ) { try { Node columnMappingNode = XMLHandler.getSubNodeByNr( columnMappingNodes, "column-mapping", i ); ColumnMapping columnMapping = new ColumnMapping(); columnMapping.setName( XMLHandler.getTagValue( columnMappingNode, "name" ) ); columnMapping.setColumnName( XMLHandler.getTagValue( columnMappingNode, "columnName" ) ); String dataType = XMLHandler.getTagValue( columnMappingNode, "dataType" ); if ( StringUtils.isNotBlank( dataType ) ) { columnMapping .setColumnDataType( DataType.valueOf( dataType ) ); } columnMappings.add( columnMapping ); } catch ( Exception ke ) { //logError( ke.getMessage() ); } } dataProvider.setColumnMappings( columnMappings ); }
String formula = condition.getCondition( logicalColumn.getDataType().name(), paramName ); Constraint constraint = new Constraint( combinationType, formula ); constraints.add( constraint );
olapCol.setAggregationType( col.getPhysicalColumn().getAggregationType() ); } else { if ( olapCol.getDataType().equals( DataType.NUMERIC ) ) { olapCol.setAggregationType( AggregationType.SUM ); } else { } else if ( olapCol.getDataType().equals( DataType.NUMERIC ) ) { olapCol.setProperty( "mask", "#" );
if ( type.equalsIgnoreCase( DataType.STRING.getName() ) && theOperator == Operator.EQUAL ) { theOperator = Operator.EXACTLY_MATCHES; if ( type.equalsIgnoreCase( DataType.STRING.getName() ) ) { for ( int idx = 0; idx < val.length; idx++ ) { val[ idx ] = "\"" + val[ idx ] + "\""; //$NON-NLS-1$ //$NON-NLS-2$ String columnName = "[" + getCategory() + "." + getColumn() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$; if ( type.equals( DataType.DATE.getName() ) ) { if ( enforceParameters ) {
concept.setProperty( name, DataType.valueOf( setting.getCode().toUpperCase() ) ); if ( setting.getPrecision() > 0 ) { String mask = "#.";
protected int convertDataType( ColumnInfo ci ) { if ( ci != null && ci.getDataType() != null ) { switch ( ci.getDataType() ) { case NUMERIC: if ( ci.getPrecision() <= 0 ) { return ValueMetaInterface.TYPE_INTEGER; } else { return ValueMetaInterface.TYPE_NUMBER; } default: return ValueMetaBase.getType( ci.getDataType().getName() ); } } else { return ValueMetaInterface.TYPE_STRING; } }
public FieldMetaData createFieldForParentWithNode( CategoryMetaData parent, AvailableField selectedField ) { FieldMetaData field = new FieldMetaData( parent, selectedField.getName(), "", selectedField.getDisplayName(), workspaceHelper .getLocale() ); //$NON-NLS-1$ ColumnBackedNode node = createColumnBackedNode( selectedField, ModelerPerspective.REPORTING ); field.setLogicalColumn( node.getLogicalColumn() ); field.setFieldTypeDesc( node.getLogicalColumn().getDataType().getName() ); switch ( node.getLogicalColumn().getDataType() ) { case DATE: field.setFormatstring( DataFormatHolder.DATE_FORMATS ); break; case NUMERIC: field.setFormatstring( DataFormatHolder.NUMBER_FORMATS ); break; case STRING: field.setFormatstring( DataFormatHolder.CONVERSION_FORMATS ); break; case BOOLEAN: case URL: case BINARY: case UNKNOWN: case IMAGE: default: break; } field.setFormat( "" ); return field; }
col.setType( c.getDataType().getName().toUpperCase() ); col.setCategory( category.getId() );
@SuppressWarnings( "deprecation" ) public void addColumn( final LogicalColumn column, final Element tableNode, final String locale ) { Element columnNode = tableNode.addElement( "column" ); //$NON-NLS-1$ if ( column.getId() != null ) { columnNode.addElement( "column_id" ).setText( column.getId() ); //$NON-NLS-1$ } if ( column.getName( locale ) != null ) { columnNode.addElement( "column_name" ).setText( column.getName( locale ) ); //$NON-NLS-1$ } if ( column.getDescription( locale ) != null ) { columnNode.addElement( "column_description" ).setText( column.getDescription( locale ) ); //$NON-NLS-1$ } if ( column.getFieldType() != null ) { // TODO this should take a locale String desc = column.getFieldType().getDescription(); desc = org.pentaho.pms.messages.Messages.getString( desc ); columnNode.addElement( "column_field_type" ).setText( desc ); //$NON-NLS-1$ } DataType dataType = column.getDataType(); if ( dataType != null ) { columnNode.addElement( "column_type" ).setText( dataType.getName() ); //$NON-NLS-1$ } if ( column.getProperty( "lookup" ) != null ) { //$NON-NLS-1$ columnNode.addElement( "column_lookup" ).setText( "true" ); //$NON-NLS-1$ //$NON-NLS-2$ } }