Map map = baseQueryDefn.getResultSetExpressions( ); if ( map != null ) { Iterator it = map.keySet( ).iterator( ); while ( it.hasNext( ) ) { Object key = it.next( ); IBaseExpression icbe = (IBaseExpression) map.get( key ); if ( ( !icbe.getGroupName( ) .equals( IBaseExpression.GROUP_OVERALL ) ) && !groupNameSet.contains( icbe.getGroupName( ) ) ) { throw new DataException( ResourceConstants.GROUP_NOT_EXIST, new Object[]{ icbe.getGroupName( ), key } ); } } }
	private void prepare( ) throws DataException	{	    // TODO - validation of static queryDefn		Context cx = Context.enter();				try		{			// Prepare all groups; note that the report query iteself			// is treated as a group (with group level 0 ), If there are group			// definitions that of invalid or duplicate group name, then throw			// exceptions.						if ( this.baseQueryDefn.getResultSetExpressions( ) != null					&& this.baseQueryDefn.getResultSetExpressions( ).size( ) > 0 )			{				this.expressionCompiler.setDataSetMode( false );			}						List groups = baseQueryDefn.getGroups( );			IGroupDefinition group;			for ( int i = 0; i < groups.size( ); i++ )			{				group = (IGroupDefinition) groups.get( i );				if ( group.getName( ) == null						|| group.getName( ).trim( ).length( ) == 0 )					continue;				for ( int j = 0; j < groups.size( ); j++ )				{					if ( group.getName( )							.equals( ( (IGroupDefinition) groups.get( j ) ).getName( ) == null									? ""									: ( (IGroupDefinition) groups.get( j ) ).getName( ) )							&& j != i )						throw new DataException( ResourceConstants.DUPLICATE_GROUP_NAME );				}			}						for ( int i = 0; i <= groups.size( ); i++ )			{				prepareGroup( baseQueryDefn, i, cx );			}		}		finally		{		    Context.exit();		}	}