當前位置: 首頁>>代碼示例>>Java>>正文


Java CaseDefinitionQuery類代碼示例

本文整理匯總了Java中org.camunda.bpm.engine.repository.CaseDefinitionQuery的典型用法代碼示例。如果您正苦於以下問題:Java CaseDefinitionQuery類的具體用法?Java CaseDefinitionQuery怎麽用?Java CaseDefinitionQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CaseDefinitionQuery類屬於org.camunda.bpm.engine.repository包,在下文中一共展示了CaseDefinitionQuery類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testQueryByTenantIdsIncludeDefinitionsWithoutTenantId

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByTenantIdsIncludeDefinitionsWithoutTenantId() {
  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .tenantIdIn(TENANT_ONE)
      .includeCaseDefinitionsWithoutTenantId();

  assertThat(query.count(), is(2L));

  query = repositoryService
      .createCaseDefinitionQuery()
      .tenantIdIn(TENANT_TWO)
      .includeCaseDefinitionsWithoutTenantId();

  assertThat(query.count(), is(2L));

  query = repositoryService
      .createCaseDefinitionQuery()
      .tenantIdIn(TENANT_ONE, TENANT_TWO)
      .includeCaseDefinitionsWithoutTenantId();

  assertThat(query.count(), is(3L));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:23,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例2: testQueryByKey

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByKey() {
  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY);
  // one definition for each tenant
  assertThat(query.count(), is(3L));

  query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .withoutTenantId();
  // one definition without tenant id
  assertThat(query.count(), is(1L));

  query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .tenantIdIn(TENANT_ONE);
  // one definition for tenant one
  assertThat(query.count(), is(1L));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:22,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例3: testQueryByLatestNoTenantIdSet

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByLatestNoTenantIdSet() {
  // deploy a second version for tenant one
  deploymentForTenant(TENANT_ONE, CMMN);

  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .latestVersion();
  // one definition for each tenant
  assertThat(query.count(), is(3L));

  Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
  assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
  assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
  assertThat(caseDefinitionsForTenant.get(null).getVersion(), is(1));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:17,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例4: testQueryByLatestWithTenantIds

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByLatestWithTenantIds() {
  // deploy a second version for tenant one
  deploymentForTenant(TENANT_ONE, CMMN);

  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .latestVersion()
      .tenantIdIn(TENANT_ONE, TENANT_TWO);
  // one definition for each tenant
  assertThat(query.count(), is(2L));

  Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
  assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(2));
  assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:17,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例5: testQueryByLatestWithoutTenantId

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByLatestWithoutTenantId() {
  // deploy a second version without tenant id
  deployment(CMMN);

  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .latestVersion()
      .withoutTenantId();

  assertThat(query.count(), is(1L));

  CaseDefinition cDefinition = query.singleResult();
  assertThat(cDefinition.getTenantId(), is(nullValue()));
  assertThat(cDefinition.getVersion(), is(2));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:17,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例6: testQueryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByLatestWithTenantIdsIncludeDefinitionsWithoutTenantId() {
  // deploy a second version without tenant id
  deployment(CMMN);
  // deploy a third version for tenant one
  deploymentForTenant(TENANT_ONE, CMMN);
  deploymentForTenant(TENANT_ONE, CMMN);

  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .latestVersion()
      .tenantIdIn(TENANT_ONE, TENANT_TWO)
      .includeCaseDefinitionsWithoutTenantId();

  assertThat(query.count(), is(3L));

  Map<String, CaseDefinition> caseDefinitionsForTenant = getCaseDefinitionsForTenant(query.list());
  assertThat(caseDefinitionsForTenant.get(TENANT_ONE).getVersion(), is(3));
  assertThat(caseDefinitionsForTenant.get(TENANT_TWO).getVersion(), is(1));
  assertThat(caseDefinitionsForTenant.get(null).getVersion(), is(2));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:22,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例7: testQueryByLatest

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByLatest() {
  CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();

  query
    .latestVersion();

  verifyQueryResults(query, 3);

  query
    .caseDefinitionKey("one")
    .latestVersion();

  verifyQueryResults(query, 1);

  query
    .caseDefinitionKey("two").latestVersion();
  verifyQueryResults(query, 1);
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:19,代碼來源:CaseDefinitionQueryTest.java

示例8: applySortBy

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
@Override
protected void applySortBy(CaseDefinitionQuery query, String sortBy, Map<String, Object> parameters, ProcessEngine engine) {
  if (sortBy.equals(SORT_BY_CATEGORY_VALUE)) {
    query.orderByCaseDefinitionCategory();
  } else if (sortBy.equals(SORT_BY_KEY_VALUE)) {
    query.orderByCaseDefinitionKey();
  } else if (sortBy.equals(SORT_BY_ID_VALUE)) {
    query.orderByCaseDefinitionId();
  } else if (sortBy.equals(SORT_BY_VERSION_VALUE)) {
    query.orderByCaseDefinitionVersion();
  } else if (sortBy.equals(SORT_BY_NAME_VALUE)) {
    query.orderByCaseDefinitionName();
  } else if (sortBy.equals(SORT_BY_DEPLOYMENT_ID_VALUE)) {
    query.orderByDeploymentId();
  } else if (sortBy.equals(SORT_BY_TENANT_ID)) {
    query.orderByTenantId();
  }
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:19,代碼來源:CaseDefinitionQueryDto.java

示例9: getCaseDefinitions

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
@Override
public List<CaseDefinitionDto> getCaseDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
  CaseDefinitionQueryDto queryDto = new CaseDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
  List<CaseDefinitionDto> definitions = new ArrayList<CaseDefinitionDto>();

  ProcessEngine engine = getProcessEngine();
  CaseDefinitionQuery query = queryDto.toQuery(engine);

  List<CaseDefinition> matchingDefinitions = null;

  if (firstResult != null || maxResults != null) {
    matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
  } else {
    matchingDefinitions = query.list();
  }

  for (CaseDefinition definition : matchingDefinitions) {
    CaseDefinitionDto def = CaseDefinitionDto.fromCaseDefinition(definition);
    definitions.add(def);
  }
  return definitions;
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:23,代碼來源:CaseDefinitionRestServiceImpl.java

示例10: setUpRuntimeData

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
private void setUpRuntimeData(CaseDefinition mockCaseDefinition) {
  repositoryServiceMock = mock(RepositoryService.class);

  when(processEngine.getRepositoryService()).thenReturn(repositoryServiceMock);
  when(repositoryServiceMock.getCaseDefinition(eq(MockProvider.EXAMPLE_CASE_DEFINITION_ID))).thenReturn(mockCaseDefinition);
  when(repositoryServiceMock.getCaseModel(eq(MockProvider.EXAMPLE_CASE_DEFINITION_ID))).thenReturn(createMockCaseDefinitionCmmnXml());

  caseDefinitionQueryMock = mock(CaseDefinitionQuery.class);
  when(caseDefinitionQueryMock.caseDefinitionKey(MockProvider.EXAMPLE_CASE_DEFINITION_KEY)).thenReturn(caseDefinitionQueryMock);
  when(caseDefinitionQueryMock.tenantIdIn(anyString())).thenReturn(caseDefinitionQueryMock);
  when(caseDefinitionQueryMock.withoutTenantId()).thenReturn(caseDefinitionQueryMock);
  when(caseDefinitionQueryMock.latestVersion()).thenReturn(caseDefinitionQueryMock);
  when(caseDefinitionQueryMock.singleResult()).thenReturn(mockCaseDefinition);
  when(caseDefinitionQueryMock.list()).thenReturn(Collections.singletonList(mockCaseDefinition));
  when(repositoryServiceMock.createCaseDefinitionQuery()).thenReturn(caseDefinitionQueryMock);
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:17,代碼來源:CaseDefinitionRestServiceInteractionTest.java

示例11: testQueryByTenantId

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByTenantId() {
  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .tenantIdIn(TENANT_ONE);

  assertThat(query.count(), is(1L));

  query = repositoryService.
      createCaseDefinitionQuery()
      .tenantIdIn(TENANT_TWO);

  assertThat(query.count(), is(1L));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:14,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例12: testQueryByTenantIds

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByTenantIds() {
  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .tenantIdIn(TENANT_ONE, TENANT_TWO);

  assertThat(query.count(), is(2L));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:8,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例13: testQueryByLatestWithTenantId

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByLatestWithTenantId() {
  // deploy a second version for tenant one
  deploymentForTenant(TENANT_ONE, CMMN);

  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .latestVersion()
      .tenantIdIn(TENANT_ONE);

  assertThat(query.count(), is(1L));

  CaseDefinition caseDefinition = query.singleResult();
  assertThat(caseDefinition.getTenantId(), is(TENANT_ONE));
  assertThat(caseDefinition.getVersion(), is(2));

  query = repositoryService
      .createCaseDefinitionQuery()
      .caseDefinitionKey(CASE_DEFINITION_KEY)
      .latestVersion()
      .tenantIdIn(TENANT_TWO);

  assertThat(query.count(), is(1L));

  caseDefinition = query.singleResult();
  assertThat(caseDefinition.getTenantId(), is(TENANT_TWO));
  assertThat(caseDefinition.getVersion(), is(1));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:29,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例14: testQueryByNonExistingTenantId

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryByNonExistingTenantId() {
  CaseDefinitionQuery query = repositoryService
      .createCaseDefinitionQuery()
      .tenantIdIn("nonExisting");

  assertThat(query.count(), is(0L));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:8,代碼來源:MultiTenancyCaseDefinitionQueryTest.java

示例15: testQueryAuthenticatedTenant

import org.camunda.bpm.engine.repository.CaseDefinitionQuery; //導入依賴的package包/類
public void testQueryAuthenticatedTenant() {
  identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));

  CaseDefinitionQuery query = repositoryService.createCaseDefinitionQuery();

  assertThat(query.count(), is(2L));
  assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
  assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
  assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeCaseDefinitionsWithoutTenantId().count(), is(2L));
}
 
開發者ID:camunda,項目名稱:camunda-bpm-platform,代碼行數:11,代碼來源:MultiTenancyCaseDefinitionQueryTest.java


注:本文中的org.camunda.bpm.engine.repository.CaseDefinitionQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。