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;
}
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;
}
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;
}
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));
}
Aggregations