Search in sources :

Example 1 with PropertyChange

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.

the class DeployCmd method createUserOperationLog.

protected void createUserOperationLog(DeploymentBuilderImpl deploymentBuilder, Deployment deployment, CommandContext commandContext) {
    UserOperationLogManager logManager = commandContext.getOperationLogManager();
    List<PropertyChange> properties = new ArrayList<PropertyChange>();
    PropertyChange filterDuplicate = new PropertyChange("duplicateFilterEnabled", null, deploymentBuilder.isDuplicateFilterEnabled());
    properties.add(filterDuplicate);
    if (deploymentBuilder.isDuplicateFilterEnabled()) {
        PropertyChange deployChangedOnly = new PropertyChange("deployChangedOnly", null, deploymentBuilder.isDeployChangedOnly());
        properties.add(deployChangedOnly);
    }
    logManager.logDeploymentOperation(UserOperationLogEntry.OPERATION_TYPE_CREATE, deployment.getId(), properties);
}
Also used : UserOperationLogManager(org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager) PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) ArrayList(java.util.ArrayList)

Example 2 with PropertyChange

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.

the class CreateAttachmentCmd method execute.

@Override
public Attachment execute(CommandContext commandContext) {
    if (taskId != null) {
        task = commandContext.getTaskManager().findTaskById(taskId);
    } else {
        ensureNotNull("taskId or processInstanceId has to be provided", this.processInstanceId);
        List<ExecutionEntity> executionsByProcessInstanceId = commandContext.getExecutionManager().findExecutionsByProcessInstanceId(processInstanceId);
        ensureNumberOfElements("processInstances", executionsByProcessInstanceId, 1);
        processInstance = executionsByProcessInstanceId.get(0);
    }
    AttachmentEntity attachment = new AttachmentEntity();
    attachment.setName(attachmentName);
    attachment.setDescription(attachmentDescription);
    attachment.setType(attachmentType);
    attachment.setTaskId(taskId);
    attachment.setProcessInstanceId(processInstanceId);
    attachment.setUrl(url);
    DbEntityManager dbEntityManger = commandContext.getDbEntityManager();
    dbEntityManger.insert(attachment);
    if (content != null) {
        byte[] bytes = IoUtil.readInputStream(content, attachmentName);
        ByteArrayEntity byteArray = new ByteArrayEntity(bytes);
        dbEntityManger.insert(byteArray);
        attachment.setContentId(byteArray.getId());
    }
    PropertyChange propertyChange = new PropertyChange("name", null, attachmentName);
    if (task != null) {
        commandContext.getOperationLogManager().logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_ADD_ATTACHMENT, task, propertyChange);
    } else if (processInstance != null) {
        commandContext.getOperationLogManager().logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_ADD_ATTACHMENT, processInstance, propertyChange);
    }
    return attachment;
}
Also used : PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ByteArrayEntity(org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity) AttachmentEntity(org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity) DbEntityManager(org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)

Example 3 with PropertyChange

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.

the class DeleteDeploymentCmd method execute.

public Void execute(final CommandContext commandContext) {
    ensureNotNull("deploymentId", deploymentId);
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
        checker.checkDeleteDeployment(deploymentId);
    }
    UserOperationLogManager logManager = commandContext.getOperationLogManager();
    List<PropertyChange> propertyChanges = Arrays.asList(new PropertyChange("cascade", null, cascade));
    logManager.logDeploymentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE, deploymentId, propertyChanges);
    commandContext.getDeploymentManager().deleteDeployment(deploymentId, cascade, skipCustomListeners, skipIoMappings);
    ProcessApplicationReference processApplicationReference = Context.getProcessEngineConfiguration().getProcessApplicationManager().getProcessApplicationForDeployment(deploymentId);
    DeleteDeploymentFailListener listener = new DeleteDeploymentFailListener(deploymentId, processApplicationReference, Context.getProcessEngineConfiguration().getCommandExecutorTxRequiresNew());
    try {
        commandContext.runWithoutAuthorization(new Callable<Void>() {

            public Void call() throws Exception {
                new UnregisterProcessApplicationCmd(deploymentId, false).execute(commandContext);
                new UnregisterDeploymentCmd(Collections.singleton(deploymentId)).execute(commandContext);
                return null;
            }
        });
    } finally {
        try {
            commandContext.getTransactionContext().addTransactionListener(TransactionState.ROLLED_BACK, listener);
        } catch (Exception e) {
            TX_LOG.debugTransactionOperation("Could not register transaction synchronization. Probably the TX has already been rolled back by application code.");
            listener.execute(commandContext);
        }
    }
    return null;
}
Also used : UserOperationLogManager(org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager) ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) DeleteDeploymentFailListener(org.camunda.bpm.engine.impl.persistence.deploy.DeleteDeploymentFailListener) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 4 with PropertyChange

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.

the class AbstractSetJobDefinitionStateCmd method logUserOperation.

@Override
protected void logUserOperation(CommandContext commandContext) {
    PropertyChange propertyChange = new PropertyChange(SUSPENSION_STATE_PROPERTY, null, getNewSuspensionState().getName());
    commandContext.getOperationLogManager().logJobDefinitionOperation(getLogEntryOperation(), jobDefinitionId, processDefinitionId, processDefinitionKey, propertyChange);
}
Also used : PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange)

Example 5 with PropertyChange

use of org.camunda.bpm.engine.impl.persistence.entity.PropertyChange in project camunda-bpm-platform by camunda.

the class AbstractSetJobStateCmd method logUserOperation.

@Override
protected void logUserOperation(CommandContext commandContext) {
    PropertyChange propertyChange = new PropertyChange(SUSPENSION_STATE_PROPERTY, null, getNewSuspensionState().getName());
    commandContext.getOperationLogManager().logJobOperation(getLogEntryOperation(), jobId, jobDefinitionId, processInstanceId, processDefinitionId, processDefinitionKey, propertyChange);
}
Also used : PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange)

Aggregations

PropertyChange (org.camunda.bpm.engine.impl.persistence.entity.PropertyChange)35 ArrayList (java.util.ArrayList)12 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)4 UserOperationLogContextEntry (org.camunda.bpm.engine.impl.oplog.UserOperationLogContextEntry)4 TaskEntity (org.camunda.bpm.engine.impl.persistence.entity.TaskEntity)4 AttachmentEntity (org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity)3 UserOperationLogManager (org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager)3 Date (java.util.Date)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)2 JobDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.JobDefinitionEntity)2 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)2 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)1 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)1 DbEntityManager (org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager)1 HistoryLevel (org.camunda.bpm.engine.impl.history.HistoryLevel)1 HistoryEvent (org.camunda.bpm.engine.impl.history.event.HistoryEvent)1 HistoryEventProcessor (org.camunda.bpm.engine.impl.history.event.HistoryEventProcessor)1 HistoryEventProducer (org.camunda.bpm.engine.impl.history.producer.HistoryEventProducer)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1