Updated Condition All Rows on Replace By Expression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113622 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
2995538566
commit
f215c727c4
|
@ -46,14 +46,14 @@ public class ReplaceColumnByExpressionDialog extends Window implements
|
||||||
private static final String HEIGHT_REDUCE = "404px";
|
private static final String HEIGHT_REDUCE = "404px";
|
||||||
|
|
||||||
private ReplaceColumnByExpressionPanel replaceColumnByExpressionPanel;
|
private ReplaceColumnByExpressionPanel replaceColumnByExpressionPanel;
|
||||||
private C_Expression cConditionExpression = null;
|
private C_Expression cConditionExpression=null;
|
||||||
|
|
||||||
private ColumnData column = null;
|
private ColumnData column = null;
|
||||||
private ArrayList<ColumnData> columns;
|
private ArrayList<ColumnData> columns;
|
||||||
|
|
||||||
//private String columnName = null;
|
//private String columnName = null;
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private ReplaceColumnByExpressionType replaceColumnByExpressionType;
|
private ReplaceColumnByExpressionType replaceColumnByExpressionType;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -190,21 +190,22 @@ public class ReplaceColumnByExpressionDialog extends Window implements
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyReplaceColumnByExpression(
|
protected void applyReplaceColumnByExpression(
|
||||||
C_Expression cConditionExpression, String replaceValue) {
|
boolean allRows,C_Expression cConditionExpression, String replaceValue) {
|
||||||
|
|
||||||
this.cConditionExpression = cConditionExpression;
|
this.cConditionExpression = cConditionExpression;
|
||||||
|
|
||||||
|
|
||||||
ReplaceColumnByExpressionSession replaceColumnByExpressionSession = new ReplaceColumnByExpressionSession(
|
ReplaceColumnByExpressionSession replaceColumnByExpressionSession = new ReplaceColumnByExpressionSession(
|
||||||
column, cConditionExpression, replaceValue);
|
column, allRows,cConditionExpression, replaceValue);
|
||||||
callApplyReplaceByExpression(replaceColumnByExpressionSession);
|
callApplyReplaceByExpression(replaceColumnByExpressionSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyReplaceColumnByExpression(
|
protected void applyReplaceColumnByExpression(boolean allRows,
|
||||||
C_Expression cConditionExpression, C_Expression cReplaceExpression) {
|
C_Expression cConditionExpression, C_Expression cReplaceExpression) {
|
||||||
this.cConditionExpression = cConditionExpression;
|
this.cConditionExpression = cConditionExpression;
|
||||||
//this.cReplaceExpression = cReplaceExpression;
|
|
||||||
ReplaceColumnByExpressionSession replaceColumnByExpressionSession = new ReplaceColumnByExpressionSession(
|
ReplaceColumnByExpressionSession replaceColumnByExpressionSession = new ReplaceColumnByExpressionSession(
|
||||||
column, cConditionExpression, cReplaceExpression);
|
column, allRows, cConditionExpression, cReplaceExpression);
|
||||||
callApplyReplaceByExpression(replaceColumnByExpressionSession);
|
callApplyReplaceByExpression(replaceColumnByExpressionSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionRe
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceColumnByExpressionType;
|
import org.gcube.portlets.user.td.expressionwidget.client.type.ReplaceColumnByExpressionType;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ReplaceTypeMapException;
|
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ReplaceTypeMapException;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
|
||||||
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.monitorwidget.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ExpressionEvent;
|
||||||
|
@ -130,8 +129,8 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|| column.getDataTypeName().compareTo(
|
|| column.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Integer.toString()) == 0
|
ColumnDataType.Integer.toString()) == 0
|
||||||
|| column.getDataTypeName().compareTo(
|
|| column.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Numeric.toString()) == 0
|
ColumnDataType.Numeric.toString()) == 0 || column
|
||||||
|| column.getDataTypeName().compareTo(
|
.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Geometry.toString()) == 0)) {
|
ColumnDataType.Geometry.toString()) == 0)) {
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
} else {
|
} else {
|
||||||
|
@ -331,9 +330,9 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void applyReplaceColumnByExpression() {
|
protected void applyReplaceColumnByExpression() {
|
||||||
C_Expression cConditionExpression;
|
C_Expression cConditionExpression = null;
|
||||||
if (allRows) {
|
if (allRows) {
|
||||||
cConditionExpression = new TD_Value(ColumnDataType.Boolean, "true");
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -367,7 +366,8 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (column.getDataTypeName().compareTo(
|
if (column.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Text.toString()) == 0|| column.getDataTypeName().compareTo(
|
ColumnDataType.Text.toString()) == 0
|
||||||
|
|| column.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Integer.toString()) == 0
|
ColumnDataType.Integer.toString()) == 0
|
||||||
|| column.getDataTypeName().compareTo(
|
|| column.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Numeric.toString()) == 0
|
ColumnDataType.Numeric.toString()) == 0
|
||||||
|
@ -406,10 +406,18 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||||
ExpressionType.REPLACECOLUMNEXPRESSION);
|
ExpressionType.REPLACECOLUMNEXPRESSION);
|
||||||
C_ExpressionContainer container = new C_ExpressionContainer(
|
C_ExpressionContainer container;
|
||||||
C_ExpressionContainer.Contains.C_Expression,
|
if (allRows) {
|
||||||
cConditionExpression,
|
container = new C_ExpressionContainer(
|
||||||
conditionWidget.getReadableExpression());
|
C_ExpressionContainer.Contains.C_Expression,
|
||||||
|
true,null,
|
||||||
|
"AllRows()");
|
||||||
|
} else {
|
||||||
|
container = new C_ExpressionContainer(
|
||||||
|
C_ExpressionContainer.Contains.C_Expression,
|
||||||
|
cConditionExpression,
|
||||||
|
conditionWidget.getReadableExpression());
|
||||||
|
}
|
||||||
expressionEvent.setC_ConditionExpressionContainer(container);
|
expressionEvent.setC_ConditionExpressionContainer(container);
|
||||||
expressionEvent.setReplaceByValue(true);
|
expressionEvent.setReplaceByValue(true);
|
||||||
expressionEvent.setReplaceValue(replaceValue);
|
expressionEvent.setReplaceValue(replaceValue);
|
||||||
|
@ -421,7 +429,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
break;
|
break;
|
||||||
case Replace:
|
case Replace:
|
||||||
parent.applyReplaceColumnByExpression(cConditionExpression,
|
parent.applyReplaceColumnByExpression(allRows,cConditionExpression,
|
||||||
replaceValue);
|
replaceValue);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -436,10 +444,18 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
case Template:
|
case Template:
|
||||||
ExpressionEvent expressionEvent = new ExpressionEvent(
|
ExpressionEvent expressionEvent = new ExpressionEvent(
|
||||||
ExpressionType.REPLACECOLUMNEXPRESSION);
|
ExpressionType.REPLACECOLUMNEXPRESSION);
|
||||||
C_ExpressionContainer conditionExpressionContainer = new C_ExpressionContainer(
|
C_ExpressionContainer conditionExpressionContainer;
|
||||||
|
if (allRows) {
|
||||||
|
conditionExpressionContainer = new C_ExpressionContainer(
|
||||||
|
C_ExpressionContainer.Contains.C_Expression,
|
||||||
|
true,null,
|
||||||
|
"AllRows()");
|
||||||
|
} else {
|
||||||
|
conditionExpressionContainer = new C_ExpressionContainer(
|
||||||
C_ExpressionContainer.Contains.C_Expression,
|
C_ExpressionContainer.Contains.C_Expression,
|
||||||
cConditionExpression,
|
cConditionExpression,
|
||||||
conditionWidget.getReadableExpression());
|
conditionWidget.getReadableExpression());
|
||||||
|
}
|
||||||
expressionEvent
|
expressionEvent
|
||||||
.setC_ConditionExpressionContainer(conditionExpressionContainer);
|
.setC_ConditionExpressionContainer(conditionExpressionContainer);
|
||||||
expressionEvent.setReplaceByValue(false);
|
expressionEvent.setReplaceByValue(false);
|
||||||
|
@ -448,7 +464,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
cReplaceExpression, replaceWidget.getReadableExpression());
|
cReplaceExpression, replaceWidget.getReadableExpression());
|
||||||
expressionEvent
|
expressionEvent
|
||||||
.setC_ReplaceExpressionContainer(replaceExpressionContainer);
|
.setC_ReplaceExpressionContainer(replaceExpressionContainer);
|
||||||
|
|
||||||
expressionEvent.setTrId(column.getTrId());
|
expressionEvent.setTrId(column.getTrId());
|
||||||
expressionEvent.setColumnId(column.getColumnId());
|
expressionEvent.setColumnId(column.getColumnId());
|
||||||
expressionEvent.setColumnName(column.getName());
|
expressionEvent.setColumnName(column.getName());
|
||||||
|
@ -457,7 +473,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
eventBus.fireEvent(expressionEvent);
|
eventBus.fireEvent(expressionEvent);
|
||||||
break;
|
break;
|
||||||
case Replace:
|
case Replace:
|
||||||
parent.applyReplaceColumnByExpression(cConditionExpression,
|
parent.applyReplaceColumnByExpression(allRows,cConditionExpression,
|
||||||
cReplaceExpression);
|
cReplaceExpression);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -109,17 +109,21 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
|
||||||
replaceColumnByExpressionSession);
|
replaceColumnByExpressionSession);
|
||||||
|
|
||||||
C_ExpressionParser parser = new C_ExpressionParser();
|
C_ExpressionParser parser = new C_ExpressionParser();
|
||||||
Expression conditionExpression;
|
|
||||||
try {
|
|
||||||
conditionExpression = parser
|
|
||||||
.parse(replaceColumnByExpressionSession
|
|
||||||
.getcConditionExpression());
|
|
||||||
} catch (ExpressionParserException e) {
|
|
||||||
logger.debug(e.getLocalizedMessage());
|
|
||||||
throw new TDGWTServiceException(e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.debug("Service Condition Expression:" + conditionExpression);
|
Expression conditionExpression=null;
|
||||||
|
if (!replaceColumnByExpressionSession.isAllRows()) {
|
||||||
|
try {
|
||||||
|
conditionExpression = parser
|
||||||
|
.parse(replaceColumnByExpressionSession
|
||||||
|
.getcConditionExpression());
|
||||||
|
} catch (ExpressionParserException e) {
|
||||||
|
logger.debug(e.getLocalizedMessage());
|
||||||
|
throw new TDGWTServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("Service Condition Expression:"
|
||||||
|
+ conditionExpression);
|
||||||
|
}
|
||||||
|
|
||||||
Expression replaceExpression = null;
|
Expression replaceExpression = null;
|
||||||
if (!replaceColumnByExpressionSession.isReplaceByValue()) {
|
if (!replaceColumnByExpressionSession.isReplaceByValue()) {
|
||||||
|
@ -127,7 +131,7 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
|
||||||
.parse(replaceColumnByExpressionSession
|
.parse(replaceColumnByExpressionSession
|
||||||
.getcReplaceExpression());
|
.getcReplaceExpression());
|
||||||
logger.debug("Service Replace Expression:"
|
logger.debug("Service Replace Expression:"
|
||||||
+ conditionExpression);
|
+ replaceExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDGWTServiceImpl gwtService = new TDGWTServiceImpl();
|
TDGWTServiceImpl gwtService = new TDGWTServiceImpl();
|
||||||
|
@ -184,14 +188,18 @@ public class ExpressionServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
TRId newTRId;
|
TRId newTRId;
|
||||||
if (viewTable == null) {
|
if (viewTable == null) {
|
||||||
newTRId = new TRId(String.valueOf(tr.getId().getValue()),
|
newTRId = new TRId(
|
||||||
TabularResourceTypeMap.map(tr.getTabularResourceType()), tr.getTableType(), String.valueOf(table.getId()
|
String.valueOf(tr.getId().getValue()),
|
||||||
.getValue()), table.getTableType().getName());
|
TabularResourceTypeMap.map(tr.getTabularResourceType()),
|
||||||
|
tr.getTableType(), String.valueOf(table.getId()
|
||||||
|
.getValue()), table.getTableType().getName());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
newTRId = new TRId(String.valueOf(tr.getId().getValue()),
|
newTRId = new TRId(
|
||||||
TabularResourceTypeMap.map(tr.getTabularResourceType()), tr.getTableType(), String.valueOf(viewTable.getId()
|
String.valueOf(tr.getId().getValue()),
|
||||||
.getValue()), viewTable.getTableType()
|
TabularResourceTypeMap.map(tr.getTabularResourceType()),
|
||||||
|
tr.getTableType(), String.valueOf(viewTable.getId()
|
||||||
|
.getValue()), viewTable.getTableType()
|
||||||
.getName(), String.valueOf(table.getId()
|
.getName(), String.valueOf(table.getId()
|
||||||
.getValue()), true);
|
.getValue()), true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue