Search in sources :

Example 1 with LocalizableException

use of com.serotonin.web.i18n.LocalizableException in project ma-core-public by infiniteautomation.

the class CompoundEventDetectorRT method initialize.

// 
// 
// /
// / Lifecycle interface
// /
// 
// 
@Override
public void initialize(boolean safe) throws LifecycleException {
    // Validate the condition statement.
    try {
        condition = parseConditionStatement(vo.getCondition());
    } catch (ConditionParseException e) {
        throw new LifecycleException(e);
    }
    try {
        condition.initialize();
    } catch (LocalizableException e) {
        throw new LifecycleException(e);
    }
    condition.initSource(this);
    // Create a convenience reference to the event type.
    eventType = new CompoundDetectorEventType(vo.getId());
    if (!vo.isReturnToNormal())
        eventType.setDuplicateHandling(EventType.DuplicateHandling.ALLOW);
    // Evaluate the current state.
    currentState = condition.evaluate();
    if (currentState)
        raiseEvent(Common.timer.currentTimeMillis());
    else
        returnToNormal(Common.timer.currentTimeMillis());
}
Also used : LifecycleException(com.serotonin.util.LifecycleException) LocalizableException(com.serotonin.web.i18n.LocalizableException) CompoundDetectorEventType(com.serotonin.m2m2.rt.event.type.CompoundDetectorEventType)

Aggregations

CompoundDetectorEventType (com.serotonin.m2m2.rt.event.type.CompoundDetectorEventType)1 LifecycleException (com.serotonin.util.LifecycleException)1 LocalizableException (com.serotonin.web.i18n.LocalizableException)1