in progress to show the page with details

This commit is contained in:
francesco 2020-11-03 13:09:08 +01:00
parent ed61ffde87
commit 6c23c0d1a1
26 changed files with 413 additions and 107 deletions

View File

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

52
pom.xml
View File

@ -49,29 +49,29 @@
</developers>
<dependencyManagement>
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.distribution</groupId> -->
<!-- <artifactId>maven-portal-bom</artifactId> -->
<!-- <version>3.6.0</version> -->
<!-- <type>pom</type> -->
<!-- <scope>import</scope> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-user</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-servlet</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-dev</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<!-- </dependencies> -->
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.distribution</groupId> -->
<!-- <artifactId>maven-portal-bom</artifactId> -->
<!-- <version>3.6.0</version> -->
<!-- <type>pom</type> -->
<!-- <scope>import</scope> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-user</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-servlet</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-dev</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<!-- </dependencies> -->
</dependencyManagement>
<dependencies>
@ -115,6 +115,12 @@
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-logic</artifactId>

View File

@ -1,8 +1,15 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.List;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.ProductType;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
@ -10,7 +17,9 @@ import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.RootPanel;
// TODO: Auto-generated Javadoc
@ -47,8 +56,10 @@ public class GeoportalDataViewer implements EntryPoint {
/** The param layer title. */
private String paramLayerTitle;
private HandlerManager eventBus = new HandlerManager("");
/** The layer manager. */
private LayerManager layerManager = new LayerManager();
private LayerManager layerManager = new LayerManager(eventBus);
//https://data.d4science.org/gis-viewer-app/?wmsrequest=https%3A%2F%2Fgeona-proto.d4science.org%2Fgeoserver%2Fconcessioni_conf%2Fwms%3Fservice%3DWMS%26version%3D1.1.0%26request%3DGetMap%26layers%3Dconcessioni_conf%3Acentroids_concessioni%26styles%3D%26bbox%3D8.476%2C39.179%2C17.391%2C45.772%26width%3D768%26height%3D567%26srs%3DEPSG%3A4326%26format%3Dapplication%2Fopenlayers&zoom=6&centermap=12.45%2C42.98
@ -57,7 +68,7 @@ public class GeoportalDataViewer implements EntryPoint {
*/
public void onModuleLoad() {
mainPanel = new GeonaDataViewMainPanel();
mainPanel = new GeonaDataViewMainPanel(eventBus);
RootPanel.get(APP_DIV).add(mainPanel);
@ -118,6 +129,43 @@ public class GeoportalDataViewer implements EntryPoint {
}
}
bindEvents();
}
private void bindEvents() {
eventBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
@Override
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
FeatureRow fRow = showDetailsEvent.getFeatureRow();
if(fRow!=null) {
if(showDetailsEvent.getProductType().equals(ProductType.CONCESSIONE)) {
List<String> productIds = fRow.getMapProperties().get("product_id");
if(productIds!=null && productIds.size()>0) {
long id = Long.parseLong(productIds.get(0));
GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(id, new AsyncCallback<ConcessioneDV>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(ConcessioneDV result) {
mainPanel.addNewTab(result);
}
});
}else
Window.alert("No product id found");
}
}
}
});
}
}

View File

@ -4,8 +4,9 @@ import java.util.List;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -21,4 +22,6 @@ public interface GeoportalDataViewerService extends RemoteService {
List<GeoNaDataObject> getDataResult(List<LayerItem> layerItems, String mapSrsName, BoundsMap mapBBOX,
int maxWFSFeature, double zoomLevel);
ConcessioneDV getConcessioneForId(Long id) throws Exception;
}

View File

@ -4,8 +4,9 @@ import java.util.List;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -33,4 +34,6 @@ public interface GeoportalDataViewerServiceAsync {
void getDataResult(List<LayerItem> layerItems, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel,
AsyncCallback<List<GeoNaDataObject>> callback);
void getConcessioneForId(Long id, AsyncCallback<ConcessioneDV> callback);
}

View File

@ -8,17 +8,23 @@ import java.util.Map;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.ProductType;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForWMSRequest;
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.ZAxis;
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.ZAxis;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -45,10 +51,14 @@ public class LayerManager {
private HandlerManager eventBus = new HandlerManager("");
private HandlerManager applicationBus;
/**
* Instantiates a new layer manager.
* @param applicationBus
*/
public LayerManager() {
public LayerManager(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
bindEvents();
}
@ -137,6 +147,17 @@ public class LayerManager {
flex.setHTML(2, 0, new HTML("<code>"+entries.get(key).get(0)).toString()+"</code>");
}
}
Button button = new Button("Open Details");
button.setType(ButtonType.LINK);
button.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(new ShowDetailsEvent(ProductType.CONCESSIONE, features.get(0)));
}
});
flex.add(button);
featureFound = true;
break; //Only the first one
}

View File

@ -0,0 +1,58 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.ProductType;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class QueryDataEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 29, 2020
*/
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
private ProductType productType;
private FeatureRow featureRow;
/**
* Instantiates a new table row selected event.
* @param coordinate
*/
public ShowDetailsEvent(ProductType productType, FeatureRow row) {
this.productType = productType;
this.featureRow = row;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowDetailsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowDetailsEventHandler handler) {
handler.onShowDetails(this);
}
public ProductType getProductType() {
return productType;
}
public FeatureRow getFeatureRow() {
return featureRow;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ShowDetailsEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 3, 2020
*/
public interface ShowDetailsEventHandler extends EventHandler {
/**
* On show details.
*
* @param showDetailsEvent the show details event
*/
void onShowDetails(ShowDetailsEvent showDetailsEvent);
}

View File

@ -1,17 +1,21 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.TabPanel;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class GeonaDataViewMainPanel extends Composite {
@ -33,6 +37,9 @@ public class GeonaDataViewMainPanel extends Composite {
@UiField
Button removeQuery;
@UiField
TabPanel mainTabPanel;
// @UiField
// ButtonGroup buttonGroup;
@ -40,8 +47,11 @@ public class GeonaDataViewMainPanel extends Composite {
private OpenLayerOSM map;
public GeonaDataViewMainPanel() {
private HandlerManager eventBus;
public GeonaDataViewMainPanel(HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
mapPanel = new MapPanel("600px");
mapTabPanel.add(mapPanel);
bindHandlers();
@ -106,4 +116,12 @@ public class GeonaDataViewMainPanel extends Composite {
}
public void addNewTab(ConcessioneDV cdv) {
Tab tab = new Tab();
String nome = cdv.getNome();
tab.setHeading(nome);
tab.add(new HTML(cdv.toString()));
}
}

View File

@ -15,7 +15,7 @@
<b:NavLink ui:field="dataPointSelection"
addStyleNames="{style.margin-right-10}">Data Point
Selection</b:NavLink>
<b:NavLink ui:field="dataBoxSelection">Data Box
<b:NavLink ui:field="dataBoxSelection" visible="false">Data Box
Selection</b:NavLink>
<!-- </b:ButtonGroup> -->
</b:DropdownButton>

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatterBuilder;
import java.util.ArrayList;
import java.util.List;
@ -31,6 +33,15 @@ public class ConvertToDataViewModel {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
public static final String DATE_FORMAT = "yyyy-MM-dd";
public static final String HOURS_MINUTES_SEPARATOR = ":";
public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
public static final DateTimeFormatterBuilder dtf = new DateTimeFormatterBuilder()
.appendPattern(DATE_FORMAT + " " + TIME_FORMAT);
/**
* To concessione.
*
@ -38,10 +49,9 @@ public class ConvertToDataViewModel {
* @return the concessione
* @throws Exception the exception
*/
public static ConcessioneDV toConcessione(
Concessione concessione) throws Exception {
public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
if(concessione==null)
if (concessione == null)
return null;
ConcessioneDV theConcessione = new ConcessioneDV();
@ -50,25 +60,27 @@ public class ConvertToDataViewModel {
theConcessione.setCentroidLat(concessione.getCentroidLat());
theConcessione.setCentroidLong(concessione.getCentroidLong());
theConcessione.setContributore(concessione.getContributore());
theConcessione.setCreationTime(concessione.getCreationTime());
theConcessione.setCreationUser(concessione.getCreationUser());
theConcessione.setDataFineProgetto(concessione.getDataFineProgetto());
theConcessione.setDataInizioProgetto(concessione.getDataInizioProgetto());
theConcessione.setCreationTime(toDateString(concessione.getCreationTime()));
theConcessione.setCreationUser(concessione.getCreationUser().toString());
theConcessione.setDataFineProgetto(toDateString(concessione.getDataFineProgetto()));
theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setId(concessione.getId());
if(concessione.getGenericContent()!=null){
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(concessione.getGenericContent().size());
if (concessione.getGenericContent() != null) {
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
concessione.getGenericContent().size());
for (OtherContent gc : concessione.getGenericContent()) {
otherContentsDV.add(toOtherContentDV(gc, theConcessione));
}
theConcessione.setGenericContent(otherContentsDV);
}
if(concessione.getImmaginiRappresentative()!=null){
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(concessione.getImmaginiRappresentative().size());
if (concessione.getImmaginiRappresentative() != null) {
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
concessione.getImmaginiRappresentative().size());
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
uploadedImagesDV.add(toUploadedImage(ui, theConcessione));
}
@ -76,22 +88,23 @@ public class ConvertToDataViewModel {
}
theConcessione.setIntroduzione(concessione.getIntroduzione());
theConcessione.setLastUpdateTime(concessione.getLastUpdateTime());
theConcessione.setLastUpdateTime(toDateString(concessione.getLastUpdateTime()));
theConcessione.setLastUpdateUser(concessione.getLastUpdateUser());
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setNome(concessione.getNome());
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
if(concessione.getPianteFineScavo()!=null){
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(concessione.getPianteFineScavo().size());
if (concessione.getPianteFineScavo() != null) {
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
concessione.getPianteFineScavo().size());
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
piantaScavoDV.add(toLayerConcessione(lc, theConcessione));
}
theConcessione.setPianteFineScavo(piantaScavoDV);
}
if(concessione.getPosizionamentoScavo()!=null){
if (concessione.getPosizionamentoScavo() != null) {
LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo(), theConcessione);
theConcessione.setPosizionamentoScavo(thePosizScavo);
}
@ -108,11 +121,15 @@ public class ConvertToDataViewModel {
theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion());
LOG.debug("Returning concessione: "+theConcessione);
LOG.debug("Returning concessione: " + theConcessione);
return theConcessione;
}
private static String toDateString(LocalDateTime dateTime) {
return dateTime.toString();
}
/**
* To relazione scavo.
*
@ -127,7 +144,7 @@ public class ConvertToDataViewModel {
RelazioneScavoDV theRelazioneDiScavo = new RelazioneScavoDV();
theRelazioneDiScavo.setAbstractSection(relazioneScavo.getAbstractSection());
theRelazioneDiScavo.setCreationTime(relazioneScavo.getCreationTime());
theRelazioneDiScavo.setCreationTime(toDateString(relazioneScavo.getCreationTime()));
theRelazioneDiScavo.setId(relazioneScavo.getId());
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelazioneDiScavo.setPolicy(relazioneScavo.getPolicy().name());
@ -136,7 +153,7 @@ public class ConvertToDataViewModel {
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
LOG.debug("Returning: "+theRelazioneDiScavo);
LOG.debug("Returning: " + theRelazioneDiScavo);
return theRelazioneDiScavo;
}
@ -153,7 +170,7 @@ public class ConvertToDataViewModel {
return null;
UploadedImageDV theUploadedImageDV = new UploadedImageDV();
theUploadedImageDV.setCreationTime(uploadedImage.getCreationTime());
theUploadedImageDV.setCreationTime(toDateString(uploadedImage.getCreationTime()));
theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
theUploadedImageDV.setFormat(uploadedImage.getFormat());
theUploadedImageDV.setId(uploadedImage.getId());
@ -164,7 +181,7 @@ public class ConvertToDataViewModel {
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
LOG.debug("Returning: "+theUploadedImageDV);
LOG.debug("Returning: " + theUploadedImageDV);
return theUploadedImageDV;
}
@ -188,7 +205,7 @@ public class ConvertToDataViewModel {
theLayerConessione.setAuthors(layerConcessione.getAuthors());
BoundsMap bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(layerConcessione.getCreationTime());
theLayerConessione.setCreationTime(toDateString(layerConcessione.getCreationTime()));
theLayerConessione.setId(layerConcessione.getId());
theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
@ -201,7 +218,7 @@ public class ConvertToDataViewModel {
theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
theLayerConessione.setWmsLink(layerConcessione.getWmsLink());
LOG.debug("Returning: "+theLayerConessione);
LOG.debug("Returning: " + theLayerConessione);
return theLayerConessione;
}
@ -219,7 +236,7 @@ public class ConvertToDataViewModel {
return null;
OtherContentDV theOtherContent = new OtherContentDV();
theOtherContent.setCreationTime(otherContent.getCreationTime());
theOtherContent.setCreationTime(toDateString(otherContent.getCreationTime()));
theOtherContent.setId(otherContent.getId());
theOtherContent.setLicenseID(otherContent.getLicenseID());
theOtherContent.setPolicy(otherContent.getPolicy().name());

View File

@ -11,13 +11,12 @@ import org.gcube.application.geoportal.model.concessioni.Concessione;
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.shared.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoInformationForWMSRequest;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.Styles;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.ZAxis;
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.spatial.data.geoutility.GeoNcWMSMetadataUtility;
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
@ -100,7 +99,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("getDataResult called");
List<GeoNaDataObject> result = FeatureParser.getDataResults(layerItems, mapSrsName, selectBBOX, maxWFSFeature);
for (GeoNaDataObject geoNaDataObject : result) {
/*for (GeoNaDataObject geoNaDataObject : result) {
List<FeatureRow> features = geoNaDataObject.getFeatures();
for (FeatureRow feature : features) {
List<String> theProductIds = feature.getMapProperties().get(PRODUCT_ID);
@ -118,11 +117,12 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.error("Error:", e);
}
}
}
}*/
return result;
}
private ConcessioneDV getConcessioneForId(Long id) throws Exception{
@Override
public ConcessioneDV getConcessioneForId(Long id) throws Exception{
LOG.info("");
if(id==null)

View File

@ -17,11 +17,11 @@ import java.util.Map;
import org.apache.commons.io.IOUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.FeatureGeometry;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureGeometry;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

View File

@ -0,0 +1,106 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataviewer.server.util;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
import org.gcube.vomanagement.usermanagement.model.GCubeGroup;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The Class SessionUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 20, 2020
*/
public class SessionUtil {
/** The log. */
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
/**
* Checks if is into portal.
*
* @return true, if is into portal
*/
public static boolean isIntoPortal() {
try {
UserLocalServiceUtil.getService();
return true;
}catch (Exception ex) {
LOG.debug("Development Mode ON");
return false;
}
}
/**
* Retrieve the current user by using the portal manager.
*
* @param request the request
* @return a GcubeUser object
*/
public static GCubeUser getCurrentUser(HttpServletRequest request){
if(request == null)
throw new IllegalArgumentException("HttpServletRequest is null!");
PortalContext pContext = PortalContext.getConfiguration();
GCubeUser user = pContext.getCurrentUser(request);
LOG.debug("Returning user " + user);
return user;
}
/**
* Retrieve the current scope by using the portal manager.
*
* @param request the request
* @param setInThread the set in thread
* @return a GcubeUser object
*/
public static String getCurrentContext(HttpServletRequest request, boolean setInThread){
if(request == null)
throw new IllegalArgumentException("HttpServletRequest is null!");
PortalContext pContext = PortalContext.getConfiguration();
String context = pContext.getCurrentScope(request);
LOG.debug("Returning context " + context);
if(context != null && setInThread)
ScopeProvider.instance.set(context);
return context;
}
/**
* Retrieve the group given the scope.
*
* @param scope the scope
* @return the group from scope
* @throws UserManagementSystemException the user management system exception
* @throws GroupRetrievalFault the group retrieval fault
*/
public static GCubeGroup getGroupFromScope(String scope) throws UserManagementSystemException, GroupRetrievalFault{
if(scope == null || scope.isEmpty())
throw new IllegalArgumentException("Scope is missing here!!");
GroupManager gm = new LiferayGroupManager();
long groupId = gm.getGroupIdFromInfrastructureScope(scope);
return gm.getGroup(groupId);
}
}

View File

@ -2,9 +2,9 @@ package org.gcube.portlets.user.geoportaldataviewer.shared;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
@ -23,7 +23,7 @@ public class GeoNaDataObject implements Serializable{
private static final long serialVersionUID = 5566069859060851625L;
/** The form data entry fields. */
private List<FeatureRow> features;
private String productType; //e.g. "Concessioni"
private ProductType productType;
private LayerItem layerItem;
private ConcessioneDV concessioneDV;
@ -42,11 +42,11 @@ public class GeoNaDataObject implements Serializable{
this.features = features;
}
public String getProductType() {
public ProductType getProductType() {
return productType;
}
public void setProductType(String productType) {
public void setProductType(ProductType productType) {
this.productType = productType;
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.shared;
public enum ProductType {
CONCESSIONE
}

View File

@ -5,6 +5,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
// TODO: Auto-generated Javadoc
/**
* The Class LayerItem.

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
import java.io.Serializable;

View File

@ -1,14 +1,12 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataviewer.shared;
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.FeatureGeometry;
/**
* The Class FeatureRow.
*

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms;
import java.io.Serializable;
import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms;
import java.io.Serializable;

View File

@ -1,7 +1,7 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms;
import java.util.List;
import java.util.Map;

View File

@ -1,7 +1,7 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms;
import java.io.Serializable;
import java.util.List;

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.products;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -53,10 +52,10 @@ public class ConcessioneDV extends RecordDV implements Serializable {
private List<String> risorseCorrelate;
/** The data inizio progetto. */
private LocalDateTime dataInizioProgetto;
private String dataInizioProgetto;
/** The data fine progetto. */
private LocalDateTime dataFineProgetto;
private String dataFineProgetto;
/** The titolare licenza. */
private String titolareLicenza;
@ -283,7 +282,7 @@ public class ConcessioneDV extends RecordDV implements Serializable {
*
* @return the data inizio progetto
*/
public LocalDateTime getDataInizioProgetto() {
public String getDataInizioProgetto() {
return dataInizioProgetto;
}
@ -292,7 +291,7 @@ public class ConcessioneDV extends RecordDV implements Serializable {
*
* @param dataInizioProgetto the new data inizio progetto
*/
public void setDataInizioProgetto(LocalDateTime dataInizioProgetto) {
public void setDataInizioProgetto(String dataInizioProgetto) {
this.dataInizioProgetto = dataInizioProgetto;
}
@ -301,7 +300,7 @@ public class ConcessioneDV extends RecordDV implements Serializable {
*
* @return the data fine progetto
*/
public LocalDateTime getDataFineProgetto() {
public String getDataFineProgetto() {
return dataFineProgetto;
}
@ -310,7 +309,7 @@ public class ConcessioneDV extends RecordDV implements Serializable {
*
* @param dataFineProgetto the new data fine progetto
*/
public void setDataFineProgetto(LocalDateTime dataFineProgetto) {
public void setDataFineProgetto(String dataFineProgetto) {
this.dataFineProgetto = dataFineProgetto;
}

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.products.content;
import java.io.Serializable;
import java.time.LocalDateTime;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
@ -32,7 +31,7 @@ public abstract class AssociatedContentDV implements Serializable{
private String titolo;
/** The creation time. */
private LocalDateTime creationTime = LocalDateTime.now();
private String creationTime;
/** The record. */
private RecordDV record;
@ -54,7 +53,7 @@ public abstract class AssociatedContentDV implements Serializable{
* @param creationTime the creation time
* @param record the record
*/
public AssociatedContentDV(long id, String policy, String licenseID, String titolo, LocalDateTime creationTime,
public AssociatedContentDV(long id, String policy, String licenseID, String titolo, String creationTime,
RecordDV record) {
super();
this.id = id;
@ -142,7 +141,7 @@ public abstract class AssociatedContentDV implements Serializable{
*
* @return the creation time
*/
public LocalDateTime getCreationTime() {
public String getCreationTime() {
return creationTime;
}
@ -151,7 +150,7 @@ public abstract class AssociatedContentDV implements Serializable{
*
* @param creationTime the new creation time
*/
public void setCreationTime(LocalDateTime creationTime) {
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.products.model;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* The Class Record.
@ -42,13 +41,13 @@ public abstract class RecordDV implements Serializable {
/** The last update time. */
// Accounting
private LocalDateTime lastUpdateTime = LocalDateTime.now();
private String lastUpdateTime;
/** The last update user. */
private String lastUpdateUser;
/** The creation time. */
private LocalDateTime creationTime = LocalDateTime.now();
private String creationTime;
/** The creation user. */
private String creationUser;
@ -191,7 +190,7 @@ public abstract class RecordDV implements Serializable {
*
* @return the last update time
*/
public LocalDateTime getLastUpdateTime() {
public String getLastUpdateTime() {
return lastUpdateTime;
}
@ -200,7 +199,7 @@ public abstract class RecordDV implements Serializable {
*
* @param lastUpdateTime the new last update time
*/
public void setLastUpdateTime(LocalDateTime lastUpdateTime) {
public void setLastUpdateTime(String lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
@ -227,7 +226,7 @@ public abstract class RecordDV implements Serializable {
*
* @return the creation time
*/
public LocalDateTime getCreationTime() {
public String getCreationTime() {
return creationTime;
}
@ -236,7 +235,7 @@ public abstract class RecordDV implements Serializable {
*
* @param creationTime the new creation time
*/
public void setCreationTime(LocalDateTime creationTime) {
public void setCreationTime(String creationTime) {
this.creationTime = creationTime;
}