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:
parent
7f26a7c2fc
commit
45bb3c033b
|
@ -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.ColumnData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnViewData;
|
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.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.RefColumn;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
|
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.ReplaceColumnSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.SplitColumnMonitor;
|
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.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.ChangeColumnTypeMonitor;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.GroupByMonitor;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.groupby.GroupByMonitor;
|
||||||
|
@ -1103,19 +1105,20 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
Table table = service.getLastTable(new TabularResourceId(Long
|
Table table = service.getLastTable(new TabularResourceId(Long
|
||||||
.valueOf(trId.getId())));
|
.valueOf(trId.getId())));
|
||||||
logger.debug("Table retrieved: "+table);
|
logger.debug("Table retrieved: " + table);
|
||||||
|
|
||||||
Table viewTable = null;
|
Table viewTable = null;
|
||||||
|
|
||||||
if (table.contains(DatasetViewTableMetadata.class)) {
|
if (table.contains(DatasetViewTableMetadata.class)) {
|
||||||
DatasetViewTableMetadata dwm = table
|
DatasetViewTableMetadata dwm = table
|
||||||
.getMetadata(DatasetViewTableMetadata.class);
|
.getMetadata(DatasetViewTableMetadata.class);
|
||||||
logger.debug("DatasetViewTableMetadata: "+dwm);
|
logger.debug("DatasetViewTableMetadata: " + dwm);
|
||||||
try {
|
try {
|
||||||
viewTable = service.getTable(dwm
|
viewTable = service.getTable(dwm
|
||||||
.getTargetDatasetViewTableId());
|
.getTargetDatasetViewTableId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("View table not found: "+e.getLocalizedMessage());
|
logger.error("View table not found: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Table not contains DataseViewTableMetadata");
|
logger.debug("Table not contains DataseViewTableMetadata");
|
||||||
|
@ -1123,15 +1126,15 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
TableData tData = new TableData();
|
TableData tData = new TableData();
|
||||||
TRId newTRId;
|
TRId newTRId;
|
||||||
|
|
||||||
if (viewTable == null) {
|
if (viewTable == null) {
|
||||||
logger.debug("ViewTable is null");
|
logger.debug("ViewTable is null");
|
||||||
newTRId=new TRId(trId.getId());
|
newTRId = new TRId(trId.getId());
|
||||||
newTRId.setTabularResourceType(trId.getTabularResourceType());
|
newTRId.setTabularResourceType(trId.getTabularResourceType());
|
||||||
newTRId.setTableId(String.valueOf(table.getId().getValue()));
|
newTRId.setTableId(String.valueOf(table.getId().getValue()));
|
||||||
newTRId.setTableType(table.getTableType().getName());
|
newTRId.setTableType(table.getTableType().getName());
|
||||||
newTRId.setViewTable(false);
|
newTRId.setViewTable(false);
|
||||||
logger.debug("NewTRId: "+newTRId);
|
logger.debug("NewTRId: " + newTRId);
|
||||||
tData.setTrId(newTRId);
|
tData.setTrId(newTRId);
|
||||||
|
|
||||||
tData.setName(table.getName());
|
tData.setName(table.getName());
|
||||||
|
@ -1187,16 +1190,16 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
logger.debug("ViewTable is not null");
|
logger.debug("ViewTable is not null");
|
||||||
newTRId= new TRId(trId.getId());
|
newTRId = new TRId(trId.getId());
|
||||||
newTRId.setTabularResourceType(trId.getTabularResourceType());
|
newTRId.setTabularResourceType(trId.getTabularResourceType());
|
||||||
newTRId.setTableId(String.valueOf(viewTable.getId().getValue()));
|
newTRId.setTableId(String.valueOf(viewTable.getId().getValue()));
|
||||||
newTRId.setTableType(viewTable.getTableType().getName());
|
newTRId.setTableType(viewTable.getTableType().getName());
|
||||||
newTRId.setReferenceTargetTableId(String.valueOf(table.getId()
|
newTRId.setReferenceTargetTableId(String.valueOf(table.getId()
|
||||||
.getValue()));
|
.getValue()));
|
||||||
newTRId.setViewTable(true);
|
newTRId.setViewTable(true);
|
||||||
logger.debug("NewTRId: "+newTRId);
|
logger.debug("NewTRId: " + newTRId);
|
||||||
tData.setTrId(newTRId);
|
tData.setTrId(newTRId);
|
||||||
|
|
||||||
tData.setName(viewTable.getName());
|
tData.setName(viewTable.getName());
|
||||||
tData.setTypeName(viewTable.getTableType().getName());
|
tData.setTypeName(viewTable.getTableType().getName());
|
||||||
tData.setTypeCode(viewTable.getTableType().getCode());
|
tData.setTypeCode(viewTable.getTableType().getCode());
|
||||||
|
@ -1248,7 +1251,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
tData.setListColumnData(lColumnData);
|
tData.setListColumnData(lColumnData);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("getLastTable: " + tData);
|
logger.debug("getLastTable: " + tData);
|
||||||
return tData;
|
return tData;
|
||||||
|
|
||||||
|
@ -1274,8 +1277,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
|
||||||
logger.debug("getTable(): "+trId);
|
logger.debug("getTable(): " + trId);
|
||||||
AuthorizationProvider.instance.set(new AuthorizationToken(
|
AuthorizationProvider.instance.set(new AuthorizationToken(
|
||||||
aslSession.getUsername(), aslSession.getScope()));
|
aslSession.getUsername(), aslSession.getScope()));
|
||||||
TabularDataService service = TabularDataServiceFactory.getService();
|
TabularDataService service = TabularDataServiceFactory.getService();
|
||||||
|
@ -1305,7 +1308,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
newTRId.setTableId(String.valueOf(table.getId().getValue()));
|
newTRId.setTableId(String.valueOf(table.getId().getValue()));
|
||||||
newTRId.setTableType(table.getTableType().getName());
|
newTRId.setTableType(table.getTableType().getName());
|
||||||
newTRId.setViewTable(false);
|
newTRId.setViewTable(false);
|
||||||
logger.debug("NewTRId: "+newTRId);
|
logger.debug("NewTRId: " + newTRId);
|
||||||
tData.setTrId(newTRId);
|
tData.setTrId(newTRId);
|
||||||
|
|
||||||
tData.setName(table.getName());
|
tData.setName(table.getName());
|
||||||
|
@ -1368,7 +1371,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
newTRId.setReferenceTargetTableId(String.valueOf(table.getId()
|
newTRId.setReferenceTargetTableId(String.valueOf(table.getId()
|
||||||
.getValue()));
|
.getValue()));
|
||||||
newTRId.setViewTable(true);
|
newTRId.setViewTable(true);
|
||||||
logger.debug("NewTRId: "+newTRId);
|
logger.debug("NewTRId: " + newTRId);
|
||||||
tData.setTrId(newTRId);
|
tData.setTrId(newTRId);
|
||||||
|
|
||||||
tData.setName(viewTable.getName());
|
tData.setName(viewTable.getName());
|
||||||
|
@ -5009,7 +5012,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
TabularResource cloned = service.cloneTabularResource(serviceTR);
|
TabularResource cloned = service.cloneTabularResource(serviceTR);
|
||||||
logger.debug("Clone: " + cloned.toString());
|
logger.debug("Clone: " + cloned.toString());
|
||||||
Table table = service.getLastTable(cloned.getId());
|
Table table = service.getLastTable(cloned.getId());
|
||||||
|
|
||||||
if (table == null) {
|
if (table == null) {
|
||||||
String report = "This tabular resource has not valid last table! (TR id="
|
String report = "This tabular resource has not valid last table! (TR id="
|
||||||
+ cloned.getId() + ")";
|
+ cloned.getId() + ")";
|
||||||
|
@ -7017,7 +7020,31 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
TaskId taskId = new TaskId(taskResumeSession.getTaskId());
|
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());
|
logger.debug("Resume Task on service: TaskId " + trTask.getId());
|
||||||
SessionUtil.setTaskResumeTask(session, trTask);
|
SessionUtil.setTaskResumeTask(session, trTask);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,28 +1,40 @@
|
||||||
package org.gcube.portlets.user.td.gwtservice.shared.task;
|
package org.gcube.portlets.user.td.gwtservice.shared.task;
|
||||||
|
|
||||||
import java.io.Serializable;
|
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;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class TaskResumeSession implements Serializable {
|
public class TaskResumeSession implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4503878699159491057L;
|
private static final long serialVersionUID = -4503878699159491057L;
|
||||||
|
|
||||||
protected TRId trId;
|
protected TRId trId;
|
||||||
protected String taskId;
|
protected String taskId;
|
||||||
|
protected ArrayList<ColumnMappingData> columnMapping;
|
||||||
|
|
||||||
|
public TaskResumeSession() {
|
||||||
|
|
||||||
public TaskResumeSession(){
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskResumeSession(TRId trId, String taskId){
|
public TaskResumeSession(TRId trId, String taskId) {
|
||||||
this.trId=trId;
|
this.trId = trId;
|
||||||
this.taskId=taskId;
|
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() {
|
public TRId getTrId() {
|
||||||
|
@ -41,13 +53,20 @@ public class TaskResumeSession implements Serializable {
|
||||||
this.taskId = taskId;
|
this.taskId = taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<ColumnMappingData> getColumnMapping() {
|
||||||
|
return columnMapping;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumnMapping(ArrayList<ColumnMappingData> columnMapping) {
|
||||||
|
this.columnMapping = columnMapping;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId + "]";
|
return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId
|
||||||
|
+ ", columnMapping=" + columnMapping + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue