List<Input> inputs = ModuleTypeI18nUtil.getLocalizedInputs(i18nProvider, at.getInputs(), bundle, moduleTypeUID, locale); List<Output> outputs = ModuleTypeI18nUtil.getLocalizedOutputs(i18nProvider, at.getOutputs(), bundle, moduleTypeUID, locale); ActionType lat = null; ((CompositeActionType) at).getChildren(), bundle, moduleTypeUID, ModuleTypeI18nUtil.MODULE_TYPE, locale); lat = new CompositeActionType(moduleTypeUID, lconfigDescriptions, llabel, ldescription, at.getTags(), at.getVisibility(), inputs, outputs, modules); } else { lat = new ActionType(moduleTypeUID, lconfigDescriptions, llabel, ldescription, at.getTags(), at.getVisibility(), inputs, outputs);
public void addActionType(ActionType actionType) { modules.add(actionType.getUID()); scriptedCustomModuleTypeProvider.addModuleType(actionType); }
private static <T extends ActionTypeDTO> T map(final ActionType actionType, final T actionTypeDto) { fillProperties(actionType, actionTypeDto); actionTypeDto.inputs = actionType.getInputs(); actionTypeDto.outputs = actionType.getOutputs(); return actionTypeDto; }
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);
private ModuleType getSayActionType(Locale locale) { return new ActionType(SayActionHandler.TYPE_ID, getConfigSayDesc(locale), "say something", "Speaks a given text through a natural voice.", null, Visibility.VISIBLE, new ArrayList<>(), new ArrayList<>()); }
private boolean hasInput(ActionType moduleType, String in) { for (Input i : moduleType.getInputs()) { if (i.getName().equals(in)) { return true; } } return false; }
private boolean hasOutput(ActionType moduleType, String out) { for (Output o : moduleType.getOutputs()) { if (o.getName().equals(out)) { return true; } } return false; } }
private ModuleType getPlayActionType(Locale locale) { return new ActionType(PlayActionHandler.TYPE_ID, getConfigPlayDesc(locale), "play a sound", "Plays a sound file.", null, Visibility.VISIBLE, new ArrayList<>(), new ArrayList<>()); }
moduleTypeContent.addAll(collectRecords(columnWidths, INPUTS, ((ActionType) moduleType).getInputs())); moduleTypeContent.addAll(collectRecords(columnWidths, OUTPUTS, ((ActionType) moduleType).getOutputs()));
List<Input> inputs = type.getInputs(); // get inputs of the condition according to module type definition
throw new IllegalArgumentException(msg + " Action Type with UID \"" + typeUID + "\" does not exist!"); checkCompatibility(msg, connection, input, actionType.getOutputs()); } else { checkConnection(mtRegistry, connection, input, triggers);
public static ActionType map(CompositeActionTypeDTO actionTypeDto) { if (actionTypeDto.children == null || actionTypeDto.children.isEmpty()) { return new ActionType(actionTypeDto.uid, ConfigDescriptionDTOMapper.map(actionTypeDto.configDescriptions), actionTypeDto.label, actionTypeDto.description, actionTypeDto.tags, actionTypeDto.visibility, actionTypeDto.inputs, actionTypeDto.outputs); } else { return new CompositeActionType(actionTypeDto.uid, ConfigDescriptionDTOMapper.map(actionTypeDto.configDescriptions), actionTypeDto.label, actionTypeDto.description, actionTypeDto.tags, actionTypeDto.visibility, actionTypeDto.inputs, actionTypeDto.outputs, ActionDTOMapper.mapDto(actionTypeDto.children)); } }
ActionType at = (ActionType) mtRegistry.get(a.getTypeUID()); if (at != null) { initTagsMap(a.getId(), at.getOutputs(), actionOutputTags); if (at != null) { Set<Connection> connections = copyConnections(ma.getConnections()); for (Input input : at.getInputs()) { if (isConnected(input, connections)) { continue; // the input is already connected. Skip it.
result = method.invoke(this.actionProvider, args.toArray()); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Could not call method '{}' from module type '{}'.", method, moduleType.getUID(), e); logger.error( "The return type of action method '{}' from module type '{}' should be Map<String, Object>, because {}", method, moduleType.getUID(), ex.getMessage());
public ActionType buildModuleType(String UID, Map<String, Set<ModuleInformation>> moduleInformation) { Set<ModuleInformation> mis = moduleInformation.get(UID); List<ConfigDescriptionParameter> configDescriptions = new ArrayList<>(); if (mis != null && mis.size() > 0) { ModuleInformation mi = (ModuleInformation) mis.toArray()[0]; ActionModuleKind kind = ActionModuleKind.SINGLE; if (mi.getConfigName() != null && mi.getThingUID() != null) { logger.error( "ModuleType with UID {} has thingUID ({}) and multi-service ({}) property set, ignoring it.", UID, mi.getConfigName(), mi.getThingUID()); return null; } else if (mi.getConfigName() != null) { kind = ActionModuleKind.SERVICE; } else if (mi.getThingUID() != null) { kind = ActionModuleKind.THING; } ConfigDescriptionParameter configParam = buildConfigParam(mis, kind); if (configParam != null) { configDescriptions.add(configParam); } ActionType at = new ActionType(UID, configDescriptions, mi.getLabel(), mi.getDescription(), mi.getTags(), mi.getVisibility(), mi.getInputs(), mi.getOutputs()); return at; } return null; }