Java Code Examples for cn.hutool.core.collection.CollUtil#isNotEmpty()

The following examples show how to use cn.hutool.core.collection.CollUtil#isNotEmpty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysMenuServiceImpl.java    From smaker with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = "menu_details", allEntries = true)
public SmakerResult removeMenuById(Integer id) {
	// 查询父节点为当前节点的节点
	List<SysMenu> menuList = this.list(Wrappers.<SysMenu>query()
			.lambda().eq(SysMenu::getParentId, id));
	if (CollUtil.isNotEmpty(menuList)) {
		return SmakerResult.builder()
				.code(CommonConstants.FAIL)
				.msg("菜单含有下级不能删除").build();
	}

	sysRoleMenuMapper
			.delete(Wrappers.<SysRoleMenu>query()
					.lambda().eq(SysRoleMenu::getMenuId, id));

	//删除当前菜单及其子菜单
	return new SmakerResult(this.removeById(id));
}
 
Example 2
Source File: HutoolController.java    From mall-learning with Apache License 2.0 6 votes vote down vote up
@ApiOperation("CollUtil使用:集合工具类")
@GetMapping("/collUtil")
public CommonResult collUtil() {
    //数组转换为列表
    String[] array = new String[]{"a", "b", "c", "d", "e"};
    List<String> list = CollUtil.newArrayList(array);
    //join:数组转字符串时添加连接符号
    String joinStr = CollUtil.join(list, ",");
    LOGGER.info("collUtil join:{}", joinStr);
    //将以连接符号分隔的字符串再转换为列表
    List<String> splitList = StrUtil.split(joinStr, ',');
    LOGGER.info("collUtil split:{}", splitList);
    //创建新的Map、Set、List
    HashMap<Object, Object> newMap = CollUtil.newHashMap();
    HashSet<Object> newHashSet = CollUtil.newHashSet();
    ArrayList<Object> newList = CollUtil.newArrayList();
    //判断列表是否为空
    CollUtil.isEmpty(list);
    CollUtil.isNotEmpty(list);
    return CommonResult.success(null, "操作成功");
}
 
Example 3
Source File: VersionIsolationRule.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
/**
 * 优先根据版本号取实例
 */
@Override
public Server choose(ILoadBalancer lb, Object key) {
    if (lb == null) {
        return null;
    }
    String version;
    if (key != null && !KEY_DEFAULT.equals(key)) {
        version = key.toString();
    } else {
        version = LbIsolationContextHolder.getVersion();
    }

    List<Server> targetList = null;
    List<Server> upList = lb.getReachableServers();
    if (StrUtil.isNotEmpty(version)) {
        //取指定版本号的实例
        targetList = upList.stream().filter(
                server -> version.equals(
                        ((NacosServer) server).getMetadata().get(CommonConstant.METADATA_VERSION)
                )
        ).collect(Collectors.toList());
    }

    if (CollUtil.isEmpty(targetList)) {
        //只取无版本号的实例
        targetList = upList.stream().filter(
                server -> {
                    String metadataVersion = ((NacosServer) server).getMetadata().get(CommonConstant.METADATA_VERSION);
                    return StrUtil.isEmpty(metadataVersion);
                }
        ).collect(Collectors.toList());
    }

    if (CollUtil.isNotEmpty(targetList)) {
        return getServer(targetList);
    }
    return super.choose(lb, key);
}
 
Example 4
Source File: NodeIndexController.java    From Jpom with MIT License 6 votes vote down vote up
@RequestMapping(value = "list.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.LIST)
public String list(String group) {
    List<NodeModel> nodeModels = nodeService.list();
    //
    if (nodeModels != null && StrUtil.isNotEmpty(group)) {
        // 筛选
        List<NodeModel> filterList = nodeModels.stream().filter(nodeModel -> StrUtil.equals(group, nodeModel.getGroup())).collect(Collectors.toList());
        if (CollUtil.isNotEmpty(filterList)) {
            // 如果传入的分组找到了节点,就返回  否则返回全部
            nodeModels = filterList;
        }
    }
    setAttribute("array", nodeModels);
    // 获取所有的ssh 名称
    JSONObject sshName = new JSONObject();
    List<SshModel> sshModels = sshService.list();
    if (sshModels != null) {
        sshModels.forEach(sshModel -> sshName.put(sshModel.getId(), sshModel.getName()));
    }
    setAttribute("sshName", sshName);
    // group
    HashSet<String> allGroup = nodeService.getAllGroup();
    setAttribute("groups", allGroup);
    return "node/list";
}
 
Example 5
Source File: BuildListController.java    From Jpom with MIT License 6 votes vote down vote up
@RequestMapping(value = "list_data.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@Feature(method = MethodFeature.LIST)
public String getMonitorList(String group) {
    List<BuildModelVo> list = buildService.list(BuildModelVo.class);
    if (StrUtil.isNotEmpty(group) && CollUtil.isNotEmpty(list)) {
        List<BuildModelVo> array = new ArrayList<>();
        for (BuildModelVo buildModelVo : list) {
            if (group.equals(buildModelVo.getGroup())) {
                array.add(buildModelVo);
            }
        }
        list = array;
    }
    return JsonMessage.getString(200, "", list);
}
 
Example 6
Source File: CategoryServiceImpl.java    From mall4j with GNU Affero General Public License v3.0 5 votes vote down vote up
private void insertBrandsAndAttributes(Category category) {
	//保存分类与品牌信息
	if(CollUtil.isNotEmpty(category.getBrandIds())){
		categoryBrandMapper.insertCategoryBrand(category.getCategoryId(), category.getBrandIds());
	}
	
	//保存分类与参数信息
	if(CollUtil.isNotEmpty(category.getAttributeIds())){
		categoryPropMapper.insertCategoryProp(category.getCategoryId(), category.getAttributeIds());
	}
}
 
Example 7
Source File: UmsAdminCacheServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
@Override
public void delResourceListByResource(Long resourceId) {
    List<Long> adminIdList = adminRoleRelationDao.getAdminIdList(resourceId);
    if (CollUtil.isNotEmpty(adminIdList)) {
        String keyPrefix = REDIS_DATABASE + ":" + REDIS_KEY_RESOURCE_LIST + ":";
        List<String> keys = adminIdList.stream().map(adminId -> keyPrefix + adminId).collect(Collectors.toList());
        redisService.del(keys);
    }
}
 
Example 8
Source File: SqlCityParserDecorator.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
private void buildCitySql(List<Area> cities, Long parentId) {
    if (CollUtil.isNotEmpty(cities)) {

        cities.forEach(item -> item.setParentId(parentId));

        areaService.saveBatch(cities);

        for (Area city : cities) {
            buildCitySql(city.getChildren(), city.getId());
        }
    }
}
 
Example 9
Source File: SqlCityParserDecorator.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
 * *实体转sql数据
 *
 * @param provinces 省市县数据
 */
private void buildSql(List<Area> provinces) {
    if (CollUtil.isNotEmpty(provinces)) {

        areaService.saveBatch(provinces);

        for (Area province : provinces) {
            buildCitySql(province.getChildren(), province.getId());
        }
    }
}
 
Example 10
Source File: AuthenticationSuccessEventHandler.java    From smaker with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Handle an application event.
 *
 * @param event the event to respond to
 */
@Override
public void onApplicationEvent(AuthenticationSuccessEvent event) {
	Authentication authentication = (Authentication) event.getSource();
	if (CollUtil.isNotEmpty(authentication.getAuthorities())) {
		handle(authentication);
	}
}
 
Example 11
Source File: SqlCityParserDecorator.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * *实体转sql数据
 *
 * @param provinces 省市县数据
 */
private void buildSql(List<Area> provinces) {
    if (CollUtil.isNotEmpty(provinces)) {

        areaService.saveBatch(provinces);

        for (Area province : provinces) {
            buildCitySql(province.getChildren(), province.getId());
        }
    }
}
 
Example 12
Source File: CloudFeignClientInterceptor.java    From smaker with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Create a template with the header of provided name and extracted extract
 * 1. 如果使用 非web 请求,header 区别
 * 2. 根据authentication 还原请求token
 *
 * @param template
 */
@Override
public void apply(RequestTemplate template) {
	Collection<String> fromHeader = template.headers().get(SecurityConstants.FROM);
	if (CollUtil.isNotEmpty(fromHeader) && fromHeader.contains(SecurityConstants.FROM_IN)) {
		return;
	}

	accessTokenContextRelay.copyToken();
	if (oAuth2ClientContext != null
		&& oAuth2ClientContext.getAccessToken() != null) {
		super.apply(template);
	}
}
 
Example 13
Source File: PmsPortalProductServiceImpl.java    From mall with Apache License 2.0 4 votes vote down vote up
@Override
public PmsPortalProductDetail detail(Long id) {
    PmsPortalProductDetail result = new PmsPortalProductDetail();
    //获取商品信息
    PmsProduct product = productMapper.selectByPrimaryKey(id);
    result.setProduct(product);
    //获取品牌信息
    PmsBrand brand = brandMapper.selectByPrimaryKey(product.getBrandId());
    result.setBrand(brand);
    //获取商品属性信息
    PmsProductAttributeExample attributeExample = new PmsProductAttributeExample();
    attributeExample.createCriteria().andProductAttributeCategoryIdEqualTo(product.getProductAttributeCategoryId());
    List<PmsProductAttribute> productAttributeList = productAttributeMapper.selectByExample(attributeExample);
    result.setProductAttributeList(productAttributeList);
    //获取商品属性值信息
    if(CollUtil.isNotEmpty(productAttributeList)){
        List<Long> attributeIds = productAttributeList.stream().map(PmsProductAttribute::getId).collect(Collectors.toList());
        PmsProductAttributeValueExample attributeValueExample = new PmsProductAttributeValueExample();
        attributeValueExample.createCriteria().andProductIdEqualTo(product.getId())
                .andProductAttributeIdIn(attributeIds);
        List<PmsProductAttributeValue> productAttributeValueList = productAttributeValueMapper.selectByExample(attributeValueExample);
        result.setProductAttributeValueList(productAttributeValueList);
    }
    //获取商品SKU库存信息
    PmsSkuStockExample skuExample = new PmsSkuStockExample();
    skuExample.createCriteria().andProductIdEqualTo(product.getId());
    List<PmsSkuStock> skuStockList = skuStockMapper.selectByExample(skuExample);
    result.setSkuStockList(skuStockList);
    //商品阶梯价格设置
    if(product.getPromotionType()==3){
        PmsProductLadderExample ladderExample = new PmsProductLadderExample();
        ladderExample.createCriteria().andProductIdEqualTo(product.getId());
        List<PmsProductLadder> productLadderList = productLadderMapper.selectByExample(ladderExample);
        result.setProductLadderList(productLadderList);
    }
    //商品满减价格设置
    if(product.getPromotionType()==4){
        PmsProductFullReductionExample fullReductionExample = new PmsProductFullReductionExample();
        fullReductionExample.createCriteria().andProductIdEqualTo(product.getId());
        List<PmsProductFullReduction> productFullReductionList = productFullReductionMapper.selectByExample(fullReductionExample);
        result.setProductFullReductionList(productFullReductionList);
    }
    //商品可用优惠券
    result.setCouponList(portalProductDao.getAvailableCouponList(product.getId(),product.getProductCategoryId()));
    return result;
}
 
Example 14
Source File: ManageEditProjectController.java    From Jpom with MIT License 4 votes vote down vote up
/**
 * 保存项目
 *
 * @param projectInfo 项目
 * @param previewData 是否是预检查
 * @return 错误信息
 */
private String save(ProjectInfoModel projectInfo, boolean previewData) {
    String edit = getParameter("edit");
    ProjectInfoModel exits = projectInfoService.getItem(projectInfo.getId());
    try {
        JsonMessage<String> jsonMessage = checkPath(projectInfo);
        if (jsonMessage != null) {
            return jsonMessage.toString();
        }
        if (exits == null) {
            // 检查运行中的tag 是否被占用
            if (AbstractProjectCommander.getInstance().isRun(projectInfo.getId())) {
                return JsonMessage.getString(400, "当前项目id已经被正在运行的程序占用");
            }
            if (previewData) {
                // 预检查数据
                return JsonMessage.getString(200, "检查通过");
            } else {
                projectInfoService.addItem(projectInfo);
                return JsonMessage.getString(200, "新增成功!");
            }
        }
        if (previewData) {
            // 预检查数据
            return JsonMessage.getString(200, "检查通过");
        } else {
            exits.setLog(projectInfo.getLog());
            exits.setName(projectInfo.getName());
            exits.setGroup(projectInfo.getGroup());
            exits.setMainClass(projectInfo.getMainClass());
            exits.setLib(projectInfo.getLib());
            exits.setJvm(projectInfo.getJvm());
            exits.setArgs(projectInfo.getArgs());
            exits.setOutGivingProject(projectInfo.isOutGivingProject());
            exits.setRunMode(projectInfo.getRunMode());
            exits.setWhitelistDirectory(projectInfo.getWhitelistDirectory());
            exits.setToken(projectInfo.getToken());
            exits.setJdkId(projectInfo.getJdkId());
            // 检查是否非法删除副本集
            List<ProjectInfoModel.JavaCopyItem> javaCopyItemList = exits.getJavaCopyItemList();
            List<ProjectInfoModel.JavaCopyItem> javaCopyItemList1 = projectInfo.getJavaCopyItemList();
            if (CollUtil.isNotEmpty(javaCopyItemList) && !CollUtil.containsAll(javaCopyItemList1, javaCopyItemList)) {
                // 重写了 equals
                return JsonMessage.getString(405, "修改中不能删除副本集、请到副本集中删除");
            }
            exits.setJavaCopyItemList(javaCopyItemList1);
            exits.setJavaExtDirsCp(projectInfo.getJavaExtDirsCp());
            //
            moveTo(exits, projectInfo);
            projectInfoService.updateItem(exits);
            return JsonMessage.getString(200, "修改成功");
        }
    } catch (Exception e) {
        DefaultSystemLog.getLog().error(e.getMessage(), e);
        return JsonMessage.getString(500, "保存数据异常");
    }
}
 
Example 15
Source File: UserController.java    From feiqu-opensource with Apache License 2.0 4 votes vote down vote up
@GetMapping("/{uid}/home")
public String home(HttpServletRequest request, HttpServletResponse response,
                   @PathVariable Integer uid, @RequestParam(defaultValue = "1") Integer p, String order) {
    try {
        FqUserCache user = webUtil.currentUser(request, response);
        if(user == null){
            return login(CommonConstant.DOMAIN_URL+request.getRequestURI(),request);
        }
        logger.info("用户:{}登进我的小窝",user.getNickname());
        ThoughtWithUser topThought = null;
        RedisString redisString = new RedisString(CommonConstant.THOUGHT_TOP_LIST);
        if(org.apache.commons.lang3.StringUtils.isNotEmpty(redisString.get())){
            topThought = JSON.parseObject(redisString.get(),ThoughtWithUser.class);
        };
        request.setAttribute("topThought",topThought);
        if (user.getId().equals(uid)) {
            PageHelper.startPage(p, 20);
            ThoughtExample example = new ThoughtExample();
            if("zan".equals(order)){
                example.setOrderByClause("like_count desc");
            }else {
                example.setOrderByClause("create_time desc");
            }
            example.createCriteria().andDelFlagEqualTo(YesNoEnum.NO.getValue());
            List<ThoughtWithUser> thoughts = thoughtService.getThoughtWithUser(example);

            List<Integer> list = fqCollectService.selectTopicIdsByTypeAndUid(TopicTypeEnum.THOUGHT_TYPE.getValue(),uid);
            JedisCommands commands = JedisProviderFactory.getJedisCommands(null);
            if(CollUtil.isNotEmpty(thoughts)){
                String key = CacheManager.getCollectKey(TopicTypeEnum.THOUGHT_TYPE.name(),uid);
                long redisCount = commands.scard(key);
                if(redisCount == 0){
                    for(Integer tid : list){
                        commands.sadd(key, tid.toString());
                    }
                    commands.expire(key,24*60*60);
                }
                for(ThoughtWithUser thoughtWithUser : thoughts){
                    if(StringUtils.isNotEmpty(thoughtWithUser.getPicList())){
                        thoughtWithUser.setPictures(Arrays.asList(thoughtWithUser.getPicList().split(",")));
                    }
                    thoughtWithUser.setCollected(commands.sismember(key,thoughtWithUser.getId().toString()));
                }
            }
            PageInfo page = new PageInfo(thoughts);
            request.setAttribute("thoughtList",thoughts);

            String followKey = CommonConstant.FQ_FOLLOW_PREFIX+user.getId();
            String followStr = commands.get(followKey);
            int fansCount;
            int followCount;
            if(StringUtils.isEmpty(followStr)){
                UserFollowExample followExample = new UserFollowExample();
                followExample.createCriteria().andFollowedUserIdEqualTo(uid).andDelFlagEqualTo(YesNoEnum.NO.getValue());
                fansCount = userFollowService.countByExample(followExample);
                followExample.clear();
                followExample.createCriteria().andFollowerUserIdEqualTo(uid).andDelFlagEqualTo(YesNoEnum.NO.getValue());
                followCount = userFollowService.countByExample(followExample);
                commands.set(followKey,fansCount+"|"+followCount);
                commands.expire(followKey, 24*60*60);
            }else {
                String[] ff = followStr.split("\\|");
                fansCount = Integer.valueOf(ff[0]);
                followCount = Integer.valueOf(ff[1]);
            }
            List<SimThoughtDTO> sim7ThoughtDTOS = Lists.newArrayList();
            String hotThoughts = commands.get(CommonConstant.SEVEN_DAYS_HOT_THOUGHT_LIST);
            if(StringUtils.isNotEmpty(hotThoughts)){
                sim7ThoughtDTOS =  JSON.parseArray(hotThoughts, SimThoughtDTO.class);
            }
            request.setAttribute("sevenDaysT",sim7ThoughtDTOS);
            request.setAttribute("fansCount",fansCount);
            request.setAttribute("followCount",followCount);
            request.setAttribute("count",page.getTotal());
            request.setAttribute("p",p);
            request.setAttribute("pageSize",20);
            request.setAttribute("activeUserList",CommonConstant.FQ_ACTIVE_USER_LIST);
        }else {
            return peopleIndex(request,response,uid);
        }
    }catch (Exception e){
        request.setAttribute(CommonConstant.SYSTEM_ERROR_CODE,"出错了");
        return GENERAL_CUSTOM_ERROR_URL;
    }finally {
        JedisProviderFactory.getJedisProvider(null).release();
    }
    return "/user/home.html";
}
 
Example 16
Source File: JwtAuthenticationFilter.java    From spring-boot-demo with MIT License 4 votes vote down vote up
/**
 * 请求是否不需要进行权限拦截
 *
 * @param request 当前请求
 * @return true - 忽略,false - 不忽略
 */
private boolean checkIgnores(HttpServletRequest request) {
    String method = request.getMethod();

    HttpMethod httpMethod = HttpMethod.resolve(method);
    if (ObjectUtil.isNull(httpMethod)) {
        httpMethod = HttpMethod.GET;
    }

    Set<String> ignores = Sets.newHashSet();

    switch (httpMethod) {
        case GET:
            ignores.addAll(customConfig.getIgnores()
                    .getGet());
            break;
        case PUT:
            ignores.addAll(customConfig.getIgnores()
                    .getPut());
            break;
        case HEAD:
            ignores.addAll(customConfig.getIgnores()
                    .getHead());
            break;
        case POST:
            ignores.addAll(customConfig.getIgnores()
                    .getPost());
            break;
        case PATCH:
            ignores.addAll(customConfig.getIgnores()
                    .getPatch());
            break;
        case TRACE:
            ignores.addAll(customConfig.getIgnores()
                    .getTrace());
            break;
        case DELETE:
            ignores.addAll(customConfig.getIgnores()
                    .getDelete());
            break;
        case OPTIONS:
            ignores.addAll(customConfig.getIgnores()
                    .getOptions());
            break;
        default:
            break;
    }

    ignores.addAll(customConfig.getIgnores()
            .getPattern());

    if (CollUtil.isNotEmpty(ignores)) {
        for (String ignore : ignores) {
            AntPathRequestMatcher matcher = new AntPathRequestMatcher(ignore, method);
            if (matcher.matches(request)) {
                return true;
            }
        }
    }

    return false;
}
 
Example 17
Source File: GenController.java    From kvf-admin with MIT License 4 votes vote down vote up
@PostMapping(value = "custom/generate/code")
public R customGenerateCode(@RequestBody GenConfigVO genConfigVO) {
    LOGGER.info("genConfig={}", genConfigVO);
    String tableType = genConfigVO.getTableType();
    String tableTplName = tableType.equals("tree_grid") ? "treegrid.vm" : "table.vm";

    // 查询列参数设置坨峰字段
    List<QueryColumnConfigDTO> queryColumns = genConfigVO.getQueryColumns();
    if (CollUtil.isNotEmpty(queryColumns)) {
        queryColumns.forEach(column -> column.setNameCamelCase(StrUtil.toCamelCase(column.getName())));
    }

    // 处理表列值说明关系
    AuxiliaryKit.handleAndSetColumnsValueRelations(genConfigVO.getColumns());

    // 获取数据库表所有列字段数据
    List<TableColumnDTO> tableColumnDTOS = tableService.listTableColumn(genConfigVO.getTableName());

    // 获取并设置实体类所有需要导入的java包集合
    Set<String> sets = AuxiliaryKit.getEntityImportPkgs(tableColumnDTOS);
    genConfigVO.setPkgs(sets);

    // 处理设置所有表列数据
    tableColumnDTOS = AuxiliaryKit.handleTableColumns(tableColumnDTOS);
    AuxiliaryKit.handleAndSetAllColumnsValueRelations(tableColumnDTOS);
    genConfigVO.setAllColumns(tableColumnDTOS);
    genConfigVO.setFirstCapFunName(StrUtil.upperFirst(genConfigVO.getFunName()));
    genConfigVO.setPkCamelCase(StrUtil.toCamelCase(genConfigVO.getPrimaryKey()));
    genConfigVO.setFirstCapPk(StrUtil.upperFirst(genConfigVO.getPkCamelCase()));

    VelocityContext ctx = VelocityKit.getContext();
    ctx.put("config", genConfigVO);
    Template t = VelocityKit.getTemplate(tableTplName);
    StringWriter sw = new StringWriter();
    t.merge(ctx, sw);

    // 生成所有模板代码
    VelocityKit.allToFile(genConfigVO);
    // 返回预览页面代码
    String tempUrl = genConfigVO.getModuleName() + "/" + genConfigVO.getFunName() + "/list/data";
    return R.ok(sw.toString().replace(tempUrl, "sys/user/list/data"));
}
 
Example 18
Source File: JwtAuthenticationFilter.java    From spring-boot-demo with MIT License 4 votes vote down vote up
/**
 * 请求是否不需要进行权限拦截
 *
 * @param request 当前请求
 * @return true - 忽略,false - 不忽略
 */
private boolean checkIgnores(HttpServletRequest request) {
    String method = request.getMethod();

    HttpMethod httpMethod = HttpMethod.resolve(method);
    if (ObjectUtil.isNull(httpMethod)) {
        httpMethod = HttpMethod.GET;
    }

    Set<String> ignores = Sets.newHashSet();

    switch (httpMethod) {
        case GET:
            ignores.addAll(customConfig.getIgnores()
                    .getGet());
            break;
        case PUT:
            ignores.addAll(customConfig.getIgnores()
                    .getPut());
            break;
        case HEAD:
            ignores.addAll(customConfig.getIgnores()
                    .getHead());
            break;
        case POST:
            ignores.addAll(customConfig.getIgnores()
                    .getPost());
            break;
        case PATCH:
            ignores.addAll(customConfig.getIgnores()
                    .getPatch());
            break;
        case TRACE:
            ignores.addAll(customConfig.getIgnores()
                    .getTrace());
            break;
        case DELETE:
            ignores.addAll(customConfig.getIgnores()
                    .getDelete());
            break;
        case OPTIONS:
            ignores.addAll(customConfig.getIgnores()
                    .getOptions());
            break;
        default:
            break;
    }

    ignores.addAll(customConfig.getIgnores()
            .getPattern());

    if (CollUtil.isNotEmpty(ignores)) {
        for (String ignore : ignores) {
            AntPathRequestMatcher matcher = new AntPathRequestMatcher(ignore, method);
            if (matcher.matches(request)) {
                return true;
            }
        }
    }

    return false;
}
 
Example 19
Source File: AssertUtil.java    From magic-starter with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 集合是否不为空
 *
 * @param collection 待校验对象
 * @param message    异常消息
 */
public static void isNotEmpty(Collection<?> collection, String message) {
	if (CollUtil.isNotEmpty(collection)) {
		ExceptionUtil.exception(message);
	}
}
 
Example 20
Source File: AssertUtil.java    From magic-starter with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 集合是否不为空
 *
 * @param collection 待校验对象
 * @param resultCode 结果状态码
 */
public static void isNotEmpty(Collection<?> collection, IResultCode resultCode) {
	if (CollUtil.isNotEmpty(collection)) {
		ExceptionUtil.exception(resultCode);
	}
}