private void setAuthorizedCategories(String groupName, List<String> categoryNames) { List<OnmsCategory> categories = m_categoryDao.getCategoriesWithAuthorizedGroup(groupName); for(OnmsCategory category : categories) { category.getAuthorizedGroups().remove(groupName); } for(String categoryName : categoryNames) { OnmsCategory category = m_categoryDao.findByName(categoryName, false); if (category != null) { category.getAuthorizedGroups().add(groupName); } } } }
private void setAuthorizedCategories(String groupName, List<String> categoryNames) { List<OnmsCategory> categories = m_categoryDao.getCategoriesWithAuthorizedGroup(groupName); for(OnmsCategory category : categories) { category.getAuthorizedGroups().remove(groupName); } for(String categoryName : categoryNames) { OnmsCategory category = m_categoryDao.findByName(categoryName, false); if (category != null) { category.getAuthorizedGroups().add(groupName); } } } }
/** * <p>toString</p> * * @return a {@link java.lang.String} object. */ @Override public String toString() { return MoreObjects.toStringHelper(this) .add("id", getId()) .add("name", getName()) .add("description", getDescription()) .add("authorizedGroups", getAuthorizedGroups()) .toString(); }
@Override public Integer save(final OnmsCategory cat) { if (cat == null) return null; final String categoryName = cat.getName(); if (categoryName == null) return null; final OnmsCategory existingCategory = findByName(categoryName); if (existingCategory == null) { return super.save(cat); } else { cat.setId(existingCategory.getId()); cat.setDescription(existingCategory.getDescription()); cat.setAuthorizedGroups(existingCategory.getAuthorizedGroups()); return cat.getId(); } }
@Override public Integer save(final OnmsCategory cat) { if (cat == null) return null; final String categoryName = cat.getName(); if (categoryName == null) return null; final OnmsCategory existingCategory = findByName(categoryName); if (existingCategory == null) { return super.save(cat); } else { cat.setId(existingCategory.getId()); cat.setDescription(existingCategory.getDescription()); cat.setAuthorizedGroups(existingCategory.getAuthorizedGroups()); return cat.getId(); } }