use of cern.laser.client.services.selection.Selection in project ACS by ACS-Community.
the class CategoryClient method addCategories.
/**
* Add the categories to the configuration i.e. add the categories
* the client wants to listen to
*
* @param config The Configuration
* @param categories The categories to listen to
* If it is null, it adds all the categories returned
* by the alarm system component
* @throws Exception
*/
private void addCategories(Configuration config, Category[] categories) throws Exception {
if (categories == null) {
categories = alarm.getCategories();
}
if (categories.length == 0) {
logger.log(AcsLogLevel.WARNING, "No categories to connect to");
return;
}
Selection selection = config.getSelection();
CategorySelection catSel = selection.createCategorySelection();
for (Category cat : categories) {
cern.laser.business.data.CategoryImpl businessCategory = new cern.laser.business.data.CategoryImpl(cat.categoryId, cat.name, cat.description, cat.path, cat.leaf);
cern.laser.client.impl.data.CategoryImpl cImpl = new cern.laser.client.impl.data.CategoryImpl(businessCategory);
catSel.add(cImpl);
}
selection.setCategorySelection(catSel);
}
Aggregations