Java Code Examples for org.springframework.transaction.annotation.Propagation

The following are top voted examples for showing how to use org.springframework.transaction.annotation.Propagation. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Equella   File: BookmarkDaoImpl.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
@Transactional(propagation = Propagation.MANDATORY)
public Map<Item, Bookmark> getBookmarksForItems(Collection<Item> items, String userId)
{
	if( items.isEmpty() )
	{
		return Collections.emptyMap();
	}

	final List<Bookmark> bs = getHibernateTemplate().findByNamedParam(
		"FROM Bookmark b WHERE b.item IN (:items) and b.owner = :ownerId", new String[]{"items", "ownerId"},
		new Object[]{items, userId});

	final Map<Item, Bookmark> rv = new HashMap<Item, Bookmark>();
	for( Bookmark b : bs )
	{
		rv.put(b.getItem(), b);
	}
	return rv;
}
 
Example 2
Project: Equella   File: AbstractEntityServiceImpl.java   Source Code and License 6 votes vote down vote up
/**
 * For REST calls or anything not using some sort of "session"
 * 
 * @param entity
 */
@Transactional(propagation = Propagation.REQUIRED)
@Override
public void save(T entity, @Nullable TargetList targetList, @Nullable Map<Object, TargetList> otherTargetLists,
	@Nullable String stagingUuid, @Nullable String lockId, boolean keepLocked) throws LockedException
{
	if( entity.getId() == 0 )
	{
		final EntityPack<T> pack = new EntityPack<T>(entity, stagingUuid);
		pack.setTargetList(targetList);
		pack.setOtherTargetLists(otherTargetLists);
		doAdd(pack, null, keepLocked);
	}
	else
	{
		doStopEditWithLock(entity, targetList, otherTargetLists, stagingUuid, lockId, !keepLocked);
	}
}
 
Example 3
Project: OMIPlatform   File: UserRelationController.java   Source Code and License 6 votes vote down vote up
@RequestMapping("/modifyRelation")
@Transactional(propagation = Propagation.REQUIRED)
public Message modifyRelation(@RequestBody List<UserRelation> relations) {
    Message message = new Message();
    if (relations != null && relations.size() > 0) {
        try {
            for (int i = 0; i < relations.size(); i++) {
                if (relations.get(i).getUrid() != null) {
                    this.userRelationService.update(relations.get(i));
                } else {

                    this.userRelationService.insert(relations.get(i));
                }
            }
        } catch (Exception excption) {
            excption.printStackTrace();
            return message;
        }
    }
    message.setStatus(1);
    return message;
}
 
Example 4
Project: dhus-core   File: SystemService.java   Source Code and License 6 votes vote down vote up
@PreAuthorize ("hasRole('ROLE_SYSTEM_MANAGER')")
@Transactional (readOnly=false, propagation=Propagation.REQUIRED)
public Configuration saveSystemSettings (Configuration cfg) throws
      IllegalArgumentException, IllegalAccessException,
      InvocationTargetException, CloneNotSupportedException
{
   Configuration db_cfg = cfgDao.getCurrentConfiguration ();
   cfg = cfg.completeWith (db_cfg);
   db_cfg.setCronConfiguration (cfg.getCronConfiguration ());
   db_cfg.setGuiConfiguration (cfg.getGuiConfiguration ());
   db_cfg.setMessagingConfiguration (cfg.getMessagingConfiguration ());
   db_cfg.setNetworkConfiguration (cfg.getNetworkConfiguration ());
   db_cfg.setProductConfiguration (cfg.getProductConfiguration ());
   db_cfg.setSearchConfiguration (cfg.getSearchConfiguration ());
   db_cfg.setServerConfiguration (cfg.getServerConfiguration ());
   db_cfg.setSystemConfiguration (cfg.getSystemConfiguration ());
   cfgDao.update (db_cfg);
   return cfgDao.getCurrentConfiguration ();
}
 
Example 5
Project: NGB-master   File: DaoHelper.java   Source Code and License 6 votes vote down vote up
@Transactional(propagation = Propagation.MANDATORY)
public Long createTempList(final Long listId, final Collection<? extends BaseEntity> list) {
    Assert.notNull(listId);
    Assert.isTrue(CollectionUtils.isNotEmpty(list));
    // creates a new local temporary table if it doesn't exists to handle temporary lists
    getJdbcTemplate().update(createTemporaryListQuery);
    // fills in a temporary list by given values
    int i = 0;
    final Iterator<? extends BaseEntity> iterator = list.iterator();
    final MapSqlParameterSource[] batchArgs = new MapSqlParameterSource[list.size()];
    while (iterator.hasNext()) {
        MapSqlParameterSource params = new MapSqlParameterSource();
        params.addValue(HelperParameters.LIST_ID.name(), listId);
        params.addValue(HelperParameters.LIST_VALUE.name(), iterator.next().getId());
        batchArgs[i] = params;
        i++;
    }
    getNamedParameterJdbcTemplate().batchUpdate(insertTemporaryListItemQuery, batchArgs);
    return listId;
}
 
Example 6
Project: dhus-core   File: UserService.java   Source Code and License 6 votes vote down vote up
@Transactional (readOnly=false, propagation=Propagation.REQUIRED)
@Caching (evict = {
   @CacheEvict(value = "user", allEntries = true),
   @CacheEvict(value = "userByName", allEntries = true)})
public void resetPassword(String code, String new_password)
   throws RootNotModifiableException, RequiredFieldMissingException, 
      EmailNotSentException
{
   User u = userDao.getUserFromUserCode (code);
   if (u == null)
   {
      throw new UserNotExistingException ();
   }
   checkRoot (u);

   u.setPassword (new_password);

   checkRequiredFields (u);
   userDao.update (u);
}
 
Example 7
Project: NGB-master   File: VcfFileDao.java   Source Code and License 6 votes vote down vote up
/**
 * Load sample metadata from the database for all files, corresponding the given reference ID.
 *
 * @param vcfFileId {@code long} reference ID for which files samples were saved.
 * @return {@code Map&lt;Long, List&lt;Sample&gt;&gt;} with file IDs for giver reference ID as keys, and with
 * lists of samples, corresponding this file IDs as values.
 */
@Transactional(propagation = Propagation.MANDATORY)
public Map<Long, List<VcfSample>> loadSamplesForFilesByReference(long vcfFileId) {
    Map<Long, List<VcfSample>> sampleFileMap = new HashMap<>();

    getJdbcTemplate().query(loadSamplesForFilesByReferenceIdQuery, rs -> {
        Long fileId = rs.getLong(SampleParameters.VCF_ID.name());
        if (!sampleFileMap.containsKey(fileId)) {
            sampleFileMap.put(fileId, new ArrayList<>());
        }

        VcfSample sample = new VcfSample();

        sample.setId(rs.getLong(SampleParameters.VCF_SAMPLE_ID.name()));
        sample.setName(rs.getString(SampleParameters.SAMPLE_NAME.name()));
        sample.setIndex(rs.getInt(SampleParameters.ORDER_INDEX.name()));

        sampleFileMap.get(fileId).add(sample);
    }, vcfFileId);

    return sampleFileMap;
}
 
Example 8
Project: Equella   File: AclDaoImpl.java   Source Code and License 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.MANDATORY)
public List<ACLEntryMapping> getAllEntries(final Collection<String> privileges, Collection<String> targets)
{
	return getHibernateTemplate().executeFind(new CollectionPartitioner<String, ACLEntryMapping>(targets)
	{
		@Override
		public List<ACLEntryMapping> doQuery(Session session, Collection<String> collection)
		{
			Query query = session.getNamedQuery("getAllEntries");
			query.setParameter("institution", CurrentInstitution.get());
			query.setParameterList("targets", collection);
			query.setParameterList("privileges", privileges);
			return query.list();
		}
	});
}
 
Example 9
Project: NGB-master   File: ToolsControllerTest.java   Source Code and License 6 votes vote down vote up
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void specifiedSortedFileShouldBeCreated() throws Exception {
    File tempDirectory = getTempDirectory();

    File toBeSorted = context.getResource("classpath:templates/" + UNSORTED_BED_NAME).getFile();
    File copiedToBeSorted = new File(tempDirectory, UNSORTED_BED_NAME);
    Files.copy(toBeSorted.toPath(), copiedToBeSorted.toPath());

    File sortedPath = new File(tempDirectory, SPECIFIED_BED_NAME);

    FeatureFileSortRequest request = new FeatureFileSortRequest();
    request.setOriginalFilePath(copiedToBeSorted.getAbsolutePath());
    request.setSortedFilePath(sortedPath.getAbsolutePath());

    assertSortRequest(request, new Equals(sortedPath.getAbsolutePath()));
}
 
Example 10
Project: NGB-master   File: BiologicalDataItemDao.java   Source Code and License 6 votes vote down vote up
/**
 * Loads a List of BiologicalDataItem from the database by their IDs
 * @param ids List of IDs of BiologicalDataItem instances
 * @return List of BiologicalDataItem, matching specified IDs
 */
@Transactional(propagation = Propagation.MANDATORY)
public List<BiologicalDataItem> loadBiologicalDataItemsByIds(List<Long> ids) {
    if (ids == null || ids.isEmpty()) {
        return Collections.emptyList();
    }

    Long listId = daoHelper.createTempLongList(ids);

    final MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue(BiologicalDataItemParameters.BIO_DATA_ITEM_ID.name(), listId);

    List<BiologicalDataItem> items = getNamedParameterJdbcTemplate().query(loadBiologicalDataItemsByIdsQuery,
            params, getRowMapper());

    daoHelper.clearTempList(listId);

    return items;
}
 
Example 11
Project: xproject   File: AdminResourceServiceImpl.java   Source Code and License 6 votes vote down vote up
@Transactional(rollbackFor=Exception.class, propagation=Propagation.REQUIRED)
public void updateResource(AdminResource resource) {
	ValidationAssert.notNull(resource, "参数不能为空!");
	ValidationAssert.notNull(resource.getResourceId(), "资源id不能为空!");
	resource.setPermissionExpression(StringUtils.defaultIfEmpty(resource.getPermissionExpression(), null));
	resource.setResourceUrl(StringUtils.defaultIfEmpty(resource.getResourceUrl(), null));
	AdminResource presource = adminResourceMapper.selectThinResourceById(resource.getResourceId(), true);
	ValidationAssert.notNull(presource, "该资源已经不存在了!");
	try {
		adminResourceMapper.updateResource(resource);
	} catch(DuplicateKeyException e) {
		BusinessAssert.isTrue(!e.getCause().getMessage().toUpperCase().contains("RESOURCE_NAME"), "修改资源失败,该资源名称已经存在!");
		BusinessAssert.isTrue(!e.getCause().getMessage().toUpperCase().contains("PERMISSION_EXPRESSION"), "修改资源失败,该权限表达式已经存在!");
		throw e;
	}
}
 
Example 12
Project: Equella   File: HierarchyServiceImpl.java   Source Code and License 6 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED)
@SecureOnCall(priv = "MODIFY_KEY_RESOURCE")
public void addKeyResource(HierarchyTreeNode node, ItemKey itemId)
{
	final HierarchyTopic topic = getHierarchyTopic(node.getId());
	final Item item = itemService.get(itemId);

	List<Item> list = topic.getKeyResources();
	if( list == null )
	{
		list = new ArrayList<Item>();
		topic.setKeyResources(list);
	}

	if( !list.contains(item) )
	{
		list.add(item);
	}

	dao.saveOrUpdate(topic);
}
 
Example 13
Project: Equella   File: EntityLockingServiceImpl.java   Source Code and License 6 votes vote down vote up
@Override
@Transactional(propagation = Propagation.MANDATORY)
public EntityLock getLock(BaseEntity entity, String lockId)
{
	EntityLock lock = entityLockDao.findByCriteria(Restrictions.eq("entity", entity));
	if( lock != null )
	{
		if( lockId == null )
		{
			throw new LockedException("Entity is locked by another user '" + lock.getUserID() + "'",
				lock.getUserID(), lock.getUserSession(), entity.getId());
		}
		if( !lockId.equals(lock.getUserSession()) )
		{
			throw new LockedException("Wrong lock id. Entity is locked by user.", lock.getUserID(),
				lock.getUserSession(), entity.getId());
		}
	}
	else if( lockId != null )
	{
		throw new LockedException("Entity is not locked", null, null, entity.getId());
	}
	return lock;
}
 
Example 14
Project: Equella   File: NotificationDaoImpl.java   Source Code and License 6 votes vote down vote up
@Override
@Transactional(propagation = Propagation.MANDATORY)
public int markProcessedById(final String user, final Collection<Long> notifications, final String attemptId)
{
	if( notifications.isEmpty() )
	{
		return 0;
	}
	return (Integer) getHibernateTemplate().execute(new HibernateCallback()
	{
		@Override
		public Object doInHibernate(Session session)
		{
			Query query = session.createQuery("update Notification set processed = true "
					+ "where institution = :inst and userTo = :user and processed = false "
					+ "and id in (:noteid) and attemptId = :attempt");
			query.setParameter(ATTEMPT, attemptId);
			query.setParameterList(NOTEID, notifications);
			query.setParameter(USER, user);
			query.setParameter(INST, CurrentInstitution.get());
			return query.executeUpdate();
		}
	});
}
 
Example 15
Project: dhus-core   File: CollectionService.java   Source Code and License 6 votes vote down vote up
@PreAuthorize ("hasRole('ROLE_DATA_MANAGER')")
@Transactional (readOnly=false, propagation=Propagation.REQUIRED)
@CacheEvict (value = "products", allEntries = true)
public void removeProducts (String uuid, Long[] pids)
{
   collectionDao.removeProducts (uuid, pids, null);
   long start = new Date ().getTime ();
   for (Long pid: pids)
   {
      try
      {
         searchService.index(productDao.read(pid));
      }
      catch (Exception e)
      {
         throw new RuntimeException("Cannot update Solr index", e);
      }
   }
   long end = new Date ().getTime ();
   LOGGER.info("[SOLR] Remove " + pids.length +
      " product(s) from collection spent " + (end-start) + "ms" );
}
 
Example 16
Project: Equella   File: TLEGroupServiceImpl.java   Source Code and License 6 votes vote down vote up
@RequiresPrivilege(priv = "EDIT_USER_MANAGEMENT")
@Transactional(propagation = Propagation.REQUIRED)
public void delete(TLEGroup group, boolean deleteChildren)
{
	TLEGroup parent = group.getParent();

	if( !deleteChildren )
	{
		// Move children up to same level as group we're deleting
		for( TLEGroup child : getGroupsInGroup(group) )
		{
			child.setParent(parent);
			updateGroup(child);
			dao.update(child);
		}
	}

	dao.delete(group);
	eventService.publishApplicationEvent(new GroupDeletedEvent(group.getUuid()));
}
 
Example 17
Project: dhus-core   File: ProductService.java   Source Code and License 6 votes vote down vote up
@PreAuthorize ("hasAnyRole('ROLE_DOWNLOAD','ROLE_SEARCH')")
@Transactional (readOnly=true, propagation=Propagation.REQUIRED)
public InputStream getProductThumbnail (Long id)
{
   // TODO remove method cause not used
   Product product = getProduct (id);
   if (!product.getThumbnailFlag ()) return null;
   try
   {
      return new FileInputStream (product.getThumbnailPath ());
   }
   catch (Exception e)
   {
      LOGGER.warn ("Cannot retrieve Thumbnail from product id #" + id,e);
   }
   return null;
}
 
Example 18
Project: Equella   File: TLEGroupServiceImpl.java   Source Code and License 6 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED)
public void userIdChangedEvent(UserIdChangedEvent event)
{
	String fromUserId = event.getFromUserId();

	for( TLEGroup group : dao.getGroupsContainingUser(fromUserId) )
	{
		Set<String> users = group.getUsers();
		users.remove(fromUserId);
		users.add(event.getToUserId());

		dao.update(group);
		eventService
			.publishApplicationEvent(new GroupEditEvent(group.getUuid(), Collections.singleton(fromUserId)));
	}
}
 
Example 19
Project: Equella   File: AclDaoImpl.java   Source Code and License 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
@Transactional(propagation = Propagation.MANDATORY)
public List<TargetListEntry> getTargetListEntries(final String target, final Collection<Integer> priorities)
{
	return getHibernateTemplate().executeFind(new TLEHibernateCallback()
	{
		@Override
		public Object doInHibernate(Session session) throws HibernateException
		{
			Query query = session.getNamedQuery("getTargetListEntries");
			query.setParameter("institution", CurrentInstitution.get());
			query.setParameterList("priorities", priorities);
			query.setString("target", target);
			return query.list();
		}
	});
}
 
Example 20
Project: Equella   File: TLEGroupServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED)
public void userDeletedEvent(UserDeletedEvent event)
{
	String userID = event.getUserID();

	for( TLEGroup group : dao.getGroupsContainingUser(userID) )
	{
		group.getUsers().remove(userID);

		dao.update(group);
		eventService.publishApplicationEvent(new GroupEditEvent(group.getUuid(), Collections.singleton(userID)));
	}
}
 
Example 21
Project: OMIPlatform   File: OfficialResouceController.java   Source Code and License 5 votes vote down vote up
@PutMapping("/addResource")
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public Message addResource(@RequestBody OfficialResouce officialResouce) {
    int status = 0;
    status = this.officialResouceService.insert(officialResouce);
    Message message = new Message();
    message.setStatus(status);
    return message;
}
 
Example 22
Project: Equella   File: AbstractCopyrightDao.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.MANDATORY)
public void updateHoldingReference(H holding, List<Item> items)
{
	List<P> portions = getPortionsForItems(items);
	if( holding != null )
	{
		holding.setPortions(portions);
	}
	for( P portion : portions )
	{
		portion.setHolding(holding);
	}
}
 
Example 23
Project: OMIPlatform   File: ShopProductController.java   Source Code and License 5 votes vote down vote up
@PostMapping("addProduct")
@Transactional(propagation = Propagation.REQUIRED)
public String insertProduct(@RequestBody EditShopProductDto productDto) throws JsonProcessingException, InvocationTargetException, IllegalAccessException {
    /*将商品基础详情转换为json串*/
    String baseProperty = "";
    baseProperty = objectMapper.writeValueAsString(productDto.getBaseProperty());
    productDto.setProBaseProperty(baseProperty);

    /*设置销量*/
    productDto.setProSalveNumber(0);
    /*设置商品为下架*/
    productDto.setProSalve(0);
    /*将图片转为字符串*/
    String proImgs = objectMapper.writeValueAsString(productDto.getImgs());
    productDto.setProImage(proImgs);
    /*存储商品*/
    this.productService.insert(productDto);

    List<ShopProductVersion> spvs = new ArrayList<>();
    for (EditShopProductVersionDto vers : productDto.getProVersion()) {
        ShopProductVersion spv = new ShopProductVersion();
        /*将商品系列中的两个详情转换为json串*/
        String dp = objectMapper.writeValueAsString(vers.getDetailProperty());
        vers.setProDetailProperty(dp);
        vers.setProId(productDto.getProId());
        /*将Dto映射到pojo*/
        BeanUtils.copyProperties(spv, vers);
        spvs.add(spv);
    }
    System.out.println(productDto.getProId());

    /*批量添加到商品系列表中*/
    this.shopProductVersionService.insertList(spvs);

    return "{\"status\":true}";
}
 
Example 24
Project: NGB-master   File: BamFileDao.java   Source Code and License 5 votes vote down vote up
/**
 * Loads {@code BamFile} records, saved for a specific reference ID. <br>
 * @param referenceId {@code long} a reference ID in the system
 * @return {@code List&lt;BamFile&gt;} instance
 */
@Transactional(propagation = Propagation.MANDATORY)
public List<BamFile> loadBamFilesByReferenceId(long referenceId) {
    return getJdbcTemplate().query(loadBamFilesByReferenceIdQuery, BiologicalDataItemDao
            .BiologicalDataItemParameters.getRowMapper(), referenceId)
            .stream().map(f -> (BamFile) f).collect(Collectors.toList());
}
 
Example 25
Project: Equella   File: TermServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED)
public TermResult addTerm(Taxonomy taxonomy, String parentFullPath, String termValue, boolean createHierarchy)
{
	String path = insertTermImpl(taxonomy, parentFullPath, termValue, -1, createHierarchy);
	return new TermResult(termValue, path, true);
}
 
Example 26
Project: OMIPlatform   File: ResourcesController.java   Source Code and License 5 votes vote down vote up
@PostMapping("modifyMenusByAuId/{auid}")
@Transactional(propagation = Propagation.REQUIRED)
public void modifyMenusByAuId(@PathVariable String auid, @RequestBody List<AuthorityResources> items) {


    List<String> rids = new ArrayList<>();

    List<ResourcesMenuDto> menuDtos = this.resourcesService.finMenusByAuId(auid);

    for (ResourcesMenuDto item : menuDtos) {

        if (item.getChildren() == null) {
            rids.add(item.getId());
        }
    }

    if (rids.size() < 1) {
        this.authorityResourcesService.deleteResourcesByRId(null, auid);
    } else {
        // 先删除该角色所拥有的菜单
        this.authorityResourcesService.deleteResourcesByRId(rids, auid);
    }

    if (items.size() > 0) {
        this.authorityResourcesService.insertMenus(items);
    }


}
 
Example 27
Project: OMIPlatform   File: EduCourseServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public int addTeacher(EduTeacher teacher, EduCourse eduCourse) {
    /*插入教师数据*/
    this.eduTheacherService.insert(teacher);

    EduCourse course = this.findByEducid(eduCourse.getEducid());
    course.setTchid(teacher.getThid());
    /*更新课程数据*/
    int result = this.eduCourseDao.update(course);
    return result;
}
 
Example 28
Project: mumu   File: DataCarBrandServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
public DataCarBrand addSystemCarBrand(DataCarBrand systemCarBrand) {
	systemCarBrand.setParentId(0);
	systemCarBrand.setStatus(PublicEnum.NORMAL.value());
	systemCarBrand.setDepth(1);
	// 添加数据
	systemCarBrand = carBrandDao.insert(systemCarBrand);
	return systemCarBrand;
}
 
Example 29
Project: NGB-master   File: GffManagerTest.java   Source Code and License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testRegisterGffFail() throws IOException, FeatureIndexException, InterruptedException,
        NoSuchAlgorithmException {
    Resource resource = context.getResource("classpath:templates/Felis_catus.Felis_catus_6.2.81.gtf");

    FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest();
    request.setReferenceId(referenceId);
    request.setPath(resource.getFile().getAbsolutePath());

    boolean failed = true;
    try {
        gffManager.registerGeneFile(request);
    } catch (TribbleException.MalformedFeatureFile e) {
        failed = false;
    }

    Assert.assertFalse("Not failed on unsorted file", failed);

    /*Resource fakeIndex = context.getResource("classpath:templates/fake_gtf_index.tbi");
    request.setIndexPath(fakeIndex.getFile().getAbsolutePath());

    failed = true;
    try {
        gffManager.registerGeneFile(request);
    } catch (Exception e) {
        failed = false;
    }

    Assert.assertFalse("Not failed on unsorted file", failed);*/
}
 
Example 30
Project: NGB-master   File: BookmarkManager.java   Source Code and License 5 votes vote down vote up
/**
 * Loads {@code Bookmark} entities for a given collection of IDs
 * @param bookmarkIds collection of IDs to load
 * @return a {@code List} of {@code Bookmark} entities
 */
@Transactional(propagation = Propagation.REQUIRED)
public List<Bookmark> loadBookmarksByIds(Collection<Long> bookmarkIds) {
    List<Bookmark> bookmarks = bookmarkDao.loadBookmarksByIds(bookmarkIds);

    if (!bookmarks.isEmpty()) {
        Map<Long, List<BiologicalDataItem>> itemMap = bookmarkDao.loadBookmarkItemsByBookmarkIds(bookmarkIds);
        for (Bookmark b : bookmarks) {
            b.setOpenedItems(itemMap.get(b.getId()));
        }
    }

    return bookmarks;
}
 
Example 31
Project: NGB-master   File: FeatureIndexManagerTest.java   Source Code and License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testCreateUnmappedGeneIndex() throws IOException, InterruptedException, FeatureIndexException,
        NoSuchAlgorithmException {
    Chromosome chr1 = EntityHelper.createNewChromosome("chr1");
    chr1.setSize(TEST_CHROMOSOME_SIZE);
    Reference testHumanReference = EntityHelper.createNewReference(chr1,
            referenceGenomeManager.createReferenceId());

    referenceGenomeManager.register(testHumanReference);
    Long humanReferenceId = testHumanReference.getId();

    Resource resource = context.getResource("classpath:templates/mrna.sorted.chunk.gtf");

    FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest();
    request.setReferenceId(humanReferenceId);
    request.setPath(resource.getFile().getAbsolutePath());

    GeneFile geneFile = gffManager.registerGeneFile(request);
    Assert.assertNotNull(geneFile);
    Assert.assertNotNull(geneFile.getId());

    Project project = new Project();
    project.setName(TEST_PROJECT_NAME + 1);

    project.setItems(Arrays.asList(
            new ProjectItem(new BiologicalDataItem(geneFile.getBioDataItemId())),
            new ProjectItem(new BiologicalDataItem(testHumanReference.getBioDataItemId()))));
    projectManager.saveProject(project);

    List<FeatureIndexEntry> entryList = (List<FeatureIndexEntry>)
            featureIndexManager.searchFeaturesInProject("", project.getId()).getEntries();
    Assert.assertTrue(entryList.isEmpty());

    entryList = (List<FeatureIndexEntry>) featureIndexManager.searchFeaturesInProject("AM992871",
                                                                                      project.getId()).getEntries();
    Assert.assertTrue(entryList.isEmpty()); // we don't search for exons
}
 
Example 32
Project: Equella   File: TLEUserDaoImpl.java   Source Code and License 5 votes vote down vote up
@Override
@SecureOnCallSystem
@Transactional(propagation = Propagation.MANDATORY)
public void deleteAll()
{
	getHibernateTemplate().deleteAll(listAllUsers());
}
 
Example 33
Project: Equella   File: ThumbnailRequestDaoImpl.java   Source Code and License 5 votes vote down vote up
@Transactional(propagation = Propagation.MANDATORY)
@Override
public void delete(Item item)
{
	List<ThumbnailRequest> thumbsForItem = findAllByCriteria(Restrictions.eq("itemUuid", item.getUuid()),
		Restrictions.eq("itemVersion", item.getVersion()), Restrictions.eq("institution", CurrentInstitution.get()));
	for( ThumbnailRequest thumb : thumbsForItem )
	{
		delete(thumb);
	}
}
 
Example 34
Project: Equella   File: ItemDefinitionServiceImpl.java   Source Code and License 5 votes vote down vote up
@Transactional(propagation = Propagation.MANDATORY)
@SecureOnReturn(priv = "CREATE_ITEM")
@Override
public ItemDefinition getForItemCreate(String uuid)
{
	ItemDefinition collection = getByUuid(uuid);
	if( collection == null )
	{
		throw new NotFoundException("Collection '" + uuid + "' doesn't exist");
	}
	return collection;
}
 
Example 35
Project: mmsns   File: MMSnsArticleCommentServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void deleteArticleCommentById(String commentId) {
    MMSnsArticleCommentEntity articleCommentEntity = new MMSnsArticleCommentEntity();
    articleCommentEntity.setCommentId(Integer.parseInt(commentId));
    articleCommentEntity.setCommentStatus(PublicEnum.DELETE.value());
    updateArticleComment(articleCommentEntity);
}
 
Example 36
Project: Equella   File: AclDaoImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.MANDATORY)
public void saveOrUpdate(AccessEntry entity)
{
	entity.generateAggregateOrdering();
	super.saveOrUpdate(entity);
}
 
Example 37
Project: plumdo-work   File: ModelResource.java   Source Code and License 5 votes vote down vote up
@RequestMapping(value = "/model", method = RequestMethod.POST, produces = "application/json", name="模型创建")
@ResponseStatus(value = HttpStatus.CREATED)
@Transactional(propagation = Propagation.REQUIRED)
public ModelResponse createModel(@RequestBody ModelRequest modelRequest){
	
	Model model = repositoryService.newModel();
	model.setCategory(modelRequest.getCategory());
	model.setKey(modelRequest.getKey());
	model.setMetaInfo(modelRequest.getMetaInfo());
	model.setName(modelRequest.getName());
	model.setVersion(modelRequest.getVersion());
	model.setTenantId(modelRequest.getTenantId());

	repositoryService.saveModel(model);
	
	ObjectMapper objectMapper = new ObjectMapper();
	ObjectNode editorNode = objectMapper.createObjectNode();
	editorNode.put(EditorJsonConstants.EDITOR_STENCIL_ID, "canvas");
	
	editorNode.put(EditorJsonConstants.EDITOR_SHAPE_ID, "canvas");
	//设置流程定义初始化的key和name
	ObjectNode propertieNode = objectMapper.createObjectNode();
	if(StringUtils.isNotEmpty(model.getKey())){
		propertieNode.put(StencilConstants.PROPERTY_PROCESS_ID, model.getKey());
	}else{
		propertieNode.put(StencilConstants.PROPERTY_PROCESS_ID, "model_"+model.getId());
	}
	propertieNode.put(StencilConstants.PROPERTY_NAME, model.getName());
	editorNode.set(EditorJsonConstants.EDITOR_SHAPE_PROPERTIES, propertieNode);
	ObjectNode stencilSetNode = objectMapper.createObjectNode();
	stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
	editorNode.set("stencilset", stencilSetNode);
	try {
		repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("utf-8"));
	} catch (UnsupportedEncodingException e) {
		throw new FlowableConflictException("create model exception :"+e.getMessage());
	}
      
	return restResponseFactory.createModelResponse(model);
}
 
Example 38
Project: NGB-master   File: BedManagerTest.java   Source Code and License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testRegisterUrl() throws Exception {
    String bedUrl = UrlTestingUtils.TEST_FILE_SERVER_URL + "/genes_sorted.bed";
    String indexUrl = UrlTestingUtils.TEST_FILE_SERVER_URL + "/genes_sorted.bed.tbi";

    Server server = UrlTestingUtils.getFileServer(context);
    try {
        server.start();

        IndexedFileRegistrationRequest request = new IndexedFileRegistrationRequest();
        request.setPath(bedUrl);
        request.setType(BiologicalDataItemResourceType.URL);
        request.setIndexType(BiologicalDataItemResourceType.URL);
        request.setIndexPath(indexUrl);
        request.setReferenceId(referenceId);

        BedFile bedFile = bedManager.registerBed(request);
        Assert.assertNotNull(bedFile);

        bedFile = bedFileManager.loadBedFile(bedFile.getId());
        Assert.assertNotNull(bedFile.getId());
        Assert.assertNotNull(bedFile.getBioDataItemId());
        Assert.assertNotNull(bedFile.getIndex());
        Assert.assertFalse(bedFile.getPath().isEmpty());
        Assert.assertFalse(bedFile.getIndex().getPath().isEmpty());

        testLoadBedRecords(bedFile);
    } finally {
        server.stop();
    }
}
 
Example 39
Project: NGB-master   File: DataItemManagerTest.java   Source Code and License 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void deleteReferenceTest() throws IOException {
    Chromosome testChromosome = EntityHelper.createNewChromosome();
    testChromosome.setSize(TEST_CHROMOSOME_SIZE);
    Reference testReference = EntityHelper.createNewReference(testChromosome,
            referenceGenomeManager.createReferenceId());
    File tmp = File.createTempFile(TMP_FILE_NAME, TMP_FILE_NAME);
    testReference.setPath(tmp.getAbsolutePath());
    referenceGenomeManager.register(testReference);
    dataItemManager.deleteFileByBioItemId(testReference.getBioDataItemId());
}
 
Example 40
Project: NGB-master   File: PersonDao.java   Source Code and License 5 votes vote down vote up
/**
 * Loads a {@code Person} instance from the database specified by it's name and password
 * @param name of a user
 * @param password of a user
 * @return  a loaded {@code Person} instance or
 *          {@code null} if user with a given name and password doesn't exist
 */
@Transactional(propagation = Propagation.MANDATORY)
public Person loadPersonByNameAndPassword(String name, String password) {
    MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue(PersonParameters.NAME.name(), name);
    params.addValue(PersonParameters.PASSWORD.name(), password);

    List<Person> persons = getNamedParameterJdbcTemplate().query(loadPersonByNameAndPasswordQuery, params,
            PersonParameters.getRowMapper());
    return persons.isEmpty() ? null : persons.get(0);
}
 
Example 41
Project: dhus-core   File: UserService.java   Source Code and License 5 votes vote down vote up
@PreAuthorize ("hasRole('ROLE_SEARCH')")
@Transactional (readOnly=true, propagation=Propagation.REQUIRED)
public List<Search> scrollSearchesOfUser (String uuid, int skip, int top)
{
   User u = userDao.read (uuid);
   if (u == null)
   {
      throw new UserNotExistingException ();
   }
   return searchDao.scrollSearchesOfUser (u, skip, top);
}
 
Example 42
Project: NGB-master   File: VcfFileDao.java   Source Code and License 5 votes vote down vote up
/**
 * Loads a persisted {@code VcfFile} record by it's ID
 *
 * @param id {@code long} a VcfFile ID
 * @return {@code VcfFile} instance
 */
@Transactional(propagation = Propagation.MANDATORY)
public VcfFile loadVcfFile(long id) {
    List<BiologicalDataItem> files = getJdbcTemplate().query(loadVcfFileQuery, BiologicalDataItemDao
            .BiologicalDataItemParameters.getRowMapper(), id);

    return !files.isEmpty() ? (VcfFile) files.get(0) : null;
}
 
Example 43
Project: devops-cstack   File: MessageServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void delete(Message message)
        throws ServiceException {
    try {
        messageDAO.delete(message);
    } catch (PersistenceException e) {
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
Example 44
Project: mmsns   File: MMSnsActionCommentServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void deleteActionCommentById(int commentId) {
    MMSnsActionCommentEntity articleCommentEntity = new MMSnsActionCommentEntity();
    articleCommentEntity.setCommentId(commentId);
    articleCommentEntity.setCommentStatus(PublicEnum.DELETE.value());
    updateArticleComment(articleCommentEntity);

    MMSnsActionCommentEntity actionCommentInfo = getActionCommentInfo(commentId);
    //动弹评论数量-1
    MMSnsActionEntity actionEntity = new MMSnsActionEntity();
    actionEntity.setActionId(actionCommentInfo.getActionId());
    actionEntity.setCommentCount(-1);
    actionService.updateAction(actionEntity);
}
 
Example 45
Project: spring-io   File: CustomAuditEventRepository.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void add(AuditEvent event) {
    if (!AUTHORIZATION_FAILURE.equals(event.getType()) &&
        !Constants.ANONYMOUS_USER.equals(event.getPrincipal())) {

        PersistentAuditEvent persistentAuditEvent = new PersistentAuditEvent();
        persistentAuditEvent.setPrincipal(event.getPrincipal());
        persistentAuditEvent.setAuditEventType(event.getType());
        persistentAuditEvent.setAuditEventDate(event.getTimestamp().toInstant());
        persistentAuditEvent.setData(auditEventConverter.convertDataToStrings(event.getData()));
        persistenceAuditEventRepository.save(persistentAuditEvent);
    }
}
 
Example 46
Project: NGB-master   File: BedFileDao.java   Source Code and License 5 votes vote down vote up
/**
 * Loads {@code BedFile} records, saved for a specific reference ID
 * @param referenceId {@code long} a reference ID in the system
 * @return a {@code List} of {@code BedFile} instances
 */
@Transactional(propagation = Propagation.MANDATORY)
public List<BedFile> loadBedFilesByReferenceId(long referenceId) {
    return getJdbcTemplate().query(loadBedFilesByReferenceIdQuery, BiologicalDataItemDao
            .BiologicalDataItemParameters.getRowMapper(), referenceId)
            .stream().map(f -> (BedFile) f).collect(Collectors.toList());
}
 
Example 47
Project: NGB-master   File: ProjectDao.java   Source Code and License 5 votes vote down vote up
/**
 * Persists a new or updates existing project in the database.
 * @param project {@code Project} a project to persist.
 */
@Transactional(propagation = Propagation.MANDATORY)
public void saveProject(Project project, Long parentId) {
    if (project.getId() == null) {
        project.setId(daoHelper.createId(projectSequenceName));
        getNamedParameterJdbcTemplate().update(insertProjectQuery, ProjectParameters.getParameters(project,
                                                                                                   parentId));
    } else {
        getNamedParameterJdbcTemplate().update(updateProjectQuery, ProjectParameters.getParameters(project, null));
    }
}
 
Example 48
Project: NGB-master   File: BedFileDao.java   Source Code and License 5 votes vote down vote up
/**
 * Persists {@code BedFile} record to the database
 * @param bedFile a {@code BedFile} instance to be persisted
 * @param realId BedFile's real ID, generated with BedFileDao::createGeneFileId() method
 */
@Transactional(propagation = Propagation.MANDATORY)
public void createBedFile(BedFile bedFile, long realId) {
    bedFile.setBioDataItemId(bedFile.getId());
    bedFile.setId(realId);

    getNamedParameterJdbcTemplate().update(createBedFileQuery, BiologicalDataItemDao.FeatureFileParameters
            .getLinkedTableParameters(BedParameters.BED_ID.name(), bedFile));
}
 
Example 49
Project: NGB-master   File: MafFileManager.java   Source Code and License 5 votes vote down vote up
/**
 * Loads a persisted {@code MafFile} record by it's ID
 * @param mafFileId {@code long} a MafFile ID
 * @return {@code MafFile} instance
 */
@Transactional(propagation = Propagation.REQUIRED)
public MafFile loadMafFile(long mafFileId) {
    MafFile mafFile = mafFileDao.loadMafFile(mafFileId);
    Assert.notNull(mafFile, "MAF file with requested ID not found: " + mafFileId);
    return mafFile;
}
 
Example 50
Project: dhus-core   File: UserService.java   Source Code and License 5 votes vote down vote up
/**
 * Create given User as temporary User, after checking required fields.
 * 
 * @param user
 * @throws RequiredFieldMissingException
 * @throws RootNotModifiableException
 */
@Transactional (readOnly=false, propagation=Propagation.REQUIRED)
public void createTmpUser (User user) throws RequiredFieldMissingException,
   RootNotModifiableException, EmailNotSentException
{
   checkRequiredFields (user);
   checkRoot (user);
   userDao.createTmpUser (user);
}
 
Example 51
Project: devoxxus-jhipster-microservices-demo   File: CustomAuditEventRepository.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void add(AuditEvent event) {
    if (!AUTHORIZATION_FAILURE.equals(event.getType()) &&
        !Constants.ANONYMOUS_USER.equals(event.getPrincipal())) {

        PersistentAuditEvent persistentAuditEvent = new PersistentAuditEvent();
        persistentAuditEvent.setPrincipal(event.getPrincipal());
        persistentAuditEvent.setAuditEventType(event.getType());
        Instant instant = Instant.ofEpochMilli(event.getTimestamp().getTime());
        persistentAuditEvent.setAuditEventDate(LocalDateTime.ofInstant(instant, ZoneId.systemDefault()));
        persistentAuditEvent.setData(auditEventConverter.convertDataToStrings(event.getData()));
        persistenceAuditEventRepository.save(persistentAuditEvent);
    }
}
 
Example 52
Project: Equella   File: CourseInfoServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
@SecureOnReturn(priv = SecurityConstants.EDIT_VIRTUAL_BASE)
@Transactional(propagation = Propagation.REQUIRED)
public List<CourseInfo> bulkImport(byte[] file, boolean override)
{
	return bulkImport(new CsvReader(new ByteArrayInputStream(file), Charset.forName("UTF-8")), override); //$NON-NLS-1$
}
 
Example 53
Project: NGB-master   File: VcfManagerTest.java   Source Code and License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testSaveUnsorted() throws IOException, ClassNotFoundException, InterruptedException,
        ParseException, VcfReadingException {
    String invalidVcf = "unsorted.vcf";
    testRegisterInvalidFile("classpath:templates/invalid/" + invalidVcf,  MessageHelper
            .getMessage(MessagesConstants.ERROR_UNSORTED_FILE));

    Assert.assertTrue(biologicalDataItemDao
            .loadFilesByNameStrict(invalidVcf).isEmpty());
}
 
Example 54
Project: xproject   File: AdminUserServiceImpl.java   Source Code and License 5 votes vote down vote up
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void updateUserStatus(AdminUser user) {
    ValidationAssert.notNull(user, "参数不能为空!");
    ValidationAssert.notNull(user.getUserId(), "用户id不能为空!");
    ValidationAssert.notNull(AdminUserStatusEnum.getStatus(user.getStatus()), String.format("无法识别的用户状态(status=%s)!", user.getStatus()));
    AdminUser puser = adminUserMapper.selectThinUserById(user.getUserId());
    ValidationAssert.notNull(puser, "该用户已经不存在了!");
    user.setUserName(puser.getUserName());
    adminUserMapper.updateUserStatus(user.getUserId(), user.getStatus());
}
 
Example 55
Project: xproject   File: AdminUserServiceImpl.java   Source Code and License 5 votes vote down vote up
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public void delUserRoles(AdminUser user, List<Long> roleIdList) {
    ValidationAssert.notNull(user, "参数不能为空!");
    ValidationAssert.notNull(user.getUserId(), "用户id不能为空!");
    AdminUser puser = adminUserMapper.selectThinUserById(user.getUserId());
    ValidationAssert.notNull(puser, "该用户已经不存在了!");
    user.setUserName(puser.getUserName());
    adminUserMapper.deleteUserRoles(user.getUserId(), roleIdList);
}
 
Example 56
Project: spring-domain-events   File: JpaEventPublicationRegistry.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void markCompleted(Object event, PublicationTargetIdentifier listener) {

	Assert.notNull(event, "Domain event must not be null!");
	Assert.notNull(listener, "Listener identifier must not be null!");

	events.findBySerializedEventAndListenerId(serializer.serialize(event), listener.toString()) //
			.map(JpaEventPublicationRegistry::logCompleted) //
			.ifPresent(it -> events.save(it.markCompleted()));
}
 
Example 57
Project: graphium   File: GraphImportStateDaoImpl.java   Source Code and License 5 votes vote down vote up
@Override
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void update(IGraphImportState graphImportState) {
	Object[] args = new Object[3];
	args[0] = graphImportState.getServerName();
	args[1] = graphImportState.getViewName();
	args[2] = graphImportState.getVersion();

	Boolean entryExists = getJdbcTemplate().queryForObject("SELECT EXISTS (SELECT servername FROM " + schema + 
			GRAPH_IMPORT_STATES_TABLE + " WHERE servername = ? AND viewname = ? AND version = ?)", args, Boolean.class);
	
	if (entryExists != null && entryExists) {
		args = new Object[4];
		args[0] = graphImportState.getState().toString();
		args[1] = graphImportState.getServerName();
		args[2] = graphImportState.getViewName();
		args[3] = graphImportState.getVersion();
		getJdbcTemplate().update("UPDATE " + schema + GRAPH_IMPORT_STATES_TABLE + " SET state = ? "
				+ "WHERE servername = ? AND viewname = ? AND version = ?",
				args);
	} else {
		args = new Object[4];
		args[0] = graphImportState.getServerName();
		args[1] = graphImportState.getViewName();
		args[2] = graphImportState.getVersion();
		args[3] = graphImportState.getState().toString();
		getJdbcTemplate().update("INSERT INTO " + schema + GRAPH_IMPORT_STATES_TABLE
				+ " (servername, viewname, version, state, timestamp) "
				+ " VALUES (?, ?, ?, ?, now())",
				args);			
	}

}
 
Example 58
Project: plumdo-work   File: FormInstanceResource.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "创建表单模型", notes = "根据传过来的modelRequest信息来创建表单模型")
@ApiImplicitParam(name = "modelRequest", value = "表单模型请求实体modelRequest", required = true, dataType = "FormInstanceRequest")
@RequestMapping(value = "/form-instances/{id}", method = RequestMethod.PUT, produces = "application/json")
@ResponseStatus(value = HttpStatus.CREATED)
@Transactional(propagation = Propagation.REQUIRED)
public FormInstanceResponse updateFormInstance(@PathVariable Long id,@RequestBody FormInstanceRequest formInstanceRequest) {
	FormInstance formInstance = getFormInstanceFromRequest(id);
	if (formInstanceRequest.getBusinessKey() != null) {
		formInstance.setBusinessKey(formInstanceRequest.getBusinessKey());
	}
	if (formInstanceRequest.getTenantId() != null) {
		formInstance.setTenantId(formInstanceRequest.getTenantId());
	}
	
	if (formInstanceRequest.getFormDatas() != null) {
		for(FormInstanceData formInstanceData : formInstanceRequest.getFormDatas()){
			Criteria<FormData> criteria = new Criteria<FormData>();
			criteria.add(Restrictions.eq("key", formInstanceData.getKey(),false));
			criteria.add(Restrictions.eq("formInstance.id", id,false));
			FormData oldFormData = formDataRepository.findOne(criteria);
			if(oldFormData == null){
				FormData formData = new FormData();
				formData.setFormInstance(formInstance);
				formData.setKey(formInstanceData.getKey());
				formData.setValue(formInstanceData.getValue());
				formInstance.addFormData(formData);
			}else{
				oldFormData.setValue(formInstanceData.getValue());
				formInstance.addFormData(oldFormData);
			}
		}
	}
	
	formInstanceRepository.save(formInstance);

	return responseFactory.createFormInstanceResponse(formInstance);
}
 
Example 59
Project: NGB-master   File: MafManagerTest.java   Source Code and License 5 votes vote down vote up
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testRegisterExtraChromosome() throws IOException, InterruptedException, NoSuchAlgorithmException {
    Resource resource = context.getResource("classpath:templates/invalid/extra_chr.maf");
    IndexedFileRegistrationRequest request = new IndexedFileRegistrationRequest();
    request.setPath(resource.getFile().getAbsolutePath());
    request.setReferenceId(referenceId);
    MafFile mafFile = mafManager.registerMafFile(request);
    //check that name is not reserved
    Assert.assertTrue(mafFile != null);

}
 
Example 60
Project: NGB-master   File: BiologicalDataItemDao.java   Source Code and License 5 votes vote down vote up
@Transactional(propagation = Propagation.MANDATORY)
public List<BiologicalDataItem> loadFilesByNamesStrict(final List<String> names) {
    if (CollectionUtils.isEmpty(names)) {
        return Collections.emptyList();
    }

    long listId = daoHelper.createTempStringList(names);

    List<BiologicalDataItem> items = getJdbcTemplate().query(loadBiologicalDataItemsByNamesStrictQuery,
                                                 getRowMapper(), listId);

    daoHelper.clearTempStringList(listId);
    return items;
}