Exemplo n.º 1
0
        public WorkflowServer(WorkflowServerParameter parameters)
        {
            Parameters = parameters;

               switch (Parameters.Provider)
            {
                case "mssql":
                    _runtime = CreateRuntimeMSSQL();
                    break;
                case "oracle":
                    _runtime = CreateRuntimeOracle();
                    break;
                case "mysql":
                    _runtime = CreateRuntimeMySQL();
                    break;
                case "postgresql":
                    _runtime = CreateRuntimePostgreSQL();
                    break;
                case "ravendb":
                    _runtime = CreateRuntimeRavenDB();
                    break;
                case "mongodb":
                    _runtime = CreateRuntimeMongoDB();
                    break;
                default:
                    throw new Exception(string.Format("Provider = '{0}' is not support", Parameters.Provider));
            }

            _runtime.WithBus(new NullBus())
                .WithTimerManager(new TimerManager())
                .WithActionProvider(callbackProvider)
                .WithRuleProvider(callbackProvider)
                .SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOn()
                .RegisterAssemblyForCodeActions(Assembly.GetExecutingAssembly());
        }
Exemplo n.º 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            Runtime = WorkflowInit.Runtime;
        }
Exemplo n.º 3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
            Runtime = WorkflowInit.Runtime;
        }
        public bool ExecuteCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
        {
            if (_conditions.ContainsKey(name))
            {
                return _conditions[name].Invoke(processInstance, actionParameter);
            }

            throw new NotImplementedException(string.Format("Action condition with name {0} not implemented", name));
        }
Exemplo n.º 5
0
        public WorkflowSync(WorkflowRuntime runtime, Guid processId)
        {
            if (runtime == null) throw new ArgumentNullException("runtime");
            if (processId == Guid.Empty) throw new ArgumentOutOfRangeException("processId");

            _isDisposed = false;
            _runtime = runtime;
            _processId = processId;
            _handle = new AutoResetEvent(false);
        }
Exemplo n.º 6
0
        public WorkflowSync(WorkflowRuntime runtime, Guid processId)
        {
            if (runtime == null)
            {
                throw new ArgumentNullException("runtime");
            }
            if (processId == Guid.Empty)
            {
                throw new ArgumentOutOfRangeException("processId");
            }

            _isDisposed = false;
            _runtime    = runtime;
            _processId  = processId;
            _handle     = new AutoResetEvent(false);
        }
 public static WorkflowRuntime WithBuilder(this WorkflowRuntime runtime, IWorkflowBuilder builder)
 {
     runtime.Builder = builder;
     return(runtime);
 }
Exemplo n.º 8
0
		public void Initialize(WorkflowRuntime runtime)
		{
			this._runtime = runtime;
		}
Exemplo n.º 9
0
 public void Init(WorkflowRuntime runtime)
 {
     _runtime = runtime;
     _timer   = new Timer(OnTimer);
 }
Exemplo n.º 10
0
		private void InvokeAction(ProcessInstance processInstance, WorkflowRuntime runtime, string parameter, MethodInfo methodInfo)
		{
			object[] objArray = new object[] { processInstance, runtime, parameter };
			methodInfo.Invoke(null, objArray);
		}
Exemplo n.º 11
0
 private List<ExecutionRequestParameters> FillExecutionRequestParameters(Guid processId, ProcessInstance processInstance, List<TransitionDefinition> transitions, WorkflowRuntime.PreExecutionContext preExecutionContext, List<TransitionDefinition> transitionsForAdditional = null)
 {
     List<ExecutionRequestParameters> executionRequestParameters = new List<ExecutionRequestParameters>();
     if (transitions == null || transitions.Count == 0)
     {
         return executionRequestParameters;
     }
     List<string> strs = new List<string>();
     List<string> strs1 = new List<string>();
     foreach (TransitionDefinition transition in transitions)
     {
         bool flag = false;
         ExecutionRequestParameters executionRequestParameter = ExecutionRequestParameters.Create(processInstance, transition, true);
         if (transition.Trigger.Type != TriggerType.Auto || transition.Restrictions.Any<RestrictionDefinition>())
         {
             preExecutionContext.TransitionForActors = transition;
             flag = true;
         }
         if (transition.To.HavePreExecutionImplementation && preExecutionContext.HaveTransitionForActors)
         {
             IEnumerable<string> actors = this.GetActors(processInstance, preExecutionContext.TransitionForActors);
             strs.AddRange(actors);
             if (flag)
             {
                 strs1.AddRange(actors);
             }
         }
         if (transition.Trigger.Type == TriggerType.Command)
         {
             processInstance.AddParameter(ParameterDefinition.Create(DefaultDefinitions.ParameterCurrentCommand, transition.Trigger.Command.Name));
         }
         executionRequestParameters.Add(executionRequestParameter);
     }
     if (transitionsForAdditional != null)
     {
         foreach (TransitionDefinition transitionDefinition in transitionsForAdditional)
         {
             if (!transitionDefinition.Restrictions.Any<RestrictionDefinition>())
             {
                 continue;
             }
             strs1.AddRange(this.GetActors(processInstance, transitionDefinition));
         }
     }
     processInstance.AddParameter(ParameterDefinition.Create(DefaultDefinitions.ParameterIdentityIds, strs));
     processInstance.AddParameter(ParameterDefinition.Create(DefaultDefinitions.ParameterIdentityIdsForCurrentActivity, strs1));
     return executionRequestParameters;
 }
Exemplo n.º 12
0
		private static void InitializeAdditionalParams(WorkflowRuntime runtime, ProcessDefinition pd)
		{
			if (!pd.AdditionalParams.ContainsKey("Rules"))
			{
				pd.AdditionalParams.Add("Rules", runtime.RuleProvider.GetRules());
			}
			if (!pd.AdditionalParams.ContainsKey("TimerTypes"))
			{
				pd.AdditionalParams.Add("TimerTypes", 
					from TimerType t in Enum.GetValues(typeof(TimerType))
					select t.ToString());
			}
			if (!pd.AdditionalParams.ContainsKey("Actions"))
			{
				pd.AdditionalParams.Add("Actions", runtime.ActionProvider.GetActions());
			}
			if (!pd.AdditionalParams.ContainsKey("Namespaces"))
			{
				pd.AdditionalParams.Add("Usings", CodeActionsCompiller.Usings);
			}
		}
 public static WorkflowRuntime WithPersistenceProvider(this WorkflowRuntime runtime, IPersistenceProvider persistenceProvider)
 {
     runtime.PersistenceProvider = persistenceProvider;
     return(runtime);
 }
 public static WorkflowRuntime AttachDeterminingParametersGetter(this WorkflowRuntime runtime, EventHandler <NeedDeterminingParametersEventArgs> determiningParametersGetter)
 {
     runtime.OnNeedDeterminingParameters += determiningParametersGetter;
     return(runtime);
 }
Exemplo n.º 15
0
		public bool ExecuteCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
		{
			return false;
		}
Exemplo n.º 16
0
		public void ExecuteAction(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
		{
		}
Exemplo n.º 17
0
		public ActivityExecutor(WorkflowRuntime runtime, bool considerResultOnPreExecution)
		{
			this._runtime = runtime;
			this.ConsiderResultOnPreExecution = considerResultOnPreExecution;
		}
Exemplo n.º 18
0
		public ActivityExecutor(WorkflowRuntime runtime)
		{
			this._runtime = runtime;
			this.ConsiderResultOnPreExecution = false;
		}
 public static WorkflowRuntime WithDefaultBuilder <TSchemeMedium>(this WorkflowRuntime runtime) where TSchemeMedium : class
 {
     runtime.Builder = new WorkflowBuilder <TSchemeMedium>();
     return(runtime);
 }
 public static WorkflowRuntime SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOff(this WorkflowRuntime runtime)
 {
     runtime.IsAutoUpdateSchemeBeforeGetAvailableCommands = false;
     return(runtime);
 }
 public static WorkflowRuntime WithRuleProvider(this WorkflowRuntime runtime, IWorkflowRuleProvider ruleProvider)
 {
     runtime.RuleProvider = ruleProvider;
     return(runtime);
 }
Exemplo n.º 22
0
		public void Init(WorkflowRuntime runtime)
		{
			this._runtime = runtime;
			this._timer = new Timer(new TimerCallback(this.OnTimer));
		}
 public static WorkflowRuntime WithRuntimePersistance(this WorkflowRuntime runtime, IRuntimePersistence persistenceProvider)
 {
     runtime.RuntimePersistence = persistenceProvider;
     return(runtime);
 }
Exemplo n.º 24
0
		public static ProcessInstancesTree RestoreFromSerializableObject(List<SerializableSubprocessTree> objects, WorkflowRuntime runtime)
		{
			Dictionary<Guid, ProcessInstancesTree> guids = new Dictionary<Guid, ProcessInstancesTree>();
			foreach (SerializableSubprocessTree @object in objects)
			{
				ProcessInstancesTree processInstancesTree = new ProcessInstancesTree(@object.Id, @object.Name);
				guids.Add(processInstancesTree.Id, processInstancesTree);
			}
			foreach (SerializableSubprocessTree serializableSubprocessTree in objects)
			{
				if (!serializableSubprocessTree.Children.Any<Guid>())
				{
					continue;
				}
				ProcessInstancesTree ıtem = guids[serializableSubprocessTree.Id];
				foreach (Guid child in serializableSubprocessTree.Children)
				{
					ıtem.AddChild(guids[child]);
				}
			}
			if (!guids.Any<KeyValuePair<Guid, ProcessInstancesTree>>())
			{
				return null;
			}
			return guids.First<KeyValuePair<Guid, ProcessInstancesTree>>().Value.Root;
		}
 public static WorkflowRuntime SwitchAutoUpdateSchemeBeforeGetAvailableCommandsOn(this WorkflowRuntime runtime, EventHandler <NeedDeterminingParametersEventArgs> determiningParametersGetter)
 {
     runtime.IsAutoUpdateSchemeBeforeGetAvailableCommands = true;
     runtime.OnNeedDeterminingParameters += determiningParametersGetter;
     return(runtime);
 }
Exemplo n.º 26
0
		public bool InvokeCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter)
		{
			return this._conditions[this.GetMethodName(name, CodeActionType.Condition).ToLower()](processInstance, runtime, parameter);
		}
 public bool ExecuteCondition(string name, OptimaJet.Workflow.Core.Model.ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 28
0
		private bool InvokeCondition(ProcessInstance processInstance, WorkflowRuntime runtime, string parameter, MethodInfo methodInfo)
		{
			object[] objArray = new object[] { processInstance, runtime, parameter };
			return (bool)methodInfo.Invoke(null, objArray);
		}
Exemplo n.º 29
0
		public void InvokeAction(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string parameter)
		{
			this._actions[this.GetMethodName(name, CodeActionType.Action).ToLower()](processInstance, runtime, parameter);
		}
Exemplo n.º 30
0
 public void Init(WorkflowRuntime runtime)
 {
     _runtime = runtime;
     _timer = new Timer(OnTimer);
 }