Concessione GWT model should be completed

This commit is contained in:
Francesco Mangiacrapa 2020-11-04 16:00:13 +01:00
parent d6cd995f9c
commit dcf468bef5
19 changed files with 408 additions and 152 deletions

View File

@ -6,11 +6,6 @@
<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"/>
@ -18,10 +13,15 @@
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<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"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
@ -35,5 +35,6 @@
<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

@ -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

View File

@ -29,6 +29,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>

View File

@ -0,0 +1,7 @@
<root>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>

View File

@ -3,4 +3,5 @@
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>

View File

@ -203,7 +203,7 @@
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<!-- <goal>test</goal> -->
<!-- <goal>generateAsync</goal> -->
</goals>
</execution>

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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;
try {
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<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
concessione.getGenericContent().size());
for (OtherContent gc : concessione.getGenericContent()) {
otherContentsDV.add(toOtherContentDV(gc, theConcessione));
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<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
concessione.getGenericContent().size());
for (OtherContent gc : concessione.getGenericContent()) {
otherContentsDV.add(toOtherContentDV(gc));
}
theConcessione.setGenericContent(otherContentsDV);
}
theConcessione.setGenericContent(otherContentsDV);
}
if (concessione.getImmaginiRappresentative() != null) {
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
concessione.getImmaginiRappresentative().size());
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
uploadedImagesDV.add(toUploadedImage(ui, theConcessione));
if (concessione.getImmaginiRappresentative() != null) {
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
concessione.getImmaginiRappresentative().size());
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
uploadedImagesDV.add(toUploadedImage(ui));
}
theConcessione.setImmaginiRappresentative(uploadedImagesDV);
}
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<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
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<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
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.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;
}
if (concessione.getPosizionamentoScavo() != null) {
LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo(), theConcessione);
theConcessione.setPosizionamentoScavo(thePosizScavo);
}
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;

View File

@ -100,26 +100,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
int maxWFSFeature, double zoomLevel) {
LOG.info("getDataResult called");
List<GeoNaDataObject> result = FeatureParser.getDataResults(layerItems, mapSrsName, selectBBOX, maxWFSFeature);
/*for (GeoNaDataObject geoNaDataObject : result) {
List<FeatureRow> features = geoNaDataObject.getFeatures();
for (FeatureRow feature : features) {
List<String> 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);
}
}

View File

@ -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<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());
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);
piante.add(pianta);
}
concessione.setPianteFineScavo(piante);
return concessione;
}
}

View File

@ -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();
}

View File

@ -36,7 +36,7 @@ public class LayerConcessioneDV extends SDILayerDescriptorDV {
private List<String> authors;
public LayerConcessioneDV() {
// TODO Auto-generated constructor stub
}
public String getAbstractSection() {

View File

@ -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<String> soggetto;
public RelazioneScavoDV() {
super();
}
public RelazioneScavoDV(String abstractSection, List<String> responsabili, List<String> soggetto) {

View File

@ -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();
}
/**

View File

@ -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.

View File

@ -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=");

View File

@ -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();

View File

@ -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<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
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);
}
}
}