Class AgendaServiceImpl

java.lang.Object
it.unisa.c03.myPersonalTrainer.agenda.service.AgendaServiceImpl
All Implemented Interfaces:
AgendaService

public final class AgendaServiceImpl
extends java.lang.Object
implements AgendaService
  • Constructor Summary

    Constructors
    Constructor Description
    AgendaServiceImpl​(AgendaDAO agendaDAO)  
  • Method Summary

    Modifier and Type Method Description
    boolean checkAvailability​(java.lang.String data, java.lang.String time)
    this class check if the data and the time format are good to be insert into database.
    boolean checkDate​(java.lang.String date)
    check if the appointment date is valid.
    boolean createAppointment​(java.lang.String date, java.lang.String time, java.lang.String mail)
    creates the appointment and makes it persistent in the database.
    boolean createAvailability​(Availability availability)
    this methods enables to insert an availability into database.
    java.util.List<Appointment> findAppointmentByDate​(java.lang.String date)  
    java.util.List<Availability> getAvailabilityByDate​(java.lang.String date)
    return the availability list from the date in input.
    Availability getAvailabilityByDateAndTime​(java.lang.String date, int time)
    retrieve the availability with this time and date.
    boolean removeAppointment​(Appointment appuntamento)  
    boolean removeAvailability​(Availability availability)
    enable to remove the availability.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AgendaServiceImpl

      public AgendaServiceImpl​(AgendaDAO agendaDAO)
  • Method Details

    • checkDate

      public boolean checkDate​(java.lang.String date)
      Description copied from interface: AgendaService
      check if the appointment date is valid.
      Specified by:
      checkDate in interface AgendaService
      Parameters:
      date - date to check
      Returns:
      return true if the date is valid
    • createAppointment

      public boolean createAppointment​(java.lang.String date, java.lang.String time, java.lang.String mail) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      Description copied from interface: AgendaService
      creates the appointment and makes it persistent in the database.
      Specified by:
      createAppointment in interface AgendaService
      Parameters:
      date - appointment's date
      time - appointment's mail
      mail - appointment's applicant
      Returns:
      return true if the insertion is successful
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • removeAppointment

      public boolean removeAppointment​(Appointment appuntamento) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOException
      Specified by:
      removeAppointment in interface AgendaService
      Parameters:
      appuntamento - appointment to delete
      Returns:
      true if the appointment is successfully deleted
      Throws:
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException
      java.io.IOException
    • findAppointmentByDate

      public java.util.List<Appointment> findAppointmentByDate​(java.lang.String date) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOException
      Specified by:
      findAppointmentByDate in interface AgendaService
      Returns:
      return a list of appointments fixed on that date
      Throws:
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException
      java.io.IOException
    • checkAvailability

      public boolean checkAvailability​(java.lang.String data, java.lang.String time) throws java.lang.IllegalArgumentException
      this class check if the data and the time format are good to be insert into database.
      Specified by:
      checkAvailability in interface AgendaService
      Parameters:
      data - the data to check
      time - the time to check
      Returns:
      true if the check success, false otherwise.
      Throws:
      java.lang.IllegalArgumentException
    • createAvailability

      public boolean createAvailability​(Availability availability) throws java.io.IOException
      this methods enables to insert an availability into database.
      Specified by:
      createAvailability in interface AgendaService
      Parameters:
      availability - the availability to insert into database
      Returns:
      true if the insertion is done; else otherwise.
      Throws:
      java.io.IOException
    • getAvailabilityByDate

      public java.util.List<Availability> getAvailabilityByDate​(java.lang.String date) throws java.util.concurrent.ExecutionException, java.io.IOException, java.lang.InterruptedException
      return the availability list from the date in input.
      Specified by:
      getAvailabilityByDate in interface AgendaService
      Parameters:
      date - the date to find the availability
      Returns:
      Throws:
      java.util.concurrent.ExecutionException
      java.io.IOException
      java.lang.InterruptedException
    • removeAvailability

      public boolean removeAvailability​(Availability availability) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedException
      enable to remove the availability.
      Specified by:
      removeAvailability in interface AgendaService
      Parameters:
      availability - the availability to remove
      Returns:
      true if the remove is done.
      Throws:
      java.io.IOException
      java.util.concurrent.ExecutionException
      java.lang.InterruptedException
    • getAvailabilityByDateAndTime

      public Availability getAvailabilityByDateAndTime​(java.lang.String date, int time) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionException
      retrieve the availability with this time and date.
      Specified by:
      getAvailabilityByDateAndTime in interface AgendaService
      Parameters:
      date -
      time -
      Returns:
      the availability that contains this time and date.
      Throws:
      java.io.IOException
      java.lang.InterruptedException
      java.util.concurrent.ExecutionException