Search in sources :

Example 1 with ModuleType

use of org.eclipse.smarthome.automation.type.ModuleType in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method getActions.

@Override
public Collection<ActionType> getActions(Locale locale, String... tags) {
    Collection<ModuleType> moduleTypes = getByTags(locale, tags);
    Collection<ActionType> actionTypes = new ArrayList<ActionType>();
    for (ModuleType mt : moduleTypes) {
        if (mt instanceof ActionType) {
            actionTypes.add((ActionType) mt);
        }
    }
    return actionTypes;
}
Also used : ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ActionType(org.eclipse.smarthome.automation.type.ActionType) CompositeActionType(org.eclipse.smarthome.automation.type.CompositeActionType) ArrayList(java.util.ArrayList)

Example 2 with ModuleType

use of org.eclipse.smarthome.automation.type.ModuleType in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method getTriggers.

@Override
public Collection<TriggerType> getTriggers(String... tags) {
    Collection<ModuleType> moduleTypes = getByTags(tags);
    Collection<TriggerType> triggerTypes = new ArrayList<TriggerType>();
    for (ModuleType mt : moduleTypes) {
        if (mt instanceof TriggerType) {
            triggerTypes.add((TriggerType) mt);
        }
    }
    return triggerTypes;
}
Also used : CompositeTriggerType(org.eclipse.smarthome.automation.type.CompositeTriggerType) TriggerType(org.eclipse.smarthome.automation.type.TriggerType) ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ArrayList(java.util.ArrayList)

Example 3 with ModuleType

use of org.eclipse.smarthome.automation.type.ModuleType in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method getTriggers.

@Override
public Collection<TriggerType> getTriggers(Locale locale, String... tags) {
    Collection<ModuleType> moduleTypes = getByTags(locale, tags);
    Collection<TriggerType> triggerTypes = new ArrayList<TriggerType>();
    for (ModuleType mt : moduleTypes) {
        if (mt instanceof TriggerType) {
            triggerTypes.add((TriggerType) mt);
        }
    }
    return triggerTypes;
}
Also used : CompositeTriggerType(org.eclipse.smarthome.automation.type.CompositeTriggerType) TriggerType(org.eclipse.smarthome.automation.type.TriggerType) ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ArrayList(java.util.ArrayList)

Example 4 with ModuleType

use of org.eclipse.smarthome.automation.type.ModuleType in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method createCopy.

private ModuleType createCopy(ModuleType mType) {
    if (mType == null) {
        return null;
    }
    ModuleType result;
    if (mType instanceof CompositeTriggerType) {
        CompositeTriggerType m = (CompositeTriggerType) mType;
        result = new CompositeTriggerType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getOutputs(), copyTriggers(m.getChildren()));
    } else if (mType instanceof TriggerType) {
        TriggerType m = (TriggerType) mType;
        result = new TriggerType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getOutputs());
    } else if (mType instanceof CompositeConditionType) {
        CompositeConditionType m = (CompositeConditionType) mType;
        result = new CompositeConditionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), copyConditions(m.getChildren()));
    } else if (mType instanceof ConditionType) {
        ConditionType m = (ConditionType) mType;
        result = new ConditionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs());
    } else if (mType instanceof CompositeActionType) {
        CompositeActionType m = (CompositeActionType) mType;
        result = new CompositeActionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), m.getOutputs(), copyActions(m.getChildren()));
    } else if (mType instanceof ActionType) {
        ActionType m = (ActionType) mType;
        result = new ActionType(mType.getUID(), mType.getConfigurationDescriptions(), mType.getLabel(), mType.getDescription(), mType.getTags(), mType.getVisibility(), m.getInputs(), m.getOutputs());
    } else {
        throw new IllegalArgumentException("Invalid template type:" + mType);
    }
    return result;
}
Also used : CompositeTriggerType(org.eclipse.smarthome.automation.type.CompositeTriggerType) CompositeTriggerType(org.eclipse.smarthome.automation.type.CompositeTriggerType) TriggerType(org.eclipse.smarthome.automation.type.TriggerType) ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ActionType(org.eclipse.smarthome.automation.type.ActionType) CompositeActionType(org.eclipse.smarthome.automation.type.CompositeActionType) CompositeConditionType(org.eclipse.smarthome.automation.type.CompositeConditionType) CompositeConditionType(org.eclipse.smarthome.automation.type.CompositeConditionType) ConditionType(org.eclipse.smarthome.automation.type.ConditionType) CompositeActionType(org.eclipse.smarthome.automation.type.CompositeActionType)

Example 5 with ModuleType

use of org.eclipse.smarthome.automation.type.ModuleType in project smarthome by eclipse.

the class ModuleTypeRegistryImpl method getConditions.

@Override
public Collection<ConditionType> getConditions(Locale locale, String... tags) {
    Collection<ModuleType> moduleTypes = getByTags(locale, tags);
    Collection<ConditionType> conditionTypes = new ArrayList<ConditionType>();
    for (ModuleType mt : moduleTypes) {
        if (mt instanceof ConditionType) {
            conditionTypes.add((ConditionType) mt);
        }
    }
    return conditionTypes;
}
Also used : ModuleType(org.eclipse.smarthome.automation.type.ModuleType) ArrayList(java.util.ArrayList) CompositeConditionType(org.eclipse.smarthome.automation.type.CompositeConditionType) ConditionType(org.eclipse.smarthome.automation.type.ConditionType)

Aggregations

ModuleType (org.eclipse.smarthome.automation.type.ModuleType)18 ArrayList (java.util.ArrayList)11 CompositeActionType (org.eclipse.smarthome.automation.type.CompositeActionType)5 CompositeConditionType (org.eclipse.smarthome.automation.type.CompositeConditionType)5 CompositeTriggerType (org.eclipse.smarthome.automation.type.CompositeTriggerType)5 ActionType (org.eclipse.smarthome.automation.type.ActionType)4 ConditionType (org.eclipse.smarthome.automation.type.ConditionType)4 TriggerType (org.eclipse.smarthome.automation.type.TriggerType)4 ParsingException (org.eclipse.smarthome.automation.parser.ParsingException)3 ParsingNestedException (org.eclipse.smarthome.automation.parser.ParsingNestedException)3 List (java.util.List)2 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 BufferedInputStream (java.io.BufferedInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1