Search in sources :

Example 66 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method getAlarmsBySource.

/*
   * (non-Javadoc)
   * 
   * @see cern.laser.business.ejb.CoreServiceSessionEJB#getAlarmsBySource(java.lang.Integer)
   */
public Collection getAlarmsBySource(String sourceId) {
    Collection result = null;
    try {
        String[] alarms = sourceDAO.getAlarms(sourceId);
        result = new ArrayList(alarms.length);
        for (int i = 0; i < alarms.length; i++) {
            Alarm alarm = alarmCache.getReference(alarms[i]);
            result.add(alarm);
        }
    } catch (Exception e) {
        LOGGER.error("unable to get alarms by source " + sourceId, e);
    //throw new EJBException("unable to get alarms by source " + sourceId, e);
    }
    return result;
}
Also used : Alarm(cern.laser.business.data.Alarm) ArrayList(java.util.ArrayList) Collection(java.util.Collection) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserProcessingException(cern.laser.business.LaserProcessingException) AlarmCacheException(cern.laser.business.cache.AlarmCacheException)

Example 67 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method getMultiplicityThreshold.

/*
   * (non-Javadoc)
   * 
   * @see cern.laser.business.ejb.CoreServiceSessionEJB#getMultiplicityThreshold(java.lang.Integer)
   */
public Integer getMultiplicityThreshold(String parentId) {
    Integer result = new Integer(0);
    try {
        Alarm parent = alarmCache.getReference(parentId);
        result = parent.getMultiplicityThreshold();
    } catch (AlarmCacheException onf) {
        LOGGER.warn("multiplicity parent " + parentId + " not found");
    } catch (Exception e) {
        LOGGER.error("unable to get multiplicity threshold for " + parentId, e);
    //throw new EJBException("unable to get multiplicity threshold for " + parentId, e);
    }
    return result;
}
Also used : Alarm(cern.laser.business.data.Alarm) AlarmCacheException(cern.laser.business.cache.AlarmCacheException) LaserRuntimeException(cern.laser.business.LaserRuntimeException) LaserProcessingException(cern.laser.business.LaserProcessingException) AlarmCacheException(cern.laser.business.cache.AlarmCacheException)

Example 68 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class CoreServiceImpl method archiveSearch.

/**
   * @param categoryIds
   * @param sql
   * @param clientId
   */
public void archiveSearch(Integer[] categoryIds, String sql, String clientId) {
    String destination = getSearchRootTopic() + "." + clientId;
    String category_constraints = buildCategorySQLFilter(categoryIds);
    String select_sql = "select alarm_id from alarm_definition where " + sql + " and alarm_id in " + "(select alarm_id from alarm_category where " + category_constraints + ")";
    if (LOGGER.isDebugEnabled())
        LOGGER.debug("search sql " + select_sql);
    Collection search_result = alarmDAO.archiveSearch(select_sql);
    Collection found_alarms = new ArrayList(search_result.size());
    try {
        for (Iterator iter = search_result.iterator(); iter.hasNext(); ) {
            Alarm alarm = alarmCache.getReference((String) iter.next());
            found_alarms.add(alarm);
        }
    } catch (AlarmCacheException e) {
        throw new LaserRuntimeException("unable to search alarms", e);
    }
    alarmPublisher.sendSearch(found_alarms, destination);
}
Also used : Alarm(cern.laser.business.data.Alarm) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Collection(java.util.Collection) AlarmCacheException(cern.laser.business.cache.AlarmCacheException) LaserRuntimeException(cern.laser.business.LaserRuntimeException)

Example 69 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class ACSAlarmCacheImpl method getCopy.

public Alarm getCopy(String identifier) throws AlarmCacheException {
    // This method get the reference to the object first and then
    // create a copy to return to the caller
    // The Alarm to return a copy of
    lock.lock();
    Alarm retAl;
    try {
        retAl = getReference(identifier);
        return (Alarm) (((AlarmImpl) retAl).clone());
    } finally {
        lock.unlock();
    }
}
Also used : Alarm(cern.laser.business.data.Alarm) AlarmImpl(cern.laser.business.data.AlarmImpl)

Example 70 with Alarm

use of cern.laser.business.data.Alarm in project ACS by ACS-Community.

the class ACSCategoryDAOImpl method assignCategoryToAlarms.

/**
	 * 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.
	 *   
	 *  @param category The category to assign to the alarms
	 *  @param FF The fault family of the alarms to assign the category to
	 */
private void assignCategoryToAlarms(Category category, String FF) {
    if (category == null) {
        throw new IllegalArgumentException("Invalid null category");
    }
    if (FF == null) {
        throw new IllegalArgumentException("Invalid null fault family");
    }
    String[] alarmIDs = ((ACSAlarmDAOImpl) alarmDao).getAllAlarmIDs();
    for (String id : alarmIDs) {
        Alarm alarm = alarmDao.getAlarm(id);
        if (alarm == null) {
            logger.log(AcsLogLevel.WARNING, "Got a null alarm for ID=" + id);
            continue;
        }
        if (alarm.getTriplet().getFaultFamily().equals(FF)) {
            Collection<Category> alarmCategories = alarm.getCategories();
            if (!alarmCategories.contains(category)) {
                alarmCategories.add(category);
                logger.log(AcsLogLevel.DEBUG, "Category " + category.getName() + " assigned to alarm " + alarm.getAlarmId());
            }
        }
    }
}
Also used : Category(cern.laser.business.data.Category) Alarm(cern.laser.business.data.Alarm)

Aggregations

Alarm (cern.laser.business.data.Alarm)91 AlarmCacheException (cern.laser.business.cache.AlarmCacheException)24 LaserRuntimeException (cern.laser.business.LaserRuntimeException)21 ArrayList (java.util.ArrayList)21 Category (cern.laser.business.data.Category)16 Collection (java.util.Collection)14 AlarmImpl (cern.laser.business.data.AlarmImpl)13 LaserDefinitionNotValidException (cern.laser.business.definition.LaserDefinitionNotValidException)12 AdminUser (cern.laser.business.data.AdminUser)11 AlarmDefinition (alma.alarmsystem.alarmmessage.generated.AlarmDefinition)10 LaserDefinitionDuplicationException (cern.laser.business.definition.LaserDefinitionDuplicationException)10 LaserDefinitionNotFoundException (cern.laser.business.definition.LaserDefinitionNotFoundException)10 Iterator (java.util.Iterator)10 LaserProcessingException (cern.laser.business.LaserProcessingException)9 LaserDefinitionNotAllowedException (cern.laser.business.definition.LaserDefinitionNotAllowedException)9 LaserObjectNotFoundException (cern.laser.business.LaserObjectNotFoundException)7 ReductionRule (cl.utfsm.acs.acg.core.ReductionRule)7 FaultCode (alma.acs.alarmsystem.generated.FaultCode)6 FaultFamily (alma.acs.alarmsystem.generated.FaultFamily)6 FaultMember (alma.acs.alarmsystem.generated.FaultMember)6