Search in sources :

Example 1 with ConfigDescriptionParameterDTO

use of org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterDTO in project smarthome by eclipse.

the class ChannelTypeResource method convertToChannelTypeDTO.

private ChannelTypeDTO convertToChannelTypeDTO(ChannelType channelType, Locale locale) {
    final ConfigDescription configDescription;
    if (channelType.getConfigDescriptionURI() != null) {
        configDescription = this.configDescriptionRegistry.getConfigDescription(channelType.getConfigDescriptionURI(), locale);
    } else {
        configDescription = null;
    }
    List<ConfigDescriptionParameterDTO> parameters;
    List<ConfigDescriptionParameterGroupDTO> parameterGroups;
    if (configDescription != null) {
        ConfigDescriptionDTO configDescriptionDTO = ConfigDescriptionDTOMapper.map(configDescription);
        parameters = configDescriptionDTO.parameters;
        parameterGroups = configDescriptionDTO.parameterGroups;
    } else {
        parameters = new ArrayList<>(0);
        parameterGroups = new ArrayList<>(0);
    }
    return new ChannelTypeDTO(channelType.getUID().toString(), channelType.getLabel(), channelType.getDescription(), channelType.getCategory(), channelType.getItemType(), channelType.getKind(), parameters, parameterGroups, channelType.getState(), channelType.getTags(), channelType.isAdvanced());
}
Also used : ConfigDescriptionParameterDTO(org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterDTO) ConfigDescriptionParameterGroupDTO(org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterGroupDTO) ConfigDescriptionDTO(org.eclipse.smarthome.config.core.dto.ConfigDescriptionDTO) ChannelTypeDTO(org.eclipse.smarthome.core.thing.dto.ChannelTypeDTO) ConfigDescription(org.eclipse.smarthome.config.core.ConfigDescription)

Example 2 with ConfigDescriptionParameterDTO

use of org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterDTO in project smarthome by eclipse.

the class ThingTypeResource method convertToThingTypeDTO.

private ThingTypeDTO convertToThingTypeDTO(ThingType thingType, Locale locale) {
    final ConfigDescription configDescription;
    if (thingType.getConfigDescriptionURI() != null) {
        configDescription = this.configDescriptionRegistry.getConfigDescription(thingType.getConfigDescriptionURI(), locale);
    } else {
        configDescription = null;
    }
    List<ConfigDescriptionParameterDTO> parameters;
    List<ConfigDescriptionParameterGroupDTO> parameterGroups;
    if (configDescription != null) {
        ConfigDescriptionDTO configDescriptionDTO = ConfigDescriptionDTOMapper.map(configDescription);
        parameters = configDescriptionDTO.parameters;
        parameterGroups = configDescriptionDTO.parameterGroups;
    } else {
        parameters = new ArrayList<>(0);
        parameterGroups = new ArrayList<>(0);
    }
    final List<ChannelDefinitionDTO> channelDefinitions = convertToChannelDefinitionDTOs(thingType.getChannelDefinitions(), locale);
    if (channelDefinitions == null) {
        return null;
    }
    return new ThingTypeDTO(thingType.getUID().toString(), thingType.getLabel(), thingType.getDescription(), thingType.getCategory(), thingType.isListed(), parameters, channelDefinitions, convertToChannelGroupDefinitionDTOs(thingType.getChannelGroupDefinitions(), locale), thingType.getSupportedBridgeTypeUIDs(), thingType.getProperties(), thingType instanceof BridgeType, parameterGroups, thingType.getExtensibleChannelTypeIds());
}
Also used : ConfigDescriptionParameterDTO(org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterDTO) ConfigDescriptionParameterGroupDTO(org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterGroupDTO) ConfigDescriptionDTO(org.eclipse.smarthome.config.core.dto.ConfigDescriptionDTO) ChannelDefinitionDTO(org.eclipse.smarthome.core.thing.dto.ChannelDefinitionDTO) ThingTypeDTO(org.eclipse.smarthome.core.thing.dto.ThingTypeDTO) StrippedThingTypeDTO(org.eclipse.smarthome.core.thing.dto.StrippedThingTypeDTO) ConfigDescription(org.eclipse.smarthome.config.core.ConfigDescription) BridgeType(org.eclipse.smarthome.core.thing.type.BridgeType)

Aggregations

ConfigDescription (org.eclipse.smarthome.config.core.ConfigDescription)2 ConfigDescriptionDTO (org.eclipse.smarthome.config.core.dto.ConfigDescriptionDTO)2 ConfigDescriptionParameterDTO (org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterDTO)2 ConfigDescriptionParameterGroupDTO (org.eclipse.smarthome.config.core.dto.ConfigDescriptionParameterGroupDTO)2 ChannelDefinitionDTO (org.eclipse.smarthome.core.thing.dto.ChannelDefinitionDTO)1 ChannelTypeDTO (org.eclipse.smarthome.core.thing.dto.ChannelTypeDTO)1 StrippedThingTypeDTO (org.eclipse.smarthome.core.thing.dto.StrippedThingTypeDTO)1 ThingTypeDTO (org.eclipse.smarthome.core.thing.dto.ThingTypeDTO)1 BridgeType (org.eclipse.smarthome.core.thing.type.BridgeType)1