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 booleancheckAvailability(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.booleancheckDate(java.lang.String date)check if the appointment date is valid.booleancreateAppointment(java.lang.String date, java.lang.String time, java.lang.String mail)creates the appointment and makes it persistent in the database.booleancreateAvailability(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.AvailabilitygetAvailabilityByDateAndTime(java.lang.String date, int time)retrieve the availability with this time and date.booleanremoveAppointment(Appointment appuntamento)booleanremoveAvailability(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
-
-
Method Details
-
checkDate
public boolean checkDate(java.lang.String date)Description copied from interface:AgendaServicecheck if the appointment date is valid.- Specified by:
checkDatein interfaceAgendaService- 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.InterruptedExceptionDescription copied from interface:AgendaServicecreates the appointment and makes it persistent in the database.- Specified by:
createAppointmentin interfaceAgendaService- Parameters:
date- appointment's datetime- appointment's mailmail- appointment's applicant- Returns:
- return true if the insertion is successful
- Throws:
java.io.IOExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
removeAppointment
public boolean removeAppointment(Appointment appuntamento) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOException- Specified by:
removeAppointmentin interfaceAgendaService- Parameters:
appuntamento- appointment to delete- Returns:
- true if the appointment is successfully deleted
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.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:
findAppointmentByDatein interfaceAgendaService- Returns:
- return a list of appointments fixed on that date
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.io.IOException
-
checkAvailability
public boolean checkAvailability(java.lang.String data, java.lang.String time) throws java.lang.IllegalArgumentExceptionthis class check if the data and the time format are good to be insert into database.- Specified by:
checkAvailabilityin interfaceAgendaService- Parameters:
data- the data to checktime- the time to check- Returns:
- true if the check success, false otherwise.
- Throws:
java.lang.IllegalArgumentException
-
createAvailability
this methods enables to insert an availability into database.- Specified by:
createAvailabilityin interfaceAgendaService- 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.InterruptedExceptionreturn the availability list from the date in input.- Specified by:
getAvailabilityByDatein interfaceAgendaService- Parameters:
date- the date to find the availability- Returns:
- Throws:
java.util.concurrent.ExecutionExceptionjava.io.IOExceptionjava.lang.InterruptedException
-
removeAvailability
public boolean removeAvailability(Availability availability) throws java.io.IOException, java.util.concurrent.ExecutionException, java.lang.InterruptedExceptionenable to remove the availability.- Specified by:
removeAvailabilityin interfaceAgendaService- Parameters:
availability- the availability to remove- Returns:
- true if the remove is done.
- Throws:
java.io.IOExceptionjava.util.concurrent.ExecutionExceptionjava.lang.InterruptedException
-
getAvailabilityByDateAndTime
public Availability getAvailabilityByDateAndTime(java.lang.String date, int time) throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.ExecutionExceptionretrieve the availability with this time and date.- Specified by:
getAvailabilityByDateAndTimein interfaceAgendaService- Parameters:
date-time-- Returns:
- the availability that contains this time and date.
- Throws:
java.io.IOExceptionjava.lang.InterruptedExceptionjava.util.concurrent.ExecutionException
-