Search in sources :

Example 1 with UserOperationLogManager

use of org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager 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 UserOperationLogManager

use of org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager 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 3 with UserOperationLogManager

use of org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager 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)

Aggregations

PropertyChange (org.camunda.bpm.engine.impl.persistence.entity.PropertyChange)3 UserOperationLogManager (org.camunda.bpm.engine.impl.persistence.entity.UserOperationLogManager)3 CommandChecker (org.camunda.bpm.engine.impl.cfg.CommandChecker)2 ArrayList (java.util.ArrayList)1 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)1 DeleteDeploymentFailListener (org.camunda.bpm.engine.impl.persistence.deploy.DeleteDeploymentFailListener)1 ProcessDefinitionManager (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1