private boolean channelTypeDefinesDimension(@Nullable ChannelTypeUID channelTypeUID) { if (channelTypeUID == null) { return false; } ChannelType channelType = channelTypeRegistry.getChannelType(channelTypeUID); return channelType != null && getDimension(channelType.getItemType()) != null; }
private boolean stateProfileMatchesProfileType(ProfileType profileType, ChannelType channelType) { if (profileType instanceof StateProfileType) { StateProfileType stateProfileType = (StateProfileType) profileType; if (stateProfileType.getSupportedItemTypesOfChannel().size() == 0) { return true; } Collection<String> supportedItemTypesOfChannelOnProfileType = stateProfileType .getSupportedItemTypesOfChannel(); if (supportedItemTypesOfChannelOnProfileType.contains(ItemUtil.getMainItemType(channelType.getItemType())) || supportedItemTypesOfChannelOnProfileType.contains(channelType.getItemType())) { return true; } } return false; }
ChannelType channelType = channelTypeRegistry.getChannelType(channel.getChannelTypeUID()); String acceptedItemTypeFromChannelType = channelType != null ? channelType.getItemType() : null; @Nullable QuantityType<?> quantityType = convertToQuantityType((DecimalType) originalType, item,
if (channelType != null) { stateDescription = channelType.getState(); if ((channelType.getItemType() != null) && ((stateDescription == null) || (stateDescription.getPattern() == null))) { String pattern = null; if (channelType.getItemType().equalsIgnoreCase(CoreItemFactory.STRING)) { pattern = "%s"; } else if (channelType.getItemType().startsWith(CoreItemFactory.NUMBER)) { pattern = "%.0f";
private ChannelType createLocalizedChannelType(Bundle bundle, ChannelType channelType, Locale locale) { LocalizedChannelTypeKey localizedChannelTypeKey = getLocalizedChannelTypeKey(channelType.getUID(), locale); ChannelType cachedEntry = localizedChannelTypeCache.get(localizedChannelTypeKey); if (cachedEntry != null) { return cachedEntry; } if (this.thingTypeI18nUtil != null) { ChannelTypeUID channelTypeUID = channelType.getUID(); String label = this.thingTypeI18nUtil.getChannelLabel(bundle, channelTypeUID, channelType.getLabel(), locale); String description = this.thingTypeI18nUtil.getChannelDescription(bundle, channelTypeUID, channelType.getDescription(), locale); StateDescription state = createLocalizedChannelState(bundle, channelType, channelTypeUID, locale); ChannelType localizedChannelType = new ChannelType(channelTypeUID, channelType.isAdvanced(), channelType.getItemType(), label, description, channelType.getCategory(), channelType.getTags(), state, channelType.getConfigDescriptionURI()); localizedChannelTypeCache.put(localizedChannelTypeKey, localizedChannelType); return localizedChannelType; } return channelType; }
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()); }
final ChannelType resolvedChannelType = this.getChannelType(channelTypeUID); if ((resolvedChannelType != null)) { itemType = resolvedChannelType.getItemType(); parsedKind = resolvedChannelType.getKind(); if ((label == null)) { String _id = it.getId(); ChannelUID _channelUID = new ChannelUID(thingTypeUID, thingUID, _id); Channel _build = ChannelBuilder.create(_channelUID, channelType.getItemType()).withType(it.getChannelTypeUID()).withAutoUpdatePolicy(channelType.getAutoUpdatePolicy()).build(); channels.add(_build); } else {
.state(channelTypeUID, label == null ? defaultLabel : label, channelType.getItemType()) .isAdvanced(channelType.isAdvanced()).withCategory(channelType.getCategory()) .withConfigDescriptionURI(channelType.getConfigDescriptionURI()).withTags(channelType.getTags()) return new ChannelType(channelTypeUID, channelType.isAdvanced(), channelType.getItemType(), channelType.getKind(), label == null ? defaultLabel : label, description, channelType.getCategory(), channelType.getTags(), channelType.getState(),
static ChannelBuilder createChannelBuilder(ChannelUID channelUID, ChannelType channelType, ConfigDescriptionRegistry configDescriptionRegistry) { ChannelBuilder channelBuilder = ChannelBuilder.create(channelUID, channelType.getItemType()) //