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:
parent
8bf48d4298
commit
bbb0a965af
|
@ -258,7 +258,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
protected static SimpleDateFormat sdfDate = new SimpleDateFormat(
|
||||
"yyyy-MM-dd");
|
||||
|
||||
|
||||
protected static SimpleDateFormat sdfPerformance = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
|
||||
|
@ -3429,6 +3429,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
exportSession.getEncoding());
|
||||
parameterInstances.put(Constants.PARAMETER_SEPARATOR,
|
||||
exportSession.getSeparator());
|
||||
parameterInstances.put(Constants.PARAMETER_VIEW_COLUMNS,
|
||||
exportSession.isExportViewColumns());
|
||||
parameterInstances.put(Constants.PARAMETER_COLUMNS,
|
||||
exportSession.getColumnsAsString());
|
||||
return parameterInstances;
|
||||
|
@ -3525,8 +3527,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
logger.error("Tabular Resource Is Locked");
|
||||
throw new TDGWTIsLockedException("Tabular Resource Is Locked");
|
||||
}
|
||||
} catch (TDGWTServiceException e){
|
||||
throw e;
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
|
@ -3554,8 +3556,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
logger.error("Tabular Resource Is Final");
|
||||
throw new TDGWTIsFinalException("Tabular Resource Is Final");
|
||||
}
|
||||
|
||||
} catch (TDGWTServiceException e){
|
||||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
} catch (SecurityException e) {
|
||||
throw e;
|
||||
|
@ -3683,7 +3685,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, trId);
|
||||
|
||||
|
||||
// Export CSV file
|
||||
OperationDefinition exportCSVFileOperation = OperationDefinitionMap
|
||||
|
@ -4014,11 +4015,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
TabularResourceId serviceTR = new TabularResourceId(id);
|
||||
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);
|
||||
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 "
|
||||
+ trTask.getId());
|
||||
|
||||
|
@ -4342,16 +4345,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
logger.debug("CloneTabularResourceSession: "
|
||||
+ cloneTabularResourceSession);
|
||||
|
||||
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service,
|
||||
cloneTabularResourceSession.getTrId());
|
||||
|
||||
|
||||
OpExecution4Clone opEx = new OpExecution4Clone(service,
|
||||
cloneTabularResourceSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
|
@ -4368,7 +4371,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
TabularResourceId serviceTRId = new TabularResourceId(id);
|
||||
TabularResource serviceTR = service.getTabularResource(serviceTRId);
|
||||
|
||||
|
||||
TabularResource cloneTR = service.createTabularResource();
|
||||
cloneTR.setAllMetadata(serviceTR.getAllMetadata());
|
||||
NameMetadata nameMetadata = cloneTR.getMetadata(NameMetadata.class);
|
||||
|
@ -4392,16 +4395,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
cloneTabularResourceSession.setTrIdClone(trIdClone);
|
||||
SessionUtil.setCloneTabularResourceSession(session,
|
||||
cloneTabularResourceSession);
|
||||
|
||||
|
||||
logger.debug("OperationInvocation: \n" + invocation.toString());
|
||||
Task trTask = service.execute(invocation, cloneTR.getId());
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
|
||||
|
||||
|
||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||
UIOperationsId.Clone, trIdClone);
|
||||
SessionUtil.setStartedTask(session, taskWrapper);
|
||||
|
||||
|
||||
return trTask.getId().getValue();
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
|
@ -4540,7 +4542,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
Long.valueOf(shareInfo.getTabResource().getTrId().getId()));
|
||||
|
||||
|
@ -5329,7 +5331,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, trId);
|
||||
checkTabularResourceIsFinal(service, trId);
|
||||
|
||||
|
||||
TabularResourceId tabularResourceId = new TabularResourceId(
|
||||
Long.valueOf(trId.getId()));
|
||||
TabularResource tabularResource = service
|
||||
|
@ -5351,20 +5353,25 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
op = new OpHistory(historyId, opName, opDesc,
|
||||
sdf.format(step.getExecutionDate().getTime()));
|
||||
logger.debug("Discard :" + op);
|
||||
|
||||
|
||||
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);
|
||||
SessionUtil.setRollBackSession(session, rollBackSession);
|
||||
|
||||
SessionUtil
|
||||
.setRollBackSession(session, rollBackSession);
|
||||
|
||||
HistoryStepId historyStepId = new HistoryStepId(
|
||||
rollBackSession.getHistoryId());
|
||||
logger.debug("Start RollBack task:"+sdfPerformance.format(new Date()));
|
||||
Task trTask = service.rollbackTo(tabularResourceId, historyStepId);
|
||||
logger.debug("Start RollBack returned task:"+sdfPerformance.format(new Date()));
|
||||
|
||||
logger.debug("Start RollBack task:"
|
||||
+ sdfPerformance.format(new Date()));
|
||||
Task trTask = service.rollbackTo(tabularResourceId,
|
||||
historyStepId);
|
||||
logger.debug("Start RollBack returned task:"
|
||||
+ sdfPerformance.format(new Date()));
|
||||
|
||||
if (trTask == null) {
|
||||
logger.error("Error on service Task null");
|
||||
throw new TDGWTServiceException("Task not started");
|
||||
|
@ -5372,14 +5379,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
logger.debug("Start Task on service: " + trTask.getId());
|
||||
|
||||
TaskWrapper taskWrapper = new TaskWrapper(trTask,
|
||||
UIOperationsId.RollBack, rollBackSession.getTrId());
|
||||
UIOperationsId.RollBack,
|
||||
rollBackSession.getTrId());
|
||||
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 {
|
||||
logger.debug("Discard : step null");
|
||||
}
|
||||
|
@ -5431,10 +5439,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
Long.valueOf(rollBackSession.getTrId().getId()));
|
||||
HistoryStepId historyStepId = new HistoryStepId(
|
||||
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);
|
||||
logger.debug("Start RollBack returned task:"+sdfPerformance.format(new Date()));
|
||||
|
||||
logger.debug("Start RollBack returned task:"
|
||||
+ sdfPerformance.format(new Date()));
|
||||
|
||||
if (trTask == null) {
|
||||
logger.error("Error on service Task null");
|
||||
throw new TDGWTServiceException("Task not started");
|
||||
|
@ -6233,7 +6243,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, codelistMappingSession.getTrId());
|
||||
checkTabularResourceIsFinal(service, codelistMappingSession.getTrId());
|
||||
|
||||
|
||||
OpExecution4CodelistMapping opEx = new OpExecution4CodelistMapping(
|
||||
service, codelistMappingSession, importUrl);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
|
@ -6274,7 +6284,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, groupBySession.getTrId());
|
||||
checkTabularResourceIsFinal(service, groupBySession.getTrId());
|
||||
|
||||
|
||||
OpExecution4GroupBy opEx = new OpExecution4GroupBy(service,
|
||||
groupBySession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
|
@ -6329,7 +6339,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, normalizationSession.getTrId());
|
||||
checkTabularResourceIsFinal(service, normalizationSession.getTrId());
|
||||
|
||||
|
||||
OpExecution4Normalization opEx = new OpExecution4Normalization(
|
||||
service, normalizationSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
|
@ -6389,8 +6399,9 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service,
|
||||
denormalizationSession.getTrId());
|
||||
checkTabularResourceIsFinal(service, denormalizationSession.getTrId());
|
||||
|
||||
checkTabularResourceIsFinal(service,
|
||||
denormalizationSession.getTrId());
|
||||
|
||||
OpExecution4Denormalization opEx = new OpExecution4Denormalization(
|
||||
service, denormalizationSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
|
@ -6446,7 +6457,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
checkTabularResourceLocked(service, unionSession.getTrId());
|
||||
checkTabularResourceIsFinal(service, unionSession.getTrId());
|
||||
|
||||
|
||||
OpExecution4Union opEx = new OpExecution4Union(service,
|
||||
unionSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
|
@ -6497,7 +6508,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
TaskWrapper taskWrapper = SessionUtil.getStartedTask(session,
|
||||
operationMonitorSession.getTaskId());
|
||||
logger.debug("Start Monitor Time:"+sdfPerformance.format(new Date()));
|
||||
logger.debug("Start Monitor Time:"
|
||||
+ sdfPerformance.format(new Date()));
|
||||
OperationMonitorCreator operationMonitorCreator = new OperationMonitorCreator(
|
||||
session, aslSession, taskWrapper, operationMonitorSession);
|
||||
OperationMonitor operationMonitor = operationMonitorCreator
|
||||
|
@ -6600,7 +6612,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
} catch (TDGWTServiceException e) {
|
||||
throw e;
|
||||
|
||||
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
|
|
|
@ -24,6 +24,7 @@ public class Constants {
|
|||
public static final String PARAMETER_FIELDMASK = "fieldMask";
|
||||
public static final String PARAMETER_SKIPERROR = "skipError";
|
||||
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_URL = "url";
|
||||
|
||||
|
|
|
@ -9,14 +9,11 @@ import java.util.ArrayList;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.destination.Destination;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CSVExportSession implements Serializable {
|
||||
|
||||
|
@ -30,89 +27,107 @@ public class CSVExportSession implements Serializable {
|
|||
protected ArrayList<ColumnData> columns;
|
||||
protected String encoding;
|
||||
protected String separator;
|
||||
|
||||
|
||||
protected boolean exportViewColumns;
|
||||
|
||||
public CSVExportSession() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ArrayList<ColumnData> getColumns() {
|
||||
return columns;
|
||||
}
|
||||
|
||||
public void setColumns(ArrayList<ColumnData> columns) {
|
||||
this.columns = columns;
|
||||
}
|
||||
|
||||
public ArrayList<String> getColumnsAsString(){
|
||||
ArrayList<String> columnsAsString=new ArrayList<String>();
|
||||
for(ColumnData cData: columns){
|
||||
columnsAsString.add(cData.getName());
|
||||
|
||||
public ArrayList<String> getColumnsAsString() {
|
||||
ArrayList<String> columnsAsString = new ArrayList<String>();
|
||||
for (ColumnData cData : columns) {
|
||||
columnsAsString.add(cData.getColumnId());
|
||||
}
|
||||
return columnsAsString;
|
||||
}
|
||||
|
||||
public String[] getColumnsAsArrayOfString(){
|
||||
ArrayList<String> columnsAsString=new ArrayList<String>();
|
||||
for(ColumnData cData: columns){
|
||||
columnsAsString.add(cData.getName());
|
||||
|
||||
public String[] getColumnsAsArrayOfString() {
|
||||
ArrayList<String> columnsAsString = new ArrayList<String>();
|
||||
for (ColumnData cData : columns) {
|
||||
columnsAsString.add(cData.getColumnId());
|
||||
}
|
||||
return columnsAsString.toArray(new String[columnsAsString.size()]);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Destination getDestination() {
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(Destination destination) {
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
public String getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(String itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getFileDescription() {
|
||||
return fileDescription;
|
||||
}
|
||||
|
||||
public void setFileDescription(String fileDescription) {
|
||||
this.fileDescription = fileDescription;
|
||||
}
|
||||
|
||||
public boolean isExportViewColumns() {
|
||||
return exportViewColumns;
|
||||
}
|
||||
|
||||
public void setExportViewColumns(boolean exportViewColumns) {
|
||||
this.exportViewColumns = exportViewColumns;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CSVExportSession [id=" + id + ", destination=" + destination
|
||||
+ ", itemId=" + itemId + ", fileName=" + fileName
|
||||
+ ", fileDescription=" + fileDescription + ", columns="
|
||||
+ columns + ", encoding=" + encoding + ", separator="
|
||||
+ separator + "]";
|
||||
+ separator + ", exportViewColumns=" + exportViewColumns + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
<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"
|
||||
date="2014-09-12">
|
||||
<Change>Added union</Change>
|
||||
|
|
Loading…
Reference in New Issue