Fixed Resume on Multi Validations

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@98742 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-17 11:03:18 +00:00
parent 130c25dd8a
commit c36e180c22
2 changed files with 77 additions and 39 deletions

View File

@ -6604,8 +6604,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
InvocationS invocationS = null; InvocationS invocationS = null;
if (job.getInvocation() != null) { if (job.getInvocation() != null) {
OperationExecution operationExecution = job
.getInvocation();
HashMap<String, Object> mapSent = new HashMap<String, Object>(); HashMap<String, Object> mapSent = new HashMap<String, Object>();
Map<String, Object> map = job.getInvocation() Map<String, Object> map = operationExecution
.getParameters(); .getParameters();
Set<String> keys = map.keySet(); Set<String> keys = map.keySet();
Iterator<String> iterator = keys.iterator(); Iterator<String> iterator = keys.iterator();
@ -6615,14 +6617,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
mapSent.put(key, o.toString()); mapSent.put(key, o.toString());
} }
RefColumn refColumn = ExtractReferences.extract(job RefColumn refColumn = ExtractReferences
.getInvocation()); .extract(operationExecution);
invocationS = new InvocationS(job.getInvocation() invocationS = new InvocationS(j,
.getColumnId(), job.getInvocation() operationExecution.getColumnId(),
.getIdentifier(), job.getInvocation() operationExecution.getIdentifier(),
.getOperationId(), mapSent, task.getId() operationExecution.getOperationId(), mapSent,
.getValue(), refColumn); task.getId().getValue(), refColumn);
} }
JobS jobS = new JobS(String.valueOf(j), job.getProgress(), JobS jobS = new JobS(String.valueOf(j), job.getProgress(),
job.getHumaReadableStatus(), job.getDescription(), job.getHumaReadableStatus(), job.getDescription(),
@ -7055,36 +7057,60 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
} }
/*
InvocationS invocationS = taskResumeSession.getInvocationS(); InvocationS invocationS = taskResumeSession.getInvocationS();
if (invocationS != null) { if (invocationS != null) {
HashMap<String, Object> mapParameters = invocationS if (invocationS.getJobNumber() != null) {
.getParameters(); if (invocationS.getTaskId() != null) {
Integer jobNumber = invocationS.getJobNumber();
TaskId previousTaskId = new TaskId(
invocationS.getTaskId());
Task previousTask = service.getTask(previousTaskId);
List<Job> previousJobs = previousTask.getTaskJobs();
if (previousJobs != null) {
Job previousJob = previousJobs
.get(jobNumber - 1);
if (previousJob != null) {
Map<String,Object> mapParameters=previousJob.getInvocation().getParameters();
if (mapParameters != null) { if (mapParameters != null) {
logger.debug("Map Class: "+mapParameters
.get(Constants.PARAMETER_COLUMN_MAPPING).getClass());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<TDTypeValue, Long> mappingPrevious = (Map<TDTypeValue, Long>) mapParameters Map<TDTypeValue, Long> mappingPrevious = (Map<TDTypeValue, Long>) mapParameters
.get(Constants.PARAMETER_COLUMN_MAPPING); .get(Constants.PARAMETER_COLUMN_MAPPING);
logger.debug("Previous Mapping"); logger.debug("Previous Mapping");
if (mappingPrevious != null) { if (mappingPrevious != null) {
for (TDTypeValue key : mappingPrevious.keySet()) { for (TDTypeValue key : mappingPrevious
logger.debug("Key = " + key + " - " .keySet()) {
+ mappingPrevious.get(key)); logger.debug("Key = "
mapping.put(key, mappingPrevious.get(key)); + key
+ " - "
+ mappingPrevious
.get(key));
mapping.put(key,
mappingPrevious
.get(key));
} }
} else { } else {
logger.debug("Previous Mapping is null"); logger.debug("Previous Mapping is null");
} }
} else { } else {
logger.debug("Parameters is null"); logger.debug("Parameters is null");
} }
} else {
logger.debug("PreviousJob is null");
}
} else {
logger.debug("PreviousJobs is null");
}
} else {
logger.debug("TaskId is null");
}
} else {
logger.debug("JobNumber is null");
}
} else { } else {
logger.debug("InvocationS is null"); logger.debug("InvocationS is null");
} }
*/
map.put(Constants.PARAMETER_COLUMN_MAPPING, mapping); map.put(Constants.PARAMETER_COLUMN_MAPPING, mapping);
trTask = service.resume(taskId, map); trTask = service.resume(taskId, map);

View File

@ -14,6 +14,7 @@ public class InvocationS implements Serializable {
private static final long serialVersionUID = -7112348181058962879L; private static final long serialVersionUID = -7112348181058962879L;
protected Integer jobNumber;//Internal job number from 1 to n
protected String columnId; protected String columnId;
protected long operationId; protected long operationId;
protected Long identifier; protected Long identifier;
@ -26,8 +27,9 @@ public class InvocationS implements Serializable {
} }
public InvocationS(String columnId, long operationId, Long identifier, public InvocationS(Integer jobNumber, String columnId, long operationId, Long identifier,
HashMap<String, Object> parameters, String taskId, RefColumn refColumn) { HashMap<String, Object> parameters, String taskId, RefColumn refColumn) {
this.jobNumber=jobNumber;
this.columnId = columnId; this.columnId = columnId;
this.operationId = operationId; this.operationId = operationId;
this.identifier = identifier; this.identifier = identifier;
@ -84,15 +86,25 @@ public class InvocationS implements Serializable {
this.taskId = taskId; this.taskId = taskId;
} }
public Integer getJobNumber() {
return jobNumber;
}
public void setJobNumber(Integer jobNumber) {
this.jobNumber = jobNumber;
}
@Override @Override
public String toString() { public String toString() {
return "InvocationS [columnId=" + columnId + ", operationId=" return "InvocationS [jobNumber=" + jobNumber + ", columnId=" + columnId
+ operationId + ", identifier=" + identifier + ", parameters=" + ", operationId=" + operationId + ", identifier=" + identifier
+ parameters + ", taskId=" + taskId + ", refColumn=" + ", parameters=" + parameters + ", taskId=" + taskId
+ refColumn + "]"; + ", refColumn=" + refColumn + "]";
} }
} }