Search in sources :

Example 1 with DecisionDefinition

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;
}
Also used : DecisionDefinitionQueryDto(org.camunda.bpm.engine.rest.dto.repository.DecisionDefinitionQueryDto) DecisionDefinitionQuery(org.camunda.bpm.engine.repository.DecisionDefinitionQuery) ArrayList(java.util.ArrayList) DecisionDefinitionDto(org.camunda.bpm.engine.rest.dto.repository.DecisionDefinitionDto) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 2 with DecisionDefinition

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();
}
Also used : DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition) Before(org.junit.Before)

Example 3 with DecisionDefinition

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();
    }
}
Also used : InputStream(java.io.InputStream) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 4 with DecisionDefinition

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);
        }
    });
}
Also used : InputStream(java.io.InputStream) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Example 5 with DecisionDefinition

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;
    }
}
Also used : InputStream(java.io.InputStream) GetDeploymentResourceCmd(org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd) DecisionDefinition(org.camunda.bpm.engine.repository.DecisionDefinition)

Aggregations

DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)68 Test (org.junit.Test)21 Deployment (org.camunda.bpm.engine.test.Deployment)18 DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)10 Date (java.util.Date)6 DmnDecisionTableResult (org.camunda.bpm.dmn.engine.DmnDecisionTableResult)5 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)5 InputStream (java.io.InputStream)4 ArrayList (java.util.ArrayList)4 DmnDecisionResult (org.camunda.bpm.dmn.engine.DmnDecisionResult)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricDecisionInstanceEntity (org.camunda.bpm.engine.impl.history.event.HistoricDecisionInstanceEntity)3 Response (com.jayway.restassured.response.Response)2 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)2 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)2