Search in sources :

Example 1 with Rating

use of com.furyviewer.service.dto.OpenMovieDatabase.Rating in project FuryViewer by TheDoctor-95.

the class MarksService method markTransformationSeries.

/**
 * Convierte la informacion de los votos de paginas externas proporcionados por la api al formato FuryViewer.
 * @param ratings List | Lista con as diferentes votaciones proporcionadas por la api.
 * @param ss Series | Series de la cual se quiere guardar las votaciones.
 */
public void markTransformationSeries(List<Rating> ratings, Series ss) {
    for (Rating r : ratings) {
        Optional<Social> seriesOptional = socialRepository.findBySeriesAndType(ss, r.getSource());
        if (!seriesOptional.isPresent()) {
            Social s = new Social();
            s.setType(r.getSource());
            if (s.getType().equalsIgnoreCase("internet movie database")) {
                s.setType("IMDB");
            }
            s.setSeries(ss);
            s.setUrl(markTranformation(r.getSource(), r.getValue()));
            socialRepository.save(s);
        }
    }
}
Also used : Social(com.furyviewer.domain.Social) Rating(com.furyviewer.service.dto.OpenMovieDatabase.Rating)

Example 2 with Rating

use of com.furyviewer.service.dto.OpenMovieDatabase.Rating in project FuryViewer by TheDoctor-95.

the class MarksService method markTransformationMovie.

/**
 * Convierte la informacion de los votos de paginas externas proporcionados por la api al formato FuryViewer.
 * @param ratings List | Lista con as diferentes votaciones proporcionadas por la api.
 * @param m Movie | Movie de la cual se quiere guardar las votaciones.
 */
public void markTransformationMovie(List<Rating> ratings, Movie m) {
    for (Rating r : ratings) {
        Optional<Social> movieOptional = socialRepository.findByMovieAndType(m, r.getSource());
        if (!movieOptional.isPresent()) {
            Social s = new Social();
            s.setMovie(m);
            s.setType(r.getSource());
            s.setUrl(markTranformation(r.getSource(), r.getValue()));
            socialRepository.save(s);
        }
    }
}
Also used : Social(com.furyviewer.domain.Social) Rating(com.furyviewer.service.dto.OpenMovieDatabase.Rating)

Aggregations

Social (com.furyviewer.domain.Social)2 Rating (com.furyviewer.service.dto.OpenMovieDatabase.Rating)2