Search in sources :

Example 6 with ModuleHandler

use of org.eclipse.smarthome.automation.handler.ModuleHandler in project smarthome by eclipse.

the class CompositeModuleHandlerFactory method ungetHandler.

@SuppressWarnings({ "unchecked" })
@Override
public void ungetHandler(Module module, String childModulePrefix, ModuleHandler handler) {
    ModuleHandler handlerOfModule = getHandlers().get(childModulePrefix + module.getId());
    if (handlerOfModule instanceof AbstractCompositeModuleHandler) {
        AbstractCompositeModuleHandler<Module, ?, ?> h = (AbstractCompositeModuleHandler<Module, ?, ?>) handlerOfModule;
        Set<Module> modules = h.moduleHandlerMap.keySet();
        if (modules != null) {
            for (Module child : modules) {
                ModuleHandler childHandler = h.moduleHandlerMap.get(child);
                ModuleHandlerFactory mhf = ruleEngine.getModuleHandlerFactory(child.getTypeUID());
                mhf.ungetHandler(child, childModulePrefix + ":" + module.getId(), childHandler);
            }
        }
    }
    String ruleId = getRuleId(childModulePrefix);
    super.ungetHandler(module, ruleId, handler);
}
Also used : ModuleHandler(org.eclipse.smarthome.automation.handler.ModuleHandler) BaseModuleHandlerFactory(org.eclipse.smarthome.automation.handler.BaseModuleHandlerFactory) ModuleHandlerFactory(org.eclipse.smarthome.automation.handler.ModuleHandlerFactory) Module(org.eclipse.smarthome.automation.Module)

Aggregations

ModuleHandler (org.eclipse.smarthome.automation.handler.ModuleHandler)6 Action (org.eclipse.smarthome.automation.Action)2 Trigger (org.eclipse.smarthome.automation.Trigger)2 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Module (org.eclipse.smarthome.automation.Module)1 ActionHandler (org.eclipse.smarthome.automation.handler.ActionHandler)1 BaseModuleHandlerFactory (org.eclipse.smarthome.automation.handler.BaseModuleHandlerFactory)1 ConditionHandler (org.eclipse.smarthome.automation.handler.ConditionHandler)1 ModuleHandlerFactory (org.eclipse.smarthome.automation.handler.ModuleHandlerFactory)1 TriggerHandler (org.eclipse.smarthome.automation.handler.TriggerHandler)1 ScriptedHandler (org.eclipse.smarthome.automation.module.script.rulesupport.shared.ScriptedHandler)1 CompositeActionType (org.eclipse.smarthome.automation.type.CompositeActionType)1 CompositeConditionType (org.eclipse.smarthome.automation.type.CompositeConditionType)1 CompositeTriggerType (org.eclipse.smarthome.automation.type.CompositeTriggerType)1 ModuleType (org.eclipse.smarthome.automation.type.ModuleType)1