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:
Giancarlo Panichi 2014-07-16 17:51:16 +00:00
parent d00d6d7481
commit f6da612b29
4 changed files with 103 additions and 40 deletions

View File

@ -95,9 +95,9 @@ public class SessionUtil {
if (username == null) { if (username == null) {
logger.warn("no user found in session, using test one"); logger.warn("no user found in session, using test one");
throw new TDGWTSessionExpiredException("Session Expired!"); throw new TDGWTSessionExpiredException("Session Expired!");
/*
//Remove comment for Test
//Remove comment for Test
/*
username = Constants.DEFAULT_USER; username = Constants.DEFAULT_USER;
String scope = Constants.DEFAULT_SCOPE; String scope = Constants.DEFAULT_SCOPE;

View File

@ -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.IdColumnType;
import org.gcube.data.analysis.tabulardata.model.column.type.TimeDimensionColumnType; 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.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.Locales;
import org.gcube.data.analysis.tabulardata.model.metadata.column.DataLocaleMetadata; import org.gcube.data.analysis.tabulardata.model.metadata.column.DataLocaleMetadata;
import org.gcube.data.analysis.tabulardata.model.metadata.column.ValidationReferencesMetadata; 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.ExtractReferences;
import org.gcube.portlets.user.td.gwtservice.server.trservice.OperationDefinitionMap; 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.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.server.trservice.TaskStateMap;
import org.gcube.portlets.user.td.gwtservice.shared.Constants; import org.gcube.portlets.user.td.gwtservice.shared.Constants;
import org.gcube.portlets.user.td.gwtservice.shared.OperationsId; import org.gcube.portlets.user.td.gwtservice.shared.OperationsId;
@ -7026,31 +7028,69 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
ArrayList<ColumnMappingData> columnMapping = taskResumeSession ArrayList<ColumnMappingData> columnMapping = taskResumeSession
.getColumnMapping(); .getColumnMapping();
Task trTask; Task trTask;
if (columnMapping != null && columnMapping.size() > 0) { 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) { for (ColumnMappingData columnMappingData : columnMapping) {
if (columnMappingData.getSourceArg() != null if (columnMappingData.getSourceArg() != null
&& columnMappingData.getTargetArg() != null) { && columnMappingData.getTargetArg() != null) {
DimensionRow source = columnMappingData.getSourceArg(); DimensionRow source = columnMappingData.getSourceArg();
DimensionRow target = columnMappingData.getTargetArg(); 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); map.put(Constants.PARAMETER_COLUMN_MAPPING, mapping);
trTask = service.resume(taskId,map); trTask = service.resume(taskId, map);
logger.debug("Resume Task on service: [TaskId:" + trTask.getId()+", Map:"+map+"]"); logger.debug("Resume Task on service: [TaskId:"
+ trTask.getId() + ", Map:" + map + "]");
} else { } else {
trTask = service.resume(taskId); 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;
@ -8410,8 +8450,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} }
} }
/** /**
* *
* {@inheritDoc} * {@inheritDoc}
@ -8428,8 +8467,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
aslSession.getUsername(), aslSession.getScope())); aslSession.getUsername(), aslSession.getScope()));
TabularDataService service = TabularDataServiceFactory.getService(); TabularDataService service = TabularDataServiceFactory.getService();
OpExecution4Union opEx = new OpExecution4Union( OpExecution4Union opEx = new OpExecution4Union(service,
service, unionSession); unionSession);
OpExecutionDirector director = new OpExecutionDirector(); OpExecutionDirector director = new OpExecutionDirector();
director.setOperationExecutionBuilder(opEx); director.setOperationExecutionBuilder(opEx);
director.constructOperationExecution(); director.constructOperationExecution();
@ -8456,9 +8495,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
"Security exception, you haven't rights!"); "Security exception, you haven't rights!");
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
throw new TDGWTServiceException( throw new TDGWTServiceException("Error in union: "
"Error in union: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
} }
} }
@ -8468,12 +8506,10 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public UnionMonitor getUnionMonitor() public UnionMonitor getUnionMonitor() throws TDGWTServiceException {
throws TDGWTServiceException {
try { try {
HttpSession session = this.getThreadLocalRequest().getSession(); HttpSession session = this.getThreadLocalRequest().getSession();
UnionSession unionSession = SessionUtil UnionSession unionSession = SessionUtil.getUnionSession(session);
.getUnionSession(session);
Task task = SessionUtil.getUnionTask(session); Task task = SessionUtil.getUnionTask(session);
UnionMonitor unionMonitor = new UnionMonitor(); UnionMonitor unionMonitor = new UnionMonitor();
@ -8491,8 +8527,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} else { } else {
logger.debug("Services TaskStatus: " + task.getStatus()); logger.debug("Services TaskStatus: " + task.getStatus());
unionMonitor.setStatus(TaskStateMap.map(task unionMonitor.setStatus(TaskStateMap.map(task.getStatus()));
.getStatus()));
TRId trId; TRId trId;
TabResource tabResource; TabResource tabResource;
@ -8563,17 +8598,13 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
} catch (TDGWTSessionExpiredException e) { } catch (TDGWTSessionExpiredException e) {
throw e; throw e;
} catch (Throwable e) { } catch (Throwable e) {
logger.debug("Error in UnionMonitor: " logger.debug("Error in UnionMonitor: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
throw new TDGWTServiceException( throw new TDGWTServiceException("Error in union monitor: "
"Error in union monitor: " + e.getLocalizedMessage());
+ e.getLocalizedMessage());
} }
} }
} }

View File

@ -105,17 +105,24 @@ public class QueryService {
querySelect = new QuerySelect(Arrays.asList( querySelect = new QuerySelect(Arrays.asList(
new QueryColumn(columnId), new QueryColumn( new QueryColumn(columnId), new QueryColumn(
sourceColumnId))); sourceColumnId),new QueryColumn(columnId,
Function.COUNT)));
logger.debug("Occurences querySelect:" logger.debug("Occurences querySelect:"
+ querySelect.toString()); + querySelect.toString());
queryGroup = new QueryGroup(Arrays.asList(columnId, sourceColumnId));
logger.debug("Occurences queryGroup:"
+ queryGroup.toString());
} else { } else {
ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType( //ColumnLocalId idColumn = retrieveColumnLocalIdOFIdColumnType(
column.getTrId(), service); // column.getTrId(), service);
querySelect = new QuerySelect(Arrays.asList( querySelect = new QuerySelect(Arrays.asList(
new QueryColumn(columnId), new QueryColumn( new QueryColumn(columnId),new QueryColumn(columnId,
idColumn))); Function.COUNT)));
logger.debug("Occurences querySelect:" logger.debug("Occurences querySelect:"
+ querySelect.toString()); + querySelect.toString());
queryGroup = new QueryGroup(Arrays.asList(columnId));
logger.debug("Occurences queryGroup:"
+ queryGroup.toString());
} }
break; break;
case CastValidation: case CastValidation:
@ -350,11 +357,11 @@ public class QueryService {
if (column.isViewColumn()) { if (column.isViewColumn()) {
occurence = new Occurrences( occurence = new Occurrences(
currentRow.getString(0), currentRow.getString(0),
currentRow.getString(1), 1); currentRow.getString(1), currentRow.getInt(2));
} else { } else {
occurence = new Occurrences( occurence = new Occurrences(
currentRow.getString(0), currentRow.getString(0),
currentRow.getString(1), 1); "1", currentRow.getInt(1));
} }
break; break;
case CastValidation: case CastValidation:

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.shared.task;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; 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.gwtservice.shared.tr.column.mapping.ColumnMappingData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -18,8 +19,10 @@ public class TaskResumeSession implements Serializable {
protected TRId trId; protected TRId trId;
protected String taskId; protected String taskId;
protected ColumnData column;
protected ArrayList<ColumnMappingData> columnMapping; protected ArrayList<ColumnMappingData> columnMapping;
protected InvocationS invocationS;
public TaskResumeSession() { public TaskResumeSession() {
} }
@ -31,10 +34,12 @@ public class TaskResumeSession implements Serializable {
} }
public TaskResumeSession(TRId trId, String taskId, public TaskResumeSession(TRId trId, String taskId,
ArrayList<ColumnMappingData> columnMapping) { ArrayList<ColumnMappingData> columnMapping, ColumnData column, InvocationS invocationS) {
this.trId = trId; this.trId = trId;
this.taskId = taskId; this.taskId = taskId;
this.columnMapping = columnMapping; this.columnMapping = columnMapping;
this.column=column;
this.invocationS=invocationS;
} }
public TRId getTrId() { public TRId getTrId() {
@ -61,12 +66,32 @@ public class TaskResumeSession implements Serializable {
this.columnMapping = columnMapping; 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 @Override
public String toString() { public String toString() {
return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId return "TaskResumeSession [trId=" + trId + ", taskId=" + taskId
+ ", columnMapping=" + columnMapping + "]"; + ", column=" + column + ", columnMapping=" + columnMapping
+ ", invocationS=" + invocationS + "]";
} }
} }