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"/>
</attributes>
</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">
<attributes>
<attribute name="optional" value="true"/>
@ -13,15 +18,10 @@
<attribute name="test" value="true"/>
</attributes>
</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">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<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"/>
</attributes>
</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"/>
</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="/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/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>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.common</groupId> -->
<!-- <artifactId>authorization-client</artifactId> -->
<!-- <version>[2.0.0, 3.0.0-SNAPSHOT)</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.resources.discovery</groupId> -->
<!-- <artifactId>ic-client</artifactId> -->
<!-- <version>[1.0.0, 2.0.0-SNAPSHOT)</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
@ -146,17 +146,23 @@
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</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>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-logic</artifactId>
<artifactId>geoportal-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>javax.json</groupId> -->
<!-- <artifactId>javax.json-api</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>

View File

@ -198,7 +198,7 @@ public class LayerManager {
for (Long key : geoNaDataObject.getMapImages().keySet()) {
List<UploadedImageDV> listUI = geoNaDataObject.getMapImages().get(key);
GWT.log("Adding images: "+listUI);
if(listUI!=null) {
if(listUI!=null && listUI.size()>0) {
UploadedImageDV img = listUI.get(0);
if(img.getListWsContent()!=null) {
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 com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
import ol.Coordinate;
import ol.Feature;
@ -262,7 +263,9 @@ import ol.style.TextOptions;
// textOptions.setFill(new Fill(fillOptions));
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);

View File

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

View File

@ -105,6 +105,7 @@ public class ConcessioneView extends Composite {
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible, boolean openImageButtonVisible) {
this();
GWT.log("Rendering "+concDV.getNome());
this.concessioneDV = concDV;
this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible;
@ -114,7 +115,7 @@ public class ConcessioneView extends Composite {
introduzione.setText(concessioneDV.getIntroduzione());
if (concessioneDV.getDataInizioProgetto() != null) {
customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataFineProgetto());
customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataInizioProgetto());
}
if (concessioneDV.getDataFineProgetto() != null) {
@ -122,7 +123,7 @@ public class ConcessioneView extends Composite {
}
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) {

View File

@ -17,6 +17,10 @@
position: absolute;
}
.the-title h1 {
font-size: 28px;
}
.margin-bottom-10 {
margin-bottom: 10px;
}
@ -30,7 +34,7 @@
<!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> -->
<b:PageHeader ui:field="titolo"></b:PageHeader>
<b:PageHeader ui:field="titolo" addStyleNames="{style.the-title}"></b:PageHeader>
<g:HorizontalPanel
addStyleNames="{style.margin-bottom-10}">
<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.List;
import org.gcube.application.geoportal.model.AccessPolicy;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
import org.gcube.application.geoportal.model.content.OtherContent;
import org.gcube.application.geoportal.model.content.PersistedContent;
import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.application.geoportal.model.content.WorkspaceContent;
import org.gcube.application.geoportal.model.gis.BBOX;
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.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV;
@ -72,7 +72,7 @@ public class ConvertToDataViewModel {
theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto()));
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
theConcessione.setEditore(concessione.getEditore());
theConcessione.setFontiFinanziamento(toListString(concessione.getFontiFinanziamento()));
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
theConcessione.setId(concessione.getId());
theConcessione.setNome(concessione.getNome());
@ -81,15 +81,15 @@ public class ConvertToDataViewModel {
theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
theConcessione.setLicenzaID(concessione.getLicenzaID());
theConcessione.setNome(concessione.getNome());
theConcessione.setParoleChiaveICCD(toListString(concessione.getParoleChiaveICCD()));
theConcessione.setParoleChiaveLibere(toListString(concessione.getParoleChiaveLibere()));
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setRisorseCorrelate(toListString(concessione.getRisorseCorrelate()));
theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
theConcessione.setSoggetto(concessione.getSoggetto());
theConcessione.setTitolareCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolareLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(toListString(concessione.getTitolari()));
theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion());
theConcessione.setRecordType(concessione.getRecordType().name());
@ -142,17 +142,17 @@ public class ConvertToDataViewModel {
}
//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;
}
// 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;
// }
public static String toUser(String username) {
@ -199,7 +199,7 @@ public class ConvertToDataViewModel {
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
//theRelazioneDiScavo.setRecord(recordDV);
theRelazioneDiScavo.setResponsabili(toListString(relazioneScavo.getResponsabili()));
theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
@ -227,7 +227,7 @@ public class ConvertToDataViewModel {
theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
//theUploadedImageDV.setRecord(recordDV);
theUploadedImageDV.setResponsabili(toListString(uploadedImage.getResponsabili()));
theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
@ -284,7 +284,7 @@ public class ConvertToDataViewModel {
theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setLayerID(layerConcessione.getLayerID());
theLayerConessione.setLayerUUID(layerConcessione.getLayerUUID());
theLayerConessione.setAuthors(toListString(layerConcessione.getAuthors()));
theLayerConessione.setAuthors(layerConcessione.getAuthors());
BoundsMap bounds = toBoundMap(layerConcessione.getBbox());
theLayerConessione.setBbox(bounds);
theLayerConessione.setCreationTime(toDateString(layerConcessione.getCreationTime()));

View File

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

View File

@ -1,123 +1,124 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.gcube.application.geoportal.model.AccessPolicy;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
import org.gcube.application.geoportal.model.content.PersistedContent;
import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.application.geoportal.model.content.WorkspaceContent;
import org.gcube.application.geoportal.model.gis.BBOX;
public class TestModel {
public static Concessione prepareEmptyConcessione() {
Concessione concessione = new Concessione();
// Generic fields
// Concessione fields
concessione.setNome("Italia, forse");
concessione.setIntroduzione("This is my project");
concessione.setDescrizioneContenuto("It contains this and that");
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.setResponsabile("Someone");
concessione.setEditore("Editore");
concessione.setFontiFinanziamento(Arrays.asList(new String[] { "Big pharma", "Pentagon" }));
concessione.setSoggetto(Arrays.asList(new String[] { "Research Excavation", "Archeology" }));
concessione
.setRisorseCorrelate(Arrays.asList(new String[] { "https://google.com", "https://www.repubblica.it" }));
concessione.setDataInizioProgetto(LocalDateTime.now());
concessione.setDataFineProgetto(LocalDateTime.now());
concessione.setLicenzaID("CC-BY");
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.setLastUpdateTime(LocalDateTime.now());
concessione.setCreationTime(LocalDateTime.now());
concessione.setLastUpdateUser("fake user");
concessione.setCentroidLat(43.0); // N-S
concessione.setCentroidLong(9.0); // E-W
return concessione;
}
public static Concessione prepareConcessione() {
Concessione concessione = prepareEmptyConcessione();
// Attachments
// Relazione scavo
RelazioneScavo relScavo = new RelazioneScavo();
relScavo.setAbstractSection("simple abstract section");
relScavo.setResponsabili(concessione.getAuthors());
concessione.setRelazioneScavo(relScavo);
// Immagini rappresentative
ArrayList<UploadedImage> imgs = new ArrayList<>();
for (int i = 0; i < 5; i++) {
UploadedImage img = new UploadedImage();
img.setTitolo("My image number " + i);
img.setDidascalia("You can see my image number " + i);
img.setFormat("TIFF");
img.setCreationTime(LocalDateTime.now());
img.setResponsabili(concessione.getAuthors());
List<PersistedContent> actualContentList = new ArrayList<PersistedContent>(1);
WorkspaceContent ws = new WorkspaceContent();
ws.setLink("https://data.dev.d4science.org/shub/E_azRkaVhqTFExMzZvTG9pY0hwSFJNV2tVTHBEMGEycFVsQitvWjZvb29WZjkwRU84b1hXQnp0QjRuSGhrODJqQg==");
actualContentList.add(ws);
img.setActualContent(actualContentList);
imgs.add(img);
}
concessione.setImmaginiRappresentative(imgs);
// Posizionamento
LayerConcessione posizionamento = new LayerConcessione();
posizionamento.setValutazioneQualita("Secondo me si");
posizionamento.setMetodoRaccoltaDati("Fattobbene");
posizionamento.setScalaAcquisizione("1:10000");
posizionamento.setAuthors(concessione.getAuthors());
concessione.setPosizionamentoScavo(posizionamento);
// Piante fine scavo
ArrayList<LayerConcessione> piante = new ArrayList<LayerConcessione>();
for (int i = 0; i < 4; i++) {
LayerConcessione pianta = new LayerConcessione();
pianta.setValutazioneQualita("Secondo me si");
pianta.setMetodoRaccoltaDati("Fattobbene");
pianta.setScalaAcquisizione("1:10000");
pianta.setAuthors(concessione.getAuthors());
pianta.setPolicy(AccessPolicy.RESTRICTED);
pianta.setLayerName("gna_conc_12:pos");
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);
}
concessione.setPianteFineScavo(piante);
return concessione;
}
}
//package org.gcube.portlets.user.geoportaldataviewer.server;
//
//import java.time.LocalDateTime;
//import java.util.ArrayList;
//import java.util.Arrays;
//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.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;
//
//
//public class TestModel {
//
// public static Concessione prepareEmptyConcessione() {
// Concessione concessione = new Concessione();
//
// // Generic fields
//
// // Concessione fields
//
// concessione.setNome("Italia, forse");
// concessione.setIntroduzione("This is my project");
// concessione.setDescrizioneContenuto("It contains this and that");
//
// 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.setResponsabile("Someone");
// concessione.setEditore("Editore");
//
// concessione.setFontiFinanziamento(Arrays.asList(new String[] { "Big pharma", "Pentagon" }));
//
// concessione.setSoggetto(Arrays.asList(new String[] { "Research Excavation", "Archeology" }));
//
// concessione
// .setRisorseCorrelate(Arrays.asList(new String[] { "https://google.com", "https://www.repubblica.it" }));
//
// concessione.setDataInizioProgetto(LocalDateTime.now());
// concessione.setDataFineProgetto(LocalDateTime.now());
//
// concessione.setLicenzaID("CC-BY");
//
// 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.setLastUpdateTime(LocalDateTime.now());
// concessione.setCreationTime(LocalDateTime.now());
// concessione.setLastUpdateUser("fake user");
//
// concessione.setCentroidLat(43.0); // N-S
// concessione.setCentroidLong(9.0); // E-W
//
// return concessione;
// }
//
// public static Concessione prepareConcessione() {
//
// Concessione concessione = prepareEmptyConcessione();
//
// // Attachments
//
// // Relazione scavo
// RelazioneScavo relScavo = new RelazioneScavo();
//
// relScavo.setAbstractSection("simple abstract section");
// relScavo.setResponsabili(concessione.getAuthors());
//
// concessione.setRelazioneScavo(relScavo);
// // Immagini rappresentative
// ArrayList<UploadedImage> imgs = new ArrayList<>();
// for (int i = 0; i < 5; i++) {
// UploadedImage img = new UploadedImage();
// img.setTitolo("My image number " + i);
// img.setDidascalia("You can see my image number " + i);
// img.setFormat("TIFF");
// img.setCreationTime(LocalDateTime.now());
// img.setResponsabili(concessione.getAuthors());
// List<PersistedContent> actualContentList = new ArrayList<PersistedContent>(1);
// WorkspaceContent ws = new WorkspaceContent();
// ws.setLink("https://data.dev.d4science.org/shub/E_azRkaVhqTFExMzZvTG9pY0hwSFJNV2tVTHBEMGEycFVsQitvWjZvb29WZjkwRU84b1hXQnp0QjRuSGhrODJqQg==");
// actualContentList.add(ws);
// img.setActualContent(actualContentList);
// imgs.add(img);
// }
// concessione.setImmaginiRappresentative(imgs);
// // Posizionamento
// LayerConcessione posizionamento = new LayerConcessione();
// posizionamento.setValutazioneQualita("Secondo me si");
// posizionamento.setMetodoRaccoltaDati("Fattobbene");
// posizionamento.setScalaAcquisizione("1:10000");
// posizionamento.setAuthors(concessione.getAuthors());
// concessione.setPosizionamentoScavo(posizionamento);
//
// // Piante fine scavo
// ArrayList<LayerConcessione> piante = new ArrayList<LayerConcessione>();
// for (int i = 0; i < 4; i++) {
// LayerConcessione pianta = new LayerConcessione();
// pianta.setValutazioneQualita("Secondo me si");
// pianta.setMetodoRaccoltaDati("Fattobbene");
// pianta.setScalaAcquisizione("1:10000");
// pianta.setAuthors(concessione.getAuthors());
// pianta.setPolicy(AccessPolicy.RESTRICTED);
// pianta.setLayerName("gna_conc_12:pos");
// 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);
// }
// concessione.setPianteFineScavo(piante);
//
// return concessione;
// }
//}

View File

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

View File

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