Browse Source

#20595 Porting and using the model view provided by geoportal-common

task_21890
Francesco Mangiacrapa 6 months ago
parent
commit
9158437b2f
  1. 2
      .settings/com.gwtplugins.gwt.eclipse.core.prefs
  2. 53
      .settings/org.eclipse.wst.common.component
  3. 1
      CHANGELOG.md
  4. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
  5. 8
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java
  6. 8
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java
  7. 6
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
  8. 2
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerOSM.java
  9. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/DetailsPanel.java
  10. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java
  11. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/gallery/ImagesGallery.java
  12. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.java
  13. 2
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ThumbnailImageView.java
  14. 2
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java
  15. 2
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/RecordView.java
  16. 8
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/ConcessioneView.java
  17. 2
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/LayerConcessioneView.java
  18. 6
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/RelazioneScavoView.java
  19. 988
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java
  20. 11
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
  21. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/FeatureParser.java
  22. 4
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/GisMakers.java
  23. 2
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/GeoNaSpatialQueryResult.java
  24. 170
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/BoundsMap.java
  25. 1
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/LayerItem.java
  26. 597
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/ConcessioneDV.java
  27. 202
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/AssociatedContentDV.java
  28. 41
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/OtherContentDV.java
  29. 85
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/WorkspaceContentDV.java
  30. 152
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/AbstractRelazioneScavoDV.java
  31. 135
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/LayerConcessioneDV.java
  32. 292
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/RecordDV.java
  33. 125
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/RelazioneScavoDV.java
  34. 143
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/SDILayerDescriptorDV.java
  35. 141
      src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/UploadedImageDV.java
  36. 4
      src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java

2
.settings/com.gwtplugins.gwt.eclipse.core.prefs

@ -0,0 +1,2 @@
eclipse.preferences.version=1
gwtSyncCodeServer=true

53
.settings/org.eclipse.wst.common.component

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -8,7 +11,10 @@
<wb-module deploy-name="geoportal-data-viewer-app-1.3.0-SNAPSHOT">
@ -17,7 +23,10 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -26,7 +35,10 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -35,17 +47,29 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -54,14 +78,20 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="geoportal-data-viewer-app"/>
@ -70,7 +100,10 @@
</wb-module>

1
CHANGELOG.md

@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
#### Enhancements
[#21890] Porting to ConcessioniManagerI and pass to mongoID
[#20595] Porting and using the model view provided by geoportal-common
## [v1.2.0-SNAPSHOT] - 2021-07-19

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java

@ -5,6 +5,8 @@ import java.util.Iterator;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
@ -17,8 +19,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;

8
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerService.java

@ -4,13 +4,13 @@ import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

8
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewerServiceAsync.java

@ -4,13 +4,13 @@ import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;

6
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java

@ -8,6 +8,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
@ -20,7 +23,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -28,8 +30,6 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.PointsPath;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;

2
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/LightOpenLayerOSM.java

@ -1,8 +1,8 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.Images;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/DetailsPanel.java

@ -1,10 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java

@ -1,9 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.NavLink;

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/gallery/ImagesGallery.java

@ -2,8 +2,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery;
import java.util.List;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONArray;

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ImageView.java

@ -1,10 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.images;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.util.NewBrowserWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Heading;

2
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/images/ThumbnailImageView.java

@ -1,7 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.images;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;

2
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/map/MapView.java

@ -1,10 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.map;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.LightOpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;

2
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/RecordView.java

@ -1,7 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;

8
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/ConcessioneView.java

@ -4,6 +4,10 @@ import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
@ -12,10 +16,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShare
import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.PageHeader;

2
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/LayerConcessioneView.java

@ -1,10 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;

6
src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/RelazioneScavoView.java

@ -2,11 +2,11 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessio
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Paragraph;

988
src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java

@ -1,499 +1,499 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.OtherContent;
import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class ConvertToGUIModel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 2, 2020
*/
public class ConvertToDataViewModel {
private static final String NO_TIME = "T00:00";
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
public static final String DATE_FORMAT = "dd-MM-yyyy";
public static final String HOURS_MINUTES_SEPARATOR = ":";
public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
/**
* To concessione.
*
* @param concessione the concessione
* @return the concessione
* @throws Exception the exception
*/
public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
LOG.debug("called toConcessione for: "+concessione);
if (concessione == null)
return null;
try {
ConcessioneDV theConcessione = new ConcessioneDV();
theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
//theConcessione.setAuthors(concessione.getAuthors());
theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(toDateFormatString(concessione.getCreationTime()));
theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
theConcessione.setDataFineProgetto(toDateFormatString(concessione.getDataFineProgetto()));
theConcessione.setDataInizioProgetto(toDateFormatString(concessione.getDataInizioProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setItemId(concessione.getMongo_id());
theConcessione.setNome(concessione.getNome());
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(toDateFormatString(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setNome(concessione.getNome());
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
theConcessione.setSoggetto(concessione.getSoggetto());
theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion());
theConcessione.setRecordType(concessione.getRecordType().name());
theConcessione.setAbstractRelazioneScavo(toAbstractRelazioneScavo(concessione.getRelazioneScavo()));
theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo()));
if (concessione.getImmaginiRappresentative() != null) {
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
concessione.getImmaginiRappresentative().size());
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
uploadedImagesDV.add(toUploadedImage(ui));
}
theConcessione.setImmaginiRappresentative(uploadedImagesDV);
}
if (concessione.getGenericContent() != null) {
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
concessione.getGenericContent().size());
for (OtherContent gc : concessione.getGenericContent()) {
otherContentsDV.add(toOtherContentDV(gc));
}
theConcessione.setGenericContent(otherContentsDV);
}
if (concessione.getPianteFineScavo() != null) {
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
concessione.getPianteFineScavo().size());
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
piantaScavoDV.add(toLayerConcessione(lc));
}
theConcessione.setPianteFineScavo(piantaScavoDV);
}
if (concessione.getPosizionamentoScavo() != null) {
LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo());
theConcessione.setPosizionamentoScavo(thePosizScavo);
}
LOG.debug("Returning concessione: " + theConcessione);
return theConcessione;
}catch (Exception e) {
LOG.error("Error on converting concessione: "+concessione, e);
return null;
}
}
//TO AVOID SERIALIZATION ISSUE AGAINST GWT
// public static List<String> toListString(List<String> orginList){
// if(orginList==null)
//package org.gcube.portlets.user.geoportaldataviewer.server;
//
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.ArrayList;
//import java.util.List;
//
//import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
//import org.gcube.application.geoportal.common.model.legacy.BBOX;
//import org.gcube.application.geoportal.common.model.legacy.Concessione;
//import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
//import org.gcube.application.geoportal.common.model.legacy.OtherContent;
//import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
//import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
//import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
//import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
//import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
//import org.gcube.application.geoportalcommon.shared.products.content.OtherContentDV;
//import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
//import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
//import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
//import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
//import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
//import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
//import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * The Class ConvertToGUIModel.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
// *
// * Nov 2, 2020
// */
//public class ConvertToDataViewModel {
//
// private static final String NO_TIME = "T00:00";
//
// /** The Constant LOG. */
// private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
//
// public static final String DATE_FORMAT = "dd-MM-yyyy";
//
// public static final String HOURS_MINUTES_SEPARATOR = ":";
//
// public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
//
//
// /**
// * To concessione.
// *
// * @param concessione the concessione
// * @return the concessione
// * @throws Exception the exception
// */
// public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
// LOG.debug("called toConcessione for: "+concessione);
//
// if (concessione == null)
// return null;
//
// List<String> destList = new ArrayList<String>(orginList.size());
// for (String orgValue : orginList) {
// destList.add(orgValue);
// try {
//
// ConcessioneDV theConcessione = new ConcessioneDV();
// theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
// //theConcessione.setAuthors(concessione.getAuthors());
// theConcessione.setCentroidLat(concessione.getCentroidLat());
// theConcessione.setCentroidLong(concessione.getCentroidLong());
// theConcessione.setContributore(concessione.getContributore());
// theConcessione.setCreationTime(toDateFormatString(concessione.getCreationTime()));
// theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
// theConcessione.setDataFineProgetto(toDateFormatString(concessione.getDataFineProgetto()));
// theConcessione.setDataInizioProgetto(toDateFormatString(concessione.getDataInizioProgetto()));
// theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
// theConcessione.setEditore(concessione.getEditore());
// theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
// theConcessione.setItemId(concessione.getMongo_id());
// theConcessione.setNome(concessione.getNome());
//
// theConcessione.setIntroduzione(concessione.getIntroduzione());
// theConcessione.setLastUpdateTime(toDateFormatString(concessione.getLastUpdateTime()));
// theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
// theConcessione.setLicenzaID(concessione.getLicenzaID());
// theConcessione.setNome(concessione.getNome());
// theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
// theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
//
// theConcessione.setResponsabile(concessione.getResponsabile());
// theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
// theConcessione.setSoggetto(concessione.getSoggetto());
// theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
// theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
// theConcessione.setTitolari(concessione.getTitolari());
// theConcessione.setVersion(concessione.getVersion());
//
// theConcessione.setRecordType(concessione.getRecordType().name());
//
// theConcessione.setAbstractRelazioneScavo(toAbstractRelazioneScavo(concessione.getRelazioneScavo()));
// theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo()));
//
//
// if (concessione.getImmaginiRappresentative() != null) {
// List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
// concessione.getImmaginiRappresentative().size());
// for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
// uploadedImagesDV.add(toUploadedImage(ui));
// }
// theConcessione.setImmaginiRappresentative(uploadedImagesDV);
// }
//
//
// if (concessione.getGenericContent() != null) {
// List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
// concessione.getGenericContent().size());
// for (OtherContent gc : concessione.getGenericContent()) {
// otherContentsDV.add(toOtherContentDV(gc));
// }
// theConcessione.setGenericContent(otherContentsDV);
// }
//
//
// if (concessione.getPianteFineScavo() != null) {
// List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
// concessione.getPianteFineScavo().size());
// for (LayerConcessione lc : concessione.getPianteFineScavo()) {
// piantaScavoDV.add(toLayerConcessione(lc));
// }
// theConcessione.setPianteFineScavo(piantaScavoDV);
// }
//
// if (concessione.getPosizionamentoScavo() != null) {
// LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo());
// theConcessione.setPosizionamentoScavo(thePosizScavo);
// }
//
//
// LOG.debug("Returning concessione: " + theConcessione);
// return theConcessione;
// }catch (Exception e) {
// LOG.error("Error on converting concessione: "+concessione, e);
// return null;
// }
//
// }
//
// //TO AVOID SERIALIZATION ISSUE AGAINST GWT
//// public static List<String> toListString(List<String> orginList){
//// if(orginList==null)
//// return null;
////
//// List<String> destList = new ArrayList<String>(orginList.size());
//// for (String orgValue : orginList) {
//// destList.add(orgValue);
//// }
////
//// return destList;
//// }
//
// /**
// * To user.
// *
// * @param username the username
// * @return the string
// */
// public static String toUser(String username) {
//
// if(username==null)
// return null;
//
// return username;
//
// }
//
// /**
// * To policy.
// *
// * @param policy the policy
// * @return the string
// */
// public static String toPolicy(AccessPolicy policy) {
//
// if(policy==null)
// return null;
//
// return policy.name();
//
// }
//
// /**
// * To date format string.
// *
// * @param dateTime the date time
// * @return the string
// */
// public static String toDateFormatString(LocalDateTime dateTime) {
//
// if(dateTime==null)
// return null;
//
// String time = dateTime.toString();
// DateTimeFormatter formatter = null;
// try {
// if(!time.endsWith(NO_TIME)) {
// formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
// }else {
// time = time.replace(NO_TIME, "");
// formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
// }
// }catch (Exception e) {
// LOG.warn("Parsing error: ",e);
// }
//
// try {
// if(formatter!=null)
// return dateTime.format(formatter);
// }catch (Exception e) {
// LOG.warn("Date format error: ",e);
// }
//
// return dateTime.toString();
// }
//
// /**
// * To abstract relazione scavo.
// *
// * @param relazioneScavo the relazione scavo
// * @return the abstract relazione scavo DV
// */
// public static AbstractRelazioneScavoDV toAbstractRelazioneScavo(RelazioneScavo relazioneScavo) {
//
// if (relazioneScavo == null)
// return null;
//
// AbstractRelazioneScavoDV theRelazioneDiScavo = new AbstractRelazioneScavoDV();
// theRelazioneDiScavo.setAbstractSectionIta(relazioneScavo.getAbstractIta());
// theRelazioneDiScavo.setAbstractSectionEng(relazioneScavo.getAbstractEng());
//
// theRelazioneDiScavo.setCreationTime(toDateFormatString(relazioneScavo.getCreationTime()));
// theRelazioneDiScavo.setId(relazioneScavo.getId());
// theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
// theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
// //theRelazioneDiScavo.setRecord(recordDV);
// theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
// theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
// theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
//
// LOG.debug("Returning: " + theRelazioneDiScavo);
// return theRelazioneDiScavo;
// }
//
// /**
// * To relazione scavo.
// *
// * @param relazioneScavo the relazione scavo
// * @return the relazione scavo data view
// */
// public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo) {
//
// if (relazioneScavo == null)
// return null;
//
// RelazioneScavoDV theRelazioneDiScavo = new RelazioneScavoDV();
// theRelazioneDiScavo.setCreationTime(toDateFormatString(relazioneScavo.getCreationTime()));
// theRelazioneDiScavo.setId(relazioneScavo.getId());
// theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
// theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
// //theRelazioneDiScavo.setRecord(recordDV);
// theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
// theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
// theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
//
// List<PersistedContent> actContent = relazioneScavo.getActualContent();
// if(actContent!=null && actContent.size()>0) {
// List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
//
// for (PersistedContent content : actContent) {
// if(content!=null && content instanceof WorkspaceContent) {
// listWsContent.add(toWorkspaceContent((WorkspaceContent)content));
// }
// }
// theRelazioneDiScavo.setListWsContent(listWsContent);
// }
//
// LOG.debug("Returning: " + theRelazioneDiScavo);
// return theRelazioneDiScavo;
// }
//
// /**
// * To uploaded image.
// *
// * @param uploadedImage the uploaded image
// * @return the uploaded image data-view
// */
// public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage) {
//
// if (uploadedImage == null)
// return null;
//
// UploadedImageDV theUploadedImageDV = new UploadedImageDV();
// theUploadedImageDV.setCreationTime(toDateFormatString(uploadedImage.getCreationTime()));
// theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
// theUploadedImageDV.setFormat(uploadedImage.getFormat());
// theUploadedImageDV.setId(uploadedImage.getId());
// theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
// theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
// //theUploadedImageDV.setRecord(recordDV);
// theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
// theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
// theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
//
// List<PersistedContent> actContent = uploadedImage.getActualContent();
// if(actContent!=null && actContent.size()>0) {
// List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
//
// for (PersistedContent content : actContent) {
// if(content!=null && content instanceof WorkspaceContent) {
// listWsContent.add(toWorkspaceContent((WorkspaceContent)content));
// }
// }
// theUploadedImageDV.setListWsContent(listWsContent);
// }
//
// LOG.debug("Returning: " + theUploadedImageDV);
// return theUploadedImageDV;
// }
//
//
// /**
// * To workspace content.
// *
// * @param wContent the w content
// * @return the workspace content DV
// */
// public static WorkspaceContentDV toWorkspaceContent(WorkspaceContent wContent){
// if (wContent == null)
// return null;
//
// WorkspaceContentDV theWSDV = new WorkspaceContentDV();
// theWSDV.setLink(wContent.getLink());
// theWSDV.setMimetype(wContent.getMimetype());
// theWSDV.setStorageID(wContent.getStorageID());
// theWSDV.setId(wContent.getId());
//
// return destList;
// return theWSDV;
// }
//
// /**
// * To layer concessione.
// *
// * @param layerConcessione the layer concessione
// * @return the layer concessione data view
// */
// public static LayerConcessioneDV toLayerConcessione(LayerConcessione layerConcessione) {
//
// if (layerConcessione == null)
// return null;
//
// LOG.debug("Converting: "+layerConcessione);
// LayerConcessioneDV theLayerConessione = new LayerConcessioneDV();
// theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection());
//
// String wmsLink = layerConcessione.getWmsLink();
// String layerName = null;
// BoundsMap bounds = null;
//
// //reading layer name from wmsLink
// //string bbox
// if(wmsLink!=null) {
// layerName = URLParserUtil.extractValueOfParameterFromURL("layers", wmsLink);
// String bbox = URLParserUtil.extractValueOfParameterFromURL("bbox", wmsLink);
// String wmsVersion = URLParserUtil.extractValueOfParameterFromURL("version", wmsLink);
// bounds = toBoundMap(wmsVersion, bbox, ",");
// LOG.debug("Built bounds from wmsLInk: "+bounds);
// }
//
// if(layerName!=null)
// theLayerConessione.setLayerName(layerName);
// else
// theLayerConessione.setLayerName(layerConcessione.getLayerName());
//
//
// theLayerConessione.setWmsLink(wmsLink);
// theLayerConessione.setLayerID(layerConcessione.getLayerID());
// theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
// theLayerConessione.setAuthors(layerConcessione.getAuthors());
//
// if(bounds==null)
// bounds = toBoundMap(layerConcessione.getBbox());
//
// theLayerConessione.setBbox(bounds);
// theLayerConessione.setCreationTime(toDateFormatString(layerConcessione.getCreationTime()));
// theLayerConessione.setId(layerConcessione.getId());
// theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
// theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
// theLayerConessione.setPolicy(toPolicy(layerConcessione.getPolicy()));
// //theLayerConessione.setRecord(recordDV);
// theLayerConessione.setScalaAcquisizione(layerConcessione.getScalaAcquisizione());
// theLayerConessione.setSubTopic(layerConcessione.getSubTopic());
// theLayerConessione.setTitolo(layerConcessione.getTitolo());
// theLayerConessione.setTopicCategory(layerConcessione.getTopicCategory());
// theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
//
//
// LOG.debug("Returning: " + theLayerConessione);
// return theLayerConessione;
//
// }
//
// /**
// * To other content DV.
// *
// * @param otherContent the other content
// * @return the other content DV
// */
// public static OtherContentDV toOtherContentDV(OtherContent otherContent) {
//
// if (otherContent == null)
// return null;
//
// OtherContentDV theOtherContent = new OtherContentDV();
// theOtherContent.setCreationTime(toDateFormatString(otherContent.getCreationTime()));
// theOtherContent.setId(otherContent.getId());
// theOtherContent.setLicenseID(otherContent.getLicenseID());
// theOtherContent.setPolicy(toPolicy(otherContent.getPolicy()));
// //theOtherContent.setRecord(recordDV);
// theOtherContent.setTitolo(otherContent.getTitolo());
//
// return theOtherContent;
// }
//
// /**
// * To bound map.
// *
// * @param bbox the bbox
// * @return the bounds map
// */
// public static BoundsMap toBoundMap(BBOX bbox) {
//
// if (bbox == null)
// return null;
//
// return new BoundsMap(bbox.getMinLong(), bbox.getMinLat(), bbox.getMaxLong(), bbox.getMaxLat(), null);
// }
//
//
// /**
// * To bound map.
// *
// * @param wmsVersion the wms version
// * @param bbox the bbox
// * @param separator the separator
// * @return the bounds map
// */
// public static BoundsMap toBoundMap(String wmsVersion, String bbox, String separator) {
//
// if (bbox == null)
// return null;
//
// if(wmsVersion==null)
// return null;
//
// if(separator==null)
// separator = ",";
//
// try {
//
// String[] bboxArr = bbox.split(separator);
//
// if(wmsVersion.startsWith("1.3")) {
// //is 1.3.x
// return new BoundsMap(toDouble(bboxArr[1]), toDouble(bboxArr[0]), toDouble(bboxArr[3]), toDouble(bboxArr[2]), wmsVersion);
// }else {
// //should be 1.1.X
// return new BoundsMap(toDouble(bboxArr[0]), toDouble(bboxArr[1]), toDouble(bboxArr[2]), toDouble(bboxArr[3]), wmsVersion);
// }
// }catch (Exception e) {
// LOG.warn("Error on creating Bounds for wmsVersion "+wmsVersion+" and bbox "+bbox+" : ",e);
// return null;
// }
// }
//
// /**
// * To double.
// *
// * @param value the value
// * @return the double
// */
// public static Double toDouble(String value) {
// try {
// return Double.parseDouble(value);
// }catch (Exception e) {
// LOG.warn("Error on parsing "+value+" as double: ",e);
// return null;
// }
// }
/**
* To user.
*
* @param username the username
* @return the string
*/
public static String toUser(String username) {
if(username==null)
return null;
return username;
}
/**
* To policy.
*
* @param policy the policy
* @return the string
*/
public static String toPolicy(AccessPolicy policy) {
if(policy==null)
return null;
return policy.name();
}
/**
* To date format string.
*
* @param dateTime the date time
* @return the string
*/
public static String toDateFormatString(LocalDateTime dateTime) {
if(dateTime==null)
return null;
String time = dateTime.toString();
DateTimeFormatter formatter = null;
try {
if(!time.endsWith(NO_TIME)) {
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
}else {
time = time.replace(NO_TIME, "");
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
}
}catch (Exception e) {
LOG.warn("Parsing error: ",e);
}
try {
if(formatter!=null)
return dateTime.format(formatter);
}catch (Exception e) {
LOG.warn("Date format error: ",e);
}
return dateTime.toString();
}
/**
* To abstract relazione scavo.
*
* @param relazioneScavo the relazione scavo
* @return the abstract relazione scavo DV
*/
public static AbstractRelazioneScavoDV toAbstractRelazioneScavo(RelazioneScavo relazioneScavo) {
if (relazioneScavo == null)
return null;
AbstractRelazioneScavoDV theRelazioneDiScavo = new AbstractRelazioneScavoDV();
theRelazioneDiScavo.setAbstractSectionIta(relazioneScavo.getAbstractIta());
theRelazioneDiScavo.setAbstractSectionEng(relazioneScavo.getAbstractEng());
theRelazioneDiScavo.setCreationTime(toDateFormatString(relazioneScavo.getCreationTime()));
theRelazioneDiScavo.setId(relazioneScavo.getId());
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
//theRelazioneDiScavo.setRecord(recordDV);
theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
LOG.debug("Returning: " + theRelazioneDiScavo);
return theRelazioneDiScavo;
}
/**
* To relazione scavo.
*
* @param relazioneScavo the relazione scavo
* @return the relazione scavo data view
*/
public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo) {
if (relazioneScavo == null)
return null;
RelazioneScavoDV theRelazioneDiScavo = new RelazioneScavoDV();
theRelazioneDiScavo.setCreationTime(toDateFormatString(relazioneScavo.getCreationTime()));
theRelazioneDiScavo.setId(relazioneScavo.getId());
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
//theRelazioneDiScavo.setRecord(recordDV);
theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
List<PersistedContent> actContent = relazioneScavo.getActualContent();
if(actContent!=null && actContent.size()>0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if(content!=null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent)content));
}
}
theRelazioneDiScavo.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theRelazioneDiScavo);
return theRelazioneDiScavo;
}
/**
* To uploaded image.
*
* @param uploadedImage the uploaded image
* @return the uploaded image data-view
*/
public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage) {
if (uploadedImage == null)
return null;
UploadedImageDV theUploadedImageDV = new UploadedImageDV();
theUploadedImageDV.setCreationTime(toDateFormatString(uploadedImage.getCreationTime()));
theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
theUploadedImageDV.setFormat(uploadedImage.getFormat());
theUploadedImageDV.setId(uploadedImage.getId());
theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
//theUploadedImageDV.setRecord(recordDV);
theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
List<PersistedContent> actContent = uploadedImage.getActualContent();
if(actContent!=null && actContent.size()>0) {
List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
for (PersistedContent content : actContent) {
if(content!=null && content instanceof WorkspaceContent) {
listWsContent.add(toWorkspaceContent((WorkspaceContent)content));
}
}
theUploadedImageDV.setListWsContent(listWsContent);
}
LOG.debug("Returning: " + theUploadedImageDV);
return theUploadedImageDV;
}
/**
* To workspace content.
*
* @param wContent the w content
* @return the workspace content DV
*/
public static WorkspaceContentDV toWorkspaceContent(WorkspaceContent wContent){
if (wContent == null)
return null;
WorkspaceContentDV theWSDV = new WorkspaceContentDV();
theWSDV.setLink(wContent.getLink());
theWSDV.setMimetype(wContent.getMimetype());
theWSDV.setStorageID(wContent.getStorageID());
theWSDV.setId(wContent.getId());
return theWSDV;
}
/**
* To layer concessione.
*
* @param layerConcessione the layer concessione
* @return the layer concessione data view
*/
public static LayerConcessioneDV toLayerConcessione(LayerConcessione layerConcessione) {
if (layerConcessione == null)
return null;
LOG.debug("Converting: "+layerConcessione);
LayerConcessioneDV theLayerConessione = new LayerConcessioneDV();
theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection());
String wmsLink = layerConcessione.getWmsLink();
String layerName = null;
BoundsMap bounds = null;
//reading layer name from wmsLink
//string bbox
if(wmsLink!=null) {
layerName = URLParserUtil.extractValueOfParameterFromURL("layers", wmsLink);
String bbox = URLParserUtil.extractValueOfParameterFromURL("bbox", wmsLink);
String wmsVersion = URLParserUtil.extractValueOfParameterFromURL("version", wmsLink);
bounds = toBoundMap(wmsVersion, bbox, ",");
LOG.debug("Built bounds from wmsLInk: "+bounds);
}
if(layerName!=null)
theLayerConessione.setLayerName(layerName);
else
theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setWmsLink(wmsLink);
theLayerConessione.setLayerID(layerConcessione.getLayerID());
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
theLayerConessione.setAuthors(layerConcessione.getAuthors());
if(bounds==null)
bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(toDateFormatString(layerConcessione.getCreationTime()));
theLayerConessione.setId(layerConcessione.getId());
theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
theLayerConessione.setPolicy(toPolicy(layerConcessione.getPolicy()));
//theLayerConessione.setRecord(recordDV);
theLayerConessione.setScalaAcquisizione(layerConcessione.getScalaAcquisizione());
theLayerConessione.setSubTopic(layerConcessione.getSubTopic());
theLayerConessione.setTitolo(layerConcessione.getTitolo());
theLayerConessione.setTopicCategory(layerConcessione.getTopicCategory());
theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
LOG.debug("Returning: " + theLayerConessione);
return theLayerConessione;
}
/**
* To other content DV.
*
* @param otherContent the other content
* @return the other content DV
*/
public static OtherContentDV toOtherContentDV(OtherContent otherContent) {
if (otherContent == null)
return null;
OtherContentDV theOtherContent = new OtherContentDV();
theOtherContent.setCreationTime(toDateFormatString(otherContent.getCreationTime()));
theOtherContent.setId(otherContent.getId());
theOtherContent.setLicenseID(otherContent.getLicenseID());
theOtherContent.setPolicy(toPolicy(otherContent.getPolicy()));
//theOtherContent.setRecord(recordDV);
theOtherContent.setTitolo(otherContent.getTitolo());
return theOtherContent;
}
/**
* To bound map.
*
* @param bbox the bbox
* @return the bounds map
*/
public static BoundsMap toBoundMap(BBOX bbox) {
if (bbox == null)
return null;
return new BoundsMap(bbox.getMinLong(), bbox.getMinLat(), bbox.getMaxLong(), bbox.getMaxLat(), null);
}
/**
* To bound map.
*
* @param wmsVersion the wms version
* @param bbox the bbox
* @param separator the separator
* @return the bounds map
*/
public static BoundsMap toBoundMap(String wmsVersion, String bbox, String separator) {
if (bbox == null)
return null;
if(wmsVersion==null)
return null;
if(separator==null)
separator = ",";
try {
String[] bboxArr = bbox.split(separator);
if(wmsVersion.startsWith("1.3")) {
//is 1.3.x
return new BoundsMap(toDouble(bboxArr[1]), toDouble(bboxArr[0]), toDouble(bboxArr[3]), toDouble(bboxArr[2]), wmsVersion);
}else {
//should be 1.1.X
return new BoundsMap(toDouble(bboxArr[0]), toDouble(bboxArr[1]), toDouble(bboxArr[2]), toDouble(bboxArr[3]), wmsVersion);
}
}catch (Exception e) {
LOG.warn("Error on creating Bounds for wmsVersion "+wmsVersion+" and bbox "+bbox+" : ",e);
return null;
}
}
/**
* To double.
*
* @param value the value
* @return the double
*/
public static Double toDouble(String value) {
try {
return Double.parseDouble(value);
}catch (Exception e) {
LOG.warn("Error on parsing "+value+" as double: ",e);
return null;
}
}
}
//
//
//}

11
src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java

@ -12,26 +12,27 @@ import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.application.geoportalcommon.GeoNaDataViewerProfileReader;
import org.gcube.application.geoportalcommon.GeoportalCommon;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Styles;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/FeatureParser.java

@ -15,9 +15,9 @@ import java.util.List;
import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.Coordinate;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureGeometry;

4
src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/GisMakers.java

@ -1,8 +1,8 @@
package org.gcube.portlets.user.geoportaldataviewer.server.gis;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.server.gis.MapServerRecognize.SERVERTYPE;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

2
src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/GeoNaSpatialQueryResult.java

@ -4,9 +4,9 @@ import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
/**

170
src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/BoundsMap.java

@ -1,170 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
import java.io.Serializable;
/**
* The Class BoundsMap.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 27, 2020
*/
public class BoundsMap implements Serializable{
/**
*
*/
private static final long serialVersionUID = 69005924452960006L;
/** The lower left X. */
private double lowerLeftX = 0.0;
/** The lower left Y. */
private double lowerLeftY = 0.0;
/** The upper right X. */
private double upperRightX = 0.0;
/** The upper right Y. */
private double upperRightY = 0.0;
/** The crs. */
private String crs = "";
/**
* Instantiates a new bounds map.
*/
public BoundsMap() {
}
/**
* Instantiates a new bounds map.
*
* @param lowerLeftX the lower left X
* @param lowerLeftY the lower left Y
* @param upperRightX the upper right X
* @param upperRightY the upper right Y
* @param crs the crs
*/
public BoundsMap(double lowerLeftX, double lowerLeftY, double upperRightX,
double upperRightY, String crs) {
super();
this.lowerLeftX = lowerLeftX;
this.lowerLeftY = lowerLeftY;
this.upperRightX = upperRightX;
this.upperRightY = upperRightY;
this.crs = crs;
}
/**
* Gets the lower left X.
*
* @return the lower left X
*/
public double getLowerLeftX() {
return lowerLeftX;
}
/**
* Sets the lower left X.
*
* @param lowerLeftX the new lower left X
*/
public void setLowerLeftX(double lowerLeftX) {
this.lowerLeftX = lowerLeftX;
}
/**
* Gets the lower left Y.
*
* @return the lower left Y
*/
public double getLowerLeftY() {
return lowerLeftY;
}
/**
* Sets the lower left Y.
*
* @param lowerLeftY the new lower left Y
*/
public void setLowerLeftY(double lowerLeftY) {
this.lowerLeftY = lowerLeftY;
}
/**
* Gets the upper right X.
*
* @return the upper right X
*/
public double getUpperRightX() {
return upperRightX;
}
/**
* Sets the upper right X.
*
* @param upperRightX the new upper right X
*/
public void setUpperRightX(double upperRightX) {
this.upperRightX = upperRightX;
}
/**
* Gets the upper right Y.
*
* @return the upper right Y
*/
public double getUpperRightY() {
return upperRightY;
}
/**
* Sets the upper right Y.
*
* @param upperRightY the new upper right Y
*/
public void setUpperRightY(double upperRightY) {
this.upperRightY = upperRightY;
}