コード例 #1
0
        public Page(WbpsResquest req, string sessionId, ISecurity security, ISession session)
        {
            this.sessionId = sessionId;
            this.url       = req.Url;
            this.security  = security;
            this.session   = session;


            this.pageId = getPageId(req.PageId);
            string query = req.Query;

            if (!string.IsNullOrEmpty(query))
            {
                queryStrings = new Dictionary <string, string>();
                string[] nameValues = query.Split('&');
                for (int i = 0; i < nameValues.Length; i++)
                {
                    string[] nameValue = nameValues[i].Split('=');
                    if (nameValue.Length > 1)
                    {
                        queryStrings.Add(nameValue[0], nameValue[1].Trim());
                    }
                }
            }

            pageSchema = null;
            if (WbdlSchemaContainer.Instance().Contains(this.pageId))
            {
                pageSchema = WbdlSchemaContainer.Instance().GetItem(this.pageId);
                pageSchema.ChangedEvent += new Schema.SchemaEventHandler(PageSchema_Changed);
                Initialize();
            }
            this.isOpen = true;
        }
コード例 #2
0
        private Page getPage(WbpsResquest request, string sessionId)
        {
            string pageId = Page.getPageId(request.PageId);
            string url    = request.Url;

            if (!string.IsNullOrEmpty(request.FlowId))
            {
                if (currentPage != null && string.IsNullOrEmpty(currentPage.ExecutingFlow))
                {
                    pages.Clear();
                }

                if (currentPage != null && currentPage.PageId.Equals(pageId, StringComparison.OrdinalIgnoreCase))
                {
                    return(currentPage);
                }

                if (pages.ContainsKey(pageId))
                {
                    return(pages[pageId]);
                }
            }



            Page ret = new Page(request, sessionId, this.security, session);

            if (currentPage == null || string.IsNullOrEmpty(currentPage.ExecutingFlow))
            {
                currentPage = ret;
            }
            else if (currentPage != null)
            {
                if (pages.ContainsKey(pageId))
                {
                    pages[pageId] = ret;
                }
                else
                {
                    pages.Add(pageId, ret);
                }
            }


            return(ret);
        }
コード例 #3
0
        public WbpsResponse invoke(WbpsResquest request, string sessionId)
        {
            WbpsResponse ret = new WbpsResponse();

            //    if (string.IsNullOrEmpty(request.FlowId))
            //        this.page = null;

            Page page = getPage(request, sessionId);

            if (!security.CheckObjectPermission("ListData", request.PageId, PermissionTypes.Read))
            {
                ret.Err = JsonExceptionUtils.ThrowErr(SecErrs.NotLogin, security.LoginPageUrl).Err;
                return(ret);
            }

            ret = page.InvokeRequest(request);

            return(ret);
        }
コード例 #4
0
        /// <summary>
        /// 执行一个Wbps请求
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public WbpsResponse InvokeRequest(WbpsResquest request)
        {
            WbpsResponse ret = new WbpsResponse();

            if (pageSchema == null)
            {
                return(ret);
            }
            string flowId = request.FlowId;

            ActionFlowSchema fs = null;

            if (!string.IsNullOrEmpty(flowId))
            {
                fs = pageSchema.ActionFlows.FindItem(flowId);
                if (fs == null)
                {
                    throw new XException("不能发现流程配置" + flowId);
                }
            }

            if (request.Step > 0)
            {
                this.nextStep  = request.Step;
                request.Sender = this.request.Sender;
            }

            this.request = request;

            bool isEnd = true;

            if (!security.CheckObjectPermission("ListData", request.PageId, PermissionTypes.Read))
            {
                ret.Err = JsonExceptionUtils.ThrowErr(SecErrs.NotPemission, security.LoginPageUrl).Err;
                return(ret);
            }

            if (request.ElementDatas != null)
            {
                if (fs != null && FlowNeedValid(fs))
                {
                    ValidateRequestData(request.ElementDatas);
                }
                ReceiveRequestData(request.ElementDatas);
            }


            if (fs != null)
            {
                isEnd = InvokeFlow(fs, request.FlowVars);
            }

            ret.ElementDatas = GetChangedElements();

            if (!isEnd)
            {
                ret.BackRequest           = new WbpsResquest();
                ret.BackRequest.PageId    = request.PageId;
                ret.BackRequest.FlowId    = request.FlowId;
                ret.BackRequest.Step      = this.nextStep;
                ret.BackRequest.SessionId = this.sessionId;

                for (int i = 0; i < NeedDatas.Count; i++)
                {
                    ret.BackRequest.ElementDatas.Add(NeedDatas[i], null);
                }

                this.executingFlow = request.FlowId;
            }
            else
            {
                this.executingFlow = null;
            }

            if (!string.IsNullOrEmpty(this.clientScript))
            {
                ret.ClientScript = CheckValueVar(this.clientScript).ToString();
            }

            this.clientScript = "";


            if (fs == null)
            {
                ret.Events = getWbapEvents();
            }

            return(ret);
        }