本文整理汇总了Java中org.camunda.bpm.engine.runtime.IncidentQuery类的典型用法代码示例。如果您正苦于以下问题:Java IncidentQuery类的具体用法?Java IncidentQuery怎么用?Java IncidentQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IncidentQuery类属于org.camunda.bpm.engine.runtime包,在下文中一共展示了IncidentQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSimpleQueryWithMultiple
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testSimpleQueryWithMultiple() {
// given
String processInstanceId = startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 1);
Incident incident = query.singleResult();
assertNotNull(incident);
assertEquals(processInstanceId, incident.getProcessInstanceId());
}
示例2: testQueryWithoutAuthorization
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryWithoutAuthorization() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 0);
}
示例3: testQueryWithReadPermissionOnProcessInstance
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryWithReadPermissionOnProcessInstance() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
String processInstanceId = startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY).getId();
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 1);
Incident incident = query.singleResult();
assertNotNull(incident);
assertEquals(processInstanceId, incident.getProcessInstanceId());
}
示例4: testQueryWithReadPermissionOnAnyProcessInstance
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryWithReadPermissionOnAnyProcessInstance() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 7);
}
示例5: testQueryWithReadInstancesPermissionOnOneTaskProcess
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryWithReadInstancesPermissionOnOneTaskProcess() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ_INSTANCE);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 3);
}
示例6: testQueryWithReadInstancesPermissionOnAnyProcessDefinition
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryWithReadInstancesPermissionOnAnyProcessDefinition() {
// given
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ANOTHER_ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_INSTANCE);
// when
IncidentQuery query = runtimeService.createIncidentQuery();
// then
verifyQueryResults(query, 7);
}
示例7: testQueryByCauseIncidentId
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
@Test
@Deployment(resources = {"org/camunda/bpm/engine/test/api/runtime/IncidentQueryTest.testQueryByCauseIncidentId.bpmn"})
public void testQueryByCauseIncidentId() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callFailingProcess");
testHelper.executeAvailableJobs();
ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstance.getId()).singleResult();
assertNotNull(subProcessInstance);
Incident causeIncident = runtimeService.createIncidentQuery().processInstanceId(subProcessInstance.getId()).singleResult();
assertNotNull(causeIncident);
IncidentQuery query = runtimeService.createIncidentQuery().causeIncidentId(causeIncident.getId());
assertEquals(2, query.count());
List<Incident> incidents = query.list();
assertFalse(incidents.isEmpty());
assertEquals(2, incidents.size());
}
示例8: applySortBy
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
@Override
protected void applySortBy(IncidentQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
if (sortBy.equals(SORT_BY_INCIDENT_ID)) {
query.orderByIncidentId();
} else if (sortBy.equals(SORT_BY_INCIDENT_TIMESTAMP)) {
query.orderByIncidentTimestamp();
} else if (sortBy.equals(SORT_BY_INCIDENT_TYPE)) {
query.orderByIncidentType();
} else if (sortBy.equals(SORT_BY_EXECUTION_ID)) {
query.orderByExecutionId();
} else if (sortBy.equals(SORT_BY_ACTIVITY_ID)) {
query.orderByActivityId();
} else if (sortBy.equals(SORT_BY_PROCESS_INSTANCE_ID)) {
query.orderByProcessInstanceId();
} else if (sortBy.equals(SORT_BY_PROCESS_DEFINITION_ID)) {
query.orderByProcessDefinitionId();
} else if (sortBy.equals(SORT_BY_CAUSE_INCIDENT_ID)) {
query.orderByCauseIncidentId();
} else if (sortBy.equals(SORT_BY_ROOT_CAUSE_INCIDENT_ID)) {
query.orderByRootCauseIncidentId();
} else if (sortBy.equals(SORT_BY_CONFIGURATION)) {
query.orderByConfiguration();
} else if (sortBy.equals(SORT_BY_TENANT_ID)) {
query.orderByTenantId();
}
}
示例9: getIncidents
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
@Override
public List<IncidentDto> getIncidents(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
IncidentQueryDto queryDto = new IncidentQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
IncidentQuery query = queryDto.toQuery(processEngine);
List<Incident> queryResult;
if (firstResult != null || maxResults != null) {
queryResult = executePaginatedQuery(query, firstResult, maxResults);
} else {
queryResult = query.list();
}
List<IncidentDto> result = new ArrayList<IncidentDto>();
for (Incident incident : queryResult) {
IncidentDto dto = IncidentDto.fromIncident(incident);
result.add(dto);
}
return result;
}
示例10: testQueryByTenantId
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryByTenantId() {
IncidentQuery query = runtimeService
.createIncidentQuery()
.tenantIdIn(TENANT_ONE);
assertThat(query.count(), is(1L));
query = runtimeService
.createIncidentQuery()
.tenantIdIn(TENANT_TWO);
assertThat(query.count(), is(1L));
}
示例11: testQueryByTenantIds
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryByTenantIds() {
IncidentQuery query = runtimeService
.createIncidentQuery()
.tenantIdIn(TENANT_ONE, TENANT_TWO);
assertThat(query.count(), is(2L));
}
示例12: testQueryByNonExistingTenantId
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryByNonExistingTenantId() {
IncidentQuery query = runtimeService
.createIncidentQuery()
.tenantIdIn("nonExisting");
assertThat(query.count(), is(0L));
}
示例13: testQueryAuthenticatedTenant
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
IncidentQuery query = runtimeService.createIncidentQuery();
assertThat(query.count(), is(1L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(1L));
}
示例14: testQueryAuthenticatedTenants
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryAuthenticatedTenants() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
IncidentQuery query = runtimeService.createIncidentQuery();
assertThat(query.count(), is(2L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
}
示例15: testQueryDisabledTenantCheck
import org.camunda.bpm.engine.runtime.IncidentQuery; //导入依赖的package包/类
public void testQueryDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
IncidentQuery query = runtimeService.createIncidentQuery();
assertThat(query.count(), is(2L));
}