Interface CRUDService<IdentifierType extends java.io.Serializable,Type extends Timestamped<IdentifierType>>
-
- Type Parameters:
IdentifierType
- Identifier for the object stored in this serviceType
- The object type being stored in this service
- All Known Subinterfaces:
AnalysisService
,AnalysisSubmissionService
,AnnouncementService
,GenomeAssemblyService
,IridaClientDetailsService
,MetadataTemplateService
,NcbiExportSubmissionService
,PasswordResetService
,ProjectEventService
,ProjectService
,ProjectSubscriptionService
,ReferenceFileService
,RemoteAPIService
,SampleService
,SequencingObjectService
,SequencingRunService
,UserGroupService
,UserService
,WorkflowNamedParametersService
- All Known Implementing Classes:
AnalysisServiceImpl
,AnalysisSubmissionServiceImpl
,AnnouncementServiceImpl
,CRUDServiceImpl
,GenomeAssemblyServiceImpl
,IridaClientDetailsServiceImpl
,MetadataTemplateServiceImpl
,NcbiExportSubmissionServiceImpl
,PasswordResetServiceImpl
,ProjectEventServiceImpl
,ProjectServiceImpl
,ProjectSubscriptionServiceImpl
,ReferenceFileServiceImpl
,RemoteAPIServiceImpl
,SampleServiceImpl
,SequencingObjectServiceImpl
,SequencingRunServiceImpl
,UserGroupServiceImpl
,UserServiceImpl
,WorkflowNamedParametersServiceImpl
@PreAuthorize("denyAll()") public interface CRUDService<IdentifierType extends java.io.Serializable,Type extends Timestamped<IdentifierType>>
All Service interfaces should extend this interface to inherit common methods relating to creating, reading, updating and deleting objects from persistence.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
count()
How many entities ofType
exist in the database?Type
create(Type object)
Create a new object in the persistence store.void
delete(IdentifierType id)
Delete the object with the specified identifier from the database.java.lang.Boolean
exists(IdentifierType id)
Check to see if an identifier forType
exists in the database.java.lang.Iterable<Type>
findAll()
List all objects ofType
in the database.org.springframework.data.history.Revisions<java.lang.Integer,Type>
findRevisions(IdentifierType id)
Find all of the revisions for the specified identifier.org.springframework.data.domain.Page<org.springframework.data.history.Revision<java.lang.Integer,Type>>
findRevisions(IdentifierType id, org.springframework.data.domain.Pageable pageable)
Returns aPage
of revisions for the entity with the given id.org.springframework.data.domain.Page<Type>
list(int page, int size, org.springframework.data.domain.Sort sort)
List objects ofType
in the database, limited to some specific pageorg.springframework.data.domain.Page<Type>
list(int page, int size, org.springframework.data.domain.Sort.Direction order)
List objects ofType
in the database, limited to some specific page, ordered by calling thecompareTo
method on the class.org.springframework.data.domain.Page<Type>
list(int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperty)
List objects ofType
in the database, limited to some specific page.Type
read(IdentifierType id)
Read the object type by unique identifier.java.lang.Iterable<Type>
readMultiple(java.lang.Iterable<IdentifierType> idents)
Read multiple objects by the given collection of identifiersorg.springframework.data.domain.Page<Type>
search(org.springframework.data.jpa.domain.Specification<Type> specification, int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperties)
Search for an entity ofType
with a given specificationorg.springframework.data.domain.Page<Type>
search(org.springframework.data.jpa.domain.Specification<Type> specification, org.springframework.data.domain.Pageable pageRequest)
Search for an entity ofType
andPageRequest
Type
update(Type object)
Update an objectType
updateFields(IdentifierType id, java.util.Map<java.lang.String,java.lang.Object> updatedProperties)
Update properties of the given object by given fields.java.util.Collection<Type>
updateMultiple(java.util.Collection<Type> objects)
Update multiple objects at once
-
-
-
Method Detail
-
create
Type create(@Valid Type object) throws EntityExistsException, javax.validation.ConstraintViolationException
Create a new object in the persistence store.- 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:
EntityExistsException
- If the object being persisted violates uniqueness constraints in the database.javax.validation.ConstraintViolationException
- If the object being persisted cannot be validated by validation rules associated with the object.
-
read
Type read(IdentifierType id) throws EntityNotFoundException
Read the object type by unique identifier.- 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.
-
readMultiple
java.lang.Iterable<Type> readMultiple(java.lang.Iterable<IdentifierType> idents)
Read multiple objects by the given collection of identifiers- Parameters:
idents
- The unique identifiers of the objects to read- Returns:
- A collection of the requested objects
-
updateFields
Type updateFields(IdentifierType id, java.util.Map<java.lang.String,java.lang.Object> updatedProperties) throws EntityExistsException, EntityNotFoundException, javax.validation.ConstraintViolationException, InvalidPropertyException
Update properties of the given object by given fields. The object must have a valid identifier prior to being passed to this method.- Parameters:
id
- The identifier of the object to update.updatedProperties
- the object properties that should be updated.- Returns:
- The object as it was persisted in the database. May modify the identifier of the object when returned.
- Throws:
EntityExistsException
- If the object being persisted violates uniqueness constraints in the database.EntityNotFoundException
- If no object with the supplied identifier exists in the database.javax.validation.ConstraintViolationException
- If the object being persisted cannot be validated by validation rules associated with the object.InvalidPropertyException
- If the updated properties map contains a property name that does not exist on the domain model.
-
update
Type update(Type object) throws EntityNotFoundException, javax.validation.ConstraintViolationException
Update an object- Parameters:
object
- The object to update- Returns:
- The updated object
- Throws:
EntityNotFoundException
- If the entity being updated is not in the databasejavax.validation.ConstraintViolationException
- if the entity being updated contains constraint violations
-
updateMultiple
java.util.Collection<Type> updateMultiple(java.util.Collection<Type> objects) throws EntityNotFoundException, javax.validation.ConstraintViolationException
Update multiple objects at once- Parameters:
objects
- the objects to update- Returns:
- the updated objects
- Throws:
EntityNotFoundException
- if an entity being updated is not found in the databasejavax.validation.ConstraintViolationException
- if an entity being updated contains constraint violations
-
delete
void delete(IdentifierType id) throws EntityNotFoundException
Delete the object with the specified identifier from the database.- Parameters:
id
- The identifier of the object to delete.- Throws:
EntityNotFoundException
- If no object with the specified identifier exists in the database.
-
findAll
java.lang.Iterable<Type> findAll()
List all objects ofType
in the database.- Returns:
- All objects of the specified
Type
in the database.
-
list
org.springframework.data.domain.Page<Type> list(int page, int size, org.springframework.data.domain.Sort.Direction order, java.lang.String... sortProperty) throws java.lang.IllegalArgumentException
List objects ofType
in the database, limited to some specific page.- Parameters:
page
- the specific page to use.size
- the size of the pages used to compute the number of pages.sortProperty
- the properties used to sort the collection.order
- the order of the sort.- Returns:
- the list of users within the specified range.
- Throws:
java.lang.IllegalArgumentException
- If theType
has no public propertysortProperty
.
-
list
org.springframework.data.domain.Page<Type> list(int page, int size, org.springframework.data.domain.Sort sort)
List objects ofType
in the database, limited to some specific page- Parameters:
page
- the specific page to usesize
- the size of the pagessort
- ASort
object for ordering the results- Returns:
- a list of objects in the given range
-
list
org.springframework.data.domain.Page<Type> list(int page, int size, org.springframework.data.domain.Sort.Direction order)
List objects ofType
in the database, limited to some specific page, ordered by calling thecompareTo
method on the class.- Parameters:
page
- the specific page to use.size
- the size of the pages used to compute the number of pages.order
- the order of the sort.- Returns:
- the list of users within the specified range.
-
exists
java.lang.Boolean exists(IdentifierType id)
Check to see if an identifier forType
exists in the database.- Parameters:
id
- The identifier to check for.- Returns:
true
if the identifier exists,false
otherwise.
-
count
long count()
How many entities ofType
exist in the database?- Returns:
- the number of entities in the database.
-
search
org.springframework.data.domain.Page<Type> search(org.springframework.data.jpa.domain.Specification<Type> 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- 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
-
search
org.springframework.data.domain.Page<Type> search(org.springframework.data.jpa.domain.Specification<Type> specification, org.springframework.data.domain.Pageable pageRequest)
Search for an entity ofType
andPageRequest
- Parameters:
specification
- The searchSpecification
pageRequest
- ThePageRequest
- Returns:
- a
Page
ofType
-
findRevisions
org.springframework.data.history.Revisions<java.lang.Integer,Type> findRevisions(IdentifierType id)
Find all of the revisions for the specified identifier.- Parameters:
id
- the identifier to find revisions for.- Returns:
- the collection of revisions for the identifier.
-
findRevisions
org.springframework.data.domain.Page<org.springframework.data.history.Revision<java.lang.Integer,Type>> findRevisions(IdentifierType id, org.springframework.data.domain.Pageable pageable)
Returns aPage
of revisions for the entity with the given id.- Parameters:
id
- the identifier to find revisions for.pageable
- the page specification.- Returns:
- the page of revisions for the specified resource.
-
-