Changeset 1b248e4 for src/main


Ignore:
Timestamp:
02/02/23 22:46:30 (23 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
ac25203
Parents:
f60cb20
Message:

service impl changes

Location:
src/main/java/com/example/moviezone
Files:
1 added
11 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/repository/TicketRepository.java

    rf60cb20 r1b248e4  
    11package com.example.moviezone.repository;
    22
     3import com.example.moviezone.model.Customer;
    34import com.example.moviezone.model.Ticket;
    45import org.springframework.data.jpa.repository.JpaRepository;
    56
     7import java.util.List;
     8
    69public interface TicketRepository extends JpaRepository<Ticket,Integer> {
     10    List<Ticket> findAllByCustomer(Customer customer);
    711}
  • src/main/java/com/example/moviezone/service/Impl/CinemaServiceImpl.java

    rf60cb20 r1b248e4  
    1818    @Override
    1919    public List<Cinema> findAllCinemas() {
    20         return null;
     20        return cinemaRepository.findAll();
    2121    }
    2222}
  • src/main/java/com/example/moviezone/service/Impl/CustomerServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.Customer;
     4import com.example.moviezone.repository.CustomerRepository;
    45import com.example.moviezone.service.CustomerService;
    56import org.springframework.stereotype.Service;
     
    910@Service
    1011public class CustomerServiceImpl implements CustomerService {
     12    private final CustomerRepository customerRepository;
     13
     14    public CustomerServiceImpl(CustomerRepository customerRepository) {
     15        this.customerRepository = customerRepository;
     16    }
     17
    1118    @Override
    1219    public List<Customer> findAllCustomers() {
    13         return null;
     20        return customerRepository.findAll();
    1421    }
    1522}
  • src/main/java/com/example/moviezone/service/Impl/EventServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.Event;
     4import com.example.moviezone.repository.EventRepository;
    45import com.example.moviezone.service.EventService;
    56import org.springframework.stereotype.Service;
     
    910@Service
    1011public class EventServiceImpl implements EventService {
     12    private final EventRepository eventRepository;
     13
     14    public EventServiceImpl(EventRepository eventRepository) {
     15        this.eventRepository = eventRepository;
     16    }
     17
    1118    @Override
    1219    public List<Event> findAllEvents() {
    13         return null;
     20        return eventRepository.findAll();
    1421    }
    1522}
  • src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.Film;
     4import com.example.moviezone.repository.FilmRepository;
    45import com.example.moviezone.service.FilmService;
    56import org.springframework.stereotype.Service;
     
    910@Service
    1011public class FilmServiceImpl implements FilmService {
     12    private final FilmRepository filmRepository;
     13
     14    public FilmServiceImpl(FilmRepository filmRepository) {
     15        this.filmRepository = filmRepository;
     16    }
     17
    1118    @Override
    1219    public List<Film> findAllFilms() {
    13         return null;
     20        return filmRepository.findAll();
    1421    }
    1522}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.Projection;
     4import com.example.moviezone.repository.ProjectionRepository;
    45import com.example.moviezone.service.ProjectionService;
    56import org.springframework.stereotype.Service;
     
    910@Service
    1011public class ProjectionServiceImpl implements ProjectionService {
     12    private final ProjectionRepository projectionRepository;
     13
     14    public ProjectionServiceImpl(ProjectionRepository projectionRepository) {
     15        this.projectionRepository = projectionRepository;
     16    }
     17
    1118    @Override
    1219    public List<Projection> findAllProjections() {
    13         return null;
     20        return projectionRepository.findAll();
    1421    }
    1522}
  • src/main/java/com/example/moviezone/service/Impl/Projection_RoomServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.Projection_Room;
     4import com.example.moviezone.repository.Projection_RoomRepository;
    45import com.example.moviezone.service.Projection_RoomService;
    56import org.springframework.stereotype.Service;
     
    910@Service
    1011public class Projection_RoomServiceImpl implements Projection_RoomService {
     12    private final Projection_RoomRepository projectionRoomRepository;
     13
     14    public Projection_RoomServiceImpl(Projection_RoomRepository projectionRoomRepository) {
     15        this.projectionRoomRepository = projectionRoomRepository;
     16    }
     17
    1118    @Override
    1219    public List<Projection_Room> findAllProjectionRooms() {
    13         return null;
     20        return projectionRoomRepository.findAll();
    1421    }
    1522}
  • src/main/java/com/example/moviezone/service/Impl/TicketServiceImpl.java

    rf60cb20 r1b248e4  
    11package com.example.moviezone.service.Impl;
    22
     3import com.example.moviezone.model.Customer;
    34import com.example.moviezone.model.Ticket;
     5import com.example.moviezone.repository.TicketRepository;
    46import com.example.moviezone.service.TicketService;
    57import org.springframework.stereotype.Service;
     
    911@Service
    1012public class TicketServiceImpl implements TicketService {
    11     @Override
    12     public List<Ticket> findAllTickets() {
    13         return null;
     13    private final TicketRepository ticketRepository;
     14
     15    public TicketServiceImpl(TicketRepository ticketRepository) {
     16        this.ticketRepository = ticketRepository;
    1417    }
    1518
    1619    @Override
    17     public List<Ticket> findAllByCustomer() {
    18         return null;
     20    public List<Ticket> findAllTickets() {
     21        return ticketRepository.findAll();
     22    }
     23
     24    @Override
     25    public List<Ticket> findAllByCustomer(Customer customer) {
     26        return ticketRepository.findAllByCustomer(customer);
    1927    }
    2028}
  • src/main/java/com/example/moviezone/service/Impl/UserServiceImpl.java

    rf60cb20 r1b248e4  
    22
    33import com.example.moviezone.model.User;
     4import com.example.moviezone.model.exceptions.UserNotFoundException;
     5import com.example.moviezone.repository.UserRepository;
    46import com.example.moviezone.service.UserService;
    57import org.springframework.stereotype.Service;
     
    1012public class UserServiceImpl implements UserService {
    1113
     14    private final UserRepository userRepository;
     15
     16    public UserServiceImpl(UserRepository userRepository) {
     17        this.userRepository = userRepository;
     18    }
    1219
    1320    @Override
    1421    public List<User> findAllUsers() {
    15         return null;
     22        return userRepository.findAll();
    1623    }
    1724
    1825    @Override
    19     public User findById() {
    20         return null;
     26    public User findById(Integer id) {
     27        return userRepository.findById(id).orElseThrow(UserNotFoundException::new);
    2128    }
    2229}
  • src/main/java/com/example/moviezone/service/TicketService.java

    rf60cb20 r1b248e4  
    11package com.example.moviezone.service;
    22
     3import com.example.moviezone.model.Customer;
    34import com.example.moviezone.model.Ticket;
    45
     
    78public interface TicketService {
    89    List<Ticket> findAllTickets();
    9     List<Ticket> findAllByCustomer();
     10    List<Ticket> findAllByCustomer(Customer customer);
    1011}
  • src/main/java/com/example/moviezone/service/UserService.java

    rf60cb20 r1b248e4  
    77public interface UserService {
    88    List<User> findAllUsers();
    9     User findById();
     9    User findById(Integer user_id);
    1010}
Note: See TracChangeset for help on using the changeset viewer.