From 7d2a685508ce84a5232965c072f7e95af10e2ec0 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 10 Nov 2020 17:53:35 +0100 Subject: [PATCH] added serializable --- .../client/ui/products/ConcessioneView.java | 11 +-- .../server/ConvertToDataViewModel.java | 83 +++++++++++-------- .../GeoportalDataViewerServiceImpl.java | 12 +-- .../shared/products/ConcessioneDV.java | 4 +- .../products/content/AssociatedContentDV.java | 4 +- .../products/model/LayerConcessioneDV.java | 5 +- .../products/model/SDILayerDescriptorDV.java | 4 +- .../products/model/UploadedImageDV.java | 4 +- 8 files changed, 77 insertions(+), 50 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/ConcessioneView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/ConcessioneView.java index c86c8f8..f1ad879 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/ConcessioneView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/ConcessioneView.java @@ -22,8 +22,6 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Widget; -import ol.Coordinate; - public class ConcessioneView extends Composite { @@ -74,9 +72,12 @@ public class ConcessioneView extends Composite { titolo.setText(concessioneDV.getNome()); introduzione.setText(concessioneDV.getIntroduzione()); - for (String author : concessioneDV.getAuthors()) { - addLabel(autori, author); - //autori.add(new Label(author)); + if(concessioneDV.getAuthors()!=null) { + + for (String author : concessioneDV.getAuthors()) { + addLabel(autori, author); + //autori.add(new Label(author)); + } } addLabel(contributore, concessioneDV.getContributore()); 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 93b33fc..7fd041e 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 @@ -62,7 +62,7 @@ public class ConvertToDataViewModel { ConcessioneDV theConcessione = new ConcessioneDV(); theConcessione.setPolicy(toPolicy(concessione.getPolicy())); - theConcessione.setAuthors(concessione.getAuthors()); + //theConcessione.setAuthors(concessione.getAuthors()); theConcessione.setCentroidLat(concessione.getCentroidLat()); theConcessione.setCentroidLong(concessione.getCentroidLong()); theConcessione.setContributore(concessione.getContributore()); @@ -72,28 +72,10 @@ public class ConvertToDataViewModel { theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto())); theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto()); theConcessione.setEditore(concessione.getEditore()); - theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento()); + theConcessione.setFontiFinanziamento(toListString(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); - } - - if (concessione.getImmaginiRappresentative() != null) { - List uploadedImagesDV = new ArrayList( - concessione.getImmaginiRappresentative().size()); - for (UploadedImage ui : concessione.getImmaginiRappresentative()) { - uploadedImagesDV.add(toUploadedImage(ui)); - } - theConcessione.setImmaginiRappresentative(uploadedImagesDV); - } - + theConcessione.setIntroduzione(concessione.getIntroduzione()); theConcessione.setLastUpdateTime(toDateString(concessione.getLastUpdateTime())); theConcessione.setLastUpdateUser(toUser(concessione.getLastUpdateUser())); @@ -101,7 +83,40 @@ public class ConvertToDataViewModel { theConcessione.setNome(concessione.getNome()); theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD()); theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere()); + + 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()); + + theConcessione.setRecordType(concessione.getRecordType().name()); + + theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo())); + + /* + if (concessione.getImmaginiRappresentative() != null) { + List uploadedImagesDV = new ArrayList( + concessione.getImmaginiRappresentative().size()); + for (UploadedImage ui : concessione.getImmaginiRappresentative()) { + uploadedImagesDV.add(toUploadedImage(ui)); + } + theConcessione.setImmaginiRappresentative(uploadedImagesDV); + }*/ + + /* + if (concessione.getGenericContent() != null) { + List otherContentsDV = new ArrayList( + concessione.getGenericContent().size()); + for (OtherContent gc : concessione.getGenericContent()) { + otherContentsDV.add(toOtherContentDV(gc)); + } + theConcessione.setGenericContent(otherContentsDV); + }*/ + /* if (concessione.getPianteFineScavo() != null) { List piantaScavoDV = new ArrayList( concessione.getPianteFineScavo().size()); @@ -114,19 +129,8 @@ public class ConvertToDataViewModel { 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; @@ -137,6 +141,19 @@ public class ConvertToDataViewModel { } + //TO AVOID SERIALIZATION ISSUE AGAINST GWT + public static List toListString(List orginList){ + if(orginList==null) + return null; + + List destList = new ArrayList(orginList.size()); + for (String orgValue : orginList) { + destList.add(orgValue); + } + + return destList; + } + public static String toUser(String username) { if(username==null) 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 be0d678..7677e4b 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 @@ -107,12 +107,12 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme public ConcessioneDV getConcessioneForId(Long id) throws Exception{ LOG.info("getConcessioneForId "+id+ "called"); - if(!SessionUtil.isIntoPortal()) { - LOG.warn("OUT OF PORTAL setting HARD-CODED SCOPE"); - String scope = "/gcube/devNext/NextNext"; - LOG.warn("SCOPE is: "+scope); - ScopeProvider.instance.set(scope); - } +// if(!SessionUtil.isIntoPortal()) { +// LOG.warn("OUT OF PORTAL setting HARD-CODED SCOPE"); +// String scope = "/gcube/devNext/NextNext"; +// LOG.warn("SCOPE is: "+scope); +// ScopeProvider.instance.set(scope); +// } ConcessioneDV concessionDV = null; 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 798b67e..16cdca2 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 @@ -91,10 +91,10 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa private LayerConcessioneDV posizionamentoScavo; /** The piante fine scavo. */ - private List pianteFineScavo = new ArrayList<>(); + private List pianteFineScavo = new ArrayList(); /** The generic content. */ - private List genericContent = new ArrayList<>(); + private List genericContent = new ArrayList(); /** * Instantiates a new concessione. 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 69f788a..4a28674 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 @@ -4,6 +4,8 @@ import java.io.Serializable; import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV; +import com.google.gwt.user.client.rpc.IsSerializable; + /** * The Class AssociatedContent. * @@ -11,7 +13,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordD * * Nov 2, 2020 */ -public class AssociatedContentDV implements Serializable{ +public class AssociatedContentDV implements IsSerializable, Serializable{ /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/LayerConcessioneDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/LayerConcessioneDV.java index db7e153..a096144 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/LayerConcessioneDV.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/LayerConcessioneDV.java @@ -1,10 +1,13 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.products.model; +import java.io.Serializable; import java.util.List; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap; -public class LayerConcessioneDV extends SDILayerDescriptorDV { +import com.google.gwt.user.client.rpc.IsSerializable; + +public class LayerConcessioneDV extends SDILayerDescriptorDV implements IsSerializable, Serializable{ /** * 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 48bb8cd..0be6a9f 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,6 +4,8 @@ import java.io.Serializable; import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.AssociatedContentDV; +import com.google.gwt.user.client.rpc.IsSerializable; + /** * The Class SDILayerDescriptorDV. @@ -12,7 +14,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.Assoc * * Nov 4, 2020 */ -public class SDILayerDescriptorDV extends AssociatedContentDV implements Serializable { +public class SDILayerDescriptorDV extends AssociatedContentDV implements IsSerializable, Serializable { /** * diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/UploadedImageDV.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/UploadedImageDV.java index 6da687b..8063a7f 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/UploadedImageDV.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/products/model/UploadedImageDV.java @@ -6,6 +6,8 @@ import java.util.List; import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.AssociatedContentDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV; +import com.google.gwt.user.client.rpc.IsSerializable; + /** * The Class UploadedImage. * @@ -13,7 +15,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.Works * * Nov 2, 2020 */ -public class UploadedImageDV extends AssociatedContentDV implements Serializable { +public class UploadedImageDV extends AssociatedContentDV implements IsSerializable, Serializable { /** The Constant serialVersionUID. */ private static final long serialVersionUID = 809167060189883015L;