Class RemoteAPIServiceImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl<java.lang.Long,RemoteAPI>
-
- ca.corefacility.bioinformatics.irida.service.impl.RemoteAPIServiceImpl
-
- All Implemented Interfaces:
CRUDService<java.lang.Long,RemoteAPI>
,RemoteAPIService
@Transactional @Service public class RemoteAPIServiceImpl extends CRUDServiceImpl<java.lang.Long,RemoteAPI> implements RemoteAPIService
Service implementation for storing and retrieving RemoteAPI objects from aRemoteAPIRepository
-
-
Field Summary
-
Fields inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
CREATED_DATE_SORT_PROPERTY, validator, valueType
-
-
Constructor Summary
Constructors Constructor Description RemoteAPIServiceImpl(RemoteAPIRepository repository, javax.validation.Validator validator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RemoteAPI
create(RemoteAPI remoteAPI)
Create a new object in the persistence store.void
delete(java.lang.Long id)
Delete the object with the specified identifier from the database.java.lang.Iterable<RemoteAPI>
findAll()
List all objects ofType
in the database.RemoteAPI
getRemoteAPIForUrl(java.lang.String url)
Find theRemoteAPI
where the serviceURI is a substring of the given URL.RemoteAPI
read(java.lang.Long id)
Read the object type by unique identifier.org.springframework.data.domain.Page<RemoteAPI>
search(org.springframework.data.jpa.domain.Specification<RemoteAPI> specification, int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperties)
Search for an entity ofType
with a given specification-
Methods inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
count, exists, findRevisions, findRevisions, list, list, list, readMultiple, search, update, 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, findRevisions, findRevisions, list, list, list, readMultiple, search, update, updateFields, updateMultiple
-
-
-
-
Constructor Detail
-
RemoteAPIServiceImpl
@Autowired public RemoteAPIServiceImpl(RemoteAPIRepository repository, javax.validation.Validator validator) throws javax.validation.ConstraintViolationException, EntityExistsException
- Throws:
javax.validation.ConstraintViolationException
EntityExistsException
-
-
Method Detail
-
create
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") public RemoteAPI create(RemoteAPI remoteAPI)
Create a new object in the persistence store.- Specified by:
create
in interfaceCRUDService<java.lang.Long,RemoteAPI>
- Overrides:
create
in classCRUDServiceImpl<java.lang.Long,RemoteAPI>
- Parameters:
remoteAPI
- The object to persist.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
-
search
@PreAuthorize("permitAll") public org.springframework.data.domain.Page<RemoteAPI> search(org.springframework.data.jpa.domain.Specification<RemoteAPI> specification, int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperties)
Search for an entity ofType
with a given specification- Specified by:
search
in interfaceCRUDService<java.lang.Long,RemoteAPI>
- Overrides:
search
in classCRUDServiceImpl<java.lang.Long,RemoteAPI>
- Parameters:
specification
- The search specificationpage
- The page numbersize
- the size of the pageorder
- the order of the page sortsortProperties
- The properties to sort on- Returns:
- a Page of Type
-
delete
@PreAuthorize("hasRole(\'ROLE_ADMIN\')") 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,RemoteAPI>
- Overrides:
delete
in classCRUDServiceImpl<java.lang.Long,RemoteAPI>
- Parameters:
id
- The identifier of the object to delete.- Throws:
EntityNotFoundException
- If no object with the specified identifier exists in the database.
-
read
@PreAuthorize("permitAll") public RemoteAPI read(java.lang.Long id) throws EntityNotFoundException
Read the object type by unique identifier.- Specified by:
read
in interfaceCRUDService<java.lang.Long,RemoteAPI>
- Overrides:
read
in classCRUDServiceImpl<java.lang.Long,RemoteAPI>
- Parameters:
id
- The unique identifier for this object.- Returns:
- The object corresponding to the unique identifier.
- Throws:
EntityNotFoundException
- If the identifier does not exist in the database.
-
findAll
@PreAuthorize("permitAll") public java.lang.Iterable<RemoteAPI> findAll()
List all objects ofType
in the database.- Specified by:
findAll
in interfaceCRUDService<java.lang.Long,RemoteAPI>
- Overrides:
findAll
in classCRUDServiceImpl<java.lang.Long,RemoteAPI>
- Returns:
- All objects of the specified
Type
in the database.
-
getRemoteAPIForUrl
@PreAuthorize("permitAll") public RemoteAPI getRemoteAPIForUrl(java.lang.String url)
Description copied from interface:RemoteAPIService
Find theRemoteAPI
where the serviceURI is a substring of the given URL. For example if you passed the URL 'http://irida.ca/api/projects/5/samples/3' the method would find aRemoteAPI
with serviceURI of 'http://irida.ca/api'- Specified by:
getRemoteAPIForUrl
in interfaceRemoteAPIService
- Parameters:
url
- The URL to test- Returns:
- The
RemoteAPI
matching the given URL
-
-