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); }
public virtual bool ShouldTransformExpression(SPModelQuery query) { return(true); }
CamlExpression ISPModelQueryFilter.TransformExpression(SPModelQuery query, CamlExpression expression) { Initialize(query); return(base.Visit(expression)); }
protected virtual void Initialize(SPModelQuery query) { }
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(); }
public override bool ShouldTransformExpression(SPModelQuery query) { return(!query.ForceKeywordSearch && query.Manager.ImplicitQueryMode == SPModelImplicitQueryMode.ListQuery); }