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.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
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.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.SDMXExportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
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,
|
public ArrayList<ColumnData> getValidationColumns(TRId trId,
|
||||||
String columnName) throws TDGWTServiceException;
|
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
|
// Share
|
||||||
/**
|
/**
|
||||||
* Retrieves information sharing on the tabular resource
|
* 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.FileUploadMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
|
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.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.SDMXExportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
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 getColumn(String columnLocalId,TRId trId, AsyncCallback<ColumnData> callback);
|
||||||
void getValidationColumns(TRId trId, String columnName, AsyncCallback<ArrayList<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
|
//Share
|
||||||
void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback);
|
void getShareInfo(TRId trId, AsyncCallback<ShareInfo> callback);
|
||||||
|
|
||||||
|
|
|
@ -1327,7 +1327,7 @@ public class SessionUtil {
|
||||||
return monitor;
|
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);
|
Task monitor = (Task) httpSession.getAttribute(ROLLBACK_TASK);
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
httpSession.removeAttribute(ROLLBACK_TASK);
|
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.file.HeaderPresence;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
|
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.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.SDMXExportMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
|
||||||
|
@ -5944,7 +5945,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void rollBack(RollBackSession rollBackSession)
|
public void rollBack(RollBackSession rollBackSession)
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
|
@ -5967,7 +5968,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
throw new TDGWTServiceException("Task not started");
|
throw new TDGWTServiceException("Task not started");
|
||||||
}
|
}
|
||||||
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
logger.debug("Start Task on service: TaskId " + trTask.getId());
|
||||||
SessionUtil.setRollBackTask(session, trTask);
|
SessionUtil.setRollBackSessionTask(session, trTask);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -5982,87 +5983,84 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor()
|
public RollBackSessionMonitor getRollBackMonitor()
|
||||||
throws TDGWTServiceException {
|
throws TDGWTServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ReplaceBatchColumnSession replaceBatchColumnSession = SessionUtil
|
RollBackSession rollBackSession = SessionUtil
|
||||||
.getReplaceBatchColumnSession(session);
|
.getRollBackSession(session);
|
||||||
|
|
||||||
Task task = SessionUtil.getReplaceBatchColumnTask(session);
|
Task task = SessionUtil.getRollBackSessionTask(session);
|
||||||
ReplaceBatchColumnMonitor replaceBatchColumnMonitor = new ReplaceBatchColumnMonitor();
|
RollBackSessionMonitor rollBackMonitor = new RollBackSessionMonitor();
|
||||||
|
|
||||||
if (task == null) {
|
if (task == null) {
|
||||||
logger.debug("Task null");
|
logger.debug("Task null");
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
"Error in ReplaceBatchColumnMonitor task null");
|
"Error in RollBackMonitor task null");
|
||||||
} else {
|
} else {
|
||||||
TaskStatus status = task.getStatus();
|
TaskStatus status = task.getStatus();
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
logger.debug("Services TaskStatus : null");
|
logger.debug("Services TaskStatus : null");
|
||||||
throw new TDGWTServiceException(
|
throw new TDGWTServiceException(
|
||||||
"Error in ReplaceBatchColumnMonitor Status null");
|
"Error in RollBackSessionMonitor Status null");
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Services TaskStatus: " + task.getStatus());
|
logger.debug("Services TaskStatus: " + task.getStatus());
|
||||||
|
|
||||||
replaceBatchColumnMonitor.setStatus(TaskStateMap.map(task
|
rollBackMonitor.setStatus(TaskStateMap.map(task
|
||||||
.getStatus()));
|
.getStatus()));
|
||||||
|
|
||||||
TRId trId;
|
TRId trId;
|
||||||
TabResource tabResource;
|
TabResource tabResource;
|
||||||
switch (replaceBatchColumnMonitor.getStatus()) {
|
switch (rollBackMonitor.getStatus()) {
|
||||||
case FAILED:
|
case FAILED:
|
||||||
if (task.getResult() != null) {
|
if (task.getResult() != null) {
|
||||||
logger.debug("Task exception:"
|
logger.debug("Task exception:"
|
||||||
+ task.getErrorCause());
|
+ task.getErrorCause());
|
||||||
replaceBatchColumnMonitor.setError(new Throwable(
|
rollBackMonitor.setError(new Throwable(
|
||||||
task.getErrorCause()));
|
task.getErrorCause()));
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Task exception: Error In ReplaceBatchColumnMonitor");
|
logger.debug("Task exception: Error In RollBackSessionMonitor");
|
||||||
replaceBatchColumnMonitor.setError(new Throwable(
|
rollBackMonitor.setError(new Throwable(
|
||||||
"Error replacing the Column value"));
|
"Error in roll back"));
|
||||||
}
|
}
|
||||||
replaceBatchColumnMonitor.setProgress(task
|
rollBackMonitor.setProgress(task
|
||||||
.getProgress());
|
.getProgress());
|
||||||
break;
|
break;
|
||||||
case SUCCEDED:
|
case SUCCEDED:
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
replaceBatchColumnMonitor.setProgress(task
|
rollBackMonitor.setProgress(task
|
||||||
.getProgress());
|
.getProgress());
|
||||||
trId = new TRId();
|
trId = new TRId();
|
||||||
trId.setId(replaceBatchColumnSession.getTrId().getId());
|
trId.setId(rollBackSession.getTrId().getId());
|
||||||
|
|
||||||
trId = retrieveTabularResourceBasicData(trId);
|
trId = retrieveTabularResourceBasicData(trId);
|
||||||
|
|
||||||
replaceBatchColumnMonitor.setTrId(trId);
|
rollBackMonitor.setTrId(trId);
|
||||||
tabResource = SessionUtil.getTabResource(session);
|
tabResource = SessionUtil.getTabResource(session);
|
||||||
tabResource.setTrId(trId);
|
tabResource.setTrId(trId);
|
||||||
SessionUtil.setTabResource(session, tabResource);
|
SessionUtil.setTabResource(session, tabResource);
|
||||||
SessionUtil.setTRId(session, trId);
|
SessionUtil.setTRId(session, trId);
|
||||||
break;
|
break;
|
||||||
case IN_PROGRESS:
|
case IN_PROGRESS:
|
||||||
replaceBatchColumnMonitor.setProgress(task
|
rollBackMonitor.setProgress(task
|
||||||
.getProgress());
|
.getProgress());
|
||||||
break;
|
break;
|
||||||
case VALIDATING_RULES:
|
case VALIDATING_RULES:
|
||||||
replaceBatchColumnMonitor.setProgress(task
|
rollBackMonitor.setProgress(task
|
||||||
.getProgress());
|
.getProgress());
|
||||||
break;
|
break;
|
||||||
case ABORTED:
|
case ABORTED:
|
||||||
break;
|
break;
|
||||||
case STOPPED:
|
case STOPPED:
|
||||||
logger.debug("Task Result:" + task.getResult());
|
logger.debug("Task Result:" + task.getResult());
|
||||||
replaceBatchColumnMonitor.setProgress(task
|
rollBackMonitor.setProgress(task
|
||||||
.getProgress());
|
.getProgress());
|
||||||
trId = new TRId();
|
|
||||||
trId.setId(replaceBatchColumnSession.getColumnData()
|
trId = retrieveTabularResourceBasicData(rollBackSession.getTrId());
|
||||||
.getTrId().getId());
|
|
||||||
|
|
||||||
trId = retrieveTabularResourceBasicData(trId);
|
rollBackMonitor.setTrId(trId);
|
||||||
|
|
||||||
replaceBatchColumnMonitor.setTrId(trId);
|
|
||||||
tabResource = SessionUtil.getTabResource(session);
|
tabResource = SessionUtil.getTabResource(session);
|
||||||
tabResource.setTrId(trId);
|
tabResource.setTrId(trId);
|
||||||
SessionUtil.setTabResource(session, tabResource);
|
SessionUtil.setTabResource(session, tabResource);
|
||||||
|
@ -6074,22 +6072,22 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SessionUtil.setReplaceBatchColumnTask(session, task);
|
SessionUtil.setRollBackSessionTask(session, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("ReplaceBatchColumnMonitor(): "
|
logger.info("RollBackSessionMonitor(): "
|
||||||
+ replaceBatchColumnMonitor);
|
+ rollBackMonitor);
|
||||||
return replaceBatchColumnMonitor;
|
return rollBackMonitor;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("Error in ReplaceBatchColumnMonitor: "
|
logger.debug("Error in RollBackSessionMonitor: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new TDGWTServiceException("Error in replace batch: "
|
throw new TDGWTServiceException("Error in rollback: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue