Package core

Class StudentDataService

java.lang.Object
core.StudentDataService
All Implemented Interfaces:
IStudentDataService

public class StudentDataService extends Object implements IStudentDataService
Serwis danych studentów.
  • Constructor Details

    • StudentDataService

      public StudentDataService(IStudentDataValidator validatorService)
      Konstruktor serwisu.
      Parameters:
      validatorService - Serwis walidujący.
  • Method Details

    • get

      public StudentData get(String album) throws Exception
      Pobiera dane studenta na podstawie numeru albumu.
      Specified by:
      get in interface IStudentDataService
      Parameters:
      album - Numer albumu studenta.
      Returns:
      Dane studenta.
      Throws:
      Exception - Wyjątek wyrzucany w przypadku braku numeru studenta lub błędu wyszukiwania danych.
    • size

      public int size() throws Exception
      Specified by:
      size in interface IStudentDataService
      Returns:
      Liczba obiektów StudentData w bazie danych.
      Throws:
      Exception - Wyjątek w przypadku błędu połączenia z listą studentów.
    • clear

      public void clear() throws Exception
      Kasuje załadowane dane studentów.
      Specified by:
      clear in interface IStudentDataService
      Throws:
      Exception - Wyjątek w przypadku błędu komunikacji z listą studentów.
    • getAll

      public Collection<StudentData> getAll() throws Exception
      Specified by:
      getAll in interface IStudentDataService
      Returns:
      Zwraca kopię listy studentów.
      Throws:
      Exception - Wyjątek w przypadku błędu komunikacji z listą studentów.
    • update

      public void update(StudentData studentData) throws Exception
      Aktualizuje dane studenta o danym numerze albumu.
      Specified by:
      update in interface IStudentDataService
      Parameters:
      studentData - Dane studenta.
      Throws:
      Exception - Wyjątek w przypadku błędu połączenia z listą studentów.
    • delete

      public void delete(String album) throws Exception
      Usuwa dane studenta o podanym numerze albumu.
      Specified by:
      delete in interface IStudentDataService
      Parameters:
      album - Numer albumu.
      Throws:
      Exception - Wyjątek w przypadku błędu połączenia z listą studentów.
    • exists

      public boolean exists(String album)
      Sprawdza, czy istnieją dane studenta o podanym numerze albumu.
      Specified by:
      exists in interface IStudentDataService
      Parameters:
      album - Numer albumu.
      Returns:
      Prawda, jeśli istnieją dane studenta o podanym numerze albumu, fałsz w przeciwnym wypadku.
    • add

      public void add(StudentData studentData) throws ValidationException
      Dodaje dane studenta.
      Specified by:
      add in interface IStudentDataService
      Parameters:
      studentData - Dane studenta.
      Throws:
      ValidationException - Wyjątek w przypadku błędu połączenia z listą studentów.
      ValidationException - Wyjątek w przypadku próby dodania studenta z istniejącym w bazie numerem albumu.
      ValidationException - Wyjątek w przypadku próby dodania studenta z niepoprawnymi danymi.
    • save

      public void save(IStudentDataPersistentStorageService preservationService) throws Exception
      Zapisuje dane studentów w serwisie danych trwałych.
      Specified by:
      save in interface IStudentDataService
      Parameters:
      preservationService - Serwis przechowywania danych studenta.
      Throws:
      Exception - Wyjątek w przypadku błędu połączenia z listą studentów.
    • load

      public void load(IStudentDataPersistentStorageService preservationService) throws Exception
      Ładuje dane studentów z serwisu danych trwałych.
      Specified by:
      load in interface IStudentDataService
      Parameters:
      preservationService - Obiekt przechowywania danych, z którego są czytane dane studentów.
      Throws:
      Exception - Wyjątek w przypadku błędu połączenia z listą studentów.
      Exception - Wyjątek w przypadku błędu ładowania danych z serwisu danych trwałych.
    • validate

      public boolean validate(StudentData studentData)
      Waliduje dane studenta.
      Specified by:
      validate in interface IStudentDataService
      Parameters:
      studentData - Dane studenta.
      Returns:
      Prawda, jeśli dane studenta są poprawne, fałsz w przeciwnym wypadku.