public boolean equals(Object obj) { try { ColumnGroup other = (ColumnGroup) obj; if (sourceId != null && !sourceId.equals(other.sourceId)) return false; if (columnId != null && !columnId.equals(other.columnId)) return false; if (strategy != null && !strategy.equals(other.strategy)) return false; if (intervalSize != null && !intervalSize.equals(other.intervalSize)) return false; if (emptyIntervals != other.emptyIntervals) return false; if (maxIntervals != other.maxIntervals) return false; return true; } catch (ClassCastException e) { return false; } }
public boolean equals(Object obj) { try { ColumnGroup other = (ColumnGroup) obj; if (sourceId != null && !sourceId.equals(other.sourceId)) return false; if (columnId != null && !columnId.equals(other.columnId)) return false; if (strategy != null && !strategy.equals(other.strategy)) return false; if (intervalSize != null && !intervalSize.equals(other.intervalSize)) return false; if (emptyIntervals != other.emptyIntervals) return false; if (maxIntervals != other.maxIntervals) return false; return true; } catch (ClassCastException e) { return false; } }
public boolean isFixedStrategy() { return GroupStrategy.FIXED.equals(columnGroup.getStrategy()); }
public boolean isFixedStrategy() { return GroupStrategy.FIXED.equals(columnGroup.getStrategy()); }
public static Column column(String name, GroupStrategy strategy, DateIntervalType type) { if (GroupStrategy.FIXED.equals(strategy)) { return new FixedDateColumn(name, type); } else { return new DynamicDateColumn(name, type); } }
public static Column column(String name, GroupStrategy strategy, DateIntervalType type) { if (GroupStrategy.FIXED.equals(strategy)) { return new FixedDateColumn(name, type); } else { return new DynamicDateColumn(name, type); } }
public T firstMonth(Month month) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.MONTH.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed MONTH date group is required."); } columnGroup.setFirstMonthOfYear(month); return (T) this; }
public T firstMonth(Month month) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.MONTH.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed MONTH date group is required."); } columnGroup.setFirstMonthOfYear(month); return (T) this; }
public T firstDay(DayOfWeek dayOfWeek) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.DAY_OF_WEEK.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed DAY_OF_WEEK date group is required."); } columnGroup.setFirstDayOfWeek(dayOfWeek); return (T) this; }
public T firstDay(DayOfWeek dayOfWeek) { DataSetGroup gOp = (DataSetGroup) getCurrentOp(); if (gOp == null || gOp.getColumnGroup() == null) { throw new RuntimeException("group() must be called first."); } ColumnGroup columnGroup = gOp.getColumnGroup(); if (!GroupStrategy.FIXED.equals(columnGroup.getStrategy())) { throw new RuntimeException("A fixed group is required."); } if (!DateIntervalType.DAY_OF_WEEK.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) { throw new RuntimeException("A fixed DAY_OF_WEEK date group is required."); } columnGroup.setFirstDayOfWeek(dayOfWeek); return (T) this; }
protected String formatDate(DateIntervalType type, GroupStrategy strategy, String date, String pattern, String expression) { if (date == null) { return null; } String str = GroupStrategy.FIXED.equals(strategy) ? formatDateFixed(type, date) : formatDateDynamic(type, date, pattern); if (StringUtils.isBlank(expression)) { return str; } return getEvaluator().evalExpression(str, expression); }
protected boolean isDynamicDateGroup(DataSetGroup groupOp) { ColumnGroup cg = groupOp.getColumnGroup(); if (!ColumnType.DATE.equals(metadata.getColumnType(cg.getSourceId()))) { return false; } if (!GroupStrategy.DYNAMIC.equals(cg.getStrategy())) { return false; } return true; }
protected boolean isDynamicDateGroup(DataSetGroup groupOp) { ColumnGroup cg = groupOp.getColumnGroup(); if (!ColumnType.DATE.equals(metadata.getColumnType(cg.getSourceId()))) { return false; } if (!GroupStrategy.DYNAMIC.equals(cg.getStrategy())) { return false; } return true; }
protected String formatDate(DateIntervalType type, GroupStrategy strategy, String date, String pattern, String expression) { if (date == null) { return null; } String str = GroupStrategy.FIXED.equals(strategy) ? formatDateFixed(type, date) : formatDateDynamic(type, date, pattern); if (StringUtils.isBlank(expression)) { return str; } return getEvaluator().evalExpression(str, expression); }
@Override protected void beforeDataSetLookup() { // Make sure the drop down entries are sorted DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp(); if (dataSetHandler.getCurrentDataSetLookup().getOperationList(DataSetSort.class).isEmpty() && group != null) { ColumnGroup column = group.getColumnGroup(); if (!GroupStrategy.FIXED.equals(column.getStrategy())) { dataSetHandler.sort(column.getSourceId(), SortOrder.ASCENDING); } } }
@Override protected void beforeDataSetLookup() { // Make sure the drop down entries are sorted DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp(); if (dataSetHandler.getCurrentDataSetLookup().getOperationList(DataSetSort.class).isEmpty() && group != null) { ColumnGroup column = group.getColumnGroup(); if (!GroupStrategy.FIXED.equals(column.getStrategy())) { dataSetHandler.sort(column.getSourceId(), SortOrder.ASCENDING); } } }
@Override protected void beforeDataSetLookup() { // Make sure the drop down entries are sorted DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp(); if (dataSetHandler.getCurrentDataSetLookup().getOperationList(DataSetSort.class).isEmpty() && group != null) { ColumnGroup column = group.getColumnGroup(); if (!GroupStrategy.FIXED.equals(column.getStrategy())) { dataSetHandler.sort(column.getSourceId(), SortOrder.ASCENDING); } } }
@Override protected void beforeDataSetLookup() { // Make sure the drop down entries are sorted DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp(); if (dataSetHandler.getCurrentDataSetLookup().getOperationList(DataSetSort.class).isEmpty() && group != null) { ColumnGroup column = group.getColumnGroup(); if (!GroupStrategy.FIXED.equals(column.getStrategy())) { dataSetHandler.sort(column.getSourceId(), SortOrder.ASCENDING); } } }
protected DateIntervalType calculateDateInterval(ColumnGroup cg) { if (dateIntervalType != null) { return dateIntervalType; } if (GroupStrategy.DYNAMIC.equals(cg.getStrategy())) { Date[] limits = calculateDateLimits(cg.getSourceId()); if (limits != null) { dateIntervalType = intervalBuilderDynamicDate.calculateIntervalSize(limits[0], limits[1], cg); return dateIntervalType; } } dateIntervalType = DateIntervalType.getByName(cg.getIntervalSize()); return dateIntervalType; }
protected DateIntervalType calculateDateInterval(ColumnGroup cg) { if (dateIntervalType != null) { return dateIntervalType; } if (GroupStrategy.DYNAMIC.equals(cg.getStrategy())) { Date[] limits = calculateDateLimits(cg.getSourceId()); if (limits != null) { dateIntervalType = intervalBuilderDynamicDate.calculateIntervalSize(limits[0], limits[1], cg); return dateIntervalType; } } dateIntervalType = DateIntervalType.getByName(cg.getIntervalSize()); return dateIntervalType; }