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 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 startCSVImport(boolean[] columnToImportMask, AsyncCallback<Void> callback);
void startCSVImport(CSVImportSession s, AsyncCallback<Void> callback);
}

View File

@ -77,10 +77,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
protected TabularDataService service;
protected HttpSession session;
protected ASLSession aslSession;
public void setTabResource(TabResource tabResource)
throws TDGWTServiceException {
try {
@ -113,14 +110,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
session = this.getThreadLocalRequest().getSession();
aslSession = SessionUtil.getAslSession(session);
TabResource currentTR=SessionUtil.getTabResource(session);
if(currentTR==null){
logger.error(
"CURRENT_TABULAR_RESOURCE is null");
TabResource currentTR = SessionUtil.getTabResource(session);
if (currentTR == null) {
logger.error("CURRENT_TABULAR_RESOURCE is null");
throw new TDGWTServiceException(
"CURRENT_TABULAR_RESOURCE is null");
}
return currentTR;
} catch (Exception e) {
@ -194,29 +190,27 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
protected void syncTRMetaData(TabularResource tr,TabResource tabResource){
Date date=Calendar.getInstance().getTime();
protected void syncTRMetaData(TabularResource tr, TabResource tabResource) {
Date date = Calendar.getInstance().getTime();
tabResource.setDate(sdf.format(date));
tr.setMetadata(new NameMetadata(tabResource.getName()));
tr.setMetadata(new DescriptionMetadata(tabResource.getDescription()));
tr.setMetadata(new CreationDateMetadata(date));
tr.setMetadata(new AgencyMetadata(tabResource.getAgency()));
tr.setMetadata(new RightsMetadata(tabResource.getRight()));
TRId trId = new TRId(String.valueOf(tr.getId().getValue()));
tabResource.setTrId(trId);
}
protected void retriveTRMetadataFromService(TabularResource tr)
throws TDGWTServiceException {
retriveTRMetadataFromService(tr, 0);
}
protected TabResource retriveTRMetadataFromService(TabularResource tr, int i)
throws TDGWTServiceException {
NameMetadata nameMeta;
RightsMetadata rightsMeta;
CreationDateMetadata creationDateMeta;
@ -458,9 +452,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
.getTabResource();
TabularResource serviceTR = trService.createTabularResource();
syncTRMetaData(serviceTR,importSDMXTabResource);
syncTRMetaData(serviceTR, importSDMXTabResource);
SessionUtil
.setSDMXImportTabResource(session, importSDMXTabResource);
@ -546,8 +540,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
sdmxImportTabResource.setTrId(trId);
SessionUtil.setSDMXImportTabResource(
session, sdmxImportTabResource);
SessionUtil
.setTabResource(session, sdmxImportTabResource);
SessionUtil.setTabResource(session,
sdmxImportTabResource);
SessionUtil.setTRId(session, trId);
@ -739,7 +733,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
@Override
public void startCSVImport(boolean[] columnToImportMask)
public void startCSVImport(CSVImportSession csvImportSession)
throws TDGWTServiceException {
session = this.getThreadLocalRequest().getSession();
if (session == null) {
@ -763,18 +757,18 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
"Error retrieving the fileUploadSession: null");
}
importCSVFileOnService(user, fileUploadSession, columnToImportMask);
importCSVFileOnService(user, fileUploadSession, csvImportSession);
}
protected Map<String, Object> csvImportFileParameter(
String fileUrlOnStorage, FileUploadSession fileUploadSession,
boolean[] columnToImportMask) {
CSVImportSession csvImportSession) {
final String ENCODING = "encoding";
final String HASHEADER = "hasHeader";
final String SEPARATOR = "separator";
final String URL = "url";
Map<String, Object> parameterInstances = new HashMap<String, Object>();
parameterInstances.put(URL, fileUrlOnStorage);
parameterInstances.put(SEPARATOR, fileUploadSession
@ -790,7 +784,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
protected void importCSVFileOnService(String user,
FileUploadSession fileUploadSession, boolean[] columnToImportMask)
FileUploadSession fileUploadSession, CSVImportSession csvImportSession)
throws TDGWTServiceException {
FilesStorage filesStorage = new FilesStorage();
@ -798,7 +792,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
fileUploadSession.getCsvFile());
Map<String, Object> parameterInstance = csvImportFileParameter(
fileUrlOnStorage, fileUploadSession, columnToImportMask);
fileUrlOnStorage, fileUploadSession, csvImportSession);
service = new TabularDataServiceMock();