com::cosylab::acs::laser::dao::ACSCategoryDAOImpl Class Reference

Inheritance diagram for com::cosylab::acs::laser::dao::ACSCategoryDAOImpl:
Inheritance graph
[legend]
Collaboration diagram for com::cosylab::acs::laser::dao::ACSCategoryDAOImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

Category getDefaultCategory ()
 ACSCategoryDAOImpl (Logger log, ACSAlarmDAOImpl alarmDAO)
Category findCategory (Integer identifier)
Category getCategory (Integer identifier)
Category findByCategoryTreeRoot ()
Category findBySurveillanceCategory ()
Category[] findAllCategories ()
Category findCategoryByPath (String path)
Category getCategoryByPathInitialized (String path)
Category getCategoryByPath (String path)
void saveCategory (Category category)
void updateCategory (Category category)
void deleteCategory (Category category)
String[] getAlarms (Integer categoryId)
Integer[] getChildren (Integer parentId)
alma.acs.alarmsystem.generated.Category[] loadCategories () throws Exception
void linkWithAlarms ()
void flushCategory ()
void setConfAccessor (ConfigurationAccessor conf)
void setCategoryTreeRoot (String categoryTreeRoot)
void setSurveillanceCategoryPath (String surveillanceCategoryPath)
Integer[] getAllCategoryIDs ()

Package Attributes

int nextCatID = 1
AlarmDAO alarmDao
ConfigurationAccessor conf
HashMap< String, CategorycatPathToCategory = new HashMap<String, Category>()
HashMap< Integer, Categorycategories = new HashMap<Integer, Category>()
String surveillanceCategoryPath
String categoryTreeRoot
Logger logger

Private Member Functions

void assignCategoryOfCoreAlarms ()
void assignDefaultCategory (Category defCategory)
void adjustParentIDs (String childrenName, int ID)
void setParentID (CategoryImpl cat)
void addRootCategory ()
void dumpCategories ()
void assignCategoryToAlarms (Category category, String FF)

Private Attributes

Category defaultCategory = null

Static Private Attributes

static final String CATEGORY_DEFINITION_PATH = "/Alarms/Administrative/Categories"
static final String ALARM_CATEGORY_DEFINITION_PATH = "/Alarms/Administrative/AlarmCategoryDefinitions"

Detailed Description

Read the categories from the CDB.

When the categories are available, the alarms are assigned to the categories (this complete the alarms initialization initiated by ACSAlarmDAOImpl)

See also:
ACSAlarmDAOImpl
Author:
acaproni

Constructor & Destructor Documentation

com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::ACSCategoryDAOImpl ( Logger  log,
ACSAlarmDAOImpl  alarmDAO 
) [inline]

Constructor

Parameters:
log The log (not null)

References alarmDao, and logger.


Member Function Documentation

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::addRootCategory (  )  [inline, private]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::adjustParentIDs ( String  childrenName,
int  ID 
) [inline, private]

Set the ID of this category in the children list of its parents

A category contains a list of all its children. The first category is ROOT. If a category is child of another category is inferred by its name. If a category has no parents, it is set to be a ROOT child.

Parameters:
childrenName The name of this category
ID The ID of this category

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References getCategoryByPath(), cern::laser::business::data::CategoryImpl::getChildrenIds(), logger, and cern::laser::business::data::CategoryImpl::setChildrenIds().

Referenced by loadCategories().

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::assignCategoryOfCoreAlarms (  )  [inline, private]

Assign core alarms to the root category.

See also:
LaserCoreAlarms
LaserCoreFaultState
LaserCoreFaultCodes

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References assignCategoryToAlarms(), and getCategoryByPath().

Referenced by loadCategories().

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::assignCategoryToAlarms ( Category  category,
String  FF 
) [inline, private]

Assign the category to the all the alarms of a given FaultFamily.

In the CDB each category has a list (eventually empty) of FaultFamily. If a FaultFamily appear in the definition of a Category then add such category to all the alarms of such FF.

Parameters:
category The category to assign to the alarms
FF The fault family of the alarms to assign the category to

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References alarmDao, cern::laser::business::dao::AlarmDAO::getAlarm(), cern::laser::business::data::Alarm::getAlarmId(), cern::laser::business::data::Alarm::getCategories(), cern::laser::business::data::Triplet::getFaultFamily(), cern::laser::business::data::Category::getName(), cern::laser::business::data::Alarm::getTriplet(), and logger.

Referenced by assignCategoryOfCoreAlarms(), and loadCategories().

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::assignDefaultCategory ( Category  defCategory  )  [inline, private]

Assign the default category to the alarms not assigned to any category

Scans all the alarms to check for alarms without any category and assign the default category to them.

Parameters:
defCategory The default category

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References alarmDao, categories, cern::laser::business::dao::AlarmDAO::getAlarm(), cern::laser::business::data::Alarm::getAlarmId(), cern::laser::business::data::Alarm::getCategories(), cern::laser::business::data::Category::getPath(), logger, and cern::laser::business::data::Alarm::setCategories().

Referenced by loadCategories().

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::deleteCategory ( Category  category  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::dumpCategories (  )  [inline, private]
Category [] com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::findAllCategories (  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::findByCategoryTreeRoot (  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::findBySurveillanceCategory (  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::findCategory ( Integer  identifier  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::findCategoryByPath ( String  path  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::flushCategory (  )  [inline]

Implements cern::laser::business::dao::CategoryDAO.

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References com::cosylab::acs::laser::dao::xml::AlarmCategoryLinkDefinitionListType::addAlarmCategoryLink(), com::cosylab::acs::laser::dao::xml::CategoryDefinitionListType::addCategoryDefinition(), ALARM_CATEGORY_DEFINITION_PATH, alarmDao, CATEGORY_DEFINITION_PATH, catPathToCategory, conf, cern::laser::business::dao::AlarmDAO::getAlarm(), cern::laser::business::data::CategoryImpl::getAlarmIds(), cern::laser::business::data::CategoryImpl::getDescription(), cern::laser::business::data::Triplet::getFaultCode(), cern::laser::business::data::Triplet::getFaultFamily(), cern::laser::business::data::Triplet::getFaultMember(), cern::laser::business::data::CategoryImpl::getPath(), cern::laser::business::data::Alarm::getTriplet(), com::cosylab::acs::laser::dao::ConfigurationAccessor::isWriteable(), com::cosylab::acs::laser::dao::xml::CategoryDefinitions::marshal(), com::cosylab::acs::laser::dao::xml::AlarmCategoryLinkType::setAlarm(), com::cosylab::acs::laser::dao::xml::CategoryDefinitions::setCategoriesToCreate(), com::cosylab::acs::laser::dao::xml::AlarmCategoryLinkType::setCategory(), com::cosylab::acs::laser::dao::xml::AlarmCategoryDefinitions::setCategoryLinksToCreate(), com::cosylab::acs::laser::dao::ConfigurationAccessor::setConfiguration(), com::cosylab::acs::laser::dao::xml::CategoryDefinitionType::setDescription(), com::cosylab::acs::laser::dao::xml::AlarmDefinition::setFaultCode(), com::cosylab::acs::laser::dao::xml::AlarmDefinition::setFaultFamily(), com::cosylab::acs::laser::dao::xml::AlarmDefinition::setFaultMember(), and com::cosylab::acs::laser::dao::xml::CategoryDefinition::setPath().

String [] com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getAlarms ( Integer  categoryId  )  [inline]
Integer [] com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getAllCategoryIDs (  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getCategory ( Integer  identifier  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getCategoryByPath ( String  path  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getCategoryByPathInitialized ( String  path  )  [inline]
Integer [] com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getChildren ( Integer  parentId  )  [inline]
Category com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::getDefaultCategory (  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::linkWithAlarms (  )  [inline]
alma.acs.alarmsystem.generated.Category [] com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::loadCategories (  )  throws Exception [inline]

Load the categories from the CDB.

Loads all the category from the CDB and build an internal representation of category. The category is also added to all the alarms having the fault family specified in the XML.

All the categories derive from ROOT that is built here as default (in this way the user does ot need to add the ROOT entry in the CDB).

Returns:
list of Category entries read from CDB
Exceptions:
Exception In case of error reading the values from the CDB

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References addRootCategory(), adjustParentIDs(), assignCategoryOfCoreAlarms(), assignCategoryToAlarms(), assignDefaultCategory(), categories, CATEGORY_DEFINITION_PATH, catPathToCategory, conf, defaultCategory, cern::laser::business::data::CategoryImpl::getCategoryId(), com::cosylab::acs::laser::dao::ConfigurationAccessor::getConfiguration(), cern::laser::business::data::CategoryImpl::getName(), cern::laser::business::data::Category::getPath(), cern::laser::business::data::CategoryImpl::getPath(), logger, nextCatID, cern::laser::business::data::CategoryImpl::setAlarmIds(), cern::laser::business::data::CategoryImpl::setCategoryId(), cern::laser::business::data::CategoryImpl::setChildrenIds(), cern::laser::business::data::CategoryImpl::setDescription(), cern::laser::business::data::CategoryImpl::setName(), setParentID(), and cern::laser::business::data::CategoryImpl::setPath().

Referenced by com::cosylab::cdb::jdal::hibernate::plugin::HibernateWDALAlarmPluginImpl::importAlarms(), com::cosylab::acs::laser::LaserComponent::initialize(), and com::cosylab::acs::alarm::ACSCategoryDAOTest::setUp().

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::saveCategory ( Category  category  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::setCategoryTreeRoot ( String  categoryTreeRoot  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::setConfAccessor ( ConfigurationAccessor  conf  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::setParentID ( CategoryImpl  cat  )  [inline, private]

Set the parent ID of the passed category

Each category has a parent ID that can be evaluated by reading the name of the category. If the name does not contain ':' then the parent ID is the ROOT. Otherwise its parent is the category whose name is represented by the substring before the ':'

Parameters:
cat 

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

References getCategoryByPath(), cern::laser::business::data::CategoryImpl::getCategoryId(), cern::laser::business::data::Category::getCategoryId(), cern::laser::business::data::CategoryImpl::getPath(), logger, cern::laser::business::data::CategoryImpl::setName(), cern::laser::business::data::CategoryImpl::setParentId(), and cern::laser::business::data::CategoryImpl::setPath().

Referenced by loadCategories().

void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::setSurveillanceCategoryPath ( String  surveillanceCategoryPath  )  [inline]
void com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::updateCategory ( Category  category  )  [inline]

Member Data Documentation

HashMap<Integer, Category> com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::categories = new HashMap<Integer, Category>() [package]
final String com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::CATEGORY_DEFINITION_PATH = "/Alarms/Administrative/Categories" [static, private]
HashMap<String, Category> com::cosylab::acs::laser::dao::ACSCategoryDAOImpl::catPathToCategory = new HashMap<String, Category>() [package]

The default category used to publish alarms not assigned to any category.

This is read by the CDB from the is-default attribute of a category. In the configuration files there should be only one default category but we can't consider an error if there is more then one (in this case a log message is submitted). If the default category is defined more then once, the first definition is used.

If no default category is defined another log message is submitted. In this case alarms not assigned to any category will remain unassigned.

Reimplemented in cl::utfsm::acs::acg::dao::ACSCategoryDAOImpl.

Referenced by getDefaultCategory(), and loadCategories().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2