public SearchReturn Expand(String searchText, String includeTypes, int offset, int numResults, DictionaryType dictionary, Language language) { log.DebugFormat("Enter searchText( {0}, {1}, {2}, {3}, {4}, {5} ).", searchText, includeTypes, offset, numResults, dictionary, language); SearchReturn ret; try { InputValidator.ValidateExpand(dictionary, language); DictionaryManager mgr = new DictionaryManager(); ret = mgr.Expand(searchText, includeTypes, offset, numResults, dictionary, language, API_VERSION); log.DebugFormat("Returning {0} results.", ret.Result.Count()); } // If there was a problem with the inputs for this request, fail with // an HTTP status message and an explanation. catch (DictionaryValidationException ex) { WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.SetStatusAsNotFound(ex.Message); ret = new SearchReturn() { Meta = new SearchReturnMeta() { Messages = new string[] { ex.Message } } }; } return(ret); }
public TermReturn GetTerm(int termId, DictionaryType dictionary, Language language, AudienceType audience) { log.DebugFormat("Enter GetTerm( {0}, {1}, {2}, {3}).", termId, dictionary, language, audience); TermReturn ret = null; try { InputValidator.ValidateGetTerm(termId, dictionary, language, audience); DictionaryManager mgr = new DictionaryManager(); ret = mgr.GetTerm(termId, dictionary, language, audience, API_VERSION); } // If there was a problem with the inputs for this request, fail with // an HTTP status message and an explanation. catch (DictionaryValidationException ex) { WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.SetStatusAsNotFound(ex.Message); ret = new TermReturn() { Meta = new TermReturnMeta() { Messages = new string[] { ex.Message } } }; } log.Debug("Successfully retrieved a term."); return(ret); }
public SuggestReturn SearchSuggest(String searchText, SearchType searchType, DictionaryType dictionary, Language language) { // This should possibly be made a parameter int MaxResultsAllowed = 10; log.DebugFormat("Enter ValidateSearchSuggest( {0}, {1}, {2}, {3}).", searchText, searchType, dictionary, language); SuggestReturn ret; try { InputValidator.ValidateSearch(searchType, dictionary, language); DictionaryManager mgr = new DictionaryManager(); ret = mgr.SearchSuggest(searchText, searchType, MaxResultsAllowed, dictionary, language, API_VERSION); log.DebugFormat("Returning {0} results.", ret.Result.Count()); } // If there was a problem with the inputs for this request, fail with // an HTTP status message and an explanation. catch (DictionaryValidationException ex) { WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.SetStatusAsNotFound(ex.Message); ret = new SuggestReturn() { Meta = new SuggestReturnMeta() { Messages = new string[] { ex.Message } } }; } return(ret); }
/// <summary> /// Retrieves a single dictionary Term based on its specific Term ID. /// </summary> /// <param name="termId">The ID of the Term to be retrieved</param> /// <param name="dictionary">The dictionary to retreive the Term from. /// Valid values are /// Term - Dictionary of Cancer Terms /// drug - Drug Dictionary /// genetic - Dictionary of Genetics Terms /// </param> /// <param name="language">The Term's desired language. /// Supported values are: /// en - English /// es - Spanish /// </param> /// <returns></returns> public TermReturn GetTerm(int termId, DictionaryType dictionary, Language language) { log.DebugFormat("Enter GetTerm( {0}, {1}, {2}).", termId, dictionary, language); AudienceType audience = AudienceType.Patient; // determine what audience to use based on the dictionary DictionaryManager dictionaryManager = new DictionaryManager(); audience = dictionaryManager.GetDefaultAudienceFromDictionaryType(dictionary); // route to GetTerm with all arguments return(GetTerm(termId, dictionary, language, audience)); }
public List <DictionaryEntryMetadata> DoDictionaryEntriesExist(List <DictionaryEntryMetadata> entriesList) { List <DictionaryEntryMetadata> ret; try { DictionaryManager mgr = new DictionaryManager(); ret = mgr.DoDictionaryEntriesExist(entriesList); log.DebugFormat("Returning {0} results.", ret.Count()); } // If there was a problem with the inputs for this request, fail with // an HTTP status message and an explanation. catch (Exception ex) { WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.SetStatusAsNotFound(ex.Message); ret = new List <DictionaryEntryMetadata>(); } return(ret); }