From 80553eaef2b9ce4991cc684b574b142b3722f524 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 8 Nov 2022 16:30:21 +0100 Subject: [PATCH] Added the new "geoportal_timeline_json_template" to GEOPORTAL_DATA_HANDLER --- .../geoportal/ucd/GEOPORTAL_DATA_HANDLER.java | 1 + .../java/org/gcube/application/UCD_Tests.java | 49 ++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java index 1986ac5..d0b3532 100644 --- a/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java +++ b/src/main/java/org/gcube/application/geoportalcommon/shared/geoportal/ucd/GEOPORTAL_DATA_HANDLER.java @@ -6,6 +6,7 @@ public enum GEOPORTAL_DATA_HANDLER { geoportal_basic_data_list("org.gcube.portlets.user.geoportal-basic-data-list", "BASIC_DATA_LIST_GUI"), geoportal_data_entry("org.gcube.portlets.user.geoportal-data-entry-app", "DATA_ENTRY_GUI"), geoportal_workflow_action_list("org.gcube.portlets.user.geoportal-workflow-action-list","WORKFLOW_ACTION_LIST_GUI"), + geoportal_timeline_json_template("org.gcube.portlets.user.geoportal-timeline-json-template","TIMELINE_JSON_TEMPLATE"), gna_concessioni_lc("GNA-CONCESSIONI-LC", "LifecycleManagement"); String id; diff --git a/src/test/java/org/gcube/application/UCD_Tests.java b/src/test/java/org/gcube/application/UCD_Tests.java index 6e56d13..35f032b 100644 --- a/src/test/java/org/gcube/application/UCD_Tests.java +++ b/src/test/java/org/gcube/application/UCD_Tests.java @@ -1,11 +1,15 @@ package org.gcube.application; +import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.List; import java.util.stream.Collectors; +import org.bson.Document; import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration; import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor; import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel; @@ -219,6 +223,49 @@ public class UCD_Tests { } } + + + /** + * Gets the UCD for handler types. + * + * @return the UCD for handler types + * @throws Exception the exception + */ + //@Test + public void getTimelineJSONTemplateConfig() throws Exception { + ScopeProvider.instance.set(CONTEXT); + SecurityTokenProvider.instance.set(TOKEN); + + UseCaseDescriptor ucd = null; + List handlers = null; + try { + + useCaseDescriptors().build().getById(PROFILE_ID).getHandlersByType(GEOPORTAL_DATA_HANDLER.geoportal_timeline_json_template.getType()).forEach(u -> { + Document config = u.getConfiguration(); + System.out.println("config "+config); + + System.out.println("config.keySet() "+config.keySet()); + + + LinkedHashMap ttd = (LinkedHashMap) config.get("tjt_document"); + + String jsonDocOfTJT = new Document(ttd).toJson(); + System.out.println("ttd "+jsonDocOfTJT); + + System.out.println(jsonDocOfTJT); + + }); + + } catch (Exception e) { + e.printStackTrace(); + return; + } + +// for (HandlerDeclaration handlerDeclaration : handlers) { +// System.out.println(handlerDeclaration); +// } + + } /** * Gets the roles for STEP id. @@ -275,7 +322,7 @@ public class UCD_Tests { * @return the configurations for UC D data handlers * @throws Exception the exception */ - @Test + //@Test public void getConfigurations_ForUCD_Data_Handlers() throws Exception { ScopeProvider.instance.set(CONTEXT); SecurityTokenProvider.instance.set(TOKEN);