diff --git a/.classpath b/.classpath
index 4247d22..c5c4bd3 100644
--- a/.classpath
+++ b/.classpath
@@ -6,22 +6,22 @@
-
+
+
+
-
+
-
-
-
+
@@ -35,5 +35,6 @@
+
diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
index ff5aa39..d16c112 100644
--- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs
+++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
@@ -1,4 +1,4 @@
eclipse.preferences.version=1
-lastWarOutDir=/home/francesco/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0-SNAPSHOT
+lastWarOutDir=/home/francesco-mangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index e56f642..baaec01 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -29,6 +29,7 @@
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100644
index 0000000..cc81385
--- /dev/null
+++ b/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml
index d808933..6abb85a 100644
--- a/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -3,4 +3,5 @@
+
diff --git a/pom.xml b/pom.xml
index 47c5ff7..96c7129 100644
--- a/pom.xml
+++ b/pom.xml
@@ -203,7 +203,7 @@
compile
- test
+
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
index 809ddfe..eda99a2 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java
@@ -148,12 +148,14 @@ public class GeoportalDataViewer implements EntryPoint {
@Override
public void onFailure(Throwable caught) {
+ GWT.log("QUI: "+caught.toString());
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(ConcessioneDV result) {
+ GWT.log("Concessione is: "+result);
mainPanel.addNewTab(result);
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java
index 10884de..0e055e5 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java
@@ -122,6 +122,8 @@ public class GeonaDataViewMainPanel extends Composite {
tab.setHeading(nome);
tab.add(new HTML(cdv.toString()));
+ mainTabPanel.add(tab);
+ tab.asWidget().getElement().focus();
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java
index 86ab56a..a6360e1 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/ConvertToDataViewModel.java
@@ -5,6 +5,7 @@ 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;
@@ -16,7 +17,6 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV
import org.gcube.portlets.user.geoportaldataviewer.shared.products.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.RelazioneScavoDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.OtherContentDV;
-import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,83 +50,113 @@ public class ConvertToDataViewModel {
* @throws Exception the exception
*/
public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
+ LOG.debug("called toConcessione for: "+concessione);
if (concessione == null)
return null;
-
- ConcessioneDV theConcessione = new ConcessioneDV();
- theConcessione.setAccesso(concessione.getAccesso().name());
- theConcessione.setAuthors(concessione.getAuthors());
- theConcessione.setCentroidLat(concessione.getCentroidLat());
- theConcessione.setCentroidLong(concessione.getCentroidLong());
- theConcessione.setContributore(concessione.getContributore());
- 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 otherContentsDV = new ArrayList(
- concessione.getGenericContent().size());
- for (OtherContent gc : concessione.getGenericContent()) {
- otherContentsDV.add(toOtherContentDV(gc, theConcessione));
+
+ try {
+
+ ConcessioneDV theConcessione = new ConcessioneDV();
+ theConcessione.setPolicy(toPolicy(concessione.getPolicy()));
+ theConcessione.setAuthors(concessione.getAuthors());
+ theConcessione.setCentroidLat(concessione.getCentroidLat());
+ theConcessione.setCentroidLong(concessione.getCentroidLong());
+ theConcessione.setContributore(concessione.getContributore());
+ theConcessione.setCreationTime(toDateString(concessione.getCreationTime()));
+ theConcessione.setCreationUser(toUser(concessione.getCreationUser()));
+ 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());
+ theConcessione.setNome(concessione.getNome());
+
+ if (concessione.getGenericContent() != null) {
+ List otherContentsDV = new ArrayList(
+ concessione.getGenericContent().size());
+ for (OtherContent gc : concessione.getGenericContent()) {
+ otherContentsDV.add(toOtherContentDV(gc));
+ }
+ theConcessione.setGenericContent(otherContentsDV);
}
- theConcessione.setGenericContent(otherContentsDV);
- }
-
- if (concessione.getImmaginiRappresentative() != null) {
- List uploadedImagesDV = new ArrayList(
- concessione.getImmaginiRappresentative().size());
- for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
- uploadedImagesDV.add(toUploadedImage(ui, theConcessione));
+
+ if (concessione.getImmaginiRappresentative() != null) {
+ List uploadedImagesDV = new ArrayList(
+ concessione.getImmaginiRappresentative().size());
+ for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
+ uploadedImagesDV.add(toUploadedImage(ui));
+ }
+ theConcessione.setImmaginiRappresentative(uploadedImagesDV);
}
- theConcessione.setImmaginiRappresentative(uploadedImagesDV);
- }
-
- theConcessione.setIntroduzione(concessione.getIntroduzione());
- 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 piantaScavoDV = new ArrayList(
- concessione.getPianteFineScavo().size());
- for (LayerConcessione lc : concessione.getPianteFineScavo()) {
- piantaScavoDV.add(toLayerConcessione(lc, theConcessione));
+
+ theConcessione.setIntroduzione(concessione.getIntroduzione());
+ theConcessione.setLastUpdateTime(toDateString(concessione.getLastUpdateTime()));
+ theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser()));
+ theConcessione.setLicenzaID(concessione.getLicenzaID());
+ theConcessione.setNome(concessione.getNome());
+ theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
+ theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
+
+ if (concessione.getPianteFineScavo() != null) {
+ List piantaScavoDV = new ArrayList(
+ concessione.getPianteFineScavo().size());
+ for (LayerConcessione lc : concessione.getPianteFineScavo()) {
+ piantaScavoDV.add(toLayerConcessione(lc));
+ }
+ theConcessione.setPianteFineScavo(piantaScavoDV);
}
- theConcessione.setPianteFineScavo(piantaScavoDV);
- }
-
- if (concessione.getPosizionamentoScavo() != null) {
- LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo(), theConcessione);
- theConcessione.setPosizionamentoScavo(thePosizScavo);
+
+ if (concessione.getPosizionamentoScavo() != null) {
+ LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo());
+ theConcessione.setPosizionamentoScavo(thePosizScavo);
+ }
+
+ theConcessione.setRecordType(concessione.getRecordType().name());
+
+ theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo()));
+
+ theConcessione.setResponsabile(concessione.getResponsabile());
+ theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
+ theConcessione.setSoggetto(concessione.getSoggetto());
+ theConcessione.setTitolareCopyright(concessione.getTitolareCopyright());
+ theConcessione.setTitolareLicenza(concessione.getTitolareLicenza());
+ theConcessione.setTitolari(concessione.getTitolari());
+ theConcessione.setVersion(concessione.getVersion());
+
+ LOG.debug("Returning concessione: " + theConcessione);
+ return theConcessione;
+ }catch (Exception e) {
+ LOG.error("Error on converting concessione: "+concessione, e);
+ return null;
}
- theConcessione.setRecordType(concessione.getRecordType().name());
-
- theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo(), theConcessione));
-
- theConcessione.setResponsabile(concessione.getResponsabile());
- theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
- theConcessione.setSoggetto(concessione.getSoggetto());
- theConcessione.setTitolareCopyright(concessione.getTitolareCopyright());
- theConcessione.setTitolareLicenza(concessione.getTitolareLicenza());
- theConcessione.setTitolari(concessione.getTitolari());
- theConcessione.setVersion(concessione.getVersion());
-
- LOG.debug("Returning concessione: " + theConcessione);
- return theConcessione;
-
+ }
+
+ public static String toUser(String username) {
+
+ if(username==null)
+ return null;
+
+ return username;
+
+ }
+
+ public static String toPolicy(AccessPolicy policy) {
+
+ if(policy==null)
+ return null;
+
+ return policy.name();
+
}
- private static String toDateString(LocalDateTime dateTime) {
+ public static String toDateString(LocalDateTime dateTime) {
+
+ if(dateTime==null)
+ return null;
+
return dateTime.toString();
}
@@ -137,7 +167,7 @@ public class ConvertToDataViewModel {
* @param recordDV the record data view
* @return the relazione scavo data view
*/
- public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo, RecordDV recordDV) {
+ public static RelazioneScavoDV toRelazioneScavo(RelazioneScavo relazioneScavo) {
if (relazioneScavo == null)
return null;
@@ -147,8 +177,8 @@ public class ConvertToDataViewModel {
theRelazioneDiScavo.setCreationTime(toDateString(relazioneScavo.getCreationTime()));
theRelazioneDiScavo.setId(relazioneScavo.getId());
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
- theRelazioneDiScavo.setPolicy(relazioneScavo.getPolicy().name());
- theRelazioneDiScavo.setRecord(recordDV);
+ theRelazioneDiScavo.setPolicy(toPolicy(relazioneScavo.getPolicy()));
+ //theRelazioneDiScavo.setRecord(recordDV);
theRelazioneDiScavo.setResponsabili(relazioneScavo.getResponsabili());
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
@@ -164,7 +194,7 @@ public class ConvertToDataViewModel {
* @param recordDV the record data-view
* @return the uploaded image data-view
*/
- public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage, RecordDV recordDV) {
+ public static UploadedImageDV toUploadedImage(UploadedImage uploadedImage) {
if (uploadedImage == null)
return null;
@@ -175,8 +205,8 @@ public class ConvertToDataViewModel {
theUploadedImageDV.setFormat(uploadedImage.getFormat());
theUploadedImageDV.setId(uploadedImage.getId());
theUploadedImageDV.setLicenseID(uploadedImage.getLicenseID());
- theUploadedImageDV.setPolicy(uploadedImage.getPolicy().name());
- theUploadedImageDV.setRecord(recordDV);
+ theUploadedImageDV.setPolicy(toPolicy(uploadedImage.getPolicy()));
+ //theUploadedImageDV.setRecord(recordDV);
theUploadedImageDV.setResponsabili(uploadedImage.getResponsabili());
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
@@ -192,12 +222,12 @@ public class ConvertToDataViewModel {
* @param recordDV the record DV
* @return the layer concessione data view
*/
- public static LayerConcessioneDV toLayerConcessione(LayerConcessione layerConcessione, RecordDV recordDV) {
+ public static LayerConcessioneDV toLayerConcessione(LayerConcessione layerConcessione) {
if (layerConcessione == null)
return null;
- LayerConcessioneDV theLayerConessione = new org.gcube.portlets.user.geoportaldataviewer.shared.products.LayerConcessioneDV();
+ LayerConcessioneDV theLayerConessione = new LayerConcessioneDV();
theLayerConessione.setAbstractSection(layerConcessione.getAbstractSection());
theLayerConessione.setLayerName(layerConcessione.getLayerName());
theLayerConessione.setLayerID(layerConcessione.getLayerID());
@@ -209,8 +239,8 @@ public class ConvertToDataViewModel {
theLayerConessione.setId(layerConcessione.getId());
theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
- theLayerConessione.setPolicy(layerConcessione.getPolicy().name());
- theLayerConessione.setRecord(recordDV);
+ theLayerConessione.setPolicy(toPolicy(layerConcessione.getPolicy()));
+ //theLayerConessione.setRecord(recordDV);
theLayerConessione.setScalaAcquisizione(layerConcessione.getScalaAcquisizione());
theLayerConessione.setSubTopic(layerConcessione.getSubTopic());
theLayerConessione.setTitolo(layerConcessione.getTitolo());
@@ -230,7 +260,7 @@ public class ConvertToDataViewModel {
* @param recordDV the record DV
* @return the other content DV
*/
- public static OtherContentDV toOtherContentDV(OtherContent otherContent, RecordDV recordDV) {
+ public static OtherContentDV toOtherContentDV(OtherContent otherContent) {
if (otherContent == null)
return null;
@@ -239,8 +269,8 @@ public class ConvertToDataViewModel {
theOtherContent.setCreationTime(toDateString(otherContent.getCreationTime()));
theOtherContent.setId(otherContent.getId());
theOtherContent.setLicenseID(otherContent.getLicenseID());
- theOtherContent.setPolicy(otherContent.getPolicy().name());
- theOtherContent.setRecord(recordDV);
+ theOtherContent.setPolicy(toPolicy(otherContent.getPolicy()));
+ //theOtherContent.setRecord(recordDV);
theOtherContent.setTitolo(otherContent.getTitolo());
return theOtherContent;
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
index 3188f97..e5eb755 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
@@ -100,26 +100,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
int maxWFSFeature, double zoomLevel) {
LOG.info("getDataResult called");
List result = FeatureParser.getDataResults(layerItems, mapSrsName, selectBBOX, maxWFSFeature);
-
- /*for (GeoNaDataObject geoNaDataObject : result) {
- List features = geoNaDataObject.getFeatures();
- for (FeatureRow feature : features) {
- List theProductIds = feature.getMapProperties().get(PRODUCT_ID);
- try {
- if (theProductIds != null && theProductIds.size() > 0) {
- String theProductID = theProductIds.get(0);
- LOG.info("Found: "+PRODUCT_ID + " loading "+ConcessioneDV.class.getSimpleName());
- long productID = Long.parseLong(theProductID);
- ConcessioneDV concessioneDV = getConcessioneForId(productID);
- geoNaDataObject.setConcessioneDV(concessioneDV);
- LOG.debug("Added "+ConcessioneDV.class.getSimpleName()+" as "+concessioneDV);
- }
-
- } catch (Exception e) {
- LOG.error("Error:", e);
- }
- }
- }*/
return result;
}
@@ -133,6 +113,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.warn("SCOPE is: "+scope);
ScopeProvider.instance.set(scope);
}
+
+ ConcessioneDV concessionDV = null;
if(id==null)
throw new Exception("Invalid parameter. The Id is null");
@@ -145,15 +127,25 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
Concessione concessione = null;
if(record !=null && record instanceof Concessione) {
concessione = (Concessione) record;
- return ConvertToDataViewModel.toConcessione(concessione);
- }else
- throw new Exception("No Concessione with id '"+id+"' is available");
+ 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 "+id+" not available";
LOG.error(erroMsg,e);
- throw new Exception(erroMsg);
+
+ 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);
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/TestModel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/TestModel.java
new file mode 100644
index 0000000..0cbfd61
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/TestModel.java
@@ -0,0 +1,108 @@
+package org.gcube.portlets.user.geoportaldataviewer.server;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+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.UploadedImage;
+
+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.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.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 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());
+ 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 piante=new ArrayList();
+ 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);
+ piante.add(pianta);
+ }
+ concessione.setPianteFineScavo(piante);
+
+ return concessione;
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/ConcessioneDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/ConcessioneDV.java
index b927ebe..7a4e226 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/ConcessioneDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/ConcessioneDV.java
@@ -8,18 +8,22 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.Other
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
-// TODO: Auto-generated Javadoc
+import com.google.gwt.user.client.rpc.IsSerializable;
+
+
/**
- * The Class Concessione.
+ * The Class ConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
- * Nov 2, 2020
+ * Nov 4, 2020
*/
-public class ConcessioneDV extends RecordDV implements Serializable {
+public class ConcessioneDV extends RecordDV implements Serializable, IsSerializable {
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 4803968461647059654L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1387327199157005059L;
/** The introduzione. */
private String introduzione;
@@ -556,8 +560,6 @@ public class ConcessioneDV extends RecordDV implements Serializable {
builder.append(centroidLat);
builder.append(", centroidLong=");
builder.append(centroidLong);
- builder.append(", relazioneScavo=");
- builder.append(relazioneScavo);
builder.append("]");
return builder.toString();
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/LayerConcessioneDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/LayerConcessioneDV.java
index 91f8f49..6c39b66 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/LayerConcessioneDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/LayerConcessioneDV.java
@@ -36,7 +36,7 @@ public class LayerConcessioneDV extends SDILayerDescriptorDV {
private List authors;
public LayerConcessioneDV() {
- // TODO Auto-generated constructor stub
+
}
public String getAbstractSection() {
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/RelazioneScavoDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/RelazioneScavoDV.java
index ce1805b..1f37cf1 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/RelazioneScavoDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/RelazioneScavoDV.java
@@ -17,7 +17,7 @@ public class RelazioneScavoDV extends AssociatedContentDV implements Serializabl
/**
*
*/
- private static final long serialVersionUID = 3054379932450275591L;
+ private static final long serialVersionUID = 2456950567302197554L;
/** The abstract section. */
private String abstractSection;
@@ -29,7 +29,7 @@ public class RelazioneScavoDV extends AssociatedContentDV implements Serializabl
private List soggetto;
public RelazioneScavoDV() {
- super();
+
}
public RelazioneScavoDV(String abstractSection, List responsabili, List soggetto) {
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/AssociatedContentDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/AssociatedContentDV.java
index 148ab30..69f788a 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/AssociatedContentDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/AssociatedContentDV.java
@@ -11,12 +11,13 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordD
*
* Nov 2, 2020
*/
-public abstract class AssociatedContentDV implements Serializable{
+public class AssociatedContentDV implements Serializable{
+
/**
*
*/
- private static final long serialVersionUID = 6076869670548825615L;
+ private static final long serialVersionUID = -3666420861504055117L;
/** The id. */
private long id;
@@ -40,7 +41,6 @@ public abstract class AssociatedContentDV implements Serializable{
* Instantiates a new associated content.
*/
public AssociatedContentDV() {
- super();
}
/**
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/OtherContentDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/OtherContentDV.java
index 1344b8a..6f8bfff 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/OtherContentDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/content/OtherContentDV.java
@@ -1,5 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.shared.products.content;
+import java.io.Serializable;
+
/**
* The Class OtherContent.
*
@@ -7,10 +9,13 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.products.content;
*
* Nov 2, 2020
*/
-public class OtherContentDV extends AssociatedContentDV {
+public class OtherContentDV extends AssociatedContentDV implements Serializable{
+
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 8594376107915639495L;
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2550361768550673836L;
/**
* Instantiates a new other content.
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/RecordDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/RecordDV.java
index fa42e25..7d5c0d9 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/RecordDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/RecordDV.java
@@ -2,6 +2,8 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.products.model;
import java.io.Serializable;
+import com.google.gwt.user.client.rpc.IsSerializable;
+
/**
* The Class Record.
*
@@ -9,15 +11,16 @@ import java.io.Serializable;
*
* Nov 2, 2020
*/
-public abstract class RecordDV implements Serializable {
+public class RecordDV implements Serializable, IsSerializable {
+
/**
*
*/
- private static final long serialVersionUID = -5937037966261692960L;
+ private static final long serialVersionUID = 2913726613820175679L;
/** The id. */
- private long id;
+ private Long id;
/** The record type. */
private String recordType;
@@ -28,8 +31,7 @@ public abstract class RecordDV implements Serializable {
/** The licenza ID. */
private String licenzaID;
- /** The accesso. */
- private String accesso;
+ private String policy;
/** The nome. */
// Nome del progetto
@@ -56,7 +58,7 @@ public abstract class RecordDV implements Serializable {
* Instantiates a new record.
*/
public RecordDV() {
- // TODO Auto-generated constructor stub
+
}
/**
@@ -64,7 +66,7 @@ public abstract class RecordDV implements Serializable {
*
* @return the id
*/
- public long getId() {
+ public Long getId() {
return id;
}
@@ -73,7 +75,7 @@ public abstract class RecordDV implements Serializable {
*
* @param id the new id
*/
- public void setId(long id) {
+ public void setId(Long id) {
this.id = id;
}
@@ -136,17 +138,17 @@ public abstract class RecordDV implements Serializable {
*
* @return the accesso
*/
- public String getAccesso() {
- return accesso;
+ public String getPolicy() {
+ return policy;
}
/**
* Sets the accesso.
*
- * @param accesso the new accesso
+ * @param policy the new policy
*/
- public void setAccesso(String accesso) {
- this.accesso = accesso;
+ public void setPolicy(String policy) {
+ this.policy = policy;
}
/**
@@ -257,15 +259,10 @@ public abstract class RecordDV implements Serializable {
this.creationUser = creationUser;
}
- /**
- * To string.
- *
- * @return the string
- */
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
- builder.append("Record [id=");
+ builder.append("RecordDV [id=");
builder.append(id);
builder.append(", recordType=");
builder.append(recordType);
@@ -273,8 +270,8 @@ public abstract class RecordDV implements Serializable {
builder.append(version);
builder.append(", licenzaID=");
builder.append(licenzaID);
- builder.append(", accesso=");
- builder.append(accesso);
+ builder.append(", policy=");
+ builder.append(policy);
builder.append(", nome=");
builder.append(nome);
builder.append(", folderId=");
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/SDILayerDescriptorDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/SDILayerDescriptorDV.java
index f831f81..48bb8cd 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/SDILayerDescriptorDV.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/SDILayerDescriptorDV.java
@@ -4,12 +4,20 @@ import java.io.Serializable;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.AssociatedContentDV;
-public abstract class SDILayerDescriptorDV extends AssociatedContentDV implements Serializable {
+
+/**
+ * The Class SDILayerDescriptorDV.
+ *
+ * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
+ *
+ * Nov 4, 2020
+ */
+public class SDILayerDescriptorDV extends AssociatedContentDV implements Serializable {
/**
*
*/
- private static final long serialVersionUID = 461437267375075700L;
+ private static final long serialVersionUID = 6137246723753812015L;
// meta
private String layerUUID;
private Long layerID;
@@ -18,9 +26,20 @@ public abstract class SDILayerDescriptorDV extends AssociatedContentDV implement
private String layerName;
private String wmsLink;
+ /**
+ * Instantiates a new SDI layer descriptor DV.
+ */
public SDILayerDescriptorDV() {
}
+ /**
+ * Instantiates a new SDI layer descriptor DV.
+ *
+ * @param layerUUID the layer UUID
+ * @param layerID the layer ID
+ * @param layerName the layer name
+ * @param wmsLink the wms link
+ */
public SDILayerDescriptorDV(String layerUUID, Long layerID, String layerName, String wmsLink) {
super();
this.layerUUID = layerUUID;
@@ -29,38 +48,81 @@ public abstract class SDILayerDescriptorDV extends AssociatedContentDV implement
this.wmsLink = wmsLink;
}
+ /**
+ * Gets the layer UUID.
+ *
+ * @return the layer UUID
+ */
public String getLayerUUID() {
return layerUUID;
}
+ /**
+ * Sets the layer UUID.
+ *
+ * @param layerUUID the new layer UUID
+ */
public void setLayerUUID(String layerUUID) {
this.layerUUID = layerUUID;
}
+ /**
+ * Gets the layer ID.
+ *
+ * @return the layer ID
+ */
public Long getLayerID() {
return layerID;
}
+ /**
+ * Sets the layer ID.
+ *
+ * @param layerID the new layer ID
+ */
public void setLayerID(Long layerID) {
this.layerID = layerID;
}
+ /**
+ * Gets the layer name.
+ *
+ * @return the layer name
+ */
public String getLayerName() {
return layerName;
}
+ /**
+ * Sets the layer name.
+ *
+ * @param layerName the new layer name
+ */
public void setLayerName(String layerName) {
this.layerName = layerName;
}
+ /**
+ * Gets the wms link.
+ *
+ * @return the wms link
+ */
public String getWmsLink() {
return wmsLink;
}
+ /**
+ * Sets the wms link.
+ *
+ * @param wmsLink the new wms link
+ */
public void setWmsLink(String wmsLink) {
this.wmsLink = wmsLink;
}
+ /* (non-Javadoc)
+ * @see org.gcube.portlets.user.geoportaldataviewer.shared.products.content.AssociatedContentDV#toString()
+ */
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java
new file mode 100644
index 0000000..df80cdf
--- /dev/null
+++ b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java
@@ -0,0 +1,46 @@
+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.common.scope.api.ScopeProvider;
+import org.gcube.portlets.user.geoportaldataviewer.server.ConvertToDataViewModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class GetConcessione {
+
+ private static final Logger LOG = LoggerFactory.getLogger(GetConcessione.class);
+
+ public static String SCOPE = "/gcube/devNext/NextNext";
+ public static long concessioneId = 14;
+
+ public static void main(String[] args) {
+
+ ScopeProvider.instance.set(SCOPE);
+
+ Concessione loaded=(Concessione) ManagerFactory.getByRecordID(concessioneId).getRecord();
+ LOG.info("Loaded bean : "+loaded);
+
+ try {
+ LOG.info("Trying to get record for id "+concessioneId);
+ AbstractRecordManager 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
+ throw new Exception("No Concessione with id '"+concessioneId+"' is available");
+
+
+ }catch (Exception e) {
+ String erroMsg = Concessione.class.getSimpleName() +" with id "+concessioneId+" not available";
+ LOG.error(erroMsg,e);
+ }
+ }
+
+
+}