/***********************************************************************
 * Copyright (c) 2004 Actuate Corporation.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Actuate Corporation - initial API and implementation
 ***********************************************************************/

package org.eclipse.birt.chart.reportitem;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.model.Chart;
import org.eclipse.birt.chart.model.ChartWithAxes;
import org.eclipse.birt.chart.model.ChartWithoutAxes;
import org.eclipse.birt.chart.model.component.Axis;
import org.eclipse.birt.chart.model.component.Series;
import org.eclipse.birt.chart.model.data.Query;
import org.eclipse.birt.chart.model.data.SeriesDefinition;
import org.eclipse.birt.chart.reportitem.i18n.Messages;
import org.eclipse.birt.data.engine.api.IBaseQueryDefinition;
import org.eclipse.birt.data.engine.api.IConditionalExpression;
import org.eclipse.birt.data.engine.api.IFilterDefinition;
import org.eclipse.birt.data.engine.api.querydefn.BaseQueryDefinition;
import org.eclipse.birt.data.engine.api.querydefn.ConditionalExpression;
import org.eclipse.birt.data.engine.api.querydefn.FilterDefinition;
import org.eclipse.birt.data.engine.api.querydefn.InputParameterBinding;
import org.eclipse.birt.data.engine.api.querydefn.QueryDefinition;
import org.eclipse.birt.data.engine.api.querydefn.ScriptExpression;
import org.eclipse.birt.data.engine.api.querydefn.SubqueryDefinition;
import org.eclipse.birt.report.engine.adapter.ModelDteApiAdapter;
import org.eclipse.birt.report.model.api.ComputedColumnHandle;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.ExtendedItemHandle;
import org.eclipse.birt.report.model.api.FilterConditionHandle;
import org.eclipse.birt.report.model.api.ParamBindingHandle;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.emf.common.util.EList;

/**
 * This class is responsible for building chart queries that may be subsequently
 * executed using the 'Data Engine' service. In addition, this class is also
 * responsible for binding the results into dynamically created chart runtime
 * series. Several methods in this class are overloaded to handle chart types
 * with and without axes.
 */
public final class QueryHelper
{

	/**
	 * 
	 */
	private static final String BASE_SERIES = Messages.getString( "QueryHelper.Text.CategroySeries" ); //$NON-NLS-1$

	/**
	 * 
	 */
	private static final String ORTHOGONAL_SERIES = Messages.getString( "QueryHelper.Text.ValueSeries" ); //$NON-NLS-1$

	/**
	 * 
	 */
	private static final String X_SERIES = Messages.getString( "QueryHelper.Text.XSeries" ); //$NON-NLS-1$

	/**
	 * 
	 */
	private static final String Y_SERIES = Messages.getString( "QueryHelper.Text.YSeries" ); //$NON-NLS-1$

	/**
	 * 
	 */
	public static final String[] CAST_STRING_ARRAY = new String[0];

	/**
	 * Delegation
	 * 
	 * @param eih
	 * @param ibqdParent
	 * @param cm
	 * 
	 * @throws ChartException
	 */
	final IBaseQueryDefinition build( ExtendedItemHandle eih,
			IBaseQueryDefinition ibqdParent, Chart cm ) throws ChartException
	{
		IBaseQueryDefinition ibqd = null;

		if ( eih.getDataSet( ) == null )
		{
			ibqd = new SubqueryDefinition( "chart_subquery" ); //$NON-NLS-1$
			// WHAT ARE THE
			// RULES FOR THE
			// SUB-QUERY
			// NAME?
		}
		else
		{
			ibqd = new QueryDefinition( (BaseQueryDefinition) ibqdParent );
		}

		// ADD ALL REQUIRED EXPRESSIONS
		final DataSetHandle dsh = eih.getDataSet( );
		if ( dsh != null )
		{
			if ( ibqd instanceof QueryDefinition )
			{
				( (QueryDefinition) ibqd ).setDataSetName( dsh.getQualifiedName( ) );
				fillParamBindings( eih, (QueryDefinition) ibqd );
				addFilters( eih, (QueryDefinition) ibqd );
			}
		}

		// ScriptExpression sxp;
		// IActionEvaluator iae = new BIRTActionEvaluator( );

		// add column bindings
		for ( Iterator itr = eih.getColumnBindings( ).iterator( ); itr.hasNext( ); )
		{
			ComputedColumnHandle cch = (ComputedColumnHandle) itr.next( );

			ScriptExpression sxp = new ScriptExpression( cch.getExpression( ) );
			sxp.setDataType( ModelDteApiAdapter.toDteDataType( cch.getDataType( ) ) );

			if ( ibqd instanceof QueryDefinition )
			{
				( (QueryDefinition) ibqd ).addResultSetExpression( cch.getName( ),
						sxp );
			}
			else if ( ibqd instanceof SubqueryDefinition )
			{
				( (SubqueryDefinition) ibqd ).addResultSetExpression( cch.getName( ),
						sxp );
			}
		}

		// // add data row expressions.
		// List alExpressions = Generator.instance( ).getRowExpressions( cm, iae
		// );
		// for ( int i = 0; i < alExpressions.size( ); i++ )
		// {
		// sxp = new ScriptExpression( (String) alExpressions.get( i ) );
		// if ( ibqd instanceof QueryDefinition )
		// {
		// ( (QueryDefinition) ibqd ).addResultSetExpression( sxp.getText( ),
		// sxp );
		// }
		// else if ( ibqd instanceof SubqueryDefinition )
		// {
		// ( (SubqueryDefinition) ibqd ).addResultSetExpression( sxp.getText( ),
		// sxp );
		// }
		// }
		//
		// // add non-datarow expressions.
		// String[] nonDataExpressions = getNonDataRowExpressions( cm, iae );
		// if ( nonDataExpressions != null )
		// {
		// for ( int i = 0; i < nonDataExpressions.length; i++ )
		// {
		// sxp = new ScriptExpression( nonDataExpressions[i] );
		// if ( ibqd instanceof QueryDefinition )
		// {
		// ( (QueryDefinition) ibqd ).addResultSetExpression( sxp.getText( ),
		// sxp );
		// }
		// else if ( ibqd instanceof SubqueryDefinition )
		// {
		// ( (SubqueryDefinition) ibqd ).addResultSetExpression( sxp.getText( ),
		// sxp );
		// }
		// }
		// }

		return ibqd;
	}

	// final String[] getNonDataRowExpressions( Chart cm, IActionEvaluator iae )
	// {
	// ArrayList rt = new ArrayList( );
	//
	// if ( cm != null )
	// {
	// // get chart title area triggers.
	// EList triggers = cm.getTitle( ).getTriggers( );
	// for ( Iterator itr = triggers.iterator( ); itr.hasNext( ); )
	// {
	// Trigger tg = (Trigger) itr.next( );
	//
	// String[] expra = iae.getActionExpressions( tg.getAction( ),
	// StructureSource.createTitle( cm.getTitle( ) ) );
	//
	// if ( expra != null && expra.length > 0 )
	// {
	// for ( int i = 0; i < expra.length; i++ )
	// {
	// String expr = expra[i];
	// if ( expr != null
	// && expr.trim( ).length( ) > 0
	// && !rt.contains( expr ) )
	// {
	// rt.add( expr );
	// }
	// }
	// }
	// }
	//
	// // get chart block area triggers.
	// triggers = cm.getBlock( ).getTriggers( );
	// for ( Iterator itr = triggers.iterator( ); itr.hasNext( ); )
	// {
	// Trigger tg = (Trigger) itr.next( );
	//
	// String[] expra = iae.getActionExpressions( tg.getAction( ),
	// StructureSource.createChartBlock( cm.getBlock( ) ) );
	//
	// if ( expra != null && expra.length > 0 )
	// {
	// for ( int i = 0; i < expra.length; i++ )
	// {
	// String expr = expra[i];
	// if ( expr != null
	// && expr.trim( ).length( ) > 0
	// && !rt.contains( expr ) )
	// {
	// rt.add( expr );
	// }
	// }
	// }
	// }
	//
	// // get chart legend area triggers.
	// triggers = cm.getLegend( ).getTriggers( );
	// for ( Iterator itr = triggers.iterator( ); itr.hasNext( ); )
	// {
	// Trigger tg = (Trigger) itr.next( );
	//
	// String[] expra = iae.getActionExpressions( tg.getAction( ),
	// StructureSource.createLegend( cm.getLegend( ) ) );
	//
	// if ( expra != null && expra.length > 0 )
	// {
	// for ( int i = 0; i < expra.length; i++ )
	// {
	// String expr = expra[i];
	// if ( expr != null
	// && expr.trim( ).length( ) > 0
	// && !rt.contains( expr ) )
	// {
	// rt.add( expr );
	// }
	// }
	// }
	// }
	//
	// // get chart axes and marker line/range triggers.
	// if ( cm instanceof ChartWithAxes )
	// {
	// ChartWithAxes cwa = (ChartWithAxes) cm;
	//
	// Axis primaryBaseAxis = cwa.getBaseAxes( )[0];
	//
	// addTriggerExpressions( primaryBaseAxis, iae, rt );
	//
	// for ( Iterator itr = primaryBaseAxis.getAssociatedAxes( )
	// .iterator( ); itr.hasNext( ); )
	// {
	// Axis orthogonalAxis = (Axis) itr.next( );
	//
	// addTriggerExpressions( orthogonalAxis, iae, rt );
	// }
	//
	// if ( cwa.getDimension( ) == ChartDimension.THREE_DIMENSIONAL_LITERAL )
	// {
	// for ( Iterator itr = primaryBaseAxis.getAncillaryAxes( )
	// .iterator( ); itr.hasNext( ); )
	// {
	// Axis ancillaryAxis = (Axis) itr.next( );
	//
	// addTriggerExpressions( ancillaryAxis, iae, rt );
	// }
	// }
	// }
	// }
	//
	// if ( rt.size( ) > 0 )
	// {
	// return (String[]) rt.toArray( new String[0] );
	// }
	// return null;
	//
	// }

	// private void addTriggerExpressions( Axis ax, IActionEvaluator iae,
	// List expList )
	// {
	// EList triggers = ax.getTriggers( );
	// for ( Iterator itr = triggers.iterator( ); itr.hasNext( ); )
	// {
	// Trigger tg = (Trigger) itr.next( );
	//
	// String[] expra = iae.getActionExpressions( tg.getAction( ),
	// StructureSource.createAxis( ax ) );
	//
	// if ( expra != null && expra.length > 0 )
	// {
	// for ( int i = 0; i < expra.length; i++ )
	// {
	// String expr = expra[i];
	// if ( expr != null
	// && expr.trim( ).length( ) > 0
	// && !expList.contains( expr ) )
	// {
	// expList.add( expr );
	// }
	// }
	// }
	// }
	//
	// EList markerLines = ax.getMarkerLines( );
	// MarkerLine ml;
	// for ( Iterator itr = markerLines.iterator( ); itr.hasNext( ); )
	// {
	// ml = (MarkerLine) itr.next( );
	// triggers = ml.getTriggers( );
	// for ( Iterator sitr = triggers.iterator( ); sitr.hasNext( ); )
	// {
	// Trigger tg = (Trigger) sitr.next( );
	//
	// String[] expra = iae.getActionExpressions( tg.getAction( ),
	// StructureSource.createMarkerLine( ml ) );
	//
	// if ( expra != null && expra.length > 0 )
	// {
	// for ( int i = 0; i < expra.length; i++ )
	// {
	// String expr = expra[i];
	// if ( expr != null
	// && expr.trim( ).length( ) > 0
	// && !expList.contains( expr ) )
	// {
	// expList.add( expr );
	// }
	// }
	// }
	// }
	// }
	//
	// EList markerRanges = ax.getMarkerRanges( );
	// MarkerRange mr;
	// for ( Iterator itr = markerRanges.iterator( ); itr.hasNext( ); )
	// {
	// mr = (MarkerRange) itr.next( );
	// triggers = mr.getTriggers( );
	// for ( Iterator sitr = triggers.iterator( ); sitr.hasNext( ); )
	// {
	// Trigger tg = (Trigger) sitr.next( );
	//
	// String[] expra = iae.getActionExpressions( tg.getAction( ),
	// StructureSource.createMarkerRange( mr ) );
	//
	// if ( expra != null && expra.length > 0 )
	// {
	// for ( int i = 0; i < expra.length; i++ )
	// {
	// String expr = expra[i];
	// if ( expr != null
	// && expr.trim( ).length( ) > 0
	// && !expList.contains( expr ) )
	// {
	// expList.add( expr );
	// }
	// }
	// }
	// }
	// }
	// }

	/**
	 * 
	 * @param cm
	 */
	public final SeriesQueries[] getSeriesQueryDefinitions( Chart cm )
	{
		if ( cm instanceof ChartWithAxes )
		{
			return getSeriesQueryDefinitions( (ChartWithAxes) cm );
		}
		else if ( cm instanceof ChartWithoutAxes )
		{
			return getSeriesQueryDefinitions( (ChartWithoutAxes) cm );
		}
		return null;
	}

	/**
	 * 
	 * @param cwa
	 */
	final SeriesQueries[] getSeriesQueryDefinitions( ChartWithAxes cwa )
	{
		final ArrayList alSeriesQueries = new ArrayList( 4 );
		final Axis axPrimaryBase = cwa.getPrimaryBaseAxes( )[0];
		EList elSD = axPrimaryBase.getSeriesDefinitions( );
		if ( elSD.size( ) != 1 )
		{
			return (SeriesQueries[]) alSeriesQueries.toArray( new SeriesQueries[alSeriesQueries.size( )] );
		}

		// DON'T CARE ABOUT THE EXPRESSION ASSOCIATED WITH THE BASE SERIES
		// DEFINITION
		SeriesDefinition sd = (SeriesDefinition) elSD.get( 0 ); // ONLY ONE MUST
		// EXIST

		// PROJECT THE QUERY ASSOCIATED WITH THE BASE SERIES EXPRESSION
		final Series seBase = sd.getDesignTimeSeries( );
		EList elBaseSeries = seBase.getDataDefinition( );
		Query[] qua = new Query[elBaseSeries.size( )];
		SeriesQueries sqd = new SeriesQueries( X_SERIES, qua );
		for ( int i = 0; i < elBaseSeries.size( ); i++ )
		{
			qua[i] = (Query) elBaseSeries.get( i );
		}
		alSeriesQueries.add( sqd );

		// PROJECT ALL DATA DEFINITIONS ASSOCIATED WITH THE ORTHOGONAL SERIES'
		// QUERIES
		Series seOrthogonal;
		EList elOrthogonalSeries;
		final Axis[] axaOrthogonal = cwa.getOrthogonalAxes( axPrimaryBase, true );
		for ( int j = 0; j < axaOrthogonal.length; j++ )
		{
			elSD = axaOrthogonal[j].getSeriesDefinitions( ); // DON'T CARE
			// ABOUT
			// SERIES
			// DEFINITION
			// QUERIES
			for ( int k = 0; k < elSD.size( ); k++ )
			{
				sd = (SeriesDefinition) elSD.get( k );
				seOrthogonal = sd.getDesignTimeSeries( );
				elOrthogonalSeries = seOrthogonal.getDataDefinition( );
				qua = new Query[elOrthogonalSeries.size( )];
				sqd = new SeriesQueries( Y_SERIES, qua );
				for ( int i = 0; i < elOrthogonalSeries.size( ); i++ )
				{
					qua[i] = (Query) elOrthogonalSeries.get( i );
				}
				alSeriesQueries.add( sqd );
			}
		}
		return (SeriesQueries[]) alSeriesQueries.toArray( new SeriesQueries[alSeriesQueries.size( )] );
	}

	/**
	 * 
	 * @param cwoa
	 */
	final SeriesQueries[] getSeriesQueryDefinitions( ChartWithoutAxes cwoa )
	{
		final ArrayList alSeriesQueries = new ArrayList( 4 );
		EList elSD = cwoa.getSeriesDefinitions( );
		if ( elSD.size( ) != 1 )
		{
			return (SeriesQueries[]) alSeriesQueries.toArray( new SeriesQueries[alSeriesQueries.size( )] );
		}

		// DON'T CARE ABOUT THE EXPRESSION ASSOCIATED WITH THE BASE SERIES
		// DEFINITION
		SeriesDefinition sd = (SeriesDefinition) elSD.get( 0 );

		// PROJECT THE QUERY ASSOCIATED WITH THE BASE SERIES EXPRESSION
		final Series seBase = sd.getDesignTimeSeries( );
		EList elBaseSeries = seBase.getDataDefinition( );
		Query[] qua = new Query[elBaseSeries.size( )];
		SeriesQueries sqd = new SeriesQueries( BASE_SERIES, qua );
		for ( int i = 0; i < elBaseSeries.size( ); i++ )
		{
			qua[i] = (Query) elBaseSeries.get( i );
		}
		alSeriesQueries.add( sqd );

		// PROJECT ALL DATA DEFINITIONS ASSOCIATED WITH THE ORTHOGONAL SERIES
		Series seOrthogonal;
		EList elOrthogonalSeries;
		elSD = sd.getSeriesDefinitions( ); // ALL ORTHOGONAL SERIES DEFINITIONS
		for ( int k = 0; k < elSD.size( ); k++ )
		{
			sd = (SeriesDefinition) elSD.get( k );
			seOrthogonal = sd.getDesignTimeSeries( );
			elOrthogonalSeries = seOrthogonal.getDataDefinition( );
			qua = new Query[elOrthogonalSeries.size( )];
			sqd = new SeriesQueries( ORTHOGONAL_SERIES, qua );
			for ( int i = 0; i < elOrthogonalSeries.size( ); i++ )
			{
				qua[i] = (Query) elOrthogonalSeries.get( i );
			}
			alSeriesQueries.add( sqd );
		}
		return (SeriesQueries[]) alSeriesQueries.toArray( new SeriesQueries[alSeriesQueries.size( )] );
	}

	/**
	 * Add the input parameter bindings to the query definition
	 */
	protected void fillParamBindings( ExtendedItemHandle eih,
			QueryDefinition queryDef )
	{
		for ( Iterator iterator = eih.paramBindingsIterator( ); iterator.hasNext( ); )
		{
			ParamBindingHandle paramBinding = (ParamBindingHandle) iterator.next( );
			ScriptExpression paramValueExpr = new ScriptExpression( paramBinding.getExpression( ) );
			InputParameterBinding inputParamBinding = new InputParameterBinding( paramBinding.getParamName( ),
					paramValueExpr );
			queryDef.addInputParamBinding( inputParamBinding );
		}
	}

	/**
	 * Add filters to the query definition
	 */
	protected void addFilters( ExtendedItemHandle eih, QueryDefinition queryDef )
	{
		// Set filters
		Iterator filtersIter = eih.getPropertyHandle( ExtendedItemHandle.FILTER_PROP )
				.iterator( );
		while ( filtersIter.hasNext( ) )
		{
			FilterConditionHandle filterCon = (FilterConditionHandle) filtersIter.next( );
			queryDef.addFilter( createFilter( filterCon ) );
		}
	}

	/**
	 * SeriesQueries
	 */
	public static final class SeriesQueries
	{

		/**
		 * 
		 */
		private final String sSeriesType;

		/**
		 * 
		 */
		private final Query[] qua;

		/**
		 * 
		 * @param sSeriesType
		 * @param qua
		 */
		SeriesQueries( String sSeriesType, Query[] qua )
		{
			this.sSeriesType = sSeriesType;
			this.qua = qua;
		}

		public Collection validate( )
		{
			ArrayList al = null;
			for ( int i = 0; i < qua.length; i++ )
			{
				if ( !qua[i].isDefined( ) )
				{
					if ( al == null )
					{
						al = new ArrayList( qua.length );
					}
					al.add( Messages.getString( "SeriesQueries.dataDefnUndefined", sSeriesType ) ); //$NON-NLS-1$
				}
			}
			if ( qua.length == 0 )
			{
				al = new ArrayList( qua.length );
				al.add( Messages.getString( "SeriesQueries.NoDataDefinitionFor", sSeriesType ) ); //$NON-NLS-1$
			}
			return al;
		}
	}

	/**
	 * create one Filter given a filter condition handle
	 * 
	 * @param handle
	 *            a filter condition handle
	 * @return the filter
	 */
	private IFilterDefinition createFilter( FilterConditionHandle handle )
	{
		String filterExpr = handle.getExpr( );
		if ( filterExpr == null || filterExpr.length( ) == 0 )
			// no filter defined
			return null;

		// converts to DtE exprFilter if there is no operator
		String filterOpr = handle.getOperator( );
		if ( filterOpr == null || filterOpr.length( ) == 0 )
			return new FilterDefinition( new ScriptExpression( filterExpr ) );

		/*
		 * has operator defined, try to convert filter condition to
		 * operator/operand style column filter with 0 to 2 operands
		 */

		String column = filterExpr;
		int dteOpr = toDteFilterOperator( filterOpr );
		String operand1 = handle.getValue1( );
		String operand2 = handle.getValue2( );
		return new FilterDefinition( new ConditionalExpression( column,
				dteOpr,
				operand1,
				operand2 ) );
	}

	/**
	 * converts model operator values to DtE IColumnFilter enum values
	 */
	private int toDteFilterOperator( String modelOpr )
	{
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_EQ ) )
			return IConditionalExpression.OP_EQ;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_NE ) )
			return IConditionalExpression.OP_NE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_LT ) )
			return IConditionalExpression.OP_LT;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_LE ) )
			return IConditionalExpression.OP_LE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_GE ) )
			return IConditionalExpression.OP_GE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_GT ) )
			return IConditionalExpression.OP_GT;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_BETWEEN ) )
			return IConditionalExpression.OP_BETWEEN;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_NOT_BETWEEN ) )
			return IConditionalExpression.OP_NOT_BETWEEN;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_NULL ) )
			return IConditionalExpression.OP_NULL;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_NOT_NULL ) )
			return IConditionalExpression.OP_NOT_NULL;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_TRUE ) )
			return IConditionalExpression.OP_TRUE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_FALSE ) )
			return IConditionalExpression.OP_FALSE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_LIKE ) )
			return IConditionalExpression.OP_LIKE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_TOP_N ) )
			return IConditionalExpression.OP_TOP_N;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_BOTTOM_N ) )
			return IConditionalExpression.OP_BOTTOM_N;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_TOP_PERCENT ) )
			return IConditionalExpression.OP_TOP_PERCENT;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_BOTTOM_PERCENT ) )
			return IConditionalExpression.OP_BOTTOM_PERCENT;
		/*
		 * if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_ANY ) )
		 * return IConditionalExpression.OP_ANY;
		 */
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_MATCH ) )
			return IConditionalExpression.OP_MATCH;

		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_NOT_LIKE ) )
			return IConditionalExpression.OP_NOT_LIKE;
		if ( modelOpr.equals( DesignChoiceConstants.FILTER_OPERATOR_NOT_MATCH ) )
			return IConditionalExpression.OP_NOT_MATCH;
		return IConditionalExpression.OP_NONE;
	}

}