Class IridaClientDetailsServiceImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl<java.lang.Long,IridaClientDetails>
-
- ca.corefacility.bioinformatics.irida.service.impl.IridaClientDetailsServiceImpl
-
- All Implemented Interfaces:
CRUDService<java.lang.Long,IridaClientDetails>
,IridaClientDetailsService
@Service("clientDetails") @PreAuthorize("hasRole(\'ROLE_ADMIN\')") public class IridaClientDetailsServiceImpl extends CRUDServiceImpl<java.lang.Long,IridaClientDetails> implements IridaClientDetailsService
Service for storing and retrievingIridaClientDetails
object. Implements for use with OAuth approvals.
-
-
Field Summary
-
Fields inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
CREATED_DATE_SORT_PROPERTY, repository, validator, valueType
-
-
Constructor Summary
Constructors Constructor Description IridaClientDetailsServiceImpl(IridaClientDetailsRepository repository, org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService authorizationService, javax.validation.Validator validator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countActiveTokensForClient(IridaClientDetails client)
Get the number of all tokens defined for a givenIridaClientDetails
that are valid and not expired.int
countTokensForClient(IridaClientDetails client)
Get the number of tokens issued for a givenIridaClientDetails
IridaClientDetails
create(IridaClientDetails object)
Create a new object in the persistence store.void
delete(java.lang.Long id)
Delete the object with the specified identifier from the database.IridaClientDetails
loadClientByClientId(java.lang.String clientId)
Get theIridaClientDetails
by clientDetailsIridaClientDetails
read(java.lang.Long object)
Read the object type by unique identifier.void
revokeTokensForClient(IridaClientDetails client)
Revoke all OAuth2 tokens for a givenIridaClientDetails
org.springframework.data.domain.Page<IridaClientDetails>
search(org.springframework.data.jpa.domain.Specification<IridaClientDetails> specification, org.springframework.data.domain.Pageable pageRequest)
Search for an entity ofType
andPageRequest
IridaClientDetails
update(IridaClientDetails object)
Update an object-
Methods inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
count, exists, findAll, findRevisions, findRevisions, list, list, list, readMultiple, search, updateFields, updateMultiple
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.service.CRUDService
count, exists, findAll, findRevisions, findRevisions, list, list, list, readMultiple, search, updateFields, updateMultiple
-
-
-
-
Constructor Detail
-
IridaClientDetailsServiceImpl
@Autowired public IridaClientDetailsServiceImpl(IridaClientDetailsRepository repository, org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService authorizationService, javax.validation.Validator validator)
-
-
Method Detail
-
search
@PreAuthorize("permitAll()") public org.springframework.data.domain.Page<IridaClientDetails> search(org.springframework.data.jpa.domain.Specification<IridaClientDetails> specification, org.springframework.data.domain.Pageable pageRequest)
Search for an entity ofType
andPageRequest
- Specified by:
search
in interfaceCRUDService<java.lang.Long,IridaClientDetails>
- Overrides:
search
in classCRUDServiceImpl<java.lang.Long,IridaClientDetails>
- Parameters:
specification
- The searchSpecification
pageRequest
- ThePageRequest
- Returns:
- a
Page
ofType
-
loadClientByClientId
@PreAuthorize("permitAll()") public IridaClientDetails loadClientByClientId(java.lang.String clientId) throws EntityNotFoundException
Get theIridaClientDetails
by clientDetails- Specified by:
loadClientByClientId
in interfaceIridaClientDetailsService
- Parameters:
clientId
- The client_id of the client to fetch.- Returns:
- The client
- Throws:
EntityNotFoundException
-
create
public IridaClientDetails create(IridaClientDetails object) throws javax.validation.ConstraintViolationException, EntityExistsException
Create a new object in the persistence store.- Specified by:
create
in interfaceCRUDService<java.lang.Long,IridaClientDetails>
- Overrides:
create
in classCRUDServiceImpl<java.lang.Long,IridaClientDetails>
- Parameters:
object
- The object to persist.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
- Throws:
javax.validation.ConstraintViolationException
- If the object being persisted cannot be validated by validation rules associated with the object.EntityExistsException
- If the object being persisted violates uniqueness constraints in the database.
-
read
public IridaClientDetails read(java.lang.Long object)
Read the object type by unique identifier.- Specified by:
read
in interfaceCRUDService<java.lang.Long,IridaClientDetails>
- Overrides:
read
in classCRUDServiceImpl<java.lang.Long,IridaClientDetails>
- Parameters:
object
- The unique identifier for this object.- Returns:
- The object corresponding to the unique identifier.
-
update
public IridaClientDetails update(IridaClientDetails object)
Description copied from class:CRUDServiceImpl
Update an object- Specified by:
update
in interfaceCRUDService<java.lang.Long,IridaClientDetails>
- Overrides:
update
in classCRUDServiceImpl<java.lang.Long,IridaClientDetails>
- Parameters:
object
- The object to update- Returns:
- The updated object
-
delete
public void delete(java.lang.Long id) throws EntityNotFoundException
Delete the object with the specified identifier from the database.- Specified by:
delete
in interfaceCRUDService<java.lang.Long,IridaClientDetails>
- Overrides:
delete
in classCRUDServiceImpl<java.lang.Long,IridaClientDetails>
- Parameters:
id
- The identifier of the object to delete.- Throws:
EntityNotFoundException
- If no object with the specified identifier exists in the database.
-
countActiveTokensForClient
public int countActiveTokensForClient(IridaClientDetails client)
Get the number of all tokens defined for a givenIridaClientDetails
that are valid and not expired.- Specified by:
countActiveTokensForClient
in interfaceIridaClientDetailsService
- Parameters:
client
- theIridaClientDetails
to get tokens for- Returns:
- number of tokens defined for the client.
-
countTokensForClient
public int countTokensForClient(IridaClientDetails client)
Get the number of tokens issued for a givenIridaClientDetails
- Specified by:
countTokensForClient
in interfaceIridaClientDetailsService
- Parameters:
client
- Client to count tokens for- Returns:
- Number of tokens issued for the given client
-
revokeTokensForClient
public void revokeTokensForClient(IridaClientDetails client)
Revoke all OAuth2 tokens for a givenIridaClientDetails
- Specified by:
revokeTokensForClient
in interfaceIridaClientDetailsService
- Parameters:
client
- The client to revoke tokens for
-
-