starting integration with geoportal-client

This commit is contained in:
Francesco Mangiacrapa 2020-11-24 17:24:41 +01:00
parent c5e03bbd1a
commit a4b38a3dfc
13 changed files with 263 additions and 261 deletions

View File

@ -6,6 +6,11 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
@ -13,15 +18,10 @@
<attribute name="test" value="true"/> <attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes> <attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
@ -35,6 +35,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -18,18 +18,11 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/resources"/>

44
pom.xml
View File

@ -110,18 +110,18 @@
<artifactId>geo-utility</artifactId> <artifactId>geo-utility</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version> <version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<!-- <dependency> --> <dependency>
<!-- <groupId>org.gcube.common</groupId> --> <groupId>org.gcube.common</groupId>
<!-- <artifactId>authorization-client</artifactId> --> <artifactId>authorization-client</artifactId>
<!-- <version>[2.0.0, 3.0.0-SNAPSHOT)</version> --> <version>[2.0.0, 3.0.0-SNAPSHOT)</version>
<!-- <scope>provided</scope> --> <scope>provided</scope>
<!-- </dependency> --> </dependency>
<!-- <dependency> --> <dependency>
<!-- <groupId>org.gcube.resources.discovery</groupId> --> <groupId>org.gcube.resources.discovery</groupId>
<!-- <artifactId>ic-client</artifactId> --> <artifactId>ic-client</artifactId>
<!-- <version>[1.0.0, 2.0.0-SNAPSHOT)</version> --> <version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<!-- <scope>provided</scope> --> <scope>provided</scope>
<!-- </dependency> --> </dependency>
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId> <artifactId>common-scope-maps</artifactId>
@ -146,17 +146,23 @@
<version>[2.4.1,3.0.0-SNAPSHOT)</version> <version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-url-shortener</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>geoportal-logic</artifactId> <artifactId>geoportal-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
<exclusions> <!-- <exclusions> -->
<exclusion> <!-- <exclusion> -->
<groupId>javax.servlet</groupId> <!-- <groupId>javax.json</groupId> -->
<artifactId>servlet-api</artifactId> <!-- <artifactId>javax.json-api</artifactId> -->
</exclusion> <!-- </exclusion> -->
</exclusions> <!-- </exclusions> -->
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.liferay.portal</groupId> <groupId>com.liferay.portal</groupId>

View File

@ -198,7 +198,7 @@ public class LayerManager {
for (Long key : geoNaDataObject.getMapImages().keySet()) { for (Long key : geoNaDataObject.getMapImages().keySet()) {
List<UploadedImageDV> listUI = geoNaDataObject.getMapImages().get(key); List<UploadedImageDV> listUI = geoNaDataObject.getMapImages().get(key);
GWT.log("Adding images: "+listUI); GWT.log("Adding images: "+listUI);
if(listUI!=null) { if(listUI!=null && listUI.size()>0) {
UploadedImageDV img = listUI.get(0); UploadedImageDV img = listUI.get(0);
if(img.getListWsContent()!=null) { if(img.getListWsContent()!=null) {
WorkspaceContentDV wsContent = img.getListWsContent().get(img.getListWsContent().size()-1); WorkspaceContentDV wsContent = img.getListWsContent().get(img.getListWsContent().size()-1);

View File

@ -6,6 +6,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery.TYPE;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
import ol.Coordinate; import ol.Coordinate;
import ol.Feature; import ol.Feature;
@ -262,7 +263,9 @@ import ol.style.TextOptions;
// textOptions.setFill(new Fill(fillOptions)); // textOptions.setFill(new Fill(fillOptions));
Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, GeoportalDataViewerConstants.EPSG_3857, GeoportalDataViewerConstants.EPSG_4326); Coordinate transfCoord = MapUtils.transformCoordiante(coordinate, GeoportalDataViewerConstants.EPSG_3857, GeoportalDataViewerConstants.EPSG_4326);
textOptions.setText("Long: "+transfCoord.getX() + ", Lat: "+transfCoord.getY()); //DecimalFormat df = new DecimalFormat("#.####");
NumberFormat fmt = NumberFormat.getFormat("#.####");
textOptions.setText("Long: "+fmt.format(transfCoord.getX()) + ", Lat: "+fmt.format(transfCoord.getY()));
Text text = new Text(textOptions); Text text = new Text(textOptions);

View File

@ -66,8 +66,10 @@ public class DetailsPanel extends Composite {
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) { public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
this.displayedRecord = cdv; this.displayedRecord = cdv;
datailsContainerPanel.clear(); datailsContainerPanel.clear();
if(detailsHTMLPanel.getParent()!=null)
if(detailsHTMLPanel.getParent()!=null) {
detailsHTMLPanel.getParent().getElement().setScrollTop(0); detailsHTMLPanel.getParent().getElement().setScrollTop(0);
}
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv)); datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
showPanelDetails(); showPanelDetails();

View File

@ -105,6 +105,7 @@ public class ConcessioneView extends Composite {
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible, boolean openImageButtonVisible) { public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible, boolean openImageButtonVisible) {
this(); this();
GWT.log("Rendering "+concDV.getNome());
this.concessioneDV = concDV; this.concessioneDV = concDV;
this.geonaItemRef = item; this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible; this.viewImageButtonVisible = viewImageButtonVisible;
@ -114,7 +115,7 @@ public class ConcessioneView extends Composite {
introduzione.setText(concessioneDV.getIntroduzione()); introduzione.setText(concessioneDV.getIntroduzione());
if (concessioneDV.getDataInizioProgetto() != null) { if (concessioneDV.getDataInizioProgetto() != null) {
customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataFineProgetto()); customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataInizioProgetto());
} }
if (concessioneDV.getDataFineProgetto() != null) { if (concessioneDV.getDataFineProgetto() != null) {
@ -122,7 +123,7 @@ public class ConcessioneView extends Composite {
} }
if (concessioneDV.getParoleChiaveLibere() != null) { if (concessioneDV.getParoleChiaveLibere() != null) {
customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveICCD(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(), GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getParoleChiaveICCD() != null) { if (concessioneDV.getParoleChiaveICCD() != null) {

View File

@ -17,6 +17,10 @@
position: absolute; position: absolute;
} }
.the-title h1 {
font-size: 28px;
}
.margin-bottom-10 { .margin-bottom-10 {
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -30,7 +34,7 @@
<!-- <g:HTMLPanel ui:field="sharePanel" --> <!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> --> <!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> --> <!-- </g:HTMLPanel> -->
<b:PageHeader ui:field="titolo"></b:PageHeader> <b:PageHeader ui:field="titolo" addStyleNames="{style.the-title}"></b:PageHeader>
<g:HorizontalPanel <g:HorizontalPanel
addStyleNames="{style.margin-bottom-10}"> addStyleNames="{style.margin-bottom-10}">
<b:Button ui:field="shareButton">Share</b:Button> <b:Button ui:field="shareButton">Share</b:Button>

View File

@ -5,15 +5,15 @@ import java.time.format.DateTimeFormatterBuilder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.application.geoportal.model.AccessPolicy; import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.model.concessioni.Concessione; import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione; import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo; import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.model.content.OtherContent; import org.gcube.application.geoportal.common.model.legacy.OtherContent;
import org.gcube.application.geoportal.model.content.PersistedContent; import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.model.content.UploadedImage; import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.model.content.WorkspaceContent; import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.model.gis.BBOX; import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap; 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.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV;
@ -72,7 +72,7 @@ public class ConvertToDataViewModel {
theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto())); theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto()); theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore()); theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(toListString(concessione.getFontiFinanziamento())); theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setId(concessione.getId()); theConcessione.setId(concessione.getId());
theConcessione.setNome(concessione.getNome()); theConcessione.setNome(concessione.getNome());
@ -81,15 +81,15 @@ public class ConvertToDataViewModel {
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser())); theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID()); theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setNome(concessione.getNome()); theConcessione.setNome(concessione.getNome());
theConcessione.setParoleChiaveICCD(toListString(concessione.getParoleChiaveICCD())); theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(toListString(concessione.getParoleChiaveLibere())); theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile()); theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setRisorseCorrelate(toListString(concessione.getRisorseCorrelate())); theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
theConcessione.setSoggetto(concessione.getSoggetto()); theConcessione.setSoggetto(concessione.getSoggetto());
theConcessione.setTitolareCopyright(concessione.getTitolareCopyright()); theConcessione.setTitolareCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolareLicenza(concessione.getTitolareLicenza()); theConcessione.setTitolareLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(toListString(concessione.getTitolari())); theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion()); theConcessione.setVersion(concessione.getVersion());
theConcessione.setRecordType(concessione.getRecordType().name()); theConcessione.setRecordType(concessione.getRecordType().name());
@ -142,17 +142,17 @@ public class ConvertToDataViewModel {
} }
//TO AVOID SERIALIZATION ISSUE AGAINST GWT //TO AVOID SERIALIZATION ISSUE AGAINST GWT
public static List<String> toListString(List<String> orginList){ // public static List<String> toListString(List<String> orginList){
if(orginList==null) // if(orginList==null)
return null; // return null;
//
List<String> destList = new ArrayList<String>(orginList.size()); // List<String> destList = new ArrayList<String>(orginList.size());
for (String orgValue : orginList) { // for (String orgValue : orginList) {
destList.add(orgValue); // destList.add(orgValue);
} // }
//
return destList; // return destList;
} // }
public static String toUser(String username) { public static String toUser(String username) {
@ -199,7 +199,7 @@ public class ConvertToDataViewModel {
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID()); theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy())); theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
//theRelazioneDiScavo.setRecord(recordDV); //theRelazioneDiScavo.setRecord(recordDV);
theRelazioneDiScavo.setResponsabili(toListString(relazioneScavo.getResponsabili())); theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto()); theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo()); theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
@ -227,7 +227,7 @@ public class ConvertToDataViewModel {
theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID()); theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy())); theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
//theUploadedImageDV.setRecord(recordDV); //theUploadedImageDV.setRecord(recordDV);
theUploadedImageDV.setResponsabili(toListString(uploadedImage.getResponsabili())); theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto()); theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo()); theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
@ -284,7 +284,7 @@ public class ConvertToDataViewModel {
theLayerConessione.setLayerName(layerConcessione.getLayerName()); theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setLayerID(layerConcessione.getLayerID()); theLayerConessione.setLayerID(layerConcessione.getLayerID());
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID()); theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
theLayerConessione.setAuthors(toListString(layerConcessione.getAuthors())); theLayerConessione.setAuthors(layerConcessione.getAuthors());
BoundsMap bounds = toBoundMap(layerConcessione.getBbox()); BoundsMap bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds); theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(toDateString(layerConcessione.getCreationTime())); theLayerConessione.setCreationTime(toDateString(layerConcessione.getCreationTime()));

View File

@ -9,11 +9,9 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.gcube.application.geoportal.managers.AbstractRecordManager; import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
import org.gcube.application.geoportal.managers.ManagerFactory; import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.model.Record; import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService; 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.FeatureParser;
@ -189,28 +187,28 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try { try {
LOG.info("Trying to get record for id "+id); LOG.info("Trying to get record for id "+id);
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true); SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
AbstractRecordManager<Record> abmRecord = ManagerFactory.getByRecordID(id); ConcessioniManager concessioniManager = new ConcessioniManager();
LOG.info("Got record for id "+id); Concessione record = concessioniManager.getById(id+"");
Record record = abmRecord.getRecord(); //AbstractRecordManager<Record> abmRecord = ManagerFactory.getByRecordID(id);
Concessione concessione = null; Concessione concessione = null;
if (record != null) { if (record != null) {
if (itemType.equalsIgnoreCase("Concessione") && record instanceof Concessione) {
concessione = (Concessione) record;
List<UploadedImage> images = concessione.getImmaginiRappresentative(); concessione = (Concessione) record;
if (images != null) { List<UploadedImage> images = concessione.getImmaginiRappresentative();
listUI = new ArrayList<UploadedImageDV>();
int max = maxImages < images.size() ? maxImages : images.size(); if (images != null) {
for (int i = 0; i < max; i++) { listUI = new ArrayList<UploadedImageDV>();
UploadedImageDV ui = ConvertToDataViewModel.toUploadedImage(images.get(i)); int max = maxImages < images.size() ? maxImages : images.size();
listUI.add(ui); for (int i = 0; i < max; i++) {
} UploadedImageDV ui = ConvertToDataViewModel.toUploadedImage(images.get(i));
listUI.add(ui);
} }
} }
} }
return listUI; return listUI;
}catch (Exception e) { }catch (Exception e) {
@ -242,7 +240,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
*/ */
@Override @Override
public ConcessioneDV getConcessioneForId(Long id) throws Exception{ public ConcessioneDV getConcessioneForId(Long id) throws Exception{
LOG.info("getConcessioneForId "+id+ "called"); LOG.info("getConcessioneForId "+id+ " called");
ConcessioneDV concessionDV = null; ConcessioneDV concessionDV = null;
@ -252,12 +250,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try { try {
LOG.info("Trying to get record for id "+id); LOG.info("Trying to get record for id "+id);
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true); SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
AbstractRecordManager<Record> abmRecord = ManagerFactory.getByRecordID(id); Concessione concessione = new ConcessioniManager().getById(id+"");
LOG.info("Got record for id "+id); LOG.info("Got concessione for id "+id);
Record record = abmRecord.getRecord(); if(concessione !=null) {
Concessione concessione = null;
if(record !=null && record instanceof Concessione) {
concessione = (Concessione) record;
concessionDV = ConvertToDataViewModel.toConcessione(concessione); concessionDV = ConvertToDataViewModel.toConcessione(concessione);
} }
@ -269,15 +264,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}catch (Exception e) { }catch (Exception e) {
String erroMsg = Concessione.class.getSimpleName() +" with id "+id+" not available"; String erroMsg = Concessione.class.getSimpleName() +" with id "+id+" not available";
LOG.error(erroMsg,e); LOG.error(erroMsg,e);
throw new Exception(erroMsg);
//TODO REMOVE THIS
Concessione concessione= TestModel.prepareConcessione();
LOG.warn("DUMMY CONCESSIONE: "+concessione);
ConcessioneDV theConcessione = ConvertToDataViewModel.toConcessione(concessione);
LOG.warn("RETURNING DUMMY CONCESSIONE: "+theConcessione+"!!!!!\n\n\n\n");
return theConcessione;
//throw new Exception(erroMsg);
} }
} }

View File

@ -1,123 +1,124 @@
package org.gcube.portlets.user.geoportaldataviewer.server; //package org.gcube.portlets.user.geoportaldataviewer.server;
//
import java.time.LocalDateTime; //import java.time.LocalDateTime;
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
//
import org.gcube.application.geoportal.model.AccessPolicy; //import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.model.concessioni.Concessione; //import org.gcube.application.geoportal.common.model.legacy.BBOX;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione; //import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo; //import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.model.content.PersistedContent; //import org.gcube.application.geoportal.common.model.legacy.PersistedContent;
import org.gcube.application.geoportal.model.content.UploadedImage; //import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.model.content.WorkspaceContent; //import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.model.gis.BBOX; //import org.gcube.application.geoportal.common.model.legacy.WorkspaceContent;
//
public class TestModel { //
//public class TestModel {
public static Concessione prepareEmptyConcessione() { //
Concessione concessione = new Concessione(); // public static Concessione prepareEmptyConcessione() {
// Concessione concessione = new Concessione();
// Generic fields //
// // Generic fields
// Concessione fields //
// // Concessione fields
concessione.setNome("Italia, forse"); //
concessione.setIntroduzione("This is my project"); // concessione.setNome("Italia, forse");
concessione.setDescrizioneContenuto("It contains this and that"); // concessione.setIntroduzione("This is my project");
// concessione.setDescrizioneContenuto("It contains this and that");
concessione.setAuthors(Arrays.asList(new String[] { "Some one", "Some, oneelse" })); //
// concessione.setAuthors(Arrays.asList(new String[] { "Some one", "Some, oneelse" }));
concessione.setContributore("Contrib 1"); //
concessione.setTitolari(Arrays.asList(new String[] { "Some one", "Some, oneelse" })); // concessione.setContributore("Contrib 1");
concessione.setResponsabile("Someone"); // concessione.setTitolari(Arrays.asList(new String[] { "Some one", "Some, oneelse" }));
concessione.setEditore("Editore"); // concessione.setResponsabile("Someone");
// concessione.setEditore("Editore");
concessione.setFontiFinanziamento(Arrays.asList(new String[] { "Big pharma", "Pentagon" })); //
// concessione.setFontiFinanziamento(Arrays.asList(new String[] { "Big pharma", "Pentagon" }));
concessione.setSoggetto(Arrays.asList(new String[] { "Research Excavation", "Archeology" })); //
// concessione.setSoggetto(Arrays.asList(new String[] { "Research Excavation", "Archeology" }));
concessione //
.setRisorseCorrelate(Arrays.asList(new String[] { "https://google.com", "https://www.repubblica.it" })); // concessione
// .setRisorseCorrelate(Arrays.asList(new String[] { "https://google.com", "https://www.repubblica.it" }));
concessione.setDataInizioProgetto(LocalDateTime.now()); //
concessione.setDataFineProgetto(LocalDateTime.now()); // concessione.setDataInizioProgetto(LocalDateTime.now());
// concessione.setDataFineProgetto(LocalDateTime.now());
concessione.setLicenzaID("CC-BY"); //
// concessione.setLicenzaID("CC-BY");
concessione.setTitolareLicenza("Qualcun altro"); //
concessione.setTitolareCopyright("Chiedilo in giro"); // concessione.setTitolareLicenza("Qualcun altro");
// concessione.setTitolareCopyright("Chiedilo in giro");
concessione.setParoleChiaveLibere(Arrays.asList(new String[] { "Robba", "Stuff" })); //
concessione.setParoleChiaveICCD(Arrays.asList(new String[] { "vattelapesca", "somthing something" })); // concessione.setParoleChiaveLibere(Arrays.asList(new String[] { "Robba", "Stuff" }));
// concessione.setParoleChiaveICCD(Arrays.asList(new String[] { "vattelapesca", "somthing something" }));
concessione.setLastUpdateTime(LocalDateTime.now()); //
concessione.setCreationTime(LocalDateTime.now()); // concessione.setLastUpdateTime(LocalDateTime.now());
concessione.setLastUpdateUser("fake user"); // concessione.setCreationTime(LocalDateTime.now());
// concessione.setLastUpdateUser("fake user");
concessione.setCentroidLat(43.0); // N-S //
concessione.setCentroidLong(9.0); // E-W // concessione.setCentroidLat(43.0); // N-S
// concessione.setCentroidLong(9.0); // E-W
return concessione; //
} // return concessione;
// }
public static Concessione prepareConcessione() { //
// public static Concessione prepareConcessione() {
Concessione concessione = prepareEmptyConcessione(); //
// Concessione concessione = prepareEmptyConcessione();
// Attachments //
// // Attachments
// Relazione scavo //
RelazioneScavo relScavo = new RelazioneScavo(); // // Relazione scavo
// RelazioneScavo relScavo = new RelazioneScavo();
relScavo.setAbstractSection("simple abstract section"); //
relScavo.setResponsabili(concessione.getAuthors()); // relScavo.setAbstractSection("simple abstract section");
// relScavo.setResponsabili(concessione.getAuthors());
concessione.setRelazioneScavo(relScavo); //
// Immagini rappresentative // concessione.setRelazioneScavo(relScavo);
ArrayList<UploadedImage> imgs = new ArrayList<>(); // // Immagini rappresentative
for (int i = 0; i < 5; i++) { // ArrayList<UploadedImage> imgs = new ArrayList<>();
UploadedImage img = new UploadedImage(); // for (int i = 0; i < 5; i++) {
img.setTitolo("My image number " + i); // UploadedImage img = new UploadedImage();
img.setDidascalia("You can see my image number " + i); // img.setTitolo("My image number " + i);
img.setFormat("TIFF"); // img.setDidascalia("You can see my image number " + i);
img.setCreationTime(LocalDateTime.now()); // img.setFormat("TIFF");
img.setResponsabili(concessione.getAuthors()); // img.setCreationTime(LocalDateTime.now());
List<PersistedContent> actualContentList = new ArrayList<PersistedContent>(1); // img.setResponsabili(concessione.getAuthors());
WorkspaceContent ws = new WorkspaceContent(); // List<PersistedContent> actualContentList = new ArrayList<PersistedContent>(1);
ws.setLink("https://data.dev.d4science.org/shub/E_azRkaVhqTFExMzZvTG9pY0hwSFJNV2tVTHBEMGEycFVsQitvWjZvb29WZjkwRU84b1hXQnp0QjRuSGhrODJqQg=="); // WorkspaceContent ws = new WorkspaceContent();
actualContentList.add(ws); // ws.setLink("https://data.dev.d4science.org/shub/E_azRkaVhqTFExMzZvTG9pY0hwSFJNV2tVTHBEMGEycFVsQitvWjZvb29WZjkwRU84b1hXQnp0QjRuSGhrODJqQg==");
img.setActualContent(actualContentList); // actualContentList.add(ws);
imgs.add(img); // img.setActualContent(actualContentList);
} // imgs.add(img);
concessione.setImmaginiRappresentative(imgs); // }
// Posizionamento // concessione.setImmaginiRappresentative(imgs);
LayerConcessione posizionamento = new LayerConcessione(); // // Posizionamento
posizionamento.setValutazioneQualita("Secondo me si"); // LayerConcessione posizionamento = new LayerConcessione();
posizionamento.setMetodoRaccoltaDati("Fattobbene"); // posizionamento.setValutazioneQualita("Secondo me si");
posizionamento.setScalaAcquisizione("1:10000"); // posizionamento.setMetodoRaccoltaDati("Fattobbene");
posizionamento.setAuthors(concessione.getAuthors()); // posizionamento.setScalaAcquisizione("1:10000");
concessione.setPosizionamentoScavo(posizionamento); // posizionamento.setAuthors(concessione.getAuthors());
// concessione.setPosizionamentoScavo(posizionamento);
// Piante fine scavo //
ArrayList<LayerConcessione> piante = new ArrayList<LayerConcessione>(); // // Piante fine scavo
for (int i = 0; i < 4; i++) { // ArrayList<LayerConcessione> piante = new ArrayList<LayerConcessione>();
LayerConcessione pianta = new LayerConcessione(); // for (int i = 0; i < 4; i++) {
pianta.setValutazioneQualita("Secondo me si"); // LayerConcessione pianta = new LayerConcessione();
pianta.setMetodoRaccoltaDati("Fattobbene"); // pianta.setValutazioneQualita("Secondo me si");
pianta.setScalaAcquisizione("1:10000"); // pianta.setMetodoRaccoltaDati("Fattobbene");
pianta.setAuthors(concessione.getAuthors()); // pianta.setScalaAcquisizione("1:10000");
pianta.setPolicy(AccessPolicy.RESTRICTED); // pianta.setAuthors(concessione.getAuthors());
pianta.setLayerName("gna_conc_12:pos"); // pianta.setPolicy(AccessPolicy.RESTRICTED);
pianta.setWmsLink( // pianta.setLayerName("gna_conc_12:pos");
"https://geoserver1.dev.d4science.org/geoserver/gna_conc_12/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_12:pos&styles=&bbox=8.62091913167495,40.62975046683799,8.621178639172953,40.630257904721645&width=392&height=768&srs=EPSG:4326&format=application/openlayers#toggle"); // pianta.setWmsLink(
// "https://geoserver1.dev.d4science.org/geoserver/gna_conc_12/wms?service=WMS&version=1.1.0&request=GetMap&layers=gna_conc_12:pos&styles=&bbox=8.62091913167495,40.62975046683799,8.621178639172953,40.630257904721645&width=392&height=768&srs=EPSG:4326&format=application/openlayers#toggle");
pianta.setBbox(new BBOX(40.630257904721645,8.621178639172953,40.62975046683799,8.62091913167495)); //
piante.add(pianta); // pianta.setBbox(new BBOX(40.630257904721645,8.621178639172953,40.62975046683799,8.62091913167495));
} // piante.add(pianta);
concessione.setPianteFineScavo(piante); // }
// concessione.setPianteFineScavo(piante);
return concessione; //
} // return concessione;
} // }
//}

View File

@ -94,20 +94,22 @@ body {
} }
#page-view-details > h1 { /* #page-view-details .page-header h1 {
font-size: 32px; font-size: 28px;
} } */
#page-view-details > p {
font-size: 24px; #page-view-details p {
font-size: 14px;
padding: 10px; padding: 10px;
color: #999; color: #333;
} }
#page-view-details .my-custom-flex-table { #page-view-details .my-custom-flex-table {
margin-left: 20px; margin-left: 20px;
margin-right: 40px; margin-right: 40px;
font-size: 14px; font-size: 13px;
max-width: 98%;
} }
#page-view-details .my-custom-flex-table td { #page-view-details .my-custom-flex-table td {
@ -210,7 +212,7 @@ body {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
width: 100%; width: 99%;
} }
.style-layer table { .style-layer table {

View File

@ -1,12 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer; package org.gcube.portlets.user.geoportaldataviewer;
import org.gcube.application.geoportal.managers.AbstractRecordManager; import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
import org.gcube.application.geoportal.managers.ManagerFactory; import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.model.Record; import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.geoportaldataviewer.server.ConvertToDataViewModel; import org.gcube.portlets.user.geoportaldataviewer.server.ConvertToDataViewModel;
import org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -15,39 +13,45 @@ public class GetConcessione {
private static final Logger LOG = LoggerFactory.getLogger(GetConcessione.class); private static final Logger LOG = LoggerFactory.getLogger(GetConcessione.class);
public static String SCOPE = "/gcube/devNext/NextNext"; private static final String YOUR_TOKEN = "8e74a17c-92f1-405a-b591-3a6090066248-98187548";
public static long concessioneId = 16;
/*public static void main(String[] args) { public static String SCOPE = "/gcube/devsec/devVRE";
public static long concessioneId = 67;
ScopeProvider.instance.set(SCOPE); public static ConcessioneDV getConcessioneForId(Long id) throws Exception{
LOG.info("getConcessioneForId "+id+ "called");
// Concessione loaded=(Concessione) ManagerFactory.getByRecordID(concessioneId).getRecord(); ConcessioneDV concessionDV = null;
// LOG.info("Loaded bean : "+loaded);
if(id==null)
throw new Exception("Invalid parameter. The Id is null");
try { try {
LOG.info("Trying to get record for id "+concessioneId); LOG.info("Trying to get record for id "+id);
AbstractRecordManager<Record> abmRecord = ManagerFactory.getByRecordID(concessioneId); Concessione concessione = new ConcessioniManager().getById(id+"");
LOG.info("Got record for id "+concessioneId); LOG.info("Got concessione for id "+id);
Record record = abmRecord.getRecord(); if(concessione !=null) {
Concessione concessione = null; concessionDV = ConvertToDataViewModel.toConcessione(concessione);
if(record !=null && record instanceof Concessione) {
concessione = (Concessione) record;
LOG.info("To concessione view model:" +ConvertToDataViewModel.toConcessione(concessione).toString());
}else {
LOG.warn("No Record with id '"+concessioneId+"' is available");
} }
if(concessionDV==null)
throw new Exception("Concessione not retrieved");
return concessionDV;
}catch (Exception e) { }catch (Exception e) {
String erroMsg = Concessione.class.getSimpleName() +" with id "+concessioneId+" not available"; String erroMsg = Concessione.class.getSimpleName() +" with id "+id+" not available";
LOG.error(erroMsg,e); LOG.error(erroMsg,e);
throw new Exception(erroMsg);
} }
}*/
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
GeoportalDataViewerServiceImpl geonNaServiecImpl = new GeoportalDataViewerServiceImpl();
ScopeProvider.instance.set(SCOPE); ScopeProvider.instance.set(SCOPE);
SecurityTokenProvider.instance.set(YOUR_TOKEN);
LOG.info("Trying to get record for id "+concessioneId); LOG.info("Trying to get record for id "+concessioneId);
ConcessioneDV concessione = geonNaServiecImpl.getConcessioneForId(concessioneId); ConcessioneDV concessione = getConcessioneForId(concessioneId);
LOG.info("Got record for id "+concessione); LOG.info("Got record for id "+concessione);
} }