public void setColumnSortOrder(JsArray<ColumnSortInfo> sortOrder) { if (sortOrder != null) { ColumnSortInfo.setSortList(filesDataGrid_, sortOrder); } else { ColumnSortList columnSortList = filesDataGrid_.getColumnSortList(); columnSortList.clear(); columnSortList.push(nameColumn_); } }
@Override public void getData(Range visibleRange) { ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); if (currentFilter == null) { currentFilter = new PortableQueryFilter( visibleRange.getStart(), visibleRange.getLength(), false, "", columnSortList.size() > 0 ? columnSortList.get(0).getColumn().getDataStoreName() : "", columnSortList.size() == 0 || columnSortList.get(0).isAscending()); } // If we are refreshing after a search action, we need to go back to offset 0 if (currentFilter.getParams() == null || currentFilter.getParams().isEmpty() || currentFilter.getParams().get("textSearch") == null || currentFilter.getParams().get("textSearch").equals("")) { currentFilter.setOffset(visibleRange.getStart()); currentFilter.setCount(visibleRange.getLength()); } else { currentFilter.setOffset(0); currentFilter.setCount(view.getListGrid().getPageSize()); } currentFilter.setOrderBy( columnSortList.size() > 0 ? columnSortList.get(0).getColumn().getDataStoreName() : ""); currentFilter.setIsAscending(columnSortList.size() == 0 || columnSortList.get(0).isAscending()); processRuntimeDataService .call( new RemoteCallback<List<ProcessSummary>>() { @Override public void callback(final List<ProcessSummary> processDefsSums) { boolean lastPageExactCount = processDefsSums.size() < visibleRange.getLength(); updateDataOnCallback( processDefsSums, visibleRange.getStart(), visibleRange.getStart() + processDefsSums.size(), lastPageExactCount); } }, new ErrorCallback<Message>() { @Override public boolean error(Message message, Throwable throwable) { view.hideBusyIndicator(); view.displayNotification( constants.ErrorRetrievingProcessDefinitions(throwable.getMessage())); GWT.log(throwable.toString()); return true; } }) .getProcessesByFilter( selectedServerTemplate, textSearchStr, visibleRange.getStart() / visibleRange.getLength(), visibleRange.getLength(), currentFilter.getOrderBy(), currentFilter.isAscending()); }
@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 + " ]"); } }
@Override public void getData(Range visibleRange) { if (!isAddingDefaultFilters()) { ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); if (currentFilter == null) { currentFilter = new PortableQueryFilter( visibleRange.getStart(), visibleRange.getLength(), false, "", (columnSortList.size() > 0) ? columnSortList.get(0).getColumn().getDataStoreName() : "", (columnSortList.size() > 0) ? columnSortList.get(0).isAscending() : true); } // If we are refreshing after a search action, we need to go back to offset 0 if (currentFilter.getParams() == null || currentFilter.getParams().isEmpty() || currentFilter.getParams().get("textSearch") == null || currentFilter.getParams().get("textSearch").equals("")) { currentFilter.setOffset(visibleRange.getStart()); currentFilter.setCount(visibleRange.getLength()); currentFilter.setFilterParams(""); } else { currentFilter.setFilterParams( "(LOWER(t.name) like '" + currentFilter.getParams().get("textSearch") + "' or LOWER(t.description) like '" + currentFilter.getParams().get("textSearch") + "') "); currentFilter.setOffset(0); currentFilter.setCount(view.getListGrid().getPageSize()); } if (currentStatusFilter == null) { currentFilter.getParams().put("statuses", TaskUtils.getStatusByType(currentStatusFilter)); } else { currentFilter.getParams().put("statuses", currentStatuses); } currentFilter.getParams().put("filter", currentStatusFilter.toString()); currentFilter.getParams().put("userId", identity.getIdentifier()); currentFilter.getParams().put("taskRole", currentRole); currentFilter.setOrderBy( (columnSortList.size() > 0) ? columnSortList.get(0).getColumn().getDataStoreName() : ""); currentFilter.setIsAscending( (columnSortList.size() > 0) ? columnSortList.get(0).isAscending() : true); taskQueryService .call( new RemoteCallback<PageResponse<TaskSummary>>() { @Override public void callback(PageResponse<TaskSummary> response) { updateDataOnCallback(response); } }, new ErrorCallback<Message>() { @Override public boolean error(Message message, Throwable throwable) { view.hideBusyIndicator(); view.displayNotification("Error: Getting Tasks: " + throwable.toString()); GWT.log(message.toString()); return true; } }) .getData(currentFilter); } }
@Override public void getData(Range visibleRange) { /*-----------------------------------------------------------*/ if (processInstanceId != null) { ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); if (currentFilter == null) { currentFilter = new PortableQueryFilter( visibleRange.getStart(), visibleRange.getLength(), false, "", (columnSortList.size() > 0) ? columnSortList.get(0).getColumn().getDataStoreName() : "", (columnSortList.size() > 0) ? columnSortList.get(0).isAscending() : true); } // If we are refreshing after a search action, we need to go back to offset 0 if (currentFilter.getParams() == null || currentFilter.getParams().isEmpty() || currentFilter.getParams().get("textSearch") == null || currentFilter.getParams().get("textSearch").equals("")) { currentFilter.setOffset(visibleRange.getStart()); currentFilter.setCount(visibleRange.getLength()); currentFilter.setFilterParams(""); } else { currentFilter.setFilterParams( "(LOWER(t.name) like '" + currentFilter.getParams().get("textSearch") + "' or LOWER(t.description) like '" + currentFilter.getParams().get("textSearch") + "') "); currentFilter.setOffset(0); currentFilter.setCount(view.getListGrid().getPageSize()); } // Applying screen specific filters if (currentFilter.getParams() == null) { currentFilter.setParams(new HashMap<String, Object>()); } currentFilter.getParams().put("processInstanceId", processInstanceId); currentFilter.getParams().put("processDefId", processDefId); currentFilter.getParams().put("deploymentId", deploymentId); currentFilter.getParams().put("processInstanceStatus", processInstanceStatus); currentFilter.setOrderBy( (columnSortList.size() > 0) ? columnSortList.get(0).getColumn().getDataStoreName() : ""); currentFilter.setIsAscending( (columnSortList.size() > 0) ? columnSortList.get(0).isAscending() : true); variablesServices .call( new RemoteCallback<PageResponse<ProcessVariableSummary>>() { @Override public void callback(PageResponse<ProcessVariableSummary> response) { updateDataOnCallback(response); } }, new ErrorCallback<Message>() { @Override public boolean error(Message message, Throwable throwable) { view.hideBusyIndicator(); view.displayNotification("Error: Getting Process Variables List: " + message); GWT.log(throwable.toString()); return true; } }) .getData(currentFilter); } }
@Override public void getData(final Range visibleRange) { try { FilterSettings currentTableSettings = dataSetQueryHelper.getCurrentTableSettings(); if (currentTableSettings != null) { currentTableSettings.setTablePageSize(view.getListGrid().getPageSize()); ColumnSortList columnSortList = view.getListGrid().getColumnSortList(); GWT.log( "-----taskList getData " + columnSortList.size() + "currentTableSettings 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(DataSetTasksListGridViewImpl.COLUMN_CREATEDON); dataSetQueryHelper.setLastSortOrder(SortOrder.ASCENDING); } dataSetQueryHelper.setDataSetHandler(currentTableSettings); dataSetQueryHelper.lookupDataSet( visibleRange.getStart(), new DataSetReadyCallback() { @Override public void callback(DataSet dataSet) { if (dataSet != null) { List<TaskSummary> myTasksFromDataSet = new ArrayList<TaskSummary>(); for (int i = 0; i < dataSet.getRowCount(); i++) { myTasksFromDataSet.add( new TaskSummary( dataSetQueryHelper.getColumnLongValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_TASKID, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_NAME, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_DESCRIPTION, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_STATUS, i), dataSetQueryHelper.getColumnIntValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_PRIORITY, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_ACTUALOWNER, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_CREATEDBY, i), dataSetQueryHelper.getColumnDateValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_CREATEDON, i), dataSetQueryHelper.getColumnDateValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_ACTIVATIONTIME, i), dataSetQueryHelper.getColumnDateValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_DUEDATE, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_PROCESSID, i), dataSetQueryHelper.getColumnLongValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_PROCESSSESSIONID, i), dataSetQueryHelper.getColumnLongValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_PROCESSINSTANCEID, i), dataSetQueryHelper.getColumnStringValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_DEPLOYMENTID, i), dataSetQueryHelper.getColumnLongValue( dataSet, DataSetTasksListGridViewImpl.COLUMN_PARENTID, i))); } PageResponse<TaskSummary> taskSummaryPageResponse = new PageResponse<TaskSummary>(); taskSummaryPageResponse.setPageRowList(myTasksFromDataSet); taskSummaryPageResponse.setStartRowIndex(visibleRange.getStart()); taskSummaryPageResponse.setTotalRowSize(dataSet.getRowCountNonTrimmed()); taskSummaryPageResponse.setTotalRowSizeExact(true); if (visibleRange.getStart() + dataSet.getRowCount() == dataSet.getRowCountNonTrimmed()) { taskSummaryPageResponse.setLastPage(true); } else { taskSummaryPageResponse.setLastPage(false); } DataSetTasksListGridPresenter.this.updateDataOnCallback(taskSummaryPageResponse); } view.hideBusyIndicator(); } @Override public void notFound() { view.hideBusyIndicator(); errorPopup.showMessage("Not found DataSet with UUID [ jbpmHumanTasks ] "); GWT.log("DataSet with UUID [ jbpmHumanTasks ] not found."); } @Override public boolean onError(final ClientRuntimeError error) { view.hideBusyIndicator(); error.getThrowable().printStackTrace(); errorPopup.showMessage( "DataSet with UUID [ jbpmHumanTasks ] error: " + error.getThrowable()); GWT.log("DataSet with UUID [ jbpmHumanTasks ] error: ", error.getThrowable()); return false; } }); } else { view.hideBusyIndicator(); } } catch (Exception e) { GWT.log("Error looking up dataset with UUID [ jbpmHumanTasks ]"); } }