Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94861 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b035abceb0
commit
8d2b4a0b77
|
@ -14,6 +14,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
||||
|
@ -89,6 +90,15 @@ public interface TDGWTService extends RemoteService {
|
|||
public String hello() throws TDGWTServiceException;
|
||||
|
||||
// TabularResource
|
||||
/**
|
||||
* Get current TRId
|
||||
*
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public TRId getCurrentTRId() throws TDGWTServiceException;
|
||||
|
||||
|
||||
/**
|
||||
* Get informations on the current tabular resource
|
||||
*
|
||||
|
@ -727,4 +737,39 @@ public interface TDGWTService extends RemoteService {
|
|||
* @throws TDGWTServiceException
|
||||
*/
|
||||
ArrayList<String> getLocales() throws TDGWTServiceException;
|
||||
|
||||
//History
|
||||
/**
|
||||
* Retrieve History
|
||||
*
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
ArrayList<OpHistory> getHistory() throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Retrieve History for specific tabular resource
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
ArrayList<OpHistory> getHistory(TRId trId) throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
OpHistory getLastOperationInfo() throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param trId
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
OpHistory getLastOperationInfo(TRId trId) throws TDGWTServiceException;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVRowError;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
||||
|
@ -74,6 +75,7 @@ public interface TDGWTServiceAsync {
|
|||
void hello(AsyncCallback<String> callback);
|
||||
|
||||
//TabularResource
|
||||
void getCurrentTRId(AsyncCallback<TRId> callback);
|
||||
void createTabularResource(TabResource tabResource,AsyncCallback<TabResource> callback);
|
||||
void removeTabularResource(TRId trId, AsyncCallback<Void> callback);
|
||||
void isTabularResourceValid(TRId trId,AsyncCallback<Boolean> callback);
|
||||
|
@ -195,4 +197,10 @@ public interface TDGWTServiceAsync {
|
|||
//Locales
|
||||
void getLocales(AsyncCallback<ArrayList<String>> callback);
|
||||
|
||||
//History
|
||||
void getHistory(AsyncCallback<ArrayList<OpHistory>> callback);
|
||||
void getHistory(TRId trId, AsyncCallback<ArrayList<OpHistory>> callback);
|
||||
void getLastOperationInfo(AsyncCallback<OpHistory> callback);
|
||||
void getLastOperationInfo(TRId trId, AsyncCallback<OpHistory> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import org.gcube.portlets.user.td.gwtservice.server.trservice.TRTasksManager;
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSessionMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
|
||||
|
@ -127,6 +129,12 @@ public class SessionUtil {
|
|||
protected static final String CODELISTS_PAGING_LOADED_FILTERED_COPY = "CODELISTS_PAGING_LOADED_FILTERED_COPY";
|
||||
protected static final String CODELISTS_PAGING_LOADED_FILTER = "CODELISTS_PAGING_LOADED_FILTER";
|
||||
|
||||
protected static final String ROLLBACK_SESSION = "ROLLBACK_SESSION";
|
||||
protected static final String ROLLBACK_MONITOR = "ROLLBACK_MONITOR";
|
||||
protected static final String ROLLBACK_TASK = "ROLLBACK_TASK";
|
||||
|
||||
|
||||
|
||||
protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
||||
|
||||
public static ASLSession getAslSession(HttpSession httpSession) {
|
||||
|
@ -1258,5 +1266,74 @@ public class SessionUtil {
|
|||
httpSession.removeAttribute(CODELISTS_PAGING_LOADED_FILTER);
|
||||
httpSession.setAttribute(CODELISTS_PAGING_LOADED_FILTER, filter);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
public static RollBackSession getRollBackSession(
|
||||
HttpSession httpSession) {
|
||||
RollBackSession rollBackSession = (RollBackSession) httpSession
|
||||
.getAttribute(ROLLBACK_SESSION);
|
||||
if (rollBackSession != null) {
|
||||
return rollBackSession;
|
||||
} else {
|
||||
rollBackSession = new RollBackSession();
|
||||
httpSession
|
||||
.setAttribute(ROLLBACK_SESSION, rollBackSession);
|
||||
return rollBackSession;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setRollBackSession(HttpSession httpSession,
|
||||
RollBackSession rollBackSession) {
|
||||
RollBackSession rb = (RollBackSession) httpSession
|
||||
.getAttribute(ROLLBACK_SESSION);
|
||||
if (rb != null) {
|
||||
httpSession.removeAttribute(ROLLBACK_SESSION);
|
||||
}
|
||||
httpSession.setAttribute(ROLLBACK_SESSION, rollBackSession);
|
||||
|
||||
}
|
||||
|
||||
public static RollBackSessionMonitor getRollBackSessionMonitor(
|
||||
HttpSession httpSession) {
|
||||
RollBackSessionMonitor rollBackMonitor = (RollBackSessionMonitor) httpSession
|
||||
.getAttribute(ROLLBACK_MONITOR);
|
||||
if (rollBackMonitor != null) {
|
||||
return rollBackMonitor;
|
||||
} else {
|
||||
rollBackMonitor = new RollBackSessionMonitor();
|
||||
httpSession
|
||||
.setAttribute(ROLLBACK_MONITOR, rollBackMonitor);
|
||||
return rollBackMonitor;
|
||||
}
|
||||
}
|
||||
|
||||
public static void setRollBackSessionMonitor(HttpSession httpSession,
|
||||
RollBackSessionMonitor rollBackMonitor) {
|
||||
RollBackSessionMonitor rb = (RollBackSessionMonitor) httpSession
|
||||
.getAttribute(ROLLBACK_MONITOR);
|
||||
if (rb != null) {
|
||||
httpSession.removeAttribute(ROLLBACK_MONITOR);
|
||||
}
|
||||
httpSession.setAttribute(ROLLBACK_MONITOR, rollBackMonitor);
|
||||
|
||||
}
|
||||
|
||||
public static Task getRollBackSessionTask(HttpSession httpSession) {
|
||||
Task monitor = (Task) httpSession.getAttribute(ROLLBACK_TASK);
|
||||
if (monitor == null) {
|
||||
logger.error("ROLLBACK_TASK was not acquired");
|
||||
}
|
||||
return monitor;
|
||||
}
|
||||
|
||||
public static void setRollBackTask(HttpSession httpSession, Task task) {
|
||||
Task monitor = (Task) httpSession.getAttribute(ROLLBACK_TASK);
|
||||
if (monitor != null)
|
||||
httpSession.removeAttribute(ROLLBACK_TASK);
|
||||
httpSession.setAttribute(ROLLBACK_TASK, task);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -77,6 +77,7 @@ import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTemplateExcep
|
|||
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
|
||||
import org.gcube.data.analysis.tabulardata.service.operation.Task;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStep;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStepId;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
|
||||
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.AgencyMetadata;
|
||||
|
@ -111,7 +112,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
|
|||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.operation.Operation;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
||||
|
@ -238,7 +240,42 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public TRId getCurrentTRId() throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
|
||||
TabResource currentTR = SessionUtil.getTabResource(session);
|
||||
if (currentTR == null) {
|
||||
logger.error("CURRENT_TABULAR_RESOURCE is null");
|
||||
throw new TDGWTServiceException(
|
||||
"CURRENT_TABULAR_RESOURCE is null");
|
||||
}
|
||||
logger.debug("GetTabResourceInformation():" + currentTR.toString());
|
||||
|
||||
if (currentTR.getTrId() == null) {
|
||||
logger.error("CURRENT_TABULAR_RESOURCE has TRId null");
|
||||
throw new TDGWTServiceException(
|
||||
"CURRENT_TABULAR_RESOURCE has TRId null");
|
||||
}
|
||||
|
||||
return currentTR.getTrId();
|
||||
} catch (Throwable e) {
|
||||
logger.error(
|
||||
"getCurrentTRID(): "
|
||||
+ e.getLocalizedMessage(), e);
|
||||
throw new TDGWTServiceException(
|
||||
"Error retrieving TR id: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -5703,14 +5740,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
/**
|
||||
*
|
||||
* OperationInfo
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public Operation getLastOperationInfo() throws TDGWTServiceException {
|
||||
@Override
|
||||
public OpHistory getLastOperationInfo() throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("getLastDiscardOperation()");
|
||||
logger.debug("getLastOperationInfo()");
|
||||
TabResource currentTR = SessionUtil.getTabResource(session);
|
||||
if (currentTR == null) {
|
||||
logger.error("CURRENT_TABULAR_RESOURCE is null");
|
||||
|
@ -5722,21 +5760,25 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
||||
List<HistoryStep> history =tabularResource.getHistory();
|
||||
OperationDefinition lastOp=null;
|
||||
long historyId=0;
|
||||
HistoryStep lastStep=null;
|
||||
if(history!=null && history.size()>0){
|
||||
HistoryStep lastStep=history.get(0);
|
||||
lastStep=history.get(0);
|
||||
historyId=lastStep.getId().getValue();
|
||||
|
||||
if(lastStep!=null){
|
||||
lastOp=service.getCapability(lastStep.getOperationInvocation().getOperationId());
|
||||
}
|
||||
|
||||
}
|
||||
Operation op=null;
|
||||
OpHistory op=null;
|
||||
if(lastOp!=null){
|
||||
op=new Operation(lastOp.getName(),lastOp.getDescription());
|
||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(),sdf.format(lastStep.getExecutionDate()));
|
||||
}
|
||||
logger.debug("Last Operation Info :" + op);
|
||||
return op;
|
||||
|
@ -5750,5 +5792,304 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public OpHistory getLastOperationInfo(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("getLastOperationInfo: "+trId);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
||||
List<HistoryStep> history =tabularResource.getHistory();
|
||||
OperationDefinition lastOp=null;
|
||||
long historyId=0;
|
||||
HistoryStep lastStep=null;
|
||||
if(history!=null && history.size()>0){
|
||||
lastStep=history.get(0);
|
||||
historyId=lastStep.getId().getValue();
|
||||
if(lastStep!=null){
|
||||
lastOp=service.getCapability(lastStep.getOperationInvocation().getOperationId());
|
||||
}
|
||||
|
||||
}
|
||||
OpHistory op=null;
|
||||
if(lastOp!=null){
|
||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(),sdf.format(lastStep.getExecutionDate()));
|
||||
}
|
||||
logger.debug("Last Operation Info :" + op);
|
||||
return op;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error retrieving last operation info: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<OpHistory> getHistory() throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("getHistory()");
|
||||
TabResource currentTR = SessionUtil.getTabResource(session);
|
||||
if (currentTR == null) {
|
||||
logger.error("CURRENT_TABULAR_RESOURCE is null");
|
||||
throw new TDGWTServiceException(
|
||||
"CURRENT_TABULAR_RESOURCE is null");
|
||||
}
|
||||
TRId trId = currentTR.getTrId();
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
||||
List<HistoryStep> history =tabularResource.getHistory();
|
||||
|
||||
ArrayList<OpHistory> opHistoryList=new ArrayList<OpHistory>();
|
||||
OperationDefinition lastOp=null;
|
||||
long historyId=0;
|
||||
OpHistory op=null;
|
||||
|
||||
for(HistoryStep step:history){
|
||||
if(step!=null){
|
||||
historyId=step.getId().getValue();
|
||||
lastOp=service.getCapability(step.getOperationInvocation().getOperationId());
|
||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(), sdf.format(step.getExecutionDate()));
|
||||
opHistoryList.add(op);
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("History :" + opHistoryList);
|
||||
return opHistoryList;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.debug("getHistory(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error retrieving history: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<OpHistory> getHistory(TRId trId)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("getHistory(): "+trId);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
|
||||
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
|
||||
List<HistoryStep> history =tabularResource.getHistory();
|
||||
|
||||
ArrayList<OpHistory> opHistoryList=new ArrayList<OpHistory>();
|
||||
OperationDefinition lastOp=null;
|
||||
long historyId=0;
|
||||
OpHistory op=null;
|
||||
|
||||
for(HistoryStep step:history){
|
||||
if(step!=null){
|
||||
historyId=step.getId().getValue();
|
||||
lastOp=service.getCapability(step.getOperationInvocation().getOperationId());
|
||||
op=new OpHistory(historyId,lastOp.getName(),lastOp.getDescription(), sdf.format(step.getExecutionDate()));
|
||||
opHistoryList.add(op);
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("History :" + opHistoryList);
|
||||
return opHistoryList;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.debug("getHistory(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error retrieving history: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
public void rollBack(RollBackSession rollBackSession)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||
|
||||
logger.debug("rollBack(): "+rollBackSession);
|
||||
SessionUtil.setRollBackSession(session, rollBackSession);
|
||||
|
||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||
aslSession.getUsername()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(rollBackSession.getTrId().getId()));
|
||||
HistoryStepId historyStepId=new HistoryStepId(rollBackSession.getHistoryId());
|
||||
|
||||
Task trTask=service.rollbackTo(tabularResourceId, historyStepId);
|
||||
if (trTask == null) {
|
||||
logger.error("Error on service Task null");
|
||||
throw new TDGWTServiceException("Task not started");
|
||||
}
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
SessionUtil.setRollBackTask(session, trTask);
|
||||
return;
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.debug("getHistory(): " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error retrieving history: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
||||
@Override
|
||||
public ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor()
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ReplaceBatchColumnSession replaceBatchColumnSession = SessionUtil
|
||||
.getReplaceBatchColumnSession(session);
|
||||
|
||||
Task task = SessionUtil.getReplaceBatchColumnTask(session);
|
||||
ReplaceBatchColumnMonitor replaceBatchColumnMonitor = new ReplaceBatchColumnMonitor();
|
||||
|
||||
if (task == null) {
|
||||
logger.debug("Task null");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in ReplaceBatchColumnMonitor task null");
|
||||
} else {
|
||||
TaskStatus status = task.getStatus();
|
||||
if (status == null) {
|
||||
logger.debug("Services TaskStatus : null");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in ReplaceBatchColumnMonitor Status null");
|
||||
} else {
|
||||
logger.debug("Services TaskStatus: " + task.getStatus());
|
||||
|
||||
replaceBatchColumnMonitor.setStatus(TaskStateMap.map(task
|
||||
.getStatus()));
|
||||
|
||||
TRId trId;
|
||||
TabResource tabResource;
|
||||
switch (replaceBatchColumnMonitor.getStatus()) {
|
||||
case FAILED:
|
||||
if (task.getResult() != null) {
|
||||
logger.debug("Task exception:"
|
||||
+ task.getErrorCause());
|
||||
replaceBatchColumnMonitor.setError(new Throwable(
|
||||
task.getErrorCause()));
|
||||
} else {
|
||||
logger.debug("Task exception: Error In ReplaceBatchColumnMonitor");
|
||||
replaceBatchColumnMonitor.setError(new Throwable(
|
||||
"Error replacing the Column value"));
|
||||
}
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
.getProgress());
|
||||
break;
|
||||
case SUCCEDED:
|
||||
logger.debug("Task Result:" + task.getResult());
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
.getProgress());
|
||||
trId = new TRId();
|
||||
trId.setId(replaceBatchColumnSession.getTrId().getId());
|
||||
|
||||
trId = retrieveTabularResourceBasicData(trId);
|
||||
|
||||
replaceBatchColumnMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getTabResource(session);
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
SessionUtil.setTRId(session, trId);
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
.getProgress());
|
||||
break;
|
||||
case VALIDATING_RULES:
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
.getProgress());
|
||||
break;
|
||||
case ABORTED:
|
||||
break;
|
||||
case STOPPED:
|
||||
logger.debug("Task Result:" + task.getResult());
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
.getProgress());
|
||||
trId = new TRId();
|
||||
trId.setId(replaceBatchColumnSession.getColumnData()
|
||||
.getTrId().getId());
|
||||
|
||||
trId = retrieveTabularResourceBasicData(trId);
|
||||
|
||||
replaceBatchColumnMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getTabResource(session);
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
SessionUtil.setTRId(session, trId);
|
||||
break;
|
||||
case INITIALIZING:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
SessionUtil.setReplaceBatchColumnTask(session, task);
|
||||
}
|
||||
|
||||
logger.info("ReplaceBatchColumnMonitor(): "
|
||||
+ replaceBatchColumnMonitor);
|
||||
return replaceBatchColumnMonitor;
|
||||
} catch (Throwable e) {
|
||||
logger.debug("Error in ReplaceBatchColumnMonitor: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error in replace batch: "
|
||||
+ e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.history;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* History step
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class OpHistory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7597236172277678816L;
|
||||
Long historyId;
|
||||
String name;
|
||||
String description;
|
||||
String date;
|
||||
|
||||
public OpHistory() {
|
||||
}
|
||||
|
||||
public OpHistory(Long historyId, String name, String description,
|
||||
String date) {
|
||||
this.historyId = historyId;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
|
||||
public Long getHistoryId() {
|
||||
return historyId;
|
||||
}
|
||||
|
||||
public void setHistoryId(Long historyId) {
|
||||
this.historyId = historyId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OpHistory [historyId=" + historyId + ", name=" + name
|
||||
+ ", description=" + description + ", date=" + date + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.history;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RollBackSession implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1896235499708614266L;
|
||||
|
||||
protected TRId trId;
|
||||
protected Long historyId;
|
||||
|
||||
public RollBackSession() {
|
||||
}
|
||||
|
||||
public RollBackSession(TRId trId, Long historyId) {
|
||||
this.trId = trId;
|
||||
this.historyId = historyId;
|
||||
}
|
||||
|
||||
public TRId getTrId() {
|
||||
return trId;
|
||||
}
|
||||
|
||||
public void setTrId(TRId trId) {
|
||||
this.trId = trId;
|
||||
}
|
||||
|
||||
public Long getHistoryId() {
|
||||
return historyId;
|
||||
}
|
||||
|
||||
public void setHistoryId(Long historyId) {
|
||||
this.historyId = historyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RollBackSession [trId=" + trId + ", historyId=" + historyId
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.gwtservice.shared.history;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.OperationMonitor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RollBackSessionMonitor extends OperationMonitor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4213157032725005579L;
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package org.gcube.portlets.user.td.gwtservice.shared.operation;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
*
|
||||
*/
|
||||
public class Operation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7597236172277678816L;
|
||||
String name;
|
||||
String description;
|
||||
|
||||
public Operation() {
|
||||
}
|
||||
|
||||
public Operation(String name, String description) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Operation [name=" + name + ", description=" + description + "]";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue