Package com.wilfredmorgan.api.services
Class RoleServiceImpl
- java.lang.Object
-
- com.wilfredmorgan.api.services.RoleServiceImpl
-
- All Implemented Interfaces:
RoleService
@Transactional @Service("roleService") public class RoleServiceImpl extends java.lang.Object implements RoleServiceImplements the RoleService interface
-
-
Constructor Summary
Constructors Constructor Description RoleServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete 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
public java.util.List<Role> findAll()
Description copied from interface:RoleServiceReturns a list of all the roles- Specified by:
findAllin interfaceRoleService- Returns:
- List of roles
-
findRoleById
public Role findRoleById(long id)
Description copied from interface:RoleServiceReturns the role with the given primary key- Specified by:
findRoleByIdin interfaceRoleService- Returns:
- Role object with the given primarry key or throws an exception if not found
-
findRoleByName
public Role findRoleByName(java.lang.String name)
Description copied from interface:RoleServiceReturns the role with the given name- Specified by:
findRoleByNamein interfaceRoleService- Parameters:
name- The name (String) of the role you seek- Returns:
- Role object with given name or throws an exception if not found
-
save
@Transactional public Role save(Role role)
Description copied from interface:RoleServiceGiven 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- Specified by:
savein interfaceRoleService- Parameters:
role- The role object (Role) to be saved- Returns:
- The saved role object including any automatically generated fields
-
update
@Transactional public Role update(Role role, long id)
Description copied from interface:RoleServiceUpdates the provided fields in the role record referenced by the primary key- Specified by:
updatein interfaceRoleService- Parameters:
role- Only the role fields to be updatedid- The primary key (long) of the user to be updated- Returns:
- Update role object
-
delete
@Transactional public void delete(long id)
Description copied from interface:RoleServiceDeletes the role record based off the provided primary key- Specified by:
deletein interfaceRoleService- Parameters:
id- The primary key (long) of the role to be deleted
-
deleteAll
@Transactional public void deleteAll()
Description copied from interface:RoleServiceDeletes all records and their associated records from the database- Specified by:
deleteAllin interfaceRoleService
-
-