@Override protected boolean check() throws Exception { humanTaskInstances = processAPI.searchHumanTaskInstances(searchOptions); return nbOfHumanTasks == humanTaskInstances.getCount(); }
@Override protected boolean check() throws Exception { final SearchResult<HumanTaskInstance> searchResult = processAPI.searchPendingTasksForUser(userId, searchOptions); pendingHumanTasks = searchResult.getResult(); return searchResult.getCount() == nbTasks; }
public List<String> checkNoFlowNodes() throws SearchException { final List<String> messages = new ArrayList<>(); final SearchOptionsBuilder build = new SearchOptionsBuilder(0, 1000); final SearchResult<FlowNodeInstance> searchResult = getProcessAPI().searchFlowNodeInstances(build.done()); final List<FlowNodeInstance> flowNodeInstances = searchResult.getResult(); if (searchResult.getCount() > 0) { final StringBuilder messageBuilder = new StringBuilder("FlowNodes are still present: "); for (final FlowNodeInstance flowNodeInstance : flowNodeInstances) { messageBuilder.append("{").append(flowNodeInstance.getName()).append(" - ").append(flowNodeInstance.getType()).append("}").append(", "); } messages.add(messageBuilder.toString()); } return messages; }
public List<String> checkNoArchivedComments() throws SearchException { final List<String> messages = new ArrayList<>(); final SearchOptionsBuilder build = new SearchOptionsBuilder(0, 1000); final SearchResult<ArchivedComment> searchResult = getProcessAPI().searchArchivedComments(build.done()); final List<ArchivedComment> archivedComments = searchResult.getResult(); if (searchResult.getCount() > 0) { final StringBuilder messageBuilder = new StringBuilder("Archived comments are still present: "); for (final ArchivedComment archivedComment : archivedComments) { messageBuilder.append(archivedComment.getName()).append(", "); } messages.add(messageBuilder.toString()); } return messages; }
public List<String> checkNoComments() throws SearchException { final List<String> messages = new ArrayList<>(); final SearchOptionsBuilder build = new SearchOptionsBuilder(0, 1000); final SearchResult<Comment> searchResult = getProcessAPI().searchComments(build.done()); final List<Comment> comments = searchResult.getResult(); if (searchResult.getCount() > 0) { final StringBuilder messageBuilder = new StringBuilder("Comments are still present: "); for (final Comment comment : comments) { messageBuilder.append(comment.getContent()).append(", "); } messages.add(messageBuilder.toString()); } return messages; }
public List<String> checkNoArchivedFlowNodes() throws SearchException { final List<String> messages = new ArrayList<>(); final SearchOptionsBuilder build = new SearchOptionsBuilder(0, 1000); final SearchResult<ArchivedFlowNodeInstance> searchResult = getProcessAPI().searchArchivedFlowNodeInstances(build.done()); final List<ArchivedFlowNodeInstance> archivedFlowNodeInstances = searchResult.getResult(); if (searchResult.getCount() > 0) { final StringBuilder messageBuilder = new StringBuilder("Archived flowNodes are still present: "); for (final ArchivedFlowNodeInstance archivedFlowNodeInstance : archivedFlowNodeInstances) { messageBuilder.append(archivedFlowNodeInstance.getName()).append(", "); } messages.add(messageBuilder.toString()); } return messages; }
public List<String> checkNoCommands() throws SearchException, CommandNotFoundException, DeletionException { final List<String> messages = new ArrayList<>(); final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 1000); searchOptionsBuilder.filter(CommandSearchDescriptor.SYSTEM, false); searchOptionsBuilder.differentFrom(CommandSearchDescriptor.NAME, ClientEventUtil.ADD_HANDLER_COMMAND); searchOptionsBuilder.differentFrom(CommandSearchDescriptor.NAME, ClientEventUtil.WAIT_SERVER_COMMAND); final SearchResult<CommandDescriptor> searchCommands = getCommandAPI().searchCommands(searchOptionsBuilder.done()); final List<CommandDescriptor> commands = searchCommands.getResult(); if (searchCommands.getCount() > 0) { final StringBuilder commandBuilder = new StringBuilder("Commands are still present: "); for (final CommandDescriptor command : commands) { commandBuilder.append(command.getName()).append(", "); getCommandAPI().unregister(command.getName()); } messages.add(commandBuilder.toString()); } return messages; }
@Override protected boolean check() throws Exception { final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 10); builder.filter(ArchivedHumanTaskInstanceSearchDescriptor.PROCESS_DEFINITION_ID, id); builder.filter(ArchivedHumanTaskInstanceSearchDescriptor.NAME, value); builder.filter(ArchivedHumanTaskInstanceSearchDescriptor.STATE_NAME, ActivityStates.COMPLETED_STATE); final SearchResult<ArchivedHumanTaskInstance> searchArchivedTasks = processApi.searchArchivedHumanTasks(builder.done()); final boolean ok = searchArchivedTasks.getCount() >= 1; if (ok) { archivedHumanTaskInstance = searchArchivedTasks.getResult().get(0); } return ok; }
@Override public void deleteProcessDefinition(final long processDefinitionId) throws DeletionException { final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 1); builder.filter(ProcessInstanceSearchDescriptor.PROCESS_DEFINITION_ID, processDefinitionId); final SearchOptions searchOptions = builder.done(); try { final boolean hasOpenProcessInstances = searchProcessInstances(getTenantAccessor(), searchOptions).getCount() > 0; checkIfItIsPossibleToDeleteProcessInstance(processDefinitionId, hasOpenProcessInstances); final boolean hasArchivedProcessInstances = searchArchivedProcessInstances(searchOptions).getCount() > 0; checkIfItIsPossibleToDeleteProcessInstance(processDefinitionId, hasArchivedProcessInstances); processManagementAPIImplDelegate.deleteProcessDefinition(processDefinitionId); } catch (final Exception e) { throw new DeletionException(e); } }
@Override public void deleteProcessDefinition(final long processDefinitionId) throws DeletionException { final SearchOptionsBuilder builder = new SearchOptionsBuilder(0, 1); builder.filter(ProcessInstanceSearchDescriptor.PROCESS_DEFINITION_ID, processDefinitionId); final SearchOptions searchOptions = builder.done(); try { final boolean hasOpenProcessInstances = searchProcessInstances(getTenantAccessor(), searchOptions).getCount() > 0; checkIfItIsPossibleToDeleteProcessInstance(processDefinitionId, hasOpenProcessInstances); final boolean hasArchivedProcessInstances = searchArchivedProcessInstances(searchOptions).getCount() > 0; checkIfItIsPossibleToDeleteProcessInstance(processDefinitionId, hasArchivedProcessInstances); processManagementAPIImplDelegate.deleteProcessDefinition(processDefinitionId); } catch (final Exception e) { throw new DeletionException(e); } }
@Override public long countComments(final SearchOptions searchOptions) throws SearchException { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 0).setFilters(searchOptions.getFilters()).searchTerm( searchOptions.getSearchTerm()); final SearchResult<Comment> searchResult = searchComments(searchOptionsBuilder.done()); return searchResult.getCount(); }
@Override public long countAttachments(final SearchOptions searchOptions) throws SearchException { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 0).setFilters(searchOptions.getFilters()).searchTerm( searchOptions.getSearchTerm()); final SearchResult<Document> searchResult = documentAPI.searchDocuments(searchOptionsBuilder.done()); return searchResult.getCount(); }
@Override public long countComments(final SearchOptions searchOptions) throws SearchException { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 0).setFilters(searchOptions.getFilters()).searchTerm( searchOptions.getSearchTerm()); final SearchResult<Comment> searchResult = searchComments(searchOptionsBuilder.done()); return searchResult.getCount(); }
@Override public long countAttachments(final SearchOptions searchOptions) throws SearchException { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 0).setFilters(searchOptions.getFilters()).searchTerm( searchOptions.getSearchTerm()); final SearchResult<Document> searchResult = documentAPI.searchDocuments(searchOptionsBuilder.done()); return searchResult.getCount(); }
@Override protected boolean check() throws Exception { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 10); if (useRootProcessInstance) { searchOptionsBuilder.filter(FlowNodeInstanceSearchDescriptor.ROOT_PROCESS_INSTANCE_ID, processInstanceId); } else { searchOptionsBuilder.filter(FlowNodeInstanceSearchDescriptor.PARENT_PROCESS_INSTANCE_ID, processInstanceId); } searchOptionsBuilder.filter(FlowNodeInstanceSearchDescriptor.NAME, name); final SearchResult<FlowNodeInstance> searchResult = processAPI.searchFlowNodeInstances(searchOptionsBuilder.done()); final boolean found = searchResult.getCount() > 0; boolean check = found; if (found) { result = searchResult.getResult().get(0); if (state != null) { check = state.equals(result.getState()); } if (stateCategory != null) { check = stateCategory.equals(result.getStateCategory()); } } return check; }
public void checkWasntExecuted(final ProcessInstance parentProcessInstance, final String flowNodeName) throws InvalidSessionException, SearchException { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 20); searchOptionsBuilder.filter(ArchivedFlowNodeInstanceSearchDescriptor.PARENT_PROCESS_INSTANCE_ID, parentProcessInstance.getId()); searchOptionsBuilder.filter(ArchivedFlowNodeInstanceSearchDescriptor.NAME, flowNodeName); final SearchResult<ArchivedFlowNodeInstance> searchArchivedActivities = getProcessAPI().searchArchivedFlowNodeInstances(searchOptionsBuilder.done()); assertTrue(searchArchivedActivities.getCount() == 0); }
protected void cleanCommands() throws SearchException, CommandNotFoundException, DeletionException { final SearchOptionsBuilder searchOptionsBuilder = new SearchOptionsBuilder(0, 1000); searchOptionsBuilder.filter(CommandSearchDescriptor.SYSTEM, false); searchOptionsBuilder.differentFrom(CommandSearchDescriptor.NAME, ClientEventUtil.ADD_HANDLER_COMMAND); searchOptionsBuilder.differentFrom(CommandSearchDescriptor.NAME, ClientEventUtil.WAIT_SERVER_COMMAND); final SearchResult<CommandDescriptor> searchCommands = getCommandAPI().searchCommands(searchOptionsBuilder.done()); final List<CommandDescriptor> commands = searchCommands.getResult(); if (searchCommands.getCount() > 0) { for (final CommandDescriptor command : commands) { getCommandAPI().unregister(command.getName()); } } }
searchOptionsBuilder.filter(ProfileMemberSearchDescriptor.USER_ID, userId); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SUserProfileMemberAlreadyExistsException("A profileMember with userId \"" + userId + "\" already exists"); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SGroupProfileMemberAlreadyExistsException("A profileMember with groupId \"" + groupId + "\" already exists"); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SRoleProfileMemberAlreadyExistsException("A profileMember with roleId \"" + roleId + "\" already exists"); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SUserMembershipProfileMemberAlreadyExistsException("A profileMember with groupId \"" + groupId + "\" and roleId \"" + roleId + "\" already exists");
searchOptionsBuilder.filter(ProfileMemberSearchDescriptor.USER_ID, userId); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SUserProfileMemberAlreadyExistsException("A profileMember with userId \"" + userId + "\" already exists"); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SGroupProfileMemberAlreadyExistsException("A profileMember with groupId \"" + groupId + "\" already exists"); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SRoleProfileMemberAlreadyExistsException("A profileMember with roleId \"" + roleId + "\" already exists"); searchProfileMembersForProfile.execute(); if (searchProfileMembersForProfile.getResult().getCount() != 0) { throw new SUserMembershipProfileMemberAlreadyExistsException("A profileMember with groupId \"" + groupId + "\" and roleId \"" + roleId + "\" already exists");
.getCount() > 0) { return true;