Bug 182895 Support sort on Level attribute.
Currently in OLAP engine we only support sort on level key value. We should go ahead to support sort on level attribute value.
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/olap/data/impl/aggregation/sort/AggregationSortHelper.java
private List keys;
	AggrResultRowComparator( List keys )
	{
		this.keys = keys;
	}
	public int compare( Object arg0, Object arg1 )
	{
		IAggregationResultRow obj1 = (IAggregationResultRow) arg0;
		IAggregationResultRow obj2 = (IAggregationResultRow) arg1;
		List keyValue1 = new ArrayList( );
		List keyValue2 = new ArrayList( );
		int offset = 0;
		for ( int i = 0; i < keys.size( ); i++ )
		{
			SortKey sk = (SortKey) keys.get( i );
			for ( int j = 0; j < sk.getAggrKeys( ).length; j++ )
			{
				keyValue1.add( obj1.getAggregationValues( )[offset+j] );
				keyValue2.add( obj2.getAggregationValues( )[offset+j] );
			}
			keyValue1.add( obj1.getLevelMembers( )[sk.getLevelKeyIndex( )].getKeyValues( )[0] );
			keyValue2.add( obj2.getLevelMembers( )[sk.getLevelKeyIndex( )].getKeyValues( )[0] );
			offset = sk.getAggrKeys( ).length;
		}
		return CompareUtil.compare( AggregationSortHelper.toObjArray( keyValue1 ),
				AggregationSortHelper.toObjArray( keyValue2 ),
				AggregationSortHelper.toDirectionArray( this.keys ) );
	}
}