Class ParametersServiceImpl
java.lang.Object
it.unisa.c03.myPersonalTrainer.parameters.service.ParametersServiceImpl
- All Implemented Interfaces:
ParametersService
public class ParametersServiceImpl extends java.lang.Object implements ParametersService
-
Constructor Summary
Constructors Constructor Description ParametersServiceImpl(ParametersDAO parametersDAO) -
Method Summary
Modifier and Type Method Description ParameterscreateParameters(java.lang.String weight, java.lang.String leanMass, java.lang.String fatMass, java.lang.String email)check the format parameters.java.util.ArrayList<Parameters>getByMail(java.lang.String email)this method show the parameters for the input email.booleansaveParameters(Parameters parameters)method to save the new parameters.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
ParametersServiceImpl
-
-
Method Details
-
createParameters
public Parameters createParameters(java.lang.String weight, java.lang.String leanMass, java.lang.String fatMass, java.lang.String email) throws java.lang.IllegalArgumentException, java.io.IOExceptioncheck the format parameters.- Specified by:
createParametersin interfaceParametersService- Parameters:
weight- between 40 and 150 format allowed XXX.XXleanMass- between 10% and 70%fatMass- between 10% and 70%email-- Returns:
- the parameters, null if the parameters in input are not good
- Throws:
java.lang.NumberFormatExceptionjava.lang.IllegalArgumentExceptionjava.io.IOException
-
saveParameters
method to save the new parameters.- Specified by:
saveParametersin interfaceParametersService- Parameters:
parameters- the parameters to insert- Returns:
- true if the parameters are inserted into database
- Throws:
java.io.IOException
-
getByMail
public java.util.ArrayList<Parameters> getByMail(java.lang.String email) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.io.IOExceptionthis method show the parameters for the input email.- Specified by:
getByMailin interfaceParametersService- Parameters:
email- mail client who want to retrieve his parameters- Returns:
- list of parameters
- Throws:
java.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.io.IOException
-