Updated Metadata reading

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@86581 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-12-05 09:13:23 +00:00
parent 613d912845
commit 7961e8e807
1 changed files with 10 additions and 48 deletions

View File

@ -241,7 +241,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} else {
if (trMetadata instanceof TRRightsMetadata) {
tabResource
.setDate(((TRRightsMetadata) trMetadata)
.setRight(((TRRightsMetadata) trMetadata)
.getValue());
} else {
@ -439,49 +439,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
*/
protected TabResource retriveTRMetadataFromService(TabularResource tr, int i)
throws TDGWTServiceException {
NameMetadata nameMeta;
RightsMetadata rightsMeta;
CreationDateMetadata creationDateMeta;
AgencyMetadata agencyMeta;
DescriptionMetadata descriptionMeta;
try {
nameMeta = tr.getMetadata(NameMetadata.class);
creationDateMeta = tr.getMetadata(CreationDateMetadata.class);
agencyMeta = tr.getMetadata(AgencyMetadata.class);
descriptionMeta = tr.getMetadata(DescriptionMetadata.class);
rightsMeta = tr.getMetadata(RightsMetadata.class);
} catch (NoSuchMetadataException e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error retriving metadata from service: "
+ e.getLocalizedMessage());
}
if (nameMeta == null) {
throw new TDGWTServiceException(
"Error retriving metadata from service: TR nameMeta is null");
}
String nameTR = nameMeta.getValue();
String descriptionTR = "";
String agencyTR = "";
String rightsTR = "";
String dateS = "";
if (descriptionMeta != null) {
descriptionTR = descriptionMeta.getValue();
}
if (agencyMeta != null) {
agencyTR = agencyMeta.getValue();
}
if (rightsMeta != null) {
rightsTR = rightsMeta.getValue();
}
if (creationDateMeta != null) {
Date dateTR = creationDateMeta.getValue();
dateS = sdf.format(dateTR);
}
Table table = null;
try {
table = service.getLastTable(tr.getId());
@ -499,17 +457,21 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
tableId = table.getId();
}
TRId trId = null;
TRId trId;
TabResource t;
if (tableId == null) {
logger.info("Tabular Resource " + tr.getId()
+ " has last table with id null.");
t=new TabResource();
t.setTrId(null);
} else {
trId = new TRId(String.valueOf(tr.getId().getValue()),
String.valueOf(tableId.getValue()));
t=getTabResourceInformation(trId);
}
TabResource t = new TabResource(String.valueOf(i), nameTR,
descriptionTR, agencyTR, dateS, rightsTR, trId);
t.setId(String.valueOf(i));
return t;
}