From 3073fd428d8414f44c6b99d470000fe2e2cbed28 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 27 Jan 2014 16:22:22 +0000 Subject: [PATCH] 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 --- .../user/td/gwtservice/server/TDGWTServiceImpl.java | 12 +++++++++--- .../user/td/gwtservice/client/TestService.java | 8 +++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java index 1f1eae0..0858386 100644 --- a/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/td/gwtservice/server/TDGWTServiceImpl.java @@ -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 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); diff --git a/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestService.java b/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestService.java index cc0a5b0..aeab672 100644 --- a/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestService.java +++ b/src/test/java/org/gcube/portlets/user/td/gwtservice/client/TestService.java @@ -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 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()+"]");