@Test(expected = IllegalArgumentException.class) @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class) public void testRegisterSpeciesExists() { Species testSpecies = new Species(); testSpecies.setName(SPECIES_NAME); testSpecies.setVersion(SPECIES_VERSION); referenceGenomeManager.registerSpecies(testSpecies); referenceGenomeManager.registerSpecies(testSpecies); }
@Transactional(propagation = Propagation.REQUIRED) public Species registerSpecies(Species species) { Assert.isTrue(!StringUtils.isEmpty(species.getName())); Assert.isTrue(!StringUtils.isEmpty(species.getVersion())); Species registeredSpecies = speciesDao.loadSpeciesByVersion(species.getVersion()); Assert.isNull(registeredSpecies, getMessage(MessagesConstants.ERROR_SPECIES_EXISTS, species.getVersion())); return speciesDao.saveSpecies(species); }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Species registerSpecies(Species species) { Assert.isTrue(!StringUtils.isEmpty(species.getName())); Assert.isTrue(!StringUtils.isEmpty(species.getVersion())); Species registeredSpecies = speciesDao.loadSpeciesByVersion(species.getVersion()); Assert.isNull(registeredSpecies, getMessage(MessagesConstants.ERROR_SPECIES_EXISTS, species.getVersion())); return speciesDao.saveSpecies(species); } }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Species registerSpecies(Species species) { Assert.isTrue(!StringUtils.isEmpty(species.getName())); Assert.isTrue(!StringUtils.isEmpty(species.getVersion())); Species registeredSpecies = speciesDao.loadSpeciesByVersion(species.getVersion()); Assert.isNull(registeredSpecies, getMessage(MessagesConstants.ERROR_SPECIES_EXISTS, species.getVersion())); return speciesDao.saveSpecies(species); }  }
ReferenceGenomeManager implements SecuredEntityManager { @Transactional(propagation = Propagation.REQUIRED) public Species registerSpecies(Species species) { Assert.isTrue(!StringUtils.isEmpty(species.getName())); Assert.isTrue(!StringUtils.isEmpty(species.getVersion())); Species registeredSpecies = speciesDao.loadSpeciesByVersion(species.getVersion()); Assert.isNull(registeredSpecies, getMessage(MessagesConstants.ERROR_SPECIES_EXISTS, species.getVersion())); return speciesDao.saveSpecies(species); }  @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 Species registerSpecies(Species species) { Assert.isTrue(!StringUtils.isEmpty(species.getName())); Assert.isTrue(!StringUtils.isEmpty(species.getVersion())); Species registeredSpecies = speciesDao.loadSpeciesByVersion(species.getVersion()); Assert.isNull(registeredSpecies, getMessage(MessagesConstants.ERROR_SPECIES_EXISTS, species.getVersion())); return speciesDao.saveSpecies(species); }  @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();  }