本文整理了Java中org.camunda.bpm.engine.RepositoryService.getProcessDefinition
方法的一些代码示例,展示了RepositoryService.getProcessDefinition
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryService.getProcessDefinition
方法的具体详情如下:
包路径:org.camunda.bpm.engine.RepositoryService
类名称:RepositoryService
方法名:getProcessDefinition
[英]Returns the ProcessDefinition including all BPMN information like additional Properties (e.g. documentation).
[中]返回ProcessDefinition,包括所有BPMN信息,如其他属性(例如文档)。
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public Response getProcessDefinitionDiagram() {
ProcessDefinition definition = engine.getRepositoryService().getProcessDefinition(processDefinitionId);
InputStream processDiagram = engine.getRepositoryService().getProcessDiagram(processDefinitionId);
if (processDiagram == null) {
return Response.noContent().build();
} else {
String fileName = definition.getDiagramResourceName();
return Response.ok(processDiagram)
.header("Content-Disposition", "attachment; filename=" + fileName)
.type(getMediaTypeForFileSuffix(fileName)).build();
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public static String getApplicationPathByProcessDefinitionId(ProcessEngine engine, String processDefinitionId) {
ProcessDefinition processDefinition = engine.getRepositoryService().getProcessDefinition(processDefinitionId);
if (processDefinition == null) {
return null;
}
return getApplicationPathForDeployment(engine, processDefinition.getDeploymentId());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public ProcessDefinitionDto getProcessDefinition() {
RepositoryService repoService = engine.getRepositoryService();
ProcessDefinition definition;
try {
definition = repoService.getProcessDefinition(processDefinitionId);
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, "No matching definition with id " + processDefinitionId);
}
ProcessDefinitionDto result = ProcessDefinitionDto.fromProcessDefinition(definition);
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public ProcessDefinitionDto getProcessDefinition() {
RepositoryService repoService = engine.getRepositoryService();
ProcessDefinition definition;
try {
definition = repoService.getProcessDefinition(processDefinitionId);
} catch (ProcessEngineException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e, "No matching definition with id " + processDefinitionId);
}
ProcessDefinitionDto result = ProcessDefinitionDto.fromProcessDefinition(definition);
return result;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public static String getApplicationPathByProcessDefinitionId(ProcessEngine engine, String processDefinitionId) {
ProcessDefinition processDefinition = engine.getRepositoryService().getProcessDefinition(processDefinitionId);
if (processDefinition == null) {
return null;
}
return getApplicationPathForDeployment(engine, processDefinition.getDeploymentId());
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public String getProperty(HistoricExternalTaskLog obj) {
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(obj.getProcessDefinitionId());
return processDefinition.getKey();
}
});
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public String getProperty(HistoricJobLog obj) {
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(obj.getProcessDefinitionId());
return processDefinition.getKey();
}
});
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void getProcessDefinitionWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
ProcessDefinition definition = repositoryService.getProcessDefinition(processDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testNonExistingProcessDefinitionRetrieval() {
String nonExistingId = "aNonExistingDefinitionId";
when(repositoryServiceMock.getProcessDefinition(eq(nonExistingId))).thenThrow(new ProcessEngineException("no matching definition"));
given().pathParam("id", "aNonExistingDefinitionId")
.then().expect()
.statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON)
.body("type", equalTo(InvalidRequestException.class.getSimpleName()))
.body("message", equalTo("No matching definition with id " + nonExistingId))
.when().get(SINGLE_PROCESS_DEFINITION_URL);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testProcessDiagramNotExist() {
// setup additional mock behavior
when(repositoryServiceMock.getProcessDiagram(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).thenReturn(null);
// call method
given().pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)
.expect().statusCode(Status.NO_CONTENT.getStatusCode())
.when().get(DIAGRAM_DEFINITION_URL);
// verify service interaction
verify(repositoryServiceMock).getProcessDefinition(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
verify(repositoryServiceMock).getProcessDiagram(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void updateHistoryTimeToLiveWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinitionId, 6);
ProcessDefinition definition = repositoryService.getProcessDefinition(processDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
assertThat(definition.getHistoryTimeToLive(), is(6));
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Assuming that the task belongs to no process definition
*/
@Test
public void getFormForIndependentTask() {
when(mockTask.getProcessDefinitionId()).thenReturn(null);
given().pathParam("id", EXAMPLE_TASK_ID)
.header("accept", MediaType.APPLICATION_JSON)
.then().expect().statusCode(Status.OK.getStatusCode())
.body("key", equalTo(MockProvider.EXAMPLE_FORM_KEY))
.body("contextPath", nullValue())
.when().get(TASK_FORM_URL);
verify(repositoryServiceMock, never()).getProcessDefinition(null);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void getProcessDefinitionDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
ProcessDefinition definition = repositoryService.getProcessDefinition(processDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testProcessDefinitionServiceEngineAccess() {
given().pathParam("name", EXAMPLE_ENGINE_NAME)
.pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)
.then().expect()
.statusCode(Status.OK.getStatusCode())
.when().get(PROCESS_DEFINITION_URL);
verify(mockRepoService).getProcessDefinition(eq(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID));
verifyZeroInteractions(processEngine);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void testGetProcessDiagramGetDefinitionThrowsAuthorizationException() {
String message = "expected exception";
when(repositoryServiceMock.getProcessDefinition(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).thenThrow(new AuthorizationException(message));
given()
.pathParam("id", MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)
.then().expect()
.statusCode(Status.FORBIDDEN.getStatusCode()).contentType(ContentType.JSON)
.body("type", equalTo(AuthorizationException.class.getSimpleName()))
.body("message", equalTo(message))
.when()
.get(DIAGRAM_DEFINITION_URL);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public ProcessInstanceSnapshotBuilder deploymentId() {
String deploymentId = processEngine.getRepositoryService().getProcessDefinition(snapshot.getProcessDefinitionId()).getDeploymentId();
snapshot.setDeploymentId(deploymentId);
return this;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testGetProcessDefinition() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_TASK_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ONE_TASK_PROCESS_KEY, userId, READ);
// when
ProcessDefinition definition = repositoryService.getProcessDefinition(processDefinitionId);
// then
assertNotNull(definition);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void failToGetProcessDefinitionNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
// declare expected exception
thrown.expect(ProcessEngineException.class);
thrown.expectMessage("Cannot get the process definition");
repositoryService.getProcessDefinition(processDefinitionId);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void updateHistoryTimeToLiveDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinitionId, 6);
ProcessDefinition definition = repositoryService.getProcessDefinition(processDefinitionId);
assertThat(definition.getTenantId(), is(TENANT_ONE));
assertThat(definition.getHistoryTimeToLive(), is(6));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public String getProperty(Execution obj) {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery()
.processInstanceId(obj.getProcessInstanceId()).singleResult();
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processInstance.getProcessDefinitionId());
return processDefinition.getKey();
}
});
内容来源于网络,如有侵权,请联系作者删除!