Changed rpc parameter

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@84225 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-10-25 10:47:17 +00:00
parent 5cb1fd5762
commit b26c7fabf3
3 changed files with 24 additions and 30 deletions

View File

@ -75,6 +75,6 @@ public interface TDGWTService extends RemoteService {
public ArrayList<CSVRowError> checkCSV(long errorsLimit) throws TDGWTServiceException; public ArrayList<CSVRowError> checkCSV(long errorsLimit) throws TDGWTServiceException;
public void startCSVImport(boolean[] columnToImportMask) throws TDGWTServiceException; public void startCSVImport(CSVImportSession s) throws TDGWTServiceException;
} }

View File

@ -73,7 +73,7 @@ public interface TDGWTServiceAsync {
void checkCSV(long errorsLimit, AsyncCallback<ArrayList<CSVRowError> > callback); void checkCSV(long errorsLimit, AsyncCallback<ArrayList<CSVRowError> > callback);
void startCSVImport(boolean[] columnToImportMask, AsyncCallback<Void> callback); void startCSVImport(CSVImportSession s, AsyncCallback<Void> callback);
} }

View File

@ -78,9 +78,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
protected HttpSession session; protected HttpSession session;
protected ASLSession aslSession; protected ASLSession aslSession;
public void setTabResource(TabResource tabResource) public void setTabResource(TabResource tabResource)
throws TDGWTServiceException { throws TDGWTServiceException {
try { try {
@ -113,10 +110,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
session = this.getThreadLocalRequest().getSession(); session = this.getThreadLocalRequest().getSession();
aslSession = SessionUtil.getAslSession(session); aslSession = SessionUtil.getAslSession(session);
TabResource currentTR=SessionUtil.getTabResource(session); TabResource currentTR = SessionUtil.getTabResource(session);
if(currentTR==null){ if (currentTR == null) {
logger.error( logger.error("CURRENT_TABULAR_RESOURCE is null");
"CURRENT_TABULAR_RESOURCE is null");
throw new TDGWTServiceException( throw new TDGWTServiceException(
"CURRENT_TABULAR_RESOURCE is null"); "CURRENT_TABULAR_RESOURCE is null");
} }
@ -194,9 +190,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
} }
protected void syncTRMetaData(TabularResource tr, TabResource tabResource) {
protected void syncTRMetaData(TabularResource tr,TabResource tabResource){ Date date = Calendar.getInstance().getTime();
Date date=Calendar.getInstance().getTime();
tabResource.setDate(sdf.format(date)); tabResource.setDate(sdf.format(date));
tr.setMetadata(new NameMetadata(tabResource.getName())); tr.setMetadata(new NameMetadata(tabResource.getName()));
tr.setMetadata(new DescriptionMetadata(tabResource.getDescription())); tr.setMetadata(new DescriptionMetadata(tabResource.getDescription()));
@ -208,7 +203,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
tabResource.setTrId(trId); tabResource.setTrId(trId);
} }
protected void retriveTRMetadataFromService(TabularResource tr) protected void retriveTRMetadataFromService(TabularResource tr)
throws TDGWTServiceException { throws TDGWTServiceException {
retriveTRMetadataFromService(tr, 0); retriveTRMetadataFromService(tr, 0);
@ -459,7 +453,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResource serviceTR = trService.createTabularResource(); TabularResource serviceTR = trService.createTabularResource();
syncTRMetaData(serviceTR,importSDMXTabResource); syncTRMetaData(serviceTR, importSDMXTabResource);
SessionUtil SessionUtil
.setSDMXImportTabResource(session, importSDMXTabResource); .setSDMXImportTabResource(session, importSDMXTabResource);
@ -546,8 +540,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
sdmxImportTabResource.setTrId(trId); sdmxImportTabResource.setTrId(trId);
SessionUtil.setSDMXImportTabResource( SessionUtil.setSDMXImportTabResource(
session, sdmxImportTabResource); session, sdmxImportTabResource);
SessionUtil SessionUtil.setTabResource(session,
.setTabResource(session, sdmxImportTabResource); sdmxImportTabResource);
SessionUtil.setTRId(session, trId); SessionUtil.setTRId(session, trId);
@ -739,7 +733,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
@Override @Override
public void startCSVImport(boolean[] columnToImportMask) public void startCSVImport(CSVImportSession csvImportSession)
throws TDGWTServiceException { throws TDGWTServiceException {
session = this.getThreadLocalRequest().getSession(); session = this.getThreadLocalRequest().getSession();
if (session == null) { if (session == null) {
@ -763,13 +757,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
"Error retrieving the fileUploadSession: null"); "Error retrieving the fileUploadSession: null");
} }
importCSVFileOnService(user, fileUploadSession, columnToImportMask); importCSVFileOnService(user, fileUploadSession, csvImportSession);
} }
protected Map<String, Object> csvImportFileParameter( protected Map<String, Object> csvImportFileParameter(
String fileUrlOnStorage, FileUploadSession fileUploadSession, String fileUrlOnStorage, FileUploadSession fileUploadSession,
boolean[] columnToImportMask) { CSVImportSession csvImportSession) {
final String ENCODING = "encoding"; final String ENCODING = "encoding";
final String HASHEADER = "hasHeader"; final String HASHEADER = "hasHeader";
final String SEPARATOR = "separator"; final String SEPARATOR = "separator";
@ -790,7 +784,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
protected void importCSVFileOnService(String user, protected void importCSVFileOnService(String user,
FileUploadSession fileUploadSession, boolean[] columnToImportMask) FileUploadSession fileUploadSession, CSVImportSession csvImportSession)
throws TDGWTServiceException { throws TDGWTServiceException {
FilesStorage filesStorage = new FilesStorage(); FilesStorage filesStorage = new FilesStorage();
@ -798,7 +792,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
fileUploadSession.getCsvFile()); fileUploadSession.getCsvFile());
Map<String, Object> parameterInstance = csvImportFileParameter( Map<String, Object> parameterInstance = csvImportFileParameter(
fileUrlOnStorage, fileUploadSession, columnToImportMask); fileUrlOnStorage, fileUploadSession, csvImportSession);
service = new TabularDataServiceMock(); service = new TabularDataServiceMock();