pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.site.content.filter
Class FilterRule

java.lang.Object
  extended by org.torweg.pulse.site.content.Localized
      extended by org.torweg.pulse.site.content.filter.FilterRule
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<FilterRule>, JDOMable, INameable, INamed

@Entity
public class FilterRule
extends Localized
implements java.lang.Comparable<FilterRule>, JDOMable

a FilterRule is part of a Filter.

Each FilterRule has a set of FilterRuleProperty. These properties are associated with Content by the Filter to allow filtering.

Version:
$Revision: 1503 $
Author:
Thomas Weber, Daniel Dietz
See Also:
Serialized Form

Constructor Summary
protected FilterRule()
          Deprecated. 
  FilterRule(java.lang.String n)
          constructs a new FilterRule with the given name.
 
Method Summary
 boolean addProperty(FilterRuleProperty p)
          adds a FilterRuleProperty to the FilterRule.
 void addProperty(int index, FilterRuleProperty p)
          adds a new FilterMatches at the given index.
 void clearProperties()
          clears all properties.
 int compareTo(FilterRule r)
          returns the result of the comparison.
 boolean contains(FilterRuleProperty p)
          returns whether the FilterRule contains the given FilterRuleProperty.
 org.jdom.Element deserializeToJDOM()
          returns a JDOM representation of the FilterRule.
 boolean equals(java.lang.Object o)
          returns whether the given Object is equal to the FilterRule.
 Filter getFilter()
          returns the Filter the rule belongs to.
 java.util.List<FilterRuleProperty> getProperties()
           
 int hashCode()
          returns the int value of the id or super.hashCode(), if the id is still null.
 boolean isEmpty()
          returns whether the rule does not contain properties.
 boolean remove(FilterRuleProperty p)
          removes the given FilterRuleProperty from the FilterRule.
 FilterRuleProperty removeProperty(int index)
          removes the FilterRuleProperty at the given index.
protected  void setFilter(Filter f)
          sets the Filter the rule belongs to.
 FilterRuleProperty setProperty(int index, FilterRuleProperty p)
          sets the given FilterRuleProperty at the given index.
 int size()
          returns the number of FilterRuleProperties contained in the FilterRule.
 
Methods inherited from class org.torweg.pulse.site.content.Localized
getId, getLocalization, getLocalization, getLocalizations, getName, putLocalization, removeLocalization, setName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterRule

@Deprecated
protected FilterRule()
Deprecated. 

used by HibernateTM.


FilterRule

public FilterRule(java.lang.String n)
constructs a new FilterRule with the given name.

Parameters:
n - the name of the rule
Method Detail

getFilter

public final Filter getFilter()
returns the Filter the rule belongs to.

Returns:
the Filter the rule belongs to

setFilter

protected final void setFilter(Filter f)
sets the Filter the rule belongs to.

Parameters:
f - the filter to set

getProperties

public final java.util.List<FilterRuleProperty> getProperties()
Returns:
returns the properties.

addProperty

public final boolean addProperty(FilterRuleProperty p)
adds a FilterRuleProperty to the FilterRule.

Parameters:
p - the property to add
Returns:
true, if the property has been added
See Also:
List.add(java.lang.Object)

addProperty

public final void addProperty(int index, FilterRuleProperty p)
adds a new FilterMatches at the given index.

Parameters:
index - the index
p - the property to add
See Also:
List.add(int, java.lang.Object)

setProperty

public final FilterRuleProperty setProperty(int index, FilterRuleProperty p)
sets the given FilterRuleProperty at the given index.

Parameters:
index - the index
p - the property to be set
Returns:
the property which has previously been at the index position
See Also:
List.set(int, java.lang.Object)

clearProperties

public final void clearProperties()
clears all properties.

See Also:
List.clear()

contains

public final boolean contains(FilterRuleProperty p)
returns whether the FilterRule contains the given FilterRuleProperty.

Parameters:
p - the property to look for
Returns:
true, if the property has been found
See Also:
List.contains(java.lang.Object)

isEmpty

public final boolean isEmpty()
returns whether the rule does not contain properties.

Returns:
true, if the rule has no properties
See Also:
List.isEmpty()

remove

public final boolean remove(FilterRuleProperty p)
removes the given FilterRuleProperty from the FilterRule.

Parameters:
p - the property to be removed
Returns:
true, if the property has been removed
See Also:
List.remove(java.lang.Object)

removeProperty

public final FilterRuleProperty removeProperty(int index)
removes the FilterRuleProperty at the given index.

Parameters:
index - the index
Returns:
the removed property
See Also:
List.remove(int)

size

public final int size()
returns the number of FilterRuleProperties contained in the FilterRule.

Returns:
the number of FilterRuleProperties contained in the FilterRule
See Also:
List.size()

hashCode

public final int hashCode()
returns the int value of the id or super.hashCode(), if the id is still null.

Overrides:
hashCode in class java.lang.Object
Returns:
the int value of the id or super.hashCode(), if the id is still null
See Also:
Object.hashCode()

equals

public final boolean equals(java.lang.Object o)
returns whether the given Object is equal to the FilterRule.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare with
Returns:
true, if the given object is a FilterRule and the result of compareTo(FilterRule) is 0

compareTo

public final int compareTo(FilterRule r)
returns the result of the comparison.

If both rules have been persisted, the rule's ids are compared. Otherwise the hash codes are compared.

Specified by:
compareTo in interface java.lang.Comparable<FilterRule>
Parameters:
r - the rule to compare to
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
See Also:
Comparable.compareTo(Object)

deserializeToJDOM

public org.jdom.Element deserializeToJDOM()
returns a JDOM representation of the FilterRule.

Specified by:
deserializeToJDOM in interface JDOMable
Returns:
a JDOM representation of the FilterRule