Class ClientService
- java.lang.Object
-
- org.exoplatform.timetracker.service.ClientService
-
public class ClientService extends java.lang.ObjectA Service to access and store Activities- Version:
- $Id: $Id
- Author:
- medamine
-
-
Constructor Summary
Constructors Constructor Description ClientService(ClientStorage clientStorage)Constructor for ClientService.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientcreateClient(Client client)Create new Client that will be available for all users.voiddeleteClient(java.lang.Long clientId, java.lang.String username)Delete Client identified by its id and check if username has permission to delete it.java.util.List<Client>getClientsList()Retrieves the list of Activities with offset, limit and a keyword that can be emptyClientupdateClient(Client Client, java.lang.String username)Update an existing Client on datasource.
-
-
-
Constructor Detail
-
ClientService
public ClientService(ClientStorage clientStorage)
Constructor for ClientService.
- Parameters:
clientStorage- aClientStorageobject.
-
-
Method Detail
-
createClient
public Client createClient(Client client) throws java.lang.Exception
Create new Client that will be available for all users. If the Client already exits anEntityExistsExceptionwill be thrown.- Parameters:
client- Client to create- Returns:
- stored
Clientin datasource - Throws:
java.lang.Exception- when Client already exists or an error occurs while creating Client or its attached image
-
updateClient
public Client updateClient(Client Client, java.lang.String username) throws java.lang.Exception
Update an existing Client on datasource. If the Client doesn't exit anEntityNotFoundExceptionwill be thrown.- Parameters:
Client- dto to update on storeusername- username storing Client- Returns:
- stored
Clientin datasource - Throws:
java.lang.Exception- whenExceptionis thrown or an error occurs while saving Client
-
deleteClient
public void deleteClient(java.lang.Long clientId, java.lang.String username) throws javax.persistence.EntityNotFoundException, java.lang.IllegalAccessExceptionDelete Client identified by its id and check if username has permission to delete it.- Parameters:
clientId- technical identifier of Clientusername- user currently deleting Client- Throws:
javax.persistence.EntityNotFoundException- if Client wasn't foundjava.lang.IllegalAccessException- if user is not allowed to delete Client
-
-