Compare commits

...

5 Commits

11 changed files with 163 additions and 126 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/geoportal-data-viewer-app-3.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.0.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-viewer-app-3.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.0.0-SNAPSHOT lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.1.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -34,8 +34,16 @@
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
<wb-module deploy-name="geoportal-data-viewer-app-3.1.0-SNAPSHOT">
@ -71,7 +79,11 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -107,7 +119,11 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -143,7 +159,11 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
@ -179,7 +199,11 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -215,7 +239,11 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
@ -251,7 +279,11 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
@ -287,7 +319,11 @@
<property name="context-root" value="geoportal-data-viewer-app"/> <property name="context-root" value="geoportal-data-viewer-app"/>
@ -323,7 +359,11 @@
</wb-module> </wb-module>

View File

@ -4,7 +4,9 @@
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).
## [v3.0.0-SNAPSHOT] - 2022-11-09 ## [v3.1.0-SNAPSHOT] - 2022-11-29
## [v3.0.0] - 2022-11-09
- [#23940] Passed to CMS-UCD - [#23940] Passed to CMS-UCD
- [#23941] Implemented and integrated the DTO Project/Document per UCD config and gCube Metadata Profiles - [#23941] Implemented and integrated the DTO Project/Document per UCD config and gCube Metadata Profiles

View File

@ -6,16 +6,22 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
* [OpenJDK](https://openjdk.java.net/) - The JDK used * [OpenJDK](https://openjdk.java.net/) - The JDK used
* [Maven](https://maven.apache.org/) - Dependency Management * [Maven](https://maven.apache.org/) - Dependency Management
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
**Uses** **Uses**
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) * GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol) * GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
* OpenLayers v.6.x [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md) * OpenLayers v.6.x [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
* Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT * Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT
* Handlebarsjs v4.x [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT * Handlebarsjs v4.x [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT
**Base Maps**
* OpenStreetMap [openstreetmap](http://www.openstreetmap.org)
* Mapbox Satellite [mapbox](https://www.mapbox.com/)
## Documentation ## Documentation
N/A N/A

12
pom.xml
View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId> <artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>3.0.0-SNAPSHOT</version> <version>3.1.0-SNAPSHOT</version>
<name>GeoPortal Data Viewer App</name> <name>GeoPortal Data Viewer App</name>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description> <description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>
@ -23,6 +23,7 @@
<gwt.version>2.9.0</gwt.version> <gwt.version>2.9.0</gwt.version>
<gwt.compiler.style>PRETTY</gwt.compiler.style> <gwt.compiler.style>PRETTY</gwt.compiler.style>
<gson.version>2.6.2</gson.version> <gson.version>2.6.2</gson.version>
<gwt-ol.version>8.1.0-gwt2_9</gwt-ol.version>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<!-- GWT 2.9 support 8, 9 and 11 --> <!-- GWT 2.9 support 8, 9 and 11 -->
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
@ -64,13 +65,6 @@
<dependencies> <dependencies>
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>javax.servlet-api</artifactId> -->
<!-- <version>3.1.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<dependency> <dependency>
<groupId>xml-apis</groupId> <groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId> <artifactId>xml-apis</artifactId>
@ -109,7 +103,7 @@
<dependency> <dependency>
<groupId>com.github.tdesjardins</groupId> <groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId> <artifactId>gwt-ol3</artifactId>
<version>8.1.0-gwt2_9</version> <version>${gwt-ol.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.gwtbootstrap</groupId> <groupId>com.github.gwtbootstrap</groupId>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -286,7 +286,8 @@ public class SearchFacilityUI extends Composite {
@Override @Override
public void onSuccess(ResultSetPaginatedDataIDs result) { public void onSuccess(ResultSetPaginatedDataIDs result) {
appManagerBus.fireEvent(new SearchPerformedEvent(profileID, result.getResultSetProjectIDs(), false)); appManagerBus
.fireEvent(new SearchPerformedEvent(profileID, result.getResultSetProjectIDs(), false));
setSearchEnabled(true); setSearchEnabled(true);
latestResult = result; latestResult = result;
@ -304,18 +305,18 @@ public class SearchFacilityUI extends Composite {
String message = ""; String message = "";
if (allItems > returnedItems) { if (allItems > returnedItems) {
message = "Too many results found. Below are " + returnedItems + " out of " + allItems message = "Your query returns too many results (" + allItems
+ " results"; + "). Please find below the top " + returnedItems + ".<br>";
} else if (returnedItems>0){ } else if (returnedItems > 0) {
message = "Found " + returnedItems; message = "Found " + returnedItems;
message += returnedItems > 0 ? " items" : " item"; message += returnedItems > 0 ? " items" : " item";
message += ". ";
} }
if (returnedItems>0) { if (returnedItems > 0) {
message += ". Projects (with a centroid) matching your search are shown on the Map"; message += "On the map you can see all the projects with a centroid matching the query";
} }
HTML resultMessage = new HTML(message); HTML resultMessage = new HTML(message);
resultMessage.getElement().addClassName("search_result_msg"); resultMessage.getElement().addClassName("search_result_msg");
@ -353,7 +354,7 @@ public class SearchFacilityUI extends Composite {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(), GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
profileID); profileID);
//here // here
appManagerBus.fireEvent(new ClosedViewDetailsEvent()); appManagerBus.fireEvent(new ClosedViewDetailsEvent());
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true)); appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true));
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(profileID, appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(profileID,

View File

@ -68,16 +68,17 @@ public class Geoportal_JSON_Mapper {
public static final String JSON_$_POINTER = "$"; public static final String JSON_$_POINTER = "$";
public static final String _THEDOCUMENT = "_theDocument"; public static final String _THEDOCUMENT = "_theDocument";
public static ProjectEdit loadProjectEdit(ProjectDV theProjectDV, String scope, String username) throws Exception {
public static ProjectEdit loadProjectEdit(ProjectDV theProjectDV, String scope, String username) throws Exception {
LOG.debug("loadProjectEdit called");
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON(); String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
LOG.debug("theProjectDV as JSON: " + theWholeProjectAsJSON); LOG.debug("theProjectDV as JSON: " + theWholeProjectAsJSON);
LOG.debug("theProjectDV as MAP: " + theProjectDV.getTheDocument().getDocumentAsMap()); LOG.trace("theProjectDV as MAP: " + theProjectDV.getTheDocument().getDocumentAsMap());
ProjectEdit projectView = new ProjectEdit(); ProjectEdit projectEdit = new ProjectEdit();
projectView.setTheProjectDV(theProjectDV); projectEdit.setTheProjectDV(theProjectDV);
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = GcubeProfilesPerUCDIdCache LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = GcubeProfilesPerUCDIdCache
.get(scope); .get(scope);
@ -112,19 +113,14 @@ public class Geoportal_JSON_Mapper {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
//LinkedHashMap<Integer, MetaDataProfileBeanExt> mapOfProfilesBeanExt = new LinkedHashMap<Integer, MetaDataProfileBeanExt>(); List<MetaDataProfileBeanExt> listOfProfilesBeanExt = new ArrayList<MetaDataProfileBeanExt>();
ArrayList<MetaDataProfileBeanExt> listOfProfilesBeanExt = new ArrayList<MetaDataProfileBeanExt>();
// Reading the Project according to list of Profile defined in the UCD // Reading the Project according to list of Profile defined in the UCD
for (GcubeProfilesMetadataForUCD gcubeProfileMetaForUCD : listProfilesBean) { for (GcubeProfilesMetadataForUCD gcubeProfileMetaForUCD : listProfilesBean) {
GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile(); GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile();
// SectionView sectionView = new SectionView(); LOG.debug("\n\n##### Creating the section: " + gcubeProfileDV.getSectionTitle());
// sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle());
System.out.println("\n\n##### Sto creando la sezione: "+gcubeProfileDV.getSectionTitle());
LOG.debug("\n\nThe profile is: " + gcubeProfileDV); LOG.debug("\n\nThe profile is: " + gcubeProfileDV);
// Building JSON/section full PATH and section name // Building JSON/section full PATH and section name
String sectionJSONPath = ""; String sectionJSONPath = "";
@ -178,80 +174,64 @@ public class Geoportal_JSON_Mapper {
LOG.debug("Result for " + gcubeProfileDV.getSectionName() + " is: " + listBSONDocument); LOG.debug("Result for " + gcubeProfileDV.getSectionName() + " is: " + listBSONDocument);
List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean(); List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean();
MetaDataProfileBean theProfileBean = theProfileBeans.get(0); MetaDataProfileBean theProfileBean = theProfileBeans.get(0);
// For each bson.Document filling the MetaDataProfileBean and its file // For each bson.Document filling the MetaDataProfileBean and its file
for (int i = 0; i < listBSONDocument.size(); i++) { for (int i = 0; i < listBSONDocument.size(); i++) {
System.out.println("DOCUMENT number "+i+ " of the section: "+theProfileBean.getTitle()); LOG.trace("DOCUMENT number " + i + " of the section: " + theProfileBean.getTitle());
MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt(); MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt();
theProfileBeanExt.setCategories(theProfileBean.getCategories()); theProfileBeanExt.setCategories(theProfileBean.getCategories());
theProfileBeanExt.setTitle(theProfileBean.getTitle()); theProfileBeanExt.setTitle(theProfileBean.getTitle());
theProfileBeanExt.setType(theProfileBean.getType()); theProfileBeanExt.setType(theProfileBean.getType());
// System.out.println("\nPRINTING PROJECT VIEW ON START: ");
// for (int j = 0; j < listOfProfilesBeanExt.size(); j++) {
// MetaDataProfileBeanExt metaDataProfileBeanExt = listOfProfilesBeanExt.get(j);
// System.out.println("MetaDataProfileBeanExt index: " + j + " "+metaDataProfileBeanExt.getType() +" "+metaDataProfileBeanExt.hashCode());
// int z = 0;
// for (MetadataFieldWrapper mfw : metaDataProfileBeanExt.getMetadataFields()) {
// System.out.println("\t MetadataFieldWrapper index: " + z++ + " " + mfw);
// }
// }
Document fromSectionDoc = listBSONDocument.get(i);
LOG.debug("\n\nNew section DOC for index " + i + " is: " + new JSONObject(fromSectionDoc.toJson()).toString(2));
//Creating the corresponding MetaDataProfileBeanExt for each section
//Reading policy and license statically Document fromSectionDoc = listBSONDocument.get(i);
//eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}} LOG.debug("\n\nNew section DOC for index " + i + " is: "
+ new JSONObject(fromSectionDoc.toJson()).toString(2));
// Creating the corresponding MetaDataProfileBeanExt for each section
// Reading policy and license statically
// eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}}
Document docAccess = null; Document docAccess = null;
Access access = null; Access access = null;
try { try {
docAccess = fromSectionDoc.get("_access", Document.class); docAccess = fromSectionDoc.get("_access", Document.class);
System.out.println("docAccess is: "+docAccess); LOG.trace("docAccess is: " + docAccess);
access = new Access(); access = new Access();
access.setPolicy(AccessPolicy.valueOf(docAccess.getString("_policy"))); access.setPolicy(AccessPolicy.valueOf(docAccess.getString("_policy")));
access.setLicense(docAccess.getString("_license")); access.setLicense(docAccess.getString("_license"));
// Access. access.get("_policy"); // Access. access.get("_policy");
// access.get("_license"); // access.get("_license");
System.out.println("access is: "+access); System.out.println("access is: " + access);
}catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); LOG.warn("No " + AccessPolicy.class.getSimpleName() + "found in the section "
+ fromSectionDoc.toJson());
LOG.debug("No AccessPolicy.class.getSimpleName(): ", e);
} }
//List<MetadataFieldWrapper> copyOfMetadataFields = new ArrayList<MetadataFieldWrapper>(theProfileBean.getMetadataFields());
//int forIndex = 0;
List<MetadataFieldWrapper> cloneListOfMFW = cloneList(theProfileBean.getMetadataFields()); List<MetadataFieldWrapper> cloneListOfMFW = cloneList(theProfileBean.getMetadataFields());
for (MetadataFieldWrapper metadataField : cloneListOfMFW) { for (MetadataFieldWrapper metadataField : cloneListOfMFW) {
String theFieldName = metadataField.getFieldId() != null ? metadataField.getFieldId() String theFieldName = metadataField.getFieldId() != null ? metadataField.getFieldId()
: metadataField.getFieldName(); : metadataField.getFieldName();
LOG.debug("reading theFieldName: " + theFieldName); LOG.debug("reading theFieldName: " + theFieldName);
Object theOBJFieldValue = fromSectionDoc.get(theFieldName); Object theOBJFieldValue = fromSectionDoc.get(theFieldName);
metadataField.setCurrentValue(theOBJFieldValue+""); metadataField.setCurrentValue(theOBJFieldValue + "");
if(access!=null) { if (access != null) {
if(theFieldName.equalsIgnoreCase("policy")) { if (theFieldName.equalsIgnoreCase("policy")) {
metadataField.setCurrentValue(access.getPolicy().name()); metadataField.setCurrentValue(access.getPolicy().name());
}else if(theFieldName.equalsIgnoreCase("licenseID")) { } else if (theFieldName.equalsIgnoreCase("licenseID")) {
metadataField.setCurrentValue(access.getLicense()); metadataField.setCurrentValue(access.getLicense());
} }
} }
//copyOfMetadataFields.set(forIndex++, metadataField);
} }
LOG.debug("Before assigning it Metadata fields are: "+cloneListOfMFW);
theProfileBeanExt.setMetadataFields(new ArrayList<MetadataFieldWrapper>(cloneListOfMFW)); theProfileBeanExt.setMetadataFields(new ArrayList<MetadataFieldWrapper>(cloneListOfMFW));
LOG.debug("Metadata fields are: "+theProfileBeanExt.getMetadataFields()); LOG.debug("Metadata fields are: " + theProfileBeanExt.getMetadataFields());
// Reading filePaths // Reading filePaths
List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths(); List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths();
List<GCubeSDIViewerLayerDV> listLayers = new ArrayList<GCubeSDIViewerLayerDV>();
// READING fileset* field ACCORDING TO filePaths OF THE 'gcubeProfiles' CONFIG // READING fileset* field ACCORDING TO filePaths OF THE 'gcubeProfiles' CONFIG
if (filePaths != null) { if (filePaths != null) {
@ -268,42 +248,25 @@ public class Geoportal_JSON_Mapper {
for (Payload payload : listPayloads) { for (Payload payload : listPayloads) {
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload); PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
filesetDV.addPayloadDV(payloadDV); filesetDV.addPayloadDV(payloadDV);
listFiles.add(filesetDV);
} }
// Reading Fileset _materializations listFiles.add(filesetDV);
//listLayers = readGcubeSDILayersForFileset(filesetJSONPath, fromSectionDocJSON);
//theProfileBeanExt.set
} }
theProfileBeanExt.setListFileset(listFiles); theProfileBeanExt.setListFileset(listFiles);
} }
System.out.println("\nputting theProfileBeanExt: "+theProfileBeanExt); LOG.trace("\nputting theProfileBeanExt: " + theProfileBeanExt);
listOfProfilesBeanExt.add(theProfileBeanExt); listOfProfilesBeanExt.add(theProfileBeanExt);
// System.out.println("\nPRINTING PROJECT VIEW ON END: ");
// for (int j = 0; j < listOfProfilesBeanExt.size(); j++) {
// MetaDataProfileBeanExt metaDataProfileBeanExt = listOfProfilesBeanExt.get(j);
// System.out.println("MetaDataProfileBeanExt index: " + j + " "+metaDataProfileBeanExt.getType() +" "+metaDataProfileBeanExt.hashCode());
// int z = 0;
// for (MetadataFieldWrapper mfw : metaDataProfileBeanExt.getMetadataFields()) {
// System.out.println("\t MetadataFieldWrapper index: " + z++ + " " + mfw);
// }
// }
//
// System.out.println(listProfileBeansExt.get(listProfileBeansExt.size()-1));
//Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView);
} }
} }
projectView.setTheProfileBeans(listOfProfilesBeanExt);
//Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView); projectEdit.setTheProfileBeans(listOfProfilesBeanExt);
return projectView; LOG.info("returning ProjectEdit with " + projectEdit.getTheProfileBeans().size() + " profile beans");
return projectEdit;
} }
public static List<MetadataFieldWrapper> cloneList(List<MetadataFieldWrapper> list) { public static List<MetadataFieldWrapper> cloneList(List<MetadataFieldWrapper> list) {
@ -583,8 +546,8 @@ public class Geoportal_JSON_Mapper {
LOG.trace("The _payloads is a String {}", toStringPayloads); LOG.trace("The _payloads is a String {}", toStringPayloads);
JSONArray jsonArray = new JSONArray(toStringPayloads); JSONArray jsonArray = new JSONArray(toStringPayloads);
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
Payload payloadDV = Serialization.read(jsonArray.getJSONObject(i).toString(), Payload.class); Payload payload = Serialization.read(jsonArray.getJSONObject(i).toString(), Payload.class);
listPayloads.add(payloadDV); listPayloads.add(payload);
} }
} }
@ -962,8 +925,15 @@ public class Geoportal_JSON_Mapper {
i = 1; i = 1;
System.out.println("***** Files"); System.out.println("***** Files");
for (FilesetDV fileSet : mpb.getListFileset()) { for (FilesetDV fileSet : mpb.getListFileset()) {
System.out.println("## " + FilesetDV.class.getSimpleName() + " n." + i); System.out.println(
System.out.println(fileSet); "## " + FilesetDV.class.getSimpleName() + " n." + i + " has name: " + fileSet.getName());
if (fileSet.getListPayload() != null) {
int j = 0;
for (PayloadDV payload : fileSet.getListPayload()) {
System.out.println("\t" + ++j + ") " + payload);
}
}
i++; i++;
} }

View File

@ -62,7 +62,7 @@ public class GeoportalViewer_Tests {
//private static String TOKEN = ""; // devVRE //private static String TOKEN = ""; // devVRE
private static String PROFILE_ID = "profiledConcessioni"; private static String PROFILE_ID = "profiledConcessioni";
private static String PROJECT_ID = "637ceb4d21dd0d6fb9f24706"; private static String PROJECT_ID = "6384942f308f5c28c5ee07b3";
private static String USERNAME = "francesco.mangiacrapa"; private static String USERNAME = "francesco.mangiacrapa";
@ -219,7 +219,7 @@ public class GeoportalViewer_Tests {
} }
} }
@Test //@Test
public void testReadProjectEdit() { public void testReadProjectEdit() {
try { try {
@ -229,13 +229,37 @@ public class GeoportalViewer_Tests {
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true); ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
projectBuilder.relationships(true); projectBuilder.relationships(true);
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder); ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
Geoportal_JSON_Mapper geojsonM = new Geoportal_JSON_Mapper();
ProjectEdit projectEdit = Geoportal_JSON_Mapper.loadProjectEdit(theProjectDV, CONTEXT, USERNAME); ProjectEdit projectEdit = Geoportal_JSON_Mapper.loadProjectEdit(theProjectDV, CONTEXT, USERNAME);
Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectEdit); Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectEdit);
// ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME); // ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME);
// Geoportal_JSON_Mapper.prettyPrintProjectView(projectView); // Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
System.out.println("testReadProjectEdit terminated"); System.out.println("\n\n testReadProjectEdit terminated!!!");
} catch (Exception e) {
System.err.println("Error");
e.printStackTrace();
}
}
@Test
public void testReadProjectView() {
try {
ScopeProvider.instance.set(CONTEXT);
SecurityTokenProvider.instance.set(TOKEN);
Project theProject = clientProjects.getProjectByID(PROFILE_ID, PROJECT_ID);
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
projectBuilder.relationships(true);
System.out.println("project json: "+theProject.getTheDocument().toJson());
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME);
Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
// ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME);
// Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
System.out.println("\n\n testReadProjectView terminated!!!");
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error"); System.err.println("Error");
e.printStackTrace(); e.printStackTrace();
@ -274,7 +298,7 @@ public class GeoportalViewer_Tests {
} }
@Test //@Test
public void getResultsWithSize() throws Exception { public void getResultsWithSize() throws Exception {
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID); // List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);