LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.info
Class LyFilterExpression

java.lang.Object
  extended by leon.info.LyTag
      extended by leon.info.LyInfo
          extended by leon.info.LyFilterExpression
All Implemented Interfaces:
java.lang.Cloneable, LyFilterElement, LyCommentInterface

public final class LyFilterExpression
extends LyInfo
implements LyFilterElement

The LyFilterExpression class implements the description of an elementary expression applied on objects of the application. A filter expression is an expression of one elementary criterion. Filters are like a 'tree' of sub-filters AND/OR, terminated by one or several filter expressions. A complex condition (a filter) is a logical association of elementary conditions.
The structure of an elementary expression is :

See Also:
LyFilter

Nested Class Summary
static class LyFilterExpression.Condition
          Condition.
 
Nested classes/interfaces inherited from class leon.info.LyTag
LyTag.Model
 
Field Summary
static java.lang.String __VERSION
           
static short MOD_CASE_SENSITIVE
          Modifier case sensitive.
static short MOD_MULTILINGUAL
          Modifier for multilingual filtering.
static short MOD_NOT_BY_NAME
          Modifier not by name for relations.
static short MOD_PEER_FILTER_ONLY
          Modifier for a filter which applies only in peer connector.
static short MOD_RAW
          Modifier no accents.
static int RECOMPUTE_DATE_DELAY
          Recompute the _now and $xxx in filter expression every 'n' seconds. -1 means never, 0 always.
 
Constructor Summary
LyFilterExpression(LyFieldInfo fieldInfo, boolean not, LyFilterExpression.Condition condition, java.lang.Object value)
          Constructor of a filter expression.
LyFilterExpression(LyFieldInfo fieldInfo, boolean not, LyFilterExpression.Condition condition, java.lang.Object value, java.util.BitSet modifiers)
          Constructor of a filter expression.
LyFilterExpression(LyFieldInfo fieldInfo, LyFilterExpression.Condition condition, java.lang.Object value)
          Constructor of a filter expression (shortcut of the previous constructor with not set to false).
LyFilterExpression(LyFieldInfo fieldInfo, java.lang.Object value)
          Constructor of a filter expression (shortcut of the main constructor with not set to false and condition set to Condition.EQUALS).
LyFilterExpression(java.lang.String id, LyFieldInfo fieldInfo, boolean not, LyFilterExpression.Condition condition, java.lang.Object value, java.util.BitSet modifiers)
          Constructor of a filter expression.
 
Method Summary
 LyFilterExpression cloneFilterExpression()
          Clone this filter expression.
 java.lang.String dump()
          Dumps this expression as a String.
 LyFilterExpression.Condition getCondition()
          Gets the condition for the filter expression.
static java.lang.String getCondition(LyFilterExpression.Condition condition)
          Return the name corresponding to the specified condition.
static LyFilterExpression.Condition getCondition(java.lang.String conditionName)
          Return the condition corresponding to the given name.
 LyFieldInfo getFieldInfo()
          Gets the fieldInfo on which this expression applies.
 LyValue getFieldValue()
          Gets wrapped value.
 java.lang.Object getInitValue()
          Gets the initial value of this filter expression The values such as "_now" are replaced using getValue() but not in getInitValue().
static java.lang.String getModifier(short modifier)
          Return the name corresponding to the specified modifier.
static short getModifier(java.lang.String modifierName)
          Return the modifier corresponding to the given name.
 java.util.BitSet getModifiers()
          Gets modifiers of the expression.
 java.lang.String getName()
          Returns a displayable string of this expression.
static java.lang.String getNotCondition(LyFilterExpression.Condition condition)
          Return the name corresponding to the specified not condition.
 LyFilterExpression[] getPeerExpression()
           
 java.lang.Object getValue()
          Gets the value on which comparison occur.
 boolean hasModifier(short modifier)
          Checks whether the expression has the given modifier set.
 boolean isCaseSensitive()
          Check whether this expression is case sensitive or not.
 boolean isDynamic()
          Checks if this filter expression is dynamic or not.
 boolean isInverted()
          Check whether this expression is inverted or not.
 boolean match(LyValueSet values)
          Indicates whether the specified values matches the filter expression.
 boolean match(java.lang.Object object)
          Indicates whether the specified object matches the filter expression.
 void setCaseSensitive(boolean caseSensitive)
          Sets whether this expression is case sensitive or not.
 void setFieldInfo(LyFieldInfo fieldInfo)
          Sets the fieldInfo on which this expression applies.
 void setInverted(boolean not)
          Set the inverted mode of this filter expression.
 void setModifier(short modifier)
          Sets a modifier on this expression.
 java.lang.String toString(boolean name)
          Dumps this expression as a String.
 void unsetModifier(short modifier)
          Unsets a modifier on this expression.
 void writeXml(java.io.PrintWriter pw)
          Writes XML corresponding to this filter element.
 
Methods inherited from class leon.info.LyInfo
getAlias, getApplication, getFile, getId, getInclude, isIncluded, isInternal, isInternal, isLoaded, isLocked, load, setApplication, setFile, toString
 
Methods inherited from class leon.info.LyTag
clone, getCommentsEnd, getCommentsStart, getEnvironment, getModelType, getParent, getRootProject, hasAncestor, isExtern, setCommentsEnd, setCommentsStart, wasCloned
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface leon.parser.LyCommentInterface
getCommentsEnd, getCommentsStart, setCommentsEnd, setCommentsStart
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values

MOD_CASE_SENSITIVE

public static final short MOD_CASE_SENSITIVE
Modifier case sensitive.

See Also:
Constant Field Values

MOD_RAW

public static final short MOD_RAW
Modifier no accents.

See Also:
Constant Field Values

MOD_NOT_BY_NAME

public static final short MOD_NOT_BY_NAME
Modifier not by name for relations.

See Also:
Constant Field Values

MOD_PEER_FILTER_ONLY

public static final short MOD_PEER_FILTER_ONLY
Modifier for a filter which applies only in peer connector. Match value always return true in GUI. Internal use only

See Also:
Constant Field Values

MOD_MULTILINGUAL

public static final short MOD_MULTILINGUAL
Modifier for multilingual filtering.

See Also:
Constant Field Values

RECOMPUTE_DATE_DELAY

public static int RECOMPUTE_DATE_DELAY
Recompute the _now and $xxx in filter expression every 'n' seconds. -1 means never, 0 always.

Constructor Detail

LyFilterExpression

public LyFilterExpression(java.lang.String id,
                          LyFieldInfo fieldInfo,
                          boolean not,
                          LyFilterExpression.Condition condition,
                          java.lang.Object value,
                          java.util.BitSet modifiers)
Constructor of a filter expression.

Parameters:
id - Id of the filter expression.
fieldInfo - FieldInfo on which this filter expression applies.
not - Inverts filter condition or not.
condition - Filter condition.
value - Value of this expression (may be null).
modifiers - List of modifiers (may be null). This value is an instance of the class returned by the getValueClass method of LyFieldInfo.
See Also:
LyFieldInfo.getValueClass()

LyFilterExpression

public LyFilterExpression(LyFieldInfo fieldInfo,
                          boolean not,
                          LyFilterExpression.Condition condition,
                          java.lang.Object value,
                          java.util.BitSet modifiers)
Constructor of a filter expression.

Parameters:
fieldInfo - FieldInfo on which this filter expression applies.
not - Inverts filter condition or not.
condition - Filter condition.
value - Value of this expression (may be null).
modifiers - List of modifiers (may be null). This value is an instance of the class returned by the getValueClass method of LyFieldInfo.
See Also:
LyFieldInfo.getValueClass()

LyFilterExpression

public LyFilterExpression(LyFieldInfo fieldInfo,
                          boolean not,
                          LyFilterExpression.Condition condition,
                          java.lang.Object value)
Constructor of a filter expression.

Parameters:
fieldInfo - FieldInfo on which this filter expression applies.
not - Inverts filter condition or not.
condition - Filter condition.
value - Value of this expression (may be null). This value is an instance of the class returned by the getValueClass method of LyFieldInfo.
See Also:
LyFieldInfo.getValueClass()

LyFilterExpression

public LyFilterExpression(LyFieldInfo fieldInfo,
                          LyFilterExpression.Condition condition,
                          java.lang.Object value)
Constructor of a filter expression (shortcut of the previous constructor with not set to false).

Parameters:
fieldInfo - FieldInfo on which this filter expression applies.
condition - Filter condition.
value - Value of this expression (may be null).

LyFilterExpression

public LyFilterExpression(LyFieldInfo fieldInfo,
                          java.lang.Object value)
Constructor of a filter expression (shortcut of the main constructor with not set to false and condition set to Condition.EQUALS).

Parameters:
fieldInfo - FieldInfo on which this filter expression applies.
value - Value of this expression (may be null).
Method Detail

getCondition

public static java.lang.String getCondition(LyFilterExpression.Condition condition)
Return the name corresponding to the specified condition.

Parameters:
condition - Condition (one of the Condition.XXX)
Returns:
Untranslated name corresponding to the given condition if found, null otherwise.

getNotCondition

public static java.lang.String getNotCondition(LyFilterExpression.Condition condition)
Return the name corresponding to the specified not condition.

Parameters:
condition - Condition (one of the Condition.XXX)
Returns:
Untranslated name corresponding to the given condition if found, null otherwise.

getCondition

public static LyFilterExpression.Condition getCondition(java.lang.String conditionName)
Return the condition corresponding to the given name.

Parameters:
conditionName - Untranslated name.
Returns:
Condition if found, null otherwise.

getModifier

public static java.lang.String getModifier(short modifier)
Return the name corresponding to the specified modifier.

Parameters:
modifier - Modifier (one of the MOD_XXX)
Returns:
Untranslated name corresponding to the given modifier if found, null otherwise.

getModifier

public static short getModifier(java.lang.String modifierName)
Return the modifier corresponding to the given name.

Parameters:
modifierName - Untranslated name.
Returns:
Modifier if found, null otherwise.

cloneFilterExpression

public LyFilterExpression cloneFilterExpression()
Clone this filter expression.


match

public boolean match(java.lang.Object object)
Indicates whether the specified object matches the filter expression.

Specified by:
match in interface LyFilterElement
Parameters:
object - Object which should be checked.
Returns:
True if the given object matches this expression, false otherwise.
See Also:
LyFilterElement.match(java.lang.Object)

match

public boolean match(LyValueSet values)
Indicates whether the specified values matches the filter expression.

Specified by:
match in interface LyFilterElement
Parameters:
values - Values which should be checked.
Returns:
True if the given object matches this expression, false otherwise.
See Also:
LyFilterElement.match(java.lang.Object)

dump

public java.lang.String dump()
Dumps this expression as a String.

Returns:
Expression written in a string (may be displayed to the user or console)

toString

public java.lang.String toString(boolean name)
Dumps this expression as a String.

Parameters:
name - boolean indicating if names or strings are requested in result string.
Returns:
Expression written in a string (may be displayed to the user or console)

writeXml

public void writeXml(java.io.PrintWriter pw)
Writes XML corresponding to this filter element.

Specified by:
writeXml in interface LyFilterElement
Parameters:
pw - PrintWriter on which the XML is written.

getName

public java.lang.String getName()
Returns a displayable string of this expression.

Specified by:
getName in interface LyFilterElement
Overrides:
getName in class LyInfo
Returns:
A displayable string representation of this expression.

getFieldInfo

public LyFieldInfo getFieldInfo()
Gets the fieldInfo on which this expression applies.

Returns:
FieldInfo concerned by this filter expression.

getCondition

public LyFilterExpression.Condition getCondition()
Gets the condition for the filter expression.

Returns:
The condition : one of the Condition.XXX constants.

isInverted

public boolean isInverted()
Check whether this expression is inverted or not.

Returns:
True is the expression is inverted, false otherwise.

isCaseSensitive

public boolean isCaseSensitive()
Check whether this expression is case sensitive or not.

Returns:
True is the expression is case sensitive, false otherwise.

hasModifier

public boolean hasModifier(short modifier)
Checks whether the expression has the given modifier set.

Parameters:
modifier - Modifier to set on the expression. See the MOD_XXX constants, default is null (no modifier).
Returns:
True if the modifier is on, false it is off.

getValue

public java.lang.Object getValue()
Gets the value on which comparison occur.

Returns:
Value used for comparison. This value is an instance of the class returned by the getValueClass method of the fieldInfo concerned by this filter expression.

getInitValue

public java.lang.Object getInitValue()
Gets the initial value of this filter expression The values such as "_now" are replaced using getValue() but not in getInitValue().

Returns:
Value init used when creating the exepression.

getFieldValue

public LyValue getFieldValue()
Gets wrapped value.

Returns:
Returns wrapped value.

getModifiers

public java.util.BitSet getModifiers()
Gets modifiers of the expression.

Returns:
A bitset of modifiers (constants prefixed by MOD_).

setModifier

public void setModifier(short modifier)
Sets a modifier on this expression.

Parameters:
modifier - Modifier to set on the expression. See the MOD_XXX constants, default is null (no modifier).

unsetModifier

public void unsetModifier(short modifier)
Unsets a modifier on this expression.

Parameters:
modifier - Modifier to unset on the expression. See the MOD_XXX constants, default is null (no modifier).

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Sets whether this expression is case sensitive or not.

Parameters:
caseSensitive - True is the expression is case sensitive, false otherwise.

setFieldInfo

public void setFieldInfo(LyFieldInfo fieldInfo)
Sets the fieldInfo on which this expression applies.

Parameters:
fieldInfo - FieldInfo concerned by this filter expression.

setInverted

public void setInverted(boolean not)
Set the inverted mode of this filter expression.

Parameters:
not - indicates whether this filter expression should be inverted or not.

isDynamic

public boolean isDynamic()
Checks if this filter expression is dynamic or not. The filter expression is dynamic when it has an value that depends on a dynamic value given by the session.


getPeerExpression

public LyFilterExpression[] getPeerExpression()

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com