Beispiel #1
0
        protected SPModelQuery ApplyFilters()
        {
            CamlExpression expression = originalExpression;

            if (expression == Caml.False || expressionForCTFilter == Caml.False)
            {
                return(this);
            }
            foreach (ISPModelQueryFilter filter in filters)
            {
                if (filter.ShouldTransformExpression(this))
                {
                    ISPModelQueryFilter clone = (ISPModelQueryFilter)filter.Clone();
                    expression = clone.TransformExpression(this, expression);
                    if (expression == Caml.False)
                    {
                        break;
                    }
                }
            }
            if (expression != this.Expression)
            {
                SPModelQuery result = (SPModelQuery)MemberwiseClone();
                result.originalExpression = expression;
                result.expression         = null;
                return(result);
            }
            return(this);
        }
Beispiel #2
0
 public virtual bool ShouldTransformExpression(SPModelQuery query)
 {
     return(true);
 }
Beispiel #3
0
 CamlExpression ISPModelQueryFilter.TransformExpression(SPModelQuery query, CamlExpression expression)
 {
     Initialize(query);
     return(base.Visit(expression));
 }
Beispiel #4
0
 protected virtual void Initialize(SPModelQuery query)
 {
 }
Beispiel #5
0
        protected override void Initialize(SPModelQuery query)
        {
            SPList list = query.Manager.ContextLists.First().EnsureList(query.Manager.ObjectCache).List;

            this.allowedFields = list.Fields.OfType <SPField>().Select(v => v.InternalName).ToArray();
        }
Beispiel #6
0
 public override bool ShouldTransformExpression(SPModelQuery query)
 {
     return(!query.ForceKeywordSearch && query.Manager.ImplicitQueryMode == SPModelImplicitQueryMode.ListQuery);
 }