コード例 #1
0
        public void TaskConverterEntityToModelWithStructureTest()
        {
            IJsonConverter            jsonConverter            = new JsonConverter(LoggerFactory);
            ICachedExpressionCompiler cachedExpressionCompiler = new CachedExpressionCompiler(LoggerFactory);
            IExpressionConverter      expressionConverter      = new ExpressionConverter(jsonConverter, cachedExpressionCompiler, LoggerFactory);
            ITaskConverter            taskConverter            = new TaskConverter(expressionConverter, jsonConverter, LoggerFactory);

            TestTaskConverterClass instance = new TestTaskConverterClass();

            ActivationData activationData = expressionConverter.Convert(() => instance.MethodJustClass(TaskCancellationToken.Null));

            TaskModel taskModel = new TaskModel(1, 2, 3, activationData, TaskStates.New, new ScheduleInformation(1));

            TaskEntity taskEntity = taskConverter.Convert(taskModel);

            Assert.IsNotNull(taskEntity);

            TaskModel actual = taskConverter.Convert(taskEntity);

            Assert.IsNotNull(actual);

            Assert.AreEqual(taskEntity.Id, actual.Id);
            Assert.AreEqual(taskEntity.QueueId, actual.QueueId);
            Assert.AreEqual(taskEntity.TaskState, actual.TaskState);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        public ProcessEngineWrapper(ProcessInstanceConverter processInstanceConverter,
                                    PageableProcessInstanceRepositoryService pageableProcessInstanceService,
                                    TaskConverter taskConverter,
                                    PageableTaskRepositoryService pageableTaskService,
                                    MessageProducerActivitiEventListener listener,
                                    SecurityPoliciesApplicationService securityService,
                                    AuthenticationWrapper authenticationWrapper,
                                    IApplicationEventPublisher eventPublisher,
                                    IProcessEngine processEngine,
                                    HistoricInstanceConverter historicInstanceConverter,
                                    ILoggerFactory loggerFactory)
        {
            this.processEngine                  = processEngine;
            this.processInstanceConverter       = processInstanceConverter;
            this.runtimeService                 = processEngine.RuntimeService;
            this.pageableProcessInstanceService = pageableProcessInstanceService;
            this.taskService         = processEngine.TaskService;
            this.taskConverter       = taskConverter;
            this.pageableTaskService = pageableTaskService;
            this.historyService      = processEngine.HistoryService;
#warning 暂时不处理事件侦听
            //this.runtimeService.addEventListener(listener);
            this.securityService           = securityService;
            this.repositoryService         = processEngine.RepositoryService;
            this.authenticationWrapper     = authenticationWrapper;
            this.eventPublisher            = eventPublisher;
            this.historicInstanceConverter = historicInstanceConverter;
            logger = loggerFactory.CreateLogger <ProcessEngineWrapper>();
        }
コード例 #3
0
ファイル: AsyncCache.cs プロジェクト: sivakumarganga/microdot
        public Task GetOrAdd(string key, Func <Task> serviceMethod, Type taskResultType, string[] metricsKeys, IMethodCachingSettings settings)
        {
            var getValueTask = Task.Run(() => GetOrAdd(key, () =>
                                                       TaskConverter.ToWeaklyTypedTask(serviceMethod(), taskResultType), metricsKeys, settings));

            return(TaskConverter.ToStronglyTypedTask(getValueTask, taskResultType));
        }
コード例 #4
0
        public async Task <IActionResult> GetTaskAsync([FromRoute] string taskId, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (!Guid.TryParse(taskId, out var modeltaskId))
            {
                return(this.NotFound());
            }

            Models.Tasks.MyTask modelTask = null;
            try
            {
                modelTask = await this.tasks.GetAsync(modeltaskId, cancellationToken);
            }
            catch (Models.Tasks.TaskNotFoundException)
            {
                return(this.NotFound());
            }

            if (!UserHaveTaskAccess(modelTask))
            {
                return(Forbid());
            }

            var clientTask = TaskConverter.Convert(modelTask);

            return(this.Ok(clientTask));
        }
コード例 #5
0
        public object Invoke(MethodInfo targetMethod, object[] args)
        {
            // TODO: Add caching to this step to prevent using reflection every call
            var resultReturnType = targetMethod.ReturnType.GetGenericArguments().SingleOrDefault() ?? typeof(object);
            var request          = new HttpServiceRequest(targetMethod, args);

            return(TaskConverter.ToStronglyTypedTask(Invoke(request, resultReturnType), resultReturnType));
        }
コード例 #6
0
        SolidityStatement CreateTouchFunctionLogic(TaskConverter attachedToConverter)
        {
            var touchLogic = new SolidityStatement();

            //Disable the current state
            touchLogic.Add(attachedToConverter.GetChangeActiveStateStatement(false));
            //place the call statement of the next element
            touchLogic.Add(processConverter.GetStatementOfNextElement(eventElement));
            touchLogic.Add(new SolidityStatement("return false"));
            return(touchLogic);
        }
コード例 #7
0
        public void TestTask()
        {
            IDataAccessor da = taskDA;

            read(da);
            DataTable table = dataSet.task;

            Assert.AreEqual(0, table.Rows.Count, "Table is empty");
            DataRow personRow = dataSet.person.NewRow();
            Person  person    = new Person("person", "", Person.PersonType.ADMIN);

            PersonConverter.toDataRow(personRow, person);
            dataSet.person.Rows.Add(personRow);
            write(personDA);
            DataRow modelRow = dataSet.model.NewRow();
            Model   model    = new Model("model");

            ModelConverter.toDataRow(modelRow, model);
            dataSet.model.Rows.Add(modelRow);
            write(modelDA);
            DataRow jobRow = dataSet.job.NewRow();
            Job     job    = new Job(0, "job", DateTime.Now, "test", 0, 0);

            JobConverter.toDataRow(jobRow, job);
            dataSet.job.Rows.Add(jobRow);
            write(jobDA);
            DataRow printerRow = dataSet.printer.NewRow();
            Printer printer    = new Printer("printer");

            PrinterConverter.toDataRow(printerRow, printer);
            dataSet.printer.Rows.Add(printerRow);
            write(printerDA);
            DataRow newRow = table.NewRow();

            TaskConverter.toDataRow(newRow, new Task(0, "TestTask", 0, 0, DateTime.Now, DateTime.Now, DateTime.Now, Task.TaskStatus.NEW, 0));
            table.Rows.Add(newRow);
            write(da);
            Assert.AreEqual(1, table.Rows.Count, "Added one record");
            DataRow firstRow = table.Rows[0];

            Assert.AreEqual("TestTask", firstRow["name"], "Names are equals");
            firstRow["name"] = "RenameTest";
            write(da);
            List <DataRow> findList = table.Select("name = 'RenameTest'").OfType <DataRow>().ToList();

            Assert.AreEqual("RenameTest", findList[0]["name"], "Names are equals");
            firstRow.Delete();
            write(da);
            read(da);
            int count = dataSet.task.Rows.Count;

            Assert.AreEqual(0, count);
        }
コード例 #8
0
 /// <inheritdoc />
 public TaskControllerImpl(ProcessEngineWrapper processEngine,
                           IProcessEngine engine,
                           TaskResourceAssembler taskResourceAssembler,
                           AuthenticationWrapper authenticationWrapper,
                           TaskConverter taskConverter)
 {
     this.engine                = engine;
     this.taskService           = engine.TaskService;
     this.authenticationWrapper = authenticationWrapper;
     this.processEngine         = processEngine;
     this.taskResourceAssembler = taskResourceAssembler;
     this.taskConverter         = taskConverter;
 }
コード例 #9
0
        SolidityFunction CreateTouchFunction(TaskConverter attachedToConverter)
        {
            var function = new SolidityFunction($"touch{GetElementCallName()}", SolidityVisibility.Public, "bool");

            function.AddParameters(processConverter.GetIdentifiersAsParameters());
            function.AddModifier($"{ConversionTemplates.StateGuardModifierName(attachedToConverter.GetElementCallName())}({processConverter.GetIdentifierNames()})");

            var solidityCondition = new SolidityIfElse();

            solidityCondition.AddConditionBlock($"now > {GetTimerCondition()}", CreateTouchFunctionLogic(attachedToConverter));
            function.AddToBody(solidityCondition);
            function.AddToBody(new SolidityStatement("return true"));
            return(function);
        }
コード例 #10
0
 /// <inheritdoc />
 public TaskControllerImpl(ProcessEngineWrapper processEngine,
                           IProcessEngine engine,
                           TaskResourceAssembler taskResourceAssembler,
                           AuthenticationWrapper authenticationWrapper,
                           TaskConverter taskConverter,
                           ILoggerFactory loggerFactory)
 {
     this.engine                = engine;
     this.taskService           = engine.TaskService;
     this.authenticationWrapper = authenticationWrapper;
     this.processEngine         = processEngine;
     this.taskResourceAssembler = taskResourceAssembler;
     this.taskConverter         = taskConverter;
     this.logger                = loggerFactory.CreateLogger <TaskControllerImpl>();
 }
コード例 #11
0
 /// <summary>
 ///
 /// </summary>
 public PageableTaskRepositoryService(ITaskService taskService,
                                      TaskConverter taskConverter,
                                      HistoricTaskInstanceConverter historicTaskInstanceConverter,
                                      IHistoryService historyService,
                                      PageRetriever pageRetriever,
                                      TaskSortApplier sortApplier,
                                      HistoryTaskSortApplier historicSortApplier)
 {
     this.taskService                   = taskService;
     this.historyService                = historyService;
     this.taskConverter                 = taskConverter;
     this.pageRetriever                 = pageRetriever;
     this.sortApplier                   = sortApplier;
     this.historicSortApplier           = historicSortApplier;
     this.historicTaskInstanceConverter = historicTaskInstanceConverter;
 }
コード例 #12
0
ファイル: AsyncCache.cs プロジェクト: boriphuth/microdot
        public Task GetOrAdd(string key, Func <Task> factory, Type taskResultType, CacheItemPolicyEx policy, params string[] metricsKeys)
        {
            var getValueTask = GetOrAdd(key, () => TaskConverter.ToWeaklyTypedTask(factory(), taskResultType), policy, metricsKeys, taskResultType);

            return(TaskConverter.ToStronglyTypedTask(getValueTask, taskResultType));
        }
コード例 #13
0
 /// <summary>
 ///
 /// </summary>
 public TaskCreatedEventConverter(TaskConverter taskConverter, RuntimeBundleProperties runtimeBundleProperties) : base(runtimeBundleProperties)
 {
     this.taskConverter = taskConverter;
 }
コード例 #14
0
 public TaskBusiness(IRepository <Models.Task> repository)
 {
     _repository = repository;
     _converter  = new TaskConverter();
 }
コード例 #15
0
 void AddTouchCheckToAttachedElement(TaskConverter attachedToConverter)
 {
     attachedToConverter.AddBoundaryEventCall(new SolidityStatement($"require(touch{GetElementCallName()}({processConverter.GetIdentifierNames()}))"));
 }