@Test(expected = IllegalArgumentException.class) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void testUpdateSpeciesWrongReferenceId() { referenceGenomeManager.updateSpecies(1L, "testVersion"); }
@Transactional(propagation = Propagation.REQUIRED) public Reference updateSpecies(long referenceId, String speciesVersion) { final Reference reference = referenceGenomeDao.loadReferenceGenome(referenceId); Assert.notNull(reference, getMessage(MessageCode.NO_SUCH_REFERENCE)); if (speciesVersion != null) { final Species species = speciesDao.loadSpeciesByVersion(speciesVersion); Assert.notNull(species, getMessage(MessageCode.NO_SUCH_SPECIES, speciesVersion)); } referenceGenomeDao.updateSpecies(referenceId, speciesVersion); return load(referenceId); }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Reference updateSpecies(long referenceId, String speciesVersion) { final Reference reference = referenceGenomeDao.loadReferenceGenome(referenceId); Assert.notNull(reference, getMessage(MessageCode.NO_SUCH_REFERENCE)); if (speciesVersion != null) { final Species species = speciesDao.loadSpeciesByVersion(speciesVersion); Assert.notNull(species, getMessage(MessageCode.NO_SUCH_SPECIES, speciesVersion)); } referenceGenomeDao.updateSpecies(referenceId, speciesVersion); return load(referenceId); } }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Reference updateSpecies(long referenceId, String speciesVersion) { final Reference reference = referenceGenomeDao.loadReferenceGenome(referenceId); Assert.notNull(reference, getMessage(MessageCode.NO_SUCH_REFERENCE)); if (speciesVersion != null) { final Species species = speciesDao.loadSpeciesByVersion(speciesVersion); Assert.notNull(species, getMessage(MessageCode.NO_SUCH_SPECIES, speciesVersion)); } referenceGenomeDao.updateSpecies(referenceId, speciesVersion); return load(referenceId); }  }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Reference updateSpecies(long referenceId, String speciesVersion) { final Reference reference = referenceGenomeDao.loadReferenceGenome(referenceId); Assert.notNull(reference, getMessage(MessageCode.NO_SUCH_REFERENCE)); if (speciesVersion != null) { final Species species = speciesDao.loadSpeciesByVersion(speciesVersion); Assert.notNull(species, getMessage(MessageCode.NO_SUCH_SPECIES, speciesVersion)); } referenceGenomeDao.updateSpecies(referenceId, speciesVersion); return load(referenceId); }  @Transactional(propagation = Propagation.REQUIRED) Long createReferenceId(); @Transactional(propagation = Propagation.REQUIRED) Reference create(final Reference reference); @Transactional(propagation = Propagation.REQUIRED) void delete(final Reference reference); @Transactional(propagation = Propagation.REQUIRED) Reference load(final Long referenceId); @Transactional(propagation = Propagation.REQUIRED) Reference loadReferenceGenomeByBioItemId(final Long dataItemId); @Transactional(propagation = Propagation.SUPPORTS) List<Reference> loadAllReferenceGenomes(); @Transactional(propagation = Propagation.REQUIRED) List<Reference> loadAllReferenceGenomes(String referenceName); @Transactional(propagation = Propagation.SUPPORTS) Chromosome loadChromosome(final Long chromosomeId); @Transactional(propagation = Propagation.SUPPORTS) List<Chromosome> loadChromosomes(final Long referenceId); @Transactional(propagation = Propagation.SUPPORTS) List<BaseEntity> loadAllFile(final Long referenceId); @Transactional(propagation = Propagation.SUPPORTS) Reference getOnlyReference(final Long referenceId); @Transactional(propagation = Propagation.REQUIRED) Reference updateReferenceGeneFileId(long referenceId, Long geneFileId); @Transactional(propagation = Propagation.REQUIRED) Reference updateSpecies(long referenceId, String speciesVersion); @Transactional(propagation = Propagation.SUPPORTS) boolean isRegistered(Long id); @Transactional(propagation = Propagation.REQUIRED) List<BiologicalDataItem> getReferenceAnnotationFiles(Long referenceId); @Transactional(propagation = Propagation.REQUIRED) Reference updateReferenceAnnotationFile(Long referenceId, Long annotationFileBiologicalItemId,
                                                   Boolean remove); @Transactional(propagation = Propagation.REQUIRED) Species registerSpecies(Species species); @Transactional(propagation = Propagation.SUPPORTS) List<Species> loadAllSpecies(); @Transactional(propagation = Propagation.SUPPORTS) Species loadSpeciesByVersion(String version); @Transactional(propagation = Propagation.REQUIRED) Species unregisterSpecies(String speciesVersion); @Override @Transactional(propagation = Propagation.REQUIRED) AbstractSecuredEntity changeOwner(Long id, String owner); @Override AclClass getSupportedClass(); }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Reference updateSpecies(long referenceId, String speciesVersion) { final Reference reference = referenceGenomeDao.loadReferenceGenome(referenceId); Assert.notNull(reference, getMessage(MessageCode.NO_SUCH_REFERENCE)); if (speciesVersion != null) { final Species species = speciesDao.loadSpeciesByVersion(speciesVersion); Assert.notNull(species, getMessage(MessageCode.NO_SUCH_SPECIES, speciesVersion)); } referenceGenomeDao.updateSpecies(referenceId, speciesVersion); return load(referenceId); }  @Transactional(propagation = Propagation.REQUIRED) Long createReferenceId(); @Transactional(propagation = Propagation.REQUIRED) Reference create(final Reference reference); @Transactional(propagation = Propagation.REQUIRED) void delete(final Reference reference); @Transactional(propagation = Propagation.REQUIRED) Reference load(final Long referenceId); @Transactional(propagation = Propagation.REQUIRED) Reference loadReferenceGenomeByBioItemId(final Long dataItemId); @Transactional(propagation = Propagation.SUPPORTS) List<Reference> loadAllReferenceGenomes(); @Transactional(propagation = Propagation.REQUIRED) List<Reference> loadAllReferenceGenomes(String referenceName); @Transactional(propagation = Propagation.SUPPORTS) Chromosome loadChromosome(final Long chromosomeId); @Transactional(propagation = Propagation.SUPPORTS) List<Chromosome> loadChromosomes(final Long referenceId); @Transactional(propagation = Propagation.SUPPORTS) List<BaseEntity> loadAllFile(final Long referenceId); @Transactional(propagation = Propagation.SUPPORTS) Reference getOnlyReference(final Long referenceId); @Transactional(propagation = Propagation.REQUIRED) Reference updateReferenceGeneFileId(long referenceId, Long geneFileId); @Transactional(propagation = Propagation.REQUIRED) Reference updateSpecies(long referenceId, String speciesVersion); @Transactional(propagation = Propagation.SUPPORTS) boolean isRegistered(Long id); @Transactional(propagation = Propagation.REQUIRED) List<BiologicalDataItem> getReferenceAnnotationFiles(Long referenceId); @Transactional(propagation = Propagation.REQUIRED) Reference updateReferenceAnnotationFile(Long referenceId, Long annotationFileBiologicalItemId,
                                                   Boolean remove); @Transactional(propagation = Propagation.REQUIRED) Species registerSpecies(Species species); @Transactional(propagation = Propagation.SUPPORTS) List<Species> loadAllSpecies(); @Transactional(propagation = Propagation.SUPPORTS) Species loadSpeciesByVersion(String version); @Transactional(propagation = Propagation.REQUIRED) Species unregisterSpecies(String speciesVersion); @Override @Transactional(propagation = Propagation.REQUIRED) AbstractSecuredEntity changeOwner(Long id, String owner); @Override AclClass getSupportedClass();  }