private static ISearchParameter CreateParameter(string identifier, string value, ISearchCriterionSet criterionSet) { ISearchCriterion criterion = criterionSet.GetCriterion(identifier); if (criterion == null) { return(null); } return(criterion.CreateParameter(value)); }
internal static IQualifiedSearchCriterion QualifyCriterion(ISearchCriterion criterion) { XmlQualifiedName xqname = criterion.Identifier.ToXmlQualifiedName(); if (xqname == null) { throw new ArgumentException("Criterion '{0}' must declare namespace to be qualified", criterion.Identifier); } return(QualifyCriterion(xqname, criterion)); }
public override void Add(ISearchCriterion criterion) { IQualifiedSearchCriterion qcriterion = null; if (criterion is IQualifiedSearchCriterion) { qcriterion = criterion as IQualifiedSearchCriterion; } else { qcriterion = QualifyCriterion(criterion); } AddCriterionNamespaceIfNotExist(qcriterion); base.Add(criterion); }
internal static XmlNamespaceSearchCriterionSet QualifyCriterionSetForOpenSearch(ISearchCriterionSet criterionSet) { if (criterionSet is XmlNamespaceSearchCriterionSet) { return(criterionSet as XmlNamespaceSearchCriterionSet); } XmlNamespaceSearchCriterionSet xmlCriterionSet = new XmlNamespaceSearchCriterionSet(); foreach (var criterion in criterionSet) { ISearchCriterion newCriterion = criterion; if (criterion is FreeTextSearchCriterion) { xmlCriterionSet.AddNamespacePrefixIfNotExist(OSNS_PREFIX); xmlCriterionSet.Add(XmlNamespaceSearchCriterionSet.QualifyCriterion(OSXN_SEARCHTERMS, criterion)); } else if (criterion is PageSizeSearchCriterion) { xmlCriterionSet.AddNamespacePrefixIfNotExist(OSNS_PREFIX); xmlCriterionSet.Add(XmlNamespaceSearchCriterionSet.QualifyCriterion(OSXN_COUNT, criterion)); } else if (criterion is StartIndexSearchCriterion) { xmlCriterionSet.AddNamespacePrefixIfNotExist(OSNS_PREFIX); xmlCriterionSet.Add(XmlNamespaceSearchCriterionSet.QualifyCriterion(OSXN_STARTINDEX, criterion)); } else if (criterion is StartPageSearchCriterion) { xmlCriterionSet.AddNamespacePrefixIfNotExist(OSNS_PREFIX); xmlCriterionSet.Add(XmlNamespaceSearchCriterionSet.QualifyCriterion(OSXN_STARTPAGE, criterion)); } else if (criterion is LanguageSearchCriterion) { xmlCriterionSet.AddNamespacePrefixIfNotExist(OSNS_PREFIX); xmlCriterionSet.Add(XmlNamespaceSearchCriterionSet.QualifyCriterion(OSXN_LANGUAGE, criterion)); } else { xmlCriterionSet.AddNamespacePrefixIfNotExist(UKNS_PREFIX); newCriterion = XmlNamespaceSearchCriterionSet.QualifyCriterion(new XmlQualifiedName(criterion.Identifier, UKNS), criterion); } } return(xmlCriterionSet); }
/// <summary> /// Parses the json message sent and converts it into a search criterion object using a json serializer. /// </summary> /// <param name="json"> the json message to be parsed.</param> /// <exception cref="ArgumentException"> thrown if the json message is null or empty.</exception> private void ProcessNewCriterionUpdate(string json) { if (String.IsNullOrEmpty(json)) { throw new ArgumentException("json"); } try { ISearchCriterion newCriterion = JsonConvert.DeserializeObject <SearchCriterionImpl>(json); searchManager.AddSearch(newCriterion.Owner, newCriterion.DescriptionKey, newCriterion.IsPrivate, newCriterion.IsFilter, newCriterion.ControlName, newCriterion.ControlValue); } catch (Exception exc) { log.Error(String.Format("Failed to deserialize json [{0}] into new search criterion update. Exception raised [{1}]", json, exc.Message)); } }
public virtual void Insert(int pos, ISearchCriterion criterion) { set.Insert(pos, criterion); }
public virtual void Add(ISearchCriterion criterion) { set.Add(criterion); }
public bool IsValidCriterionForCurrentSearch(ISearchCriterion criterion) { return(this.Owner == criterion.Owner && this.DescriptionKey == criterion.DescriptionKey); }
public void AddCriteria(ISearchCriterion criterion) { Criteria.Add(criterion); }
internal static IQualifiedSearchCriterion QualifyCriterion(XmlQualifiedName xmlQualifiedName, ISearchCriterion criterion) { Type typedCriterion = typeof(TypedCriterion <>); Type type = GetInstanceOfGenericType(typedCriterion, criterion); if (type == null) { throw new ArgumentException("Criterion '{0}' must be typed to be qualified", criterion.Identifier); } Type[] types = type.GetGenericArguments(); Type xmlCriterion = typeof(XmlNamespaceTypedCriterion <>); Type construct = xmlCriterion.MakeGenericType(types); return((IQualifiedSearchCriterion)Activator.CreateInstance(construct, new object[] { criterion, xmlQualifiedName })); }