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 ofSequencingObjectServiceusing aSequencingObjectRepositoryandSampleSequencingObjectJoinRepositoryto 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 SampleSequencingObjectJoinconcatenateSequences(java.util.List<SequencingObject> toJoin, java.lang.String filename, Sample targetSample, boolean removeOriginals)Concatenate a collection ofSequencingObjects and save back to aSampleSequencingObjectcreate(SequencingObject object)Create a new object in the persistence store.SampleSequencingObjectJoincreateSequencingObjectInSample(SequencingObject seqObject, Sample sample)Create a newSequencingObjectassociated with aSamplejava.lang.Booleanexists(java.lang.Long id)Check to see if an identifier forTypeexists in the database.java.util.Collection<SampleSequencingObjectJoin>getSequencesForSampleOfType(Sample sample, java.lang.Class<? extends SequencingObject> type)Get a collection ofSampleSequencingObjectJoins assocaited with a givenSampleand of the given class typejava.util.Set<SequencingObject>getSequencingObjectsForAnalysisSubmission(AnalysisSubmission submission)Get the set ofSequencingObjects associated with a givenAnalysisSubmissionjava.util.Collection<SampleSequencingObjectJoin>getSequencingObjectsForSample(Sample sample)Get all theSequencingObjects associate with a givenSamplejava.util.Set<SequencingObject>getSequencingObjectsForSequencingRun(SequencingRun sequencingRun)Get all theSequencingObjects associated with a givenSequencingRun<Type extends SequencingObject>
java.util.Set<Type>getSequencingObjectsOfTypeForAnalysisSubmission(AnalysisSubmission submission, java.lang.Class<Type> type)Get allSequencingObjects of a given type associated with anAnalysisSubmission<T extends SequencingObject>
java.util.Map<Sample,T>getUniqueSamplesForSequencingObjects(java.util.Set<T> sequenceFiles)Gets a map ofSequencingObjects and correspondingSamples.SequencingObjectread(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 identifiersSequencingObjectreadSequencingObjectForSample(Sample sample, java.lang.Long objectId)Read aSequencingObjectand verify that it belongs to a givenSample.SequencingObjectupdateRemoteStatus(java.lang.Long id, RemoteStatus remoteStatus)Update theRemoteStatusfor 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 EntityNotFoundExceptionRead the object type by unique identifier.- Specified by:
readin interfaceCRUDService<java.lang.Long,SequencingObject>- Overrides:
readin 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, EntityExistsExceptionCreate a new object in the persistence store.- Specified by:
createin interfaceCRUDService<java.lang.Long,SequencingObject>- Overrides:
createin 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 newSequencingObjectassociated with aSample- Specified by:
createSequencingObjectInSamplein interfaceSequencingObjectService- Parameters:
seqObject- TheSequencingObjectto createsample- theSampleto associate it with- Returns:
- a new
SampleSequencingObjectJoindescribing the relationship
-
getSequencingObjectsForSample
@PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_SEQUENCER\') or hasPermission(#sample, \'canReadSample\')") public java.util.Collection<SampleSequencingObjectJoin> getSequencingObjectsForSample(Sample sample)Get all theSequencingObjects associate with a givenSample- Specified by:
getSequencingObjectsForSamplein interfaceSequencingObjectService- Parameters:
sample- TheSampleto 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 ofSampleSequencingObjectJoins assocaited with a givenSampleand of the given class type- Specified by:
getSequencesForSampleOfTypein interfaceSequencingObjectService- Parameters:
sample- theSampleused in the jointype- The type ofSequencingObjectthat 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 aSequencingObjectand verify that it belongs to a givenSample.- Specified by:
readSequencingObjectForSamplein interfaceSequencingObjectService- Parameters:
sample- theSampleto get theSequencingObjectforobjectId- TheSequencingObjectID- Returns:
- A
SequencingObjectobject
-
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 DuplicateSampleExceptionGets a map ofSequencingObjects and correspondingSamples.- Specified by:
getUniqueSamplesForSequencingObjectsin interfaceSequencingObjectService- Type Parameters:
T- The type of sequencing object which should be returned- Parameters:
sequenceFiles- ASetofSequencingObjects.- Returns:
- A
Mapof betweenSampleandSequencingObject. - 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 theSequencingObjects associated with a givenSequencingRun- Specified by:
getSequencingObjectsForSequencingRunin 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:
readMultiplein interfaceCRUDService<java.lang.Long,SequencingObject>- Overrides:
readMultiplein 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 forTypeexists in the database.- Specified by:
existsin interfaceCRUDService<java.lang.Long,SequencingObject>- Overrides:
existsin classCRUDServiceImpl<java.lang.Long,SequencingObject>- Parameters:
id- The identifier to check for.- Returns:
trueif the identifier exists,falseotherwise.
-
updateRemoteStatus
@PreAuthorize("hasRole(\'ROLE_ADMIN\') or hasPermission(#id, \'canReadSequencingObject\')") public SequencingObject updateRemoteStatus(java.lang.Long id, RemoteStatus remoteStatus) throws javax.validation.ConstraintViolationException, EntityExistsException, InvalidPropertyExceptionUpdate theRemoteStatusfor aSequencingObject- Specified by:
updateRemoteStatusin interfaceSequencingObjectService- Parameters:
id- ID of the objet to updateremoteStatus- a RemoteStatus to set- Returns:
- the updated
SequencingObject - Throws:
javax.validation.ConstraintViolationExceptionEntityExistsExceptionInvalidPropertyException
-
getSequencingObjectsForAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") public java.util.Set<SequencingObject> getSequencingObjectsForAnalysisSubmission(AnalysisSubmission submission)Get the set ofSequencingObjects associated with a givenAnalysisSubmission- Specified by:
getSequencingObjectsForAnalysisSubmissionin interfaceSequencingObjectService- Parameters:
submission- theAnalysisSubmission- Returns:
- the associated
SequencingObjects
-
getSequencingObjectsOfTypeForAnalysisSubmission
@PreAuthorize("hasPermission(#submission, \'canReadAnalysisSubmission\')") public <Type extends SequencingObject> java.util.Set<Type> getSequencingObjectsOfTypeForAnalysisSubmission(AnalysisSubmission submission, java.lang.Class<Type> type)Get allSequencingObjects of a given type associated with anAnalysisSubmission- Specified by:
getSequencingObjectsOfTypeForAnalysisSubmissionin interfaceSequencingObjectService- Type Parameters:
Type- a class type extendingSequencingObject- Parameters:
submission- theAnalysisSubmissiontype- the class type ofSequencingObjectto 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 ConcatenateExceptionConcatenate a collection ofSequencingObjects and save back to aSample- Specified by:
concatenateSequencesin interfaceSequencingObjectService- Parameters:
toJoin- theSequencingObjects to concatenatefilename- The name of the file to create on concatenationtargetSample- theSampleto save toremoveOriginals- Whether to remove the originalSequencingObjects from the sample- Returns:
- the new
SampleSequencingObjectJoin - Throws:
ConcatenateException- if there was an error concatenating the sequences
-
-