From 9ee1c7978eab1589145b4bc82525ce12902c76a1 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 20 Nov 2013 17:50:06 +0000 Subject: [PATCH] Minor updated git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@85803 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gwtservice/server/TDGWTServiceImpl.java | 58 ++++++++++++++++++- .../shared/tr/metadata/TRNamesMetadata.java | 12 ++-- 2 files changed, 63 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index e03e946..c679c15 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -28,7 +28,12 @@ import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException; import org.gcube.data.analysis.tabulardata.model.column.Column; import org.gcube.data.analysis.tabulardata.model.metadata.common.DescriptionsMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.common.LocalizedText; +import org.gcube.data.analysis.tabulardata.model.metadata.common.NamesMetadata; +import org.gcube.data.analysis.tabulardata.model.metadata.table.ExportMetadata; +import org.gcube.data.analysis.tabulardata.model.metadata.table.GenericMapMetadata; +import org.gcube.data.analysis.tabulardata.model.metadata.table.ImportMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.table.TableMetadata; +import org.gcube.data.analysis.tabulardata.model.metadata.table.VersionMetadata; import org.gcube.data.analysis.tabulardata.model.table.Table; import org.gcube.data.analysis.tabulardata.model.table.TableId; import org.gcube.data.analysis.tabulardata.operation.worker.ActivityStatus; @@ -77,8 +82,13 @@ import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRDescriptionsMetadata; +import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRExportMetadata; +import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRGenericMapMetadata; +import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRImportMetadata; import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRLocalizedText; import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRMetadata; +import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRNamesMetadata; +import org.gcube.portlets.user.td.gwtservice.shared.tr.metadata.TRVersionMetadata; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1130,11 +1140,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements .getUsername()); Table table = service.getTable(new TableId(Long.valueOf(trId.getTableId()))); + Collection cMeta=table.getAllMetadata(); + ArrayList listTRMetadata=new ArrayList(); for(TableMetadata tMetadata:cMeta){ - if(tMetadata instanceof TRDescriptionsMetadata){ + if(tMetadata instanceof DescriptionsMetadata){ TRDescriptionsMetadata trDescriptionsMetadata=new TRDescriptionsMetadata(); ArrayList listTRLocalizedText=new ArrayList(); List lLocalizedText=((DescriptionsMetadata) tMetadata).getTexts(); @@ -1148,7 +1160,51 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements listTRMetadata.add(trDescriptionsMetadata); } else { + if(tMetadata instanceof NamesMetadata){ + TRNamesMetadata trNamesMetadata=new TRNamesMetadata(); + ArrayList listTRLocalizedText=new ArrayList(); + List lLocalizedText=((NamesMetadata) tMetadata).getTexts(); + for(LocalizedText lt:lLocalizedText){ + TRLocalizedText trLocalizedText=new TRLocalizedText(); + trLocalizedText.setValue(lt.getValue()); + trLocalizedText.setLocaleCode(lt.getLocaleCode()); + listTRLocalizedText.add(trLocalizedText); + } + trNamesMetadata.setListTRLocalizedText(listTRLocalizedText); + listTRMetadata.add(trNamesMetadata); + } else { + if(tMetadata instanceof VersionMetadata){ + TRVersionMetadata trVersionMetadata=new TRVersionMetadata(); + trVersionMetadata.setVersion(((VersionMetadata)tMetadata).getVersion()); + listTRMetadata.add(trVersionMetadata); + }else{ + if(tMetadata instanceof ExportMetadata){ + TRExportMetadata trExportMetadata=new TRExportMetadata(); + trExportMetadata.setDestinationType(((ExportMetadata)tMetadata).getDestinationType()); + trExportMetadata.setExportDate(((ExportMetadata)tMetadata).getExportDate()); + trExportMetadata.setUrl(((ExportMetadata)tMetadata).getUri()); + listTRMetadata.add(trExportMetadata); + }else{ + if(tMetadata instanceof ImportMetadata){ + TRImportMetadata trImportMetadata=new TRImportMetadata(); + trImportMetadata.setSourceType(((ImportMetadata)tMetadata).getSourceType()); + trImportMetadata.setImportDate(((ImportMetadata)tMetadata).getImportDate()); + trImportMetadata.setUrl(((ImportMetadata)tMetadata).getUri()); + listTRMetadata.add(trImportMetadata); + }else{ + if(tMetadata instanceof GenericMapMetadata){ + TRGenericMapMetadata trGenericMapMetadata=new TRGenericMapMetadata(); + trGenericMapMetadata.setMetadataMap(((GenericMapMetadata)tMetadata).getMetadataMap()); + listTRMetadata.add(trGenericMapMetadata); + }else{ + + } + + } + } + } + } } } diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/metadata/TRNamesMetadata.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/metadata/TRNamesMetadata.java index 316f6fd..183acd7 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/metadata/TRNamesMetadata.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/shared/tr/metadata/TRNamesMetadata.java @@ -13,19 +13,19 @@ public class TRNamesMetadata implements TRMetadata { private static final long serialVersionUID = 7635332011036656032L; - ArrayList listLocalizedText; + ArrayList listTRLocalizedText; - public ArrayList getListLocalizedText() { - return listLocalizedText; + public ArrayList getListTRLocalizedText() { + return listTRLocalizedText; } - public void setListLocalizedText(ArrayList listLocalizedText) { - this.listLocalizedText = listLocalizedText; + public void setListTRLocalizedText(ArrayList listTRLocalizedText) { + this.listTRLocalizedText = listTRLocalizedText; } @Override public String toString() { - return "TRNamesMetadata [listLocalizedText=" + listLocalizedText + "]"; + return "TRNamesMetadata [listTRLocalizedText=" + listTRLocalizedText + "]"; }