Class PSRule

java.lang.Object
com.helger.schematron.pure.model.PSRule
All Implemented Interfaces:
IPSElement, IPSHasFlag, IPSHasForeignAttributes, IPSHasForeignElements, IPSHasID, IPSHasIncludes, IPSHasLets, IPSHasLinkableGroup, IPSHasRichGroup

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.
Author:
Philip Helger
  • Field Details

  • Constructor Details

    • PSRule

      public PSRule()
  • Method Details

    • isValid

      public boolean isValid(@Nonnull IPSErrorHandler aErrorHandler)
      Description copied from interface: IPSElement
      Check if this element is specified completely. This method stops at the first encountered error.
      Specified by:
      isValid in interface IPSElement
      Parameters:
      aErrorHandler - The error handler where the error details are stored. May not be null.
      Returns:
      true if all mandatory fields are set and the element is valid, false otherwise.
    • validateCompletely

      public void validateCompletely(@Nonnull IPSErrorHandler aErrorHandler)
      Description copied from interface: IPSElement
      Check if this element is specified completely. This method performs all validations independent of the number of encountered error.
      Specified by:
      validateCompletely in interface IPSElement
      Parameters:
      aErrorHandler - The error handler where the error details are stored. May not be null.
    • isMinimal

      public boolean isMinimal()
      Specified by:
      isMinimal in interface IPSElement
      Returns:
      true if this element conforms to the Schematron minimal syntax, false otherwise.
    • addForeignElement

      public void addForeignElement(@Nonnull com.helger.xml.microdom.IMicroElement aForeignElement)
      Specified by:
      addForeignElement in interface IPSHasForeignElements
    • hasForeignElements

      public boolean hasForeignElements()
      Specified by:
      hasForeignElements in interface IPSHasForeignElements
    • getAllForeignElements

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<com.helger.xml.microdom.IMicroElement> getAllForeignElements()
      Specified by:
      getAllForeignElements in interface IPSHasForeignElements
    • addForeignAttribute

      public void addForeignAttribute(@Nonnull String sAttrName, @Nonnull String sAttrValue)
      Specified by:
      addForeignAttribute in interface IPSHasForeignAttributes
    • hasForeignAttributes

      public boolean hasForeignAttributes()
      Specified by:
      hasForeignAttributes in interface IPSHasForeignAttributes
    • getAllForeignAttributes

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getAllForeignAttributes()
      Specified by:
      getAllForeignAttributes in interface IPSHasForeignAttributes
    • getFlag

      @Nullable public String getFlag()
      Description copied from interface: IPSHasFlag
      The 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:
      getFlag in interface IPSHasFlag
      Returns:
      The flag value
    • setFlag

      public void setFlag(@Nullable String sFlag)
    • getRich

      @Nullable public PSRichGroup getRich()
      Specified by:
      getRich in interface IPSHasRichGroup
      Returns:
      Get the existing rich group or null if none is present.
    • setRich

      public void setRich(@Nullable PSRichGroup aRich)
      Description copied from interface: IPSHasRichGroup
      Overwrite any existing rich group.
      Specified by:
      setRich in interface IPSHasRichGroup
      Parameters:
      aRich - The new rich group to set. May be null.
    • getLinkable

      @Nullable public PSLinkableGroup getLinkable()
      Specified by:
      getLinkable in interface IPSHasLinkableGroup
      Returns:
      Get the existing linkable group or null if none is present.
    • setLinkable

      public void setLinkable(@Nullable PSLinkableGroup aLinkable)
      Description copied from interface: IPSHasLinkableGroup
      Overwrite any existing linkable group.
      Specified by:
      setLinkable in interface IPSHasLinkableGroup
      Parameters:
      aLinkable - The new linkable group to set. May be null.
    • isAbstract

      public boolean isAbstract()
      Returns:
      true if this rule is abstract, false otherwise. Default is false.
    • setAbstract

      public void setAbstract(boolean bAbstract)
      Parameters:
      bAbstract - The abstract state of this rule.
    • getContext

      @Nullable public String getContext()
    • setContext

      public void setContext(@Nullable String sContext)
    • getID

      @Nullable public String getID()
      Specified by:
      getID in interface IPSHasID
      Returns:
      The optional ID of this element. May be null.
    • setID

      public void setID(@Nullable String sID)
      Description copied from interface: IPSHasID
      Set an ID for this object.
      Specified by:
      setID in interface IPSHasID
      Parameters:
      sID - The ID to be set. May be null.
    • hasAnyInclude

      public boolean hasAnyInclude()
      Specified by:
      hasAnyInclude in interface IPSHasIncludes
      Returns:
      true if at least one include is present in this object.
    • getAllIncludes

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSInclude> getAllIncludes()
      Specified by:
      getAllIncludes in interface IPSHasIncludes
      Returns:
      A list of all contained includes. Never null.
    • addInclude

      public void addInclude(@Nonnull PSInclude aInclude)
      Description copied from interface: IPSHasIncludes
      Add an include to this object.
      Specified by:
      addInclude in interface IPSHasIncludes
      Parameters:
      aInclude - The include to be added. May not be null.
    • hasAnyLet

      public boolean hasAnyLet()
      Specified by:
      hasAnyLet in interface IPSHasLets
      Returns:
      true if this object has at least on contained PSLet object.
    • getAllLets

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSLet> getAllLets()
      Specified by:
      getAllLets in interface IPSHasLets
      Returns:
      A list of all contained PSLet elements. Never null.
    • addLet

      public void addLet(@Nonnull PSLet aLet)
      Description copied from interface: IPSHasLets
      Add a PSLet element.
      Specified by:
      addLet in interface IPSHasLets
      Parameters:
      aLet - The let element to be added. May not be null.
    • getAllLetsAsMap

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedMap<String,String> getAllLetsAsMap()
      Specified by:
      getAllLetsAsMap in interface IPSHasLets
      Returns:
      The content of all PSLet elements as an ordered Map from name to value. The order must match the declaration order! Never null.
    • getAllAssertReports

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSAssertReport> getAllAssertReports()
    • addAssertReport

      public void addAssertReport(@Nonnull PSAssertReport aAssertReport)
    • getAllExtends

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<PSExtends> getAllExtends()
    • getExtendsCount

      @Nonnegative public int getExtendsCount()
    • hasAnyExtends

      public boolean hasAnyExtends()
    • addExtends

      public void addExtends(@Nonnull PSExtends aExtends)
    • getAllContentElements

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsList<IPSElement> getAllContentElements()
      Returns:
      A list consisting of PSAssertReport and PSExtends parameters
    • getAsMicroElement

      @Nonnull public com.helger.xml.microdom.IMicroElement getAsMicroElement()
      Specified by:
      getAsMicroElement in interface IPSElement
      Returns:
      The XML representation of this element. Never null.
    • toString

      public String toString()
      Overrides:
      toString in class Object