Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


oracle.jdeveloper.audit.analyzer
Class Rule

java.lang.Object
  extended by oracle.jdeveloper.audit.extension.ExtensionBean
      extended by oracle.jdeveloper.audit.analyzer.Rule

Direct Known Subclasses:
Assist

public class Rule
extends ExtensionBean

An Audit rule. A rule reifies a condition in source code which Audit can report. (A particular occurrence of such a condition is a violation.)

The configurable state of an Audit rule is exposed through JavaBeans properties. Every rule has id, category, enabled, and severity properties. The id and categirt are read-only properties. The id uniquely identifies the rule and is not inteded for display.

Rules can expose additional properties which the Audit framework will discover by introspection and add to the appropriate Audit preferences panel. These properties should be bound properties, which in practice means that the setters should invoke the appropriate ExtensionBean.firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) method.

Localized label, tool tip, description strings are returned by this class using the Localizer supplied to the constructor and the following keys:

   "rule." + name() + ".label"
   "rule." + name() + ".tip"
   "rule." + name() + ".description"
 

See ExtensionBean.labelOrId() and ExtensionBean.description(). The object which supplies properties for these strings is the Rule instance.

By default, localized violation message strings are returned by this class using the following key for the base (null) variation:

   "rule." + name() + ".message"
 

See message(Violation). The object which supplies properties for message strings is a Violation instance.

For some rules, not all violations of the rule can be described by the same message format string. A variation name can be set on a violation which will cause the following key to be tried before the default:

   "rule." + name() + "." + violation.getVariation() + ".message"
 
See Also:
Localizer, Violation

Nested Class Summary
static interface Rule.Parameter
           

 

Field Summary
static java.lang.String HTML_MESSAGE_KEY
          The key for the message text of a rule.
static int MAX_TRANSFORM_COUNT
          The maximum number of transforms allowed by a rule.
static java.lang.String MESSAGE_KEY
          The key for the message text of a rule.

 

Fields inherited from class oracle.jdeveloper.audit.extension.ExtensionBean
DESCRIPTION_KEY, LABEL_KEY, SHORT_LABEL_KEY, TIP_KEY

 

Constructor Summary
Rule()
          Creates a rule.
Rule(java.lang.String name, Category category, Severity severity, Localizer localizer)
          Creates a rule with no fixes
Rule(java.lang.String name, Category category, Severity severity, Localizer localizer, Transform defaultTransform)
          Creates a rule with one, default fix.
Rule(java.lang.String name, Category category, Severity severity, Localizer localizer, Transform[] transforms, Transform defaultTransform)
          Creates a rule.
Rule(java.lang.String name, java.lang.String[] variations, Category category, Severity severity, Localizer localizer, Transform[] transforms, Transform defaultTransform)
          Creates a rule.
Rule(java.lang.String id, java.lang.String extensionId, Category category, java.lang.String[] variations, Transform[] transforms, Transform defaultTransform)
          Creates a rule.
Rule(java.lang.String name, java.lang.String extensionId, java.lang.String[] variations, Category category, Severity severity, Localizer localizer, Transform[] transforms, Transform defaultTransform)
          Creates a rule.

 

Method Summary
 Category category()
          Gets the category of this rule.
protected  void copyInternalState(ExtensionBean copy, java.util.IdentityHashMap<java.lang.Object,java.lang.Object> context)
          Copies internal subclass state as part of creating a copy of this bean.
 boolean declarative()
          Gets whether this rule is declarative.
 Transform getDefaultTransform()
          Gets the default transform for this rule, or null if none.
 java.lang.String getDefaultTransformName()
          Gets the name of the default transform of this rule, or null if none.
 Severity getSeverity()
          Gets the severity of this rule.
 StyleCategory getStyle()
          Gets the style of this rule.
 Transform[] getTransforms()
          Gets the transforms which can be applied to violations of this rule.
 java.lang.String htmlMessage(Violation violation)
          Gets the localized HTML violation message for a violation of this rule from its localizer using this key for a default (null) variation:
 boolean isEnabled()
          Gets whether this rule is enabled.
 java.lang.String message(Violation violation)
          Gets the localized violation message for a violation of this rule from its localizer using this key for a default (null) variation:
 Rule.Parameter[] parameters()
          Gets the parameters declared by this rule, or an empty array if none.
 void setDefaultTransformName(java.lang.String newName)
          Sets the default transform for this rule by its name.
 void setEnabled(boolean newValue)
          Sets whether this rule is enabled.
 void setSeverity(Severity newValue)
           
 void setStyle(StyleCategory newValue)
          Sets the style of this rule.
 void setStyleCategory(StyleCategory newValue)
          Deprecated.  
protected  void setTransforms(Transform[] transforms)
          Sets the transforms which can be applied to violations of this rule.
 java.lang.String toString()
           
 java.lang.String[] variations()
          Gets the variations supported by this rule, or an empty array if none.

 

Methods inherited from class oracle.jdeveloper.audit.extension.ExtensionBean
addPropertyChangeListener, addPropertyChangeListener, createCopy, description, equals, extensionId, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, formattedString, formattedString, hashCode, id, label, labelOrId, logError, logWarning, propertyDescription, propertyLabel, propertyString, propertyTip, removePropertyChangeListener, removePropertyChangeListener, setCompatibilityBundle, setStrings, setters, shortLabel, string, strings, tip

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Field Detail

MESSAGE_KEY

public static final java.lang.String MESSAGE_KEY
The key for the message text of a rule.
See Also:
message(oracle.jdeveloper.audit.service.Violation), Constant Field Values

HTML_MESSAGE_KEY

public static final java.lang.String HTML_MESSAGE_KEY
The key for the message text of a rule.
See Also:
htmlMessage(oracle.jdeveloper.audit.service.Violation), Constant Field Values

MAX_TRANSFORM_COUNT

public static final int MAX_TRANSFORM_COUNT
The maximum number of transforms allowed by a rule.
See Also:
Constant Field Values

Constructor Detail

Rule

public Rule()
Creates a rule.

The Audit framework uses this constructor for rules declared in an extension manifest, and then injects values for the ExtensionBean.id, ExtensionBean.extensionId, category, variations, parameters transforms, and defaultTransform fields.


Rule

public Rule(java.lang.String name,
            Category category,
            Severity severity,
            Localizer localizer)
Creates a rule with no fixes
Parameters:
name - The non-localized name of this rule.
category - The category of this rule.
severity - The severity of this rule.
localizer - The localizer which supplies localized strings for this rule.

Rule

public Rule(java.lang.String name,
            Category category,
            Severity severity,
            Localizer localizer,
            Transform defaultTransform)
Creates a rule with one, default fix.
Parameters:
name - The non-localized name of this rule.
category - The category of this rule.
severity - The severity of this rule.
localizer - The localizer which supplies localized strings for this rule.
defaultTransform - The name of the default, and only available, tranform for this rule.

Rule

public Rule(java.lang.String name,
            Category category,
            Severity severity,
            Localizer localizer,
            Transform[] transforms,
            Transform defaultTransform)
Creates a rule.
Parameters:
name - The non-localized name of this rule.
category - The category of this rule.
severity - The severity of this rule.
localizer - The localizer for this rule.
transforms - An array of names of available fixes for this rule.
defaultTransform - The name of the default fix for this rule, or null if none.
Throws:
java.lang.IllegalArgumentException - if the default fix is not in fixes.

Rule

public Rule(java.lang.String name,
            java.lang.String[] variations,
            Category category,
            Severity severity,
            Localizer localizer,
            Transform[] transforms,
            Transform defaultTransform)
Creates a rule.
Parameters:
name - The non-localized name of this rule.
variations - The variations supported by this rule.
category - The category of this rule.
severity - The severity of this rule.
localizer - The localizer for this rule.
transforms - An array of names of available fixes for this rule.
defaultTransform - The name of the default fix for this rule, or null if none.
Throws:
java.lang.IllegalArgumentException - if the default fix is not in fixes.

Rule

public Rule(java.lang.String name,
            java.lang.String extensionId,
            java.lang.String[] variations,
            Category category,
            Severity severity,
            Localizer localizer,
            Transform[] transforms,
            Transform defaultTransform)
Creates a rule.
Parameters:
name - The non-localized name of this rule.
extensionId - The id of the extension that defined this rule.
variations - The variations supported by this rule.
category - The category of this rule.
severity - The severity of this rule.
localizer - The localizer for this rule.
transforms - An array of names of available fixes for this rule.
defaultTransform - The name of the default fix for this rule, or null if none.
Throws:
java.lang.IllegalArgumentException - if the default fix is not in fixes.

Rule

public Rule(java.lang.String id,
            java.lang.String extensionId,
            Category category,
            java.lang.String[] variations,
            Transform[] transforms,
            Transform defaultTransform)
Creates a rule.
Parameters:
id - The id of this rule.
extensionId - The id of the extension that defined this rule.
variations - The variations supported by this rule.
category - The category of this rule.
transforms - An array of available transforms for this rule.
defaultTransform - The default fix for this rule, or null if none.
Throws:
java.lang.IllegalArgumentException - if the default fix is not in fixes.

Method Detail

copyInternalState

protected void copyInternalState(ExtensionBean copy,
                                 java.util.IdentityHashMap<java.lang.Object,java.lang.Object> context)
                          throws java.lang.reflect.InvocationTargetException
Description copied from class: ExtensionBean
Copies internal subclass state as part of creating a copy of this bean.
Overrides:
copyInternalState in class ExtensionBean
Parameters:
copy - The partially initialized copy.
context - A map which allows subclasses to preserve object identity when copying a graph of extension beans.
Throws:
java.lang.reflect.InvocationTargetException
See Also:
ExtensionBean.createCopy(java.util.IdentityHashMap<java.lang.Object, java.lang.Object>)

declarative

public final boolean declarative()
Gets whether this rule is declarative.

category

public Category category()
Gets the category of this rule.

parameters

public Rule.Parameter[] parameters()
Gets the parameters declared by this rule, or an empty array if none.

variations

public java.lang.String[] variations()
Gets the variations supported by this rule, or an empty array if none.

message

public java.lang.String message(Violation violation)
Gets the localized violation message for a violation of this rule from its localizer using this key for a default (null) variation:
 "rule." + getName() + ".message"
 
and the first defined of these keys for a named variation:
 "rule." + getName() + "." + violation.getVariation() + ".message"
 "rule." + getName() + ".message"
 
Parameters:
violation - The violation for which to get a message.
See Also:
Localizer

htmlMessage

public java.lang.String htmlMessage(Violation violation)
Gets the localized HTML violation message for a violation of this rule from its localizer using this key for a default (null) variation:
 "rule." + getName() + ".html-message"
 
and the first defined of these keys for a named variation:
 "rule." + getName() + "." + violation.getVariation() + ".html-message"
 "rule." + getName() + ".message"
 
Parameters:
violation - The violation for which to get a message.
See Also:
Localizer

getDefaultTransform

public Transform getDefaultTransform()
Gets the default transform for this rule, or null if none.

setDefaultTransformName

public void setDefaultTransformName(java.lang.String newName)
Sets the default transform for this rule by its name. This method exists only to support saving and restoring profiles.
Parameters:
newName - The name of a transform of this rule, or null.

getDefaultTransformName

public java.lang.String getDefaultTransformName()
Gets the name of the default transform of this rule, or null if none. This method exists to support saving and restoring profiles.

isEnabled

public boolean isEnabled()
Gets whether this rule is enabled.

setEnabled

public void setEnabled(boolean newValue)
Sets whether this rule is enabled.

getSeverity

public Severity getSeverity()
Gets the severity of this rule.

setSeverity

public void setSeverity(Severity newValue)

getStyle

public StyleCategory getStyle()
Gets the style of this rule.

setStyle

public void setStyle(StyleCategory newValue)
Sets the style of this rule.
Parameters:
newValue - The new style of this rule.

setStyleCategory

public void setStyleCategory(StyleCategory newValue)
Deprecated. 

getTransforms

public Transform[] getTransforms()
Gets the transforms which can be applied to violations of this rule.
Returns:
An array of Transforms.
See Also:
getDefaultTransform()

setTransforms

protected void setTransforms(Transform[] transforms)
Sets the transforms which can be applied to violations of this rule. Typically, this is set in the constructor. However, a subclass may want to alter the set of fixes from the setter of another property.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.2)

E13403-10


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