Search in sources :

Example 1 with Selection

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);
}
Also used : CategoryImpl(cern.laser.business.data.CategoryImpl) CategorySelection(cern.laser.client.services.selection.CategorySelection) Category(alma.alarmsystem.Category) CategoryImpl(cern.laser.business.data.CategoryImpl) CategorySelection(cern.laser.client.services.selection.CategorySelection) Selection(cern.laser.client.services.selection.Selection)

Aggregations

Category (alma.alarmsystem.Category)1 CategoryImpl (cern.laser.business.data.CategoryImpl)1 CategorySelection (cern.laser.client.services.selection.CategorySelection)1 Selection (cern.laser.client.services.selection.Selection)1