Example #1
0
 public virtual void restartProcessInstance(RestartProcessInstanceDto restartProcessInstanceDto)
 {
     try
     {
         createRestartProcessInstanceBuilder(restartProcessInstanceDto).execute();
     }
     catch (BadUserRequestException e)
     {
         throw new InvalidRequestException(Response.Status.BAD_REQUEST, e.Message);
     }
 }
Example #2
0
        public virtual BatchDto restartProcessInstanceAsync(RestartProcessInstanceDto restartProcessInstanceDto)
        {
            Batch batch = null;

            try
            {
                batch = createRestartProcessInstanceBuilder(restartProcessInstanceDto).executeAsync();
            }
            catch (BadUserRequestException e)
            {
                throw new InvalidRequestException(Response.Status.BAD_REQUEST, e.Message);
            }
            return(BatchDto.fromBatch(batch));
        }
Example #3
0
        private RestartProcessInstanceBuilder createRestartProcessInstanceBuilder(RestartProcessInstanceDto restartProcessInstanceDto)
        {
            RuntimeService runtimeService         = engine.RuntimeService;
            RestartProcessInstanceBuilder builder = runtimeService.restartProcessInstances(processDefinitionId);

            if (restartProcessInstanceDto.ProcessInstanceIds != null)
            {
                builder.processInstanceIds(restartProcessInstanceDto.ProcessInstanceIds);
            }

            if (restartProcessInstanceDto.HistoricProcessInstanceQuery != null)
            {
                builder.historicProcessInstanceQuery(restartProcessInstanceDto.HistoricProcessInstanceQuery.toQuery(engine));
            }

            if (restartProcessInstanceDto.InitialVariables)
            {
                builder.initialSetOfVariables();
            }

            if (restartProcessInstanceDto.WithoutBusinessKey)
            {
                builder.withoutBusinessKey();
            }

            if (restartProcessInstanceDto.SkipCustomListeners)
            {
                builder.skipCustomListeners();
            }

            if (restartProcessInstanceDto.SkipIoMappings)
            {
                builder.skipIoMappings();
            }
            restartProcessInstanceDto.applyTo(builder, engine, objectMapper);
            return(builder);
        }