Minor updated
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@85694 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
6a7bec4949
commit
620976a5db
|
@ -8,6 +8,7 @@ import java.nio.charset.Charset;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -25,6 +26,7 @@ import org.gcube.common.homelibrary.home.workspace.Workspace;
|
|||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||
import org.gcube.data.analysis.tabulardata.metadata.NoSuchMetadataException;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.Column;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.table.TableMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.table.Table;
|
||||
import org.gcube.data.analysis.tabulardata.model.table.TableId;
|
||||
import org.gcube.data.analysis.tabulardata.operation.worker.ActivityStatus;
|
||||
|
@ -151,54 +153,50 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@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();
|
||||
|
||||
Table table = service.getLastTable(new TabularResourceId(Long
|
||||
.valueOf(trId.getId())));
|
||||
|
||||
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();
|
||||
|
||||
ArrayList<ColumnData> lColumnData=new ArrayList<ColumnData>();
|
||||
for(Column column:table.getColumns()){
|
||||
ColumnData colData=new ColumnData();
|
||||
tData.setMetaData(cMeta.toString());
|
||||
|
||||
|
||||
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());
|
||||
logger.error("Error in getLastTable(): " + e.getLocalizedMessage(),
|
||||
e);
|
||||
throw new TDGWTServiceException("Error in getLastTable(): "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -1070,17 +1068,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Error retrieving the item on workspace"
|
||||
+ csvImportSession.getItemId());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
logger.debug("WorkspaceItem [id:"+wi.getId()+" name:"+wi.getName()+" remotePath:"+wi.getRemotePath()+"]");
|
||||
logger.debug("WorkspaceItem [id:" + wi.getId() + " name:"
|
||||
+ wi.getName() + " remotePath:" + wi.getRemotePath() + "]");
|
||||
} catch (InternalErrorException e1) {
|
||||
e1.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving the item on workspace"
|
||||
+ wi);
|
||||
"Error retrieving the item on workspace" + wi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
FileUploadSession fileUploadSession = new FileUploadSession();
|
||||
CSVImportMonitor csvImportMonitor = new CSVImportMonitor();
|
||||
FileUploadMonitor fileUploadMonitor = new FileUploadMonitor();
|
||||
|
|
|
@ -17,6 +17,8 @@ public class TableData implements Serializable {
|
|||
protected String name;
|
||||
protected String typeName;
|
||||
protected String typeCode;
|
||||
protected String metaData;
|
||||
|
||||
protected ArrayList<ColumnData> listColumnData;
|
||||
protected TRId trId;
|
||||
|
||||
|
@ -51,13 +53,19 @@ public class TableData implements Serializable {
|
|||
public void setTrId(TRId trId) {
|
||||
this.trId = trId;
|
||||
}
|
||||
public String getMetaData() {
|
||||
return metaData;
|
||||
}
|
||||
public void setMetaData(String metaData) {
|
||||
this.metaData = metaData;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TableData [name=" + name + ", typeName="
|
||||
+ typeName + ", typeCode=" + typeCode + ", lColumnData="
|
||||
+ listColumnData + ", trId=" + trId + "]";
|
||||
return "TableData [name=" + name + ", typeName=" + typeName
|
||||
+ ", typeCode=" + typeCode + ", metaData=" + metaData
|
||||
+ ", listColumnData=" + listColumnData + ", trId=" + trId + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue