|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.actf.validation.rules.AbstractCriterion
org.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
|
Fields inherited from class org.eclipse.actf.validation.rules.AbstractCriterion |
---|
attributes, parent, parts, ruleSet |
Constructor Summary | |
---|---|
AbstractRule()
|
Method Summary | |
---|---|
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 |
getComponentCategory()
return the unique component category identifier in effect at the time this rule is evaluated. |
protected ICriterionFactory |
getCriterionFactory()
|
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. |
String |
getRepairHint()
returns the repair hint for this rule |
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 |
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 |
setRepairHint(String hint)
set the repair hint for this rule. |
void |
setSeverity(int severity)
set the severity level for a violation of this rule. |
String |
toString()
|
Methods inherited from class org.eclipse.actf.validation.rules.AbstractCriterion |
---|
addPart, equals, getAttribute, getParent, getParts, getRuleSet, hashCode, setAttribute, setParent, setParts, setRuleSet |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.actf.validation.rules.ICriterion |
---|
addPart, getAttribute, getParent, getParts, getRuleSet, initialize, setAttribute, setParent, setParts, setRuleSet |
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 int getSeverity()
getSeverity
in interface IRule
public void setSeverity(int severity)
org.eclipse.actf.util.logging.Reporter
.
setSeverity
in interface IRule
IReporter
public String getId()
getId
in interface IRule
public void setId(String id)
setId
in interface IRule
protected String findRuleId()
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 | falseprotected 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 usedRuleConstants.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 ICriterion
context
- context under which rule is being evaluated (supplied by engine)target
- object to which rule is to be applied
Exception
ICriterion.initialize(Object)
,
IValidationContext
,
ValidationContextConstants
protected String findComponentCategory()
public String getComponentCategory()
getComponentCategory
in interface IRule
public void setComponentCategory(String categoryId)
setComponentCategory
in interface IRule
public String toString()
toString
in class Object
protected void report(IValidationContext context, String msg)
protected String getAliasValue(String name)
protected ICriterionFactory getCriterionFactory()
protected String getTextTrim(Element elem)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |