@Override public Set<CategoryOption> getCoDimensionConstraints( UserCredentials userCredentials ) { Set<CategoryOption> options = null; Set<Category> catConstraints = userCredentials.getCatDimensionConstraints(); if ( catConstraints != null && !catConstraints.isEmpty() ) { options = new HashSet<>(); for ( Category category : catConstraints ) { options.addAll( getCategoryOptions( category ) ); } } return options; }
/** * 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<Category> catDimensionConstraints = user.getUserCredentials().getCatDimensionConstraints();
Set<Category> categories = user.getUserCredentials().getCatDimensionConstraints();
&& CollectionUtils.isEmpty( user.getUserCredentials().getCatDimensionConstraints() ) );