feature_25074 #9
|
@ -4,6 +4,11 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v2.2.0-SNAPSHOT]
|
||||||
|
|
||||||
|
- Integrated the cross-filtering configuration [#25074]
|
||||||
|
- Integrated the overlay layers configuration [#25110]
|
||||||
|
|
||||||
## [v2.1.0] - 2023-05-11
|
## [v2.1.0] - 2023-05-11
|
||||||
|
|
||||||
- Integrated the deleteFileset method [#24977]
|
- Integrated the deleteFileset method [#24977]
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.application</groupId>
|
<groupId>org.gcube.application</groupId>
|
||||||
<artifactId>geoportal-data-common</artifactId>
|
<artifactId>geoportal-data-common</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<description>GeoPortal Data Common is common library used by GUI components developed for GeoNA</description>
|
<description>GeoPortal Data Common is common library used by GUI components developed for GeoNA</description>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
|
|
|
@ -42,7 +42,10 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.ConfiguredLayerDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.Crs;
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.Crs;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
|
@ -71,9 +74,11 @@ import org.slf4j.LoggerFactory;
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
||||||
import com.jayway.jsonpath.DocumentContext;
|
import com.jayway.jsonpath.DocumentContext;
|
||||||
|
@ -297,7 +302,7 @@ public class ConvertToDataValueObjectModel {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String asJSONString : jsonConfigurations) {
|
for (String asJSONString : jsonConfigurations) {
|
||||||
LOG.debug(++i + ") the gCubeProfile is: " + asJSONString);
|
LOG.debug(++i + ") the " + geoportalConfigType + " is: " + asJSONString);
|
||||||
GcubeProfile profile = org.gcube.application.geoportal.client.utils.Serialization
|
GcubeProfile profile = org.gcube.application.geoportal.client.utils.Serialization
|
||||||
.read(asJSONString, GcubeProfile.class);
|
.read(asJSONString, GcubeProfile.class);
|
||||||
listGcubeProfiles.add(toGcubeProfileDV(profile));
|
listGcubeProfiles.add(toGcubeProfileDV(profile));
|
||||||
|
@ -317,7 +322,7 @@ public class ConvertToDataValueObjectModel {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String asJSONString : jsonConfigurations) {
|
for (String asJSONString : jsonConfigurations) {
|
||||||
LOG.debug(++i + ") the itemField is: " + asJSONString);
|
LOG.debug(++i + ") the " + geoportalConfigType + " is: " + asJSONString);
|
||||||
ItemField itemField = org.gcube.application.geoportal.client.utils.Serialization
|
ItemField itemField = org.gcube.application.geoportal.client.utils.Serialization
|
||||||
.read(asJSONString, ItemField.class);
|
.read(asJSONString, ItemField.class);
|
||||||
listItemFields.add(toItemFieldDV(itemField));
|
listItemFields.add(toItemFieldDV(itemField));
|
||||||
|
@ -374,7 +379,61 @@ public class ConvertToDataValueObjectModel {
|
||||||
return hdDV;
|
return hdDV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case grouped_overlay_layers: {
|
||||||
|
|
||||||
|
List<GroupedLayersDV<ConfiguredLayerDV>> listGroupedCL = new ArrayList<GroupedLayersDV<ConfiguredLayerDV>>(
|
||||||
|
jsonConfigurations.size());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
for (String asJSONString : jsonConfigurations) {
|
||||||
|
LOG.debug(++i + ") the " + GroupedLayersDV.class.getSimpleName() + " is: " + asJSONString);
|
||||||
|
TypeReference<GroupedLayersDV<ConfiguredLayerDV>> typeRef = new TypeReference<GroupedLayersDV<ConfiguredLayerDV>>() {};
|
||||||
|
GroupedLayersDV<ConfiguredLayerDV> profile = mapper.readValue(asJSONString, typeRef);
|
||||||
|
// GroupedLayersDV<ConfiguredLayerDV> profile = org.gcube.application.geoportal.client.utils.Serialization
|
||||||
|
// .read(asJSONString, typeRef);
|
||||||
|
// listGroupedCL.add(toGcubeProfileDV(profile));
|
||||||
|
listGroupedCL.add(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigurationDV<List<GroupedLayersDV<ConfiguredLayerDV>>> dDV = new ConfigurationDV<List<GroupedLayersDV<ConfiguredLayerDV>>>(
|
||||||
|
listGroupedCL);
|
||||||
|
dDV.setConfiguration(listGroupedCL);
|
||||||
|
dDV.setConfigurationType(geoportalConfigType);
|
||||||
|
hdDV.setConfiguration(dDV);
|
||||||
|
LOG.info("returning {}", hdDV);
|
||||||
|
return hdDV;
|
||||||
|
}
|
||||||
|
|
||||||
|
case grouped_cross_filtering_layers: {
|
||||||
|
|
||||||
|
List<GroupedLayersDV<CrossFilteringLayerDV>> listGroupedCL = new ArrayList<GroupedLayersDV<CrossFilteringLayerDV>>(
|
||||||
|
jsonConfigurations.size());
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
for (String asJSONString : jsonConfigurations) {
|
||||||
|
LOG.debug(++i + ") the " + GroupedLayersDV.class.getSimpleName() + " is: " + asJSONString);
|
||||||
|
TypeReference<GroupedLayersDV<CrossFilteringLayerDV>> typeRef = new TypeReference<GroupedLayersDV<CrossFilteringLayerDV>>() {};
|
||||||
|
GroupedLayersDV<CrossFilteringLayerDV> profile = mapper.readValue(asJSONString, typeRef);
|
||||||
|
// GroupedLayersDV<CrossFilteringLayerDV> profile = org.gcube.application.geoportal.client.utils.Serialization
|
||||||
|
// .read(asJSONString, GroupedLayersDV.class);
|
||||||
|
// listGroupedCL.add(toGcubeProfileDV(profile));
|
||||||
|
listGroupedCL.add(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigurationDV<List<GroupedLayersDV<CrossFilteringLayerDV>>> dDV = new ConfigurationDV<List<GroupedLayersDV<CrossFilteringLayerDV>>>(
|
||||||
|
listGroupedCL);
|
||||||
|
dDV.setConfiguration(listGroupedCL);
|
||||||
|
dDV.setConfigurationType(geoportalConfigType);
|
||||||
|
hdDV.setConfiguration(dDV);
|
||||||
|
LOG.info("returning {}", hdDV);
|
||||||
|
return hdDV;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
LOG.warn("HANDLER NOT FOUND FOR configs: " + geoportalConfigType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package org.gcube.application.geoportalcommon.shared.geoportal.config;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GroupedLayersDV.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 12, 2023
|
||||||
|
*/
|
||||||
|
public class GroupedLayersDV<T extends LayerIDV> implements Serializable, GeoportalConfigurationID {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -2021774489849084231L;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@JsonProperty(value = "layers")
|
||||||
|
private List<T> listCustomLayers;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getID() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setID(String configID) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupedLayersDV() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<T> getListCustomLayers() {
|
||||||
|
return listCustomLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListCustomLayers(List<T> listCustomLayers) {
|
||||||
|
this.listCustomLayers = listCustomLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("GroupedLayersDV [name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", description=");
|
||||||
|
builder.append(description);
|
||||||
|
builder.append(", listCustomLayers=");
|
||||||
|
builder.append(listCustomLayers);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ConfiguredLayerDV.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* May 12, 2023
|
||||||
|
*/
|
||||||
|
public class ConfiguredLayerDV implements LayerIDV, Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 6910607957385140987L;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
private String description;
|
||||||
|
private String name;
|
||||||
|
private String wms_url;
|
||||||
|
private String wfs_url;
|
||||||
|
boolean display = false;
|
||||||
|
|
||||||
|
public ConfiguredLayerDV() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWMS_URL() {
|
||||||
|
return wms_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWFS_URL() {
|
||||||
|
return wfs_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDisplay() {
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWms_url(String wms_url) {
|
||||||
|
this.wms_url = wms_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWfs_url(String wfs_url) {
|
||||||
|
this.wfs_url = wfs_url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplay(boolean display) {
|
||||||
|
this.display = display;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("ConfiguredLayerDV [title=");
|
||||||
|
builder.append(title);
|
||||||
|
builder.append(", description=");
|
||||||
|
builder.append(description);
|
||||||
|
builder.append(", name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", wms_url=");
|
||||||
|
builder.append(wms_url);
|
||||||
|
builder.append(", wfs_url=");
|
||||||
|
builder.append(wfs_url);
|
||||||
|
builder.append(", display=");
|
||||||
|
builder.append(display);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CrossFilteringLayerDV extends ConfiguredLayerDV {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1130075528037312939L;
|
||||||
|
String table_show_field;
|
||||||
|
String table_key_field;
|
||||||
|
String table_parent_key_field;
|
||||||
|
String table_geometry_name;
|
||||||
|
List<CrossFilteringLayerDV> related_to;
|
||||||
|
|
||||||
|
public CrossFilteringLayerDV() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTable_show_field() {
|
||||||
|
return table_show_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTable_key_field() {
|
||||||
|
return table_key_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTable_parent_key_field() {
|
||||||
|
return table_parent_key_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTable_geometry_name() {
|
||||||
|
return table_geometry_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CrossFilteringLayerDV> getRelated_to() {
|
||||||
|
return related_to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTable_show_field(String table_show_field) {
|
||||||
|
this.table_show_field = table_show_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTable_key_field(String table_key_field) {
|
||||||
|
this.table_key_field = table_key_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTable_parent_key_field(String table_parent_key_field) {
|
||||||
|
this.table_parent_key_field = table_parent_key_field;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTable_geometry_name(String table_geometry_name) {
|
||||||
|
this.table_geometry_name = table_geometry_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRelated_to(List<CrossFilteringLayerDV> related_to) {
|
||||||
|
this.related_to = related_to;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("CrossFilteringLayerDV [table_show_field=");
|
||||||
|
builder.append(table_show_field);
|
||||||
|
builder.append(", table_key_field=");
|
||||||
|
builder.append(table_key_field);
|
||||||
|
builder.append(", table_parent_key_field=");
|
||||||
|
builder.append(table_parent_key_field);
|
||||||
|
builder.append(", table_geometry_name=");
|
||||||
|
builder.append(table_geometry_name);
|
||||||
|
builder.append(", related_to=");
|
||||||
|
builder.append(related_to);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.gcube.application.geoportalcommon.shared.geoportal.config.layers;
|
||||||
|
|
||||||
|
public interface LayerIDV {
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
String getTitle();
|
||||||
|
String getWMS_URL();
|
||||||
|
String getWFS_URL();
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
|
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
|
||||||
|
|
||||||
public enum GEOPORTAL_CONFIGURATION_TYPE {
|
public enum GEOPORTAL_CONFIGURATION_TYPE {
|
||||||
item_fields("itemFields"), gcube_profiles("gcubeProfiles"), actions_definition("actionsDefinition");
|
item_fields("itemFields"),
|
||||||
|
gcube_profiles("gcubeProfiles"),
|
||||||
|
actions_definition("actionsDefinition"),
|
||||||
|
grouped_overlay_layers("grouped_overlay_layers"),
|
||||||
|
grouped_cross_filtering_layers("grouped_cross_filtering_layers");
|
||||||
|
|
||||||
String id;
|
String id;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ public enum GEOPORTAL_DATA_HANDLER {
|
||||||
geoportal_data_entry("org.gcube.portlets.user.geoportal-data-entry-app", "DATA_ENTRY_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_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"),
|
geoportal_timeline_json_template("org.gcube.portlets.user.geoportal-timeline-json-template","TIMELINE_JSON_TEMPLATE"),
|
||||||
|
geoportal_grouped_cross_filtering("org.gcube.portlets.user.grouped_cross_filtering_layers","GROUPED_CROSS_FILTERING_LAYERS"),
|
||||||
|
geoportal_grouped_overlay_layers("org.gcube.portlets.user.grouped_overlay_layers","GROUPED_OVERLAY_LAYERS"),
|
||||||
gna_concessioni_lc("GNA-CONCESSIONI-LC", "LifecycleManagement");
|
gna_concessioni_lc("GNA-CONCESSIONI-LC", "LifecycleManagement");
|
||||||
|
|
||||||
String id;
|
String id;
|
||||||
|
|
|
@ -15,8 +15,6 @@ import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class TestGNACommon {
|
public class TestGNACommon {
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,15 @@ package org.gcube.application;
|
||||||
|
|
||||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
|
@ -19,6 +23,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
|
@ -26,6 +31,8 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||||
|
@ -39,24 +46,53 @@ import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||||
*/
|
*/
|
||||||
public class UCD_Tests {
|
public class UCD_Tests {
|
||||||
|
|
||||||
private UseCaseDescriptorCaller client = null;
|
private static final String GCUBE_CONFIG_PROPERTIES_FILENAME = "gcube_config.properties";
|
||||||
|
// APP Working Directory + /src/test/resources must be the location of
|
||||||
|
// gcube_config.properties
|
||||||
|
private static String gcube_config_path = String.format("%s/%s",
|
||||||
|
System.getProperty("user.dir") + "/src/test/resources", GCUBE_CONFIG_PROPERTIES_FILENAME);
|
||||||
|
private static String CONTEXT;
|
||||||
|
private static String TOKEN;
|
||||||
|
|
||||||
private static String CONTEXT = "/pred4s/preprod/preVRE";
|
private UseCaseDescriptorCaller client = null;
|
||||||
private static String TOKEN = ""; //preVRE
|
|
||||||
|
|
||||||
//private static String CONTEXT = "/gcube/devsec/devVRE";
|
//private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||||
//private static String TOKEN = ""; // devVRE
|
//private static String TOKEN = ""; // devVRE
|
||||||
|
|
||||||
private static String PROFILE_ID = "profiledConcessioni";
|
private static String PROFILE_ID = "profiledConcessioni";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read context settings.
|
||||||
|
*/
|
||||||
|
public static void readContextSettings() {
|
||||||
|
|
||||||
|
try (InputStream input = new FileInputStream(gcube_config_path)) {
|
||||||
|
|
||||||
|
Properties prop = new Properties();
|
||||||
|
|
||||||
|
// load a properties file
|
||||||
|
prop.load(input);
|
||||||
|
|
||||||
|
CONTEXT = prop.getProperty("CONTEXT");
|
||||||
|
TOKEN = prop.getProperty("TOKEN");
|
||||||
|
// get the property value and print it out
|
||||||
|
System.out.println("CONTEXT: " + CONTEXT);
|
||||||
|
System.out.println("TOKEN: " + TOKEN);
|
||||||
|
|
||||||
|
} catch (IOException ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the client.
|
* Gets the client.
|
||||||
*
|
*
|
||||||
* @return the client
|
* @return the client
|
||||||
*/
|
*/
|
||||||
//@Before
|
@Before
|
||||||
public void getClient() {
|
public void getClient() {
|
||||||
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
readContextSettings();
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
client = GeoportalClientCaller.useCaseDescriptors();
|
client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
@ -193,6 +229,77 @@ public class UCD_Tests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void getUCDGroupedOverlayLayers() throws Exception {
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
|
List<String> handlersIds = null;
|
||||||
|
List<UseCaseDescriptor> listUseCaseDescriptor;
|
||||||
|
|
||||||
|
try {
|
||||||
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
|
||||||
|
if (handlersIds == null) {
|
||||||
|
handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers.getId());
|
||||||
|
System.out.println("handlersIds is null, so using default: " + handlersIds);
|
||||||
|
}
|
||||||
|
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listUseCaseDescriptor == null) {
|
||||||
|
listUseCaseDescriptor = new ArrayList<UseCaseDescriptor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size());
|
||||||
|
for (UseCaseDescriptor ucd : listUseCaseDescriptor) {
|
||||||
|
listUCDDV.add(ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(listUCDDV);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void getUCDGroupedCrossFilteringLayers() throws Exception {
|
||||||
|
System.out.println("Running getUCDGroupedCrossFilteringLayers");
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
|
List<String> handlersIds = null;
|
||||||
|
List<UseCaseDescriptor> listUseCaseDescriptor;
|
||||||
|
|
||||||
|
try {
|
||||||
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
|
||||||
|
if (handlersIds == null) {
|
||||||
|
handlersIds = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering.getId());
|
||||||
|
System.out.println("handlersIds is null, so using default: " + handlersIds);
|
||||||
|
}
|
||||||
|
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listUseCaseDescriptor == null) {
|
||||||
|
listUseCaseDescriptor = new ArrayList<UseCaseDescriptor>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<UseCaseDescriptorDV> listUCDDV = new ArrayList<UseCaseDescriptorDV>(listUseCaseDescriptor.size());
|
||||||
|
for (UseCaseDescriptor ucd : listUseCaseDescriptor) {
|
||||||
|
listUCDDV.add(ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println(listUCDDV);
|
||||||
|
System.out.println("Terminated getUCDGroupedCrossFilteringLayers");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the UCD for handler types.
|
* Gets the UCD for handler types.
|
||||||
*
|
*
|
||||||
|
@ -201,29 +308,38 @@ public class UCD_Tests {
|
||||||
*/
|
*/
|
||||||
//@Test
|
//@Test
|
||||||
public void getUCDForHandlerTypes() throws Exception {
|
public void getUCDForHandlerTypes() throws Exception {
|
||||||
|
System.out.println("Running getUCDForHandlerTypes");
|
||||||
ScopeProvider.instance.set(CONTEXT);
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
SecurityTokenProvider.instance.set(TOKEN);
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
|
||||||
|
String handlerType = GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering.getType();
|
||||||
|
|
||||||
UseCaseDescriptor ucd = null;
|
UseCaseDescriptor ucd = null;
|
||||||
List<HandlerDeclaration> handlers = null;
|
List<HandlerDeclaration> handlers = null;
|
||||||
try {
|
try {
|
||||||
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
UseCaseDescriptorCaller client = GeoportalClientCaller.useCaseDescriptors();
|
||||||
ucd = client.getUCDForId(PROFILE_ID);
|
ucd = client.getUCDForId(PROFILE_ID);
|
||||||
handlers = client.getHandlersByType(PROFILE_ID, GEOPORTAL_DATA_HANDLER.geoportal_basic_data_list.getType());
|
handlers = client.getHandlersByType(PROFILE_ID, handlerType);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
for (HandlerDeclaration handlerDeclaration : handlers) {
|
for (HandlerDeclaration handlerDeclaration : handlers) {
|
||||||
System.out.println(handlerDeclaration);
|
System.out.println(handlerDeclaration);
|
||||||
System.out.println("Config json: "+handlerDeclaration.getConfiguration().toJson());
|
System.out.println(++i+")##Config json: "+handlerDeclaration.getConfiguration().toJson());
|
||||||
|
HandlerDeclarationDV handlerDV = ConvertToDataValueObjectModel.toHandlerDeclarationDV(handlerDeclaration, ucd, GEOPORTAL_CONFIGURATION_TYPE.grouped_cross_filtering_layers);
|
||||||
|
System.out.println("\nhandlerDV is: "+handlerDV);
|
||||||
}
|
}
|
||||||
|
System.out.println("\n");
|
||||||
|
System.out.println("Terminated getUCDForHandlerTypes");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the UCD for handler types.
|
* Gets the UCD for handler types.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue