public void getDomainSpecifDataForTasks( final int startRange, String filterValue, final List<TaskSummary> myTasksFromDataSet, boolean lastPageExactCount) { FilterSettings variablesTableSettings = view.getVariablesTableSettings(filterValue); variablesTableSettings.setTablePageSize(-1); variablesTableSettings.setServerTemplateId(selectedServerTemplate); dataSetQueryHelperDomainSpecific.setDataSetHandler(variablesTableSettings); dataSetQueryHelperDomainSpecific.setCurrentTableSettings(variablesTableSettings); dataSetQueryHelperDomainSpecific.setLastOrderedColumn(COLUMN_TASK_ID); dataSetQueryHelperDomainSpecific.setLastSortOrder(SortOrder.ASCENDING); List<Comparable> tasksIds = new ArrayList<Comparable>(); for (TaskSummary task : myTasksFromDataSet) { tasksIds.add(task.getTaskId()); } DataSetFilter filter = new DataSetFilter(); ColumnFilter filter1 = equalsTo(COLUMN_TASK_VARIABLE_TASK_ID, tasksIds); filter.addFilterColumn(filter1); variablesTableSettings.getDataSetLookup().addOperation(filter); dataSetQueryHelperDomainSpecific.lookupDataSet( 0, createDataSetDomainSpecificCallback( startRange, myTasksFromDataSet, variablesTableSettings.getDataSet(), lastPageExactCount)); }
public void columnFilterDeleted(ColumnFilterEditor editor) { addFilterButton.setVisible(true); addFilterPanel.setVisible(false); filterListPanel.remove(editor); Integer index = filter.getColumnFilterIdx(editor.getFilter()); if (index != null) { filter.getColumnFilterList().remove(index.intValue()); if (listener != null) { listener.filterChanged(filter); } } }
@UiHandler(value = "newFilterListBox") public void onNewFilterSelected(ChangeEvent changeEvent) { int selectedIdx = newFilterListBox.getSelectedIndex(); if (selectedIdx > 0) { String columnId = metadata.getColumnId(selectedIdx - 1); ColumnType columnType = metadata.getColumnType(selectedIdx - 1); CoreFunctionFilter columnFilter = FilterFactory.createCoreFunctionFilter( columnId, columnType, ColumnType.DATE.equals(columnType) ? CoreFunctionType.TIME_FRAME : CoreFunctionType.NOT_EQUALS_TO); if (filter == null) filter = new DataSetFilter(); filter.addFilterColumn(columnFilter); ColumnFilterEditor columnFilterEditor = new ColumnFilterEditor(); columnFilterEditor.init(metadata, columnFilter, this); columnFilterEditor.expand(); filterListPanel.add(columnFilterEditor); newFilterListBox.setSelectedIndex(0); addFilterPanel.setVisible(false); addFilterButton.setVisible(true); columnFilterChanged(columnFilterEditor); } }
@Override public Query build() { if (filters == null || filters.isEmpty()) return null; List<Query> queries = new LinkedList<Query>(); // Build query definition for filter operations. for (DataSetFilter filter : filters) { Query subQuery = build(filter.getColumnFilterList(), Operator.AND); if (subQuery == null) continue; queries.add(subQuery); } // Build query definition for interval group selections. for (DataSetGroup group : groups) { if (group.isSelect()) { List<Query> subQueries = buildGroupIntervalQuery(group); if (subQueries != null && !subQueries.isEmpty()) { for (Query subQuery : subQueries) { queries.add(subQuery); } } } } Query result = joinQueriesAndFilters(queries, Operator.AND); // If result is a filter, wrap into a MATCH_ALL filtered query, as EL aggregations requires // working with queries. if (result != null && isFilter(result)) { Query filtered = new Query(Query.Type.FILTERED); Query matchAll = new Query(Query.Type.MATCH_ALL); filtered.setParam(Query.Parameter.QUERY.name(), matchAll); filtered.setParam(Query.Parameter.FILTER.name(), result); return filtered; } return result; }
@Override public void getData(final Range visibleRange) { try { if (!isAddingDefaultFilters()) { FilterSettings currentTableSettings = dataSetQueryHelper.getCurrentTableSettings(); if (currentTableSettings != null) { currentTableSettings.setServerTemplateId(selectedServerTemplate); currentTableSettings.setTablePageSize(view.getListGrid().getPageSize()); ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); if (columnSortList != null && columnSortList.size() > 0) { dataSetQueryHelper.setLastOrderedColumn( columnSortList.size() > 0 ? columnSortList.get(0).getColumn().getDataStoreName() : ""); dataSetQueryHelper.setLastSortOrder( (columnSortList.size() > 0) && columnSortList.get(0).isAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING); } else { dataSetQueryHelper.setLastOrderedColumn(COLUMN_CREATED_ON); dataSetQueryHelper.setLastSortOrder(SortOrder.ASCENDING); } final List<ColumnFilter> filters = getColumnFilters(textSearchStr); if (filters.isEmpty() == false) { if (currentTableSettings.getDataSetLookup().getFirstFilterOp() != null) { currentTableSettings .getDataSetLookup() .getFirstFilterOp() .addFilterColumn(OR(filters)); } else { final DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(OR(filters)); currentTableSettings.getDataSetLookup().addOperation(filter); } } boolean isAdminDataset = currentTableSettings .getDataSetLookup() .getDataSetUUID() .equals(HUMAN_TASKS_WITH_ADMIN_DATASET); if (isAdminDataset || currentTableSettings .getDataSetLookup() .getDataSetUUID() .equals(HUMAN_TASKS_WITH_USER_DATASET)) { if (currentTableSettings.getDataSetLookup().getFirstFilterOp() != null) { currentTableSettings .getDataSetLookup() .getFirstFilterOp() .addFilterColumn(getUserGroupFilters(isAdminDataset)); } else { final DataSetFilter filter = new DataSetFilter(); filter.addFilterColumn(getUserGroupFilters(isAdminDataset)); currentTableSettings.getDataSetLookup().addOperation(filter); } } dataSetQueryHelper.setDataSetHandler(currentTableSettings); dataSetQueryHelper.lookupDataSet( visibleRange.getStart(), createDataSetTaskCallback(visibleRange.getStart(), currentTableSettings)); } else { taskService .call( new RemoteCallback<List<TaskSummary>>() { @Override public void callback(List<TaskSummary> taskSummaries) { boolean lastPage = false; if (taskSummaries.size() < visibleRange.getLength()) { lastPage = true; } updateDataOnCallback( taskSummaries, visibleRange.getStart(), visibleRange.getStart() + taskSummaries.size(), lastPage); } }) .getActiveTasks( selectedServerTemplate, visibleRange.getStart() / visibleRange.getLength(), visibleRange.getLength()); } } } catch (Exception e) { errorPopup.showMessage(constants.UnexpectedError(e.getMessage())); } }
@Override public void getData(final Range visibleRange) { try { if (!isAddingDefaultFilters()) { FilterSettings currentTableSettings = dataSetQueryHelper.getCurrentTableSettings(); if (currentTableSettings != null) { currentTableSettings.setTablePageSize(view.getListGrid().getPageSize()); ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); // GWT.log( "-----PIVarList getData table name " + currentTableSettings.getTableName() ); if (columnSortList != null && columnSortList.size() > 0) { dataSetQueryHelper.setLastOrderedColumn( (columnSortList.size() > 0) ? columnSortList.get(0).getColumn().getDataStoreName() : ""); dataSetQueryHelper.setLastSortOrder( (columnSortList.size() > 0) && columnSortList.get(0).isAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING); } else { dataSetQueryHelper.setLastOrderedColumn( DataSetProcessInstanceListVariableViewImpl.VARIABLE_NAME); dataSetQueryHelper.setLastSortOrder(SortOrder.ASCENDING); } if (textSearchStr != null && textSearchStr.trim().length() > 0) { DataSetFilter filter = new DataSetFilter(); List<ColumnFilter> filters = new ArrayList<ColumnFilter>(); filters.add( likeTo( DataSetProcessInstanceListVariableViewImpl.PROCESS_NAME, "%" + textSearchStr.toLowerCase() + "%", false)); filters.add( likeTo( DataSetProcessInstanceListVariableViewImpl.PROCESS_INSTANCE_ID, "%" + textSearchStr.toLowerCase() + "%", false)); filters.add( likeTo( DataSetProcessInstanceListVariableViewImpl.VARIABLE_VALUE, "%" + textSearchStr.toLowerCase() + "%", false)); filter.addFilterColumn(OR(filters)); if (currentTableSettings.getDataSetLookup().getFirstFilterOp() != null) { currentTableSettings .getDataSetLookup() .getFirstFilterOp() .addFilterColumn(OR(filters)); } else { currentTableSettings.getDataSetLookup().addOperation(filter); } textSearchStr = ""; } dataSetQueryHelper.setDataSetHandler(currentTableSettings); dataSetQueryHelper.lookupDataSet( visibleRange.getStart(), new DataSetReadyCallback() { @Override public void callback(DataSet dataSet) { if (dataSet != null) { List<ProcessInstanceVariableSummary> myProcessInstancesFromDataSet = new ArrayList<ProcessInstanceVariableSummary>(); for (int i = 0; i < dataSet.getRowCount(); i++) { myProcessInstancesFromDataSet.add( new ProcessInstanceVariableSummary( dataSetQueryHelper.getColumnLongValue( dataSet, DataSetProcessInstanceListVariableViewImpl.PROCESS_INSTANCE_ID, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetProcessInstanceListVariableViewImpl.PROCESS_NAME, i), dataSetQueryHelper.getColumnLongValue( dataSet, DataSetProcessInstanceListVariableViewImpl.VARIABLE_ID, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetProcessInstanceListVariableViewImpl.VARIABLE_NAME, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetProcessInstanceListVariableViewImpl.VARIABLE_VALUE, i))); } PageResponse<ProcessInstanceVariableSummary> processInstanceSummaryPageResponse = new PageResponse<ProcessInstanceVariableSummary>(); processInstanceSummaryPageResponse.setPageRowList( myProcessInstancesFromDataSet); processInstanceSummaryPageResponse.setStartRowIndex(visibleRange.getStart()); processInstanceSummaryPageResponse.setTotalRowSize( dataSet.getRowCountNonTrimmed()); processInstanceSummaryPageResponse.setTotalRowSizeExact(true); if (visibleRange.getStart() + dataSet.getRowCount() == dataSet.getRowCountNonTrimmed()) { processInstanceSummaryPageResponse.setLastPage(true); } else { processInstanceSummaryPageResponse.setLastPage(false); } DataSetProcessInstanceVariableListPresenter.this.updateDataOnCallback( processInstanceSummaryPageResponse); } view.hideBusyIndicator(); } @Override public void notFound() { view.hideBusyIndicator(); errorPopup.showMessage( "Not found DataSet with UUID [ " + PROCESS_INSTANCE_WITH_VARIABLES_DATASET + " ] "); GWT.log( "DataSet with UUID [ " + PROCESS_INSTANCE_WITH_VARIABLES_DATASET + " ] not found."); } @Override public boolean onError(final ClientRuntimeError error) { view.hideBusyIndicator(); errorPopup.showMessage( "DataSet with UUID [ " + PROCESS_INSTANCE_WITH_VARIABLES_DATASET + " ] error: " + error.getThrowable()); GWT.log( "DataSet with UUID [ " + PROCESS_INSTANCE_WITH_VARIABLES_DATASET + " ] error: ", error.getThrowable()); return false; } }); } else { view.hideBusyIndicator(); } } } catch (Exception e) { GWT.log( "Error looking up dataset with UUID [ " + PROCESS_INSTANCE_WITH_VARIABLES_DATASET + " ]"); } }