Updated Task Resume added mapping

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@98638 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-07-15 11:04:59 +00:00
parent 7f26a7c2fc
commit 45bb3c033b
2 changed files with 74 additions and 28 deletions

View File

@ -165,6 +165,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.template.TemplateDeleteSessi
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.ConditionCodeMap;
import org.gcube.portlets.user.td.gwtservice.shared.tr.DimensionRow;
import org.gcube.portlets.user.td.gwtservice.shared.tr.RefColumn;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
@ -185,6 +186,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnMonit
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.ReplaceColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.SplitColumnMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.SplitColumnSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.GroupByMonitor;
@ -1115,7 +1117,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
viewTable = service.getTable(dwm
.getTargetDatasetViewTableId());
} catch (Exception e) {
logger.error("View table not found: "+e.getLocalizedMessage());
logger.error("View table not found: "
+ e.getLocalizedMessage());
}
} else {
logger.debug("Table not contains DataseViewTableMetadata");
@ -7017,7 +7020,31 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
TaskId taskId = new TaskId(taskResumeSession.getTaskId());
Task trTask = service.resubmit(taskId);
Map<String, Object> map = new HashMap<String, Object>();
ArrayList<ColumnMappingData> columnMapping = taskResumeSession
.getColumnMapping();
Task trTask;
if (columnMapping != null && columnMapping.size() > 0) {
HashMap<Long, Long> mapping = new HashMap<Long, Long>();
for (ColumnMappingData columnMappingData : columnMapping) {
if (columnMappingData.getSourceArg() != null
&& columnMappingData.getTargetArg() != null) {
DimensionRow source = columnMappingData.getSourceArg();
DimensionRow target = columnMappingData.getTargetArg();
mapping.put(new Long(source.getRowId()), new Long(
target.getRowId()));
}
}
map.put(Constants.PARAMETER_COLUMN_MAPPING, mapping);
trTask = service.resume(taskId,map);
} else {
trTask = service.resume(taskId);
}
logger.debug("Resume Task on service: TaskId " + trTask.getId());
SessionUtil.setTaskResumeTask(session, trTask);
return;

View File

@ -1,12 +1,15 @@
package org.gcube.portlets.user.td.gwtservice.shared.task;
import java.io.Serializable;
import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
/**
*
* @author "Giancarlo Panichi"
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class TaskResumeSession implements Serializable {
@ -15,6 +18,7 @@ public class TaskResumeSession implements Serializable {
protected TRId trId;
protected String taskId;
protected ArrayList<ColumnMappingData> columnMapping;
public TaskResumeSession() {
@ -23,6 +27,14 @@ public class TaskResumeSession implements Serializable {
public TaskResumeSession(TRId trId, String taskId) {
this.trId = trId;
this.taskId = taskId;
this.columnMapping = null;
}
public TaskResumeSession(TRId trId, String taskId,
ArrayList<ColumnMappingData> columnMapping) {
this.trId = trId;
this.taskId = taskId;
this.columnMapping = columnMapping;
}
public TRId getTrId() {
@ -41,13 +53,20 @@ public class TaskResumeSession implements Serializable {
this.taskId = taskId;
}
public ArrayList<ColumnMappingData> getColumnMapping() {
return columnMapping;
}
public void setColumnMapping(ArrayList<ColumnMappingData> columnMapping) {
this.columnMapping = columnMapping;
}
@Override
public String toString() {
return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId + "]";
return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId
+ ", columnMapping=" + columnMapping + "]";
}
}