Package ubic.gemma.persistence.service
Interface BaseReadOnlyService<O extends Identifiable>
-
- All Known Subinterfaces:
AnalysisResultSetService<K,O>,AnalysisService<T>,AnnotationAssociationService,ArrayDesignService,AuditTrailService,BaseImmutableService<O>,BaseService<O>,BaseVoEnabledService<O,VO>,BibliographicReferenceService,BioAssayDimensionService,BioAssayService,BioAssaySetService,BioMaterialService,BioSequenceService,BlacklistedEntityService,BlatAssociationService,BlatResultService,CharacteristicService,ChromosomeService,CoexpressionAnalysisService,CompositeSequenceService,CompoundService,ContactService,CuratableService<C,VO>,DatabaseEntryService,ubic.gemma.persistence.service.expression.bioAssayData.DesignElementDataVectorService<T>,DifferentialExpressionAnalysisService,DifferentialExpressionResultService,ExperimentalDesignService,ExperimentalFactorService,ExpressionAnalysisResultSetService,ExpressionExperimentService,ExpressionExperimentSetService,ExpressionExperimentSubSetService,ExternalDatabaseService,FactorValueService,FilteringService<O>,FilteringVoEnabledService<O,VO>,GeeqService,Gene2GOAssociationService,GeneDiffExMetaAnalysisService,GeneProductService,GeneService,GeneSetService,PhenotypeAssociationService,PrincipalComponentAnalysisService,ProcessedExpressionDataVectorService,ProtocolService,QuantitationTypeService,RawAndProcessedExpressionDataVectorService,RawExpressionDataVectorService,SingleExperimentAnalysisService<T>,TaxonService
- All Known Implementing Classes:
AbstractDesignElementDataVectorService,AbstractFilteringVoEnabledService,AbstractService,AbstractVoEnabledService,AnnotationAssociationServiceImpl,ArrayDesignServiceImpl,AuditTrailServiceImpl,BibliographicReferenceServiceImpl,BioAssayDimensionServiceImpl,BioAssayServiceImpl,BioAssaySetServiceImpl,BioMaterialServiceImpl,BioSequenceServiceImpl,BlacklistedEntityServiceImpl,BlatAssociationServiceImpl,BlatResultServiceImpl,CharacteristicServiceImpl,ChromosomeServiceImpl,CoexpressionAnalysisServiceImpl,CompositeSequenceServiceImpl,CompoundServiceImpl,ContactServiceImpl,DatabaseEntryServiceImpl,DifferentialExpressionAnalysisServiceImpl,DifferentialExpressionResultServiceImpl,ExperimentalDesignServiceImpl,ExperimentalFactorServiceImpl,ExpressionAnalysisResultSetServiceImpl,ExpressionExperimentServiceImpl,ExpressionExperimentSetServiceImpl,ExpressionExperimentSubSetServiceImpl,ExternalDatabaseServiceImpl,FactorValueServiceImpl,GeeqServiceImpl,Gene2GOAssociationServiceImpl,GeneDiffExMetaAnalysisServiceImpl,GeneProductServiceImpl,GeneServiceImpl,GeneSetServiceImpl,PhenotypeAssociationServiceImpl,PrincipalComponentAnalysisServiceImpl,ProcessedExpressionDataVectorServiceImpl,ProtocolServiceImpl,QuantitationTypeServiceImpl,RawAndProcessedExpressionDataVectorServiceImpl,RawExpressionDataVectorServiceImpl,TaxonServiceImpl
public interface BaseReadOnlyService<O extends Identifiable>Interface for read-only services.- Author:
- poirigui
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longcountAll()Ofind(O entity)Does a search for the entity in the persistent storageOfindOrFail(O entity)Does a search for the entity in the persistent storage, raising aNullPointerExceptionif not found.Class<? extends O>getElementClass()Oload(Long id)Loads object with given ID.Collection<O>load(Collection<Long> ids)Loads objects with given ids.Collection<O>loadAll()Loads all the entities of specific type.OloadOrFail(Long id)Convenience for runningload(Long)and checking if the result is null.<T extends Exception>
OloadOrFail(Long id, Function<String,T> exceptionSupplier)Load an entity or fail with the supplied exception; the message is generated automatically.<T extends Exception>
OloadOrFail(Long id, Function<String,T> exceptionSupplier, String message)Load an entity or fail with the supplied exception and message.<T extends Exception>
OloadOrFail(Long id, Supplier<T> exceptionSupplier)Load an entity or fail with the supplied exception.
-
-
-
Method Detail
-
find
@Nullable @CheckReturnValue O find(O entity)
Does a search for the entity in the persistent storage- Parameters:
entity- the entity to be searched for- Returns:
- the version of entity retrieved from the persistent storage, if found, otherwise null.
-
findOrFail
@Nonnull @CheckReturnValue O findOrFail(O entity) throws NullPointerException
Does a search for the entity in the persistent storage, raising aNullPointerExceptionif not found.- Parameters:
entity- the entity to be searched for- Returns:
- the version of entity retrieved from persistent storage
- Throws:
NullPointerException- if the entity is not found
-
load
Collection<O> load(Collection<Long> ids)
Loads objects with given ids.- Parameters:
ids- the ids of objects to be loaded.- Returns:
- collection containing object with given IDs.
-
load
@Nullable O load(Long id)
Loads object with given ID.- Parameters:
id- the ID of entity to be loaded.- Returns:
- the entity with matching ID, or null if the entity does not exist or if the passed ID was null
-
loadOrFail
@Nonnull O loadOrFail(Long id) throws NullPointerException
Convenience for runningload(Long)and checking if the result is null.- Parameters:
id- the ID used to retrieve the entity- Returns:
- the entity as per
load(Long), never null - Throws:
NullPointerException- if the entity does not exist in the persistent storage
-
loadOrFail
@Nonnull <T extends Exception> O loadOrFail(Long id, Supplier<T> exceptionSupplier) throws T extends Exception
Load an entity or fail with the supplied exception.- Throws:
T- if the entity does not exist in the persistent storageT extends Exception
-
loadOrFail
@Nonnull <T extends Exception> O loadOrFail(Long id, Function<String,T> exceptionSupplier) throws T extends Exception
Load an entity or fail with the supplied exception; the message is generated automatically.- Throws:
T- if the entity does not exist in the persistent storageT extends Exception
-
loadOrFail
@Nonnull <T extends Exception> O loadOrFail(Long id, Function<String,T> exceptionSupplier, String message) throws T extends Exception
Load an entity or fail with the supplied exception and message.- Throws:
T- if the entity does not exist in the persistent storageT extends Exception
-
loadAll
Collection<O> loadAll()
Loads all the entities of specific type.- Returns:
- collection of all entities currently available in the persistent storage.
-
countAll
long countAll()
-
-