@Override
 public Observable<RecentResponseJson> getRecentItems(String lastId, final int count) {
   QueryParams params = getBasicQueryParams().add("count", count);
   String url = makeApiUrl(REQUEST_RECENT_MEDIA, params, Prefs.getUserId());
   if (lastId != null) {
     params.add("max_id", lastId);
   }
   Request.Builder request = new Request.Builder().url(url);
   return makeRequest(request, new TypeToken<RecentResponseJson>() {}.getType());
 }
 @Override
 public String getAuthUrl() {
   QueryParams params =
       new QueryParams()
           .add("client_id", clientId)
           .add("redirect_uri", callbackUrl)
           .add("response_type", "code")
           .add("display", "touch")
           .add("scope", "likes+comments+relationships", false);
   return AUTH_URL + params.asUrlParams();
 }
 @Override
 public Observable<TokenResponseJson> login(final String code) {
   QueryParams params =
       new QueryParams()
           .add("client_id", clientId)
           .add("client_secret", clientSecret)
           .add("redirect_uri", callbackUrl)
           .add("redirect_uri", callbackUrl)
           .add("code", code)
           .add("grant_type", "authorization_code");
   Request.Builder request =
       new Request.Builder()
           .url(TOKEN_URL)
           .post(RequestBody.create(MEDIA_TYPE_JSON, params.asBody()));
   return makeRequest(request, new TypeToken<TokenResponseJson>() {}.getType());
 }
Example #4
0
 @Test
 public void test() throws Exception {
   String[] testDates =
       new String[] {
         "2012-07-18T06:00:00.000GMT",
         "2012-07-18T06:00:00.000Z",
         "2012-07-18T06:00:00.000",
         "2012-07-18T06:00:00"
       };
   SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
   Date d = dateFormat.parse(testDates[0]);
   QueryParams qp = new QueryParams(new String[0]);
   for (int i = 0; i < testDates.length; i++) {
     Date testDate = qp.extractDate(testDates[i]);
     assertEquals(i + " " + testDates[i], d, testDate);
   }
   // check with no time in date string
   String onlyDate = "2012-07-18";
   d = dateFormat.parse(onlyDate + "T00:00:00.000GMT");
   Date testDate = qp.extractDate(onlyDate);
   assertEquals("no time " + onlyDate, d, testDate);
 }
  @Test
  public void query_EndPoints() throws Exception {
    Map<String, Object> json = Helper.getBigJsonText(20);

    String fortress = "epFortress";
    String company = "epCompany";
    String doc = "epDocType";
    String user = "******";

    Entity entity = Helper.getEntity(company, fortress, user, doc);

    EntitySearchChange change = new EntitySearchChange(entity);
    change.setDescription("Test Description");
    change.setWhat(json);

    deleteEsIndex(entity);
    Thread.sleep(1000);

    SearchResults searchResults =
        trackService.createSearchableChange(new EntitySearchChanges(change));
    SearchResult searchResult = searchResults.getSearchResults().iterator().next();
    Thread.sleep(2000);
    assertNotNull(searchResult);
    assertNotNull(searchResult.getSearchKey());

    QueryParams qp = new QueryParams(entity.getSegment());
    qp.setCompany(company);
    qp.setSearchText("*");
    // Sanity check - there is only one document in the index
    EsSearchResult queryResult = queryServiceEs.doFdViewSearch(qp);
    assertEquals(1, queryResult.getResults().size());
    assertEquals(entity.getMetaKey(), queryResult.getResults().iterator().next().getMetaKey());
    MetaKeyResults metaResults = queryServiceEs.doMetaKeyQuery(qp);
    assertEquals(1, metaResults.getResults().size());
    assertEquals(entity.getMetaKey(), metaResults.getResults().iterator().next());

    // Find with just a fortress
    qp = new QueryParams(entity.getSegment());
    qp.setSearchText("description");
    queryResult = queryServiceEs.doFdViewSearch(qp);
    assertEquals(1, queryResult.getResults().size());
    assertEquals(entity.getMetaKey(), queryResult.getResults().iterator().next().getMetaKey());

    qp = new QueryParams().setCompany(company.toLowerCase());
    qp.setSearchText("description");
    queryResult = queryServiceEs.doFdViewSearch(qp);
    assertEquals(1, queryResult.getResults().size());
    assertEquals(entity.getMetaKey(), queryResult.getResults().iterator().next().getMetaKey());

    qp = new QueryParams(entity.getSegment());
    qp.setSearchText("-description"); // Ignore description
    queryResult = queryServiceEs.doFdViewSearch(qp);
    assertEquals(0, queryResult.getResults().size());
  }
Example #6
0
 public static void load(LogBlock logblock) throws DataFormatException, IOException {
   final ConfigurationSection config = logblock.getConfig();
   final Map<String, Object> def = new HashMap<String, Object>();
   def.put("version", logblock.getDescription().getVersion());
   final List<String> worldNames = new ArrayList<String>();
   for (final World world : getWorlds()) worldNames.add(world.getName());
   if (worldNames.isEmpty()) {
     worldNames.add("world");
     worldNames.add("world_nether");
     worldNames.add("world_the_end");
   }
   def.put("loggedWorlds", worldNames);
   def.put("mysql.host", "localhost");
   def.put("mysql.port", 3306);
   def.put("mysql.database", "minecraft");
   def.put("mysql.user", "username");
   def.put("mysql.password", "pass");
   def.put("consumer.delayBetweenRuns", 2);
   def.put("consumer.forceToProcessAtLeast", 200);
   def.put("consumer.timePerRun", 1000);
   def.put("consumer.fireCustomEvents", false);
   def.put("consumer.useBukkitScheduler", true);
   def.put("consumer.queueWarningSize", 1000);
   def.put("clearlog.dumpDeletedLog", false);
   def.put("clearlog.enableAutoClearLog", false);
   def.put(
       "clearlog.auto",
       Arrays.asList(
           "world \"world\" before 365 days all",
           "world \"world\" player lavaflow waterflow leavesdecay before 7 days all",
           "world world_nether before 365 days all",
           "world world_nether player lavaflow before 7 days all"));
   def.put("clearlog.autoClearLogDelay", "6h");
   def.put("logging.logCreeperExplosionsAsPlayerWhoTriggeredThese", false);
   def.put("logging.logKillsLevel", "PLAYERS");
   def.put("logging.logPlayerInfo", false);
   def.put("logging.hiddenPlayers", new ArrayList<String>());
   def.put("logging.hiddenBlocks", Arrays.asList(0));
   def.put("logging.ignoredChat", Arrays.asList("/register", "/login"));
   def.put("rollback.dontRollback", Arrays.asList(10, 11, 46, 51));
   def.put("rollback.replaceAnyway", Arrays.asList(8, 9, 10, 11, 51));
   def.put("rollback.maxTime", "2 days");
   def.put("rollback.maxArea", 50);
   def.put("lookup.defaultDist", 20);
   def.put("lookup.defaultTime", "30 minutes");
   def.put("lookup.linesPerPage", 15);
   def.put("lookup.linesLimit", 1500);
   try {
     formatter = new SimpleDateFormat(config.getString("lookup.dateFormat", "MM-dd HH:mm:ss"));
   } catch (IllegalArgumentException e) {
     throw new DataFormatException(
         "Invalid specification for  date format, please see http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html : "
             + e.getMessage());
   }
   def.put("lookup.dateFormat", "MM-dd HH:mm:ss");
   def.put("questioner.askRollbacks", true);
   def.put("questioner.askRedos", true);
   def.put("questioner.askClearLogs", true);
   def.put("questioner.askClearLogAfterRollback", true);
   def.put("questioner.askRollbackAfterBan", false);
   def.put("questioner.banPermission", "mcbans.ban.local");
   def.put("tools.tool.aliases", Arrays.asList("t"));
   def.put("tools.tool.leftClickBehavior", "NONE");
   def.put("tools.tool.rightClickBehavior", "TOOL");
   def.put("tools.tool.defaultEnabled", true);
   def.put("tools.tool.item", 270);
   def.put("tools.tool.canDrop", true);
   def.put("tools.tool.params", "area 0 all sum none limit 15 desc silent");
   def.put("tools.tool.mode", "LOOKUP");
   def.put("tools.tool.permissionDefault", "OP");
   def.put("tools.toolblock.aliases", Arrays.asList("tb"));
   def.put("tools.toolblock.leftClickBehavior", "TOOL");
   def.put("tools.toolblock.rightClickBehavior", "BLOCK");
   def.put("tools.toolblock.defaultEnabled", true);
   def.put("tools.toolblock.item", 7);
   def.put("tools.toolblock.canDrop", false);
   def.put("tools.toolblock.params", "area 0 all sum none limit 15 desc silent");
   def.put("tools.toolblock.mode", "LOOKUP");
   def.put("tools.toolblock.permissionDefault", "OP");
   def.put("safety.id.check", true);
   for (final Entry<String, Object> e : def.entrySet())
     if (!config.contains(e.getKey())) config.set(e.getKey(), e.getValue());
   logblock.saveConfig();
   url =
       "jdbc:mysql://"
           + config.getString("mysql.host")
           + ":"
           + config.getInt("mysql.port")
           + "/"
           + getStringIncludingInts(config, "mysql.database");
   user = getStringIncludingInts(config, "mysql.user");
   password = getStringIncludingInts(config, "mysql.password");
   delayBetweenRuns = config.getInt("consumer.delayBetweenRuns", 2);
   forceToProcessAtLeast = config.getInt("consumer.forceToProcessAtLeast", 0);
   timePerRun = config.getInt("consumer.timePerRun", 1000);
   fireCustomEvents = config.getBoolean("consumer.fireCustomEvents", false);
   useBukkitScheduler = config.getBoolean("consumer.useBukkitScheduler", true);
   queueWarningSize = config.getInt("consumer.queueWarningSize", 1000);
   enableAutoClearLog = config.getBoolean("clearlog.enableAutoClearLog");
   autoClearLog = config.getStringList("clearlog.auto");
   dumpDeletedLog = config.getBoolean("clearlog.dumpDeletedLog", false);
   autoClearLogDelay = parseTimeSpec(config.getString("clearlog.autoClearLogDelay").split(" "));
   logCreeperExplosionsAsPlayerWhoTriggeredThese =
       config.getBoolean("logging.logCreeperExplosionsAsPlayerWhoTriggeredThese", false);
   logPlayerInfo = config.getBoolean("logging.logPlayerInfo", true);
   try {
     logKillsLevel =
         LogKillsLevel.valueOf(config.getString("logging.logKillsLevel").toUpperCase());
   } catch (final IllegalArgumentException ex) {
     throw new DataFormatException(
         "lookup.toolblockID doesn't appear to be a valid log level. Allowed are 'PLAYERS', 'MONSTERS' and 'ANIMALS'");
   }
   hiddenPlayers = new HashSet<String>();
   for (final String playerName : config.getStringList("logging.hiddenPlayers"))
     hiddenPlayers.add(playerName.toLowerCase().trim());
   hiddenBlocks = new HashSet<Integer>();
   for (final Object blocktype : config.getList("logging.hiddenBlocks")) {
     final Material mat = Material.matchMaterial(String.valueOf(blocktype));
     if (mat != null) hiddenBlocks.add(mat.getId());
     else throw new DataFormatException("Not a valid material: '" + blocktype + "'");
   }
   ignoredChat = new HashSet<String>();
   for (String chatCommand : config.getStringList("logging.ignoredChat")) {
     ignoredChat.add(chatCommand);
   }
   dontRollback = new HashSet<Integer>(config.getIntegerList("rollback.dontRollback"));
   replaceAnyway = new HashSet<Integer>(config.getIntegerList("rollback.replaceAnyway"));
   rollbackMaxTime = parseTimeSpec(config.getString("rollback.maxTime").split(" "));
   rollbackMaxArea = config.getInt("rollback.maxArea", 50);
   defaultDist = config.getInt("lookup.defaultDist", 20);
   defaultTime = parseTimeSpec(config.getString("lookup.defaultTime").split(" "));
   linesPerPage = config.getInt("lookup.linesPerPage", 15);
   linesLimit = config.getInt("lookup.linesLimit", 1500);
   askRollbacks = config.getBoolean("questioner.askRollbacks", true);
   askRedos = config.getBoolean("questioner.askRedos", true);
   askClearLogs = config.getBoolean("questioner.askClearLogs", true);
   askClearLogAfterRollback = config.getBoolean("questioner.askClearLogAfterRollback", true);
   askRollbackAfterBan = config.getBoolean("questioner.askRollbackAfterBan", false);
   safetyIdCheck = config.getBoolean("safety.id.check", true);
   banPermission = config.getString("questioner.banPermission");
   final List<Tool> tools = new ArrayList<Tool>();
   final ConfigurationSection toolsSec = config.getConfigurationSection("tools");
   for (final String toolName : toolsSec.getKeys(false))
     try {
       final ConfigurationSection tSec = toolsSec.getConfigurationSection(toolName);
       final List<String> aliases = tSec.getStringList("aliases");
       final ToolBehavior leftClickBehavior =
           ToolBehavior.valueOf(tSec.getString("leftClickBehavior").toUpperCase());
       final ToolBehavior rightClickBehavior =
           ToolBehavior.valueOf(tSec.getString("rightClickBehavior").toUpperCase());
       final boolean defaultEnabled = tSec.getBoolean("defaultEnabled", false);
       final int item = tSec.getInt("item", 0);
       final boolean canDrop = tSec.getBoolean("canDrop", false);
       final QueryParams params = new QueryParams(logblock);
       params.prepareToolQuery = true;
       params.parseArgs(getConsoleSender(), Arrays.asList(tSec.getString("params").split(" ")));
       final ToolMode mode = ToolMode.valueOf(tSec.getString("mode").toUpperCase());
       final PermissionDefault pdef =
           PermissionDefault.valueOf(tSec.getString("permissionDefault").toUpperCase());
       tools.add(
           new Tool(
               toolName,
               aliases,
               leftClickBehavior,
               rightClickBehavior,
               defaultEnabled,
               item,
               canDrop,
               params,
               mode,
               pdef));
     } catch (final Exception ex) {
       getLogger().log(Level.WARNING, "Error at parsing tool '" + toolName + "': ", ex);
     }
   toolsByName = new HashMap<String, Tool>();
   toolsByType = new HashMap<Integer, Tool>();
   for (final Tool tool : tools) {
     toolsByType.put(tool.item, tool);
     toolsByName.put(tool.name.toLowerCase(), tool);
     for (final String alias : tool.aliases) toolsByName.put(alias, tool);
   }
   final List<String> loggedWorlds = config.getStringList("loggedWorlds");
   worldConfigs = new HashMap<String, WorldConfig>();
   if (loggedWorlds.isEmpty()) throw new DataFormatException("No worlds configured");
   for (final String world : loggedWorlds)
     worldConfigs.put(
         world,
         new WorldConfig(new File(logblock.getDataFolder(), friendlyWorldname(world) + ".yml")));
   superWorldConfig = new LoggingEnabledMapping();
   for (final WorldConfig wcfg : worldConfigs.values())
     for (final Logging l : Logging.values())
       if (wcfg.isLogging(l)) superWorldConfig.setLogging(l, true);
 }
  @Override
  protected QueryParams getQueryParams(Uri uri, String selection, String[] projection) {
    QueryParams res = new QueryParams();
    String id = null;
    int matchedId = URI_MATCHER.match(uri);
    switch (matchedId) {
      case URI_TYPE_MOVIES:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_MOVIES ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }

        res.table = MoviesColumns.TABLE_NAME;
        res.idColumn = MoviesColumns._ID;
        res.tablesWithJoins = MoviesColumns.TABLE_NAME;
        res.selection = selection;
        res.orderBy = MoviesColumns.DEFAULT_ORDER;
        break;
      case URI_TYPE_MOVIES_ID:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_MOVIES_ID ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }

        res.table = MoviesColumns.TABLE_NAME;
        res.idColumn = MoviesColumns._ID;
        res.tablesWithJoins = MoviesColumns.TABLE_NAME;
        res.selection = selection;
        res.orderBy = MoviesColumns.DEFAULT_ORDER;
        break;
      case URI_TYPE_MOVIES_WITH_DETAILS:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_MOVIES_WITH_DETAILS ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }

        res.table = MoviesColumns.TABLE_NAME;
        res.idColumn = MoviesColumns._ID;
        res.tablesWithJoins = MoviesColumns.TABLE_NAME;
        if (ReviewsColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + ReviewsColumns.TABLE_NAME
                  + " ON "
                  + MoviesColumns.TABLE_NAME
                  + "."
                  + MoviesColumns._ID
                  + "="
                  + ReviewsColumns.TABLE_NAME
                  + "."
                  + ReviewsColumns.MOVIE_ID;
        }
        if (TrailersColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + TrailersColumns.TABLE_NAME
                  + " ON "
                  + MoviesColumns.TABLE_NAME
                  + "."
                  + MoviesColumns._ID
                  + "="
                  + TrailersColumns.TABLE_NAME
                  + "."
                  + TrailersColumns.MOVIE_ID;
        }
        res.orderBy = MoviesColumns.DEFAULT_ORDER;
        break;

      case URI_TYPE_REVIEWS:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_REVIEWS ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }
        res.table = ReviewsColumns.TABLE_NAME;
        res.idColumn = ReviewsColumns._ID;
        res.tablesWithJoins = ReviewsColumns.TABLE_NAME;
        if (MoviesColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + MoviesColumns.TABLE_NAME
                  + " AS "
                  + ReviewsColumns.PREFIX_MOVIES
                  + " ON "
                  + ReviewsColumns.TABLE_NAME
                  + "."
                  + ReviewsColumns.MOVIE_ID
                  + "="
                  + ReviewsColumns.PREFIX_MOVIES
                  + "."
                  + MoviesColumns._ID;
        }
        res.orderBy = ReviewsColumns.DEFAULT_ORDER;
        break;
      case URI_TYPE_REVIEWS_ID:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_REVIEWS_ID ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }
        res.table = ReviewsColumns.TABLE_NAME;
        res.idColumn = ReviewsColumns._ID;
        res.tablesWithJoins = ReviewsColumns.TABLE_NAME;
        if (MoviesColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + MoviesColumns.TABLE_NAME
                  + " AS "
                  + ReviewsColumns.PREFIX_MOVIES
                  + " ON "
                  + ReviewsColumns.TABLE_NAME
                  + "."
                  + ReviewsColumns.MOVIE_ID
                  + "="
                  + ReviewsColumns.PREFIX_MOVIES
                  + "."
                  + MoviesColumns._ID;
        }
        res.orderBy = ReviewsColumns.DEFAULT_ORDER;
        break;

      case URI_TYPE_TRAILERS:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_TRAILERS ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }
        res.table = TrailersColumns.TABLE_NAME;
        res.idColumn = TrailersColumns._ID;
        res.tablesWithJoins = TrailersColumns.TABLE_NAME;
        if (MoviesColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + MoviesColumns.TABLE_NAME
                  + " AS "
                  + TrailersColumns.PREFIX_MOVIES
                  + " ON "
                  + TrailersColumns.TABLE_NAME
                  + "."
                  + TrailersColumns.MOVIE_ID
                  + "="
                  + TrailersColumns.PREFIX_MOVIES
                  + "."
                  + MoviesColumns._ID;
        }
        res.orderBy = TrailersColumns.DEFAULT_ORDER;
        break;

      case URI_TYPE_TRAILERS_ID:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_TRAILERS_ID ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }
        res.table = TrailersColumns.TABLE_NAME;
        res.idColumn = TrailersColumns._ID;
        res.tablesWithJoins = TrailersColumns.TABLE_NAME;
        if (MoviesColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + MoviesColumns.TABLE_NAME
                  + " AS "
                  + TrailersColumns.PREFIX_MOVIES
                  + " ON "
                  + TrailersColumns.TABLE_NAME
                  + "."
                  + TrailersColumns.MOVIE_ID
                  + "="
                  + TrailersColumns.PREFIX_MOVIES
                  + "."
                  + MoviesColumns._ID;
        }
        res.orderBy = TrailersColumns.DEFAULT_ORDER;
        break;

        /* **************************************************************** */
      case URI_TYPE_MOVIEDB_ID:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_MOVIEDB_ID ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }
        id = uri.getLastPathSegment();

        res.table = MoviesColumns.TABLE_NAME;
        res.idColumn = MoviesColumns._ID;
        res.tablesWithJoins = MoviesColumns.TABLE_NAME;
        if (ReviewsColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + ReviewsColumns.TABLE_NAME
                  + " ON "
                  + MoviesColumns.TABLE_NAME
                  + "."
                  + MoviesColumns._ID
                  + "="
                  + ReviewsColumns.TABLE_NAME
                  + "."
                  + ReviewsColumns.MOVIE_ID;
        }
        if (TrailersColumns.hasColumns(projection)) {
          res.tablesWithJoins +=
              " LEFT OUTER JOIN "
                  + TrailersColumns.TABLE_NAME
                  + " ON "
                  + MoviesColumns.TABLE_NAME
                  + "."
                  + MoviesColumns._ID
                  + "="
                  + TrailersColumns.TABLE_NAME
                  + "."
                  + TrailersColumns.MOVIE_ID;
        }
        res.orderBy = MoviesColumns.DEFAULT_ORDER;
        if (selection != null)
          res.selection =
              MoviesColumns.TABLE_NAME
                  + "."
                  + MoviesColumns.MOVIE_ID
                  + " = "
                  + id
                  + " + and ("
                  + selection
                  + ")";
        else res.selection = MoviesColumns.TABLE_NAME + "." + MoviesColumns.MOVIE_ID + " = " + id;
        break;

      case URI_TYPE_MOVIES_WITH_FAV:
        if (PopMoviesConstants.DEBUG) {
          Log.i("PopMovies1", "+++++++++\n+++++++++++case URI_TYPE_MOVIES_WITH_FAV ");
          if (projection != null) Log.i("PopMovies1", " projection = " + projection.toString());
          if (selection != null) Log.i("PopMovies1", " selection= " + selection.toString());
        }
        res.table = MoviesColumns.TABLE_NAME;
        res.idColumn = MoviesColumns._ID;
        res.tablesWithJoins = MoviesColumns.TABLE_NAME;
        res.orderBy = MoviesColumns.DEFAULT_ORDER;
        if (selection != null)
          res.selection =
              MoviesColumns.TABLE_NAME
                  + "."
                  + MoviesColumns.FAVORITE
                  + " = TRUE"
                  + " + and ("
                  + selection
                  + ")";
        else res.selection = MoviesColumns.TABLE_NAME + "." + MoviesColumns.FAVORITE + " = TRUE";
        break;

        /* **************************************************************** */
      default:
        throw new IllegalArgumentException(
            "The uri '" + uri + "' is not supported by this ContentProvider");
    }

    switch (matchedId) {
      case URI_TYPE_MOVIES_ID:
      case URI_TYPE_REVIEWS_ID:
      case URI_TYPE_TRAILERS_ID:
      case URI_TYPE_MOVIES_WITH_DETAILS:
        id = uri.getLastPathSegment();
    }
    if (id != null) {
      if (selection != null) {
        res.selection = res.table + "." + res.idColumn + "=" + id + " and (" + selection + ")";
      } else {
        res.selection = res.table + "." + res.idColumn + "=" + id;
      }
    } else {
      res.selection = selection;
    }
    return res;
  }
 private String makeApiUrl(String path, QueryParams queryParams, Object... pathParams) {
   return API_URL + String.format(Locale.US, path, pathParams) + queryParams.asUrlParams();
 }
 public V get(QueryParams key) {
   return get(key.toString());
 }