Minor Updated
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@92280 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
78b2466274
commit
44595f7cf7
|
@ -114,6 +114,16 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public TableData getLastTable(TRId trId) throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Return Table
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public TableData getTable(TRId trId) throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Return Metadata of Table
|
||||
*
|
||||
|
|
|
@ -67,6 +67,8 @@ public interface TDGWTServiceAsync {
|
|||
|
||||
void getLastTable(TRId trId, AsyncCallback<TableData> callback);
|
||||
|
||||
void getTable(TRId trId, AsyncCallback<TableData> callback);
|
||||
|
||||
void getTableMetadata(TRId trId, AsyncCallback<ArrayList<TabMetadata>> callback);
|
||||
|
||||
void getTRMetadata(TRId trId, AsyncCallback<ArrayList<TRMetadata>> callback);
|
||||
|
|
|
@ -543,6 +543,57 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public TableData getTable(TRId trId) throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
Table table = service.getTable(new TableId(Long
|
||||
.valueOf(trId.getTableId())));
|
||||
|
||||
TableData tData = new TableData();
|
||||
trId.setTableId(String.valueOf(table.getId().getValue()));
|
||||
tData.setTrId(trId);
|
||||
tData.setName(table.getName());
|
||||
tData.setTypeName(table.getTableType().getName());
|
||||
tData.setTypeCode(table.getTableType().getCode());
|
||||
Collection<TableMetadata> cMeta = table.getAllMetadata();
|
||||
|
||||
tData.setMetaData(cMeta.toString());
|
||||
|
||||
ArrayList<ColumnData> lColumnData = new ArrayList<ColumnData>();
|
||||
for (Column column : table.getColumns()) {
|
||||
ColumnData colData = new ColumnData();
|
||||
colData.setColumnId(column.getLocalId().getValue());
|
||||
colData.setName(column.getName());
|
||||
colData.setTypeName(column.getColumnType().getName());
|
||||
colData.setTypeCode(column.getColumnType().getCode());
|
||||
colData.setDataTypeName(column.getDataType().getName());
|
||||
lColumnData.add(colData);
|
||||
}
|
||||
|
||||
tData.setListColumnData(lColumnData);
|
||||
|
||||
return tData;
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in getTable(): " + e.getLocalizedMessage(),
|
||||
e);
|
||||
throw new TDGWTServiceException("Error in getTable(): "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Not used now, but it will be necessary in the future to retrieve task
|
||||
* pending
|
||||
|
|
Loading…
Reference in New Issue