Added the new "geoportal_timeline_json_template" to

GEOPORTAL_DATA_HANDLER
This commit is contained in:
Francesco Mangiacrapa 2022-11-08 16:30:21 +01:00
parent 7a7b39418f
commit 80553eaef2
2 changed files with 49 additions and 1 deletions

View File

@ -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;

View File

@ -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<HandlerDeclaration> 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<String, Object> ttd = (LinkedHashMap<String, Object>) 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);