use of ca.corefacility.bioinformatics.irida.service.impl.processor.SequenceFileProcessorLauncher in project irida by phac-nml.
the class SequencingObjectServiceImpl method create.
/**
* {@inheritDoc}
*/
@Override
@Transactional
@PreAuthorize("hasAnyRole('ROLE_SEQUENCER', 'ROLE_USER')")
public SequencingObject create(SequencingObject object) throws ConstraintViolationException, EntityExistsException {
SequencingRun sequencingRun = object.getSequencingRun();
if (sequencingRun != null) {
if (object instanceof SingleEndSequenceFile && sequencingRun.getLayoutType() != LayoutType.SINGLE_END) {
throw new IllegalArgumentException("Attempting to add a single end file to a non single end run");
} else if (object instanceof SequenceFilePair && sequencingRun.getLayoutType() != LayoutType.PAIRED_END) {
throw new IllegalArgumentException("Attempting to add a paired end file to a non paired end run");
}
}
for (SequenceFile file : object.getFiles()) {
file = sequenceFileRepository.save(file);
}
SequencingObject so = super.create(object);
fileProcessingChainExecutor.execute(new SequenceFileProcessorLauncher(fileProcessingChain, so.getId(), SecurityContextHolder.getContext()));
return so;
}
Aggregations