Search in sources :

Example 6 with DeploymentEntity

use of org.activiti.engine.impl.persistence.entity.DeploymentEntity in project Activiti by Activiti.

the class ExecutionContext method getDeployment.

public DeploymentEntity getDeployment() {
    String deploymentId = getProcessDefinition().getDeploymentId();
    DeploymentEntity deployment = Context.getCommandContext().getDeploymentEntityManager().findDeploymentById(deploymentId);
    return deployment;
}
Also used : DeploymentEntity(org.activiti.engine.impl.persistence.entity.DeploymentEntity)

Example 7 with DeploymentEntity

use of org.activiti.engine.impl.persistence.entity.DeploymentEntity in project Activiti by Activiti.

the class SetDeploymentCategoryCmd method execute.

public Void execute(CommandContext commandContext) {
    if (deploymentId == null) {
        throw new ActivitiIllegalArgumentException("Deployment id is null");
    }
    DeploymentEntity deployment = commandContext.getDeploymentEntityManager().findDeploymentById(deploymentId);
    if (deployment == null) {
        throw new ActivitiObjectNotFoundException("No deployment found for id = '" + deploymentId + "'", Deployment.class);
    }
    // Update category
    deployment.setCategory(category);
    if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
        commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, deployment));
    }
    return null;
}
Also used : DeploymentEntity(org.activiti.engine.impl.persistence.entity.DeploymentEntity) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) ActivitiObjectNotFoundException(org.activiti.engine.ActivitiObjectNotFoundException)

Example 8 with DeploymentEntity

use of org.activiti.engine.impl.persistence.entity.DeploymentEntity in project Activiti by Activiti.

the class DeploymentCreateTransformer method apply.

@Override
public SimulationEvent apply(ActivitiEvent event) {
    if (ActivitiEventType.ENTITY_CREATED.equals(event.getType()) && (event instanceof ActivitiEntityEvent) && ((ActivitiEntityEvent) event).getEntity() instanceof DeploymentEntity) {
        DeploymentEntity deploymentEntity = (DeploymentEntity) ((ActivitiEntityEvent) event).getEntity();
        Map<String, Object> simEventProperties = new HashMap<String, Object>();
        simEventProperties.put(resourcesKey, deploymentEntity.getResources());
        return new SimulationEvent.Builder(simulationEventType).simulationTime(Context.getProcessEngineConfiguration().getClock().getCurrentTime().getTime()).properties(simEventProperties).build();
    }
    return null;
}
Also used : DeploymentEntity(org.activiti.engine.impl.persistence.entity.DeploymentEntity) HashMap(java.util.HashMap) ActivitiEntityEvent(org.activiti.engine.delegate.event.ActivitiEntityEvent) SimulationEvent(org.activiti.crystalball.simulator.SimulationEvent)

Example 9 with DeploymentEntity

use of org.activiti.engine.impl.persistence.entity.DeploymentEntity in project Activiti by Activiti.

the class ProcessDefinitionsTest method testDeployments.

@Test
public void testDeployments() {
    when(repositoryService.createDeploymentQuery()).thenReturn(deploymentQuery);
    DeploymentEntity deployment = new DeploymentEntity();
    List<Deployment> deploymentList = new ArrayList<Deployment>();
    deployment.setId("testDeploymentId");
    deployment.setName("testDeploymentName");
    deployment.setTenantId("tenantId");
    deploymentList.add(deployment);
    when(deploymentQuery.list()).thenReturn(deploymentList);
    List<List<String>> result = processDefinitionsMBean.getDeployments();
    assertNotNull(result);
    assertEquals(1, result.size());
    assertEquals(3, result.get(0).size());
    assertEquals("testDeploymentId", result.get(0).get(0));
    assertEquals("testDeploymentName", result.get(0).get(1));
    assertEquals("tenantId", result.get(0).get(2));
}
Also used : DeploymentEntity(org.activiti.engine.impl.persistence.entity.DeploymentEntity) ArrayList(java.util.ArrayList) Deployment(org.activiti.engine.repository.Deployment) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Aggregations

DeploymentEntity (org.activiti.engine.impl.persistence.entity.DeploymentEntity)9 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ActivitiException (org.activiti.engine.ActivitiException)2 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)2 Deployment (org.activiti.engine.repository.Deployment)2 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)2 List (java.util.List)1 SimulationEvent (org.activiti.crystalball.simulator.SimulationEvent)1 ActivitiEntityEvent (org.activiti.engine.delegate.event.ActivitiEntityEvent)1 ActivitiEventDispatcher (org.activiti.engine.delegate.event.ActivitiEventDispatcher)1 ProcessDefinitionQueryImpl (org.activiti.engine.impl.ProcessDefinitionQueryImpl)1 DeploymentEntityManager (org.activiti.engine.impl.persistence.entity.DeploymentEntityManager)1 KnowledgeBase (org.drools.KnowledgeBase)1 Test (org.junit.Test)1