Example #1
0
        public virtual object Execute(CommandContext commandContext)
        {
            EnsureUtil.EnsureNotNull("deploymentId", DeploymentId);

            foreach (ICommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.CheckDeleteDeployment(DeploymentId);
            }

            IUserOperationLogManager logManager      = commandContext.OperationLogManager;
            IList <PropertyChange>   propertyChanges = new List <PropertyChange>()
            {
                new PropertyChange("cascade", null, Cascade)
            };

            logManager.LogDeploymentOperation(UserOperationLogEntryFields.OperationTypeDelete, DeploymentId, propertyChanges);

            commandContext.DeploymentManager.DeleteDeployment(DeploymentId, Cascade, SkipCustomListeners /*, skipIoMappings*/);

            IProcessApplicationReference processApplicationReference = Context.ProcessEngineConfiguration.ProcessApplicationManager.GetProcessApplicationForDeployment(DeploymentId);

            DeleteDeploymentFailListener listener = new DeleteDeploymentFailListener(DeploymentId, processApplicationReference /*, Context.ProcessEngineConfiguration.CommandExecutorTxRequiresNew*/);

            try
            {
                commandContext.RunWithoutAuthorization(() =>
                {
                    (new UnregisterProcessApplicationCmd(DeploymentId, false)).Execute(commandContext);
                    (new UnregisterDeploymentCmd(new List <string>()
                    {
                        DeploymentId
                    })).Execute(commandContext);
                });
            }
            finally
            {
                try
                {
                    commandContext.TransactionContext.AddTransactionListener(TransactionJavaStatus.RolledBack, listener);
                }
                catch (System.Exception)
                {
                    TxLog.DebugTransactionOperation("Could not register transaction synchronization. Probably the TX has already been rolled back by application code.");
                    listener.Execute(commandContext);
                }
            }


            return(null);
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: public Void execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        public virtual Void execute(CommandContext commandContext)
        {
            ensureNotNull("deploymentId", deploymentId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkDeleteDeployment(deploymentId);
            }

            UserOperationLogManager logManager      = commandContext.OperationLogManager;
            IList <PropertyChange>  propertyChanges = Arrays.asList(new PropertyChange("cascade", null, cascade));

            logManager.logDeploymentOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_DELETE, deploymentId, propertyChanges);

            commandContext.DeploymentManager.deleteDeployment(deploymentId, cascade, skipCustomListeners, skipIoMappings);

            ProcessApplicationReference processApplicationReference = Context.ProcessEngineConfiguration.ProcessApplicationManager.getProcessApplicationForDeployment(deploymentId);

            DeleteDeploymentFailListener listener = new DeleteDeploymentFailListener(deploymentId, processApplicationReference, Context.ProcessEngineConfiguration.CommandExecutorTxRequiresNew);

            try
            {
                commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext));
            }
            finally
            {
                try
                {
                    commandContext.TransactionContext.addTransactionListener(TransactionState.ROLLED_BACK, listener);
                }
                catch (Exception)
                {
                    TX_LOG.debugTransactionOperation("Could not register transaction synchronization. Probably the TX has already been rolled back by application code.");
                    listener.execute(commandContext);
                }
            }


            return(null);
        }