com.atlassian.jira.jql.operand
Class DefaultJqlOperandResolver

java.lang.Object
  extended by com.atlassian.jira.jql.operand.DefaultJqlOperandResolver
All Implemented Interfaces:
JqlOperandResolver

@InjectableComponent
public final class DefaultJqlOperandResolver
extends Object
implements JqlOperandResolver

Default implementation of the JqlOperandResolver interface.

Since:
v4.0

Constructor Summary
DefaultJqlOperandResolver(JqlFunctionHandlerRegistry registry, I18nHelper.BeanFactory factory, QueryCache queryCache)
           
 
Method Summary
 QueryLiteral getSingleValue(com.atlassian.crowd.embedded.api.User user, Operand operand, TerminalClause clause)
          Returns the single value contained within the passed operand.
 List<QueryLiteral> getValues(QueryCreationContext queryCreationContext, Operand operand, TerminalClause terminalClause)
          Return the values contained within the passed operand.
 List<QueryLiteral> getValues(com.atlassian.crowd.embedded.api.User searcher, Operand operand, TerminalClause terminalClause)
          Return the values contained within the passed operand.
 boolean isEmptyOperand(Operand operand)
          Returns true if the operand represents an EMPTY operand.
 boolean isFunctionOperand(Operand operand)
          Returns true if the passed operand is a function call.
 boolean isListOperand(Operand operand)
          Returns true if the passed operand returns a list of values.
 boolean isValidOperand(Operand operand)
          Returns true if the operand is one which is known about.
 FunctionOperand sanitiseFunctionOperand(com.atlassian.crowd.embedded.api.User searcher, FunctionOperand funcOperand)
          Sanitise a function operand for the specified user, so that information is not leaked.
 MessageSet validate(com.atlassian.crowd.embedded.api.User user, Operand operand, TerminalClause terminalClause)
          Validates the operand against its handler.
 MessageSet validate(com.atlassian.crowd.embedded.api.User searcher, Operand operand, WasClause clause)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJqlOperandResolver

public DefaultJqlOperandResolver(JqlFunctionHandlerRegistry registry,
                                 I18nHelper.BeanFactory factory,
                                 QueryCache queryCache)
Method Detail

getValues

public List<QueryLiteral> getValues(com.atlassian.crowd.embedded.api.User searcher,
                                    Operand operand,
                                    TerminalClause terminalClause)
Description copied from interface: JqlOperandResolver
Return the values contained within the passed operand.

Specified by:
getValues in interface JqlOperandResolver
Parameters:
searcher - the user performing the search
operand - the operand whose values should be returned. Must not be null.
terminalClause - the terminal clause that contained the operand
Returns:
a list of the values in the literal. May return null on an error.

getValues

public List<QueryLiteral> getValues(QueryCreationContext queryCreationContext,
                                    Operand operand,
                                    TerminalClause terminalClause)
Description copied from interface: JqlOperandResolver
Return the values contained within the passed operand.

Specified by:
getValues in interface JqlOperandResolver
Parameters:
queryCreationContext - the context of query creation
operand - the operand whose values should be returned. Must not be null.
terminalClause - the terminal clause that contained the operand
Returns:
a list of the values in the literal. May return null on an error.

validate

public MessageSet validate(com.atlassian.crowd.embedded.api.User user,
                           Operand operand,
                           TerminalClause terminalClause)
Description copied from interface: JqlOperandResolver
Validates the operand against its handler.

Specified by:
validate in interface JqlOperandResolver
Parameters:
user - the user who is validating. May be null.
operand - the operand to be validated. Must not be null.
terminalClause - the terminal clause that contained the operand
Returns:
a MessageSet containing any errors reported. Note: if the operand is unknown, an error message will be added to the message set returned. Never null.

validate

public MessageSet validate(com.atlassian.crowd.embedded.api.User searcher,
                           Operand operand,
                           WasClause clause)
Specified by:
validate in interface JqlOperandResolver

sanitiseFunctionOperand

public FunctionOperand sanitiseFunctionOperand(com.atlassian.crowd.embedded.api.User searcher,
                                               FunctionOperand funcOperand)
Description copied from interface: JqlOperandResolver
Sanitise a function operand for the specified user, so that information is not leaked.

Specified by:
sanitiseFunctionOperand in interface JqlOperandResolver
Parameters:
searcher - the user performing the search
funcOperand - the operand to sanitise; will only be sanitised if valid
Returns:
the sanitised operand; never null.

getSingleValue

public QueryLiteral getSingleValue(com.atlassian.crowd.embedded.api.User user,
                                   Operand operand,
                                   TerminalClause clause)
Description copied from interface: JqlOperandResolver
Returns the single value contained within the passed operand. If the operand contains more than one value, an exception is thrown.

Specified by:
getSingleValue in interface JqlOperandResolver
Parameters:
user - the user who is retrieving the values. May be null.
operand - the operand whose values should be returned. Must not be null.
clause - the terminal clause that contained the operand
Returns:
the single value present in the operand, or null if there is no value.

isEmptyOperand

public boolean isEmptyOperand(Operand operand)
Description copied from interface: JqlOperandResolver
Returns true if the operand represents an EMPTY operand.

Specified by:
isEmptyOperand in interface JqlOperandResolver
Parameters:
operand - the operand to check if it is a EMPTY operand
Returns:
true if the operand is an EMPTY operand, false otherwise.

isFunctionOperand

public boolean isFunctionOperand(Operand operand)
Description copied from interface: JqlOperandResolver
Returns true if the passed operand is a function call.

Specified by:
isFunctionOperand in interface JqlOperandResolver
Parameters:
operand - the operand to check. Cannot be null.
Returns:
true of the passed operand is a function operand, false otherwise.

isListOperand

public boolean isListOperand(Operand operand)
Description copied from interface: JqlOperandResolver
Returns true if the passed operand returns a list of values.

Specified by:
isListOperand in interface JqlOperandResolver
Parameters:
operand - the operand to check. Cannot be null.
Returns:
true if the passed operand returns a list of values or false otherwise.

isValidOperand

public boolean isValidOperand(Operand operand)
Description copied from interface: JqlOperandResolver
Returns true if the operand is one which is known about. This is:

Specified by:
isValidOperand in interface JqlOperandResolver
Parameters:
operand - the operand; cannot be null.
Returns:
true if it is known, false otherwise.


Copyright © 2002-2012 Atlassian. All Rights Reserved.