This is an automated email from the ASF dual-hosted git repository.
bossenti pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 686d2f2f9d fix: correctly retrieve documentation for asset overview
(#2872)
686d2f2f9d is described below
commit 686d2f2f9d4c52b3061b79c4d7c1fae0141493eb
Author: Tim <[email protected]>
AuthorDate: Fri May 17 08:31:00 2024 +0200
fix: correctly retrieve documentation for asset overview (#2872)
* fix: correctly retrieve documentation for asset overview
* style: fix import order
---
.../streampipes/rest/impl/PipelineElementAsset.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
index f0d628d7f9..bd09bb173e 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/PipelineElementAsset.java
@@ -19,6 +19,7 @@ package org.apache.streampipes.rest.impl;
import org.apache.streampipes.manager.assets.AssetManager;
import org.apache.streampipes.rest.core.base.impl.AbstractRestResource;
+import org.apache.streampipes.storage.management.StorageDispatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,6 +50,20 @@ public class PipelineElementAsset extends
AbstractRestResource {
@GetMapping(path = "/{appId}/assets/documentation", produces =
MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<?> getDocumentationAsset(@PathVariable("appId") String
appId) {
try {
+ //If the provided appId contains "sp:spdatastream",
+ //it indicates usage by the asset-overview view where the data stream ID
is supplied.
+ //In such cases, the appId of the adapter description needs retrieval
for successful documentation loading.
+ if (appId.contains("sp:spdatastream")) {
+ var dataStream = StorageDispatcher.INSTANCE
+ .getNoSqlStore()
+ .getDataStreamStorage()
+ .getDataStreamByAppId(appId);
+ var adapterDescription = StorageDispatcher.INSTANCE
+ .getNoSqlStore()
+ .getAdapterInstanceStorage()
+ .getAdapter(dataStream.getCorrespondingAdapterId());
+ appId = adapterDescription.getAppId();
+ }
return ok(AssetManager.getAssetDocumentation(appId));
} catch (IOException e) {
return fail();