Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-gwt-service@94620 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-09 13:22:08 +00:00
parent 391e1ff5ec
commit 182f35c406
4 changed files with 133 additions and 15 deletions

View File

@ -74,6 +74,7 @@ import org.gcube.data.analysis.tabulardata.service.TabularDataService;
import org.gcube.data.analysis.tabulardata.service.exception.NoSuchTemplateException;
import org.gcube.data.analysis.tabulardata.service.impl.TabularDataServiceFactory;
import org.gcube.data.analysis.tabulardata.service.operation.Task;
import org.gcube.data.analysis.tabulardata.service.tabular.HistoryStep;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.AgencyMetadata;
@ -108,6 +109,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTServiceExcept
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadState;
import org.gcube.portlets.user.td.gwtservice.shared.file.HeaderPresence;
import org.gcube.portlets.user.td.gwtservice.shared.operation.Operation;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportMonitor;
@ -348,8 +350,8 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
* Returns ArrayList<ColumnData> other than IdColumnType,
* ValidationColumnType, DimensionColumnType and TimeDimensionColumnType
* Returns ArrayList<ColumnData> other than IdColumnType and
* ValidationColumnType
*
* {@inheritDoc}
*/
@ -377,11 +379,12 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
List<Column> cols = table.getColumns();
int i = 0;
//|| c.getColumnType() instanceof DimensionColumnType
//|| c.getColumnType() instanceof TimeDimensionColumnType
for (Column c : cols) {
if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType
|| c.getColumnType() instanceof DimensionColumnType
|| c.getColumnType() instanceof TimeDimensionColumnType) {
) {
} else {
if (c.contains(ViewColumnMetadata.class)) {
@ -484,9 +487,7 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
int i = 0;
for (Column c : cols) {
if (c.getColumnType() instanceof IdColumnType
|| c.getColumnType() instanceof ValidationColumnType
|| c.getColumnType() instanceof DimensionColumnType
|| c.getColumnType() instanceof TimeDimensionColumnType) {
|| c.getColumnType() instanceof ValidationColumnType) {
} else {
if (c.contains(ViewColumnMetadata.class)) {
@ -5645,4 +5646,55 @@ public class TDGWTServiceImpl extends RemoteServiceServlet implements
}
/**
*
* OperationInfo
*/
public Operation getLastOperationInfo() throws TDGWTServiceException {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getAslSession(session);
logger.debug("getLastDiscardOperation()");
TabResource currentTR = SessionUtil.getTabResource(session);
if (currentTR == null) {
logger.error("CURRENT_TABULAR_RESOURCE is null");
throw new TDGWTServiceException(
"CURRENT_TABULAR_RESOURCE is null");
}
TRId trId = currentTR.getTrId();
AuthorizationProvider.instance.set(new AuthorizationToken(
aslSession.getUsername()));
TabularDataService service = TabularDataServiceFactory.getService();
TabularResourceId tabularResourceId=new TabularResourceId(Long.valueOf(trId.getId()));
TabularResource tabularResource=service.getTabularResource(tabularResourceId);
List<HistoryStep> history =tabularResource.getHistory();
OperationDefinition lastOp=null;
if(history!=null && history.size()>0){
HistoryStep lastStep=history.get(0);
if(lastStep!=null){
lastOp=service.getCapability(lastStep.getOperationInvocation().getOperationId());
}
}
Operation op=null;
if(lastOp!=null){
op=new Operation(lastOp.getName(),lastOp.getDescription());
}
logger.debug("Last Operation Info :" + op);
return op;
} catch (Throwable e) {
logger.debug("getLastOperationInfo(): " + e.getLocalizedMessage());
e.printStackTrace();
throw new TDGWTServiceException("Error retrieving last operation info: "
+ e.getLocalizedMessage());
}
}
}

View File

@ -218,10 +218,20 @@ public class ExpressionGenerator {
new ColumnLocalId(columnLocalId));
listColumnReference.add(cr);
}
if(listColumnReference.size()<=0){
return null;
} else {
if(listColumnReference.size()==1){
Not not=new Not(listColumnReference.get(0));
return not;
} else {
And and = new And(listColumnReference);
Not not = new Not(and);
return not;
}
}
} catch (Throwable e) {
logger.debug("Error in genReplaceBatchOccurrencesFilter: "
+ e.getLocalizedMessage());

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.gwtservice.server.trservice;
import java.util.ArrayList;
import java.util.Arrays;
import org.gcube.data.analysis.tabulardata.expression.Expression;
import org.gcube.data.analysis.tabulardata.model.column.ColumnLocalId;
import org.gcube.data.analysis.tabulardata.model.table.TableId;
import org.gcube.data.analysis.tabulardata.query.parameters.QueryFilter;
@ -87,14 +88,24 @@ public class QueryService {
if (occurrencesSession.getShowType().compareTo(
ShowOccurrencesType.ONLYERRORS) == 0) {
if (occurrencesSession.isHasValidationColumns()) {
Expression exp=ExpressionGenerator
.genReplaceBatchOccurrencesFilter(column);
logger.debug("Expression: "+exp);
if(exp!=null){
queryFilter = new QueryFilter(
ExpressionGenerator
.genReplaceBatchOccurrencesFilter(column));
exp);
}
} else {
return occurences;
}
}
logger.debug("Query on " + tableId.toString() + " queryPage:"
+ queryPage + " queryFilter:" + queryFilter
+ " querySelect:" + querySelect + " queryGroup:"
+ queryGroup+" queryOrder:"+queryOrder);
logger.debug("Query Select Columns:"+querySelect.getColumns());
logger.debug("Query Group Columns: "+queryGroup.getColumns());
String serviceJson = null;
try {
if (queryOrder == null) {

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.user.td.gwtservice.shared.operation;
import java.io.Serializable;
/**
*
* @author "Giancarlo Panichi"
*
*/
public class Operation implements Serializable {
private static final long serialVersionUID = 7597236172277678816L;
String name;
String description;
public Operation() {
}
public Operation(String name, String description) {
this.name = name;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "Operation [name=" + name + ", description=" + description + "]";
}
}