This is an automated email from the ASF dual-hosted git repository.

riemer 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 a5976655cf feat: Extend generic storage api (#3536)
a5976655cf is described below

commit a5976655cf243b8115b5248af75bb553eaa27ae0
Author: Dominik Riemer <[email protected]>
AuthorDate: Wed Mar 19 20:59:32 2025 +0100

    feat: Extend generic storage api (#3536)
---
 .../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);

Reply via email to