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
This commit is contained in:
Giancarlo Panichi 2014-10-29 10:49:54 +00:00
parent 6c7a99b2fd
commit 672dc9e84e
1 changed files with 15 additions and 9 deletions

View File

@ -5454,27 +5454,31 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("setTabResourceInformation - old information:" + tr);
ArrayList<TabularResourceMetadata<?>> meta=new ArrayList<TabularResourceMetadata<?>>();
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,7 +5515,7 @@ 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());
@ -5519,6 +5523,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
tr.setAllMetadata(meta);
if (tabResource.isFinalized()) {
if (tr.isValid()) {
if (!tr.isFinalized()) {