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 4b91b5199c fix(#2550): change handling of data stream in extensions
service endpoint (#2560)
4b91b5199c is described below
commit 4b91b5199c41a20560639916cabe5f73bef199de
Author: Tim <[email protected]>
AuthorDate: Fri Mar 15 07:59:02 2024 +0100
fix(#2550): change handling of data stream in extensions service endpoint
(#2560)
---
.../admin/ExtensionsServiceEndpointResource.java | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
index 748d9f0a26..a2d83a014f 100644
---
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
+++
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/admin/ExtensionsServiceEndpointResource.java
@@ -49,7 +49,6 @@ import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import java.util.stream.Collectors;
@RestController
@RequestMapping("/api/v2/rdfendpoints")
@@ -121,6 +120,7 @@ public class ExtensionsServiceEndpointResource extends
AbstractAuthGuardedRestRe
String appId) {
return installedElements
.stream()
+ .filter(e -> !(e instanceof SpDataStream)) // DataStreams are not
getting installed
.anyMatch(e -> e.getAppId().equals(appId));
}
@@ -139,17 +139,19 @@ public class ExtensionsServiceEndpointResource extends
AbstractAuthGuardedRestRe
.stream()
.filter(s -> existingItems.stream().noneMatch(item ->
s.getAppId().equals(item.getAppId())))
.map(adapter -> makeItem(adapter, "adapter"))
- .collect(Collectors.toList());
+ .toList();
}
private List<ExtensionsServiceEndpointItem> getAllDataStreamEndpoints(
List<ExtensionsServiceEndpointItem> existingItems) {
return getAllDataStreams()
.stream()
- .filter(s -> existingItems.stream().noneMatch(item ->
s.getAppId().equals(item.getAppId())))
+ // compared to similar methods we use the elementId here instead of
the appId
+ // because data streams are supposed to do not have an appId
+ .filter(s -> existingItems.stream().noneMatch(item ->
s.getElementId().equals(item.getElementId())))
.filter(s -> !s.isInternallyManaged())
.map(stream -> makeItem(stream, "stream"))
- .collect(Collectors.toList());
+ .toList();
}
@@ -160,7 +162,7 @@ public class ExtensionsServiceEndpointResource extends
AbstractAuthGuardedRestRe
.stream()
.filter(s -> existingItems.stream().noneMatch(item ->
s.getAppId().equals(item.getAppId())))
.map(source -> makeItem(source, "sepa"))
- .collect(Collectors.toList());
+ .toList();
}
private List<ExtensionsServiceEndpointItem> getAllDataSinkEndpoints(
@@ -170,7 +172,7 @@ public class ExtensionsServiceEndpointResource extends
AbstractAuthGuardedRestRe
.stream()
.filter(s -> existingItems.stream().noneMatch(item ->
s.getAppId().equals(item.getAppId())))
.map(source -> makeItem(source, "action"))
- .collect(Collectors.toList());
+ .toList();
}
private ExtensionsServiceEndpointItem makeItem(NamedStreamPipesEntity
entity, String type) {
@@ -178,7 +180,6 @@ public class ExtensionsServiceEndpointResource extends
AbstractAuthGuardedRestRe
endpoint.setInstalled(true);
endpoint.setDescription(entity.getDescription());
endpoint.setName(entity.getName());
- endpoint.setAppId(entity.getAppId());
endpoint.setType(type);
endpoint.setAvailable(false);
endpoint.setElementId(entity.getElementId());
@@ -186,6 +187,11 @@ public class ExtensionsServiceEndpointResource extends
AbstractAuthGuardedRestRe
endpoint.setEditable(!(entity.isInternallyManaged()));
endpoint.setIncludesIcon(entity.isIncludesAssets() &&
entity.getIncludedAssets().contains(Assets.ICON));
endpoint.setIncludesDocs(entity.isIncludesAssets() &&
entity.getIncludedAssets().contains(Assets.DOCUMENTATION));
+
+ if (!(entity instanceof SpDataStream)) {
+ endpoint.setAppId(entity.getAppId());
+ }
+
return endpoint;
}