This is an automated email from the ASF dual-hosted git repository. riemer pushed a commit to branch extend-generic-storage-api in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 9325be3c18983eb183807a19dc22af1aceb58d99 Author: Dominik Riemer <[email protected]> AuthorDate: Wed Mar 19 15:09:53 2025 +0100 feat: Extend generic storage api --- .../java/org/apache/streampipes/storage/api/IGenericStorage.java | 2 ++ .../streampipes/storage/couchdb/impl/GenericStorageImpl.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IGenericStorage.java b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IGenericStorage.java index e9d9208f92..d15028669f 100644 --- a/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IGenericStorage.java +++ b/streampipes-storage-api/src/main/java/org/apache/streampipes/storage/api/IGenericStorage.java @@ -32,6 +32,8 @@ public interface IGenericStorage { Map<String, Object> findOne(String id) throws IOException; + Map<String, Object> findOneWithNullIfEmpty(String id); + Map<String, Object> create(String payload) throws IOException; <T> T create(T payload, Class<T> targetClass) throws IOException; diff --git a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java index 1af99ec94f..2390f4fa8d 100644 --- a/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java +++ b/streampipes-storage-couchdb/src/main/java/org/apache/streampipes/storage/couchdb/impl/GenericStorageImpl.java @@ -99,6 +99,15 @@ public class GenericStorageImpl implements IGenericStorage { return this.queryDocuments(getDatabaseRoute() + SLASH + id); } + @Override + public Map<String, Object> findOneWithNullIfEmpty(String id) { + try { + return this.queryDocuments(getDatabaseRoute() + SLASH + id); + } catch (IOException e) { + return null; + } + } + @Override public Map<String, Object> create(String payload) throws IOException { Request req = Utils.postRequest(getDatabaseRoute(), payload);
