Updated Curation
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@98707 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d00d6d7481
commit
f6da612b29
|
@ -95,9 +95,9 @@ public class SessionUtil {
|
|||
if (username == null) {
|
||||
logger.warn("no user found in session, using test one");
|
||||
throw new TDGWTSessionExpiredException("Session Expired!");
|
||||
/*
|
||||
//Remove comment for Test
|
||||
|
||||
//Remove comment for Test
|
||||
/*
|
||||
username = Constants.DEFAULT_USER;
|
||||
String scope = Constants.DEFAULT_SCOPE;
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.gcube.data.analysis.tabulardata.model.column.type.DimensionColumnType
|
|||
import org.gcube.data.analysis.tabulardata.model.column.type.IdColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.type.TimeDimensionColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.column.type.ValidationColumnType;
|
||||
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDTypeValue;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.Locales;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.column.DataLocaleMetadata;
|
||||
import org.gcube.data.analysis.tabulardata.model.metadata.column.ValidationReferencesMetadata;
|
||||
|
@ -119,6 +120,7 @@ import org.gcube.portlets.user.td.gwtservice.server.storage.FilesStorage;
|
|||
import org.gcube.portlets.user.td.gwtservice.server.trservice.ExtractReferences;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.QueryService;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TDTypeValueMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.server.trservice.TaskStateMap;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.Constants;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.OperationsId;
|
||||
|
@ -7029,28 +7031,66 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
|
||||
Task trTask;
|
||||
if (columnMapping != null && columnMapping.size() > 0) {
|
||||
HashMap<Long, Long> mapping = new HashMap<Long, Long>();
|
||||
HashMap<TDTypeValue, Long> mapping = new HashMap<TDTypeValue, Long>();
|
||||
logger.debug("New Mapping");
|
||||
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()));
|
||||
|
||||
TDTypeValue tdValue = TDTypeValueMap
|
||||
.map(taskResumeSession.getColumn()
|
||||
.getDataTypeName(), source.getValue());
|
||||
logger.debug("Key = " + tdValue + " - "
|
||||
+ new Long(target.getRowId()));
|
||||
mapping.put(tdValue, new Long(target.getRowId()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
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));
|
||||
}
|
||||
} else {
|
||||
logger.debug("Previous Mapping is null");
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.debug("Parameters 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:" + trTask.getId()+", Map:"+map+"]");
|
||||
trTask = service.resume(taskId, map);
|
||||
logger.debug("Resume Task on service: [TaskId:"
|
||||
+ trTask.getId() + ", Map:" + 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);
|
||||
return;
|
||||
|
||||
|
@ -8411,7 +8451,6 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
|
@ -8428,8 +8467,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
aslSession.getUsername(), aslSession.getScope()));
|
||||
TabularDataService service = TabularDataServiceFactory.getService();
|
||||
|
||||
OpExecution4Union opEx = new OpExecution4Union(
|
||||
service, unionSession);
|
||||
OpExecution4Union opEx = new OpExecution4Union(service,
|
||||
unionSession);
|
||||
OpExecutionDirector director = new OpExecutionDirector();
|
||||
director.setOperationExecutionBuilder(opEx);
|
||||
director.constructOperationExecution();
|
||||
|
@ -8456,9 +8495,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
"Security exception, you haven't rights!");
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error in union: "
|
||||
+ e.getLocalizedMessage());
|
||||
throw new TDGWTServiceException("Error in union: "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8468,12 +8506,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public UnionMonitor getUnionMonitor()
|
||||
throws TDGWTServiceException {
|
||||
public UnionMonitor getUnionMonitor() throws TDGWTServiceException {
|
||||
try {
|
||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||
UnionSession unionSession = SessionUtil
|
||||
.getUnionSession(session);
|
||||
UnionSession unionSession = SessionUtil.getUnionSession(session);
|
||||
|
||||
Task task = SessionUtil.getUnionTask(session);
|
||||
UnionMonitor unionMonitor = new UnionMonitor();
|
||||
|
@ -8491,8 +8527,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
} else {
|
||||
logger.debug("Services TaskStatus: " + task.getStatus());
|
||||
|
||||
unionMonitor.setStatus(TaskStateMap.map(task
|
||||
.getStatus()));
|
||||
unionMonitor.setStatus(TaskStateMap.map(task.getStatus()));
|
||||
|
||||
TRId trId;
|
||||
TabResource tabResource;
|
||||
|
@ -8563,17 +8598,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
|
|||
} catch (TDGWTSessionExpiredException e) {
|
||||
throw e;
|
||||
} catch (Throwable e) {
|
||||
logger.debug("Error in UnionMonitor: "
|
||||
+ e.getLocalizedMessage());
|
||||
logger.debug("Error in UnionMonitor: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw new TDGWTServiceException(
|
||||
"Error in union monitor: "
|
||||
+ e.getLocalizedMessage());
|
||||
throw new TDGWTServiceException("Error in union monitor: "
|
||||
+ e.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -105,17 +105,24 @@ public class QueryService {
|
|||
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
sourceColumnId)));
|
||||
sourceColumnId),new QueryColumn(columnId,
|
||||
Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
} else {
|
||||
ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType(
|
||||
column.getTrId(), service);
|
||||
//ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType(
|
||||
// column.getTrId(), service);
|
||||
querySelect = new QuerySelect(Arrays.asList(
|
||||
new QueryColumn(columnId), new QueryColumn(
|
||||
idColumn)));
|
||||
new QueryColumn(columnId),new QueryColumn(columnId,
|
||||
Function.COUNT)));
|
||||
logger.debug("Occurences querySelect:"
|
||||
+ querySelect.toString());
|
||||
queryGroup = new QueryGroup(Arrays.asList(columnId));
|
||||
logger.debug("Occurences queryGroup:"
|
||||
+ queryGroup.toString());
|
||||
}
|
||||
break;
|
||||
case CastValidation:
|
||||
|
@ -350,11 +357,11 @@ public class QueryService {
|
|||
if (column.isViewColumn()) {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getString(1), 1);
|
||||
currentRow.getString(1), currentRow.getInt(2));
|
||||
} else {
|
||||
occurence = new Occurrences(
|
||||
currentRow.getString(0),
|
||||
currentRow.getString(1), 1);
|
||||
"1", currentRow.getInt(1));
|
||||
}
|
||||
break;
|
||||
case CastValidation:
|
||||
|
|
|
@ -3,6 +3,7 @@ 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.ColumnData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.mapping.ColumnMappingData;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
@ -18,7 +19,9 @@ public class TaskResumeSession implements Serializable {
|
|||
|
||||
protected TRId trId;
|
||||
protected String taskId;
|
||||
protected ColumnData column;
|
||||
protected ArrayList<ColumnMappingData> columnMapping;
|
||||
protected InvocationS invocationS;
|
||||
|
||||
public TaskResumeSession() {
|
||||
|
||||
|
@ -31,10 +34,12 @@ public class TaskResumeSession implements Serializable {
|
|||
}
|
||||
|
||||
public TaskResumeSession(TRId trId, String taskId,
|
||||
ArrayList<ColumnMappingData> columnMapping) {
|
||||
ArrayList<ColumnMappingData> columnMapping, ColumnData column, InvocationS invocationS) {
|
||||
this.trId = trId;
|
||||
this.taskId = taskId;
|
||||
this.columnMapping = columnMapping;
|
||||
this.column=column;
|
||||
this.invocationS=invocationS;
|
||||
}
|
||||
|
||||
public TRId getTrId() {
|
||||
|
@ -61,12 +66,32 @@ public class TaskResumeSession implements Serializable {
|
|||
this.columnMapping = columnMapping;
|
||||
}
|
||||
|
||||
public ColumnData getColumn() {
|
||||
return column;
|
||||
}
|
||||
|
||||
public void setColumn(ColumnData column) {
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
public InvocationS getInvocationS() {
|
||||
return invocationS;
|
||||
}
|
||||
|
||||
public void setInvocationS(InvocationS invocationS) {
|
||||
this.invocationS = invocationS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId
|
||||
+ ", columnMapping=" + columnMapping + "]";
|
||||
+ ", column=" + column + ", columnMapping=" + columnMapping
|
||||
+ ", invocationS=" + invocationS + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue