diff --git a/bundles/org.openhab.core.addon.eclipse/src/main/java/org/openhab/core/addon/eclipse/internal/EclipseAddonService.java b/bundles/org.openhab.core.addon.eclipse/src/main/java/org/openhab/core/addon/eclipse/internal/EclipseAddonService.java index 1a28c50d719..6e5f063850a 100644 --- a/bundles/org.openhab.core.addon.eclipse/src/main/java/org/openhab/core/addon/eclipse/internal/EclipseAddonService.java +++ b/bundles/org.openhab.core.addon.eclipse/src/main/java/org/openhab/core/addon/eclipse/internal/EclipseAddonService.java @@ -144,7 +144,8 @@ private Addon getAddon(Bundle bundle, @Nullable Locale locale) { if (addonInfo != null) { // only enrich if this add-on is installed, otherwise wrong data might be added addon = addon.withLabel(addonInfo.getName()).withDescription(addonInfo.getDescription()) - .withCountries(addonInfo.getCountries()).withLink(getDefaultDocumentationLink(type, name)) + .withConnection(addonInfo.getConnection()).withCountries(addonInfo.getCountries()) + .withLink(getDefaultDocumentationLink(type, name)) .withConfigDescriptionURI(addonInfo.getConfigDescriptionURI()); } else { addon = addon.withLabel(name).withLink(getDefaultDocumentationLink(type, name)); diff --git a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/JsonAddonService.java b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/JsonAddonService.java index 0b39fd1460c..f349e242ac7 100644 --- a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/JsonAddonService.java +++ b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/JsonAddonService.java @@ -177,6 +177,6 @@ private Addon fromAddonEntry(AddonEntryDTO addonEntry) { .withCompatible(compatible).withMaturity(addonEntry.maturity).withProperties(properties) .withLink(addonEntry.link).withImageLink(addonEntry.imageUrl) .withConfigDescriptionURI(addonEntry.configDescriptionURI).withLoggerPackages(addonEntry.loggerPackages) - .build(); + .withConnection(addonEntry.connection).withCountries(addonEntry.countries).build(); } } diff --git a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/model/AddonEntryDTO.java b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/model/AddonEntryDTO.java index 5cbf0e9935b..227c4c42524 100644 --- a/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/model/AddonEntryDTO.java +++ b/bundles/org.openhab.core.addon.marketplace/src/main/java/org/openhab/core/addon/marketplace/internal/json/model/AddonEntryDTO.java @@ -41,4 +41,6 @@ public class AddonEntryDTO { public String url = ""; @SerializedName("logger_packages") public List loggerPackages = List.of(); + public String connection = ""; + public List countries = List.of(); } diff --git a/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonInfo.java b/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonInfo.java index 25c7593878b..2016d107408 100644 --- a/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonInfo.java +++ b/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/AddonInfo.java @@ -135,6 +135,10 @@ public String getDescription() { return sourceBundle; } + public @Nullable String getConnection() { + return connection; + } + public List getCountries() { return countries; } @@ -192,7 +196,7 @@ public Builder withConnection(@Nullable String connection) { } public Builder withCountries(@Nullable String countries) { - this.countries = Arrays.asList(Objects.requireNonNullElse(countries, "").split(",")); + this.countries = countries == null || countries.isBlank() ? List.of() : Arrays.asList(countries.split(",")); return this; } diff --git a/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java b/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java index 8b8fe68bcbe..106930d00a7 100644 --- a/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java +++ b/bundles/org.openhab.core.addon/src/main/java/org/openhab/core/addon/internal/JarFileAddonService.java @@ -154,6 +154,7 @@ private Addon toAddon(Bundle bundle, AddonInfo addonInfo) { String uid = ADDON_ID_PREFIX + addonInfo.getUID(); return Addon.create(uid).withId(addonInfo.getId()).withType(addonInfo.getType()).withInstalled(true) .withVersion(bundle.getVersion().toString()).withLabel(addonInfo.getName()) + .withConnection(addonInfo.getConnection()).withCountries(addonInfo.getCountries()) .withConfigDescriptionURI(addonInfo.getConfigDescriptionURI()) .withDescription(Objects.requireNonNullElse(addonInfo.getDescription(), bundle.getSymbolicName())) .withContentType(ADDONS_CONTENT_TYPE).build(); diff --git a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/KarafAddonService.java b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/KarafAddonService.java index 2fcc9e2dee4..8e422715568 100644 --- a/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/KarafAddonService.java +++ b/bundles/org.openhab.core.karaf/src/main/java/org/openhab/core/karaf/internal/KarafAddonService.java @@ -136,7 +136,8 @@ private Addon getAddon(Feature feature, @Nullable Locale locale) { if (isInstalled && addonInfo != null) { // only enrich if this add-on is installed, otherwise wrong data might be added addon = addon.withLabel(addonInfo.getName()).withDescription(addonInfo.getDescription()) - .withCountries(addonInfo.getCountries()).withLink(getDefaultDocumentationLink(type, name)) + .withConnection(addonInfo.getConnection()).withCountries(addonInfo.getCountries()) + .withLink(getDefaultDocumentationLink(type, name)) .withConfigDescriptionURI(addonInfo.getConfigDescriptionURI()); } else { addon = addon.withLabel(feature.getDescription()).withLink(getDefaultDocumentationLink(type, name));