Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94872 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8d2b4a0b77
commit
fe4880c51b
|
@ -15,6 +15,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.HeaderPresence;
|
||||
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.history.RollBackSessionMonitor;
|
||||
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;
|
||||
|
@ -223,7 +225,27 @@ public interface TDGWTService extends RemoteService {
|
|||
*/
|
||||
public ArrayList<ColumnData> getValidationColumns(TRId trId,
|
||||
String columnName) throws TDGWTServiceException;
|
||||
|
||||
|
||||
//RollBack
|
||||
/**
|
||||
* Call rollback on tabular resource
|
||||
*
|
||||
* @param rollBackSession
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public void rollBack(RollBackSession rollBackSession)
|
||||
throws TDGWTServiceException;
|
||||
|
||||
/**
|
||||
* Get Operation Monitor during the rollback
|
||||
*
|
||||
* @return
|
||||
* @throws TDGWTServiceException
|
||||
*/
|
||||
public RollBackSessionMonitor getRollBackMonitor()
|
||||
throws TDGWTServiceException;
|
||||
|
||||
|
||||
// Share
|
||||
/**
|
||||
* Retrieves information sharing on the tabular resource
|
||||
|
|
|
@ -14,6 +14,8 @@ 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.history.RollBackSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSessionMonitor;
|
||||
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;
|
||||
|
@ -98,6 +100,10 @@ public interface TDGWTServiceAsync {
|
|||
void getColumn(String columnLocalId,TRId trId, AsyncCallback<ColumnData> callback);
|
||||
void getValidationColumns(TRId trId, String columnName, AsyncCallback<ArrayList<ColumnData>> callback);
|
||||
|
||||
//RollBack
|
||||
void rollBack(RollBackSession rollBackSession,AsyncCallback<Void> callback);
|
||||
void getRollBackMonitor(AsyncCallback<RollBackSessionMonitor> callback);
|
||||
|
||||
//Share
|
||||
void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback);
|
||||
|
||||
|
|
|
@ -1327,7 +1327,7 @@ public class SessionUtil {
|
|||
return monitor;
|
||||
}
|
||||
|
||||
public static void setRollBackTask(HttpSession httpSession, Task task) {
|
||||
public static void setRollBackSessionTask(HttpSession httpSession, Task task) {
|
||||
Task monitor = (Task) httpSession.getAttribute(ROLLBACK_TASK);
|
||||
if (monitor != null)
|
||||
httpSession.removeAttribute(ROLLBACK_TASK);
|
||||
|
|
|
@ -114,6 +114,7 @@ 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.history.OpHistory;
|
||||
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.SDMXExportMonitor;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
||||
|
@ -5944,7 +5945,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void rollBack(RollBackSession rollBackSession)
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
|
@ -5967,7 +5968,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
throw new TDGWTServiceException("Task not started");
|
||||
}
|
||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||
SessionUtil.setRollBackTask(session, trTask);
|
||||
SessionUtil.setRollBackSessionTask(session, trTask);
|
||||
return;
|
||||
|
||||
} catch (Throwable e) {
|
||||
|
@ -5982,87 +5983,84 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
||||
*/
|
||||
@Override
|
||||
public ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor()
|
||||
public RollBackSessionMonitor getRollBackMonitor()
|
||||
throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
ReplaceBatchColumnSession replaceBatchColumnSession = SessionUtil
|
||||
.getReplaceBatchColumnSession(session);
|
||||
RollBackSession rollBackSession = SessionUtil
|
||||
.getRollBackSession(session);
|
||||
|
||||
Task task = SessionUtil.getReplaceBatchColumnTask(session);
|
||||
ReplaceBatchColumnMonitor replaceBatchColumnMonitor = new ReplaceBatchColumnMonitor();
|
||||
Task task = SessionUtil.getRollBackSessionTask(session);
|
||||
RollBackSessionMonitor rollBackMonitor = new RollBackSessionMonitor();
|
||||
|
||||
if (task == null) {
|
||||
logger.debug("Task null");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in ReplaceBatchColumnMonitor task null");
|
||||
"Error in RollBackMonitor task null");
|
||||
} else {
|
||||
TaskStatus status = task.getStatus();
|
||||
if (status == null) {
|
||||
logger.debug("Services TaskStatus : null");
|
||||
throw new TDGWTServiceException(
|
||||
"Error in ReplaceBatchColumnMonitor Status null");
|
||||
"Error in RollBackSessionMonitor Status null");
|
||||
} else {
|
||||
logger.debug("Services TaskStatus: " + task.getStatus());
|
||||
|
||||
replaceBatchColumnMonitor.setStatus(TaskStateMap.map(task
|
||||
rollBackMonitor.setStatus(TaskStateMap.map(task
|
||||
.getStatus()));
|
||||
|
||||
TRId trId;
|
||||
TabResource tabResource;
|
||||
switch (replaceBatchColumnMonitor.getStatus()) {
|
||||
switch (rollBackMonitor.getStatus()) {
|
||||
case FAILED:
|
||||
if (task.getResult() != null) {
|
||||
logger.debug("Task exception:"
|
||||
+ task.getErrorCause());
|
||||
replaceBatchColumnMonitor.setError(new Throwable(
|
||||
rollBackMonitor.setError(new Throwable(
|
||||
task.getErrorCause()));
|
||||
} else {
|
||||
logger.debug("Task exception: Error In ReplaceBatchColumnMonitor");
|
||||
replaceBatchColumnMonitor.setError(new Throwable(
|
||||
"Error replacing the Column value"));
|
||||
logger.debug("Task exception: Error In RollBackSessionMonitor");
|
||||
rollBackMonitor.setError(new Throwable(
|
||||
"Error in roll back"));
|
||||
}
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
rollBackMonitor.setProgress(task
|
||||
.getProgress());
|
||||
break;
|
||||
case SUCCEDED:
|
||||
logger.debug("Task Result:" + task.getResult());
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
rollBackMonitor.setProgress(task
|
||||
.getProgress());
|
||||
trId = new TRId();
|
||||
trId.setId(replaceBatchColumnSession.getTrId().getId());
|
||||
trId.setId(rollBackSession.getTrId().getId());
|
||||
|
||||
trId = retrieveTabularResourceBasicData(trId);
|
||||
|
||||
replaceBatchColumnMonitor.setTrId(trId);
|
||||
rollBackMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getTabResource(session);
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
SessionUtil.setTRId(session, trId);
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
rollBackMonitor.setProgress(task
|
||||
.getProgress());
|
||||
break;
|
||||
case VALIDATING_RULES:
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
rollBackMonitor.setProgress(task
|
||||
.getProgress());
|
||||
break;
|
||||
case ABORTED:
|
||||
break;
|
||||
case STOPPED:
|
||||
logger.debug("Task Result:" + task.getResult());
|
||||
replaceBatchColumnMonitor.setProgress(task
|
||||
rollBackMonitor.setProgress(task
|
||||
.getProgress());
|
||||
trId = new TRId();
|
||||
trId.setId(replaceBatchColumnSession.getColumnData()
|
||||
.getTrId().getId());
|
||||
|
||||
trId = retrieveTabularResourceBasicData(rollBackSession.getTrId());
|
||||
|
||||
trId = retrieveTabularResourceBasicData(trId);
|
||||
|
||||
replaceBatchColumnMonitor.setTrId(trId);
|
||||
rollBackMonitor.setTrId(trId);
|
||||
tabResource = SessionUtil.getTabResource(session);
|
||||
tabResource.setTrId(trId);
|
||||
SessionUtil.setTabResource(session, tabResource);
|
||||
|
@ -6074,22 +6072,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
break;
|
||||
}
|
||||
}
|
||||
SessionUtil.setReplaceBatchColumnTask(session, task);
|
||||
SessionUtil.setRollBackSessionTask(session, task);
|
||||
}
|
||||
|
||||
logger.info("ReplaceBatchColumnMonitor(): "
|
||||
+ replaceBatchColumnMonitor);
|
||||
return replaceBatchColumnMonitor;
|
||||
logger.info("RollBackSessionMonitor(): "
|
||||
+ rollBackMonitor);
|
||||
return rollBackMonitor;
|
||||
} catch (Throwable e) {
|
||||
logger.debug("Error in ReplaceBatchColumnMonitor: "
|
||||
logger.debug("Error in RollBackSessionMonitor: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException("Error in replace batch: "
|
||||
throw new TDGWTServiceException("Error in rollback: "
|
||||
+ e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue