Search in sources :

Example 1 with InvalidOperationException

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;
}
Also used : FeedCategory(com.thinkbiganalytics.feedmgr.rest.model.FeedCategory) InvalidOperationException(com.thinkbiganalytics.feedmgr.InvalidOperationException)

Aggregations

InvalidOperationException (com.thinkbiganalytics.feedmgr.InvalidOperationException)1 FeedCategory (com.thinkbiganalytics.feedmgr.rest.model.FeedCategory)1