ProcessInstanceListFilterSettingsManager extends FilterSettingsManagerImpl { @Override public FilterSettings getVariablesFilterSettings(final List<Long> processIds) { FilterSettingsBuilderHelper builder = FilterSettingsBuilderHelper.init(); builder.initBuilder(); builder.dataset(PROCESS_INSTANCE_WITH_VARIABLES_DATASET); builder.filter(in(PROCESS_INSTANCE_ID, processIds)); builder.setColumn(PROCESS_INSTANCE_ID, "processInstanceId"); builder.setColumn(PROCESS_NAME, "processName"); builder.setColumn(VARIABLE_ID, "variableID"); builder.setColumn(VARIABLE_NAME, "variableName"); builder.setColumn(VARIABLE_VALUE, "variableValue"); builder.filterOn(true, true, true); builder.tableOrderEnabled(true); builder.tableOrderDefault(PROCESS_INSTANCE_ID, SortOrder.ASCENDING); FilterSettings varTableSettings = builder.buildSettings(); varTableSettings.setTablePageSize(-1); varTableSettings.setTableName("Filtered"); varTableSettings.setTableDescription("Filtered Desc"); return varTableSettings; }  @Override String getGridGlobalPreferencesKey(); @Override FilterSettings createFilterSettingsPrototype(); @Override List<FilterSettings> initDefaultFilters(); @Override FilterSettings getVariablesFilterSettings(final List<Long> processIds);  }
@Test public void testVariablesFilterSettings() { final List<Long> processIds = singletonList(1l); final FilterSettings settings = manager.getVariablesFilterSettings(processIds); assertNotNull(settings.getDataSetLookup()); final DataSetLookup dataSetLookup = settings.getDataSetLookup(); assertEquals("jbpmProcessInstancesWithVariables", dataSetLookup.getDataSetUUID()); assertEquals(PROCESS_INSTANCE_ID, settings.getTableDefaultSortColumnId()); assertEquals(SortOrder.ASCENDING, settings.getTableDefaultSortOrder()); assertEquals(DisplayerType.TABLE, settings.getType()); assertEquals(true, settings.isFilterEnabled()); assertEquals(true, settings.isFilterSelfApplyEnabled()); assertEquals(true, settings.isFilterNotificationEnabled()); assertEquals(-1, dataSetLookup.getNumberOfRows()); assertEquals(0, dataSetLookup.getRowOffset()); assertNotNull(dataSetLookup.getFirstFilterOp()); final DataSetFilter firstFilterOp = dataSetLookup.getFirstFilterOp(); assertEquals(DataSetOpType.FILTER, firstFilterOp.getType()); assertEquals(1, firstFilterOp.getColumnFilterList().size()); final ColumnFilter columnFilter = firstFilterOp.getColumnFilterList().get(0); assertEquals(PROCESS_INSTANCE_ID, columnFilter.getColumnId()); assertTrue(columnFilter instanceof CoreFunctionFilter); assertEquals(CoreFunctionType.IN, ((CoreFunctionFilter) columnFilter).getType()); assertEquals(1, ((CoreFunctionFilter) columnFilter).getParameters().size()); assertEquals(processIds.get(0), ((CoreFunctionFilter) columnFilter).getParameters().get(0)); final DataSetGroup groupOp = dataSetLookup.getLastGroupOp(); assertEquals(DataSetOpType.GROUP, groupOp.getType()); assertEquals(false, groupOp.isJoin()); assertEquals(5, groupOp.getGroupFunctions().size()); assertEquals(PROCESS_INSTANCE_ID, groupOp.getGroupFunctions().get(0).getColumnId()); assertEquals(PROCESS_INSTANCE_ID, groupOp.getGroupFunctions().get(0).getSourceId()); assertEquals(PROCESS_NAME, groupOp.getGroupFunctions().get(1).getColumnId()); assertEquals(PROCESS_NAME, groupOp.getGroupFunctions().get(1).getSourceId()); assertEquals(VARIABLE_ID, groupOp.getGroupFunctions().get(2).getColumnId()); assertEquals(VARIABLE_ID, groupOp.getGroupFunctions().get(2).getSourceId()); assertEquals(VARIABLE_NAME, groupOp.getGroupFunctions().get(3).getColumnId()); assertEquals(VARIABLE_NAME, groupOp.getGroupFunctions().get(3).getSourceId()); assertEquals(VARIABLE_VALUE, groupOp.getGroupFunctions().get(4).getColumnId()); assertEquals(VARIABLE_VALUE, groupOp.getGroupFunctions().get(4).getSourceId()); assertEquals(5, settings.getColumnSettingsList().size()); assertEquals(PROCESS_INSTANCE_ID, settings.getColumnSettingsList().get(0).getColumnId()); assertEquals("processInstanceId", settings.getColumnSettingsList().get(0).getColumnName()); assertEquals(PROCESS_NAME, settings.getColumnSettingsList().get(1).getColumnId()); assertEquals("processName", settings.getColumnSettingsList().get(1).getColumnName()); assertEquals(VARIABLE_ID, settings.getColumnSettingsList().get(2).getColumnId()); assertEquals("variableID", settings.getColumnSettingsList().get(2).getColumnName()); assertEquals(VARIABLE_NAME, settings.getColumnSettingsList().get(3).getColumnId()); assertEquals("variableName", settings.getColumnSettingsList().get(3).getColumnName()); assertEquals(VARIABLE_VALUE, settings.getColumnSettingsList().get(4).getColumnId()); assertEquals("variableValue", settings.getColumnSettingsList().get(4).getColumnName()); assertEquals("Filtered", settings.getTableName()); assertEquals("Filtered Desc", settings.getTableDescription()); assertEquals(false, settings.isEditable()); verifyNoMoreInteractions(marshaller); }