mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
@@ -32,6 +32,9 @@ import org.openhab.core.common.registry.Identifiable;
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class AddonInfo implements Identifiable<String> {
|
||||
|
||||
public static final String NA = "n/a";
|
||||
|
||||
private static final Set<String> SUPPORTED_ADDON_TYPES = Set.of("automation", "binding", "misc", "persistence",
|
||||
"transformation", "ui", "voice");
|
||||
|
||||
|
||||
+8
-1
@@ -97,8 +97,15 @@ public class AddonInfoRegistry {
|
||||
return a;
|
||||
}
|
||||
AddonInfo.Builder builder = AddonInfo.builder(a);
|
||||
if (a.getDescription().isEmpty()) {
|
||||
if (AddonInfo.NA.equals(a.getName())) {
|
||||
builder.withName(b.getName());
|
||||
} else if (AddonInfo.NA.equals(b.getName())) {
|
||||
builder.withName(a.getName());
|
||||
}
|
||||
if (AddonInfo.NA.equals(a.getDescription())) {
|
||||
builder.withDescription(b.getDescription());
|
||||
} else if (AddonInfo.NA.equals(b.getDescription())) {
|
||||
builder.withDescription(a.getDescription());
|
||||
}
|
||||
if (a.getConnection() == null && b.getConnection() != null) {
|
||||
builder.withConnection(b.getConnection());
|
||||
|
||||
+3
-1
@@ -94,7 +94,9 @@ public class AddonInfoAddonsXmlProvider implements AddonInfoProvider {
|
||||
try {
|
||||
String xml = Files.readString(f.toPath());
|
||||
if (xml != null && !xml.isBlank()) {
|
||||
addonInfos.addAll(reader.readFromXML(xml).getAddons().stream().collect(Collectors.toSet()));
|
||||
addonInfos.addAll(reader.readFromXML(xml).getAddons().stream()
|
||||
.map(a -> AddonInfo.builder(a).withName(AddonInfo.NA).withDescription(AddonInfo.NA).build())
|
||||
.collect(Collectors.toSet()));
|
||||
} else {
|
||||
logger.warn("File '{}' contents are null or empty", f.getName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user