Exemplo n.º 1
0
        public virtual ProcessInstanceWithVariables executeWithVariablesInReturn(bool skipCustomListeners, bool skipIoMappings)
        {
            ensureOnlyOneNotNull("either process definition id or key must be set", processDefinitionId, processDefinitionKey);

            if (isProcessDefinitionTenantIdSet && !string.ReferenceEquals(processDefinitionId, null))
            {
                throw LOG.exceptionStartProcessInstanceByIdAndTenantId();
            }

            Command <ProcessInstanceWithVariables> command;

            if (modificationBuilder.ModificationOperations.Count == 0)
            {
                if (skipCustomListeners || skipIoMappings)
                {
                    throw LOG.exceptionStartProcessInstanceAtStartActivityAndSkipListenersOrMapping();
                }
                // start at the default start activity
                command = new StartProcessInstanceCmd(this);
            }
            else
            {
                // start at any activity using the instructions
                modificationBuilder.SkipCustomListeners = skipCustomListeners;
                modificationBuilder.SkipIoMappings      = skipIoMappings;

                command = new StartProcessInstanceAtActivitiesCmd(this);
            }

            return(commandExecutor.execute(command));
        }