summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlzhang2012-05-30 02:48:07 (EDT)
committer mwu2012-05-30 02:48:07 (EDT)
commitf56f5ae2d92131c2bc2e25ac8025286f05833e0d (patch)
treed64f645df2de072907403049b9d2b4b64b580866
parent2a732ccab74cca4eb2a38859ecf24fad24ff3be0 (diff)
downloadorg.eclipse.birt-f56f5ae2d92131c2bc2e25ac8025286f05833e0d.zip
org.eclipse.birt-f56f5ae2d92131c2bc2e25ac8025286f05833e0d.tar.gz
org.eclipse.birt-f56f5ae2d92131c2bc2e25ac8025286f05833e0d.tar.bz2
no error when preview aggregation using dataSetRow[] as easy script
[49840]
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties1
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java1
-rw-r--r--data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/impl/ModelAdapter.java30
3 files changed, 25 insertions, 7 deletions
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties
index 5a5929c..b1f78ef 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/Messages.properties
@@ -30,6 +30,7 @@ exception.error=An exception occurred during processing. Please see the followin
invalid.level.expression=The level name "{0}" is not found.
invalid.measure.expression=The measure expression for measure "{0}" cannot be null.
invalid.data.type=Invalid data type: {0}.
+invalid.binding.expression=Invalid expression: {0}.
cube.error.createhierarchy=Error happens when create hierarchy:{0}.
cube.error.createdimension=Error happens when create dimension:{0}.
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java
index d73480a..bb3209d 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/i18n/ResourceConstants.java
@@ -34,6 +34,7 @@ public class ResourceConstants
public final static String INVALID_LEVEL_EXPRESSION = "invalid.level.expression";
public final static String INVALID_MEASURE_EXPRESSION = "invalid.measure.expression";
public final static String INVALID_DATA_TYPE = "invlid.data.type";
+ public final static String INVALID_BINDING_EXPRESSION = "invalid.binding.expression";
public final static String CUBE_HIERARCHY_CREATION_ERROR = "cube.error.createhierarchy";
public final static String CUBE_DIMENSION_CREATION_ERROR = "cube.error.createdimension";
public final static String CUBE_MEASURE_CREATION_ERROR = "cube.error.createmeasure";
diff --git a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/impl/ModelAdapter.java b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/impl/ModelAdapter.java
index a40bdbe..649aa4e 100644
--- a/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/impl/ModelAdapter.java
+++ b/data/org.eclipse.birt.report.data.adapter/src/org/eclipse/birt/report/data/adapter/impl/ModelAdapter.java
@@ -49,6 +49,8 @@ import org.eclipse.birt.report.data.adapter.api.DataSessionContext;
import org.eclipse.birt.report.data.adapter.api.IModelAdapter;
import org.eclipse.birt.report.data.adapter.api.timeFunction.IArgumentInfo;
import org.eclipse.birt.report.data.adapter.api.timeFunction.IBuildInBaseTimeFunction;
+import org.eclipse.birt.report.data.adapter.i18n.Message;
+import org.eclipse.birt.report.data.adapter.i18n.ResourceConstants;
import org.eclipse.birt.report.data.adapter.internal.adapter.ColumnAdapter;
import org.eclipse.birt.report.data.adapter.internal.adapter.ComputedColumnAdapter;
import org.eclipse.birt.report.data.adapter.internal.adapter.ConditionAdapter;
@@ -345,13 +347,14 @@ public class ModelAdapter implements IModelAdapter
* (non-Javadoc)
* @see org.eclipse.birt.report.data.adapter.api.IModelAdapter#adaptBinding(org.eclipse.birt.report.model.api.ComputedColumnHandle)
*/
- public IBinding adaptBinding( ComputedColumnHandle handle )
+ public IBinding adaptBinding( ComputedColumnHandle handle ) throws AdapterException
{
+ if ( handle == null )
+ return null;
+ Binding result = new Binding( handle.getName( ) );
try
{
- if ( handle == null )
- return null;
- Binding result = new Binding( handle.getName( ) );
+
if ( handle.getExpression( ) != null )
{
ScriptExpression expr = this.adaptExpression( (Expression) handle.getExpressionProperty( org.eclipse.birt.report.model.api.elements.structures.ComputedColumn.EXPRESSION_MEMBER )
@@ -371,10 +374,10 @@ public class ModelAdapter implements IModelAdapter
: this.adaptExpression( (Expression) handle.getExpressionProperty( org.eclipse.birt.report.model.api.elements.structures.ComputedColumn.FILTER_MEMBER )
.getValue( ),
DesignChoiceConstants.COLUMN_DATA_TYPE_BOOLEAN ) );
- populateArgument( result, handle );
+
populateAggregateOns( result, handle );
- return result;
+
}
catch ( Exception e )
{
@@ -382,6 +385,9 @@ public class ModelAdapter implements IModelAdapter
return null;
}
+ populateArgument(result, handle);
+
+ return result;
}
@@ -873,7 +879,13 @@ public class ModelAdapter implements IModelAdapter
try
{
Expression expr = (Expression)arg.getExpressionProperty( AggregationArgument.VALUE_MEMBER ).getValue( );
- binding.addArgument( this.adaptExpression( expr ));
+ ScriptExpression scriptExpression = this.adaptExpression( expr );
+ if ( "bre".equals( expr.getType( ) ) && scriptExpression == null )
+ throw new AdapterException(Message.formatMessage(
+ ResourceConstants.INVALID_BINDING_EXPRESSION,
+ new Object[] { expr.getStringExpression() } ) );
+ else
+ binding.addArgument(scriptExpression);
}
catch ( DataException e )
{
@@ -923,6 +935,10 @@ public class ModelAdapter implements IModelAdapter
jsExpr.setConstantValue( expr.getExpression( ) );
return jsExpr;
}
+ else if ( "bre".equals( expr.getType( ) ) )
+ {
+ return null;
+ }
else
{
if ( expr.getStringExpression( ) == null )