use of org.camunda.bpm.engine.impl.persistence.deploy.DeleteDeploymentFailListener 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;
}
Aggregations