use of org.eclipse.smarthome.config.core.ConfigDescription in project smarthome by eclipse.
the class ThingResource method normalizeConfiguration.
private Map<String, Object> normalizeConfiguration(Map<String, Object> properties, ThingTypeUID thingTypeUID, ThingUID thingUID) {
if (properties == null || properties.isEmpty()) {
return properties;
}
ThingType thingType = thingTypeRegistry.getThingType(thingTypeUID);
if (thingType == null) {
return properties;
}
List<ConfigDescription> configDescriptions = new ArrayList<>(2);
if (thingType.getConfigDescriptionURI() != null) {
ConfigDescription typeConfigDesc = configDescRegistry.getConfigDescription(thingType.getConfigDescriptionURI());
if (typeConfigDesc != null) {
configDescriptions.add(typeConfigDesc);
}
}
if (getConfigDescriptionURI(thingUID) != null) {
ConfigDescription thingConfigDesc = configDescRegistry.getConfigDescription(getConfigDescriptionURI(thingUID));
if (thingConfigDesc != null) {
configDescriptions.add(thingConfigDesc);
}
}
if (configDescriptions.isEmpty()) {
return properties;
}
return ConfigUtil.normalizeTypes(properties, configDescriptions);
}
use of org.eclipse.smarthome.config.core.ConfigDescription in project smarthome by eclipse.
the class ThingResource method normalizeConfiguration.
private Map<String, Object> normalizeConfiguration(Map<String, Object> properties, ChannelTypeUID channelTypeUID, ChannelUID channelUID) {
if (properties == null || properties.isEmpty()) {
return properties;
}
ChannelType channelType = channelTypeRegistry.getChannelType(channelTypeUID);
if (channelType == null) {
return properties;
}
List<ConfigDescription> configDescriptions = new ArrayList<>(2);
if (channelType.getConfigDescriptionURI() != null) {
ConfigDescription typeConfigDesc = configDescRegistry.getConfigDescription(channelType.getConfigDescriptionURI());
if (typeConfigDesc != null) {
configDescriptions.add(typeConfigDesc);
}
}
if (getConfigDescriptionURI(channelUID) != null) {
ConfigDescription channelConfigDesc = configDescRegistry.getConfigDescription(getConfigDescriptionURI(channelUID));
if (channelConfigDesc != null) {
configDescriptions.add(channelConfigDesc);
}
}
if (configDescriptions.isEmpty()) {
return properties;
}
return ConfigUtil.normalizeTypes(properties, configDescriptions);
}
Aggregations