Interface SampleRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Sample,java.lang.Long>
,IridaJpaRepository<Sample,java.lang.Long>
,org.springframework.data.jpa.repository.JpaSpecificationExecutor<Sample>
,org.springframework.data.repository.PagingAndSortingRepository<Sample,java.lang.Long>
,org.springframework.data.repository.Repository<Sample,java.lang.Long>
,org.springframework.data.repository.history.RevisionRepository<Sample,java.lang.Long,java.lang.Integer>
,SampleRepositoryCustom
public interface SampleRepository extends IridaJpaRepository<Sample,java.lang.Long>, SampleRepositoryCustom
A repository for storing Sample objects
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<GenericStatModel>
countSamplesCreatedGrouped(java.util.Date createdDate, java.lang.String groupByFormat)
Get a list ofGenericStatModel
s for samples created in the past n time period and grouped by the format provided.java.lang.Long
countSamplesCreatedInTimePeriod(java.util.Date createdDate)
Get a count of allSample
s created within time periodorg.springframework.data.domain.Page<ProjectSampleJoin>
findSampleByNameInProject(Project project, java.util.List<java.lang.String> sampleNames, org.springframework.data.domain.Pageable pageable)
java.util.Set<Sample>
findSamplesForAnalysisSubmission(AnalysisSubmission analysisSubmission)
Get theSample
s associated with a givenAnalysisSubmission
Sample
getSampleBySampleName(Project p, java.lang.String sampleName)
Get aSample
with the given string sample name from a specific project.java.util.List<javax.persistence.Tuple>
getSampleIdsBySampleNameInProjects(java.util.List<java.lang.Long> projectIds, java.util.List<java.lang.String> sampleNames)
Get theSample
identifiers with the given list of sample names from a list of projects.java.util.List<Sample>
getSamplesForProjectShallow(Project project)
-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
-
Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, exists, findAll, findAll, findAll, findOne
-
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll, findAll
-
Methods inherited from interface org.springframework.data.repository.history.RevisionRepository
findLastChangeRevision, findRevision, findRevisions, findRevisions
-
Methods inherited from interface ca.corefacility.bioinformatics.irida.repositories.sample.SampleRepositoryCustom
updateSampleModifiedDate
-
-
-
-
Method Detail
-
getSamplesForProjectShallow
@EntityGraph(value="sampleOnly", type=FETCH) @Query("select j.sample from ProjectSampleJoin j where j.project = ?1") java.util.List<Sample> getSamplesForProjectShallow(Project project)
-
getSampleBySampleName
@Query("select j.sample from ProjectSampleJoin j where j.project = ?1 and j.sample.sampleName = ?2") Sample getSampleBySampleName(Project p, java.lang.String sampleName) throws EntityNotFoundException
Get aSample
with the given string sample name from a specific project.- Parameters:
p
- TheProject
that theSample
belongs to.sampleName
- The string sample name for a sample- Returns:
- The
Sample
for this identifier - Throws:
EntityNotFoundException
- if a sample with this identifier doesn't exist
-
getSampleIdsBySampleNameInProjects
@Query("select j.sample.sampleName, j.sample.id from ProjectSampleJoin j where j.project.id in ?1 and j.sample.sampleName in ?2") java.util.List<javax.persistence.Tuple> getSampleIdsBySampleNameInProjects(java.util.List<java.lang.Long> projectIds, java.util.List<java.lang.String> sampleNames) throws EntityNotFoundException
Get theSample
identifiers with the given list of sample names from a list of projects.- Parameters:
projectIds
- TheProject
identifiers that theSample
belongs to.sampleNames
- The list of sample names- Returns:
- A list of
Sample
identifiers - Throws:
EntityNotFoundException
- if a sample with this identifier doesn't exist
-
findSampleByNameInProject
@Query("select j from ProjectSampleJoin j where j.project = ?1 and j.sample.sampleName in ?2") org.springframework.data.domain.Page<ProjectSampleJoin> findSampleByNameInProject(Project project, java.util.List<java.lang.String> sampleNames, org.springframework.data.domain.Pageable pageable)
- Parameters:
project
- TheProject
that theSample
belongs to.sampleNames
- AList
ofString
sample namespageable
-Pageable
information about whichSample
s to retrun- Returns:
- The
Page
ofProjectSampleJoin
-
findSamplesForAnalysisSubmission
@Query("SELECT j.sample FROM SampleSequencingObjectJoin j WHERE ?1 in elements(j.sequencingObject.analysisSubmissions)") java.util.Set<Sample> findSamplesForAnalysisSubmission(AnalysisSubmission analysisSubmission)
Get theSample
s associated with a givenAnalysisSubmission
- Parameters:
analysisSubmission
- theAnalysisSubmission
.- Returns:
- the set of associated
Sample
s
-
countSamplesCreatedInTimePeriod
@Query("select count(s.id) from Sample s where s.createdDate >= ?1") java.lang.Long countSamplesCreatedInTimePeriod(java.util.Date createdDate)
Get a count of allSample
s created within time period- Parameters:
createdDate
- the minimum created date for samples- Returns:
- a count of
Sample
s
-
countSamplesCreatedGrouped
@Query("select new ca.corefacility.bioinformatics.irida.ria.web.admin.dto.statistics.GenericStatModel(function(\'date_format\', s.createdDate, ?2), count(s.id))from Sample s where s.createdDate >= ?1 group by function(\'date_format\', s.createdDate, ?2) order by function(\'date_format\', s.createdDate, ?2) asc") java.util.List<GenericStatModel> countSamplesCreatedGrouped(java.util.Date createdDate, java.lang.String groupByFormat)
Get a list ofGenericStatModel
s for samples created in the past n time period and grouped by the format provided.- Parameters:
createdDate
- The minimum created date for samplesgroupByFormat
- the format for which to group the results by- Returns:
- A list of
GenericStatModel
s
-
-