本文整理匯總了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));
}