summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormianrui2012-06-25 23:34:14 (EDT)
committer mwu2012-06-25 23:34:14 (EDT)
commit9bc03585a16fa832df127b0ccd217ef9794b5e60 (patch)
treeb933dfc93ffe9773ef504320129f6ece35ed8912
parenta0a9f73e8dfddd2c4950f8ca7706e46807246c61 (diff)
downloadorg.eclipse.birt-9bc03585a16fa832df127b0ccd217ef9794b5e60.zip
org.eclipse.birt-9bc03585a16fa832df127b0ccd217ef9794b5e60.tar.gz
org.eclipse.birt-9bc03585a16fa832df127b0ccd217ef9794b5e60.tar.bz2
T49386 [BZ]Binding JointSet of scripted datasets to report element
produces invalid bindings for outputParams
-rw-r--r--UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/JointDataSetPage.java1
-rw-r--r--data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/JointDataSetParameterUtil.java13
-rw-r--r--data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/PreparedJointDataSourceQuery.java33
3 files changed, 43 insertions, 4 deletions
diff --git a/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/JointDataSetPage.java b/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/JointDataSetPage.java
index 139b590..7453b4c 100644
--- a/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/JointDataSetPage.java
+++ b/UI/org.eclipse.birt.report.designer.ui.data/src/org/eclipse/birt/report/designer/data/ui/dataset/JointDataSetPage.java
@@ -868,6 +868,7 @@ public class JointDataSetPage extends WizardPage
dataSetParameter.setAllowNull( parameter.allowNull( ) );
dataSetParameter.setDefaultValue( parameter.getDefaultValue( ) );
dataSetParameter.setIsInput( parameter.isInput( ) );
+ dataSetParameter.setIsOutput( parameter.isOutput( ) );
dataSetParameter.setName( getParameterName( dataSetName,
parameter.getName( ) ) );
dataSetParameter.setIsOptional( parameter.isOptional( ) );
diff --git a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/JointDataSetParameterUtil.java b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/JointDataSetParameterUtil.java
index 6204016..fe7739d 100644
--- a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/JointDataSetParameterUtil.java
+++ b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/JointDataSetParameterUtil.java
@@ -18,7 +18,8 @@ package org.eclipse.birt.data.engine.impl;
public class JointDataSetParameterUtil
{
private final static String seperator = "::";
-
+ private final static String PREFIX = "outputParams";
+
/**
*
* @param dataSetName
@@ -65,4 +66,14 @@ public class JointDataSetParameterUtil
return parameterName.replaceFirst( "\\Q"
+ extractDataSetName( parameterName ) + "::\\E", "" );
}
+
+ /**
+ *
+ * @param parameterName
+ * @return
+ */
+ public static String buildOutputParamsExpr( String parameterName )
+ {
+ return PREFIX+"[\"" + parameterName +"\"]";
+ }
}
diff --git a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/PreparedJointDataSourceQuery.java b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/PreparedJointDataSourceQuery.java
index 1a94936..674966b 100644
--- a/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/PreparedJointDataSourceQuery.java
+++ b/data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/impl/PreparedJointDataSourceQuery.java
@@ -20,6 +20,7 @@ import java.util.Map;
import org.eclipse.birt.core.data.DataType;
import org.eclipse.birt.core.data.ExpressionUtil;
import org.eclipse.birt.core.exception.BirtException;
+import org.eclipse.birt.core.script.JavascriptEvalUtil;
import org.eclipse.birt.data.engine.api.IBaseDataSetDesign;
import org.eclipse.birt.data.engine.api.IBaseDataSourceDesign;
import org.eclipse.birt.data.engine.api.IBaseResultMetaData;
@@ -27,6 +28,7 @@ import org.eclipse.birt.data.engine.api.IColumnDefinition;
import org.eclipse.birt.data.engine.api.IComputedColumn;
import org.eclipse.birt.data.engine.api.IJoinCondition;
import org.eclipse.birt.data.engine.api.IJointDataSetDesign;
+import org.eclipse.birt.data.engine.api.IParameterDefinition;
import org.eclipse.birt.data.engine.api.IPreparedQuery;
import org.eclipse.birt.data.engine.api.IQueryDefinition;
import org.eclipse.birt.data.engine.api.IQueryResults;
@@ -52,10 +54,11 @@ import org.eclipse.birt.data.engine.impl.jointdataset.JointResultMetadata;
import org.eclipse.birt.data.engine.odi.IDataSetPopulator;
import org.eclipse.birt.data.engine.odi.IDataSource;
import org.eclipse.birt.data.engine.odi.IEventHandler;
-import org.eclipse.birt.data.engine.odi.IPreparedDSQuery;
import org.eclipse.birt.data.engine.odi.IQuery;
import org.eclipse.birt.data.engine.odi.IResultClass;
import org.eclipse.birt.data.engine.odi.IResultObjectEvent;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Scriptable;
/**
* This is an extension of PreparedDataSourceQuery. It is used to provide joint
@@ -632,11 +635,12 @@ public class PreparedJointDataSourceQuery extends PreparedDataSourceQuery
dscm.setDataSourceAndDataSet(
leftDataSourceDesign, leftDataSetDesgin, leftParameterHints, leftAppContext );
left = (ResultIterator) leftQueryResults.getResultIterator( );
-
+ registerOutputParams( leftDataSetDesgin, left.getScope( ) );
+
dscm.setDataSourceAndDataSet(
rightDataSourceDesign, rightDataSetDesgin, rightParameterHints, rightAppContext );
right = (ResultIterator) rightQueryResults.getResultIterator( );
-
+ registerOutputParams( rightDataSetDesgin, right.getScope( ) );
}
catch ( BirtException e )
{
@@ -686,6 +690,29 @@ public class PreparedJointDataSourceQuery extends PreparedDataSourceQuery
return obList;
}
+ private void registerOutputParams( IBaseDataSetDesign dataSetDesign, Scriptable scope ) throws BirtException
+ {
+ String dataSetName= dataSetDesign.getName( );
+ for ( int i = 0; i < dataSetDesign.getParameters( ).size( ); i++ )
+ {
+ if ( ( (IParameterDefinition) dataSetDesign.getParameters( )
+ .get( i ) ).isOutputMode( ) )
+ {
+ String paramName = ( (IParameterDefinition) dataSetDesign.getParameters( )
+ .get( i ) ).getName( );
+ String joinname = JointDataSetParameterUtil.getParameterName( dataSetName,
+ paramName );
+ Object value = JavascriptEvalUtil.evaluateRawScript( Context.getCurrentContext( ),
+ scope,
+ JointDataSetParameterUtil.buildOutputParamsExpr( paramName ),
+ "",
+ 1 );
+ dataSet.setOutputParameterValue( joinname, value );
+ }
+ }
+
+ }
+
/**
* @return
* @throws DataException