public async Task shouldReceiveResponseAsExpected()
        {
            // given
            var expectedResponse = new GetWorkflowResponse
            {
                BpmnProcessId = "process",
                Version       = 1,
                WorkflowKey   = 2,
                ResourceName  = DemoProcessPath,
                BpmnXml       = File.ReadAllText(DemoProcessPath)
            };

            TestService.AddRequestHandler(typeof(GetWorkflowRequest), request => expectedResponse);

            // when
            var workflowResourceResponse = await ZeebeClient.NewWorkflowResourceRequest()
                                           .BpmnProcessId("process")
                                           .LatestVersion()
                                           .Send();

            // then
            Assert.AreEqual(2, workflowResourceResponse.WorkflowKey);
            Assert.AreEqual(1, workflowResourceResponse.Version);
            Assert.AreEqual(DemoProcessPath, workflowResourceResponse.ResourceName);
            Assert.AreEqual("process", workflowResourceResponse.BpmnProcessId);
            Assert.AreEqual(File.ReadAllText(DemoProcessPath), workflowResourceResponse.BpmnXml);
        }
コード例 #2
0
 public WorkflowResourceResponse(GetWorkflowResponse response)
 {
     BpmnXml       = response.BpmnXml;
     Version       = response.Version;
     BpmnProcessId = response.BpmnProcessId;
     ResourceName  = response.ResourceName;
     WorkflowKey   = response.WorkflowKey;
 }
コード例 #3
0
        public ActionResult GetWorkflowReport(short workflowID)
        {
            var accountId = this.Identity.ToAccountID();

            ViewBag.CurrentWfId = workflowService.GetWorkflowIdByParentWfId(workflowID);
            GetWorkflowResponse response = workflowService.GetWorkFlow(new GetWorkflowRequest()
            {
                WorkflowID  = workflowID,
                AccountId   = accountId,
                RoleId      = this.Identity.ToRoleID(),
                RequestedBy = this.Identity.ToUserID()
            });

            if (response.WorkflowViewModel != null && response.WorkflowViewModel.WorkflowActions != null)
            {
                response.WorkflowViewModel.WorkflowActions.Each(a =>
                {
                    if (a.WorkflowActionTypeID == WorkflowActionType.SetTimer)
                    {
                        if (((WorkflowTimerActionViewModel)a.Action).RunAt != null)
                        {
                            ((WorkflowTimerActionViewModel)a.Action).RunAt = ((WorkflowTimerActionViewModel)a.Action).RunAt.Value.ToUtcBrowserDatetime();
                        }
                        else if (((WorkflowTimerActionViewModel)a.Action).RunAtTime != null)
                        {
                            DateTime value = ((WorkflowTimerActionViewModel)a.Action).RunAtTime.Value.ToUtcBrowserDatetime();
                            ((WorkflowTimerActionViewModel)a.Action).RunAtTime = value;
                        }
                        else if (((WorkflowTimerActionViewModel)a.Action).StartDate != null && ((WorkflowTimerActionViewModel)a.Action).EndDate != null)
                        {
                            ((WorkflowTimerActionViewModel)a.Action).StartDate = ((WorkflowTimerActionViewModel)a.Action).StartDate.Value.ToUtcBrowserDatetime();
                            ((WorkflowTimerActionViewModel)a.Action).EndDate   = ((WorkflowTimerActionViewModel)a.Action).EndDate.Value.ToUtcBrowserDatetime();
                        }
                        if (((WorkflowTimerActionViewModel)a.Action).RunOnDate != null)
                        {
                            ((WorkflowTimerActionViewModel)a.Action).RunOnDate = ((WorkflowTimerActionViewModel)a.Action).RunOnDate.Value.ToUserUtcDateTime();
                        }
                    }
                });
            }
            var viewModel = ProcessWorkflowFromServer(response.WorkflowViewModel, response.WorkflowViewModel);

            ViewBag.DateFormat    = this.Identity.ToDateFormat();
            ViewData["Parentwfs"] = response.ParentWorkflows.ToList();
            if (Request.IsAjaxRequest() == true)
            {
                return(Json(new
                {
                    success = true,
                    response = viewModel
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(View("WorkflowReport", viewModel));
            }
        }
コード例 #4
0
        public ActionResult FullEditWorkFlow(short WorkflowID)
        {
            GetWorkflowResponse response = workflowService.CopyWorkFlow(new GetWorkflowRequest()
            {
                WorkflowID    = WorkflowID,
                IsNewWorkflow = true,
                AccountId     = this.Identity.ToAccountID(),
                RoleId        = this.Identity.ToRoleID(),
                RequestedBy   = this.Identity.ToUserID()
            });

            ViewBag.ParentID = WorkflowID;

            if (response.WorkflowViewModel != null && response.WorkflowViewModel.WorkflowActions != null)
            {
                response.WorkflowViewModel.WorkflowActions.Each(a =>
                {
                    if (a.WorkflowActionTypeID == WorkflowActionType.SetTimer)
                    {
                        if (((WorkflowTimerActionViewModel)a.Action).RunAt != null)
                        {
                            Logger.Current.Informational("workflow  set timer action time zone(when retriving workflow in controller): " + ((WorkflowTimerActionViewModel)a.Action).RunAt.Value.ToUtcBrowserDatetime());
                            ((WorkflowTimerActionViewModel)a.Action).RunAt = ((WorkflowTimerActionViewModel)a.Action).RunAt.Value.ToUtcBrowserDatetime();
                        }
                        else if (((WorkflowTimerActionViewModel)a.Action).RunAtTime != null)
                        {
                            Logger.Current.Informational("workflow set timer action time zone(when retriving workflow in controller): " + ((WorkflowTimerActionViewModel)a.Action).RunAtTime.Value.ToUtcBrowserDatetime());
                            DateTime value = ((WorkflowTimerActionViewModel)a.Action).RunAtTime.Value.ToUtcBrowserDatetime();
                            ((WorkflowTimerActionViewModel)a.Action).RunAtTime = value;
                        }
                        else if (((WorkflowTimerActionViewModel)a.Action).StartDate != null && ((WorkflowTimerActionViewModel)a.Action).EndDate != null)
                        {
                            ((WorkflowTimerActionViewModel)a.Action).StartDate = ((WorkflowTimerActionViewModel)a.Action).StartDate.Value.ToUtcBrowserDatetime();
                            ((WorkflowTimerActionViewModel)a.Action).EndDate   = ((WorkflowTimerActionViewModel)a.Action).EndDate.Value.ToUtcBrowserDatetime();
                        }
                        if (((WorkflowTimerActionViewModel)a.Action).RunOnDate != null)
                        {
                            ((WorkflowTimerActionViewModel)a.Action).RunOnDate = ((WorkflowTimerActionViewModel)a.Action).RunOnDate.Value.ToUserUtcDateTime();
                        }
                    }
                });
            }
            var viewModel = ProcessWorkflowFromServer(response.WorkflowViewModel, response.WorkflowViewModel);

            ViewBag.DateFormat = this.Identity.ToDateFormat();
            ViewBag.SenderName = this.Identity.ToFirstName() + " " + this.Identity.ToLastName();
            return(View("AddEditWorkflow", viewModel));
        }
コード例 #5
0
        public static GetWorkflowResponse Unmarshall(UnmarshallerContext context)
        {
            GetWorkflowResponse getWorkflowResponse = new GetWorkflowResponse();

            getWorkflowResponse.HttpResponse = context.HttpResponse;
            getWorkflowResponse.RequestId    = context.StringValue("GetWorkflow.RequestId");

            GetWorkflowResponse.GetWorkflow_WorkflowInfo workflowInfo = new GetWorkflowResponse.GetWorkflow_WorkflowInfo();
            workflowInfo.WorkflowId          = context.StringValue("GetWorkflow.WorkflowInfo.WorkflowId");
            workflowInfo.Name                = context.StringValue("GetWorkflow.WorkflowInfo.Name");
            workflowInfo.ActionList          = context.StringValue("GetWorkflow.WorkflowInfo.ActionList");
            workflowInfo.CreationTime        = context.StringValue("GetWorkflow.WorkflowInfo.CreationTime");
            workflowInfo.ModifyTime          = context.StringValue("GetWorkflow.WorkflowInfo.ModifyTime");
            getWorkflowResponse.WorkflowInfo = workflowInfo;

            return(getWorkflowResponse);
        }
コード例 #6
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetWorkflowResponse response = new GetWorkflowResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Workflow", targetDepth))
                {
                    var unmarshaller = WorkflowUnmarshaller.Instance;
                    response.Workflow = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
コード例 #7
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetWorkflowResponse response = new GetWorkflowResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("Attributes", targetDepth))
                {
                    var unmarshaller = WorkflowAttributesUnmarshaller.Instance;
                    response.Attributes = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("ErrorDescription", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.ErrorDescription = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("LastUpdatedAt", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.LastUpdatedAt = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Metrics", targetDepth))
                {
                    var unmarshaller = WorkflowMetricsUnmarshaller.Instance;
                    response.Metrics = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("StartDate", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.StartDate = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Status", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Status = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("WorkflowId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.WorkflowId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("WorkflowType", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.WorkflowType = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }