public int getIndex() { for (int i = 0; i < _typeArray.length; i++) { AggregateFunctionType type = _typeArray[i]; if (this.equals(type)) return i; } return -1; }
/** * <p>Builds a column identifier when applying an aggregate function to the column, but no id is specified.</p> * <p>It follows the nomenclature: <code>sourceId_function</code>.</p> * * @param sourceId The source column identifier. * @param function The aggregate function. * @return A new column identifier. */ protected String buildColumnId(String sourceId, AggregateFunctionType function) { if (sourceId == null || sourceId.trim().length() == 0) { return function.name().toLowerCase(); } else { return sourceId + SYMBOL_UNDERSCORE + function.name().toLowerCase(); } } }
public static AggregateFunctionType getByName(String str) { try { if (str == null) { return null; } return valueOf(str.toUpperCase()); } catch (Exception e) { return null; } } }
filterParams.add(new QueryParam(groupFunction.getSourceId(), groupFunction.getFunction().toString(), Arrays.asList(groupFunction.getColumnId()))); extraColumns.add(new DataColumnImpl(groupFunction.getSourceId(), ColumnType.NUMBER)); } else {
DataColumn sourceColumn = context.dataSet.getColumnById(sourceId); ColumnType sourceColumnType = sourceColumn != null ? sourceColumn.getColumnType() : null; ColumnType aggColumnType = gf.getFunction().getResultType(sourceColumnType);
public GroupFunction parseGroupFunction( JsonObject groupFunctionJson ) { if (groupFunctionJson == null) { return null; } GroupFunction groupFunction = new GroupFunction(); groupFunction.setSourceId(groupFunctionJson.getString(keySet(SOURCE))); groupFunction.setColumnId(groupFunctionJson.getString(keySet(COLUMN))); groupFunction.setFunction(AggregateFunctionType.getByName(groupFunctionJson.getString(keySet(FUNCTION)))); return groupFunction; }
public JsonObject formatGroupFunction(GroupFunction groupFunction) throws JsonException { if (groupFunction == null) { return null; } JsonObject groupFunctionJson = Json.createObject(); groupFunctionJson.put(SOURCE, groupFunction.getSourceId() != null ? groupFunction.getSourceId() : null); groupFunctionJson.put(COLUMN, groupFunction.getColumnId() != null ? groupFunction.getColumnId() : null); groupFunctionJson.put(FUNCTION, groupFunction.getFunction() != null ? groupFunction.getFunction().toString() : null); return groupFunctionJson; }
ColumnType resultType = gf.getFunction().getResultType(columnType); column.setColumnType(resultType);
public GroupFunction parseGroupFunction( JsonObject groupFunctionJson ) { if (groupFunctionJson == null) { return null; } GroupFunction groupFunction = new GroupFunction(); groupFunction.setSourceId(groupFunctionJson.getString(keySet(SOURCE))); groupFunction.setColumnId(groupFunctionJson.getString(keySet(COLUMN))); groupFunction.setFunction(AggregateFunctionType.getByName(groupFunctionJson.getString(keySet(FUNCTION)))); return groupFunction; }
public JsonObject formatGroupFunction(GroupFunction groupFunction) throws JsonException { if (groupFunction == null) { return null; } JsonObject groupFunctionJson = Json.createObject(); groupFunctionJson.put(SOURCE, groupFunction.getSourceId() != null ? groupFunction.getSourceId() : null); groupFunctionJson.put(COLUMN, groupFunction.getColumnId() != null ? groupFunction.getColumnId() : null); groupFunctionJson.put(FUNCTION, groupFunction.getFunction() != null ? groupFunction.getFunction().toString() : null); return groupFunctionJson; }
/** * <p>Builds a column identifier when applying an aggregate function to the column, but no id is specified.</p> * <p>It follows the nomenclature: <code>sourceId_function</code>.</p> * * @param sourceId The source column identifier. * @param function The aggregate function. * @return A new column identifier. */ protected String buildColumnId(String sourceId, AggregateFunctionType function) { if (sourceId == null || sourceId.trim().length() == 0) { return function.name().toLowerCase(); } else { return sourceId + SYMBOL_UNDERSCORE + function.name().toLowerCase(); } } }
ColumnType resultType = gf.getFunction().getResultType(columnType); column.setColumnType(resultType);
public static AggregateFunctionType getByName(String str) { try { if (str == null) { return null; } return valueOf(str.toUpperCase()); } catch (Exception e) { return null; } } }
public int getIndex() { for (int i = 0; i < _typeArray.length; i++) { AggregateFunctionType type = _typeArray[i]; if (this.equals(type)) return i; } return -1; }
if (groupFunction.getFunction() != null) { filterParams.add(new QueryParam(groupFunction.getSourceId(), groupFunction.getFunction().toString(), Arrays.asList(groupFunction.getColumnId()))); extraColumns.add(new DataColumnImpl(groupFunction.getSourceId(),
@Override public void addFunctionItem(AggregateFunctionType functionType) { String functionName = AggregateFunctionTypeConstants.INSTANCE.getString(functionType.name()); functionListBox.addItem(functionName); }
@Override public void addFunctionItem(AggregateFunctionType functionType) { String functionName = AggregateFunctionTypeConstants.INSTANCE.getString(functionType.name()); functionListBox.addItem(functionName); }
public boolean equals(Object obj) { try { GroupFunction other = (GroupFunction) obj; if (sourceId != null && !sourceId.equals(other.sourceId)) return false; if (columnId != null && !columnId.equals(other.columnId)) return false; if (function != null && !function.equals(other.function)) return false; return true; } catch (ClassCastException e) { return false; } }