Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@90585 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-01-27 16:22:22 +00:00
parent 4b268dc70b
commit 3073fd428d
2 changed files with 14 additions and 6 deletions

View File

@ -194,15 +194,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
public TabResource getTabResourceInformation(TRId trId)
throws TDGWTServiceException {
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);
SessionUtil.setTabResource(session, currentTR);
return currentTR;
} catch (Exception e) {
@ -544,7 +544,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
*/
protected void syncTRMetaData(TabularResource tr, TabResource tabResource) {
// Date date = Calendar.getInstance().getTime();
logger.debug("TR [id:"+tr.getId()+" ,creationDate:"+tr.getCreationDate()+"]");
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()));
@ -830,6 +834,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResource serviceTR = trService.createTabularResource();
syncTRMetaData(serviceTR, importSDMXTabResource);
TRId trId = new TRId(String.valueOf(serviceTR.getId().getValue()));
importSDMXTabResource.setTrId(trId);
@ -1237,6 +1242,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResource tabularResource = service.createTabularResource();
TabResource csvImportTabResource = csvImportSession.getTabResource();
syncTRMetaData(tabularResource, csvImportTabResource);
logger.debug(csvImportTabResource.toString());
TRId trId = new TRId(String.valueOf(tabularResource.getId().getValue()));
csvImportTabResource.setTrId(trId);
SessionUtil.setCSVImportTabResource(session, csvImportTabResource);

View File

@ -44,7 +44,7 @@ public class TestService {
@Test
public void createSDMX() throws Exception {
System.out.println("------------Create SDMX TR--------------");
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
AuthorizationProvider.instance.set(new AuthorizationToken(Constants.DEFAULT_USER));
@ -129,6 +129,7 @@ public class TestService {
@Test
public void createCSV() throws Exception{
System.out.println("------------Create CSV TR--------------");
try{
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
AuthorizationProvider.instance.set(new AuthorizationToken(Constants.DEFAULT_USER));
@ -194,13 +195,14 @@ public class TestService {
@Test
public void listTR() throws Exception {
System.out.println("------------List TR--------------");
ScopeProvider.instance.set(Constants.DEFAULT_SCOPE);
AuthorizationProvider.instance.set(new AuthorizationToken(Constants.DEFAULT_USER));
TabularDataService service = TabularDataServiceFactory.getService();
List<TabularResource> trs = service.getTabularResources();
Assert.assertTrue(trs.size() > 0);
System.out.println("------------Tabular Resource--------------");
System.out.println("---Tabular Resource---");
Table lastTable=null;
for (TabularResource tr : trs) {
lastTable=service.getLastTable(tr.getId());
@ -214,7 +216,7 @@ public class TestService {
}
if(lastTable!=null){
System.out.println("------------Test Column--------------");
System.out.println("---Test Column---");
System.out.println("Table "+lastTable.getId()+" "+lastTable.getName());
for(Column col:lastTable.getColumns()){
System.out.println("Column: [name:" + col.getName()+", localId:"+col.getLocalId()+", dataType:"+col.getDataType()+"]");