Updated CSVExport and Discard

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100348 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-10-02 10:50:38 +00:00
parent 8bf48d4298
commit bbb0a965af
4 changed files with 108 additions and 75 deletions

View File

@ -3429,6 +3429,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
exportSession.getEncoding()); exportSession.getEncoding());
parameterInstances.put(Constants.PARAMETER_SEPARATOR, parameterInstances.put(Constants.PARAMETER_SEPARATOR,
exportSession.getSeparator()); exportSession.getSeparator());
parameterInstances.put(Constants.PARAMETER_VIEW_COLUMNS,
exportSession.isExportViewColumns());
parameterInstances.put(Constants.PARAMETER_COLUMNS, parameterInstances.put(Constants.PARAMETER_COLUMNS,
exportSession.getColumnsAsString()); exportSession.getColumnsAsString());
return parameterInstances; return parameterInstances;
@ -3525,7 +3527,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.error("Tabular Resource Is Locked"); logger.error("Tabular Resource Is Locked");
throw new TDGWTIsLockedException("Tabular Resource Is Locked"); throw new TDGWTIsLockedException("Tabular Resource Is Locked");
} }
} catch (TDGWTServiceException e){ } catch (TDGWTServiceException e) {
throw e; throw e;
} catch (SecurityException e) { } catch (SecurityException e) {
throw e; throw e;
@ -3555,7 +3557,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
throw new TDGWTIsFinalException("Tabular Resource Is Final"); throw new TDGWTIsFinalException("Tabular Resource Is Final");
} }
} catch (TDGWTServiceException e){ } catch (TDGWTServiceException e) {
throw e; throw e;
} catch (SecurityException e) { } catch (SecurityException e) {
throw e; throw e;
@ -3684,7 +3686,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
checkTabularResourceLocked(service, trId); checkTabularResourceLocked(service, trId);
// Export CSV file // Export CSV file
OperationDefinition exportCSVFileOperation = OperationDefinitionMap OperationDefinition exportCSVFileOperation = OperationDefinitionMap
.map(OperationsId.CSVExport.toString(), service); .map(OperationsId.CSVExport.toString(), service);
@ -4015,9 +4016,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularResourceId serviceTR = new TabularResourceId(id); TabularResourceId serviceTR = new TabularResourceId(id);
logger.debug("OperationInvocation: \n" + invocation.toString()); logger.debug("OperationInvocation: \n" + invocation.toString());
logger.debug("Start Replace on Service:"+sdfPerformance.format(new Date())); logger.debug("Start Replace on Service:"
+ sdfPerformance.format(new Date()));
Task trTask = service.execute(invocation, serviceTR); Task trTask = service.execute(invocation, serviceTR);
logger.debug("Start Replace returned task:"+sdfPerformance.format(new Date())); logger.debug("Start Replace returned task:"
+ sdfPerformance.format(new Date()));
logger.debug("Replace Column by Expression on service: TaskId " logger.debug("Replace Column by Expression on service: TaskId "
+ trTask.getId()); + trTask.getId());
@ -4397,7 +4400,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Task trTask = service.execute(invocation, cloneTR.getId()); Task trTask = service.execute(invocation, cloneTR.getId());
logger.debug("Start Task on service: TaskId " + trTask.getId()); logger.debug("Start Task on service: TaskId " + trTask.getId());
TaskWrapper taskWrapper = new TaskWrapper(trTask, TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.Clone, trIdClone); UIOperationsId.Clone, trIdClone);
SessionUtil.setStartedTask(session, taskWrapper); SessionUtil.setStartedTask(session, taskWrapper);
@ -5353,17 +5355,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Discard :" + op); logger.debug("Discard :" + op);
rollBackSession = new RollBackSession(trId, historyId); rollBackSession = new RollBackSession(trId, historyId);
logger.debug("Start Discard:"+sdfPerformance.format(new Date())); logger.debug("Start Discard:"
+ sdfPerformance.format(new Date()));
// //
logger.debug("rollBack(): " + rollBackSession); logger.debug("rollBack(): " + rollBackSession);
SessionUtil.setRollBackSession(session, rollBackSession); SessionUtil
.setRollBackSession(session, rollBackSession);
HistoryStepId historyStepId = new HistoryStepId( HistoryStepId historyStepId = new HistoryStepId(
rollBackSession.getHistoryId()); rollBackSession.getHistoryId());
logger.debug("Start RollBack task:"+sdfPerformance.format(new Date())); logger.debug("Start RollBack task:"
Task trTask = service.rollbackTo(tabularResourceId, historyStepId); + sdfPerformance.format(new Date()));
logger.debug("Start RollBack returned task:"+sdfPerformance.format(new Date())); Task trTask = service.rollbackTo(tabularResourceId,
historyStepId);
logger.debug("Start RollBack returned task:"
+ sdfPerformance.format(new Date()));
if (trTask == null) { if (trTask == null) {
logger.error("Error on service Task null"); logger.error("Error on service Task null");
@ -5372,13 +5379,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
logger.debug("Start Task on service: " + trTask.getId()); logger.debug("Start Task on service: " + trTask.getId());
TaskWrapper taskWrapper = new TaskWrapper(trTask, TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.RollBack, rollBackSession.getTrId()); UIOperationsId.RollBack,
rollBackSession.getTrId());
SessionUtil.setStartedTask(session, taskWrapper); SessionUtil.setStartedTask(session, taskWrapper);
taskId=trTask.getId().getValue(); taskId = trTask.getId().getValue();
// //
logger.debug("Start Discard returned task:"+sdfPerformance.format(new Date())); logger.debug("Start Discard returned task:"
+ sdfPerformance.format(new Date()));
} else { } else {
logger.debug("Discard : step null"); logger.debug("Discard : step null");
@ -5431,9 +5439,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Long.valueOf(rollBackSession.getTrId().getId())); Long.valueOf(rollBackSession.getTrId().getId()));
HistoryStepId historyStepId = new HistoryStepId( HistoryStepId historyStepId = new HistoryStepId(
rollBackSession.getHistoryId()); rollBackSession.getHistoryId());
logger.debug("Start RollBack task:"+sdfPerformance.format(new Date())); logger.debug("Start RollBack task:"
+ sdfPerformance.format(new Date()));
Task trTask = service.rollbackTo(tabularResourceId, historyStepId); Task trTask = service.rollbackTo(tabularResourceId, historyStepId);
logger.debug("Start RollBack returned task:"+sdfPerformance.format(new Date())); logger.debug("Start RollBack returned task:"
+ sdfPerformance.format(new Date()));
if (trTask == null) { if (trTask == null) {
logger.error("Error on service Task null"); logger.error("Error on service Task null");
@ -6389,7 +6399,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
checkTabularResourceLocked(service, checkTabularResourceLocked(service,
denormalizationSession.getTrId()); denormalizationSession.getTrId());
checkTabularResourceIsFinal(service, denormalizationSession.getTrId()); checkTabularResourceIsFinal(service,
denormalizationSession.getTrId());
OpExecution4Denormalization opEx = new OpExecution4Denormalization( OpExecution4Denormalization opEx = new OpExecution4Denormalization(
service, denormalizationSession); service, denormalizationSession);
@ -6497,7 +6508,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TaskWrapper taskWrapper = SessionUtil.getStartedTask(session, TaskWrapper taskWrapper = SessionUtil.getStartedTask(session,
operationMonitorSession.getTaskId()); operationMonitorSession.getTaskId());
logger.debug("Start Monitor Time:"+sdfPerformance.format(new Date())); logger.debug("Start Monitor Time:"
+ sdfPerformance.format(new Date()));
OperationMonitorCreator operationMonitorCreator = new OperationMonitorCreator( OperationMonitorCreator operationMonitorCreator = new OperationMonitorCreator(
session, aslSession, taskWrapper, operationMonitorSession); session, aslSession, taskWrapper, operationMonitorSession);
OperationMonitor operationMonitor = operationMonitorCreator OperationMonitor operationMonitor = operationMonitorCreator

View File

@ -24,6 +24,7 @@ public class Constants {
public static final String PARAMETER_FIELDMASK = "fieldMask"; public static final String PARAMETER_FIELDMASK = "fieldMask";
public static final String PARAMETER_SKIPERROR = "skipError"; public static final String PARAMETER_SKIPERROR = "skipError";
public static final String PARAMETER_SEPARATOR = "separator"; public static final String PARAMETER_SEPARATOR = "separator";
public static final String PARAMETER_VIEW_COLUMNS ="useView";
public static final String PARAMETER_COLUMNS = "columns"; public static final String PARAMETER_COLUMNS = "columns";
public static final String PARAMETER_URL = "url"; public static final String PARAMETER_URL = "url";

View File

@ -9,13 +9,10 @@ import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.destination.Destination; import org.gcube.portlets.user.td.gwtservice.shared.destination.Destination;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
/** /**
* *
* @author "Giancarlo Panichi" * @author giancarlo email: <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class CSVExportSession implements Serializable { public class CSVExportSession implements Serializable {
@ -30,27 +27,32 @@ public class CSVExportSession implements Serializable {
protected ArrayList<ColumnData> columns; protected ArrayList<ColumnData> columns;
protected String encoding; protected String encoding;
protected String separator; protected String separator;
protected boolean exportViewColumns;
public CSVExportSession() {
super();
}
public ArrayList<ColumnData> getColumns() { public ArrayList<ColumnData> getColumns() {
return columns; return columns;
} }
public void setColumns(ArrayList<ColumnData> columns) { public void setColumns(ArrayList<ColumnData> columns) {
this.columns = columns; this.columns = columns;
} }
public ArrayList<String> getColumnsAsString(){ public ArrayList<String> getColumnsAsString() {
ArrayList<String> columnsAsString=new ArrayList<String>(); ArrayList<String> columnsAsString = new ArrayList<String>();
for(ColumnData cData: columns){ for (ColumnData cData : columns) {
columnsAsString.add(cData.getName()); columnsAsString.add(cData.getColumnId());
} }
return columnsAsString; return columnsAsString;
} }
public String[] getColumnsAsArrayOfString(){ public String[] getColumnsAsArrayOfString() {
ArrayList<String> columnsAsString=new ArrayList<String>(); ArrayList<String> columnsAsString = new ArrayList<String>();
for(ColumnData cData: columns){ for (ColumnData cData : columns) {
columnsAsString.add(cData.getName()); columnsAsString.add(cData.getColumnId());
} }
return columnsAsString.toArray(new String[columnsAsString.size()]); return columnsAsString.toArray(new String[columnsAsString.size()]);
} }
@ -58,61 +60,74 @@ public class CSVExportSession implements Serializable {
public String getEncoding() { public String getEncoding() {
return encoding; return encoding;
} }
public void setEncoding(String encoding) { public void setEncoding(String encoding) {
this.encoding = encoding; this.encoding = encoding;
} }
public String getSeparator() { public String getSeparator() {
return separator; return separator;
} }
public void setSeparator(String separator) { public void setSeparator(String separator) {
this.separator = separator; this.separator = separator;
} }
public String getId() { public String getId() {
return id; return id;
} }
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
public Destination getDestination() { public Destination getDestination() {
return destination; return destination;
} }
public void setDestination(Destination destination) { public void setDestination(Destination destination) {
this.destination = destination; this.destination = destination;
} }
public String getItemId() { public String getItemId() {
return itemId; return itemId;
} }
public void setItemId(String itemId) { public void setItemId(String itemId) {
this.itemId = itemId; this.itemId = itemId;
} }
public String getFileName() { public String getFileName() {
return fileName; return fileName;
} }
public void setFileName(String fileName) { public void setFileName(String fileName) {
this.fileName = fileName; this.fileName = fileName;
} }
public String getFileDescription() { public String getFileDescription() {
return fileDescription; return fileDescription;
} }
public void setFileDescription(String fileDescription) { public void setFileDescription(String fileDescription) {
this.fileDescription = fileDescription; this.fileDescription = fileDescription;
} }
public boolean isExportViewColumns() {
return exportViewColumns;
}
public void setExportViewColumns(boolean exportViewColumns) {
this.exportViewColumns = exportViewColumns;
}
@Override @Override
public String toString() { public String toString() {
return "CSVExportSession [id=" + id + ", destination=" + destination return "CSVExportSession [id=" + id + ", destination=" + destination
+ ", itemId=" + itemId + ", fileName=" + fileName + ", itemId=" + itemId + ", fileName=" + fileName
+ ", fileDescription=" + fileDescription + ", columns=" + ", fileDescription=" + fileDescription + ", columns="
+ columns + ", encoding=" + encoding + ", separator=" + columns + ", encoding=" + encoding + ", separator="
+ separator + "]"; + separator + ", exportViewColumns=" + exportViewColumns + "]";
} }
} }

View File

@ -1,4 +1,9 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="${groupId}.${artifactId}.2-4-0"
date="Next">
<Change>Updated Discard</Change>
<Change>Updated CSVExportSession</Change>
</Changeset>
<Changeset component="${groupId}.${artifactId}.2-4-0" <Changeset component="${groupId}.${artifactId}.2-4-0"
date="2014-09-12"> date="2014-09-12">
<Change>Added union</Change> <Change>Added union</Change>