@Override public void populate( final Map<String, Serializable> propertiesMap ) { super.populate( propertiesMap ); // let base class handle primitives, etc. // correctly convert aggregate type if ( propertiesMap.containsKey( AGGREGATE_TYPE_ID ) ) { Serializable value = propertiesMap.get( AGGREGATE_TYPE_ID ); if ( value != null ) { setAggregateType( AggregationType.valueOf( value.toString() ) ); } } }
public boolean hasAggregate() { // this selection is an aggregate if the business column is an aggregate and the agg type is not null return !AggregationType.NONE.equals( getActiveAggregationType() ); }
@Override public String toString() { StringBuffer buffer = new StringBuffer(); for ( int i = 0; i < this.size(); i++ ) { buffer.append( this.get( i ) ); if ( i < this.size() - 1 && ( buffer.length() + this.get( i + 1 ).name().length() < MAX_COL_SIZE ) ) { buffer.append( ',' ); } else { break; } } return buffer.toString(); }
protected void addSelectionToDocument( Document doc, Selection selection, Element selectionElement ) { addTextElement( doc, selectionElement, "view", selection.getCategory().getId() ); //$NON-NLS-1$ addTextElement( doc, selectionElement, "column", selection.getLogicalColumn().getId() ); //$NON-NLS-1$ if ( selection.getAggregationType() != null ) { addTextElement( doc, selectionElement, "aggregation", selection.getAggregationType().toString() ); //$NON-NLS-1$ } }
public static AggregationSettings convertToLegacy( AggregationType aggType ) { if ( aggType == null ) { return null; } return AggregationSettings.types[aggType.ordinal()]; }
concept.setProperty( name, AggregationType.values()[AggregationSettings.getType( body ).getType()] ); } else if ( propType.equals( "AggregationList" ) ) { //$NON-NLS-1$ List<AggregationSettings> settings = ConceptPropertyAggregationList.fromXML( body ); if ( settings != null ) { for ( AggregationSettings setting : settings ) { aggTypes.add( AggregationType.values()[setting.getType()] );
column.setAggregateType( AggregationType.NONE.toString() ); column.setDataType( DataType.NUMERIC ); column.setFieldType( ColumnInfo.FIELD_TYPE_DIMENSION );
for ( Object obj : list ) { AggregationType aggType = (AggregationType) obj; listaggs.add( AggregationSettings.types[aggType.ordinal()] );
List<AggregationType> list = new ArrayList<AggregationType>(); for ( AggregationSettings setting : orig ) { list.add( AggregationType.values()[setting.getType()] ); return AggregationType.values()[aggSettings.getType()]; } else if ( property instanceof ConceptPropertyBoolean ) { Boolean boolVal = (Boolean) property.getValue();
AggregationType agg = null; if ( seg.length > 2 ) { agg = AggregationType.valueOf( seg[2].toUpperCase() );
@Override public String getSummary() { if ( getAggregateType() != null ) { return BaseMessages.getString( MSG_CLASS, "Modeler.CreateMeasure.Summary", getName(), getAggregateType().name() ); } else { return BaseMessages.getString( MSG_CLASS, "Modeler.CreateMeasure.NoAggregateSummary", getName() ); } }
protected void addOrderByToDocument( Document doc, Order order, Element orderElement ) { // test that this is lower case addTextElement( doc, orderElement, "direction", order.getType().toString() ); //$NON-NLS-1$ addTextElement( doc, orderElement, "view_id", order.getSelection().getCategory().getId() ); //$NON-NLS-1$ addTextElement( doc, orderElement, "column_id", order.getSelection().getLogicalColumn().getId() ); //$NON-NLS-1$ if ( order.getSelection().getAggregationType() != null ) { addTextElement( doc, orderElement, "aggregation", order.getSelection().getAggregationType().toString() ); //$NON-NLS-1$ } }
@Bindable public void setDefaultAggregation( AggregationType defaultAggregation ) { AggregationType previousAggregation = this.defaultAggregation; if ( previousAggregation == null && defaultAggregation == null ) { return; } if ( previousAggregation != null && defaultAggregation != null && previousAggregation.equals( defaultAggregation ) ) { return; } this.defaultAggregation = defaultAggregation; this.firePropertyChange( "defaultAggregation", previousAggregation, defaultAggregation ); if ( getNode() != null ) { getNode().setDefaultAggregation( defaultAggregation ); } }
} else if ( val instanceof AggregationType ) { AggregationType at = (AggregationType) val; body = AggregationSettings.types[at.ordinal()].getCode(); type = "Aggregation"; //$NON-NLS-1$ } else if ( val instanceof List ) { List<AggregationSettings> aggSettings = new ArrayList<AggregationSettings>(); for ( AggregationType aggType : aggTypes ) { aggSettings.add( AggregationSettings.types[aggType.ordinal()] );
AggregationType type = AggregationType.valueOf( value.toString() ); if ( type != null ) { PropertyUtils.setProperty( this, field.getName(), type );
@Override protected void removeAutoMeasure( final ModelerWorkspace workspace, final String column ) { LogicalColumn logicalColumn = locateLogicalColumn( workspace, column ); String locale = workspace.getWorkspaceHelper().getLocale(); for ( MeasureMetaData measure : workspace.getModel().getMeasures() ) { if ( measureNameEquals( column, measure ) && measure.getLogicalColumn().getPhysicalColumn().getName( locale ).equals( logicalColumn.getPhysicalColumn().getName( locale ) ) && measure.getDefaultAggregation().equals( AggregationType.SUM ) && !measure.getMemberAnnotations().containsKey( GeneratedbyMemberAnnotation.GEBERATED_BY_STRING ) ) { workspace.getModel().getMeasures().remove( measure ); break; } } }
if ( aggnodes.getLength() > 0 ) { String aggvalue = XMLHandler.getNodeValue( aggnodes.item( 0 ) ); AggregationType setting = AggregationType.valueOf( aggvalue.toUpperCase() ); if ( setting == null ) { Messages.getErrorString( "QueryXmlHelper.ERROR_0011_AGG_NOT_RECOGNIZED", columnId, aggvalue ); //$NON-NLS-1$
protected void addOrderBy( Query query, Category category, String columnId, String aggregation, Order.Type orderType ) throws PentahoMetadataException { if ( category == null ) { throw new PentahoMetadataException( Messages.getErrorString( "QueryXmlHelper.ERROR_0016_BUSINESS_CATEGORY_NULL" ) ); //$NON-NLS-1$ } LogicalColumn column = category.findLogicalColumn( columnId ); if ( column == null ) { throw new PentahoMetadataException( Messages.getErrorString( "QueryXmlHelper.ERROR_0013_BUSINESS_COL_NOT_FOUND", category.getId(), columnId ) ); //$NON-NLS-1$ } // this code verifies the aggregation setting provided is a // valid option AggregationType aggsetting = null; if ( aggregation != null ) { AggregationType setting = AggregationType.valueOf( aggregation.toUpperCase() ); if ( ( column.getAggregationType() == setting ) || column.getAggregationList() != null && column.getAggregationList().contains( setting ) ) { aggsetting = setting; } } query.getOrders().add( new Order( new Selection( category, column, aggsetting ), orderType ) ); }
String aggregation = tblcol[2]; if ( aggregation != null ) { AggregationType setting = AggregationType.valueOf( aggregation.toUpperCase() ); if ( ( column.getAggregationType() == setting ) || column.getAggregationList() != null && column.getAggregationList().contains( setting ) ) {