Added Table information
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@85688 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ec652ed49d
commit
0e13cd4a95
|
@ -11,7 +11,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.TDGWTServiceException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.TDOpenSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.TRId;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.TableData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
|
@ -70,6 +72,16 @@ public interface TDGWTService extends RemoteService {
|
||||||
public TabResource createTabularResource(TabResource tabResource)
|
public TabResource createTabularResource(TabResource tabResource)
|
||||||
throws TDGWTServiceException;
|
throws TDGWTServiceException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return Last Table
|
||||||
|
*
|
||||||
|
* @param trId
|
||||||
|
* @return
|
||||||
|
* @throws TDGWTServiceException
|
||||||
|
*/
|
||||||
|
public TableData getLastTable(TRId trId) throws TDGWTServiceException;
|
||||||
|
|
||||||
// Open
|
// Open
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,9 @@ import org.gcube.portlets.user.td.gwtservice.shared.Agencies;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.TDOpenSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.TRId;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.TableData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||||
|
@ -43,6 +45,8 @@ public interface TDGWTServiceAsync {
|
||||||
|
|
||||||
void getTabularResources(AsyncCallback<List<TabResource>> callback);
|
void getTabularResources(AsyncCallback<List<TabResource>> callback);
|
||||||
|
|
||||||
|
void getLastTable(TRId trId, AsyncCallback<TableData> callback);
|
||||||
|
|
||||||
//Open
|
//Open
|
||||||
void setTDOpenSession(TDOpenSession tdOpenSession, AsyncCallback<Void> callback);
|
void setTDOpenSession(TDOpenSession tdOpenSession, AsyncCallback<Void> callback);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
|
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
|
||||||
|
import org.gcube.data.analysis.tabulardata.model.column.Column;
|
||||||
import org.gcube.data.analysis.tabulardata.model.table.Table;
|
import org.gcube.data.analysis.tabulardata.model.table.Table;
|
||||||
import org.gcube.data.analysis.tabulardata.model.table.TableId;
|
import org.gcube.data.analysis.tabulardata.model.table.TableId;
|
||||||
import org.gcube.data.analysis.tabulardata.operation.worker.ActivityStatus;
|
import org.gcube.data.analysis.tabulardata.operation.worker.ActivityStatus;
|
||||||
|
@ -53,11 +54,13 @@ import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
||||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId;
|
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Agencies;
|
import org.gcube.portlets.user.td.gwtservice.shared.Agencies;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
import org.gcube.portlets.user.td.gwtservice.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.ColumnData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
import org.gcube.portlets.user.td.gwtservice.shared.Dataset;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TDGWTServiceException;
|
import org.gcube.portlets.user.td.gwtservice.shared.TDGWTServiceException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TDOpenSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.TDOpenSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TRId;
|
import org.gcube.portlets.user.td.gwtservice.shared.TRId;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.TableData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
||||||
|
@ -149,6 +152,54 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableData getLastTable(TRId trId) throws TDGWTServiceException {
|
||||||
|
try {
|
||||||
|
session = this.getThreadLocalRequest().getSession();
|
||||||
|
aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
|
service = TabularDataServiceFactory.getService(aslSession
|
||||||
|
.getUsername());
|
||||||
|
|
||||||
|
long id=Long.valueOf(trId.getId());
|
||||||
|
|
||||||
|
TabularResourceId tabularResourceId=new TabularResourceId(id);
|
||||||
|
Table table = service.getLastTable(tabularResourceId);
|
||||||
|
|
||||||
|
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());
|
||||||
|
|
||||||
|
ArrayList<ColumnData> lColumnData=new ArrayList<ColumnData>();
|
||||||
|
for(Column column:table.getColumns()){
|
||||||
|
ColumnData colData=new ColumnData();
|
||||||
|
colData.setName(column.getName());
|
||||||
|
colData.setTypeName(column.getColumnType().getName());
|
||||||
|
colData.setTypeCode(column.getColumnType().getCode());
|
||||||
|
lColumnData.add(colData);
|
||||||
|
};
|
||||||
|
|
||||||
|
tData.setListColumnData(lColumnData);
|
||||||
|
|
||||||
|
return tData;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(
|
||||||
|
"Error in getLastTable(): "
|
||||||
|
+ e.getLocalizedMessage(), e);
|
||||||
|
throw new TDGWTServiceException(
|
||||||
|
"Error in getLastTable(): "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue