Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.delegate.DelegateExecution execution) throws Exception
        public virtual void execute(DelegateExecution execution)
        {
            EnsureUtil.ensureNotNull("user transaction", utx);

            // simulate a failure that triggers the transaction rollback
            utx.setRollbackOnly();
        }
Beispiel #2
0
	  public virtual Void execute(CommandContext commandContext)
	  {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.runtime.Incident incident = commandContext.getIncidentManager().findIncidentById(incidentId);
		Incident incident = commandContext.IncidentManager.findIncidentById(incidentId);

		EnsureUtil.ensureNotNull(typeof(NotFoundException), "Cannot find an incident with id '" + incidentId + "'", "incident", incident);

		if (incident.IncidentType.Equals("failedJob") || incident.IncidentType.Equals("failedExternalTask"))
		{
		  throw new BadUserRequestException("Cannot resolve an incident of type " + incident.IncidentType);
		}

		EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "", "executionId", incident.ExecutionId);
		ExecutionEntity execution = commandContext.ExecutionManager.findExecutionById(incident.ExecutionId);

		EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Cannot find an execution for an incident with id '" + incidentId + "'", "execution", execution);

		foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
		{
		  checker.checkUpdateProcessInstance(execution);
		}

		commandContext.OperationLogManager.logProcessInstanceOperation(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_RESOLVE, execution.ProcessInstanceId, execution.ProcessDefinitionId, null, Collections.singletonList(new PropertyChange("incidentId", null, incidentId)));

		execution.resolveIncident(incidentId);
		return null;
	  }
Beispiel #3
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity determineSourceInstanceExecution(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        protected internal override ExecutionEntity determineSourceInstanceExecution(CommandContext commandContext)
        {
            ActivityInstance   instance         = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext));
            TransitionInstance instanceToCancel = findTransitionInstance(instance, transitionInstanceId);

            EnsureUtil.ensureNotNull(typeof(NotValidException), describeFailure("Transition instance '" + transitionInstanceId + "' does not exist"), "transitionInstance", instanceToCancel);

            ExecutionEntity transitionExecution = commandContext.ExecutionManager.findExecutionById(instanceToCancel.ExecutionId);

            return(transitionExecution);
        }
Beispiel #4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity determineSourceInstanceExecution(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext)
        protected internal override ExecutionEntity determineSourceInstanceExecution(CommandContext commandContext)
        {
            ExecutionEntity processInstance = commandContext.ExecutionManager.findExecutionById(processInstanceId);

            // rebuild the mapping because the execution tree changes with every iteration
            ActivityExecutionTreeMapping mapping = new ActivityExecutionTreeMapping(commandContext, processInstanceId);

            ActivityInstance instance = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext));

            ActivityInstance instanceToCancel = findActivityInstance(instance, activityInstanceId);

            EnsureUtil.ensureNotNull(typeof(NotValidException), describeFailure("Activity instance '" + activityInstanceId + "' does not exist"), "activityInstance", instanceToCancel);
            ExecutionEntity scopeExecution = getScopeExecutionForActivityInstance(processInstance, mapping, instanceToCancel);

            return(scopeExecution);
        }
Beispiel #5
0
        public virtual object execute(CommandContext commandContext)
        {
            EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Historic batch id must not be null", "historic batch id", batchId);

            HistoricBatchEntity historicBatch = commandContext.HistoricBatchManager.findHistoricBatchById(batchId);

            EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Historic batch for id '" + batchId + "' cannot be found", "historic batch", historicBatch);

            checkAccess(commandContext, historicBatch);

            writeUserOperationLog(commandContext);

            historicBatch.delete();

            return(null);
        }
Beispiel #6
0
        public virtual Void execute(CommandContext commandContext)
        {
            EnsureUtil.ensureNotNull("job id must not be null", "jobId", jobId);

            JobEntity job = commandContext.JobManager.findJobById(jobId);

            EnsureUtil.ensureNotNull(typeof(NotFoundException), "No job found with id '" + jobId + "'", "job", job);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkUpdateJob(job);
            }

            long currentPriority = job.Priority;

            job.Priority = priority;

            createOpLogEntry(commandContext, currentPriority, job);

            return(null);
        }
Beispiel #7
0
        public override Void execute(CommandContext commandContext)
        {
            validateInput();

            ExternalTaskEntity externalTask = commandContext.ExternalTaskManager.findExternalTaskById(externalTaskId);

            EnsureUtil.ensureNotNull(typeof(NotFoundException), "Cannot find external task with id " + externalTaskId, "externalTask", externalTask);

            if (!workerId.Equals(externalTask.WorkerId))
            {
                throw new BadUserRequestException(ErrorMessageOnWrongWorkerAccess + "'. It is locked by worker '" + externalTask.WorkerId + "'.");
            }

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkUpdateProcessInstanceById(externalTask.ProcessInstanceId);
            }

            execute(externalTask);

            return(null);
        }
Beispiel #8
0
        public virtual Void execute(CommandContext commandContext)
        {
            JobEntity job = Job;

            if (Context.JobExecutorContext == null)
            {
                EnsureUtil.ensureNotNull("Job with id " + jobId + " does not exist", "job", job);
            }
            else if (Context.JobExecutorContext != null && job == null)
            {
                // CAM-1842
                // Job was acquired but does not exist anymore. This is not a problem.
                // It usually means that the job has been deleted after it was acquired which can happen if the
                // the activity instance corresponding to the job is cancelled.
                LOG.debugAcquiredJobNotFound(jobId);
                return(null);
            }

            job.unlock();

            return(null);
        }
Beispiel #9
0
 public GetDeployedTaskFormCmd(string taskId)
 {
     EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Task id cannot be null", "taskId", taskId);
     this.taskId = taskId;
 }
Beispiel #10
0
 /// <summary>
 /// Validates the current input of the command.
 /// </summary>
 protected internal override void validateInput()
 {
     EnsureUtil.ensureNotNull("workerId", workerId);
 }
Beispiel #11
0
	  public ResolveIncidentCmd(string incidentId)
	  {
		EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "", "incidentId", incidentId);
		this.incidentId = incidentId;
	  }
Beispiel #12
0
 public GetDeployedStartFormCmd(string processDefinitionId)
 {
     EnsureUtil.ensureNotNull(typeof(BadUserRequestException), "Process definition id cannot be null", "processDefinitionId", processDefinitionId);
     this.processDefinitionId = processDefinitionId;
 }