private static UriMatcher buildUriMatcher() { UriMatcher uriMatcher = new UriMatcher(UriMatcher.NoMatch); uriMatcher.AddURI(TaskContract.AUTHORITY, TaskContract.PATH_TASKS, TASKS); uriMatcher.AddURI(TaskContract.AUTHORITY, TaskContract.PATH_TASKS + "/#", TASK_WITH_ID); return(uriMatcher); }
static UriMatcher BuildUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); matcher.AddURI(AUTHORITY, BASE_PATH, GET_ALL); matcher.AddURI(AUTHORITY, BASE_PATH + "/#", GET_ONE); return(matcher); }
static PreferenceProvider() { sUriMatcher = new UriMatcher(UriMatcher.NoMatch); sUriMatcher.AddURI(AUTHORITY, "boolean/*/*", PREF_BOOLEAN); sUriMatcher.AddURI(AUTHORITY, "string/*/*", PREF_STRING); sUriMatcher.AddURI(AUTHORITY, "integer/*/*", PREF_INT); sUriMatcher.AddURI(AUTHORITY, "long/*/*", PREF_LONG); sUriMatcher.AddURI(AUTHORITY, "datetime/*/*", PREF_DATETIME); }
static UriMatcher BuildUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); // to get data... matcher.AddURI(AUTHORITY, BASE_PATH, GET_ALL); // all vegetables matcher.AddURI(AUTHORITY, BASE_PATH + "/#", GET_ONE); // specific vegetable by numeric ID return matcher; }
/// <summary> /// Builds the URI matcher. /// </summary> /// <returns>The URI matcher.</returns> public static UriMatcher BuildUriMatcher() { var uriMatcher = new UriMatcher(UriMatcher.NoMatch); uriMatcher.AddURI(WeatherContract.ContentAuthority, WeatherContract.PathWeather, Weather); uriMatcher.AddURI(WeatherContract.ContentAuthority, WeatherContract.PathWeather + "/*", WeatherWithLocation); uriMatcher.AddURI(WeatherContract.ContentAuthority, WeatherContract.PathWeather + "/*/#", WeatherWithLocationAndDate); uriMatcher.AddURI(WeatherContract.ContentAuthority, WeatherContract.PathLocation, Location); return(uriMatcher); }
static UriMatcher BuildUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); // to get definitions... matcher.AddURI(Authority, GetIconPathQuery, (int)UriMatches.GetIcon); matcher.AddURI(Authority, SearchManager.SuggestUriPathQuery, (int)UriMatches.GetSuggestions); return(matcher); }
static UriMatcher BuildUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); // to get data... matcher.AddURI(AUTHORITY, BASE_PATH, GET_ALL); // all goals matcher.AddURI(AUTHORITY, BASE_PATH + "/#", GET_ONE); // specific goal by numeric ID return(matcher); }
public void AbsolutePathMatches() { var uriMatcher = new UriMatcher( "newssubscriptions/subscribeaction/", new Dictionary <string, string>(), new StringDictionary()); var uri = new Uri("http://moskva.dr-bee.ru/newssubscriptions/subscribeaction/?type=AddSubscription"); var uriMatchResult = uriMatcher.Match(uri, "/"); Assert.True(uriMatchResult.Success); }
static LocationContentProvider() { mProjectionMap = new Dictionary<string, string>(); mProjectionMap.Add(_ID, _ID); mProjectionMap.Add(NAME, NAME); mProjectionMap.Add(LONGITUDE, LONGITUDE); mProjectionMap.Add(LATITUTDE, LATITUTDE); uriMatcher = new UriMatcher(UriMatcher.NoMatch); uriMatcher.AddURI(PROVIDER_NAME, "locations", LOCATIONS); uriMatcher.AddURI(PROVIDER_NAME, "locations/#", LOCATION_ID); }
static LocationContentProvider() { mProjectionMap = new Dictionary <string, string>(); mProjectionMap.Add(_ID, _ID); mProjectionMap.Add(NAME, NAME); mProjectionMap.Add(LONGITUDE, LONGITUDE); mProjectionMap.Add(LATITUTDE, LATITUTDE); uriMatcher = new UriMatcher(UriMatcher.NoMatch); uriMatcher.AddURI(PROVIDER_NAME, "locations", LOCATIONS); uriMatcher.AddURI(PROVIDER_NAME, "locations/#", LOCATION_ID); }
/// Metodo que nos genera la URI a utilizar y las almacena en un URIMatcher static UriMatcher ConstructorUriMatcher () { var matcher = new UriMatcher (UriMatcher.NoMatch); //definimos los URI para poder accesar a la informacion apra realizar la busquedad o buscar una palabra en especifico // to get definitions... matcher.AddURI (AUTHORITY, "paises", BUSCAR_PALABRAS); matcher.AddURI (AUTHORITY, "paises/#", RECUPERAR_PALABRA); // to get suggestions... matcher.AddURI (AUTHORITY, SearchManager.SuggestUriPathQuery, BUSCAR_SUJERENCIAS); matcher.AddURI (AUTHORITY, SearchManager.SuggestUriPathQuery + "/*", BUSCAR_SUJERENCIAS); return matcher; }
/// Metodo que nos genera la URI a utilizar y las almacena en un URIMatcher static UriMatcher ConstructorUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); //definimos los URI para poder accesar a la informacion apra realizar la busquedad o buscar una palabra en especifico // to get definitions... matcher.AddURI(AUTHORITY, "paises", BUSCAR_PALABRAS); matcher.AddURI(AUTHORITY, "paises/#", RECUPERAR_PALABRA); // to get suggestions... matcher.AddURI(AUTHORITY, SearchManager.SuggestUriPathQuery, BUSCAR_SUJERENCIAS); matcher.AddURI(AUTHORITY, SearchManager.SuggestUriPathQuery + "/*", BUSCAR_SUJERENCIAS); return(matcher); }
/* Students: Here is where you need to create the UriMatcher. This UriMatcher will match each URI to the WEATHER, WEATHER_WITH_LOCATION, WEATHER_WITH_LOCATION_AND_DATE, and LOCATION integer constants defined above. You can test this by uncommenting the testUriMatcher test within TestUriMatcher. */ public static UriMatcher buildUriMatcher() { // 1) The code passed into the constructor represents the code to return for the root // URI. It's common to use NO_MATCH as the code for this case. Add the constructor below. var matcher = new UriMatcher (UriMatcher.NoMatch); // 2) Use the addURI function to match each of the types. Use the constants from // WeatherContract to help define the types to the UriMatcher. matcher.AddURI (AUTHORITY, WeatherContractOpen.PATH_WEATHER, WEATHER); matcher.AddURI (AUTHORITY, WeatherContractOpen.PATH_WEATHER + "/*", WEATHER_WITH_LOCATION); matcher.AddURI (AUTHORITY, WeatherContractOpen.PATH_WEATHER + "/*/#", WEATHER_WITH_LOCATION_AND_DATE); matcher.AddURI (AUTHORITY, WeatherContractOpen.PATH_LOCATION, LOCATION); // 3) Return the new matcher! return matcher; }
public void DataDoesNotMatch() { var data = new Dictionary <string, string>(); data.Add("tariff", "wrong_tariff"); var uriMatcher = new UriMatcher( "customers/products/mobile/services/details/{tariff}/", data, new StringDictionary()); var uri = new Uri( "http://moskva.beeline.ru/" + "customers/products/mobile/services/details/highway-1gb-nedelya-besplatno/?deviceTypeId=cellphone"); var uriMatchResult = uriMatcher.Match(uri, "/"); Assert.False(uriMatchResult.Success, "Содержимое поле Data не учитывается при сопоставлении страницы"); }
public void DataMatch() { var data = new Dictionary <string, string>(); data.Add("tariff", "highway-1gb-nedelya-besplatno"); var uriMatcher = new UriMatcher( "customers/products/mobile/services/details/{tariff}/", data, new StringDictionary()); var uri = new Uri( "http://moskva.beeline.ru/" + "customers/products/mobile/services/details/highway-1gb-nedelya-besplatno/?deviceTypeId=cellphone"); var uriMatchResult = uriMatcher.Match(uri, "/"); Assert.True(uriMatchResult.Success); }
public void ParamsMatch() { var _params = new StringDictionary(); _params.Add("deviceTypeId", "cellphone"); var uriMatcher = new UriMatcher( "customers/products/mobile/services/details/{tariff}/", new Dictionary <string, string>(), _params); var uri = new Uri( "http://moskva.beeline.ru/" + "customers/products/mobile/services/details/highway-1gb-nedelya-besplatno/?deviceTypeId=cellphone"); var uriMatchResult = uriMatcher.Match(uri, "/"); Assert.True(uriMatchResult.Success, "Содержимое поле Params не учитывается при сопоставлении страницы"); }
public void ExtractDataFromUri() { var uriMatcher = new UriMatcher( "customers/products/mobile/services/details/{tariff}/", new Dictionary <string, string>(), new StringDictionary()); var uri = new Uri( "http://moskva.beeline.ru/" + "customers/products/mobile/services/details/highway-1gb-nedelya-besplatno/?deviceTypeId=cellphone"); var uriMatchResult = uriMatcher.Match(uri, "/"); Assert.True(uriMatchResult.Success); Assert.True(uriMatchResult.Data.ContainsKey("tariff"), "Матчер не обнаружил параметр в Url"); Assert.AreEqual( "highway-1gb-nedelya-besplatno", uriMatchResult.Data["tariff"], "Матчер обнаружил некорректный параметр"); }
/** * Build and return a {@link UriMatcher} that catches all {@link Uri} * variations supported by this {@link ContentProvider}. */ private static UriMatcher BuildUriMatcher() { UriMatcher matcher = new UriMatcher(UriMatcher.NoMatch); String authority = ScheduleContract.CONTENT_AUTHORITY; matcher.AddURI(authority, "blocks", BLOCKS); matcher.AddURI(authority, "blocks/between/*/*", BLOCKS_BETWEEN); matcher.AddURI(authority, "blocks/*", BLOCKS_ID); matcher.AddURI(authority, "blocks/*/sessions", BLOCKS_ID_SESSIONS); matcher.AddURI(authority, "tracks", TRACKS); matcher.AddURI(authority, "tracks/*", TRACKS_ID); matcher.AddURI(authority, "tracks/*/sessions", TRACKS_ID_SESSIONS); matcher.AddURI(authority, "tracks/*/vendors", TRACKS_ID_VENDORS); matcher.AddURI(authority, "rooms", ROOMS); matcher.AddURI(authority, "rooms/*", ROOMS_ID); matcher.AddURI(authority, "rooms/*/sessions", ROOMS_ID_SESSIONS); matcher.AddURI(authority, "sessions", SESSIONS); matcher.AddURI(authority, "sessions/starred", SESSIONS_STARRED); matcher.AddURI(authority, "sessions/search/*", SESSIONS_SEARCH); matcher.AddURI(authority, "sessions/at/*", SESSIONS_AT); matcher.AddURI(authority, "sessions/*", SESSIONS_ID); matcher.AddURI(authority, "sessions/*/speakers", SESSIONS_ID_SPEAKERS); matcher.AddURI(authority, "sessions/*/tracks", SESSIONS_ID_TRACKS); matcher.AddURI(authority, "speakers", SPEAKERS); matcher.AddURI(authority, "speakers/*", SPEAKERS_ID); matcher.AddURI(authority, "speakers/*/sessions", SPEAKERS_ID_SESSIONS); matcher.AddURI(authority, "vendors", VENDORS); matcher.AddURI(authority, "vendors/starred", VENDORS_STARRED); matcher.AddURI(authority, "vendors/search/*", VENDORS_SEARCH); matcher.AddURI(authority, "vendors/*", VENDORS_ID); matcher.AddURI(authority, "search_suggest_query", SEARCH_SUGGEST); return(matcher); }
static UriMatcher BuildUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); // to get definitions... matcher.AddURI(AUTHORITY, "dictionary", SEARCH_WORDS); matcher.AddURI(AUTHORITY, "dictionary/#", GET_WORD); // to get suggestions... matcher.AddURI(AUTHORITY, SearchManager.SuggestUriPathQuery, SEARCH_SUGGEST); matcher.AddURI(AUTHORITY, SearchManager.SuggestUriPathQuery + "/*", SEARCH_SUGGEST); /* The following are unused in this implementation, but if we include * SearchManager.SuggestColumnShortcutId as a column in our suggestions table, we * could expect to receive refresh queries when a shortcutted suggestion is displayed in * Quick Search Box, in which case, the following Uris would be provided and we * would return a cursor with a single item representing the refreshed suggestion data. */ matcher.AddURI(AUTHORITY, SearchManager.SuggestUriPathShortcut, REFRESH_SHORTCUT); matcher.AddURI(AUTHORITY, SearchManager.SuggestUriPathShortcut + "/*", REFRESH_SHORTCUT); return(matcher); }
/** * Build and return a {@link UriMatcher} that catches all {@link Uri} * variations supported by this {@link ContentProvider}. */ private static UriMatcher BuildUriMatcher() { UriMatcher matcher = new UriMatcher(UriMatcher.NoMatch); String authority = ScheduleContract.CONTENT_AUTHORITY; matcher.AddURI(authority, "blocks", BLOCKS); matcher.AddURI(authority, "blocks/between/*/*", BLOCKS_BETWEEN); matcher.AddURI(authority, "blocks/*", BLOCKS_ID); matcher.AddURI(authority, "blocks/*/sessions", BLOCKS_ID_SESSIONS); matcher.AddURI(authority, "tracks", TRACKS); matcher.AddURI(authority, "tracks/*", TRACKS_ID); matcher.AddURI(authority, "tracks/*/sessions", TRACKS_ID_SESSIONS); matcher.AddURI(authority, "tracks/*/vendors", TRACKS_ID_VENDORS); matcher.AddURI(authority, "rooms", ROOMS); matcher.AddURI(authority, "rooms/*", ROOMS_ID); matcher.AddURI(authority, "rooms/*/sessions", ROOMS_ID_SESSIONS); matcher.AddURI(authority, "sessions", SESSIONS); matcher.AddURI(authority, "sessions/starred", SESSIONS_STARRED); matcher.AddURI(authority, "sessions/search/*", SESSIONS_SEARCH); matcher.AddURI(authority, "sessions/at/*", SESSIONS_AT); matcher.AddURI(authority, "sessions/*", SESSIONS_ID); matcher.AddURI(authority, "sessions/*/speakers", SESSIONS_ID_SPEAKERS); matcher.AddURI(authority, "sessions/*/tracks", SESSIONS_ID_TRACKS); matcher.AddURI(authority, "speakers", SPEAKERS); matcher.AddURI(authority, "speakers/*", SPEAKERS_ID); matcher.AddURI(authority, "speakers/*/sessions", SPEAKERS_ID_SESSIONS); matcher.AddURI(authority, "vendors", VENDORS); matcher.AddURI(authority, "vendors/starred", VENDORS_STARRED); matcher.AddURI(authority, "vendors/search/*", VENDORS_SEARCH); matcher.AddURI(authority, "vendors/*", VENDORS_ID); matcher.AddURI(authority, "search_suggest_query", SEARCH_SUGGEST); return matcher; }
static UriMatcher BuildUriMatcher () { var matcher = new UriMatcher (UriMatcher.NoMatch); // to get definitions... matcher.AddURI (AUTHORITY, "dictionary", SEARCH_WORDS); matcher.AddURI (AUTHORITY, "dictionary/#", GET_WORD); // to get suggestions... matcher.AddURI (AUTHORITY, SearchManager.SuggestUriPathQuery, SEARCH_SUGGEST); matcher.AddURI (AUTHORITY, SearchManager.SuggestUriPathQuery + "/*", SEARCH_SUGGEST); /* The following are unused in this implementation, but if we include * SearchManager.SuggestColumnShortcutId as a column in our suggestions table, we * could expect to receive refresh queries when a shortcutted suggestion is displayed in * Quick Search Box, in which case, the following Uris would be provided and we * would return a cursor with a single item representing the refreshed suggestion data. */ matcher.AddURI (AUTHORITY, SearchManager.SuggestUriPathShortcut, REFRESH_SHORTCUT); matcher.AddURI (AUTHORITY, SearchManager.SuggestUriPathShortcut + "/*", REFRESH_SHORTCUT); return matcher; }
static TaskContentProvider() { sUriMatcher = buildUriMatcher(); }
private static UriMatcher buildUriMatcher() { UriMatcher matcher = new UriMatcher(UriMatcher.NoMatch); // .NO_MATCH); String authority = BowlingContract.CONTENT_AUTHORITY; matcher.AddURI(authority, "Scorecard", SCORECARD); //.addURI(authority, "Scorecard", SCORECARD); matcher.AddURI(authority, "Scorecard/*", SCORECARD_ID); return matcher; }
static UriMatcher BuildUriMatcher() { var matcher = new UriMatcher(UriMatcher.NoMatch); // to get definitions... matcher.AddURI(Authority, GetIconPathQuery, (int)UriMatches.GetIcon); matcher.AddURI(Authority, SearchManager.SuggestUriPathQuery, (int)UriMatches.GetSuggestions); return matcher; }