ProcessInstanceListPresenter extends AbstractMultiGridPresenter<ProcessInstanceSummary, ProcessInstanceListPresenter.ProcessInstanceListView> { public void getDomainSpecifDataForProcessInstances(final Integer startRange, final List<ProcessInstanceSummary> instancesFromDataSet, final Boolean lastPage) { List<Long> processIds = instancesFromDataSet.stream().map(t -> t.getId()).collect(Collectors.toList()); FilterSettings variablesTableSettings = filterSettingsManager.getVariablesFilterSettings(processIds); variablesTableSettings.setServerTemplateId(getSelectedServerTemplate()); variablesTableSettings.setTablePageSize(-1); dataSetQueryHelperDomainSpecific.setDataSetHandler(variablesTableSettings); dataSetQueryHelperDomainSpecific.setCurrentTableSettings(variablesTableSettings); dataSetQueryHelperDomainSpecific.setLastOrderedColumn(PROCESS_INSTANCE_ID); dataSetQueryHelperDomainSpecific.setLastSortOrder(SortOrder.ASCENDING); dataSetQueryHelperDomainSpecific.lookupDataSet(0, createDataSetDomainSpecificCallback(startRange, variablesTableSettings, lastPage)); }  @Inject void setProcessInstanceSelectedEvent(final Event<ProcessInstanceSelectionEvent> processInstanceSelectionEvent); @Override void createListBreadcrumb(); void setupDetailBreadcrumb(String detailLabel); void getDomainSpecifDataForProcessInstances(final Integer startRange,
                                                       final List<ProcessInstanceSummary> instancesFromDataSet,
                                                       final Boolean lastPage); void newInstanceCreated(@Observes final NewProcessInstanceEvent pi); void newInstanceCreated(@Observes final ProcessInstancesUpdateEvent pis); void abortProcessInstance(String containerId,
                                     long processInstanceId); void abortProcessInstances(Map<String, List<Long>> containerInstances); void bulkSignal(List<ProcessInstanceSummary> processInstances); void bulkAbort(List<ProcessInstanceSummary> processInstances); @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); void signalProcessInstance(final ProcessInstanceSummary processInstance); @Override void selectSummaryItem(final ProcessInstanceSummary summary); void refreshDetailBreadcrumb(@Observes ProcessInstanceSelectionEvent event); void formClosed(@Observes BeforeClosePlaceEvent closed); @Inject void setFilterSettingsManager(final ProcessInstanceListFilterSettingsManager filterSettingsManager); @Inject void setProcessService(final Caller<ProcessService> processService); @Override void setupActiveSearchFilters(); @Override boolean existActiveSearchFilters(); @Override ActiveFilterItem getActiveFilterFromColumnFilter(ColumnFilter columnFilter); String getStatusColumnFilterDescription(ColumnFilter columnFilter); void openJobsView(final String pid); void openTaskView(final String pid); @Override void openErrorView(final String pid); Predicate<ProcessInstanceSummary> getSignalActionCondition(); Predicate<ProcessInstanceSummary> getAbortActionCondition(); Predicate<ProcessInstanceSummary> getViewJobsActionCondition(); Predicate<ProcessInstanceSummary> getViewTasksActionCondition(); @Override Predicate<ProcessInstanceSummary> getViewErrorsActionCondition();  }
@Test public void getDomainSpecifDataForProcessInstancesTest() { final DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(equalsTo(COLUMN_PROCESS_ID, "testProc")); filterSettings.getDataSetLookup().addOperation(filter); when(dataSet.getRowCount()).thenReturn(1); when(dataSet.getValueAt(0, COLUMN_PROCESS_INSTANCE_ID)).thenReturn(Long.valueOf(1)); when(dataSetProcessVar.getRowCount()).thenReturn(2); when(dataSetProcessVar.getValueAt(0, PROCESS_INSTANCE_ID)).thenReturn(Long.valueOf(1)); String processVariable1 = "var1"; when(dataSetProcessVar.getValueAt(0, VARIABLE_NAME)).thenReturn(processVariable1); when(dataSetProcessVar.getValueAt(0, VARIABLE_VALUE)).thenReturn("value1"); when(dataSetProcessVar.getValueAt(1, PROCESS_INSTANCE_ID)).thenReturn(Long.valueOf(1)); String processVariable2 = "var2"; when(dataSetProcessVar.getValueAt(1, VARIABLE_NAME)).thenReturn(processVariable2); when(dataSetProcessVar.getValueAt(1, VARIABLE_VALUE)).thenReturn("value2"); Set<String> expectedColumns = new HashSet<String>(); expectedColumns.add(processVariable1); expectedColumns.add(processVariable2); presenter.getData(new Range(0, 5)); ArgumentCaptor<Set> argument = ArgumentCaptor.forClass(Set.class); verify(viewMock).addDomainSpecifColumns(argument.capture()); assertEquals(expectedColumns, argument.getValue()); verify(dataSetQueryHelper).lookupDataSet(anyInt(), any(DataSetReadyCallback.class)); verify(dataSetQueryHelperDomainSpecific).lookupDataSet(anyInt(), any(DataSetReadyCallback.class)); verify(dataSetQueryHelperDomainSpecific).setLastOrderedColumn(PROCESS_INSTANCE_ID); verify(dataSetQueryHelperDomainSpecific).setLastSortOrder(SortOrder.ASCENDING); when(dataSetProcessVar.getRowCount()).thenReturn(1); when(dataSetProcessVar.getValueAt(0, PROCESS_INSTANCE_ID)).thenReturn(Long.valueOf(1)); processVariable1 = "varTest1"; when(dataSetProcessVar.getValueAt(0, VARIABLE_NAME)).thenReturn(processVariable1); when(dataSetProcessVar.getValueAt(0, VARIABLE_VALUE)).thenReturn("value1"); expectedColumns = Collections.singleton(processVariable1); presenter.getData(new Range(0, 5)); argument = ArgumentCaptor.forClass(Set.class); verify(viewMock, times(2)).addDomainSpecifColumns(argument.capture()); assertEquals(expectedColumns, argument.getValue()); verify(dataSetQueryHelper, times(2)).lookupDataSet(anyInt(), any(DataSetReadyCallback.class)); verify(dataSetQueryHelperDomainSpecific, times(2)).lookupDataSet(anyInt(), any(DataSetReadyCallback.class)); }