org.jtheque.movies.services.impl
Class MoviesService

java.lang.Object
  extended by org.jtheque.movies.services.impl.MoviesService
All Implemented Interfaces:
org.jtheque.core.managers.persistence.able.DataContainer<Movie>, IMoviesService, org.jtheque.primary.services.able.DataService<Movie>

public final class MoviesService
extends Object
implements IMoviesService

A service for movies implementation.

Author:
Baptiste Wicht

Field Summary
 
Fields inherited from interface org.jtheque.movies.services.able.IMoviesService
DATA_TYPE
 
Constructor Summary
MoviesService()
           
 
Method Summary
 void addDataListener(org.jtheque.core.managers.persistence.able.DataListener listener)
           
 void clean(Collection<Movie> movies, Collection<NameCleaner> cleaners)
          Clean all the movies using the specified cleaners.
 void clean(Movie movie, Collection<NameCleaner> cleaners)
          Clean the specified movie title with the specified cleaners.
 void clearAll()
           
 void create(Movie movie)
           
 boolean delete(Movie movie)
           
 boolean fileExists(String file)
          Indicate if the specified file still exists in the application.
 boolean fileExistsInOtherMovie(Movie movie, String file)
          Indicate if the specified file exists in the application in an other movie than the specified one.
 void fillInformations(Set<Movie> movies, boolean duration, boolean resolution, boolean image)
          Fill the informations of the specified movies.
 Collection<Movie> getDatas()
           
 String getDataType()
           
 Movie getEmptyMovie()
          Create an empty film.
 Movie getMovie(String title)
          Return the movie of the specified title.
 Collection<Movie> getMovies()
          Return the movies of the current collection.
 Set<Movie> getMovies(Category category, boolean includeSubCategory)
          Return all the movies of the specified category, including or not the movies of the subcategories.
 Collection<? extends Movie> getMoviesWithInvalidFiles()
          Return all the movies with invalid files.
 void save(Movie movie)
           
 void saveImage(Movie movie, BufferedImage image)
          Save the specified image and set it as the preview image of the movie.
 boolean thumbnailIsNotUsed(String name)
          Indicate if a thumbnail is not used in any movies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoviesService

public MoviesService()
Method Detail

getEmptyMovie

public Movie getEmptyMovie()
Description copied from interface: IMoviesService
Create an empty film.

Specified by:
getEmptyMovie in interface IMoviesService
Returns:
An empty film.

getMovies

public Collection<Movie> getMovies()
Description copied from interface: IMoviesService
Return the movies of the current collection.

Specified by:
getMovies in interface IMoviesService
Returns:
A List containing all the movies of the current collection.

getMovies

public Set<Movie> getMovies(Category category,
                            boolean includeSubCategory)
Description copied from interface: IMoviesService
Return all the movies of the specified category, including or not the movies of the subcategories.

Specified by:
getMovies in interface IMoviesService
Parameters:
category - The category to get the movies from.
includeSubCategory - boolean tag indicating if we must include (true) the subcategories or not (false).
Returns:
A Set containing all the movies of the specified category and eventually the subcategories if specified.

delete

@Transactional
public boolean delete(Movie movie)
Specified by:
delete in interface org.jtheque.primary.services.able.DataService<Movie>

save

@Transactional
public void save(Movie movie)
Specified by:
save in interface org.jtheque.primary.services.able.DataService<Movie>

create

@Transactional
public void create(Movie movie)
Specified by:
create in interface org.jtheque.primary.services.able.DataService<Movie>

clean

public void clean(Movie movie,
                  Collection<NameCleaner> cleaners)
Description copied from interface: IMoviesService
Clean the specified movie title with the specified cleaners.

Specified by:
clean in interface IMoviesService
Parameters:
movie - The movie to clean.
cleaners - The cleaners to use to clean the movie's title.

clean

public void clean(Collection<Movie> movies,
                  Collection<NameCleaner> cleaners)
Description copied from interface: IMoviesService
Clean all the movies using the specified cleaners.

Specified by:
clean in interface IMoviesService
Parameters:
movies - The movies to clean.
cleaners - The cleaners to use to clean the movies.

fileExists

public boolean fileExists(String file)
Description copied from interface: IMoviesService
Indicate if the specified file still exists in the application.

Specified by:
fileExists in interface IMoviesService
Parameters:
file - The file to test.
Returns:
true if the file exists else false.

fileExistsInOtherMovie

public boolean fileExistsInOtherMovie(Movie movie,
                                      String file)
Description copied from interface: IMoviesService
Indicate if the specified file exists in the application in an other movie than the specified one.

Specified by:
fileExistsInOtherMovie in interface IMoviesService
Parameters:
movie - The movie to exclude from the search.
file - The file to search for.
Returns:
true if the file in an other movie than the specified one else false.

saveImage

public void saveImage(Movie movie,
                      BufferedImage image)
Description copied from interface: IMoviesService
Save the specified image and set it as the preview image of the movie.

Specified by:
saveImage in interface IMoviesService
Parameters:
movie - The movie to set the image to. .
image - The image to save.

fillInformations

public void fillInformations(Set<Movie> movies,
                             boolean duration,
                             boolean resolution,
                             boolean image)
Description copied from interface: IMoviesService
Fill the informations of the specified movies.

Specified by:
fillInformations in interface IMoviesService
Parameters:
movies - The movies to fill the informations for.
duration - A boolean tag indicating if we must fill the duration (true) or not (false).
resolution - A boolean tag indicating if we must fill the resolution (true) or not (false).
image - A boolean tag indicating if we must fill the image (true) or not (false).

getMovie

public Movie getMovie(String title)
Description copied from interface: IMoviesService
Return the movie of the specified title.

Specified by:
getMovie in interface IMoviesService
Parameters:
title - The title to search for.
Returns:
The Movie with the specified title if there is one else null.

thumbnailIsNotUsed

public boolean thumbnailIsNotUsed(String name)
Description copied from interface: IMoviesService
Indicate if a thumbnail is not used in any movies.

Specified by:
thumbnailIsNotUsed in interface IMoviesService
Parameters:
name - The name of the thumbnail.
Returns:
true if the thumbnail is not used else false.

getMoviesWithInvalidFiles

public Collection<? extends Movie> getMoviesWithInvalidFiles()
Description copied from interface: IMoviesService
Return all the movies with invalid files.

Specified by:
getMoviesWithInvalidFiles in interface IMoviesService
Returns:
A Collection containing all the movies with invalid files.

getDatas

public Collection<Movie> getDatas()
Specified by:
getDatas in interface org.jtheque.core.managers.persistence.able.DataContainer<Movie>

addDataListener

public void addDataListener(org.jtheque.core.managers.persistence.able.DataListener listener)
Specified by:
addDataListener in interface org.jtheque.core.managers.persistence.able.DataContainer<Movie>

getDataType

public String getDataType()
Specified by:
getDataType in interface org.jtheque.core.managers.persistence.able.DataContainer<Movie>

clearAll

@Transactional
public void clearAll()
Specified by:
clearAll in interface org.jtheque.core.managers.persistence.able.DataContainer<Movie>


Copyright © 2010 JTheque. All Rights Reserved.