/** {@inheritDoc} */ @Override public Category getCategoryByLabel(String label) { return CategoryFactory.getInstance().getCategory(label); }
/** {@inheritDoc} */ @Override public Category getCategoryByLabel(String label) { return CategoryFactory.getInstance().getCategory(label); }
/** * Look up the category definition and return the category's description. * * @param categoryName a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ public String getCategoryComment(final String categoryName) { if (categoryName == null) { throw new IllegalArgumentException("Cannot take null parameters."); } String comment = null; m_factory.getReadLock().lock(); try { org.opennms.netmgt.config.categories.Category category = m_factory.getCategory(categoryName); if (category != null) { comment = category.getComment().orElse(null); } } finally { m_factory.getReadLock().unlock(); } return comment; }
/** * Update a category with new values. * * @param rtcCategory a {@link org.opennms.netmgt.xml.rtc.Category} object. */ public void updateCategory(final org.opennms.netmgt.xml.rtc.Category rtcCategory) { if (rtcCategory == null) { throw new IllegalArgumentException("Cannot take null parameters."); } final String categoryName = rtcCategory.getCatlabel(); m_factory.getWriteLock().lock(); try { org.opennms.netmgt.config.categories.Category categoryDef = m_factory.getCategory(categoryName); org.opennms.web.category.Category category = new org.opennms.web.category.Category(categoryDef, rtcCategory, new Date()); synchronized (m_categoryMap) { m_categoryMap.put(categoryName, category); } } finally { m_factory.getWriteLock().unlock(); } LOG.debug("{} was updated", categoryName); }
/** * Look up the category definition and return the category's description. * * @param categoryName a {@link java.lang.String} object. * @return a {@link java.lang.String} object. */ public String getCategoryComment(final String categoryName) { if (categoryName == null) { throw new IllegalArgumentException("Cannot take null parameters."); } String comment = null; m_factory.getReadLock().lock(); try { org.opennms.netmgt.config.categories.Category category = m_factory.getCategory(categoryName); if (category != null) { comment = category.getComment().orElse(null); } } finally { m_factory.getReadLock().unlock(); } return comment; }
/** * Update a category with new values. * * @param rtcCategory a {@link org.opennms.netmgt.xml.rtc.Category} object. */ public void updateCategory(final org.opennms.netmgt.xml.rtc.Category rtcCategory) { if (rtcCategory == null) { throw new IllegalArgumentException("Cannot take null parameters."); } final String categoryName = rtcCategory.getCatlabel(); m_factory.getWriteLock().lock(); try { org.opennms.netmgt.config.categories.Category categoryDef = m_factory.getCategory(categoryName); org.opennms.web.category.Category category = new org.opennms.web.category.Category(categoryDef, rtcCategory, new Date()); synchronized (m_categoryMap) { m_categoryMap.put(categoryName, category); } } finally { m_factory.getWriteLock().unlock(); } LOG.debug("{} was updated", categoryName); }
org.opennms.netmgt.config.categories.Category cat = (org.opennms.netmgt.config.categories.Category) m_catFactory.getCategory(categoryName); LOG.debug("CATEGORY - now populating data structures {}", cat.getLabel()); populateDataStructures(cat, report, format, monthFormat, 1);
org.opennms.netmgt.config.categories.Category cat = (org.opennms.netmgt.config.categories.Category) m_catFactory.getCategory(categoryName); LOG.debug("CATEGORY - now populating data structures {}", cat.getLabel()); populateDataStructures(cat, report, format, monthFormat, 1);
public void testGetCategory() { Category category = m_catFactory.getCategory(CATLABEL); assertEquals(99,category.getNormalThreshold(),0); assertEquals(97,category.getWarningThreshold(),0); assertTrue(category.getComment().isPresent()); assertEquals(CATCOMMENT,category.getComment().get()); assertEquals(CATRULE,category.getRule()); assertEquals("ICMP",category.getServices().get(0)); assertEquals("SNMP",category.getServices().get(1)); }