Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made changes to return correct arguments in Binding. #445

Merged
merged 1 commit into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public Binding( String name, IBaseExpression expr )
this.expr = expr;
this.aggregateOn = new ArrayList<String>();
this.argument = new LinkedHashMap<String, IBaseExpression>();
this.orderedArgument = new ArrayList<IBaseExpression>();
if ( expr != null )
this.dataType = expr.getDataType( );
else
Expand All @@ -78,10 +77,17 @@ public void addAggregateOn( String levelName ) throws DataException
* (non-Javadoc)
* @see org.eclipse.birt.data.engine.api.IBinding#addArgument(org.eclipse.birt.data.engine.api.IBaseExpression)
*/
@Deprecated
public void addArgument( IBaseExpression expr )
{
if( expr!= null )
if ( expr != null )
{
if ( orderedArgument == null )
{
orderedArgument = new ArrayList<IBaseExpression>( );
}
this.orderedArgument.add( expr );
}

}

Expand All @@ -95,6 +101,15 @@ public void addArgument( String name, IBaseExpression expr )
{
this.argument.put( name, expr );
}
// orderedArgument list needs to be regenerated
orderedArgument = null;
}

public void removeArgument(IBaseExpression expr)
{
this.argument.values().remove( expr );
// orderedArgument list needs to be regenerated
orderedArgument = null;
}

/*
Expand All @@ -121,19 +136,20 @@ public List getAggregatOns( )
*/
public List getArguments( ) throws DataException
{
if( this.aggrFunc == null )
if( this.orderedArgument != null)
// ordered list already computed;
return this.orderedArgument;

orderedArgument = new ArrayList<IBaseExpression>();

if( this.orderedArgument.size() > 0 )
if( this.aggrFunc == null )
return this.orderedArgument;

IAggrFunction info = AggregationManager.getInstance().getAggregation( this.aggrFunc );

if( info == null )
return this.orderedArgument;

IParameterDefn[] parameters = info.getParameterDefn();

if( parameters!= null )
{
for( int i = 0; i < parameters.length; i++ )
Expand Down Expand Up @@ -306,10 +322,15 @@ public IBinding clone( )
{
n.aggregateOn.add( o );
}
for ( IBaseExpression o : this.orderedArgument )

if ( orderedArgument != null )
{
n.orderedArgument.add( o );
for ( IBaseExpression o : this.orderedArgument )
{
n.orderedArgument.add( o );
}
}

for ( Map.Entry<String, IBaseExpression> o : this.argument.entrySet( ) )
{
n.argument.put( o.getKey( ), o.getValue( ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,10 @@ private String getDataSetExpr( String rowExpr ) throws DataException
Object binding = this.baseQueryDefn.getBindings( ).get( bindingName );
if( binding != null )
{
if ( ( (IBinding) binding ).getAggrFunction( ) != null )
{
return null;
}
IBaseExpression expr = ( (IBinding) binding ).getExpression( );
if( expr != null && expr instanceof IScriptExpression )
{
Expand Down