mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
Fix countries and connection AddonInfo issues (#3797)
Fixes the following: * connection and countries details missing for some AddonServices * missing connection getter on AddonInfo * countries lists has empty String when when countries info is missing Related to #3795 Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
parent
daeb367155
commit
f6435ec132
@ -144,7 +144,8 @@ public class EclipseAddonService implements AddonService {
|
||||
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));
|
||||
|
@ -177,6 +177,6 @@ public class JsonAddonService extends AbstractRemoteAddonService {
|
||||
.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();
|
||||
}
|
||||
}
|
||||
|
@ -41,4 +41,6 @@ public class AddonEntryDTO {
|
||||
public String url = "";
|
||||
@SerializedName("logger_packages")
|
||||
public List<String> loggerPackages = List.of();
|
||||
public String connection = "";
|
||||
public List<String> countries = List.of();
|
||||
}
|
||||
|
@ -135,6 +135,10 @@ public class AddonInfo implements Identifiable<String> {
|
||||
return sourceBundle;
|
||||
}
|
||||
|
||||
public @Nullable String getConnection() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
public List<String> getCountries() {
|
||||
return countries;
|
||||
}
|
||||
@ -192,7 +196,7 @@ public class AddonInfo implements Identifiable<String> {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -154,6 +154,7 @@ public class JarFileAddonService extends BundleTracker<Bundle> implements AddonS
|
||||
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();
|
||||
|
@ -136,7 +136,8 @@ public class KarafAddonService implements AddonService {
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user