Esempio n. 1
0
 /**
  * 自定义保存资源. <br>
  * 说明:如果保存的资源类型为“功能” 则将所有子资源都设置为“功能”类型
  *
  * @param entity 资源对象
  * @throws DaoException
  * @throws SystemException
  * @throws ServiceException
  */
 public void saveResource(Resource entity) throws DaoException, SystemException, ServiceException {
   Assert.notNull(entity, "参数[entity]为空!");
   this.saveEntity(entity);
   if (entity.getType() != null && ResourceState.function.getValue().equals(entity.getType())) {
     List<Resource> subResources = entity.getSubResources();
     while (!Collections3.isEmpty(subResources)) {
       Iterator<Resource> iterator = subResources.iterator();
       while (iterator.hasNext()) {
         Resource subResource = iterator.next();
         subResource.setType(ResourceState.function.getValue());
         iterator.remove();
         subResources = ListUtils.union(subResources, subResource.getSubResources());
         super.update(subResource);
       }
     }
   }
 }
Esempio n. 2
0
 // 清除缓存
 @CacheEvict(
     value = {
       CacheConstants.RESOURCE_USER_RESOURCE_TREE_CACHE,
       CacheConstants.RESOURCE_USER_AUTHORITY_URLS_CACHE,
       CacheConstants.RESOURCE_USER_MENU_TREE_CACHE
     },
     allEntries = true)
 public void deleteByIds(List<Long> ids) throws DaoException, SystemException, ServiceException {
   logger.debug(
       "清空缓存:{}",
       CacheConstants.RESOURCE_USER_RESOURCE_TREE_CACHE
           + ","
           + CacheConstants.RESOURCE_USER_AUTHORITY_URLS_CACHE
           + ","
           + CacheConstants.RESOURCE_USER_MENU_TREE_CACHE);
   super.deleteByIds(ids);
 }
Esempio n. 3
0
 @CacheEvict(
     value = {
       CacheConstants.RESOURCE_USER_RESOURCE_TREE_CACHE,
       CacheConstants.RESOURCE_USER_AUTHORITY_URLS_CACHE,
       CacheConstants.RESOURCE_USER_MENU_TREE_CACHE
     },
     allEntries = true)
 @Override
 public void saveEntity(Resource entity) throws DaoException, SystemException, ServiceException {
   logger.debug(
       "清空缓存:{}",
       CacheConstants.RESOURCE_USER_RESOURCE_TREE_CACHE
           + ","
           + CacheConstants.RESOURCE_USER_AUTHORITY_URLS_CACHE
           + ","
           + CacheConstants.RESOURCE_USER_MENU_TREE_CACHE);
   super.saveEntity(entity);
 }