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 * ValidationColumnType and ViewColumn
* *
* {@inheritDoc} * {@inheritDoc}
@ -522,7 +522,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<Column> cols = table.getColumns(); List<Column> cols = table.getColumns();
int i = 0; int i = 0;
for (Column c : cols) { for (Column c : cols) {
if (c.getColumnType() instanceof IdColumnType if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType) { || c.getColumnType() instanceof ValidationColumnType) {
@ -4719,7 +4719,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
/** /**
* Returns only CodeColumnType, CodeNameColumnType, * Returns only CodeColumnType, CodeNameColumnType,
* CodeDescriptionColumnType and AnnotationColumnType * CodeDescriptionColumnType and AnnotationColumnType
* *
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -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(),
@ -6805,7 +6807,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
} }
/** /**
* *
* *
@ -7055,37 +7057,61 @@ 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) {
if (mapParameters != null) { Integer jobNumber = invocationS.getJobNumber();
logger.debug("Map Class: "+mapParameters TaskId previousTaskId = new TaskId(
.get(Constants.PARAMETER_COLUMN_MAPPING).getClass()); invocationS.getTaskId());
@SuppressWarnings("unchecked") Task previousTask = service.getTask(previousTaskId);
Map<TDTypeValue, Long> mappingPrevious = (Map<TDTypeValue, Long>) mapParameters List<Job> previousJobs = previousTask.getTaskJobs();
.get(Constants.PARAMETER_COLUMN_MAPPING); if (previousJobs != null) {
logger.debug("Previous Mapping"); Job previousJob = previousJobs
if (mappingPrevious != null) { .get(jobNumber - 1);
for (TDTypeValue key : mappingPrevious.keySet()) { if (previousJob != null) {
logger.debug("Key = " + key + " - " Map<String,Object> mapParameters=previousJob.getInvocation().getParameters();
+ mappingPrevious.get(key)); if (mapParameters != null) {
mapping.put(key, mappingPrevious.get(key)); @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 { } else {
logger.debug("Previous Mapping is null"); logger.debug("TaskId is null");
} }
} else { } else {
logger.debug("Parameters is null"); 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);
logger.debug("Resume Task on service: [TaskId:" 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 { 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 + "]";
} }
} }