From defe9ad7f4f9899c35b8382d2915694b98499ae9 Mon Sep 17 00:00:00 2001 From: Tim <50115603+bossenti@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:06:27 +0100 Subject: [PATCH] refactor: remove deprecated elements from `NamedStreamPipesEntity` (#2205) --- .../model/base/NamedStreamPipesEntity.java | 10 ---------- .../connect/AdapterWorkerResource.java | 6 ++++-- .../streampipes/sdk/stream/StreamBuilder.java | 16 ++++++++-------- .../storage/couchdb/utils/Filter.java | 2 +- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/streampipes-model/src/main/java/org/apache/streampipes/model/base/NamedStreamPipesEntity.java b/streampipes-model/src/main/java/org/apache/streampipes/model/base/NamedStreamPipesEntity.java index 1e7e1a8bbe..30981732f4 100644 --- a/streampipes-model/src/main/java/org/apache/streampipes/model/base/NamedStreamPipesEntity.java +++ b/streampipes-model/src/main/java/org/apache/streampipes/model/base/NamedStreamPipesEntity.java @@ -128,16 +128,6 @@ public void setIconUrl(String iconUrl) { this.iconUrl = iconUrl; } - @Deprecated - public String getUri() { - return elementId; - } - - @Deprecated - public void setUri(String uri) { - this.elementId = uri; - } - public String getDom() { return dom; } diff --git a/streampipes-rest-extensions/src/main/java/org/apache/streampipes/rest/extensions/connect/AdapterWorkerResource.java b/streampipes-rest-extensions/src/main/java/org/apache/streampipes/rest/extensions/connect/AdapterWorkerResource.java index 2877fc456e..56475c355d 100644 --- a/streampipes-rest-extensions/src/main/java/org/apache/streampipes/rest/extensions/connect/AdapterWorkerResource.java +++ b/streampipes-rest-extensions/src/main/java/org/apache/streampipes/rest/extensions/connect/AdapterWorkerResource.java @@ -76,11 +76,13 @@ public Response invokeAdapter(AdapterDescription adapterStreamDescription) { try { adapterManagement.invokeAdapter(adapterStreamDescription); - String responseMessage = "Stream adapter with id " + adapterStreamDescription.getUri() + " successfully started"; + String responseMessage = "Stream adapter with id " + + adapterStreamDescription.getElementId() + + " successfully started"; logger.info(responseMessage); return ok(Notifications.success(responseMessage)); } catch (AdapterException e) { - logger.error("Error while starting adapter with id " + adapterStreamDescription.getUri(), e); + logger.error("Error while starting adapter with id " + adapterStreamDescription.getElementId(), e); return serverError(SpLogMessage.from(e)); } } diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java index 9462a0daa0..f213f02a21 100644 --- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java +++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/stream/StreamBuilder.java @@ -32,25 +32,25 @@ public class StreamBuilder { private SpDataStream stream; private EventSchema schema; - private StreamBuilder(String name, String description, String uri) { + private StreamBuilder(String name, String description, String elementId) { stream = new SpDataStream(); stream.setName(name); stream.setDescription(description); - stream.setUri(uri); + stream.setElementId(elementId); } - private StreamBuilder(String uri) { + private StreamBuilder(String elementId) { stream = new SpDataStream(); - stream.setUri(uri); + stream.setElementId(elementId); schema = new EventSchema(); } - public static StreamBuilder createStream(String name, String description, String uri) { - return new StreamBuilder(name, description, uri); + public static StreamBuilder createStream(String name, String description, String elementId) { + return new StreamBuilder(name, description, elementId); } - public static StreamBuilder createStreamRestriction(String uri) { - return new StreamBuilder(uri); + public static StreamBuilder createStreamRestriction(String elementId) { + return new StreamBuilder(elementId); } public StreamBuilder property(String propertyName, URI propertyType, URI subclassOf) { diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Filter.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Filter.java index 64356a145f..57ff1595cb 100644 --- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Filter.java +++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/utils/Filter.java @@ -29,7 +29,7 @@ public static List byUri(List allElemen return allElements .stream() .filter(e -> userElements.stream() - .anyMatch(u -> u.equals(e.getUri()))).collect(Collectors.toList()); + .anyMatch(u -> u.equals(e.getElementId()))).collect(Collectors.toList()); } }