/// <summary> /// Set taskanswer for a receive-task /// </summary> /// <param name="taskId">Id of the task</param> /// <param name="messageInstanceId">Id of the choosen message</param> /// <param name="username">username</param> public void submitReceiveTaskAnswer(int taskId, string messageInstanceId, string username) { IProcessStore processStore = StoreHandler.getProcessStore(connectionString); ITaskStore taskStore = StoreHandler.getTaskStore(connectionString); T_Task openTask = taskStore.getTaskById(taskId); //check if task isn't already answered if (openTask.Done == false && openTask.Type.Equals("R")) { P_ProcessSubject processSubject = processStore.getProcessSubjectForWFId(openTask.WFId); P_Process process = processStore.getProcess(processSubject.Process_Id); DynamicValue val = new DynamicValue(); val.Add("MessageId", new DynamicValue(messageInstanceId)); submitTaskAnswer(val, process, openTask); //set task as answered //taskStore.setTaskStatus(taskId, true); taskStore.setTaskStatus(taskId, username, "", messageInstanceId); //set the owner of the task recipient instance to the user who submitted the taskanswer processStore.setWorkflowInstanceOwner(openTask.WFId, username); } }
public MaterialAmountChange(IMaterialStore materialStore, ITaskStore taskStore, IProductStore productStore, MaterialMethods materialMethods) { _materialStore = materialStore; _taskStore = taskStore; _productStore = productStore; _materialMethods = materialMethods; }
private void TaskStore_SetStatus(ITaskStore obj, QueueTask e) { if (obj.Id == this.Id) { Update(e); } }
public async Task Invoke(HttpContext context, ITaskStore taskStore, ITaskExecutor executor) { var action = context.GetRouteValueAs <string>("action"); if (action == PollAction || action == RunAction) { if (!HttpMethods.IsPost(context.Request.Method)) { context.Response.StatusCode = StatusCodes.Status405MethodNotAllowed; return; } if (!await _scheduler.VerifyAuthTokenAsync(context.Request.Headers[DefaultTaskScheduler.AuthTokenName])) { context.Response.StatusCode = StatusCodes.Status401Unauthorized; return; } var taskParameters = context.Request.Query.ToDictionary(x => x.Key, x => x.Value.ToString(), StringComparer.OrdinalIgnoreCase); if (action == RunAction) { var taskId = context.GetRouteValueAs <int>("id", 0); await Run(taskId, context, taskStore, executor, taskParameters); } else { await Poll(context, taskStore, executor, taskParameters); } } else { await Noop(context); } }
public TaskChangeMaterialUpdate(IMaterialStore materialStore, ITaskStore taskStore, IProductStore productStore, MaterialMethods materialMethods) { _materialStore = materialStore; _taskStore = taskStore; _productStore = productStore; _materialMethods = materialMethods; }
protected override void Execute(CodeActivityContext context) { IProcessStore processStore = StoreHandler.getProcessStore(context.GetValue(cfgSQLConnectionString)); ITaskStore taskStore = StoreHandler.getTaskStore(context.GetValue(cfgSQLConnectionString)); P_WorkflowInstance creatorinstance = processStore.getWorkflowInstance(context.GetValue(WFId)); processStore.updateWorkflowInstanceEndState(creatorinstance.Id, context.GetValue(IsEndState)); if (processStore.hasProcessEnded(creatorinstance.ProcessInstance_Id)) { processStore.markProcessInstanceAsEnded(creatorinstance.ProcessInstance_Id, creatorinstance.ProcessSubject_Id, creatorinstance.Owner); taskStore.setAllTasksForProcessInstanceAsDone(creatorinstance.ProcessInstance_Id); var instances = processStore.getWFInstanceIdsForProcessInstance(creatorinstance.ProcessInstance_Id); CoreFunctions c = new CoreFunctions(context.GetValue(cfgWFMBaseAddress), context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword), context.GetValue(cfgSQLConnectionString)); foreach (var i in instances) { try { c.terminateSubjectInstance(i); } catch (Exception e) { } } } }
/// <summary> /// Executed queueTask handler. /// </summary> /// <param name="queueTask"></param> private void ExecutedTaskEvent(ITaskStore obj, QueueTask e) { if (obj.Id == this.WorkerTaskStore.Id) { SetStatusFree(); TryStartNextTask(); } }
/// <summary> /// Loads - if not already loaded - the last <see cref="TaskExecutionInfo"/> object instance for a task from the store /// and assigns data to <see cref="TaskDescriptor.LastExecution"/>. /// </summary> /// <param name="task">The task to load data for.</param> /// <param name="force"><c>true</c> always enforces a reload, even if data is loaded already.</param> public static async Task LoadLastExecutionInfoAsync(this ITaskStore store, TaskDescriptor task, bool force = false) { Guard.NotNull(task, nameof(task)); if (task.LastExecution == null || force) { task.LastExecution = await store.GetLastExecutionInfoByTaskAsync(task); } }
public void CtorNoStoreThrowsArgumentNullException() { // Arrange. var parser = MockRepository.GenerateStub <ITaskParser>(); ITaskStore store = null; // Act. new TaskFactory(parser, store); }
public EventManager(IMaterialStore materialStore, ITaskStore taskStore, IProductStore productStore, IPlatform platform, MaterialMethods materialMethods, ExtensionExtras functionLib) { _materialStore = materialStore; _taskStore = taskStore; _productStore = productStore; _platform = platform; _materialMethods = materialMethods; _functionLib = functionLib; }
private QueueManager() { queues = new Dictionary <string, IQueue>(); taslStore = new TaskStore.TaskStore(); timer = new Timer(); int hourAsMs = 3600000; timer.Interval = hourAsMs; timer.Elapsed += TaskCleaner; }
public void createNotificationForTask(int TaskId, string cfgSQLConnectionString) { this.cfgSQLConnectionString = cfgSQLConnectionString; configStore = StoreHandler.getConfigStore(cfgSQLConnectionString); baseURL = configStore.getString(BaseURL); templatepath = configStore.getString(Email_NotificationTemplate); taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString); T_Task task = taskStore.getTaskById(TaskId); helper = new MailBodyHelper(); processStore = StoreHandler.getProcessStore(cfgSQLConnectionString); instance = processStore.getWorkflowInstance(task.WFId); mail = new SmtpUtils(configStore); if (task.Type.Equals("F") || task.Type.Equals("S")) { if (configStore.getBool(Email_Notifications_Tasks)) { string content = helper.getStateBody(task, baseURL, templatepath); List <string> recipients = new List <string>(); if (String.IsNullOrEmpty(instance.Owner)) { var subject = processStore.getProcessSubjectForWFId(task.WFId); userStore = StoreHandler.getUserStore(cfgSQLConnectionString); recipients.AddRange(userStore.getUsernamesForRole(subject.U_Role_Id)); } else { recipients.Add(instance.Owner); } foreach (string user in recipients) { mail.sendMail(user, "InFlow: " + task.Name + " #" + task.Id, content); } } } if (task.Type.Equals("R")) { if (configStore.getBool(Email_Notifications_Messages)) { messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString); var messages = messageStore.getMessagesForReceiveStateTask(task.WFId, task.getTaskPropertiesAsListOfString()); foreach (var i in messages) { createReceiveNotification(i, task); } } } }
public void createNotificationForTask(int TaskId, string cfgSQLConnectionString) { this.cfgSQLConnectionString = cfgSQLConnectionString; configStore = StoreHandler.getConfigStore(cfgSQLConnectionString); baseURL = configStore.getString(BaseURL); templatepath = configStore.getString(Email_NotificationTemplate); taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString); T_Task task = taskStore.getTaskById(TaskId); helper = new MailBodyHelper(); processStore = StoreHandler.getProcessStore(cfgSQLConnectionString); instance = processStore.getWorkflowInstance(task.WFId); mail = new SmtpUtils(configStore); if (task.Type.Equals("F") || task.Type.Equals("S")) { if (configStore.getBool(Email_Notifications_Tasks)) { string content = helper.getStateBody(task, baseURL, templatepath); List<string> recipients = new List<string>(); if (String.IsNullOrEmpty(instance.Owner)) { var subject = processStore.getProcessSubjectForWFId(task.WFId); userStore = StoreHandler.getUserStore(cfgSQLConnectionString); recipients.AddRange(userStore.getUsernamesForRole(subject.U_Role_Id)); } else { recipients.Add(instance.Owner); } foreach (string user in recipients) { mail.sendMail(user, "InFlow: " + task.Name + " #" + task.Id, content); } } } if (task.Type.Equals("R")) { if (configStore.getBool(Email_Notifications_Messages)) { messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString); var messages = messageStore.getMessagesForReceiveStateTask(task.WFId, task.getTaskPropertiesAsListOfString()); foreach (var i in messages) { createReceiveNotification(i, task); } } } }
public ImportController( SmartDbContext db, IImportProfileService importProfileService, ITaskStore taskStore, ITaskScheduler taskScheduler) { _db = db; _importProfileService = importProfileService; _taskStore = taskStore; _taskScheduler = taskScheduler; }
public TaskListViewModel(ITaskStore iTaskStore, IMyEventAggregator iMyEventAggregator) { _taskStore = iTaskStore; _myEventAggregator = iMyEventAggregator; _myEventAggregator.Subscribe(this); SearchRange = DateOption.Today; SelectedManagementUnit = 0; ExecuteLoadPastTasksCommandAsync(); }
public TaskManager(ITaskStore taskStore, IUserStore userStore, HelperDynamic dynamicHelper, RestClient restClient, IConfigurationRoot configuration, ITransaction <PointsGameDbContext> transaction, HellperPush hellperEmail, HelperSendClientMessage sendClientMessageManager) { _iTaskStore = taskStore ?? throw new ArgumentNullException(nameof(taskStore)); _iUserStore = userStore ?? throw new ArgumentNullException(nameof(userStore)); _dynamicHelper = dynamicHelper ?? throw new ArgumentNullException(nameof(dynamicHelper)); _restClient = restClient ?? throw new ArgumentNullException(nameof(restClient)); _config = configuration ?? throw new ArgumentNullException(nameof(configuration)); _transaction = transaction ?? throw new ArgumentNullException(nameof(transaction)); _hellperEmail = hellperEmail ?? throw new ArgumentNullException(nameof(hellperEmail)); _sendClientMessageManager = sendClientMessageManager; }
public SchedulingController( ITaskStore taskStore, ITaskActivator taskActivator, ITaskScheduler taskScheduler, IAsyncState asyncState, CommonSettings commonSettings) { _taskStore = taskStore; _taskActivator = taskActivator; _taskScheduler = taskScheduler; _asyncState = asyncState; _commonSettings = commonSettings; }
public static async Task <bool> TryDeleteTaskAsync <T>(this ITaskStore store) where T : ITask { var task = await store.GetTaskByTypeAsync(typeof(T)); if (task != null) { await store.DeleteTaskAsync(task); return(true); } return(false); }
public ITaskStore GetStore() { if (string.IsNullOrEmpty(this.settingsStore.UserName)) { return new NullTaskStore(); } if (this.settingsStore.UserName != this.username) { this.username = this.settingsStore.UserName; var storeName = string.Format("{0}.task.store", this.username); this.taskStore = this.taskStoreFactory.Invoke(storeName); } return this.taskStore; }
/// <summary> /// Initializes a new task factory with the specified task parser. /// </summary> /// <param name="taskParser"> /// The task parser to use. /// </param> /// <exception cref="ArgumenNullException"> /// If <c>taskParser</c> is <c>null</c>. /// </exception> public TaskFactory( ITaskParser taskParser, ITaskStore taskStore ) { if (taskParser == null) { throw new ArgumentNullException("taskParser"); } if (taskStore == null) { throw new ArgumentNullException("taskStore"); } _taskParser = taskParser; _taskStore = taskStore; }
private async Task Run(int taskId, HttpContext context, ITaskStore taskStore, ITaskExecutor executor, IDictionary <string, string> taskParameters) { var task = await taskStore.GetTaskByIdAsync(taskId); if (task == null) { context.Response.StatusCode = StatusCodes.Status404NotFound; return; } await Virtualize(context, taskParameters); await executor.ExecuteAsync(task, context, taskParameters); context.Response.StatusCode = StatusCodes.Status200OK; await context.Response.WriteAsync($"Task '{task.Name}' executed."); }
public DefaultTaskExecutor( ITaskStore taskStore, Func <Type, ITask> taskResolver, IComponentContext componentContext, IAsyncState asyncState, AsyncRunner asyncRunner, IApplicationContext appContext) { _taskStore = taskStore; _taskResolver = taskResolver; _componentContext = componentContext; _asyncState = asyncState; _asyncRunner = asyncRunner; _appContext = appContext; Logger = NullLogger.Instance; }
public TaskExecutor( ITaskStore taskStore, ITaskActivator taskActivator, IComponentContext componentContext, IAsyncState asyncState, AsyncRunner asyncRunner, IApplicationContext appContext) { _taskStore = taskStore; _taskActivator = taskActivator; _componentContext = componentContext; _asyncState = asyncState; _asyncRunner = asyncRunner; _appContext = appContext; Logger = NullLogger.Instance; }
private void initService() { if (connectionString == null) { connectionString = ConfigurationSettings.AppSettings["repositoryConnectionString"].ToString(); wfmBaseAddress = ConfigurationSettings.AppSettings["wfmBaseAddress"].ToString(); wfmUsername = ConfigurationSettings.AppSettings["wfmUsername"].ToString(); wfmPassword = ConfigurationSettings.AppSettings["wfmPassword"].ToString(); taskStore = StoreHandler.getTaskStore(connectionString); processStore = StoreHandler.getProcessStore(connectionString); userStore = StoreHandler.getUserStore(connectionString); messageStore = StoreHandler.getMessageStore(connectionString); _db = new InFlowDb(); } }
public TaskExecutionContext( ITaskStore taskStore, HttpContext httpContext, IComponentContext componentContext, TaskExecutionInfo originalExecutionInfo) { Guard.NotNull(taskStore, nameof(taskStore)); Guard.NotNull(httpContext, nameof(httpContext)); Guard.NotNull(componentContext, nameof(componentContext)); Guard.NotNull(originalExecutionInfo, nameof(originalExecutionInfo)); _componentContext = componentContext; _originalExecutionInfo = originalExecutionInfo; HttpContext = httpContext; Parameters = httpContext.Request.Query; TaskStore = taskStore; ExecutionInfo = _originalExecutionInfo.Clone(); }
private void initService() { if (connectionString == null) { connectionString = ConfigurationSettings.AppSettings["repositoryConnectionString"].ToString(); wfmBaseAddress = ConfigurationSettings.AppSettings["wfmBaseAddress"].ToString(); wfmUsername = ConfigurationSettings.AppSettings["wfmUsername"].ToString(); wfmPassword = ConfigurationSettings.AppSettings["wfmPassword"].ToString(); taskStore = StoreHandler.getTaskStore(connectionString); processStore = StoreHandler.getProcessStore(connectionString); userStore = StoreHandler.getUserStore(connectionString); messageStore = StoreHandler.getMessageStore(connectionString); _db = new InFlowDb(); } }
public TaskExecutionContext( ITaskStore taskStore, HttpContext httpContext, IComponentContext componentContext, TaskExecutionInfo originalExecutionInfo, IDictionary <string, string> taskParameters = null) { Guard.NotNull(taskStore, nameof(taskStore)); Guard.NotNull(httpContext, nameof(httpContext)); Guard.NotNull(componentContext, nameof(componentContext)); Guard.NotNull(originalExecutionInfo, nameof(originalExecutionInfo)); _componentContext = componentContext; _originalExecutionInfo = originalExecutionInfo; HttpContext = httpContext; Parameters = taskParameters ?? new Dictionary <string, string>(); TaskStore = taskStore; ExecutionInfo = _originalExecutionInfo.Clone(); }
public ExportController( SmartDbContext db, IExportProfileService exportProfileService, ICategoryService categoryService, IDataExporter dataExporter, ITaskScheduler taskScheduler, IProviderManager providerManager, ITaskStore taskStore, DataExchangeSettings dataExchangeSettings, CustomerSettings customerSettings) { _db = db; _exportProfileService = exportProfileService; _categoryService = categoryService; _dataExporter = dataExporter; _taskScheduler = taskScheduler; _providerManager = providerManager; _taskStore = taskStore; _dataExchangeSettings = dataExchangeSettings; _customerSettings = customerSettings; }
public TaskExecutionContext( ITaskStore taskStore, IComponentContext componentContext, ITaskExecutionInfo originalExecutionInfo, IDictionary <string, string> taskParameters = null) { Guard.NotNull(taskStore, nameof(taskStore)); Guard.NotNull(componentContext, nameof(componentContext)); Guard.NotNull(originalExecutionInfo, nameof(originalExecutionInfo)); _componentContext = componentContext; _originalExecutionInfo = originalExecutionInfo; if (taskParameters != null) { Parameters.Merge(taskParameters); } TaskStore = taskStore; ExecutionInfo = _originalExecutionInfo.Clone(); }
public void createNotificationForMessage(int MessageId, string cfgSQLConnectionString) { this.cfgSQLConnectionString = cfgSQLConnectionString; configStore = StoreHandler.getConfigStore(cfgSQLConnectionString); baseURL = configStore.getString(BaseURL); templatepath = configStore.getString(Email_NotificationTemplate); if (configStore.getBool(Email_Notifications_Messages)) { taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString); T_Task task = taskStore.getReceiveTaskForMessageId(MessageId); if (task != null) { messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString); mail = new SmtpUtils(configStore); processStore = StoreHandler.getProcessStore(cfgSQLConnectionString); instance = processStore.getWorkflowInstance(task.WFId); M_Message message = messageStore.getMessageBymsgId(MessageId); createReceiveNotification(message, task); } } }
private async Task Poll(HttpContext context, ITaskStore taskStore, ITaskExecutor executor, IDictionary <string, string> taskParameters) { var pendingTasks = await taskStore.GetPendingTasksAsync(); var numTasks = pendingTasks.Count; var numExecuted = 0; if (pendingTasks.Any()) { await Virtualize(context, taskParameters); } for (var i = 0; i < numTasks; i++) { var task = pendingTasks[i]; if (i > 0 /*&& (DateTime.UtcNow - _sweepStart).TotalMinutes > _taskScheduler.SweepIntervalMinutes*/) { // Maybe a subsequent Sweep call or another machine in a webfarm executed // successive tasks already. // To be able to determine this, we need to reload the entity from the database. // The TaskExecutor will exit when the task should be in running state then. await taskStore.ReloadTaskAsync(task); task.LastExecution = await taskStore.GetLastExecutionInfoByTaskIdAsync(task.Id); } if (task.IsPending) { await executor.ExecuteAsync(task, context, taskParameters); numExecuted++; } } context.Response.StatusCode = StatusCodes.Status200OK; await context.Response.WriteAsync($"{numExecuted} of {numTasks} pending tasks executed."); }
/// <summary> /// Set taskanswer for a send-state task /// </summary> /// <param name="taskId">Id of the task</param> /// <param name="recipientName">choosen recipient/s</param> /// <param name="editableParameters">edited parameters</param> public void submitSendTaskAnswer(int taskId, string recipientName, string editableParameters, string username) { IProcessStore processStore = StoreHandler.getProcessStore(connectionString); ITaskStore taskStore = StoreHandler.getTaskStore(connectionString); T_Task openTask = taskStore.getTaskById(taskId); //check if task isn't already answered if (openTask.Done == false && openTask.Type.Equals("S")) { P_ProcessSubject processSubject = processStore.getProcessSubjectForWFId(openTask.WFId); P_Process process = processStore.getProcess(processSubject.Process_Id); DynamicValue val = DynamicValue.Parse(editableParameters); val.Add("recipient", new DynamicValue(recipientName)); submitTaskAnswer(val, process, openTask); //set task as answered //taskStore.setTaskStatus(taskId, true); taskStore.setTaskStatus(taskId, username, editableParameters, recipientName); } }
public void createNotificationForMessage(int MessageId, string cfgSQLConnectionString) { this.cfgSQLConnectionString = cfgSQLConnectionString; configStore = StoreHandler.getConfigStore(cfgSQLConnectionString); baseURL = configStore.getString(BaseURL); templatepath = configStore.getString(Email_NotificationTemplate); if (configStore.getBool(Email_Notifications_Messages)) { taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString); T_Task task = taskStore.getReceiveTaskForMessageId(MessageId); if (task != null) { messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString); mail = new SmtpUtils(configStore); processStore = StoreHandler.getProcessStore(cfgSQLConnectionString); instance = processStore.getWorkflowInstance(task.WFId); M_Message message = messageStore.getMessageBymsgId(MessageId); createReceiveNotification(message, task); } } }
public TaskRepository(ITaskStore taskStore) { this._taskStore = taskStore; }
public TaskRepository() { _taskStore = new XmlTaskStore(); }
public sealed override void Initialize(IHostContext hostContext) { base.Initialize(hostContext); _taskStore = HostContext.GetService <ITaskStore>(); _term = hostContext.GetService <ITerminal>(); }
public void Refresh() { if (this._taskStoreLocator.GetStore() != this.lastTaskStore) { this.lastTaskStore = this._taskStoreLocator.GetStore(); this.BuildPanoramaDimensions(); this.RaisePropertyChanged(string.Empty); this.StartSyncCommand.RaiseCanExecuteChanged(); } }