Skip to content

Commit

Permalink
Fix add-on type inconsistencies (openhab#2508)
Browse files Browse the repository at this point in the history
* Fix add-on type inconsistencies

This makes the CommunityMarketplaceAddonService return the same add-on type responses as the KarafAddonService.
This allows for add-ons tagged with "io" in the Marketplace to show up in the UI.

Fixes openhab#2507

* Update "io" tag to "misc"

Signed-off-by: Wouter Born <github@maindrain.net>
GitOrigin-RevId: 5afa5fe
  • Loading branch information
wborn authored and splatch committed Jul 12, 2023
1 parent c7bcca7 commit 9b5e9fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@NonNullByDefault
public class CommunityKarafAddonHandler implements MarketplaceAddonHandler {
private static final Path KAR_CACHE_PATH = Path.of(OpenHAB.getUserDataFolder(), "marketplace", "kar");
private static final List<String> SUPPORTED_EXT_TYPES = List.of("automation", "binding", "io", "persistence",
private static final List<String> SUPPORTED_EXT_TYPES = List.of("automation", "binding", "misc", "persistence",
"transformation", "ui", "voice");
private static final String KAR_DOWNLOAD_URL_PROPERTY = "kar_download_url";
private static final String KAR_EXTENSION = ".kar";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@Component(immediate = true)
@NonNullByDefault
public class CommunityBundleAddonHandler extends MarketplaceBundleInstaller implements MarketplaceAddonHandler {
private static final List<String> SUPPORTED_EXT_TYPES = List.of("automation", "binding", "io", "persistence",
private static final List<String> SUPPORTED_EXT_TYPES = List.of("automation", "binding", "misc", "persistence",
"transformation", "ui", "voice");
private static final String JAR_DOWNLOAD_URL_PROPERTY = "jar_download_url";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ public class CommunityMarketplaceAddonService implements AddonService {
private static final Map<String, AddonType> TAG_ADDON_TYPE_MAP = Map.of( //
"automation", new AddonType("automation", "Automation"), //
"binding", new AddonType("binding", "Bindings"), //
"io", new AddonType("io", "I/O Services"), //
"persistence", new AddonType("persistence", "Persistence Services"), //
"misc", new AddonType("misc", "Misc"), //
"persistence", new AddonType("persistence", "Persistence"), //
"transformation", new AddonType("transformation", "Transformations"), //
"ui", new AddonType("ui", "User Interfaces"), //
"voice", new AddonType("voice", "Voices"));
"voice", new AddonType("voice", "Voice"));

private final Logger logger = LoggerFactory.getLogger(CommunityMarketplaceAddonService.class);
private final Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
Expand Down Expand Up @@ -336,7 +336,7 @@ private Addon convertTopicItemToAddon(DiscourseTopicItem topic, List<DiscourseUs

String maturity = tags.stream().filter(CODE_MATURITY_LEVELS::contains).findAny().orElse(null);

HashMap<String, Object> properties = new HashMap<>(10);
Map<String, Object> properties = new HashMap<>(10);
properties.put("created_at", createdDate);
properties.put("like_count", likeCount);
properties.put("views", views);
Expand Down Expand Up @@ -386,7 +386,7 @@ private Addon convertTopicToAddon(DiscourseTopicResponseDTO topic) {

String maturity = tags.stream().filter(CODE_MATURITY_LEVELS::contains).findAny().orElse(null);

HashMap<String, Object> properties = new HashMap<>(10);
Map<String, Object> properties = new HashMap<>(10);
properties.put("created_at", createdDate);
properties.put("updated_at", updatedDate);
properties.put("last_posted", lastPostedDate);
Expand Down

0 comments on commit 9b5e9fa

Please sign in to comment.