Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@90595 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
44ea1d308b
commit
9f3f7fbd7d
|
@ -174,6 +174,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR
|
||||
.getTrId());
|
||||
updateTabResourceInformation(currentTR, trMetadatas);
|
||||
currentTR.setDate(getTRCreationDate(currentTR.getTrId()));
|
||||
SessionUtil.setTabResource(session, currentTR);
|
||||
return currentTR;
|
||||
|
||||
|
@ -196,13 +197,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
try {
|
||||
@SuppressWarnings("unused")
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
//ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
// ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
TabResource currentTR = new TabResource();
|
||||
currentTR.setTrId(trId);
|
||||
ArrayList<TRMetadata> trMetadatas = getTRMetadata(currentTR
|
||||
.getTrId());
|
||||
updateTabResourceInformation(currentTR, trMetadatas);
|
||||
currentTR.setDate(getTRCreationDate(trId));
|
||||
return currentTR;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -321,10 +323,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
"Error retrieving Columns: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving Columns: "
|
||||
"Error retrieving Columns: " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving Columns: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +333,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ArrayList<ColumnData> getColumns(TRId trId) throws TDGWTServiceException {
|
||||
public ArrayList<ColumnData> getColumns(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
@ -342,8 +343,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
Table table = service.getTable(new TableId(Long
|
||||
.valueOf(trId.getTableId())));
|
||||
Table table = service.getTable(new TableId(Long.valueOf(trId
|
||||
.getTableId())));
|
||||
|
||||
ArrayList<ColumnData> columns = new ArrayList<ColumnData>();
|
||||
|
||||
|
@ -392,10 +393,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
"Error retrieving Columns: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving Columns: "
|
||||
"Error retrieving Columns: " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error retrieving Columns: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +403,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public ColumnData getColumn(TRId trId, String columnName) throws TDGWTServiceException {
|
||||
public ColumnData getColumn(TRId trId, String columnName)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
@ -413,8 +413,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
Table table = service.getTable(new TableId(Long
|
||||
.valueOf(trId.getTableId())));
|
||||
Table table = service.getTable(new TableId(Long.valueOf(trId
|
||||
.getTableId())));
|
||||
|
||||
ColumnData cData = new ColumnData();
|
||||
|
||||
|
@ -457,11 +457,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
return cData;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
"Error retrieving Column: "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving Column: "
|
||||
logger.error("Error retrieving Column: " + e.getLocalizedMessage(),
|
||||
e);
|
||||
throw new TDGWTServiceException("Error retrieving Column: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
@ -544,11 +542,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*/
|
||||
protected void syncTRMetaData(TabularResource tr, TabResource tabResource) {
|
||||
// Date date = Calendar.getInstance().getTime();
|
||||
logger.debug("TRservice [id:"+tr.getId()+" ,creationDate:"+tr.getCreationDate()+"]");
|
||||
logger.debug("TabResource [name:"+tabResource.getName()+
|
||||
" ,description:"+tabResource.getDescription()+
|
||||
" ,agency:"+tabResource.getAgency()+
|
||||
" ,rights:"+tabResource.getRight()+"]");
|
||||
logger.debug("TRservice [id:" + tr.getId() + " ,creationDate:"
|
||||
+ tr.getCreationDate() + "]");
|
||||
logger.debug("TabResource [name:" + tabResource.getName()
|
||||
+ " ,description:" + tabResource.getDescription() + " ,agency:"
|
||||
+ tabResource.getAgency() + " ,rights:"
|
||||
+ tabResource.getRight() + "]");
|
||||
tabResource.setDate(sdf.format(tr.getCreationDate().getTime()));
|
||||
tr.setMetadata(new NameMetadata(tabResource.getName()));
|
||||
tr.setMetadata(new DescriptionMetadata(tabResource.getDescription()));
|
||||
|
@ -1433,6 +1432,31 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
SessionUtil.setFileUploadSession(session, fileUploadSession);
|
||||
}
|
||||
|
||||
public String getTRCreationDate(TRId trId) throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("GetTRMetadata on " + trId.toString());
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResource tr = service
|
||||
.getTabularResource(new TabularResourceId(Long.valueOf(trId
|
||||
.getId())));
|
||||
|
||||
return sdf.format(tr.getCreationDate().getTime());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error(
|
||||
"Error in getTRCreationDate(): " + e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException("Error in getTRCreationDate(): "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -1443,7 +1467,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("GetTRMetadata on TRId:"+trId.toString());
|
||||
logger.debug("GetTRMetadata on " + trId.toString());
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
|
@ -1455,7 +1479,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
Collection<TabularResourceMetadata> trMetas = tr.getAllMetadata();
|
||||
|
||||
logger.debug("GetTRMetadata size: "+trMetas.size());
|
||||
logger.debug("GetTRMetadata size: " + trMetas.size());
|
||||
ArrayList<TRMetadata> listTRMetadata = new ArrayList<TRMetadata>();
|
||||
|
||||
for (TabularResourceMetadata trMetadata : trMetas) {
|
||||
|
@ -1495,7 +1519,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
logger.debug("GetTRMetadata retrived: "+listTRMetadata.size());
|
||||
logger.debug("GetTRMetadata retrived: " + listTRMetadata.size());
|
||||
return listTRMetadata;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -1516,7 +1540,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("GetTableMetadata on TRId:"+trId.toString());
|
||||
logger.debug("GetTableMetadata on " + trId.toString());
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
@ -1527,7 +1551,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
Collection<TableMetadata> cMeta = table.getAllMetadata();
|
||||
|
||||
ArrayList<TabMetadata> listTabMetadata = new ArrayList<TabMetadata>();
|
||||
logger.debug("Metadata size:"+cMeta.size());
|
||||
logger.debug("Metadata size:" + cMeta.size());
|
||||
for (TableMetadata tMetadata : cMeta) {
|
||||
if (tMetadata instanceof DescriptionsMetadata) {
|
||||
TabDescriptionsMetadata trDescriptionsMetadata = new TabDescriptionsMetadata();
|
||||
|
|
Loading…
Reference in New Issue