Package com.wilfredmorgan.api.services
Interface RoleService
-
- All Known Implementing Classes:
RoleServiceImpl
public interface RoleServiceThe service that works with the Role model
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddelete(long id)Deletes the role record based off the provided primary keyvoiddeleteAll()Deletes all records and their associated records from the databasejava.util.List<Role>findAll()Returns a list of all the rolesRolefindRoleById(long id)Returns the role with the given primary keyRolefindRoleByName(java.lang.String name)Returns the role with the given nameRolesave(Role role)Given a complete role object, saves that role object in the database If a primary key is provided, the record is completely replaced If no primary key is provided, one is automatically generated and the record is added to the databaseRoleupdate(Role role, long id)Updates the provided fields in the role record referenced by the primary key
-
-
-
Method Detail
-
findAll
java.util.List<Role> findAll()
Returns a list of all the roles- Returns:
- List of roles
-
findRoleById
Role findRoleById(long id)
Returns the role with the given primary key- Parameters:
id-- Returns:
- Role object with the given primarry key or throws an exception if not found
-
findRoleByName
Role findRoleByName(java.lang.String name)
Returns the role with the given name- Parameters:
name- The name (String) of the role you seek- Returns:
- Role object with given name or throws an exception if not found
-
save
Role save(Role role)
Given a complete role object, saves that role object in the database If a primary key is provided, the record is completely replaced If no primary key is provided, one is automatically generated and the record is added to the database- Parameters:
role- The role object (Role) to be saved- Returns:
- The saved role object including any automatically generated fields
-
update
Role update(Role role, long id)
Updates the provided fields in the role record referenced by the primary key- Parameters:
role- Only the role fields to be updatedid- The primary key (long) of the user to be updated- Returns:
- Update role object
-
delete
void delete(long id)
Deletes the role record based off the provided primary key- Parameters:
id- The primary key (long) of the role to be deleted
-
deleteAll
void deleteAll()
Deletes all records and their associated records from the database
-
-