private WfBranchProcessInfoCollection LoadBranches() { WfBranchProcessInfoCollection resultCollection = new WfBranchProcessInfoCollection(); IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; List <string> branchProcessIDs = persistProcess.GetBranchProcessIDsByOperationID(this.ID); WfProcessCollection processes = WfRuntime.GetWfProcesses(branchProcessIDs.ToArray()); IWfProcess[] processesArray = new IWfProcess[processes.Count]; int i = 0; foreach (IWfProcess process in processes) { ((WfBranchProcessInfo)process.EntryInfo).OwnerOperation = this; processesArray[i++] = process; } //按照子流程的序号排序 Array.Sort <IWfProcess>(processesArray, delegate(IWfProcess process1, IWfProcess process2) { return(Math.Sign(process1.EntryInfo.Sequence - process2.EntryInfo.Sequence)); }); foreach (IWfProcess process in processesArray) { resultCollection.Add(process.EntryInfo); } return(resultCollection); }
public static WfProcessCollection GetWfProcessesByResourceID(string resourceID) { ExceptionHelper.TrueThrow <ArgumentNullException>(resourceID == null, "resourceID"); IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; IList <string> processIDs = persistProcess.GetProcessIDsByResourceID(resourceID); return(GetProcessesFromIDs(processIDs)); }
/// <summary> /// Parses the specified input into a new <see cref="WorkflowDefinition"/> /// </summary> /// <param name="reader">The extended <see cref="IWorkflowReader"/></param> /// <param name="input">The input to parse</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/></param> /// <returns>A new <see cref="WorkflowDefinition"/></returns> public static async Task <WorkflowDefinition> ParseAsync(this IWorkflowReader reader, string input, CancellationToken cancellationToken = default) { if (string.IsNullOrWhiteSpace(input)) { throw new ArgumentNullException(nameof(input)); } using Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(input)); return(await reader.ReadAsync(stream, cancellationToken)); }
public static WfProcessCollection GetUserRelativeProcessesByResourceID(string resourceID, IUser user) { ExceptionHelper.CheckStringIsNullOrEmpty(resourceID, "resourceID"); ExceptionHelper.TrueThrow <ArgumentNullException>(user == null, "user"); IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; List <string> processIDs = persistProcess.GetUserRelativeProcessIDsByResourceID(resourceID, user); return(GetWfProcesses(processIDs.ToArray())); }
private static void FillProcessesFromPersistence(WfProcessCollection processes, List <string> notInCacheIDs) { if (notInCacheIDs.Count > 0) { IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; WfProcessCollection tempCollection = persistProcess.LoadProcesses(notInCacheIDs.ToArray()); foreach (IWfProcess tempProcess in tempCollection) { processes.Add(tempProcess); AddProcessToCache(tempProcess.ID, tempProcess); } } }
public static IWfActivity GetWfActivity(string activityID) { ExceptionHelper.CheckStringIsNullOrEmpty(activityID, "activityID"); IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; string processID = persistProcess.GetProcessIDByActivityID(activityID); if (string.IsNullOrEmpty(processID)) { throw new WfRuntimeException(WfRuntimeErrorType.ActivityError, string.Format("不能根据activityID:{0}恢复流程数据", activityID)); } IWfProcess wfProcess = GetWfProcesses(processID)[processID]; return(wfProcess.Activities[activityID]); }
private WfBranchProcessInfoContext LoadContext() { WfBranchProcessInfoContext branchContext = null; IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; string strContext = persistProcess.GetBranchContext(this.OperationID, this.Process.ID); if (string.IsNullOrEmpty(strContext) == false) { branchContext = SerializationHelper.DeserializeStringToObject <WfBranchProcessInfoContext>(strContext, SerializationFormatterType.Binary); } else { branchContext = new WfBranchProcessInfoContext(); } return(branchContext); }
private WfOperationContext LoadContext() { WfOperationContext operationContext = null; IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; Dictionary <string, string> context = persistProcess.GetWfContext(this.ID); string strContext = string.Empty; if (context.TryGetValue(this.ID, out strContext)) { operationContext = SerializationHelper.DeserializeStringToObject <WfOperationContext>(strContext, SerializationFormatterType.Binary); } else { operationContext = new WfOperationContext(); } return(operationContext); }
/// <summary> /// Initializes a new <see cref="DeployWorkflowCommand"/> /// </summary> /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param> /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param> /// <param name="synapseManagementApi">The service used to interact with the remote Synapse Management API</param> /// <param name="workflowReader">The service used to read <see cref="WorkflowDefinition"/>s</param> public DeployWorkflowCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi, IWorkflowReader workflowReader) : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription) { this.WorkflowReader = workflowReader; this.Add(CommandOptions.File); this.Handler = CommandHandler.Create <string>(this.HandleAsync); }
private IWfOperation LoadOperation() { IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; return(persistProcess.LoadOperationByBranchProcessID(this.Process.ID)); }
private WfAssigneeCollection LoadAssignees() { IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; return(persistProcess.LoadAssignees(this.ID)[this.ID]); }
/// <summary> /// Initializes a new <see cref="WorkflowDefinitionFileMonitor"/> /// </summary> /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param> /// <param name="logger">The service used to perform logging</param> /// <param name="options">The service used to access the current <see cref="SynapseApplicationOptions"/></param> /// <param name="workflowReader">The service used to read <see cref="WorkflowDefinition"/>s</param> public WorkflowDefinitionFileMonitor(IServiceProvider serviceProvider, ILogger <WorkflowDefinitionFileMonitor> logger, IOptions <SynapseApplicationOptions> options, IWorkflowReader workflowReader) { this.ServiceProvider = serviceProvider; this.Logger = logger; this.Options = options.Value; this.WorkflowReader = workflowReader; }
private WfActivityCollection LoadActivities() { IWorkflowReader persistProcess = WorkflowSettings.GetConfig().Reader; return(persistProcess.LoadProcessActivities(this)); }