示例#1
0
        /// <summary>
        /// 取得动作
        /// </summary>
        /// <param name="wbapRequest"></param>
        /// <param name="response"></param>
        /// <param name="pageName"></param>
        /// <param name="sessionId"></param>
        /// <returns></returns>
        public ActionBroker GetAction(WbapRequest wbapRequest, ref WbapResponse response, string pageName, string sessionId, ISecurity secHandler)
        {
            SetSessionInfo(wbapRequest);
            ActionBroker action = null;

            SaveRequestData(wbapRequest);
            if (response == null)
            {
                response = new WbapResponse();
            }
            response.PageName = pageName;

            //if (pageCtr == null || pageCtr.BuzObject.Id != pageName)
            //    pageCtr = new PageController(pageName,sessionId);

            this.sessionId = sessionId;

            ActionFlowSchema actionSchema = null;

            if (pageCtr.Schame.Actions.FindItem(wbapRequest.ActionId) == null)
            {
                if (wbapRequest.ActionId.Equals("onLoad", StringComparison.OrdinalIgnoreCase))
                {
                    return(null);
                }
                else
                {
                    action   = new ActionBroker(wbapRequest, actionSchema, pageCtr, sessionId, WbdlSchema, secHandler);
                    response = action.ExecuteFar();
                    return(null);
                }
            }

            try
            {
                actionSchema = pageCtr.Schame.Actions.GetItem(wbapRequest.ActionId);
            }
            catch (Exception)
            {
                throw (new E_CanNotFindActionSchema(wbapRequest.ActionId));
            }

            if (actionSchema == null)
            {
                throw (new E_CanNotFindActionSchema(wbapRequest.ActionId));
            }
            action = new ActionBroker(wbapRequest, actionSchema, pageCtr, sessionId, WbdlSchema, _ISec);
            return(action);
        }
示例#2
0
 /// <summary>
 /// Tries to determine why the Signal cache is empty, and attempts to resolve it if possible
 /// </summary>
 private void GetSignalNullReason()
 {
     try
     {
         var setupProcessorId = Cache.RetrieveItem("SetupProcessorConfigurationId", tenantId: CacheTenantId);
         if (setupProcessorId == null)
         {
             Prompts.Add(new Prompt
             {
                 Message  = "The Setup Processor has not been run. Make sure the Setup Processor has been configured correctly and run it again.",
                 Severity = PromptSeverity.MayNotContinue
             });
         }
         else
         {
             if (ActionBroker.IsConfigurationRunning((int)setupProcessorId))
             {
                 Prompts.Add(new Prompt
                 {
                     Message  = "The Setup Processor is currently running, once it has completed this will run successfully.",
                     Severity = PromptSeverity.MayNotContinue
                 });
             }
             else
             {
                 // For some reason the Setup Processor failed to run.. let's force it to run again, and hope it completes!
                 Logger.LogInfo(LogCategory.Processor, this.Name, "Force starting the Setup Processor, as it has failed to run for some reason, please check the logs for additional information.");
                 ActionBroker.StartConfiguration((int)setupProcessorId, DerivedFromConfigurationType.Processor);
                 Prompts.Add(new Prompt
                 {
                     Message  = "The Setup Processor processor has been forced to start, the Value Push Processor cannot run to completion until it has run successfully.",
                     Severity = PromptSeverity.MayNotContinue
                 });
             }
         }
     }
     catch (Exception ex)
     {
         Prompts.Add(new Prompt
         {
             Message  = ex.ToString(),
             Severity = PromptSeverity.MayNotContinue
         });
     }
 }
示例#3
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns></returns>
        public WbapResponse Initialize(string pageName, string sessionId)
        {
            WbapResponse resp = null;

            //CheckPermissionRetrun ret = _ISec.CheckObjectPermission(sessionId, pageName, 1);
            //if (ret != CheckPermissionRetrun.Yes)
            //{
            //    resp = new WbapResponse();
            //    resp.ErrorNo = (int)(ret);
            //    // Convert.ToInt32
            //    resp.Message = "Access denied: " + ret.ToString();
            //    resp.PageName = pageName;
            //    return resp;
            //}

            //pageCtr = new PageController(pageName,sessionId);

            this.sessionId = sessionId;
            // this.schema = pageCtr.Schame;
            pageCtr.Initialize();

            WbapRequest request = new WbapRequest();

            request.ActionId = "OnLoad";
            request.Step     = 0;
            request.PageName = pageName;

            #region 权限管理
            //ret =_ISec.CheckObjectPermission(sessionId, streamRequest.ActionId, 2);
            //if (ret != CheckPermissionRetrun.Yes)
            //{
            //    resp = new WbapResponse();
            //    resp.ErrorNo = Convert.ToInt32(ret);
            //    resp.Message = "Access denied:" + ret.ToString();
            //    resp.PageName = pageName;
            //    return resp;
            //}
            #endregion

            ActionBroker action = GetAction(request, ref resp, pageName, sessionId, _ISec);

            if (action != null)
            {
                resp = action.Execute();
            }



            //元素捆绑
            foreach (FieldBindSchema fieldBindSchema in WbdlSchema.FieldBinds)
            {
                //ret = _ISec.CheckObjectPermission(sessionId, fieldBindSchema.Id, 2);
                //if (ret == CheckPermissionRetrun.Yes)
                this.InitualElement(resp, fieldBindSchema);
            }

            //捆绑列表列属性
            foreach (DataListBindSchema listBindSchema in WbdlSchema.DataListBinds)
            {
                //ret = _ISec.CheckObjectPermission(sessionId, listBindSchema.Id, 2);
                //if (ret == CheckPermissionRetrun.Yes)
                //{
                foreach (FieldBindSchema fieldBindSchema in listBindSchema.Columns)
                {
                    //ret = _ISec.CheckObjectPermission(sessionId, fieldBindSchema.Id, 2);
                    //if (ret == CheckPermissionRetrun.Yes)
                    this.InitualElement(resp, fieldBindSchema);
                }
                //}
            }

            //控件捆绑
            foreach (WbdlControl wbdlControl in WbdlSchema.Controls)
            {
                ActionSchema ms = wbdlControl.DataFunction;
                MethodBroker mb = new MethodBroker(ms);

                object invokeRet = mb.Invoke(sessionId, WbdlSchema, request);

                WbapControl wbapControl = new WbapControl();
                wbapControl.Data         = invokeRet;
                wbapControl.VenderObject = wbdlControl.VenderObject;
                wbapControl.VenderUrl    = wbdlControl.VerderUrl;
                resp.Controls.Add(wbdlControl.Id, wbapControl);
            }



            //捆绑数据;
            pageCtr.FillDataBodyWithDataSet(resp.ElementBinds);
            //捆绑列表

            //foreach (PageDataList pageList in pageCtr.Page.PageLists.Values)
            //{
            //    string listId = pageList.ElementId;
            //    if (!resp.ElementBinds.ContainsKey(listId + WbapList.TypeMarker))
            //    {
            //        WbapList wbapList = pageCtr.GetWbapList(listId);
            //        resp.ElementBinds.Add(listId + WbapList.TypeMarker, wbapList);
            //    }

            //}



            //捆绑事件
            foreach (EventSchema eventBindSchema in WbdlSchema.EventBinds)
            {
                string    actionId  = eventBindSchema.ActionFlow;
                WbapEvent wbapEvent = new WbapEvent();
                wbapEvent.EventName = eventBindSchema.EventName;
                BuildAction(actionId, 0, wbapEvent.Action, request);
                resp.ElementBinds.AddEvent(eventBindSchema.Id, wbapEvent);
            }

            //替换全局变量

            foreach (string elementKey in resp.ElementBinds.Keys)
            {
                if (elementKey.Length > 0 && elementKey[0] == '$')
                {
                    resp.ElementBinds[elementKey] = request.ElementBinds[elementKey];
                }
            }

            return(resp);
        }