Search in sources :

Example 26 with PropertyChange

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

the class AbstractSetProcessDefinitionStateCmd method logUserOperation.

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

Example 27 with PropertyChange

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

the class AbstractUpdateProcessInstancesSuspendStateCmd method writeUserOperationLog.

protected void writeUserOperationLog(CommandContext commandContext, int numInstances, boolean async) {
    List<PropertyChange> propertyChanges = new ArrayList<PropertyChange>();
    propertyChanges.add(new PropertyChange("nrOfInstances", null, numInstances));
    propertyChanges.add(new PropertyChange("async", null, async));
    String operationType;
    if (suspending) {
        operationType = UserOperationLogEntry.OPERATION_TYPE_SUSPEND_JOB;
    } else {
        operationType = UserOperationLogEntry.OPERATION_TYPE_ACTIVATE_JOB;
    }
    commandContext.getOperationLogManager().logProcessInstanceOperation(operationType, null, null, null, propertyChanges);
}
Also used : PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) ArrayList(java.util.ArrayList)

Example 28 with PropertyChange

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

the class AbstractDeleteProcessDefinitionCmd method deleteProcessDefinitionCmd.

protected void deleteProcessDefinitionCmd(CommandContext commandContext, String processDefinitionId, boolean cascade, boolean skipCustomListeners) {
    ensureNotNull("processDefinitionId", processDefinitionId);
    ProcessDefinition processDefinition = commandContext.getProcessDefinitionManager().findLatestProcessDefinitionById(processDefinitionId);
    ensureNotNull(NotFoundException.class, "No process definition found with id '" + processDefinitionId + "'", "processDefinition", processDefinition);
    List<CommandChecker> commandCheckers = commandContext.getProcessEngineConfiguration().getCommandCheckers();
    for (CommandChecker checker : commandCheckers) {
        checker.checkDeleteProcessDefinitionById(processDefinitionId);
    }
    UserOperationLogManager userOperationLogManager = commandContext.getOperationLogManager();
    userOperationLogManager.logProcessDefinitionOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE, processDefinitionId, processDefinition.getKey(), new PropertyChange("cascade", false, cascade));
    ProcessDefinitionManager definitionManager = commandContext.getProcessDefinitionManager();
    definitionManager.deleteProcessDefinition(processDefinition, processDefinitionId, cascade, cascade, skipCustomListeners);
}
Also used : UserOperationLogManager(org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager) ProcessDefinitionManager(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager) PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) CommandChecker(org.camunda.bpm.engine.impl.cfg.CommandChecker)

Example 29 with PropertyChange

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

the class DeleteAttachmentCmd method execute.

public Object execute(CommandContext commandContext) {
    AttachmentEntity attachment = commandContext.getDbEntityManager().selectById(AttachmentEntity.class, attachmentId);
    commandContext.getDbEntityManager().delete(attachment);
    if (attachment.getContentId() != null) {
        commandContext.getByteArrayManager().deleteByteArrayById(attachment.getContentId());
    }
    if (attachment.getTaskId() != null) {
        TaskEntity task = commandContext.getTaskManager().findTaskById(attachment.getTaskId());
        PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName());
        commandContext.getOperationLogManager().logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange);
    }
    return null;
}
Also used : TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) AttachmentEntity(org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity)

Example 30 with PropertyChange

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

the class DeleteTaskAttachmentCmd method execute.

public Object execute(CommandContext commandContext) {
    AttachmentEntity attachment = (AttachmentEntity) commandContext.getAttachmentManager().findAttachmentByTaskIdAndAttachmentId(taskId, attachmentId);
    ensureNotNull("No attachment exist for task id '" + taskId + " and attachmentId '" + attachmentId + "'.", "attachment", attachment);
    commandContext.getDbEntityManager().delete(attachment);
    if (attachment.getContentId() != null) {
        commandContext.getByteArrayManager().deleteByteArrayById(attachment.getContentId());
    }
    if (attachment.getTaskId() != null) {
        TaskEntity task = commandContext.getTaskManager().findTaskById(attachment.getTaskId());
        PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName());
        commandContext.getOperationLogManager().logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange);
    }
    return null;
}
Also used : TaskEntity(org.camunda.bpm.engine.impl.persistence.entity.TaskEntity) PropertyChange(org.camunda.bpm.engine.impl.persistence.entity.PropertyChange) AttachmentEntity(org.camunda.bpm.engine.impl.persistence.entity.AttachmentEntity)

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