From 5731c855acf9d484dc83b99b062e28ad45d841b6 Mon Sep 17 00:00:00 2001 From: Fabio Sinibaldi Date: Thu, 17 Feb 2022 11:07:03 +0100 Subject: [PATCH] Fix --- .../plugins/ConcessioniLifeCycleManager.java | 4 ++-- .../concessioni/plugins/SDIMaterializerPlugin.java | 4 ++-- .../application/cms/concessioni/sdi/SDIManager.java | 12 +++++------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java index 0944db8..37aec02 100644 --- a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java +++ b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/ConcessioniLifeCycleManager.java @@ -48,7 +48,7 @@ public class ConcessioniLifeCycleManager implements LifecycleManager { PluginManagerInterface pluginManager; // TODO DISCOVER - MaterializationPlugin plugin = new SDIMaterializerPlugin(); + MaterializationPlugin plugin; @Override public InitializationReport initInContext() throws InitializationException { @@ -109,7 +109,7 @@ public class ConcessioniLifeCycleManager implements LifecycleManager { matReq.setParameters(params); - MaterializationReport matRep = new SDIMaterializerPlugin().materialize(matReq); + MaterializationReport matRep = plugin.materialize(matReq); switch(matRep.getStatus()){ diff --git a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/SDIMaterializerPlugin.java b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/SDIMaterializerPlugin.java index 99a3a3d..6944deb 100644 --- a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/SDIMaterializerPlugin.java +++ b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/plugins/SDIMaterializerPlugin.java @@ -133,11 +133,11 @@ public class SDIMaterializerPlugin implements MaterializationPlugin { RegisteredFileSet obtained = getSDIManager().materializeLayer(fs,requestArguments); log.debug("Obtained {} ",obtained); - documentNavigator.setElement("$..[?(@.uuid == "+fs.getUUID()+")]",obtained); + documentNavigator.setElement("$..[?(@.uuid == '"+fs.getUUID()+"')]",obtained); } } - profiledDocument.setTheDocument(Document.parse(documentNavigator.getValueCTX().json())); + profiledDocument.setTheDocument(Document.parse(documentNavigator.getValueCTX().jsonString())); report.setResultDocument(profiledDocument); report.setStatus(Report.Status.OK); }catch (SDIInteractionException e){ diff --git a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/sdi/SDIManager.java b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/sdi/SDIManager.java index 67715ea..375578b 100644 --- a/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/sdi/SDIManager.java +++ b/concessioni-lifecycle/src/main/java/org/gcube/application/cms/concessioni/sdi/SDIManager.java @@ -8,6 +8,7 @@ import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.bson.Document; import org.gcube.application.cms.concessioni.sdi.faults.SDIInteractionException; +import org.gcube.application.cms.plugins.requests.BaseExecutionRequest; import org.gcube.application.cms.serialization.Serialization; import org.gcube.application.geoportal.common.model.document.filesets.GCubeSDILayer; @@ -92,9 +93,9 @@ public class SDIManager { log.debug("Materializing FS {} on {} ", fileSet, geoserverHostName); // validate parameters - String workspace = getMandatory("workspace", params); - String documentID = getMandatory("documentID", params); - String basePersistencePAth = getMandatory("basePersistencePath", params); + String workspace = BaseExecutionRequest.getMandatory("workspace", params); + String documentID = BaseExecutionRequest.getMandatory("documentID", params); + String basePersistencePAth = BaseExecutionRequest.getMandatory("basePersistencePath", params); // check if empty @@ -276,9 +277,6 @@ public class SDIManager { } - private static final String getMandatory(String param,Document params) throws SDIInteractionException { - if(!params.containsKey(param)) throw new SDIInteractionException("Missing mandatory parameter "+param); - return params.getString(param); - } + }