Retrieves the reviews for a movie

@param movieId
@param reviewType
@param pageLimit
@param page
@param country
@return
@throws RottenTomatoesException
165767
public List<Review> getMoviesReviews(int movieId, String reviewType, int pageLimit, int page, String country) throws RottenTomatoesException {
        properties.clear();
        properties.put(ApiBuilder.PROPERTY_ID, String.valueOf(movieId));
        properties.put(ApiBuilder.PROPERTY_URL, URL_MOVIES_REVIEWS);
        properties.put(ApiBuilder.PROPERTY_REVIEW_TYPE, reviewType);
        properties.put(ApiBuilder.PROPERTY_PAGE_LIMIT, ApiBuilder.validatePageLimit(pageLimit));
        properties.put(ApiBuilder.PROPERTY_PAGE, ApiBuilder.validatePage(page));
        properties.put(ApiBuilder.PROPERTY_COUNTRY, ApiBuilder.validateCountry(country));

        WrapperLists wrapper = response.getResponse(WrapperLists.class, properties);
        if (wrapper != null && wrapper.getReviews() != null) {
            return wrapper.getReviews();
        } else {
            return Collections.emptyList();
        }
    }
120421
public <T extends AbstractJsonMapping> T getResponse(Class<T> clazz, Map<String, String> properties) throws RottenTomatoesException {
        String url = ApiBuilder.create(properties);
        try {
            T wrapper = clazz.cast(MAPPER.readValue(getContent(url), clazz));
            int retry = 1;

            while (!wrapper.isValid() && "Account Over Queries Per Second Limit".equalsIgnoreCase(wrapper.getError()) && retry <= retryLimit) {
                LOG.trace("Account over queries limit, waiting for {}ms.", retryDelay * retry);
                sleeper(retry++);
                wrapper = MAPPER.readValue(getContent(url), clazz);
            }

            if (wrapper.isValid()) {
                return wrapper;
            } else {
                throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, wrapper.getError(), url);
            }
        } catch (IOException ex) {
            throw new RottenTomatoesException(ApiExceptionType.MAPPING_FAILED, "Failed to map response", url, ex);
        }
    }
838273
public ResultList<MovieBasic> getDiscoverMovies(Discover discover) throws MovieDbException {
        URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.MOVIE).buildUrl(discover.getParams());
        String webpage = httpTools.getRequest(url);
        WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage);
        return wrapper.getResultsList();
    }
6888
public ResultList<Artwork> getMovieImages(int movieId, String language) throws MovieDbException {
        return tmdbMovies.getMovieImages(movieId, language);
    }
833687
public ResultList<MovieBasic> getKeywordMovies(String keywordId, String language, Integer page) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, keywordId);
        parameters.add(Param.LANGUAGE, language);
        parameters.add(Param.PAGE, page);

        URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).subMethod(MethodSub.MOVIES).buildUrl(parameters);
        WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "keyword movies");
        return wrapper.getResultsList();
    }
980990
public List<RTMovie> getNewReleaseDvds(String country) throws RottenTomatoesException {
        return getNewReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
    }
1183536
public ResultList<MovieInfo> getRecommendations(int movieId, String language) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, movieId);
        parameters.add(Param.LANGUAGE, language);

        URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RECOMMENDATIONS).buildUrl(parameters);
        WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "recommendations");
        return wrapper.getResultsList();
    }
752181
public ResultList<Keyword> getMovieKeywords(int movieId) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, movieId);

        URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.KEYWORDS).buildUrl(parameters);
        String webpage = httpTools.getRequest(url);

        try {
            WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class);
            ResultList<Keyword> results = new ResultList<>(wrapper.getKeywords());
            wrapper.setResultProperties(results);
            return results;
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keywords", url, ex);
        }
    }
323858
public StatusCode addToWatchList(String sessionId, int accountId, MediaType mediaType, Integer mediaId) throws MovieDbException {
        return tmdbAccount.modifyWatchList(sessionId, accountId, mediaType, mediaId, true);
    }
1085225
public Revision getRevision(final int revisionID)
        throws WikiApiException
    {

        try {
            if (revisionID < 1) {
                throw new IllegalArgumentException();
            }

            int fullRevPK = -1;
            int limit = 1;

            PreparedStatement statement = null;
            ResultSet result = null;

            try {
                statement = this.connection.prepareStatement("SELECT FullRevisionPK, RevisionPK "
                        + "FROM index_revisionID " + "WHERE revisionID=? LIMIT 1");
                statement.setInt(1, revisionID);
                result = statement.executeQuery();

                if (result.next()) {
                    fullRevPK = result.getInt(1);
                    limit = (result.getInt(2) - fullRevPK) + 1;

                }
                else {
                    throw new WikiPageNotFoundException("The revision with the ID " + revisionID
                            + " was not found.");
                }

            }
            finally {
                if (statement != null) {
                    statement.close();
                }
                if (result != null) {
                    result.close();
                }
            }

            return buildRevisionMetaData(fullRevPK, limit);

        }
        catch (WikiPageNotFoundException e) {
            throw e;
        }
        catch (Exception e) {
            throw new WikiApiException(e);
        }
    }
1177601
public ResultList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, movieId);
        parameters.add(Param.COUNTRY, country);

        URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
        String webpage = httpTools.getRequest(url);
        try {
            WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class);
            ResultList<AlternativeTitle> results = new ResultList<>(wrapper.getTitles());
            wrapper.setResultProperties(results);
            return results;
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get alternative titles", url, ex);
        }
    }
753686
public ResultList<ReleaseInfo> getMovieReleaseInfo(int movieId, String language) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, movieId);
        parameters.add(Param.LANGUAGE, language);

        URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASES).buildUrl(parameters);
        String webpage = httpTools.getRequest(url);

        try {
            WrapperReleaseInfo wrapper = MAPPER.readValue(webpage, WrapperReleaseInfo.class);
            ResultList<ReleaseInfo> results = new ResultList<>(wrapper.getCountries());
            wrapper.setResultProperties(results);
            return results;
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get release information", url, ex);
        }
    }
824671
private List<Object> getFilePreviews(final String[] fileList, final String locationFull,
      final IStreamProvider streamProvider, final boolean renderResultsAsHtml) {
    final List<Object> files = new ArrayList<>();
    InputStream csvInputStream = null;

    try {
      for (final String fileName : fileList) {
        final Map<String, Object> file = new HashMap<>();
        file.put("name", fileName);

        final String filePath = locationFull + "/" + fileName;
        csvInputStream = streamProvider.getFileInputStream(filePath);
        final Scanner rowScanner = new Scanner(csvInputStream, StandardCharsets.UTF_8.toString());

        final List<Object> lines = new ArrayList<>();
        int lineNumber = 0;
        while (rowScanner.hasNextLine()
            && lineNumber < ReportalMailCreator.NUM_PREVIEW_ROWS) {
          final String csvLine = rowScanner.nextLine();
          final String[] data = csvLine.split("\",\"");
          final List<String> line = new ArrayList<>();
          for (final String item : data) {
            String column = item.replace("\"", "");
            if (!renderResultsAsHtml) {
              column = StringEscapeUtils.escapeHtml(column);
            }
            line.add(column);
          }
          lines.add(line);
          lineNumber++;
        }

        file.put("content", lines);

        if (rowScanner.hasNextLine()) {
          file.put("hasMore", true);
        }

        files.add(file);
        rowScanner.close();
      }
    } catch (final Exception e) {
      logger.debug("Error encountered while processing files in "
          + locationFull, e);
    } finally {
      IOUtils.closeQuietly(csvInputStream);
    }

    return files;
  }
1043917
private boolean queryArticle()
		throws SQLException
	{

		Statement statement = this.connection.createStatement();

		String query = "SELECT ArticleID, FullRevisionPKs, RevisionCounter "
				+ "FROM index_articleID_rc_ts " + "WHERE articleID > "
				+ this.currentArticleID + " LIMIT " + MAX_NUMBER_RESULTS;

		resultArticles = statement.executeQuery(query);

		if (resultArticles.next()) {

			this.currentArticleID = resultArticles.getInt(1);
			return (this.lastArticleID == -1)
					|| (this.currentArticleID <= this.lastArticleID);
		}

		return false;
	}
1190476
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language) throws MovieDbException {
        return tmdbTv.getTVSimilar(tvID, page, language);
    }
224236
public ResultList<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, guestSessionId);
        parameters.add(Param.LANGUAGE, language);
        parameters.add(Param.PAGE, page);
        if (sortBy != null) {
            // Only created_at is supported
            parameters.add(Param.SORT_BY, "created_at");

            if (sortBy.getPropertyString().endsWith("asc")) {
                parameters.add(Param.SORT_ORDER, "asc");
            } else {
                parameters.add(Param.SORT_ORDER, "desc");
            }
        }

        URL url = new ApiUrl(apiKey, MethodBase.GUEST_SESSION).subMethod(MethodSub.RATED_MOVIES_GUEST).buildUrl(parameters);
        WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "Guest Session Movies");
        return wrapper.getResultsList();
    }
879093
final public function startGetReviews($limit = null, $offset = null, array $uids = array(), $responseType = 'xml')
    {
        switch ($responseType) {
            default:
            case 'xml':
                $this->buffer->setFile($this->config->getReviewsXmlPath());
                break;

            case 'json':
                $this->buffer->setFile($this->config->getReviewsJsonPath());
                break;
        }

        $this->createReviews($limit, $offset, $uids);
        $this->buffer->finish();
    }