org.camunda.bpm.engine.FilterService Java Examples
The following examples show how to use
org.camunda.bpm.engine.FilterService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreateFilterConfigurationTest.java From camunda-bpm-spring-boot-starter with Apache License 2.0 | 6 votes |
@Test public void do_not_create_when_already_exist() throws Exception { CamundaBpmProperties camundaBpmProperties = new CamundaBpmProperties(); camundaBpmProperties.getFilter().setCreate("All"); final CreateFilterConfiguration configuration = new CreateFilterConfiguration(); ReflectionTestUtils.setField(configuration, "camundaBpmProperties", camundaBpmProperties); configuration.init(); ProcessEngine engine = mock(ProcessEngine.class); FilterService filterService = mock(FilterService.class); FilterQuery filterQuery = mock(FilterQuery.class); Filter filter = mock(Filter.class); when(engine.getFilterService()).thenReturn(filterService); when(filterService.createFilterQuery()).thenReturn(filterQuery); when(filterQuery.filterName(anyString())).thenReturn(filterQuery); when(filterQuery.singleResult()).thenReturn(filter); configuration.postProcessEngineBuild(engine); verify(filterService).createFilterQuery(); verify(filterQuery).filterName("All"); verify(filterService, never()).newTaskFilter("All"); }
Example #2
Source File: TaskFilterPropertiesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@ScenarioUnderTest("initTaskFilterProperties.1") @Test public void testMapContainingMapContainingListProperty_DeserializePrimitives() { FilterService filterService = engineRule.getFilterService(); // when Filter filterTwo = filterService.createFilterQuery().filterName("taskFilterTwo").singleResult(); Map deserialisedProperties = filterTwo.getProperties(); List list = (List) ((Map) deserialisedProperties.get("foo")).get("bar"); // then assertThat(deserialisedProperties.size(), is(1)); assertThat((String) list.get(0), is("aStringValue")); assertThat((int) list.get(1), is(47)); assertThat((long) list.get(2), is(Integer.MAX_VALUE + 1L)); assertThat((long) list.get(3), is(Long.MAX_VALUE)); assertThat((double) list.get(4), is(3.14159265359D)); assertThat((boolean) list.get(5), is(true)); assertThat(list.get(6), nullValue()); }
Example #3
Source File: TaskFilterPropertiesTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@ScenarioUnderTest("initTaskFilterProperties.1") @Test public void testMapContainingListContainingMapProperty_DeserializePrimitives() { FilterService filterService = engineRule.getFilterService(); // when Filter filterOne = filterService.createFilterQuery().filterName("taskFilterOne").singleResult(); Map deserialisedProperties = filterOne.getProperties(); List list = (List) deserialisedProperties.get("foo"); Map map = (Map) list.get(0); // then assertThat(deserialisedProperties.size(), is(1)); assertThat((String) map.get("string"), is("aStringValue")); assertThat((int) map.get("int"), is(47)); assertThat((long) map.get("intOutOfRange"), is(Integer.MAX_VALUE + 1L)); assertThat((long) map.get("long"), is(Long.MAX_VALUE)); assertThat((double) map.get("double"), is(3.14159265359D)); assertThat((boolean) map.get("boolean"), is(true)); assertThat(map.get("null"), nullValue()); }
Example #4
Source File: FilterRestServiceQueryTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Before public void setUpRuntimeData() { mockedQuery = MockProvider.createMockFilterQuery(); mockedFilter = MockProvider.createMockFilter(MockProvider.EXAMPLE_FILTER_ID); mockedFilterItemCount = 13; anotherMockedFilter = MockProvider.createMockFilter(MockProvider.ANOTHER_EXAMPLE_FILTER_ID); anotherMockedFilterItemCount = 42; FilterService filterService = processEngine.getFilterService(); when(filterService.createFilterQuery()).thenReturn(mockedQuery); when(filterService.getFilter(eq(MockProvider.EXAMPLE_FILTER_ID))).thenReturn(mockedFilter); when(filterService.count(eq(MockProvider.EXAMPLE_FILTER_ID))).thenReturn((long) mockedFilterItemCount); when(filterService.getFilter(eq(MockProvider.ANOTHER_EXAMPLE_FILTER_ID))).thenReturn(anotherMockedFilter); when(filterService.count(eq(MockProvider.ANOTHER_EXAMPLE_FILTER_ID))).thenReturn((long) anotherMockedFilterItemCount); }
Example #5
Source File: MockedProcessEngineProvider.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
private void mockServices(ProcessEngine engine) { RepositoryService repoService = mock(RepositoryService.class); IdentityService identityService = mock(IdentityService.class); TaskService taskService = mock(TaskService.class); RuntimeService runtimeService = mock(RuntimeService.class); FormService formService = mock(FormService.class); HistoryService historyService = mock(HistoryService.class); ManagementService managementService = mock(ManagementService.class); CaseService caseService = mock(CaseService.class); FilterService filterService = mock(FilterService.class); ExternalTaskService externalTaskService = mock(ExternalTaskService.class); when(engine.getRepositoryService()).thenReturn(repoService); when(engine.getIdentityService()).thenReturn(identityService); when(engine.getTaskService()).thenReturn(taskService); when(engine.getRuntimeService()).thenReturn(runtimeService); when(engine.getFormService()).thenReturn(formService); when(engine.getHistoryService()).thenReturn(historyService); when(engine.getManagementService()).thenReturn(managementService); when(engine.getCaseService()).thenReturn(caseService); when(engine.getFilterService()).thenReturn(filterService); when(engine.getExternalTaskService()).thenReturn(externalTaskService); }
Example #6
Source File: FilterRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public FilterDto createFilter(FilterDto filterDto) { FilterService filterService = getProcessEngine().getFilterService(); String resourceType = filterDto.getResourceType(); Filter filter; if (EntityTypes.TASK.equals(resourceType)) { filter = filterService.newTaskFilter(); } else { throw new InvalidRequestException(Response.Status.BAD_REQUEST, "Unable to create filter with invalid resource type '" + resourceType + "'"); } try { filterDto.updateFilter(filter, getProcessEngine()); } catch (NotValidException e) { throw new InvalidRequestException(Response.Status.BAD_REQUEST, e, "Unable to create filter with invalid content"); } filterService.saveFilter(filter); return FilterDto.fromFilter(filter); }
Example #7
Source File: FilterRestServiceImpl.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
public List<FilterDto> getFilters(UriInfo uriInfo, Boolean itemCount, Integer firstResult, Integer maxResults) { FilterService filterService = getProcessEngine().getFilterService(); FilterQuery query = getQueryFromQueryParameters(uriInfo.getQueryParameters()); List<Filter> matchingFilters = executeFilterQuery(query, firstResult, maxResults); List<FilterDto> filters = new ArrayList<FilterDto>(); for (Filter filter : matchingFilters) { FilterDto dto = FilterDto.fromFilter(filter); if (itemCount != null && itemCount) { dto.setItemCount(filterService.count(filter.getId())); } filters.add(dto); } return filters; }
Example #8
Source File: MockedProcessEngineProvider.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
private void mockServices(ProcessEngine engine) { RepositoryService repoService = mock(RepositoryService.class); IdentityService identityService = mock(IdentityService.class); TaskService taskService = mock(TaskService.class); RuntimeService runtimeService = mock(RuntimeService.class); FormService formService = mock(FormService.class); HistoryService historyService = mock(HistoryService.class); ManagementService managementService = mock(ManagementService.class); CaseService caseService = mock(CaseService.class); FilterService filterService = mock(FilterService.class); ExternalTaskService externalTaskService = mock(ExternalTaskService.class); when(engine.getRepositoryService()).thenReturn(repoService); when(engine.getIdentityService()).thenReturn(identityService); when(engine.getTaskService()).thenReturn(taskService); when(engine.getRuntimeService()).thenReturn(runtimeService); when(engine.getFormService()).thenReturn(formService); when(engine.getHistoryService()).thenReturn(historyService); when(engine.getManagementService()).thenReturn(managementService); when(engine.getCaseService()).thenReturn(caseService); when(engine.getFilterService()).thenReturn(filterService); when(engine.getExternalTaskService()).thenReturn(externalTaskService); }
Example #9
Source File: CreateFilterConfigurationTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void do_not_create_when_already_exist() throws Exception { CamundaBpmProperties camundaBpmProperties = new CamundaBpmProperties(); camundaBpmProperties.getFilter().setCreate("All"); final CreateFilterConfiguration configuration = new CreateFilterConfiguration(); ReflectionTestUtils.setField(configuration, "camundaBpmProperties", camundaBpmProperties); configuration.init(); ProcessEngine engine = mock(ProcessEngine.class); FilterService filterService = mock(FilterService.class); FilterQuery filterQuery = mock(FilterQuery.class); Filter filter = mock(Filter.class); when(engine.getFilterService()).thenReturn(filterService); when(filterService.createFilterQuery()).thenReturn(filterQuery); when(filterQuery.filterName(anyString())).thenReturn(filterQuery); when(filterQuery.count()).thenReturn(1L); configuration.postProcessEngineBuild(engine); verifyLogs(Level.INFO, "the filter with this name already exists"); verify(filterService).createFilterQuery(); verify(filterQuery).filterName("All"); verify(filterService, never()).newTaskFilter("All"); }
Example #10
Source File: TaskFilterPropertiesScenario.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@DescribesScenario("initTaskFilterProperties") public static ScenarioSetup initTaskFilterProperties() { return new ScenarioSetup() { public void execute(ProcessEngine engine, String scenarioName) { FilterService filterService = engine.getFilterService(); Filter filterOne = filterService .newTaskFilter("taskFilterOne"); Map<String, Object> primitivesMap = new HashMap<>(); primitivesMap.put("string", "aStringValue"); primitivesMap.put("int", 47); primitivesMap.put("intOutOfRange", Integer.MAX_VALUE + 1L); primitivesMap.put("long", Long.MAX_VALUE); primitivesMap.put("double", 3.14159265359D); primitivesMap.put("boolean", true); primitivesMap.put("null", null); filterOne.setProperties(Collections.<String, Object>singletonMap("foo", Collections.singletonList(primitivesMap))); filterService.saveFilter(filterOne); Filter filterTwo = engine.getFilterService() .newTaskFilter("taskFilterTwo"); List<Object> primitivesList = new ArrayList<>(); primitivesList.add("aStringValue"); primitivesList.add(47); primitivesList.add(Integer.MAX_VALUE + 1L); primitivesList.add(Long.MAX_VALUE); primitivesList.add(3.14159265359D); primitivesList.add(true); primitivesList.add(null); filterTwo.setProperties(Collections.<String, Object>singletonMap("foo", Collections.singletonMap("bar", primitivesList))); filterService.saveFilter(filterTwo); } }; }
Example #11
Source File: ProcessEngineImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override public FilterService getFilterService() { return filterService; }
Example #12
Source File: ProcessEngineRule.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Override public FilterService getFilterService() { return filterService; }
Example #13
Source File: ProcessEngineRule.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void setFilterService(FilterService filterService) { this.filterService = filterService; }
Example #14
Source File: ProcessEngineConfigurationImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void setFilterService(FilterService filterService) { this.filterService = filterService; }
Example #15
Source File: ProcessEngineConfigurationImpl.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public FilterService getFilterService() { return filterService; }
Example #16
Source File: ProcessEngineRestServiceTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Before public void setUpRuntimeData() { namedProcessEngine = getProcessEngine(EXAMPLE_ENGINE_NAME); mockRepoService = mock(RepositoryService.class); mockRuntimeService = mock(RuntimeService.class); mockTaskService = mock(TaskService.class); mockIdentityService = mock(IdentityService.class); mockManagementService = mock(ManagementService.class); mockHistoryService = mock(HistoryService.class); mockCaseService = mock(CaseService.class); mockFilterService = mock(FilterService.class); mockExternalTaskService = mock(ExternalTaskService.class); when(namedProcessEngine.getRepositoryService()).thenReturn(mockRepoService); when(namedProcessEngine.getRuntimeService()).thenReturn(mockRuntimeService); when(namedProcessEngine.getTaskService()).thenReturn(mockTaskService); when(namedProcessEngine.getIdentityService()).thenReturn(mockIdentityService); when(namedProcessEngine.getManagementService()).thenReturn(mockManagementService); when(namedProcessEngine.getHistoryService()).thenReturn(mockHistoryService); when(namedProcessEngine.getCaseService()).thenReturn(mockCaseService); when(namedProcessEngine.getFilterService()).thenReturn(mockFilterService); when(namedProcessEngine.getExternalTaskService()).thenReturn(mockExternalTaskService); createProcessDefinitionMock(); createProcessInstanceMock(); createTaskMock(); createIdentityMocks(); createExecutionMock(); createVariableInstanceMock(); createJobDefinitionMock(); createIncidentMock(); createDeploymentMock(); createMessageCorrelationBuilderMock(); createCaseDefinitionMock(); createCaseInstanceMock(); createCaseExecutionMock(); createFilterMock(); createExternalTaskMock(); createHistoricActivityInstanceMock(); createHistoricProcessInstanceMock(); createHistoricVariableInstanceMock(); createHistoricActivityStatisticsMock(); createHistoricDetailMock(); createHistoricTaskInstanceMock(); createHistoricIncidentMock(); createHistoricJobLogMock(); createHistoricExternalTaskLogMock(); }
Example #17
Source File: FilterRestServiceInteractionTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Before @SuppressWarnings("unchecked") public void setUpRuntimeData() { filterServiceMock = mock(FilterService.class); when(processEngine.getFilterService()).thenReturn(filterServiceMock); FilterQuery filterQuery = MockProvider.createMockFilterQuery(); when(filterServiceMock.createFilterQuery()).thenReturn(filterQuery); filterMock = MockProvider.createMockFilter(); when(filterServiceMock.newTaskFilter()).thenReturn(filterMock); when(filterServiceMock.saveFilter(eq(filterMock))).thenReturn(filterMock); when(filterServiceMock.getFilter(eq(EXAMPLE_FILTER_ID))).thenReturn(filterMock); when(filterServiceMock.getFilter(eq(MockProvider.NON_EXISTING_ID))).thenReturn(null); List<Object> mockTasks = Collections.<Object>singletonList(new TaskEntity()); when(filterServiceMock.singleResult(eq(EXAMPLE_FILTER_ID))) .thenReturn(mockTasks.get(0)); when(filterServiceMock.singleResult(eq(EXAMPLE_FILTER_ID), any(Query.class))) .thenReturn(mockTasks.get(0)); when(filterServiceMock.list(eq(EXAMPLE_FILTER_ID))) .thenReturn(mockTasks); when(filterServiceMock.list(eq(EXAMPLE_FILTER_ID), any(Query.class))) .thenReturn(mockTasks); when(filterServiceMock.listPage(eq(EXAMPLE_FILTER_ID), anyInt(), anyInt())) .thenReturn(mockTasks); when(filterServiceMock.listPage(eq(EXAMPLE_FILTER_ID), any(Query.class), anyInt(), anyInt())) .thenReturn(mockTasks); when(filterServiceMock.count(eq(EXAMPLE_FILTER_ID))) .thenReturn((long) 1); when(filterServiceMock.count(eq(EXAMPLE_FILTER_ID), any(Query.class))) .thenReturn((long) 1); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).singleResult(eq(MockProvider.NON_EXISTING_ID)); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).singleResult(eq(MockProvider.NON_EXISTING_ID), any(Query.class)); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).list(eq(MockProvider.NON_EXISTING_ID)); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).list(eq(MockProvider.NON_EXISTING_ID), any(Query.class)); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).listPage(eq(MockProvider.NON_EXISTING_ID), anyInt(), anyInt()); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).listPage(eq(MockProvider.NON_EXISTING_ID), any(Query.class), anyInt(), anyInt()); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).count(eq(MockProvider.NON_EXISTING_ID)); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).count(eq(MockProvider.NON_EXISTING_ID), any(Query.class)); doThrow(new NullValueException("No filter found with given id")) .when(filterServiceMock).deleteFilter(eq(MockProvider.NON_EXISTING_ID)); authorizationServiceMock = mock(AuthorizationServiceImpl.class); identityServiceMock = mock(IdentityServiceImpl.class); processEngineConfigurationMock = mock(ProcessEngineConfiguration.class); when(processEngine.getAuthorizationService()).thenReturn(authorizationServiceMock); when(processEngine.getIdentityService()).thenReturn(identityServiceMock); when(processEngine.getProcessEngineConfiguration()).thenReturn(processEngineConfigurationMock); TaskService taskService = processEngine.getTaskService(); when(taskService.createTaskQuery()).thenReturn(new TaskQueryImpl()); variableInstanceQueryMock = mock(VariableInstanceQueryImpl.class); when(processEngine.getRuntimeService().createVariableInstanceQuery()) .thenReturn(variableInstanceQueryMock); when(variableInstanceQueryMock.variableScopeIdIn((String) anyVararg())) .thenReturn(variableInstanceQueryMock); when(variableInstanceQueryMock.variableNameIn((String) anyVararg())) .thenReturn(variableInstanceQueryMock); when(variableInstanceQueryMock.disableBinaryFetching()).thenReturn(variableInstanceQueryMock); when(variableInstanceQueryMock.disableCustomObjectDeserialization()).thenReturn(variableInstanceQueryMock); }
Example #18
Source File: FilterQueryMock.java From camunda-bpm-mockito with Apache License 2.0 | 4 votes |
public FilterQueryMock() { super(FilterQuery.class, FilterService.class); }
Example #19
Source File: AbstractProcessEngineServicesDelegate.java From camunda-bpm-assert-scenario with Apache License 2.0 | 4 votes |
public FilterService getFilterService() { return processEngine.getFilterService(); }
Example #20
Source File: SpringProcessEngineServicesConfiguration.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Bean(name = "filterService") @Override public FilterService getFilterService() { return processEngine.getFilterService(); }
Example #21
Source File: ProcessEngineServicesProducer.java From camunda-bpm-platform with Apache License 2.0 | votes |
@Produces @Named @ApplicationScoped public FilterService filterService() { return processEngine().getFilterService(); }
Example #22
Source File: NamedProcessEngineServicesProducer.java From camunda-bpm-platform with Apache License 2.0 | votes |
@Produces @ProcessEngineName("") public FilterService filterService(InjectionPoint ip) { return processEngine(ip).getFilterService(); }