use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class AbstractPaLocalScriptEngineTest method getProcessApplication.
protected ProcessApplicationInterface getProcessApplication() {
ProcessApplicationReference reference = processEngineConfiguration.getCommandExecutorTxRequired().execute(new Command<ProcessApplicationReference>() {
public ProcessApplicationReference execute(CommandContext commandContext) {
ProcessDefinitionEntity definition = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionByKey(PROCESS_ID);
String deploymentId = definition.getDeploymentId();
ProcessApplicationManager processApplicationManager = processEngineConfiguration.getProcessApplicationManager();
return processApplicationManager.getProcessApplicationForDeployment(deploymentId);
}
});
assertNotNull(reference);
ProcessApplicationInterface processApplication = null;
try {
processApplication = reference.getProcessApplication();
} catch (ProcessApplicationUnavailableException e) {
fail("Could not retrieve process application");
}
return processApplication.getRawObject();
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class CdiEventListener method createEvent.
protected BusinessProcessEvent createEvent(DelegateTask task) {
ExecutionContext executionContext = Context.getExecutionContext();
ProcessDefinitionEntity processDefinition = null;
if (executionContext != null) {
processDefinition = executionContext.getProcessDefinition();
}
// map type
String eventName = task.getEventName();
BusinessProcessEventType type = null;
if (TaskListener.EVENTNAME_CREATE.equals(eventName)) {
type = BusinessProcessEventType.CREATE_TASK;
} else if (TaskListener.EVENTNAME_ASSIGNMENT.equals(eventName)) {
type = BusinessProcessEventType.ASSIGN_TASK;
} else if (TaskListener.EVENTNAME_COMPLETE.equals(eventName)) {
type = BusinessProcessEventType.COMPLETE_TASK;
} else if (TaskListener.EVENTNAME_DELETE.equals(eventName)) {
type = BusinessProcessEventType.DELETE_TASK;
}
return new CdiBusinessProcessEvent(task, processDefinition, type, ClockUtil.getCurrentTime());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class BpmnDeployer method definitionAddedToDeploymentCache.
@Override
protected void definitionAddedToDeploymentCache(DeploymentEntity deployment, ProcessDefinitionEntity definition, Properties properties) {
List<JobDeclaration<?, ?>> declarations = properties.get(JOB_DECLARATIONS_PROPERTY).get(definition.getKey());
updateJobDeclarations(declarations, definition, deployment.isNew());
ProcessDefinitionEntity latestDefinition = findLatestDefinitionByKeyAndTenantId(definition.getKey(), definition.getTenantId());
if (deployment.isNew()) {
adjustStartEventSubscriptions(definition, latestDefinition);
}
// add "authorizations"
addAuthorizations(definition);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class AbstractCorrelateMessageCmd method checkAuthorization.
protected void checkAuthorization(CorrelationHandlerResult correlation) {
CommandContext commandContext = Context.getCommandContext();
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
if (MessageCorrelationResultType.Execution.equals(correlation.getResultType())) {
ExecutionEntity execution = correlation.getExecutionEntity();
checker.checkUpdateProcessInstanceById(execution.getProcessInstanceId());
} else {
ProcessDefinitionEntity definition = correlation.getProcessDefinitionEntity();
checker.checkCreateProcessInstance(definition);
}
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationBatchCmd method execute.
@Override
public Batch execute(CommandContext commandContext) {
List<AbstractProcessInstanceModificationCommand> instructions = builder.getInstructions();
Collection<String> processInstanceIds = collectProcessInstanceIds(commandContext);
ensureNotEmpty(BadUserRequestException.class, "Modification instructions cannot be empty", instructions);
ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot be empty", "Process instance ids", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "Process instance ids", processInstanceIds);
commandContext.getAuthorizationManager().checkAuthorization(Permissions.CREATE, Resources.BATCH);
ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, builder.getProcessDefinitionId());
ensureNotNull(BadUserRequestException.class, "Process definition id cannot be null", processDefinition);
writeUserOperationLog(commandContext, processDefinition, processInstanceIds.size(), true);
BatchEntity batch = createBatch(commandContext, instructions, processInstanceIds, processDefinition);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
Aggregations