Updated discard

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@100336 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-10-01 16:31:18 +00:00
parent 2f52c38946
commit 8bf48d4298
1 changed files with 47 additions and 11 deletions

View File

@ -258,6 +258,9 @@ 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");
/**
*
@ -4011,7 +4014,11 @@ 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()));
Task trTask = service.execute(invocation, serviceTR);
logger.debug("Start Replace returned task:"+sdfPerformance.format(new Date()));
logger.debug("Replace Column by Expression on service: TaskId "
+ trTask.getId());
@ -4335,12 +4342,12 @@ 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());
@ -4361,7 +4368,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);
@ -4385,15 +4392,16 @@ 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;
@ -5314,14 +5322,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("discard(): " + trId);
logger.debug("StartDiscard: " + trId);
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService();
checkTabularResourceLocked(service, trId);
checkTabularResourceIsFinal(service, trId);
TabularResourceId tabularResourceId = new TabularResourceId(
Long.valueOf(trId.getId()));
TabularResource tabularResource = service
@ -5343,9 +5351,35 @@ 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);
taskId = startRollBack(rollBackSession);
logger.debug("Start Discard:"+sdfPerformance.format(new Date()));
//
logger.debug("rollBack(): " + 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()));
if (trTask == null) {
logger.error("Error on service Task null");
throw new TDGWTServiceException("Task not started");
}
logger.debug("Start Task on service: " + trTask.getId());
TaskWrapper taskWrapper = new TaskWrapper(trTask,
UIOperationsId.RollBack, rollBackSession.getTrId());
SessionUtil.setStartedTask(session, taskWrapper);
taskId=trTask.getId().getValue();
//
logger.debug("Start Discard returned task:"+sdfPerformance.format(new Date()));
} else {
logger.debug("Discard : step null");
}
@ -5397,8 +5431,10 @@ 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()));
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");
@ -6461,7 +6497,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TaskWrapper taskWrapper = SessionUtil.getStartedTask(session,
operationMonitorSession.getTaskId());
logger.debug("Start Monitor Time:"+sdfPerformance.format(new Date()));
OperationMonitorCreator operationMonitorCreator = new OperationMonitorCreator(
session, aslSession, taskWrapper, operationMonitorSession);
OperationMonitor operationMonitor = operationMonitorCreator