|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.actf.validation.rules.AbstractRule
public abstract class AbstractRule
base implementation of a validation rule in ACTF. Clients should extend this
class rather than implementing IRule
.
Field Summary | |
---|---|
protected static Map |
SEVERITY_MAP
|
Constructor Summary | |
---|---|
AbstractRule()
|
Method Summary | |
---|---|
void |
addRulePart(IRule rule)
adds a rule to the list of rule parts or nested rules that are executed when this rule is evaluated. |
boolean |
apply(IValidationContext context,
Object target)
insures that either the target is not null or that,
if the target is null , null targets can be ignored |
protected String |
findComponentCategory()
|
protected String |
findMessage()
|
protected String |
findRuleId()
|
protected String |
getAliasValue(String name)
|
String |
getAttribute(String name)
retreaves the attribute with the given name for this rule |
String |
getComponentCategory()
return the unique component category identifier in effect at the time this rule is evaluated. |
String |
getId()
get the unique id for this rule |
boolean |
getIgnoreIfNull()
returns the actf:ignoreifnull attribute for this rule |
Iterator |
getIterator(Object collection)
returns the iterator used for this rule should the rule involve any sort of collection or array. |
String |
getLongDescription()
returns the long description received upon a violation of this rule |
String |
getMessage()
returns the message resulting from violating this rule |
String |
getName()
return the name of the rule. |
IRule |
getParent()
return the parent rule of this rule. |
String |
getRepairHint()
returns the repair hint for this rule |
protected IRuleFactory |
getRuleFactory()
|
List |
getRuleParts()
returns the rule parts or nested rules for this rule |
IRuleSet |
getRuleSet()
return the IRuleSet containing this IRule. |
int |
getSeverity()
return the severity level for a violation of this rule. |
protected String |
getTextTrim(Element elem)
|
boolean |
isEnabled()
returns the enable attribute for this rule |
protected boolean |
isIgnoringNullTarget(Object target)
|
protected void |
processActfAttributes(Element elem)
|
protected void |
report(IValidationContext context,
String msg)
|
void |
setAttribute(String name,
String value)
set an arbitrary attribute for this rule |
void |
setComponentCategory(String categoryId)
set the component category identifier for this rule. |
void |
setEnabled(boolean enable)
set the enable attribute for this rule. |
void |
setId(String id)
set the id for this rule. |
void |
setIgnoreIfNull(boolean ignoreifnull)
set the actf:ignoreifnull attribute for this rule. |
void |
setIteratorName(String clsName)
set the class name of the iterator to be used for iterating through any sort of collection. |
void |
setLongDescription(String desc)
set the long description or message to be received upon a violation of this rule. |
void |
setMessage(String msg)
set the message to be received upon a violation of this rule. |
void |
setName(String name)
set the name for this rule. |
void |
setParent(IRule parent)
set the parent rule of this rule. |
void |
setRepairHint(String hint)
set the repair hint for this rule. |
void |
setRuleParts(List ruleParts)
set the rule parts or nested rules for this rule. |
void |
setRuleSet(IRuleSet iRuleSet)
Set the containing IRuleSet for this rule. |
void |
setSeverity(int level)
set the severity level for a violation of this rule. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.actf.validation.rules.IRule |
---|
initialize |
Field Detail |
---|
protected static final Map SEVERITY_MAP
Constructor Detail |
---|
public AbstractRule()
Method Detail |
---|
public String getName()
getName
in interface IRule
public void setName(String name)
setName
in interface IRule
public String getId()
getId
in interface IRule
public void setId(String id)
setId
in interface IRule
protected String findRuleId()
public int getSeverity()
getSeverity
in interface IRule
public void setSeverity(int level)
org.eclipse.actf.util.logging.Reporter
.
setSeverity
in interface IRule
IReporter
protected String findMessage()
public String getMessage()
getMessage
in interface IRule
public void setMessage(String msg)
setMessage
in interface IRule
msg
- -
message to be received upon a violation of this ruleIRule.setLongDescription(String)
public boolean getIgnoreIfNull()
getIgnoreIfNull
in interface IRule
public void setIgnoreIfNull(boolean ignoreifnull)
setIgnoreIfNull
in interface IRule
ignoreifnull
- -
true | false#apply(Object)
protected boolean isIgnoringNullTarget(Object target)
public boolean isEnabled()
isEnabled
in interface IRule
public void setEnabled(boolean enable)
setEnabled
in interface IRule
enable
- -
true | falsepublic Iterator getIterator(Object collection)
ArrayIterator
is provided for
arrays and a DomNodeIterator
is provided for iterating through the
nodes of a W3C DOM level 2 NodeList
.
Other iterators may be specified using the actf:iterator attribute.
getIterator
in interface IRule
collection
- with which to initialize iterator
null
if no
iterator is requiredpublic void setIteratorName(String clsName)
RuleConstants.ITERATOR
attribute.
setIteratorName
in interface IRule
clsName
- - class name of iterator to be used#getIterator(Object)Object)
,
RuleConstants.ITERATOR
public String getLongDescription()
getLongDescription
in interface IRule
public void setLongDescription(String desc)
setLongDescription
in interface IRule
desc
- -
long description to be received upon a violation of this ruleIRule.setMessage(String)
public String getRepairHint()
getRepairHint
in interface IRule
public void setRepairHint(String hint)
setRepairHint
in interface IRule
protected void processActfAttributes(Element elem)
public boolean apply(IValidationContext context, Object target) throws Exception
null
or that,
if the target is null
, null targets can be ignored
apply
in interface IRule
context
- context under which rule is being evaluated (supplied by engine)target
- object to which rule is to be applied
Exception
IRule.initialize(Object)
,
IValidationContext
,
ValidationContextConstants
public List getRuleParts()
getRuleParts
in interface IRule
public void setRuleParts(List ruleParts)
setRuleParts
in interface IRule
ruleParts
- list of rule partspublic void addRulePart(IRule rule)
addRulePart
in interface IRule
rule
- validation ruleprotected String findComponentCategory()
public String getComponentCategory()
getComponentCategory
in interface IRule
public void setComponentCategory(String categoryId)
setComponentCategory
in interface IRule
public IRule getParent()
getParent
in interface IRule
public void setParent(IRule parent)
IRule
setParent
in interface IRule
parent
- rulepublic IRuleSet getRuleSet()
getRuleSet
in interface IRule
public void setRuleSet(IRuleSet iRuleSet)
IRule
setRuleSet
in interface IRule
iRuleSet
- parent rulepublic String toString()
toString
in class Object
protected void report(IValidationContext context, String msg)
protected String getAliasValue(String name)
protected IRuleFactory getRuleFactory()
protected String getTextTrim(Element elem)
public String getAttribute(String name)
IRule
getAttribute
in interface IRule
name
- name of attribute
null
public void setAttribute(String name, String value)
IRule
setAttribute
in interface IRule
name
- name of attributevalue
- value of attribute
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |