/Private-Movie-Collection

A movie aficionado is buying and collecting movies in the mp4 format on an external 2 TB harddrive. So far he has tried to use a system where he puts them in different folders, depending on their IMDB rating and the category of the movie. As the collection has grown the categories is becoming an increasing problem. Here we come with a solution !

Primary LanguageJava

Private-Movie-Collection

🎒 Final Exam | 1st Semester | SDE & SCO

Contributors



Logo

Private Movie Collection
Explore the docs »

The brief

A movie aficionado is buying and collecting movies in the mp4 format on an external 2 TB hard-drive. So far he has tried to use a system where he puts them in different folders, depending on their rating and the category of the movie. As the collection has grown the categories is becoming an increasing problem. Here we come with a solution !

Table of Contents

  1. About The Project
  2. Features
  3. Application design
  4. Database design
  5. UML diagram
  6. Application design patterns
  7. Application interface
  8. License
  9. Contact

Tech stack

Style

Features and requirements

  • MSSQL Database
    • T-SQL dialect
    • MyBatis
    • SL4J logging
    • Build in caching
    • Environmental variables
    • Config file
    • SQL Server Driver
  • Movies
    • CRUD
      • Ability to play movie
      • Get all movies
      • Get all movies in category
      • Create movie
      • Update movie
      • Remove movie
    • Updating categories for movie
    • Dynamic update in the interface
    • Custom validation
  • Categories
    • CRUD impl
      • Create Category
      • Remove Category
    • Updating categories for movie
    • Dynamic update in the interface
    • Build in drawer with dynamic categories
    • Get all the movies when category assigned
    • Custom validation
  • API Contract
    • Open source RESTful web service
    • OpenFeign for smooth API calls
    • Implemented feature to fetch possible movie title from open source api
  • Dependency injection
    • Implemented DI with Guice in order to write efficient/reliable code
  • Dynamic sorting/filtering
    • Table view with sortable columns
    • Linear search algorithm
      • Search movie by title,year,category
      • Additional search feature for specifying rating
    • Error handling
  • Playable video formats
    • Works on Windows
    • Current issues with development environment and permission for mac users
      • Implementation works as intended however only on window atm but the impl works and would work
    • Feature to choose your own preferred movie player
  • Initial warning feature requirement
    • User will get the informational option to delete movie that are less than 6 rating and have not been seen for 2 years at the start

Application design

Our application was design by us in Figma

Screenshot 2022-12-14 at 10 23 40

Database design

MSSQL Database diagram

EASV

UML diagram

UML

Application design patterns

  • Singleton pattern
  • Dependency injection pattern
  • Factory pattern
  • Publish-subscribe-style communication
  • Data-access-object
  • Service pattern

Data Access Object

Example Method to retrieve movie by its category ID with com.movie_collection.dal.myBatis and SL4J

  • Additional mapping included in Movie.xml
@Override
public Optional<List<Movie>> getAllMoviesInTheCategoryById(int categoryId) {
    List<Movie> fetchedMovieInRole = new ArrayList<>();
    try (SqlSession session = MyBatisConnectionFactory.getSqlSessionFactory().openSession()) {
        MovieMapperDAO mapper = session.getMapper(MovieMapperDAO.class);
        fetchedMovieInRole = mapper.getAllMoviesByCategoryId(categoryId);
    } catch (Exception ex) {
        logger.error("An error occurred mapping tables", ex);
    }
    return Optional.ofNullable(fetchedMovieInRole);
}

DI Guice

Dependency injection pattern example of injecting a model via class construct

private IMovieDAO movieDAO;

@Inject
public MovieService(IMovieDAO movieDAO) {
    this.movieDAO = movieDAO;
}

OpenFeign /w API

RESTful web service to obtain movie information

  • http://www.omdbapi.com
  • API contract call to get movie by title
  • Environmental variables / sensitive credentials handeling
  • Custom logger stored in logs
public interface IMovie {
      @Headers({"Content-Type: application/json","apikey: {apikey}"})
      @RequestLine("GET /?t={title}")
      MovieDTO movieByName(@Param("title") String title);
}

FXML Factory Controller with Guice DI injection

@Override
public RootController loadFxmlFile(ViewType fxmlFile) throws IOException {
      final URL fxmlFileUrl = Main.class.getResource(fxmlFile.getFXMLView());

      final FXMLLoader loader = new FXMLLoader(fxmlFileUrl);
      loader.setControllerFactory(injector::getInstance);

      final Parent view = loader.load();
      final RootController controller = loader.getController();
      controller.setView(view);

      return controller;
    }

Abstract root controller

  • Implementation of a simple abstract class that set and retrieves Parent root object
public abstract class RootController implements IRootController {
    protected Parent root;

    @Override
    public Parent getView() {
        return root;
    }

    @Override
    public void setView(Parent node){
       this.root = Objects.requireNonNull(node, "view must not be null.");
    }
}

Application interface

Dashboard page

Screenshot 2022-12-14 at 10 41 16

Movie page

Screenshot 2022-12-14 at 10 41 16

Create movie window

image2

Licence

Distributed under the MIT License. See LICENSE for more information.

Team: The Binary Aces
2023 SDE & SCO cs project posted here on GitHub.
Hope you will like it!
Thank you for your attention! TTT ✒️

Contact

Tomas Simko - @twitter -simko.t@email.cz - @linkedIn

Patrik Valentíny @linkedIn

Nicola Martinez Clemente @linkedIn

Project Link: https://github.com/TomassSimko/Private-Movie-Collection