refactor(was-lib): use bundleId to dynamically match module-wide tool manifest requests
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()
|
List<ToolManifestItem> tools = toolSupplier.get().stream()
|
||||||
.filter(tool -> isMatchCategory(categoryKey, tool.getCategoryKey()))
|
.filter(tool -> isMatchCategory(categoryKey, tool.getCategoryKey(), bundleId))
|
||||||
.map(this::toManifestItem)
|
.map(this::toManifestItem)
|
||||||
.sorted(Comparator.comparing(ToolManifestItem::name))
|
.sorted(Comparator.comparing(ToolManifestItem::name))
|
||||||
.toList();
|
.toList();
|
||||||
@@ -61,16 +61,21 @@ public class ToolManifestService {
|
|||||||
return new ToolManifestResponse(bundleId, revision(bundleId, tools), tools);
|
return new ToolManifestResponse(bundleId, revision(bundleId, tools), tools);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMatchCategory(String requestedCategory, String toolCategory) {
|
private boolean isMatchCategory(String requestedCategory, String toolCategory, String bundleId) {
|
||||||
if (requestedCategory == null) {
|
if (requestedCategory == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (requestedCategory.equalsIgnoreCase(toolCategory)) {
|
if (requestedCategory.equalsIgnoreCase(toolCategory)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ("sys".equalsIgnoreCase(requestedCategory)) {
|
|
||||||
return "iam".equalsIgnoreCase(toolCategory) || "pct".equalsIgnoreCase(toolCategory);
|
// Return all tools in this module if the requested category matches the module's bundle ID
|
||||||
|
if (bundleId != null &&
|
||||||
|
(bundleId.equalsIgnoreCase(requestedCategory) ||
|
||||||
|
bundleId.equalsIgnoreCase("was-" + requestedCategory))) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user