use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initHistoricIdentityLinkEvent.
protected void initHistoricIdentityLinkEvent(HistoricIdentityLinkLogEventEntity evt, IdentityLink identityLink, HistoryEventType eventType) {
if (identityLink.getTaskId() != null) {
TaskEntity task = Context.getCommandContext().getTaskManager().findTaskById(identityLink.getTaskId());
evt.setProcessDefinitionId(task.getProcessDefinitionId());
if (task.getProcessDefinition() != null) {
evt.setProcessDefinitionKey(task.getProcessDefinition().getKey());
}
}
if (identityLink.getProcessDefId() != null) {
evt.setProcessDefinitionId(identityLink.getProcessDefId());
ProcessDefinitionEntity definition = Context.getProcessEngineConfiguration().getDeploymentCache().findProcessDefinitionFromCache(identityLink.getProcessDefId());
evt.setProcessDefinitionKey(definition.getKey());
}
evt.setTime(ClockUtil.getCurrentTime());
evt.setType(identityLink.getType());
evt.setUserId(identityLink.getUserId());
evt.setGroupId(identityLink.getGroupId());
evt.setTaskId(identityLink.getTaskId());
evt.setTenantId(identityLink.getTenantId());
// There is a conflict in HistoryEventTypes for 'delete' keyword,
// So HistoryEventTypes.IDENTITY_LINK_ADD /
// HistoryEventTypes.IDENTITY_LINK_DELETE is provided with the event name
// 'add-identity-link' /'delete-identity-link'
// and changed to 'add'/'delete' (While inserting it into the database) on
// Historic identity link add / delete event
String operationType = "add";
if (eventType.getEventName().equals(HistoryEventTypes.IDENTITY_LINK_DELETE.getEventName())) {
operationType = "delete";
}
evt.setOperationType(operationType);
evt.setEventType(eventType.getEventName());
evt.setAssignerId(Context.getCommandContext().getAuthenticatedUserId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method createFormPropertyUpdateEvt.
// form Properties ///////////////////////////
public HistoryEvent createFormPropertyUpdateEvt(ExecutionEntity execution, String propertyId, String propertyValue, String taskId) {
final IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
HistoricFormPropertyEventEntity historicFormPropertyEntity = newHistoricFormPropertyEvent();
historicFormPropertyEntity.setId(idGenerator.getNextId());
historicFormPropertyEntity.setEventType(HistoryEventTypes.FORM_PROPERTY_UPDATE.getEventName());
historicFormPropertyEntity.setTimestamp(ClockUtil.getCurrentTime());
historicFormPropertyEntity.setActivityInstanceId(execution.getActivityInstanceId());
historicFormPropertyEntity.setExecutionId(execution.getId());
historicFormPropertyEntity.setProcessDefinitionId(execution.getProcessDefinitionId());
historicFormPropertyEntity.setProcessInstanceId(execution.getProcessInstanceId());
historicFormPropertyEntity.setPropertyId(propertyId);
historicFormPropertyEntity.setPropertyValue(propertyValue);
historicFormPropertyEntity.setTaskId(taskId);
historicFormPropertyEntity.setTenantId(execution.getTenantId());
historicFormPropertyEntity.setUserOperationId(Context.getCommandContext().getOperationId());
ProcessDefinitionEntity definition = execution.getProcessDefinition();
if (definition != null) {
historicFormPropertyEntity.setProcessDefinitionKey(definition.getKey());
}
// initialize sequence counter
initSequenceCounter(execution, historicFormPropertyEntity);
return historicFormPropertyEntity;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class MigrateProcessInstanceBatchCmd method execute.
@Override
public Batch execute(CommandContext commandContext) {
MigrationPlan migrationPlan = executionBuilder.getMigrationPlan();
Collection<String> processInstanceIds = collectProcessInstanceIds(commandContext);
ensureNotNull(BadUserRequestException.class, "Migration plan cannot be null", "migration plan", migrationPlan);
ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot empty", "process instance ids", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "process instance ids", processInstanceIds);
ProcessDefinitionEntity sourceProcessDefinition = resolveSourceProcessDefinition(commandContext);
ProcessDefinitionEntity targetProcessDefinition = resolveTargetProcessDefinition(commandContext);
checkAuthorizations(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds);
writeUserOperationLog(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds.size(), true);
BatchEntity batch = createBatch(commandContext, migrationPlan, processInstanceIds, sourceProcessDefinition);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class MigrationBatchJobHandler method postProcessJob.
@Override
protected void postProcessJob(MigrationBatchConfiguration configuration, JobEntity job) {
CommandContext commandContext = Context.getCommandContext();
String sourceProcessDefinitionId = configuration.getMigrationPlan().getSourceProcessDefinitionId();
ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, sourceProcessDefinitionId);
job.setDeploymentId(processDefinition.getDeploymentId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity in project camunda-bpm-platform by camunda.
the class UserOperationLogContextEntryBuilder method inContextOf.
public UserOperationLogContextEntryBuilder inContextOf(ExecutionEntity execution) {
entry.setProcessInstanceId(execution.getProcessInstanceId());
entry.setProcessDefinitionId(execution.getProcessDefinitionId());
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) execution.getProcessDefinition();
entry.setProcessDefinitionKey(processDefinition.getKey());
entry.setDeploymentId(processDefinition.getDeploymentId());
return this;
}
Aggregations