use of com.thinkbiganalytics.feedmgr.InvalidOperationException in project kylo by Teradata.
the class InMemoryFeedManagerCategoryService method deleteCategory.
@Override
public boolean deleteCategory(String categoryId) throws InvalidOperationException {
FeedCategory category = categories.get(categoryId);
if (category != null) {
// dont allow if category has feeds on it
if (category.getRelatedFeeds() > 0) {
throw new InvalidOperationException("Unable to delete Category " + category.getName() + ". This category has " + category.getRelatedFeeds() + " feeds associated to it.");
} else {
categories.remove(categoryId);
FileObjectPersistence.getInstance().writeCategoriesToFile(categories.values());
return true;
}
}
return false;
}
Aggregations