use of org.openhab.core.thing.profiles.ProfileType in project addons by smarthomej.
the class BasicProfilesFactory method createLocalizedProfileType.
private ProfileType createLocalizedProfileType(ProfileType profileType, @Nullable Locale locale) {
final LocalizedKey localizedKey = new LocalizedKey(profileType.getUID(), locale != null ? locale.toLanguageTag() : null);
final ProfileType cachedlocalizedProfileType = localizedProfileTypeCache.get(localizedKey);
if (cachedlocalizedProfileType != null) {
return cachedlocalizedProfileType;
}
final ProfileType localizedProfileType = profileTypeI18nLocalizationService.createLocalizedProfileType(bundle, profileType, locale);
if (localizedProfileType != null) {
localizedProfileTypeCache.put(localizedKey, localizedProfileType);
return localizedProfileType;
} else {
return profileType;
}
}
use of org.openhab.core.thing.profiles.ProfileType in project addons by smarthomej.
the class MathTransformationProfileFactoryTest method systemProfileTypesAndUidsShouldBeAvailable.
@Test
public void systemProfileTypesAndUidsShouldBeAvailable() {
Collection<ProfileTypeUID> supportedProfileTypeUIDs = profileFactory.getSupportedProfileTypeUIDs();
assertThat(supportedProfileTypeUIDs, hasSize(NUMBER_OF_PROFILES));
Collection<ProfileType> supportedProfileTypes = profileFactory.getProfileTypes(null);
assertThat(supportedProfileTypeUIDs, hasSize(NUMBER_OF_PROFILES));
for (ProfileType profileType : supportedProfileTypes) {
assertTrue(supportedProfileTypeUIDs.contains(profileType.getUID()));
}
}
use of org.openhab.core.thing.profiles.ProfileType in project openhab-core by openhab.
the class SystemProfileFactory method createLocalizedProfileType.
private ProfileType createLocalizedProfileType(ProfileType profileType, @Nullable Locale locale) {
LocalizedKey localizedKey = new LocalizedKey(profileType.getUID(), locale != null ? locale.toLanguageTag() : null);
ProfileType cachedEntry = localizedProfileTypeCache.get(localizedKey);
if (cachedEntry != null) {
return cachedEntry;
}
ProfileType localizedProfileType = profileTypeI18nLocalizationService.createLocalizedProfileType(bundle, profileType, locale);
if (localizedProfileType != null) {
localizedProfileTypeCache.put(localizedKey, localizedProfileType);
return localizedProfileType;
} else {
return profileType;
}
}
use of org.openhab.core.thing.profiles.ProfileType in project addons by smarthomej.
the class BasicProfilesFactoryTest method systemProfileTypesAndUidsShouldBeAvailable.
@Test
public void systemProfileTypesAndUidsShouldBeAvailable() {
Collection<ProfileTypeUID> supportedProfileTypeUIDs = profileFactory.getSupportedProfileTypeUIDs();
assertThat(supportedProfileTypeUIDs, hasSize(NUMBER_OF_PROFILES));
Collection<ProfileType> supportedProfileTypes = profileFactory.getProfileTypes(null);
assertThat(supportedProfileTypeUIDs, hasSize(NUMBER_OF_PROFILES));
for (ProfileType profileType : supportedProfileTypes) {
assertTrue(supportedProfileTypeUIDs.contains(profileType.getUID()));
}
}
use of org.openhab.core.thing.profiles.ProfileType in project addons by smarthomej.
the class MathTransformationProfileFactory method createLocalizedProfileType.
private ProfileType createLocalizedProfileType(ProfileType profileType, @Nullable Locale locale) {
final LocalizedKey localizedKey = new LocalizedKey(profileType.getUID(), locale != null ? locale.toLanguageTag() : null);
final ProfileType cachedlocalizedProfileType = localizedProfileTypeCache.get(localizedKey);
if (cachedlocalizedProfileType != null) {
return cachedlocalizedProfileType;
}
final ProfileType localizedProfileType = profileTypeI18nLocalizationService.createLocalizedProfileType(bundle, profileType, locale);
if (localizedProfileType != null) {
localizedProfileTypeCache.put(localizedKey, localizedProfileType);
return localizedProfileType;
} else {
return profileType;
}
}
Aggregations