From 8f72db03914f91c67b2fe60cac1d4c70cfa31efc Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 9 Apr 2024 16:10:36 +0200 Subject: [PATCH] added setOptionalMessage and optional Document --- .../cms/plugins/events/ItemObserved.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java index fe2a2b3..5cbe3e0 100644 --- a/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java +++ b/cms-plugin-framework/src/main/java/org/gcube/application/cms/plugins/events/ItemObserved.java @@ -4,6 +4,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map.Entry; +import org.bson.Document; import org.gcube.application.geoportal.common.model.document.Project; import org.gcube.application.geoportal.common.model.document.accounting.Context; import org.gcube.application.geoportal.common.model.document.accounting.User; @@ -26,6 +27,7 @@ public class ItemObserved implements ItemObservable { UseCaseDescriptor useCaseDescriptor; T project; EventManager.Event event; + Document optional; public String getProjectId() { log.debug("Called getProjectId"); @@ -65,6 +67,18 @@ public class ItemObserved implements ItemObservable { return documentAsMap; } + + public void setOptionalMessage(String message){ + this.optional = new Document(); + this.optional.put("message", message); + } + + public String getOptionalMessage(){ + if(this.optional!=null) { + return (String) this.optional.getOrDefault("message", null); + } + return null; + } @Override public String toString() {