Class SequencingObjectServiceImpl
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl<java.lang.Long,SequencingObject>
-
- ca.corefacility.bioinformatics.irida.service.impl.SequencingObjectServiceImpl
-
- All Implemented Interfaces:
CRUDService<java.lang.Long,SequencingObject>
,SequencingObjectService
@Service public class SequencingObjectServiceImpl extends CRUDServiceImpl<java.lang.Long,SequencingObject> implements SequencingObjectService
Implementation ofSequencingObjectService
using aSequencingObjectRepository
andSampleSequencingObjectJoinRepository
to persist and load objects.
-
-
Field Summary
-
Fields inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
CREATED_DATE_SORT_PROPERTY, validator, valueType
-
-
Constructor Summary
Constructors Constructor Description SequencingObjectServiceImpl(SequencingObjectRepository repository, SequenceFileRepository sequenceFileRepository, SampleSequencingObjectJoinRepository ssoRepository, SequenceConcatenationRepository concatenationRepository, javax.validation.Validator validator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SampleSequencingObjectJoin
concatenateSequences(java.util.List<SequencingObject> toJoin, java.lang.String filename, Sample targetSample, boolean removeOriginals)
Concatenate a collection ofSequencingObject
s and save back to aSample
SequencingObject
create(SequencingObject object)
Create a new object in the persistence store.SampleSequencingObjectJoin
createSequencingObjectInSample(SequencingObject seqObject, Sample sample)
Create a newSequencingObject
associated with aSample
java.lang.Boolean
exists(java.lang.Long id)
Check to see if an identifier forType
exists in the database.java.util.Collection<SampleSequencingObjectJoin>
getSequencesForSampleOfType(Sample sample, java.lang.Class<? extends SequencingObject> type)
Get a collection ofSampleSequencingObjectJoin
s assocaited with a givenSample
and of the given class typejava.util.Set<SequencingObject>
getSequencingObjectsForAnalysisSubmission(AnalysisSubmission submission)
Get the set ofSequencingObject
s associated with a givenAnalysisSubmission
java.util.Collection<SampleSequencingObjectJoin>
getSequencingObjectsForSample(Sample sample)
Get all theSequencingObject
s associate with a givenSample
java.util.Set<SequencingObject>
getSequencingObjectsForSequencingRun(SequencingRun sequencingRun)
Get all theSequencingObject
s associated with a givenSequencingRun
<Type extends SequencingObject>
java.util.Set<Type>getSequencingObjectsOfTypeForAnalysisSubmission(AnalysisSubmission submission, java.lang.Class<Type> type)
Get allSequencingObject
s of a given type associated with anAnalysisSubmission
<T extends SequencingObject>
java.util.Map<Sample,T>getUniqueSamplesForSequencingObjects(java.util.Set<T> sequenceFiles)
Gets a map ofSequencingObject
s and correspondingSample
s.SequencingObject
read(java.lang.Long id)
Read the object type by unique identifier.java.lang.Iterable<SequencingObject>
readMultiple(java.lang.Iterable<java.lang.Long> idents)
Read multiple objects by the given collection of identifiersSequencingObject
readSequencingObjectForSample(Sample sample, java.lang.Long objectId)
Read aSequencingObject
and verify that it belongs to a givenSample
.SequencingObject
updateRemoteStatus(java.lang.Long id, RemoteStatus remoteStatus)
Update theRemoteStatus
for aSequencingObject
-
Methods inherited from class ca.corefacility.bioinformatics.irida.service.impl.CRUDServiceImpl
count, delete, findAll, findRevisions, findRevisions, list, list, list, search, 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, delete, findAll, findRevisions, findRevisions, list, list, list, search, search, update, updateFields, updateMultiple
-
-
-
-
Constructor Detail
-
SequencingObjectServiceImpl
@Autowired public SequencingObjectServiceImpl(SequencingObjectRepository repository, SequenceFileRepository sequenceFileRepository, SampleSequencingObjectJoinRepository ssoRepository, SequenceConcatenationRepository concatenationRepository, javax.validation.Validator validator)
-
-
Method Detail
-
read
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\',\'ROLE_SEQUENCER\', \'ROLE_TECHNICIAN\') or hasPermission(#id, \'canReadSequencingObject\')") public SequencingObject read(java.lang.Long id) throws EntityNotFoundException
Read the object type by unique identifier.- Specified by:
read
in interfaceCRUDService<java.lang.Long,SequencingObject>
- Overrides:
read
in classCRUDServiceImpl<java.lang.Long,SequencingObject>
- 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.
-
create
@Transactional @PreAuthorize("hasAnyRole(\'ROLE_SEQUENCER\', \'ROLE_USER\')") public SequencingObject create(SequencingObject object) throws javax.validation.ConstraintViolationException, EntityExistsException
Create a new object in the persistence store.- Specified by:
create
in interfaceCRUDService<java.lang.Long,SequencingObject>
- Overrides:
create
in classCRUDServiceImpl<java.lang.Long,SequencingObject>
- 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.
-
createSequencingObjectInSample
@Transactional @PreAuthorize("hasPermission(#sample, \'canUpdateSample\')") public SampleSequencingObjectJoin createSequencingObjectInSample(SequencingObject seqObject, Sample sample)
Create a newSequencingObject
associated with aSample
- Specified by:
createSequencingObjectInSample
in interfaceSequencingObjectService
- Parameters:
seqObject
- TheSequencingObject
to createsample
- theSample
to associate it with- Returns:
- a new
SampleSequencingObjectJoin
describing the relationship
-
getSequencingObjectsForSample
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#sample, \'canReadSample\')") public java.util.Collection<SampleSequencingObjectJoin> getSequencingObjectsForSample(Sample sample)
Get all theSequencingObject
s associate with a givenSample
- Specified by:
getSequencingObjectsForSample
in interfaceSequencingObjectService
- Parameters:
sample
- TheSample
to get sequences for- Returns:
- A collection of
SampleSequencingObjectJoin
-
getSequencesForSampleOfType
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#sample, \'canReadSample\')") public java.util.Collection<SampleSequencingObjectJoin> getSequencesForSampleOfType(Sample sample, java.lang.Class<? extends SequencingObject> type)
Get a collection ofSampleSequencingObjectJoin
s assocaited with a givenSample
and of the given class type- Specified by:
getSequencesForSampleOfType
in interfaceSequencingObjectService
- Parameters:
sample
- theSample
used in the jointype
- The type ofSequencingObject
that must be in the join- Returns:
- a Collection of
SampleSequencingObjectJoin
-
readSequencingObjectForSample
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#sample, \'canReadSample\')") public SequencingObject readSequencingObjectForSample(Sample sample, java.lang.Long objectId)
Read aSequencingObject
and verify that it belongs to a givenSample
.- Specified by:
readSequencingObjectForSample
in interfaceSequencingObjectService
- Parameters:
sample
- theSample
to get theSequencingObject
forobjectId
- TheSequencingObject
ID- Returns:
- A
SequencingObject
object
-
getUniqueSamplesForSequencingObjects
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\') or hasPermission(#sequenceFiles, \'canReadSequencingObject\')") public <T extends SequencingObject> java.util.Map<Sample,T> getUniqueSamplesForSequencingObjects(java.util.Set<T> sequenceFiles) throws DuplicateSampleException
Gets a map ofSequencingObject
s and correspondingSample
s.- Specified by:
getUniqueSamplesForSequencingObjects
in interfaceSequencingObjectService
- Type Parameters:
T
- The type of sequencing object which should be returned- Parameters:
sequenceFiles
- ASet
ofSequencingObject
s.- Returns:
- A
Map
of betweenSample
andSequencingObject
. - Throws:
DuplicateSampleException
- If there is a duplicate sample.
-
getSequencingObjectsForSequencingRun
@Transactional(readOnly=true) @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\', \'ROLE_TECHNICIAN\')") public java.util.Set<SequencingObject> getSequencingObjectsForSequencingRun(SequencingRun sequencingRun)
Get all theSequencingObject
s associated with a givenSequencingRun
- Specified by:
getSequencingObjectsForSequencingRun
in interfaceSequencingObjectService
- Parameters:
sequencingRun
- the run to get objects for- Returns:
- a set of
SequencingObject
-
readMultiple
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#idents, \'canReadSequencingObject\')") public java.lang.Iterable<SequencingObject> readMultiple(java.lang.Iterable<java.lang.Long> idents)
Read multiple objects by the given collection of identifiers- Specified by:
readMultiple
in interfaceCRUDService<java.lang.Long,SequencingObject>
- Overrides:
readMultiple
in classCRUDServiceImpl<java.lang.Long,SequencingObject>
- Parameters:
idents
- The unique identifiers of the objects to read- Returns:
- A collection of the requested objects
-
exists
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#id, \'canReadSequencingObject\')") public java.lang.Boolean exists(java.lang.Long id)
Check to see if an identifier forType
exists in the database.- Specified by:
exists
in interfaceCRUDService<java.lang.Long,SequencingObject>
- Overrides:
exists
in classCRUDServiceImpl<java.lang.Long,SequencingObject>
- Parameters:
id
- The identifier to check for.- Returns:
true
if the identifier exists,false
otherwise.
-
updateRemoteStatus
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#id, \'canReadSequencingObject\')") public SequencingObject updateRemoteStatus(java.lang.Long id, RemoteStatus remoteStatus) throws javax.validation.ConstraintViolationException, EntityExistsException, InvalidPropertyException
Update theRemoteStatus
for aSequencingObject
- Specified by:
updateRemoteStatus
in interfaceSequencingObjectService
- Parameters:
id
- ID of the objet to updateremoteStatus
- a RemoteStatus to set- Returns:
- the updated
SequencingObject
- Throws:
javax.validation.ConstraintViolationException
EntityExistsException
InvalidPropertyException
-
getSequencingObjectsForAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") public java.util.Set<SequencingObject> getSequencingObjectsForAnalysisSubmission(AnalysisSubmission submission)
Get the set ofSequencingObject
s associated with a givenAnalysisSubmission
- Specified by:
getSequencingObjectsForAnalysisSubmission
in interfaceSequencingObjectService
- Parameters:
submission
- theAnalysisSubmission
- Returns:
- the associated
SequencingObject
s
-
getSequencingObjectsOfTypeForAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") public <Type extends SequencingObject> java.util.Set<Type> getSequencingObjectsOfTypeForAnalysisSubmission(AnalysisSubmission submission, java.lang.Class<Type> type)
Get allSequencingObject
s of a given type associated with anAnalysisSubmission
- Specified by:
getSequencingObjectsOfTypeForAnalysisSubmission
in interfaceSequencingObjectService
- Type Parameters:
Type
- a class type extendingSequencingObject
- Parameters:
submission
- theAnalysisSubmission
type
- the class type ofSequencingObject
to return- Returns:
- a set of the requested type
-
concatenateSequences
@PreAuthorize("hasPermission(#toJoin, \'canReadSequencingObject\') and hasPermission(#targetSample, \'canUpdateSample\')") @Transactional public SampleSequencingObjectJoin concatenateSequences(java.util.List<SequencingObject> toJoin, java.lang.String filename, Sample targetSample, boolean removeOriginals) throws ConcatenateException
Concatenate a collection ofSequencingObject
s and save back to aSample
- Specified by:
concatenateSequences
in interfaceSequencingObjectService
- Parameters:
toJoin
- theSequencingObject
s to concatenatefilename
- The name of the file to create on concatenationtargetSample
- theSample
to save toremoveOriginals
- Whether to remove the originalSequencingObject
s from the sample- Returns:
- the new
SampleSequencingObjectJoin
- Throws:
ConcatenateException
- if there was an error concatenating the sequences
-
-