use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceImpl method getDecisionDefinitions.
@Override
public List<DecisionDefinitionDto> getDecisionDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
DecisionDefinitionQueryDto queryDto = new DecisionDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
List<DecisionDefinitionDto> definitions = new ArrayList<DecisionDefinitionDto>();
ProcessEngine engine = getProcessEngine();
DecisionDefinitionQuery query = queryDto.toQuery(engine);
List<DecisionDefinition> matchingDefinitions = null;
if (firstResult != null || maxResults != null) {
matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingDefinitions = query.list();
}
for (DecisionDefinition definition : matchingDefinitions) {
DecisionDefinitionDto def = DecisionDefinitionDto.fromDecisionDefinition(definition);
definitions.add(def);
}
return definitions;
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionRestServiceInteractionTest method setUpRuntime.
@Before
public void setUpRuntime() {
DecisionDefinition mockDecisionDefinition = MockProvider.createMockDecisionDefinition();
setUpRuntimeData(mockDecisionDefinition);
setUpDecisionService();
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class DecisionDefinitionResourceImpl method getDecisionDefinitionDiagram.
@Override
public Response getDecisionDefinitionDiagram() {
DecisionDefinition definition = engine.getRepositoryService().getDecisionDefinition(decisionDefinitionId);
InputStream decisionDiagram = engine.getRepositoryService().getDecisionDiagram(decisionDefinitionId);
if (decisionDiagram == null) {
return Response.noContent().build();
} else {
String fileName = definition.getDiagramResourceName();
return Response.ok(decisionDiagram).header("Content-Disposition", "attachment; filename=" + fileName).type(ProcessDefinitionResourceImpl.getMediaTypeForFileSuffix(fileName)).build();
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class GetDeploymentDecisionModelCmd method execute.
public InputStream execute(final CommandContext commandContext) {
DecisionDefinition decisionDefinition = new GetDeploymentDecisionDefinitionCmd(decisionDefinitionId).execute(commandContext);
final String deploymentId = decisionDefinition.getDeploymentId();
final String resourceName = decisionDefinition.getResourceName();
return commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
}
});
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class GetDeploymentDecisionDiagramCmd method execute.
public InputStream execute(final CommandContext commandContext) {
DecisionDefinition decisionDefinition = new GetDeploymentDecisionDefinitionCmd(decisionDefinitionId).execute(commandContext);
final String deploymentId = decisionDefinition.getDeploymentId();
final String resourceName = decisionDefinition.getDiagramResourceName();
if (resourceName != null) {
return commandContext.runWithoutAuthorization(new Callable<InputStream>() {
public InputStream call() throws Exception {
return new GetDeploymentResourceCmd(deploymentId, resourceName).execute(commandContext);
}
});
} else {
return null;
}
}
Aggregations