public void removeAllCategoryOptions() { for ( CategoryOption categoryOption : categoryOptions ) { categoryOption.getCategories().remove( this ); } categoryOptions.clear(); }
public void addCategoryOption( CategoryOption categoryOption ) { categoryOptions.add( categoryOption ); categoryOption.getCategories().add( this ); }
public void removeCategoryOption( CategoryOption categoryOption ) { categoryOptions.remove( categoryOption ); categoryOption.getCategories().remove( this ); }
@Override public void deleteCategory( Category category ) { for ( CategoryOption categoryOption : category.getCategoryOptions() ) { categoryOption.getCategories().remove( category ); idObjectManager.updateNoAcl( categoryOption ); } } }
@Override public void deleteCategoryOption( CategoryOption categoryOption ) { Set<Category> categories = categoryOption.getCategories(); for ( Category category : categories ) { category.removeCategoryOption( categoryOption ); idObjectManager.updateNoAcl( category ); } } }
/** * Returns whether a user can read a data element category option * given the user's category constraints, if any. * <p> * If the option belongs to *any* category that is constrained for the user, * and the option is readable by the user, return true. * * @param user the user. * @param option the data element category option to test. * @param catDimensionConstraints category constraints, if any. * @return whether the user can read the data element category option. */ private boolean isOptionCatConstraintReadable( User user, CategoryOption option, Set<Category> catDimensionConstraints ) { if ( CollectionUtils.isEmpty( catDimensionConstraints ) ) { return true; // No category dimension constraints. } return !CollectionUtils.intersection ( catDimensionConstraints, option.getCategories() ).isEmpty() && aclService.canRead( user, option ); } }