public SearchQueryService(ISearchParameterCache ISearchParameterCache, ISearchQueryFactory ISearchQueryFactory, IResourceTypeSupport IResourceTypeSupport, IKnownResource IKnownResource, IChainQueryProcessingService IChainQueryProcessingService) { this.ISearchParameterCache = ISearchParameterCache; this.ISearchQueryFactory = ISearchQueryFactory; this.IResourceTypeSupport = IResourceTypeSupport; this.IKnownResource = IKnownResource; this.IChainQueryProcessingService = IChainQueryProcessingService; }
public ChainQueryProcessingService(IResourceTypeSupport IResourceTypeSupport, IKnownResource IKnownResource, ISearchParameterCache ISearchParameterCache, ISearchQueryFactory ISearchQueryFactory) { this.IResourceTypeSupport = IResourceTypeSupport; this.IKnownResource = IKnownResource; this.ISearchParameterCache = ISearchParameterCache; this.ISearchQueryFactory = ISearchQueryFactory; this.InvalidSearchQueryParameterList = new List <InvalidSearchQueryParameter>(); this.UnsupportedSearchQueryParameterList = new List <InvalidSearchQueryParameter>(); }
public SearchQueryFactory(IFhirUriFactory IFhirUriFactory, IResourceTypeSupport IResourceTypeSupport, ISearchParameterCache ISearchParameterCache, IKnownResource IKnownResource, IFhirDateTimeFactory IFhirDateTimeFactory, ISearchParameterRepository ISearchParameterRepository) { this.IFhirUriFactory = IFhirUriFactory; this.IResourceTypeSupport = IResourceTypeSupport; this.ISearchParameterCache = ISearchParameterCache; this.IKnownResource = IKnownResource; this.IFhirDateTimeFactory = IFhirDateTimeFactory; this.ISearchParameterRepository = ISearchParameterRepository; }
public virtual void ParseModifier(string parameterName, IResourceTypeSupport IResourceTypeSupport, IKnownResource IKnownResource) { if (parameterName.Contains(FhirSearchQuery.TermSearchModifierDelimiter)) { string parameterNameModifierPart = parameterName.Split(FhirSearchQuery.TermSearchModifierDelimiter)[1]; var SearchModifierTypeDic = StringToEnumMap <Common.Enums.SearchModifierCode> .GetDictionary(); string ValueCaseCorrectly = StringSupport.ToLowerFast(parameterNameModifierPart); if (SearchModifierTypeDic.ContainsKey(ValueCaseCorrectly)) { this.Modifier = SearchModifierTypeDic[ValueCaseCorrectly]; } else { string TypedResourceName = parameterNameModifierPart; if (parameterNameModifierPart.Contains(".")) { char[] delimiters = { '.' }; TypedResourceName = parameterNameModifierPart.Split(delimiters)[0].Trim(); } if (IKnownResource.IsKnownResource(this.FhirVersionId, TypedResourceName)) { Common.Enums.ResourceType?ResourceType = IResourceTypeSupport.GetTypeFromName(TypedResourceName); if (ResourceType != null) { this.TypeModifierResource = ResourceType.Value; this.Modifier = SearchModifierCode.Type; } else { throw new ApplicationException($"Found a known resource to the FHIR API yet this resource was not found in the Enum list for {typeof(Common.Enums.ResourceType).Name}"); } } else { this.InvalidMessage = $"Unable to parse the given search parameter's Modifier: {parameterName}, "; this.IsValid = false; } } } else { this.Modifier = null; this.TypeModifierResource = null; } if (this.Modifier.HasValue) { SearchModifierCode[] oSupportedModifierArray = SearchQuerySupport.GetModifiersForSearchType(this.SearchParamTypeId); if (!oSupportedModifierArray.Any(x => x == this.Modifier.Value)) { this.InvalidMessage += $"The parameter's modifier: '{this.Modifier.GetCode()}' is not supported by this server for this search parameter type '{this.SearchParamTypeId.GetCode()}', the whole parameter was : '{this.RawValue}', "; this.IsValid = false; } } }