Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94288 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-04 08:27:24 +00:00
parent b0cbe6e72b
commit a99fc93d5d
2 changed files with 117 additions and 6 deletions

View File

@ -3358,9 +3358,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
capabilities);
Expression condition = ExpressionGenerator
.genReplaceValueParameterCondition(replaceBatchColumnSession,re);
.genReplaceValueParameterCondition(
replaceBatchColumnSession, re);
Expression value = ExpressionGenerator
.genReplaceBatchValueParameterValue(replaceBatchColumnSession,re);
.genReplaceBatchValueParameterValue(
replaceBatchColumnSession, re);
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
condition);
@ -3380,9 +3382,11 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
capabilities);
Expression condition = ExpressionGenerator
.genReplaceValueParameterCondition(replaceBatchColumnSession,re);
.genReplaceValueParameterCondition(
replaceBatchColumnSession, re);
Expression value = ExpressionGenerator
.genReplaceBatchValueParameterValue(replaceBatchColumnSession,re);
.genReplaceBatchValueParameterValue(
replaceBatchColumnSession, re);
map.put(Constants.PARAMETER_REPLACE_BY_EXPRESSION_COLUMN_CONDITION,
condition);
@ -5169,8 +5173,104 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
@Override
public ReplaceBatchColumnMonitor getReplaceBatchColumnMonitor()
throws TDGWTServiceException {
// TODO Auto-generated method stub
return null;
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());
}
}
}

View File

@ -21,6 +21,17 @@ public class ReplaceBatchColumnSession implements Serializable {
protected ArrayList<ReplaceEntry> replaceEntryList;
protected boolean replaceDimension;
public ReplaceBatchColumnSession() {
}
public ReplaceBatchColumnSession(TRId trId, ColumnData columnData,
ArrayList<ReplaceEntry> replaceEntryList, boolean replaceDimension) {
this.trId = trId;
this.columnData = columnData;
this.replaceEntryList = replaceEntryList;
this.replaceDimension = replaceDimension;
}
public TRId getTrId() {
return trId;
}