feat(was-lib): map sys category to iam and pct tools
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
This commit is contained in:
@@ -53,7 +53,7 @@ public class ToolManifestService {
|
||||
}
|
||||
|
||||
List<ToolManifestItem> tools = toolSupplier.get().stream()
|
||||
.filter(tool -> categoryKey == null || categoryKey.equals(tool.getCategoryKey()))
|
||||
.filter(tool -> isMatchCategory(categoryKey, tool.getCategoryKey()))
|
||||
.map(this::toManifestItem)
|
||||
.sorted(Comparator.comparing(ToolManifestItem::name))
|
||||
.toList();
|
||||
@@ -61,6 +61,19 @@ public class ToolManifestService {
|
||||
return new ToolManifestResponse(bundleId, revision(bundleId, tools), tools);
|
||||
}
|
||||
|
||||
private boolean isMatchCategory(String requestedCategory, String toolCategory) {
|
||||
if (requestedCategory == null) {
|
||||
return true;
|
||||
}
|
||||
if (requestedCategory.equalsIgnoreCase(toolCategory)) {
|
||||
return true;
|
||||
}
|
||||
if ("sys".equalsIgnoreCase(requestedCategory)) {
|
||||
return "iam".equalsIgnoreCase(toolCategory) || "pct".equalsIgnoreCase(toolCategory);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ToolManifestItem toManifestItem(ToolMetadata tool) {
|
||||
String title = tool.getDisplayName() == null || tool.getDisplayName().isBlank()
|
||||
? tool.getName() : tool.getDisplayName();
|
||||
|
||||
Reference in New Issue
Block a user