Search in sources :

Example 1 with Category

use of cern.laser.client.data.Category in project ACS by ACS-Community.

the class AlarmSearchHelper method getCategoryIds.

private Integer[] getCategoryIds(Selection selection) throws LaserConnectionException, LaserException {
    Category[] categories = selection.getCategorySelection().list();
    Collection category_ids = new ArrayList(categories.length);
    for (int i = 0; i < categories.length; i++) {
        category_ids.add(categories[i].getCategoryId());
    }
    return (Integer[]) category_ids.toArray(new Integer[category_ids.size()]);
}
Also used : Category(cern.laser.client.data.Category) ArrayList(java.util.ArrayList) Collection(java.util.Collection)

Example 2 with Category

use of cern.laser.client.data.Category in project ACS by ACS-Community.

the class AlarmSelectionHelper method setupCategorySubscriptions.

private Collection setupCategorySubscriptions(Selection selection, String sql_filter) throws LaserConnectionException, LaserException {
    Category[] categories = selection.getCategorySelection().list();
    Collection category_ids = new ArrayList(categories.length);
    for (int i = 0; i < categories.length; i++) {
        Category category = categories[i];
        String topic = getCategoryRootTopic() + "." + category.getPath();
        if (selectionListener != null) {
            try {
                getSubscriber().subscribe(topic, this, sql_filter);
            } catch (Exception e1) {
                new LaserException("unable to subscribe to topic " + topic, e1);
            }
        }
        category_ids.add(category.getCategoryId());
    }
    return category_ids;
}
Also used : Category(cern.laser.client.data.Category) ArrayList(java.util.ArrayList) Collection(java.util.Collection) LaserConnectionException(cern.laser.client.LaserConnectionException) LaserException(cern.laser.client.LaserException) UnknownHostException(java.net.UnknownHostException) JMSException(javax.jms.JMSException) MOMException(cern.cmw.mom.pubsub.MOMException) LaserSelectionException(cern.laser.client.services.selection.LaserSelectionException) LaserTimeOutException(cern.laser.client.LaserTimeOutException) LaserException(cern.laser.client.LaserException)

Aggregations

Category (cern.laser.client.data.Category)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 MOMException (cern.cmw.mom.pubsub.MOMException)1 LaserConnectionException (cern.laser.client.LaserConnectionException)1 LaserException (cern.laser.client.LaserException)1 LaserTimeOutException (cern.laser.client.LaserTimeOutException)1 LaserSelectionException (cern.laser.client.services.selection.LaserSelectionException)1 UnknownHostException (java.net.UnknownHostException)1 JMSException (javax.jms.JMSException)1