Package com.helger.schematron.pure.model
Class PSRule
java.lang.Object
com.helger.schematron.pure.model.PSRule
- All Implemented Interfaces:
IPSElement,IPSHasFlag,IPSHasForeignAttributes,IPSHasForeignElements,IPSHasID,IPSHasIncludes,IPSHasLets,IPSHasLinkableGroup,IPSHasRichGroup
@NotThreadSafe
public class PSRule
extends Object
implements IPSElement, IPSHasID, IPSHasFlag, IPSHasForeignElements, IPSHasIncludes, IPSHasLets, IPSHasRichGroup, IPSHasLinkableGroup
A single Schematron rule-element.
A list of assertions tested within the context specified by the required context attribute. The context attribute specifies the rule context expression.
NOTE: It is not an error if a rule never fires in a document. In order to test that a document always has some context, a new pattern should be created from the context of the document, with an assertion requiring the element or attribute.
The icon, see and fpi attributes allow rich interfaces and documentation.
The flag attribute allows more detailed outcomes.
The role and subject attributes allow explicit identification of some part of a pattern as part of the validation outcome.
When the rule element has the attribute abstract with a value true, then the rule is an abstract rule. An abstract rule shall not have a context attribute. An abstract rule is a list of assertions that will be invoked by other rules belonging to the same pattern using the extends element. Abstract rules provide a mechanism for reducing schema size.
A list of assertions tested within the context specified by the required context attribute. The context attribute specifies the rule context expression.
NOTE: It is not an error if a rule never fires in a document. In order to test that a document always has some context, a new pattern should be created from the context of the document, with an assertion requiring the element or attribute.
The icon, see and fpi attributes allow rich interfaces and documentation.
The flag attribute allows more detailed outcomes.
The role and subject attributes allow explicit identification of some part of a pattern as part of the validation outcome.
When the rule element has the attribute abstract with a value true, then the rule is an abstract rule. An abstract rule shall not have a context attribute. An abstract rule is a list of assertions that will be invoked by other rules belonging to the same pattern using the extends element. Abstract rules provide a mechanism for reducing schema size.
- Author:
- Philip Helger
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssertReport(PSAssertReport aAssertReport) voidaddExtends(PSExtends aExtends) voidaddForeignAttribute(String sAttrName, String sAttrValue) voidaddForeignElement(com.helger.xml.microdom.IMicroElement aForeignElement) voidaddInclude(PSInclude aInclude) Add an include to this object.voidAdd aPSLetelement.com.helger.commons.collection.impl.ICommonsList<PSAssertReport>com.helger.commons.collection.impl.ICommonsList<IPSElement>com.helger.commons.collection.impl.ICommonsList<PSExtends>com.helger.commons.collection.impl.ICommonsList<com.helger.xml.microdom.IMicroElement>com.helger.commons.collection.impl.ICommonsList<PSInclude>com.helger.commons.collection.impl.ICommonsList<PSLet>com.helger.xml.microdom.IMicroElementintgetFlag()The name of a Boolean flag variable.getID()getRich()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisValid(IPSErrorHandler aErrorHandler) Check if this element is specified completely.voidsetAbstract(boolean bAbstract) voidsetContext(String sContext) voidvoidSet an ID for this object.voidsetLinkable(PSLinkableGroup aLinkable) Overwrite any existing linkable group.voidsetRich(PSRichGroup aRich) Overwrite any existing rich group.toString()voidvalidateCompletely(IPSErrorHandler aErrorHandler) Check if this element is specified completely.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.schematron.pure.model.IPSHasForeignAttributes
addForeignAttributesMethods inherited from interface com.helger.schematron.pure.model.IPSHasForeignElements
addForeignElementsMethods inherited from interface com.helger.schematron.pure.model.IPSHasLinkableGroup
getLinkableClone, hasLinkableMethods inherited from interface com.helger.schematron.pure.model.IPSHasRichGroup
getRichClone, hasRich
-
Field Details
-
DEFAULT_ABSTRACT
public static final boolean DEFAULT_ABSTRACT- See Also:
-
-
Constructor Details
-
PSRule
public PSRule()
-
-
Method Details
-
isValid
Description copied from interface:IPSElementCheck if this element is specified completely. This method stops at the first encountered error.- Specified by:
isValidin interfaceIPSElement- Parameters:
aErrorHandler- The error handler where the error details are stored. May not benull.- Returns:
trueif all mandatory fields are set and the element is valid,falseotherwise.
-
validateCompletely
Description copied from interface:IPSElementCheck if this element is specified completely. This method performs all validations independent of the number of encountered error.- Specified by:
validateCompletelyin interfaceIPSElement- Parameters:
aErrorHandler- The error handler where the error details are stored. May not benull.
-
isMinimal
public boolean isMinimal()- Specified by:
isMinimalin interfaceIPSElement- Returns:
trueif this element conforms to the Schematron minimal syntax,falseotherwise.
-
addForeignElement
- Specified by:
addForeignElementin interfaceIPSHasForeignElements
-
hasForeignElements
public boolean hasForeignElements()- Specified by:
hasForeignElementsin interfaceIPSHasForeignElements
-
getAllForeignElements
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<com.helger.xml.microdom.IMicroElement> getAllForeignElements()- Specified by:
getAllForeignElementsin interfaceIPSHasForeignElements
-
addForeignAttribute
- Specified by:
addForeignAttributein interfaceIPSHasForeignAttributes
-
hasForeignAttributes
public boolean hasForeignAttributes()- Specified by:
hasForeignAttributesin interfaceIPSHasForeignAttributes
-
getAllForeignAttributes
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getAllForeignAttributes()- Specified by:
getAllForeignAttributesin interfaceIPSHasForeignAttributes
-
getFlag
Description copied from interface:IPSHasFlagThe name of a Boolean flag variable. A flag is implicitly declared by an assertion or rule having a flag attribute with that name. The value of a flag becomes true when an assertion with that flag fails or a rule with that flag fires.
The purpose of flags is to convey state or severity information to a subsequent process.
An implementation is not required to make use of this attribute.- Specified by:
getFlagin interfaceIPSHasFlag- Returns:
- The flag value
-
setFlag
-
getRich
- Specified by:
getRichin interfaceIPSHasRichGroup- Returns:
- Get the existing rich group or
nullif none is present.
-
setRich
Description copied from interface:IPSHasRichGroupOverwrite any existing rich group.- Specified by:
setRichin interfaceIPSHasRichGroup- Parameters:
aRich- The new rich group to set. May benull.
-
getLinkable
- Specified by:
getLinkablein interfaceIPSHasLinkableGroup- Returns:
- Get the existing linkable group or
nullif none is present.
-
setLinkable
Description copied from interface:IPSHasLinkableGroupOverwrite any existing linkable group.- Specified by:
setLinkablein interfaceIPSHasLinkableGroup- Parameters:
aLinkable- The new linkable group to set. May benull.
-
isAbstract
public boolean isAbstract()- Returns:
trueif this rule is abstract,falseotherwise. Default is false.
-
setAbstract
public void setAbstract(boolean bAbstract) - Parameters:
bAbstract- The abstract state of this rule.
-
getContext
-
setContext
-
getID
-
setID
Description copied from interface:IPSHasIDSet an ID for this object. -
hasAnyInclude
public boolean hasAnyInclude()- Specified by:
hasAnyIncludein interfaceIPSHasIncludes- Returns:
trueif at least one include is present in this object.
-
getAllIncludes
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSInclude> getAllIncludes()- Specified by:
getAllIncludesin interfaceIPSHasIncludes- Returns:
- A list of all contained includes. Never
null.
-
addInclude
Description copied from interface:IPSHasIncludesAdd an include to this object.- Specified by:
addIncludein interfaceIPSHasIncludes- Parameters:
aInclude- The include to be added. May not benull.
-
hasAnyLet
public boolean hasAnyLet()- Specified by:
hasAnyLetin interfaceIPSHasLets- Returns:
trueif this object has at least on containedPSLetobject.
-
getAllLets
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSLet> getAllLets()- Specified by:
getAllLetsin interfaceIPSHasLets- Returns:
- A list of all contained
PSLetelements. Nevernull.
-
addLet
Description copied from interface:IPSHasLetsAdd aPSLetelement.- Specified by:
addLetin interfaceIPSHasLets- Parameters:
aLet- The let element to be added. May not benull.
-
getAllLetsAsMap
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getAllLetsAsMap()- Specified by:
getAllLetsAsMapin interfaceIPSHasLets- Returns:
- The content of all
PSLetelements as an ordered Map from name to value. The order must match the declaration order! Nevernull.
-
getAllAssertReports
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSAssertReport> getAllAssertReports() -
addAssertReport
-
getAllExtends
-
getExtendsCount
-
hasAnyExtends
public boolean hasAnyExtends() -
addExtends
-
getAllContentElements
@Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<IPSElement> getAllContentElements()- Returns:
- A list consisting of
PSAssertReportandPSExtendsparameters
-
getAsMicroElement
- Specified by:
getAsMicroElementin interfaceIPSElement- Returns:
- The XML representation of this element. Never
null.
-
toString
-