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 IridaClientDetailsServiceService for storing and retrievingIridaClientDetailsobject. 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 intcountActiveTokensForClient(IridaClientDetails client)Get the number of all tokens defined for a givenIridaClientDetailsthat are valid and not expired.intcountTokensForClient(IridaClientDetails client)Get the number of tokens issued for a givenIridaClientDetailsIridaClientDetailscreate(IridaClientDetails object)Create a new object in the persistence store.voiddelete(java.lang.Long id)Delete the object with the specified identifier from the database.IridaClientDetailsloadClientByClientId(java.lang.String clientId)Get theIridaClientDetailsby clientDetailsIridaClientDetailsread(java.lang.Long object)Read the object type by unique identifier.voidrevokeTokensForClient(IridaClientDetails client)Revoke all OAuth2 tokens for a givenIridaClientDetailsorg.springframework.data.domain.Page<IridaClientDetails>search(org.springframework.data.jpa.domain.Specification<IridaClientDetails> specification, org.springframework.data.domain.Pageable pageRequest)Search for an entity ofTypeandPageRequestIridaClientDetailsupdate(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 ofTypeandPageRequest- Specified by:
searchin interfaceCRUDService<java.lang.Long,IridaClientDetails>- Overrides:
searchin classCRUDServiceImpl<java.lang.Long,IridaClientDetails>- Parameters:
specification- The searchSpecificationpageRequest- ThePageRequest- Returns:
- a
PageofType
-
loadClientByClientId
@PreAuthorize("permitAll()") public IridaClientDetails loadClientByClientId(java.lang.String clientId) throws EntityNotFoundExceptionGet theIridaClientDetailsby clientDetails- Specified by:
loadClientByClientIdin 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:
createin interfaceCRUDService<java.lang.Long,IridaClientDetails>- Overrides:
createin 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:
readin interfaceCRUDService<java.lang.Long,IridaClientDetails>- Overrides:
readin 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:CRUDServiceImplUpdate an object- Specified by:
updatein interfaceCRUDService<java.lang.Long,IridaClientDetails>- Overrides:
updatein classCRUDServiceImpl<java.lang.Long,IridaClientDetails>- Parameters:
object- The object to update- Returns:
- The updated object
-
delete
public void delete(java.lang.Long id) throws EntityNotFoundExceptionDelete the object with the specified identifier from the database.- Specified by:
deletein interfaceCRUDService<java.lang.Long,IridaClientDetails>- Overrides:
deletein 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 givenIridaClientDetailsthat are valid and not expired.- Specified by:
countActiveTokensForClientin interfaceIridaClientDetailsService- Parameters:
client- theIridaClientDetailsto 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:
countTokensForClientin 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:
revokeTokensForClientin interfaceIridaClientDetailsService- Parameters:
client- The client to revoke tokens for
-
-