SenseNet.Portal.Page.SetPageData C# (CSharp) 메소드

SetPageData() 개인적인 메소드

private SetPageData ( ) : void
리턴 void
        private void SetPageData()
        {
            if (this.SmartUrl == null || this.CopyInProgress)
            {
                var savedFlag = SmartUrlChanged;
                this.SmartUrl = string.Empty;
                SmartUrlChanged = savedFlag;
            }

            if (this.SmartUrl != String.Empty)
            {
                NodeQueryResult result;
                using (new SystemAccount())
                {
                    if (StorageContext.Search.IsOuterEngineEnabled && StorageContext.Search.SearchEngine != InternalSearchEngine.Instance)
                    {
                        //this NodeQuery will be compiled to LucQuery because the outer engine is enabled
                        var pageQuery = new NodeQuery();
                        pageQuery.Add(new TypeExpression(ActiveSchema.NodeTypes[typeof (Page).Name]));
                        pageQuery.Add(new StringExpression(ActiveSchema.PropertyTypes["SmartUrl"], StringOperator.Equal, this.SmartUrl));
                        pageQuery.Add(new NotExpression(new StringExpression(StringAttribute.Path, StringOperator.Equal, this.Path)));

                        result = pageQuery.Execute();
                    }
                    else
                    {
                        //we need to execute a direct database query because the outer engine is disabled
                        result = NodeQuery.QueryNodesByTypeAndPathAndProperty(
                            ActiveSchema.NodeTypes[typeof (Page).Name], false, null, false,
                            new List<QueryPropertyData>(new[] { 
                                new QueryPropertyData {PropertyName = "SmartUrl", Value = this.SmartUrl},
                                new QueryPropertyData {PropertyName = "Path", Value = this.Path, QueryOperator = Operator.NotEqual}}));
                    }
                }

                if (result.Count > 0)
                {
                    var page = result.Nodes.First() as Page;
                    if (page != null)
                        throw new Exception(String.Concat("'", this.SmartUrl, "' smartUrl is already mapped to page with path '", page.Path, "'"));
                }
            }

            SetBinary();
        }