Code Monkey home page Code Monkey logo

tomassirotek / private-movie-collection Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 4.0 574 KB

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 !

Java 91.47% CSS 8.53%
feign guava mybatis open-source sql guice javafx jupiter logback mssql

private-movie-collection's Introduction

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 [email protected] - @linkedIn

Patrik Valentíny @linkedIn

Nicola Martinez Clemente @linkedIn

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

private-movie-collection's People

Contributors

lordstacker avatar patrikvalentiny avatar tomassirotek avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

private-movie-collection's Issues

Question from curiosity

What if u want to call getAllMovies and they are not record inside the database ? What result we are getting ?
Because when u want to getAllMoviesByCategoryId u will get sql exception how that can happen ?

is this needed ?

The home button does nothing except fetching again all movies ? do we really need it there ?
since we are not planning to expand for another views then maybe we can just get rid of it :)

Screenshot 2023-01-13 at 12 32 43

Not needed 2.0 ?

Screenshot 2023-01-10 at 18 21 57

Why do we have getById when that method only used to chain everything in the Dao ?
On the GUI we are not going to need It

  • if it is not used then anywhere state it as private since it will be only used by that class

It is located inside the MovieService ->

Update of categories is not working maybe backend ?

Screenshot 2023-01-10 at 18 39 14

When movie is updated and different categories are selected and update is executed then It does not update all movie properties especially the categories ?

Also why are we updating the lastViewed/seen in update of the movie when we agreed on only updating the query when movie is played ?

Screenshot 2023-01-10 at 18 48 03

Is this really necessary ?

Screenshot 2023-01-10 at 18 17 13

Why are we deleting the CatMovie also ?
Is this necessary since we are having on delete cascade so that It wont leave anything behind when the movie is deleted ?

Its it located in MovieDAO starting 154 ?

Some ORM or tidy up MovieDAO ?

This is just note for later if we could look more (or I can) to tidy up the MovieDAO with the categories
Patrik dont get me wrong I love u spend so much time but just reading it makes me so confused for such a simple query that needs to map categories :)

But do not spend time on it now since we have more important stuff to do !

and why do I care to much just try to imagine the movie will have more aggregation ... or another nested stuff than can you imagine how f crazy our getAllMovies will get ? plus do you think when someone comes after you to watch this code they will be like yep that what I need to add here or modify

Filter bug

When u search on all movies and then you will go to specific category and then you go back to movies it does not want to switch scenes ? Can we take a look at it ? :) branch -> setup/filter

Empty Movie creation

I found that we can add movie without anything because front-end is storing initial value for rating and other so It will always be able to be inserted ... I will handle validation on the front end but can we look later into how we could maybe secure it also on the back end ? :)
Screenshot 2023-01-09 at 19 39 52

Not needed ?

Maybe when trying to search not on movie or category we could just not display sout ? :)

Screenshot 2023-01-16 at 12 18 38

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.