@Override public Set<CategoryOptionGroup> getCogDimensionConstraints( UserCredentials userCredentials ) { Set<CategoryOptionGroup> groups = null; Set<CategoryOptionGroupSet> cogsConstraints = userCredentials.getCogsDimensionConstraints(); if ( cogsConstraints != null && !cogsConstraints.isEmpty() ) { groups = new HashSet<>(); for ( CategoryOptionGroupSet cogs : cogsConstraints ) { groups.addAll( getCategoryOptionGroups( cogs ) ); } } return groups; }
/** * Can the user read from this CategoryOptionGroupSet (COGS)? * <p> * If the COGS is null, then the user must have no dimension constraints. * (In other words, the user must be able to read across all category * option groups.) * <p> * If the COGS is not null, then the user must be able to read at least * one category option group from the category option group set. * * @param cogs The category option group set to test * @return true if user can read at least one category option group. */ private boolean canReadCOGS( User user, CategoryOptionGroupSet cogs ) { if ( cogs == null ) { UserCredentials userCredentials = user.getUserCredentials(); return CollectionUtils.isEmpty( userCredentials.getCogsDimensionConstraints() ) && CollectionUtils.isEmpty( userCredentials.getCatDimensionConstraints() ); } return !CollectionUtils.isEmpty( categoryService.getCategoryOptionGroups( cogs ) ); }
Set<CategoryOptionGroupSet> cogDimensionConstraints = user.getUserCredentials().getCogsDimensionConstraints(); Set<Category> catDimensionConstraints = user.getUserCredentials().getCatDimensionConstraints();
Set<CategoryOptionGroupSet> cogsets = user.getUserCredentials().getCogsDimensionConstraints();
( CollectionUtils.isEmpty( user.getUserCredentials().getCogsDimensionConstraints() ) && CollectionUtils.isEmpty( user.getUserCredentials().getCatDimensionConstraints() ) );