From 672dc9e84e6389475f201cd662f1f562deab7a66 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 29 Oct 2014 10:49:54 +0000 Subject: [PATCH] Fixed set TR information git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@101125 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../gwtservice/server/TDGWTServiceImpl.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 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 bd676d8..470089c 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 @@ -5453,28 +5453,32 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements checkTabularResourceIsFinal(tr); logger.debug("setTabResourceInformation - old information:" + tr); - + + ArrayList> meta=new ArrayList>(); + + if (tabResource.getName() != null) { NameMetadata name = new NameMetadata(tabResource.getName()); - tr.setMetadata(name); + meta.add(name); } if (tabResource.getDescription() != null) { DescriptionMetadata description = new DescriptionMetadata( tabResource.getDescription()); - tr.setMetadata(description); + meta.add(description); + } if (tabResource.getAgency() != null) { AgencyMetadata agency = new AgencyMetadata( tabResource.getAgency()); - tr.setMetadata(agency); + meta.add(agency); } if (tabResource.getRight() != null) { RightsMetadata rights = new RightsMetadata( tabResource.getRight()); - tr.setMetadata(rights); + meta.add(rights); } if (tabResource.getValidFrom() != null @@ -5485,7 +5489,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements validFromC.setTime(dateF); ValidSinceMetadata validSince = new ValidSinceMetadata(); validSince.setValue(validFromC); - tr.setMetadata(validSince); + meta.add(validSince); } catch (ParseException e) { logger.info("ValidFromMetadata is not set, no valid calendar present"); } @@ -5499,7 +5503,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements validUntilToC.setTime(dateU); ValidUntilMetadata validUntil = new ValidUntilMetadata( validUntilToC); - tr.setMetadata(validUntil); + meta.add(validUntil); } catch (ParseException e) { logger.info("ValidUntilMetadata is not set, no valid calendar present"); } @@ -5511,14 +5515,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements Licence licence = LicenceMap.map(tabResource.getLicence()); if (licence != null) { licenceMetadata.setValue(licence); - tr.setMetadata(licenceMetadata); + meta.add(licenceMetadata); } else { logger.error("Licence type not found: " + tabResource.getLicence()); } } - + + tr.setAllMetadata(meta); + if (tabResource.isFinalized()) { if (tr.isValid()) { if (!tr.isFinalized()) {