/** * Create the instance of the CategoryModel. */ private CategoryModel() throws IOException { CategoryFactory.init(); m_factory = CategoryFactory.getInstance(); LOG.debug("The CategoryModel object was created"); }
/** {@inheritDoc} */ @Override public Category getCategoryByLabel(String label) { return CategoryFactory.getInstance().getCategory(label); }
/** {@inheritDoc} */ @Override public Category getCategoryByLabel(String label) { return CategoryFactory.getInstance().getCategory(label); }
/** * Create the instance of the CategoryModel. */ private CategoryModel() throws IOException { CategoryFactory.init(); m_factory = CategoryFactory.getInstance(); LOG.debug("The CategoryModel object was created"); }
/** * <p>findAll</p> * * @return a {@link java.util.Collection} object. */ @Override public Collection<Category> findAll() { List<Category> catList = new ArrayList<>(); Catinfo catInfo = CategoryFactory.getInstance().getConfig(); List<CategoryGroup> catGroupList = catInfo.getCategoryGroups(); if (catGroupList != null) { for (final CategoryGroup cg : catGroupList) { catList.addAll(cg.getCategories()); } } return catList; } }
/** * <p>findAll</p> * * @return a {@link java.util.Collection} object. */ @Override public Collection<Category> findAll() { List<Category> catList = new ArrayList<>(); Catinfo catInfo = CategoryFactory.getInstance().getConfig(); List<CategoryGroup> catGroupList = catInfo.getCategoryGroups(); if (catGroupList != null) { for (final CategoryGroup cg : catGroupList) { catList.addAll(cg.getCategories()); } } return catList; } }
@Override protected void setUp() throws Exception { super.setUp(); m_mockCatFactory = new MockCategoryFactory(MOCK_CATEGORY_CONFIG); CategoryFactory.setInstance(m_mockCatFactory); m_catFactory = CategoryFactory.getInstance(); }
try { CategoryFactory.init(); m_catFactory = CategoryFactory.getInstance(); config = m_catFactory.getConfig(); } catch (IOException e) {
try { CategoryFactory.init(); m_catFactory = CategoryFactory.getInstance(); config = m_catFactory.getConfig(); } catch (IOException e) {
/** * Creates the categories map. Reads the categories from the categories.xml * and creates the 'RTCCategory's map */ public static HashMap<String, RTCCategory> createCategoriesMap() { CatFactory cFactory = null; try { CategoryFactory.init(); cFactory = CategoryFactory.getInstance(); } catch (IOException ex) { LOG.error("Failed to load categories information", ex); throw new UndeclaredThrowableException(ex); } HashMap<String, RTCCategory> retval = new HashMap<String, RTCCategory>(); cFactory.getReadLock().lock(); try { for (CategoryGroup cg : cFactory.getConfig().getCategoryGroups()) { final String commonRule = cg.getCommon().getRule(); for (final org.opennms.netmgt.config.categories.Category cat : cg.getCategories()) { RTCCategory rtcCat = new RTCCategory(cat, commonRule); retval.put(rtcCat.getLabel(), rtcCat); } } } finally { cFactory.getReadLock().unlock(); } return retval; }
try { CategoryFactory.init(); m_catFactory = CategoryFactory.getInstance(); } catch (final Exception e) { LOG.error("Failed to initialize CategoryFactory", e);
try { CategoryFactory.init(); m_catFactory = CategoryFactory.getInstance(); } catch (final Exception e) { LOG.error("Failed to initialize CategoryFactory", e);