Added Export CSV Monitor

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@86338 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-11-28 17:35:11 +00:00
parent c5bf5a1d4f
commit 1127ad51c2
7 changed files with 396 additions and 95 deletions

View File

@ -7,6 +7,8 @@ import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
@ -24,7 +26,6 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Codelist;
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Dataset;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@ -241,4 +242,26 @@ public interface TDGWTService extends RemoteService {
*/
public CSVImportMonitor getCSVImportMonitor() throws TDGWTServiceException;
//Export CSV
/**
* Get Operation Monitor during the CSV Export operation
*
* @return
* @throws TDGWTServiceException
*/
public CSVExportMonitor getCSVExportMonitor() throws TDGWTServiceException;
/**
* Start CSV Export and invokes the client library
*
* @param csvExportSession
* @throws TDGWTServiceException
*/
public void startCSVExport(CSVExportSession csvExportSession) throws TDGWTServiceException;
}

View File

@ -7,6 +7,8 @@ import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
@ -84,5 +86,10 @@ public interface TDGWTServiceAsync {
void startCSVImport(CSVImportSession csvImportSession, AsyncCallback<Void> callback);
//Export CSV
void getCSVExportMonitor(AsyncCallback<CSVExportMonitor> callback);
void startCSVExport(CSVExportSession csvExportSession, AsyncCallback<Void> callback);
}

View File

@ -57,6 +57,11 @@ public class SessionUtil {
protected static final String CSV_IMPORT_TASK="CSV_IMPORT_TASK";
protected static final String CSV_IMPORT_TABULAR_RESOURCE = "CSV_IMPORT_TABULAR_RESOURCE";
protected static final String CSV_EXPORT_FILE_SESSION = "CSV_EXPORT_FILE";
protected static final String CSV_EXPORT_FILE_TASK="CSV_EXPORT_FILE_TASK";
protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
protected static ASLSession getAslSession(HttpSession httpSession) {
@ -367,6 +372,22 @@ public class SessionUtil {
httpSession.setAttribute(CSV_IMPORT_TASK, task);
}
public static Task getCSVExportFileTask(HttpSession httpSession) {
Task monitor = (Task) httpSession.getAttribute(CSV_EXPORT_FILE_TASK);
if (monitor == null) {
logger.error("CSV_EXPORT_FILE_TASK was not acquired");
}
return monitor;
}
public static void setCSVExportFileTask(HttpSession httpSession, Task task) {
Task monitor = (Task) httpSession.getAttribute(CSV_EXPORT_FILE_TASK);
if (monitor != null)
httpSession.removeAttribute(CSV_EXPORT_FILE_TASK);
httpSession.setAttribute(CSV_EXPORT_FILE_TASK, task);
}
public static TRTasksManager getTRTasksManager(HttpSession httpSession) {
TRTasksManager tasksManager = (TRTasksManager) httpSession.getAttribute(TR_TASK_MANAGER);

View File

@ -63,7 +63,10 @@ import org.gcube.portlets.user.td.gwtservice.server.file.FileUploadSession;
import org.gcube.portlets.user.td.gwtservice.server.file.FileUtil;
import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationsId;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.csv.AvailableCharsetList;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVFileUtil;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
@ -190,11 +193,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
tData.setName(table.getName());
tData.setTypeName(table.getTableType().getName());
tData.setTypeCode(table.getTableType().getCode());
Collection<TableMetadata> cMeta=table.getAllMetadata();
Collection<TableMetadata> cMeta = table.getAllMetadata();
tData.setMetaData(cMeta.toString());
ArrayList<ColumnData> lColumnData = new ArrayList<ColumnData>();
for (Column column : table.getColumns()) {
ColumnData colData = new ColumnData();
@ -569,9 +571,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Map<String, Object> parameterInstance = retrieveOperationParameters(sdmxImportSession);
InvocationCreator ic=InvocationCreator.getCreator(importSDMXCodelistOperation);
OperationInvocation invocation = ic.setParameters(parameterInstance).create();
InvocationCreator ic = InvocationCreator
.getCreator(importSDMXCodelistOperation);
OperationInvocation invocation = ic
.setParameters(parameterInstance).create();
logger.debug("OperationInvocation: \n" + invocation.toString());
Task trTask = oService.execute(invocation, serviceTR.getId());
logger.debug("Start Task on service: TaskId " + trTask.getId());
@ -592,19 +596,19 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* @throws TDGWTServiceException
*/
protected OperationDescriptor getOperationDescriptorWithId(String op,
List<OperationDescriptor> capabilities) throws TDGWTServiceException {
List<OperationDescriptor> capabilities)
throws TDGWTServiceException {
for (OperationDescriptor operation : capabilities) {
if (Long.valueOf(op) == operation.getOperationId().getValue()) {
return operation;
}
}
throw new TDGWTServiceException("OperationDescriptor not found");
}
protected State matchTaskState(TaskStatus status){
protected State matchTaskState(TaskStatus status) {
switch (status) {
case INITIALIZING:
return State.INITIALIZING;
@ -622,7 +626,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
return State.FAILED;
}
}
/**
* {@inheritDoc}
@ -655,14 +658,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} else {
logger.debug("Service Task.getStatus(): "
+ task.getStatus());
importMonitor.setStatus(matchTaskState(task.getStatus()));
importMonitor
.setStatus(matchTaskState(task.getStatus()));
switch (importMonitor.getStatus()) {
case SUCCEDED:
importMonitor.setProgress(task.getProgress());
logger.debug("Task Result: " + task.getResult());
trId.setTableId(String.valueOf(task.getResult().getPrimaryTable().getId().getValue()));
trId.setTableId(String.valueOf(task.getResult()
.getPrimaryTable().getId().getValue()));
sdmxImportTabResource.setTrId(trId);
SessionUtil.setSDMXImportTabResource(session,
sdmxImportTabResource);
@ -675,8 +680,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
if (task.getResult() != null) {
logger.debug("Task exception:"
+ task.getErrorCause());
importMonitor
.setError(task.getErrorCause());
importMonitor.setError(task.getErrorCause());
} else {
logger.debug("Task exception: Error In Import");
importMonitor.setError(new Throwable(
@ -913,22 +917,18 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
protected Map<String, Object> csvImportFileParameter(
String fileUrlOnStorage, FileUploadSession fileUploadSession,
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, String.valueOf(fileUploadSession
.getParserConfiguration().getDelimiter()));// ','
parameterInstances.put(ENCODING, fileUploadSession
parameterInstances.put(Constants.URL, fileUrlOnStorage);
parameterInstances.put(Constants.SEPARATOR, String
.valueOf(fileUploadSession.getParserConfiguration()
.getDelimiter()));// ','
parameterInstances.put(Constants.ENCODING, fileUploadSession
.getParserConfiguration().getCharset().name());// "UTF-8"
boolean hasHeader = true;
if (fileUploadSession.getParserConfiguration().getHeaderPresence() == HeaderPresence.NONE) {
hasHeader = false;
}
parameterInstances.put(HASHEADER, hasHeader);// true
parameterInstances.put(Constants.HASHEADER, hasHeader);// true
return parameterInstances;
}
@ -943,14 +943,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
FileUploadSession fileUploadSession,
CSVImportSession csvImportSession) throws TDGWTServiceException {
logger.debug("File Storage Access");
FilesStorage filesStorage = new FilesStorage();
String fileUrlOnStorage = filesStorage.storageCSVTempFile(user,
fileUploadSession.getCsvFile());
logger.debug("File Url On Storage:"+fileUrlOnStorage);
logger.debug("File Url On Storage:" + fileUrlOnStorage);
Map<String, Object> parameterInstance = csvImportFileParameter(
fileUrlOnStorage, fileUploadSession, csvImportSession);
@ -960,13 +959,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<OperationDescriptor> capabilities = service.getCapabilities();
// Import CSV file
OperationDescriptor importCSVFileOperation = getOperationDescriptorWithId(
OperationsId.CSVImport.toString(), capabilities);
InvocationCreator ic=InvocationCreator.getCreator(importCSVFileOperation);
OperationInvocation invocation = ic.setParameters(parameterInstance).create();
InvocationCreator ic = InvocationCreator
.getCreator(importCSVFileOperation);
OperationInvocation invocation = ic.setParameters(parameterInstance)
.create();
logger.debug("OperationInvocation: \n" + invocation.toString());
TabularResource tabularResource = service.createTabularResource();
TabResource csvImportTabResource = csvImportSession.getTabResource();
@ -1018,15 +1019,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
"Error in importCSV Status null");
} else {
logger.debug("Status: " + task.getStatus());
importMonitor.setStatus(matchTaskState(task.getStatus()));
importMonitor
.setStatus(matchTaskState(task.getStatus()));
switch (importMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
logger.debug("Task exception:"
+ task.getErrorCause());
importMonitor
.setError(new Throwable(task.getErrorCause()));
importMonitor.setError(task
.getErrorCause());
} else {
logger.debug("Task exception: Error In Import");
importMonitor.setError(new Throwable(
@ -1079,6 +1081,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* {@inheritDoc}
*/
@Override
public void getFileFromWorkspace(CSVImportSession csvImportSession)
throws TDGWTServiceException {
@ -1157,6 +1163,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
SessionUtil.setFileUploadSession(session, fileUploadSession);
}
/**
*
* {@inheritDoc}
*/
@Override
public ArrayList<TRMetadata> getTableMetadata(TRId trId)
throws TDGWTServiceException {
@ -1167,90 +1177,292 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
service = TabularDataServiceFactory.getService(aslSession
.getUsername());
Table table = service.getTable(new TableId(Long.valueOf(trId.getTableId())));
Collection<TableMetadata> cMeta=table.getAllMetadata();
ArrayList<TRMetadata> listTRMetadata=new ArrayList<TRMetadata>();
for(TableMetadata tMetadata:cMeta){
if(tMetadata instanceof DescriptionsMetadata){
TRDescriptionsMetadata trDescriptionsMetadata=new TRDescriptionsMetadata();
ArrayList<TRLocalizedText> listTRLocalizedText=new ArrayList<TRLocalizedText>();
List<LocalizedText> lLocalizedText=((DescriptionsMetadata) tMetadata).getTexts();
int i=0;
for(LocalizedText lt:lLocalizedText){
TRLocalizedText trLocalizedText=new TRLocalizedText();
Table table = service.getTable(new TableId(Long.valueOf(trId
.getTableId())));
Collection<TableMetadata> cMeta = table.getAllMetadata();
ArrayList<TRMetadata> listTRMetadata = new ArrayList<TRMetadata>();
for (TableMetadata tMetadata : cMeta) {
if (tMetadata instanceof DescriptionsMetadata) {
TRDescriptionsMetadata trDescriptionsMetadata = new TRDescriptionsMetadata();
ArrayList<TRLocalizedText> listTRLocalizedText = new ArrayList<TRLocalizedText>();
List<LocalizedText> lLocalizedText = ((DescriptionsMetadata) tMetadata)
.getTexts();
int i = 0;
for (LocalizedText lt : lLocalizedText) {
TRLocalizedText trLocalizedText = new TRLocalizedText();
trLocalizedText.setId(i);
trLocalizedText.setValue(lt.getValue());
trLocalizedText.setLocaleCode(lt.getLocale());
listTRLocalizedText.add(trLocalizedText);
i++;
}
trDescriptionsMetadata.setListTRLocalizedText(listTRLocalizedText);
trDescriptionsMetadata
.setListTRLocalizedText(listTRLocalizedText);
listTRMetadata.add(trDescriptionsMetadata);
} else {
if(tMetadata instanceof NamesMetadata){
TRNamesMetadata trNamesMetadata=new TRNamesMetadata();
ArrayList<TRLocalizedText> listTRLocalizedText=new ArrayList<TRLocalizedText>();
List<LocalizedText> lLocalizedText=((NamesMetadata) tMetadata).getTexts();
int i=0;
for(LocalizedText lt:lLocalizedText){
TRLocalizedText trLocalizedText=new TRLocalizedText();
if (tMetadata instanceof NamesMetadata) {
TRNamesMetadata trNamesMetadata = new TRNamesMetadata();
ArrayList<TRLocalizedText> listTRLocalizedText = new ArrayList<TRLocalizedText>();
List<LocalizedText> lLocalizedText = ((NamesMetadata) tMetadata)
.getTexts();
int i = 0;
for (LocalizedText lt : lLocalizedText) {
TRLocalizedText trLocalizedText = new TRLocalizedText();
trLocalizedText.setId(i);
trLocalizedText.setValue(lt.getValue());
trLocalizedText.setLocaleCode(lt.getLocale());
listTRLocalizedText.add(trLocalizedText);
i++;
}
trNamesMetadata.setListTRLocalizedText(listTRLocalizedText);
trNamesMetadata
.setListTRLocalizedText(listTRLocalizedText);
listTRMetadata.add(trNamesMetadata);
} else {
if(tMetadata instanceof VersionMetadata){
TRVersionMetadata trVersionMetadata=new TRVersionMetadata();
trVersionMetadata.setVersion(((VersionMetadata)tMetadata).getVersion());
if (tMetadata instanceof VersionMetadata) {
TRVersionMetadata trVersionMetadata = new TRVersionMetadata();
trVersionMetadata
.setVersion(((VersionMetadata) tMetadata)
.getVersion());
listTRMetadata.add(trVersionMetadata);
}else{
if(tMetadata instanceof ExportMetadata){
TRExportMetadata trExportMetadata=new TRExportMetadata();
trExportMetadata.setDestinationType(((ExportMetadata)tMetadata).getDestinationType());
trExportMetadata.setExportDate(sdf.format(((ExportMetadata)tMetadata).getExportDate()));
trExportMetadata.setUrl(((ExportMetadata)tMetadata).getUri());
} else {
if (tMetadata instanceof ExportMetadata) {
TRExportMetadata trExportMetadata = new TRExportMetadata();
trExportMetadata
.setDestinationType(((ExportMetadata) tMetadata)
.getDestinationType());
trExportMetadata.setExportDate(sdf
.format(((ExportMetadata) tMetadata)
.getExportDate()));
trExportMetadata
.setUrl(((ExportMetadata) tMetadata)
.getUri());
listTRMetadata.add(trExportMetadata);
}else{
if(tMetadata instanceof ImportMetadata){
TRImportMetadata trImportMetadata=new TRImportMetadata();
trImportMetadata.setSourceType(((ImportMetadata)tMetadata).getSourceType());
trImportMetadata.setImportDate(sdf.format(((ImportMetadata)tMetadata).getImportDate()));
trImportMetadata.setUrl(((ImportMetadata)tMetadata).getUri());
} else {
if (tMetadata instanceof ImportMetadata) {
TRImportMetadata trImportMetadata = new TRImportMetadata();
trImportMetadata
.setSourceType(((ImportMetadata) tMetadata)
.getSourceType());
trImportMetadata
.setImportDate(sdf
.format(((ImportMetadata) tMetadata)
.getImportDate()));
trImportMetadata
.setUrl(((ImportMetadata) tMetadata)
.getUri());
listTRMetadata.add(trImportMetadata);
}else{
if(tMetadata instanceof GenericMapMetadata){
TRGenericMapMetadata trGenericMapMetadata=new TRGenericMapMetadata();
trGenericMapMetadata.setMetadataMap(((GenericMapMetadata)tMetadata).getMetadataMap());
listTRMetadata.add(trGenericMapMetadata);
}else{
} else {
if (tMetadata instanceof GenericMapMetadata) {
TRGenericMapMetadata trGenericMapMetadata = new TRGenericMapMetadata();
trGenericMapMetadata
.setMetadataMap(((GenericMapMetadata) tMetadata)
.getMetadataMap());
listTRMetadata
.add(trGenericMapMetadata);
} else {
}
}
}
}
}
}
}
return listTRMetadata;
} catch (Exception e) {
logger.error("Error in getTableMetadata(): " + e.getLocalizedMessage(),
logger.error(
"Error in getTableMetadata(): " + e.getLocalizedMessage(),
e);
throw new TDGWTServiceException("Error in getTableMetadata(): "
+ e.getLocalizedMessage());
}
}
/**
*
* @param exportSession
* @return
*/
protected Map<String, Object> csvExportFileParameter(
CSVExportSession exportSession) {
Map<String, Object> parameterInstances = new HashMap<String, Object>();
parameterInstances.put(Constants.ENCODING, exportSession.getEncoding());
parameterInstances.put(Constants.SEPARATOR,
exportSession.getSeparator());
parameterInstances.put(Constants.COLUMNS, exportSession.getColumns());
// TODO
/*
* List<String> columns = Lists.newArrayList(); for(Column column :
* table.getColumns()) if (!(column.getColumnType() instanceof
* IdColumnType)) columns.add(column.getName());
*
* instances.put(Constants.COLUMNS, columns);
*/
return parameterInstances;
}
/**
*
* {@inheritDoc}
*/
@Override
public void startCSVExport(CSVExportSession exportSession)
throws TDGWTServiceException {
logger.debug("Start CSV Export");
session = this.getThreadLocalRequest().getSession();
if (session == null) {
throw new TDGWTServiceException(
"Error retrieving the session: null");
}
logger.info("Session:" + session.getId());
aslSession = SessionUtil.getAslSession(session);
if (aslSession == null) {
throw new TDGWTServiceException(
"Error retrieving the asl session: null");
}
String user = aslSession.getUsername();
logger.info("Session User:" + user);
TRId trId = SessionUtil.getTRId(session);
if (trId == null) {
throw new TDGWTServiceException(
"Error no tabular resource in session");
}
if (trId.getTableId() == null) {
throw new TDGWTServiceException("Error no table present in session");
}
Map<String, Object> parameterInstance = csvExportFileParameter(exportSession);
logger.debug("Tabular Data Service");
service = TabularDataServiceFactory
.getService(aslSession.getUsername());
List<OperationDescriptor> capabilities = service.getCapabilities();
// Export CSV file
OperationDescriptor exportCSVFileOperation = getOperationDescriptorWithId(
OperationsId.CSVExport.toString(), capabilities);
InvocationCreator ic = InvocationCreator
.getCreator(exportCSVFileOperation);
OperationInvocation invocation = ic
.setTargetTable(new TableId(Long.valueOf(trId.getTableId())))
.setParameters(parameterInstance).create();
logger.debug("OperationInvocation: \n" + invocation.toString());
Task trTask;
try {
trTask = service.execute(invocation,
new TabularResourceId(Long.valueOf(trId.getId())));
} catch (Exception e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Tabular Data Service error exporting TabularResource: "
+ e.getLocalizedMessage());
}
logger.debug("Start Task on service: TaskId " + trTask.getId());
SessionUtil.setCSVExportFileTask(session, trTask);
}
/**
* {@inheritDoc}
*/
@Override
public CSVExportMonitor getCSVExportMonitor() throws TDGWTServiceException {
try {
session = this.getThreadLocalRequest().getSession();
aslSession = SessionUtil.getAslSession(session);
Task task = SessionUtil.getCSVExportFileTask(session);
CSVExportMonitor exportMonitor = new CSVExportMonitor();
if (task == null) {
logger.debug("Task null");
throw new TDGWTServiceException("Error in exportCSV task null");
} else {
TaskStatus status = task.getStatus();
if (status == null) {
throw new TDGWTServiceException(
"Error in exportCSV Status null");
} else {
logger.debug("Status: " + task.getStatus());
exportMonitor.setStatus(matchTaskState(task.getStatus()));
switch (exportMonitor.getStatus()) {
case FAILED:
if (task.getResult() != null) {
logger.debug("Task exception:"
+ task.getErrorCause());
exportMonitor.setError(task
.getErrorCause());
} else {
logger.debug("Task exception: Error In Export");
exportMonitor.setError(new Throwable(
"Error In Export"));
}
exportMonitor.setProgress(task.getProgress());
break;
case SUCCEDED:
logger.debug("Task Result:" + task.getResult());
exportMonitor.setProgress(task.getProgress());
Table table = task.getResult().getPrimaryTable();
logger.debug("Table retrived: " + table.toString());
ExportMetadata exportMetadata = table
.getMetadata(ExportMetadata.class);
logger.debug("ExportMetadata: " + exportMetadata);
exportMonitor.setTrId(SessionUtil.getTRId(session));
TRExportMetadata trExportMetadata = new TRExportMetadata();
trExportMetadata.setUrl(exportMetadata.getUri());
trExportMetadata.setDestinationType(exportMetadata
.getDestinationType());
trExportMetadata.setExportDate(sdf
.format(exportMetadata.getExportDate()));
exportMonitor.setTrExportMetadata(trExportMetadata);
break;
case IN_PROGRESS:
exportMonitor.setProgress(task.getProgress());
break;
case ABORTED:
break;
case INITIALIZING:
break;
case WAITING:
break;
default:
break;
}
}
SessionUtil.setCSVExportFileTask(session, task);
}
logger.info("getExportMonitor(): " + exportMonitor);
return exportMonitor;
} catch (Exception e) {
e.printStackTrace();
throw new TDGWTServiceException(
"Error in exportCSV CSVExportMonitor: "
+ e.getLocalizedMessage());
}
}
}

View File

@ -16,5 +16,10 @@ public class Constants {
public final static String DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devsec";
public static final String ENCODING = "encoding";
public static final String HASHEADER = "hasHeader";
public static final String SEPARATOR = "separator";
public static final String COLUMNS = "columns";
public static final String URL = "url";
}

View File

@ -4,7 +4,10 @@
package org.gcube.portlets.user.td.gwtservice.shared.csv;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.destination.Destination;
@ -25,6 +28,29 @@ public class CSVExportSession implements Serializable {
protected String itemId;
protected String fileName;
protected ArrayList<String> columns;
protected String encoding;
protected String separator;
public ArrayList<String> getColumns() {
return columns;
}
public void setColumns(ArrayList<String> columns) {
this.columns = columns;
}
public String getEncoding() {
return encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public String getSeparator() {
return separator;
}
public void setSeparator(String separator) {
this.separator = separator;
}
public String getId() {
return id;
}
@ -52,10 +78,14 @@ public class CSVExportSession implements Serializable {
@Override
public String toString() {
return "CSVExportSession [id=" + id + ", destination=" + destination
+ ", itemId=" + itemId + ", fileName=" + fileName + "]";
+ ", itemId=" + itemId + ", fileName=" + fileName
+ ", columns=" + columns + ", encoding=" + encoding
+ ", separator=" + separator + "]";
}

View File

@ -28,7 +28,10 @@ public class TestServiceOperations {
System.out
.println("------------Tabular Resource Operation--------------");
for (OperationDescriptor operation : trOperations) {
System.out.println(operation.toString());
System.out.println("Name: "+operation.getName());
System.out.println("Scope: "+operation.getScope());
System.out.println("Desc: "+operation.toString());
System.out.println("-----------------------------------");
}
}