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

@ -493,7 +493,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* Returns ArrayList<ColumnData> other than IdColumnType,
* Returns ArrayList<ColumnData> other than IdColumnType,
* ValidationColumnType and ViewColumn
*
* {@inheritDoc}
@ -522,7 +522,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<Column> cols = table.getColumns();
int i = 0;
for (Column c : cols) {
if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType) {
@ -4719,7 +4719,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
/**
* Returns only CodeColumnType, CodeNameColumnType,
* CodeDescriptionColumnType and AnnotationColumnType
* CodeDescriptionColumnType and AnnotationColumnType
*
* {@inheritDoc}
*/
@ -6604,8 +6604,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
InvocationS invocationS = null;
if (job.getInvocation() != null) {
OperationExecution operationExecution = job
.getInvocation();
HashMap<String, Object> mapSent = new HashMap<String, Object>();
Map<String, Object> map = job.getInvocation()
Map<String, Object> map = operationExecution
.getParameters();
Set<String> keys = map.keySet();
Iterator<String> iterator = keys.iterator();
@ -6615,14 +6617,14 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
mapSent.put(key, o.toString());
}
RefColumn refColumn = ExtractReferences.extract(job
.getInvocation());
RefColumn refColumn = ExtractReferences
.extract(operationExecution);
invocationS = new InvocationS(job.getInvocation()
.getColumnId(), job.getInvocation()
.getIdentifier(), job.getInvocation()
.getOperationId(), mapSent, task.getId()
.getValue(), refColumn);
invocationS = new InvocationS(j,
operationExecution.getColumnId(),
operationExecution.getIdentifier(),
operationExecution.getOperationId(), mapSent,
task.getId().getValue(), refColumn);
}
JobS jobS = new JobS(String.valueOf(j), job.getProgress(),
job.getHumaReadableStatus(), job.getDescription(),
@ -6805,7 +6807,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/**
*
*
@ -7055,37 +7057,61 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
}
/*
InvocationS invocationS = taskResumeSession.getInvocationS();
if (invocationS != null) {
HashMap<String, Object> mapParameters = invocationS
.getParameters();
if (mapParameters != null) {
logger.debug("Map Class: "+mapParameters
.get(Constants.PARAMETER_COLUMN_MAPPING).getClass());
@SuppressWarnings("unchecked")
Map<TDTypeValue, Long> mappingPrevious = (Map<TDTypeValue, Long>) mapParameters
.get(Constants.PARAMETER_COLUMN_MAPPING);
logger.debug("Previous Mapping");
if (mappingPrevious != null) {
for (TDTypeValue key : mappingPrevious.keySet()) {
logger.debug("Key = " + key + " - "
+ mappingPrevious.get(key));
mapping.put(key, mappingPrevious.get(key));
if (invocationS.getJobNumber() != null) {
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) {
@SuppressWarnings("unchecked")
Map<TDTypeValue, Long> mappingPrevious = (Map<TDTypeValue, Long>) mapParameters
.get(Constants.PARAMETER_COLUMN_MAPPING);
logger.debug("Previous Mapping");
if (mappingPrevious != null) {
for (TDTypeValue key : mappingPrevious
.keySet()) {
logger.debug("Key = "
+ key
+ " - "
+ mappingPrevious
.get(key));
mapping.put(key,
mappingPrevious
.get(key));
}
} else {
logger.debug("Previous Mapping is null");
}
} else {
logger.debug("Parameters is null");
}
} else {
logger.debug("PreviousJob is null");
}
} else {
logger.debug("PreviousJobs is null");
}
} else {
logger.debug("Previous Mapping is null");
logger.debug("TaskId is null");
}
} else {
logger.debug("Parameters is null");
logger.debug("JobNumber is null");
}
} else {
logger.debug("InvocationS is null");
}
*/
map.put(Constants.PARAMETER_COLUMN_MAPPING, mapping);
trTask = service.resume(taskId, map);
logger.debug("Resume Task on service: [TaskId:"

View File

@ -13,7 +13,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
public class InvocationS implements Serializable {
private static final long serialVersionUID = -7112348181058962879L;
protected Integer jobNumber;//Internal job number from 1 to n
protected String columnId;
protected long operationId;
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) {
this.jobNumber=jobNumber;
this.columnId = columnId;
this.operationId = operationId;
this.identifier = identifier;
@ -84,15 +86,25 @@ public class InvocationS implements Serializable {
this.taskId = taskId;
}
public Integer getJobNumber() {
return jobNumber;
}
public void setJobNumber(Integer jobNumber) {
this.jobNumber = jobNumber;
}
@Override
public String toString() {
return "InvocationS [columnId=" + columnId + ", operationId="
+ operationId + ", identifier=" + identifier + ", parameters="
+ parameters + ", taskId=" + taskId + ", refColumn="
+ refColumn + "]";
return "InvocationS [jobNumber=" + jobNumber + ", columnId=" + columnId
+ ", operationId=" + operationId + ", identifier=" + identifier
+ ", parameters=" + parameters + ", taskId=" + taskId
+ ", refColumn=" + refColumn + "]";
}
}