Example #1
0
        public ConfigurationItemId[] Query(CIQueryParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters", "parameters is null.");
            }

            var parameterDictionary = new Dictionary <string, string>();

            if (!string.IsNullOrWhiteSpace(parameters.CIType))
            {
                parameterDictionary.Add("type", parameters.CIType);
            }

            if (!string.IsNullOrWhiteSpace(parameters.ParentId))
            {
                parameterDictionary.Add("parent", parameters.ParentId);
            }

            if (!string.IsNullOrWhiteSpace(parameters.Pattern))
            {
                parameterDictionary.Add("namePattern", parameters.Pattern);
            }

            parameterDictionary.Add("page", parameters.Page.ToString(CultureInfo.InvariantCulture));

            parameterDictionary.Add("resultsPerPage", "" + (parameters.ResultPerPage ?? -1));

            var command = BuildCommand("query", parameterDictionary);

            var response = ExecuteHttp <ConfigurationItemIdCollection, UDMHttpContent <ConfigurationItemIdCollection>, string, StringHttpContent>(
                new GetHttpResponseProvider(), command);

            return(response.CIs);
        }
 public ConfigurationItemId[] Query(CIQueryParameters parameters)
 {
     return(_queryCache.GetValue(parameters));
 }