Skip to content

Commit

Permalink
Merge pull request eclipse-birt#282 from FreemanZhang/master
Browse files Browse the repository at this point in the history
support getParentQuery inside nested xtab
  • Loading branch information
greatyan committed Mar 5, 2016
2 parents 46c10f8 + 0937eb7 commit f340456
Showing 3 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -19,14 +19,15 @@
import java.util.List;
import java.util.Map;


import org.eclipse.birt.data.engine.api.IBaseExpression;
import org.eclipse.birt.data.engine.api.IBaseQueryDefinition;
import org.eclipse.birt.data.engine.api.IBinding;
import org.eclipse.birt.data.engine.api.IDataQueryDefinition;
import org.eclipse.birt.data.engine.api.IQueryDefinition;
import org.eclipse.birt.data.engine.api.IQueryExecutionHints;
import org.eclipse.birt.data.engine.core.DataException;
import org.eclipse.birt.data.engine.i18n.ResourceConstants;
import org.eclipse.birt.data.engine.olap.impl.query.CubeQueryDefinition;


/**
@@ -39,6 +40,7 @@ abstract public class BaseQueryDefinition extends BaseTransform implements IBase
{
protected List groups = new ArrayList();
protected boolean hasDetail = true;
private IDataQueryDefinition parentDataQuery; // parent query for nest inside xtab
protected IBaseQueryDefinition parentQuery;
protected int maxRowCount = 0;
protected int startingRow = 0;
@@ -56,9 +58,19 @@ abstract public class BaseQueryDefinition extends BaseTransform implements IBase
/**
* Constructs an instance with parent set to the specified <code>BaseQueryDefinition</code>
*/
BaseQueryDefinition( IBaseQueryDefinition parent )
BaseQueryDefinition( IDataQueryDefinition parent )
{
parentQuery = parent;
/*
* original implemenetation doesn't support nest query in Xtab. Add a new
* API to return parent XTAB but keep current API unchanged.
*
* TODO: need merge those two API as a single one.
*/
this.parentDataQuery = parent;
if ( parent instanceof IBaseQueryDefinition) {
this.parentQuery = (IBaseQueryDefinition)parent;
}

}

/**
@@ -113,6 +125,17 @@ public IBaseQueryDefinition getParentQuery()
return parentQuery;
}

/**
* Returns the parent query. The parent query is the outer query which encloses
* this query.
*
* if the parent is XTAB query, it will return null. Call getParentDataQuery instead for this case.
*/
public IDataQueryDefinition getParentDataQuery()
{
return parentDataQuery;
}

/**
* Gets the maximum number of detail rows that can be retrieved by this report query
* @return Maximum number of rows. If 0, there is no limit on how many rows this query can retrieve.
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@

import org.eclipse.birt.data.engine.api.IBaseLinkDefinition;
import org.eclipse.birt.data.engine.api.IBaseQueryDefinition;
import org.eclipse.birt.data.engine.api.IDataQueryDefinition;
import org.eclipse.birt.data.engine.api.IQueryDefinition;


@@ -64,7 +65,7 @@ public QueryDefinition( boolean autoBinding )
* can be another query, or a sub query.
* @param parent The outer query or subquery
*/
public QueryDefinition( IBaseQueryDefinition parent)
public QueryDefinition( IDataQueryDefinition parent)
{
super(parent);
}
@@ -74,7 +75,7 @@ public QueryDefinition( IBaseQueryDefinition parent)
* @param parent
* @param autoBinding
*/
public QueryDefinition( IBaseQueryDefinition parent, boolean autoBinding )
public QueryDefinition( IDataQueryDefinition parent, boolean autoBinding )
{
super( parent );
this.autoBinding = autoBinding;
Original file line number Diff line number Diff line change
@@ -1404,12 +1404,8 @@ protected IDataQueryDefinition createQuery( ReportItemDesign item,
}
// The report item has a data set definition, must create a query
// for it.
BaseQueryDefinition parentQuery = null;
if ( parent instanceof BaseQueryDefinition )
{
parentQuery = (BaseQueryDefinition) parent;
}
QueryDefinition query = new QueryDefinition( parentQuery );

QueryDefinition query = new QueryDefinition( parent );
query.setDataSetName( dsHandle.getQualifiedName( ) );

// set max rows

0 comments on commit f340456

Please sign in to comment.