Search in sources :

Example 31 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class DeploymentResourceImpl method deleteDeployment.

@Override
public void deleteDeployment(String deploymentId, UriInfo uriInfo) {
    RepositoryService repositoryService = getProcessEngine().getRepositoryService();
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
    if (deployment == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' do not exist");
    }
    boolean cascade = isQueryPropertyEnabled(uriInfo, CASCADE);
    boolean skipCustomListeners = isQueryPropertyEnabled(uriInfo, "skipCustomListeners");
    boolean skipIoMappings = isQueryPropertyEnabled(uriInfo, "skipIoMappings");
    repositoryService.deleteDeployment(deploymentId, cascade, skipCustomListeners, skipIoMappings);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 32 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class DeploymentResourceImpl method getDeployment.

public DeploymentDto getDeployment() {
    RepositoryService repositoryService = getProcessEngine().getRepositoryService();
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
    if (deployment == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' does not exist");
    }
    return DeploymentDto.fromDeployment(deployment);
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 33 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class DeployCmd method scheduleProcessDefinitionActivation.

protected void scheduleProcessDefinitionActivation(CommandContext commandContext, DeploymentEntity deployment) {
    if (deploymentBuilder.getProcessDefinitionsActivationDate() != null) {
        RepositoryService repositoryService = commandContext.getProcessEngineConfiguration().getRepositoryService();
        for (ProcessDefinition processDefinition : deployment.getDeployedProcessDefinitions()) {
            // If activation date is set, we first suspend all the process definition
            repositoryService.updateProcessDefinitionSuspensionState().byProcessDefinitionId(processDefinition.getId()).suspend();
            // And we schedule an activation at the provided date
            repositoryService.updateProcessDefinitionSuspensionState().byProcessDefinitionId(processDefinition.getId()).executionDate(deploymentBuilder.getProcessDefinitionsActivationDate()).activate();
        }
    }
}
Also used : RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 34 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class CmmnDeployerTest method testCmmnDeployment.

public void testCmmnDeployment() {
    String deploymentId = processEngine.getRepositoryService().createDeployment().addClasspathResource("org/camunda/bpm/engine/test/cmmn/deployment/CmmnDeploymentTest.testSimpleDeployment.cmmn").deploy().getId();
    // there should be one deployment
    RepositoryService repositoryService = processEngine.getRepositoryService();
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    assertEquals(1, deploymentQuery.count());
    // there should be one case definition
    CaseDefinitionQuery query = processEngine.getRepositoryService().createCaseDefinitionQuery();
    assertEquals(1, query.count());
    CaseDefinition caseDefinition = query.singleResult();
    assertEquals("Case_1", caseDefinition.getKey());
    processEngine.getRepositoryService().deleteDeployment(deploymentId);
}
Also used : RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 35 with RepositoryService

use of org.camunda.bpm.engine.RepositoryService in project camunda-bpm-platform by camunda.

the class CmmnDeployerTest method verifyCmmnResourceDeployed.

protected void verifyCmmnResourceDeployed(String resourcePath) {
    String deploymentId = processEngine.getRepositoryService().createDeployment().addClasspathResource(resourcePath).deploy().getId();
    // there should be one deployment
    RepositoryService repositoryService = processEngine.getRepositoryService();
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    assertEquals(1, deploymentQuery.count());
    // there should be one case definition
    CaseDefinitionQuery query = processEngine.getRepositoryService().createCaseDefinitionQuery();
    assertEquals(1, query.count());
    CaseDefinition caseDefinition = query.singleResult();
    assertEquals("Case_1", caseDefinition.getKey());
    processEngine.getRepositoryService().deleteDeployment(deploymentId);
}
Also used : RepositoryService(org.camunda.bpm.engine.RepositoryService)

Aggregations

RepositoryService (org.camunda.bpm.engine.RepositoryService)57 Test (org.junit.Test)24 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)23 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)13 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)10 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)9 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)8 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)6 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)5 ProcessApplicationDeploymentInfo (org.camunda.bpm.application.ProcessApplicationDeploymentInfo)5 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)5 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)5 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)4 RuntimeService (org.camunda.bpm.engine.RuntimeService)4 Deployment (org.camunda.bpm.engine.repository.Deployment)4 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)4 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)3 NotValidException (org.camunda.bpm.engine.exception.NotValidException)3