Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 2 (11.1.2.0.0)

E17492-01

oracle.dss.rules
Class Rule

java.lang.Object
  extended by oracle.dss.rules.Rule
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DiscriminatorRule

public class Rule
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

An object that specifies:

The property values are specified in a Mergeable object. The applies method specifies whether the properties in the Mergeable should be used. In this class, the applies method always returns true, so the rule always applies.

Rule objects are normally stored in RuleBundle objects. RuleBundle objects are stored in vectors, which are then passed to a Manager class, which runs all the rules in all of the rule bundles. The result is a single Mergeable object that specifies all of the settings that the Manager should use to render an item in a Dataview.

Subclasses of this class can override methods, in order to produce more specific rules. For example, the DiscriminatorRule specifies conditions under which the rule applies.

See Also:
Mergeable, DiscriminatorRule, RuleBundle, Serialized Form

Field Summary
protected  Mergeable m_mergeable
           
static int RESET_EVERYTHING
          Reset all defaults, so that the rule is equivalent to one that has just been created.
static int RESET_NONE
          Reset no defaults.
static int RESET_XML_PROPERTIES
          Reset defaults for properties that can be set through XML.
 
Constructor Summary
Rule()
          Constructor that does not specify a Mergeable object.
Rule(Mergeable mergeable)
          Constructor that specifies a Mergeable object.
 
Method Summary
 boolean applies(RuleContext context, Mergeable target)
          Specifies whether this rule applies in the specified context.
 java.lang.Object clone()
          Clones this object.
 void fireRule(RuleContext context, Mergeable target)
          Modifies the specified Mergeable object to include property settings that this Rule specifies.
 Mergeable getFixedMergeable()
          Retrieves the Mergeable object that specifies property settings that should take effect when this Rule applies.
 long getID()
           
 oracle.dss.util.xml.ObjectNode getXML(boolean allProperties, ComponentTypeConverter converter)
           
 boolean runRule(RuleContext context, Mergeable target)
          Fires this rule if the specified context warrants.
 void setFixedMergeable(Mergeable mergeable)
          Specifies the Mergeable object whose property values should be set whenever this Rule applies.
 void setID(long id)
           
 boolean setXML(oracle.dss.util.xml.ObjectNode objectNode, java.lang.String version, int reset)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_mergeable

protected Mergeable m_mergeable
For internal use only. Application developers should not use this

RESET_NONE

public static final int RESET_NONE
Reset no defaults.

See Also:
Constant Field Values

RESET_XML_PROPERTIES

public static final int RESET_XML_PROPERTIES
Reset defaults for properties that can be set through XML.

See Also:
Constant Field Values

RESET_EVERYTHING

public static final int RESET_EVERYTHING
Reset all defaults, so that the rule is equivalent to one that has just been created.

See Also:
Constant Field Values
Constructor Detail

Rule

public Rule()
Constructor that does not specify a Mergeable object. If you call this constructor, and the rule needs a Mergeable object, then you must also call the setFixedMergeable method.

See Also:
setFixedMergeable(oracle.dss.rules.Mergeable), Mergeable

Rule

public Rule(Mergeable mergeable)
Constructor that specifies a Mergeable object.

Parameters:
mergeable - The Mergeable object whose property values should be used when this rule applies.
Method Detail

setID

public void setID(long id)
Parameters:
id - A long number that identifies this Rule. This id is internally set by our UI Panels.
For internal use only. Application developers should not use this
Specifies an identifier for this Rule.

getID

public long getID()
Returns:
returns The identifier for this Rule.
For internal use only. Application developers should not use this
Retrieves the identifier for this Rule.

clone

public java.lang.Object clone()
Clones this object. Subclasses of this class must override this method. Not doing so leads to unexpected behavior.

Overrides:
clone in class java.lang.Object
Returns:
The clone of this object.

applies

public boolean applies(RuleContext context,
                       Mergeable target)
                throws RuleException
Specifies whether this rule applies in the specified context. Subclasses should override this method, because in this class, this method always returns true.

Parameters:
context - The context of the item that is to be rendered. The Dataview provides this parameter.
target - The Mergeable object whose properties will be modified when the rule is fired, if this method returns true. Overriding methods may or may not use this parameter. This must be the same class as the object retrieved by calling the getFixedMergeable method.
Returns:
true. Overriding methods should return true or false.
Throws:
RuleException - If context is unusable for some reason or if this Rule has a problem.

runRule

public boolean runRule(RuleContext context,
                       Mergeable target)
                throws RuleException
Fires this rule if the specified context warrants. This method calls the applies method. If the applies method returns true, then this method calls the fireRule method.

The RuleBundle method calls this method for each rule in the bundle. Extending classes may or may not choose to override this method. (An implementation might skip the call to applies altogether and just call fireRule.)

Parameters:
context - The context of the item that is to be rendered. The Dataview provides this parameter.
target - The Mergeable object whose properties will be modified when the rule is fired, if this method returns true. Included in case the applies method wants to examine the Mergeable. This must be the same class as, or a subclass of, the object retrieved by calling the getFixedMergeable method.
Returns:
true if the applies method returns true, false if not.
Throws:
RuleException - If context is unusable for some reason or if this Rule has a problem.

fireRule

public void fireRule(RuleContext context,
                     Mergeable target)
              throws RuleException
Modifies the specified Mergeable object to include property settings that this Rule specifies. This implementation merges the specified Mergeable object with the Mergeable object of this Rule. Merging the two objects adds the property settings from this Rule to those property settings that will be used when the Dataview renders an item.

Parameters:
context - The context of the item that is to be rendered. The Dataview provides this parameter. Subclasses might examine the context to determine how to modify the Mergeable object.
target - The Mergeable object whose properties will be modified. This must be the same class as, or a subclass of, the object retrieved by calling the getFixedMergeable method.
Throws:
RuleException - If context is unusable for some reason or if this Rule has a problem.

getFixedMergeable

public Mergeable getFixedMergeable()
Retrieves the Mergeable object that specifies property settings that should take effect when this Rule applies.

Returns:
The Mergeable that specifies the property settings for this Rule.

setFixedMergeable

public void setFixedMergeable(Mergeable mergeable)
Specifies the Mergeable object whose property values should be set whenever this Rule applies.

Parameters:
mergeable - The object that specifies property values that should be set whenever this Rule applies.

getXML

public oracle.dss.util.xml.ObjectNode getXML(boolean allProperties,
                                             ComponentTypeConverter converter)
Parameters:
allProperties - true to store all property values in XML, false to store only values that are different from default values.
converter - A class that converts view component identifiers from strings to integers and back. Dataview objects implement the ComponentTypeConverter interface.
Returns:
XML for the properties and values.
For internal use only. Application developers should not use this
Retrieves XML that represents properties and their values in the form of and ObjectNode.

setXML

public boolean setXML(oracle.dss.util.xml.ObjectNode objectNode,
                      java.lang.String version,
                      int reset)
Parameters:
node - ObjectNode that has the properties and their values.
version - The XML version.
reset - A constant that indicates how much to reset when XML is applied. Valid values are listed in the See Also section.
Returns:
true if XML is properly applied, false if the XML cannot be applied.
See Also:
RESET_NONE, RESET_XML_PROPERTIES, RESET_EVERYTHING
For internal use only. Application developers should not use this
Specifies XML that represents properties and values. This method applies the values of the properties in the XML to this Rule.

Oracle Fusion Middleware Java API Reference for Oracle Data Visualization Components
11g Release 2 (11.1.2.0.0)

E17492-01

Copyright © 1997, 2011, Oracle. All rights reserved.