Class ForEachTag

java.lang.Object
jakarta.servlet.jsp.tagext.TagSupport
jakarta.servlet.jsp.tagext.BodyTagSupport
net.ontopia.topicmaps.nav2.taglibs.tolog.ForEachTag
All Implemented Interfaces:
jakarta.servlet.jsp.tagext.BodyTag, jakarta.servlet.jsp.tagext.IterationTag, jakarta.servlet.jsp.tagext.JspTag, jakarta.servlet.jsp.tagext.Tag, Serializable

public class ForEachTag extends jakarta.servlet.jsp.tagext.BodyTagSupport
INTERNAL: Tolog Tag for executing a query, iterating over each object in a result collection and creating new content for each iteration. The column names in the query result are accessible as variables in the body of the tag, and are bound to the query result row of that iteration. The groupBy attribute can be used to indicate that only some of the column names should be bound (yet), and that only lines which differ in those columns should produce new output. To access those columns, one can use another ForEachTag nested within this one, which has no query attribute, but uses the result set produced here. The nested ForEachTag can group by columns not yet grouped. This can format a tree-result like the following (using a single query): Asia China Beijing Shanghai India Delhi Europe Sweden Gothenburg
See Also:
  • Field Details

    • groupingAncestor

      protected ForEachTag groupingAncestor
    • queryWrapper

      protected QueryWrapper queryWrapper
    • groupColumns

      protected boolean[] groupColumns
    • groupNames

      protected Set groupNames
    • orderBy

      protected List orderBy
    • hasValidated

      protected boolean hasValidated
    • sequenceNumber

      protected int sequenceNumber
    • neverEvaluatedBody

      protected boolean neverEvaluatedBody
    • SEQUENCE_FIRST

      protected static final String SEQUENCE_FIRST
      See Also:
    • SEQUENCE_NUMBER

      protected static final String SEQUENCE_NUMBER
      See Also:
    • SEQUENCE_LAST

      protected static final String SEQUENCE_LAST
      See Also:
    • FALSE

      protected static final Collection FALSE
    • TRUE

      protected static final Collection TRUE
    • query

      protected String query
    • groupBy

      protected String groupBy
    • separator

      protected String separator
  • Constructor Details

    • ForEachTag

      public ForEachTag()
  • Method Details

    • doStartTag

      public int doStartTag() throws jakarta.servlet.jsp.JspTagException
      Process the start tag for this instance. Depending on the input, chooses between evaluating an input query or continuing iteration over a queryResult obtained in an ancestor ForEachTag. Binds any varibles needed in the body.
      Specified by:
      doStartTag in interface jakarta.servlet.jsp.tagext.Tag
      Overrides:
      doStartTag in class jakarta.servlet.jsp.tagext.BodyTagSupport
      Throws:
      jakarta.servlet.jsp.JspTagException
    • getOrderBy

      protected List getOrderBy()
      Get the names to order by in this tag (to be used by nested tags for ordering
    • needsCurrentRow

      public boolean needsCurrentRow()
      Checks if this ForEachTag needs the current row of the query result.
    • processGroupBy

      protected void processGroupBy() throws jakarta.servlet.jsp.JspTagException
      Finds out which columns to group by based on a space separated string.
      Throws:
      jakarta.servlet.jsp.JspTagException
    • validateGroupByOrderBy

      protected void validateGroupByOrderBy() throws jakarta.servlet.jsp.JspTagException
      Validate the groupNames against the names in orderBy.
      Throws:
      jakarta.servlet.jsp.JspTagException
    • doAfterBody

      public int doAfterBody() throws jakarta.servlet.jsp.JspTagException
      Actions after some body has been evaluated.
      Specified by:
      doAfterBody in interface jakarta.servlet.jsp.tagext.IterationTag
      Overrides:
      doAfterBody in class jakarta.servlet.jsp.tagext.BodyTagSupport
      Throws:
      jakarta.servlet.jsp.JspTagException
    • getQueryWrapper

      protected QueryWrapper getQueryWrapper()
    • doEndTag

      public int doEndTag() throws jakarta.servlet.jsp.JspException
      Process the end tag.
      Specified by:
      doEndTag in interface jakarta.servlet.jsp.tagext.Tag
      Overrides:
      doEndTag in class jakarta.servlet.jsp.tagext.BodyTagSupport
      Throws:
      jakarta.servlet.jsp.JspException
    • release

      public void release()
      Resets the state of the Tag.
      Specified by:
      release in interface jakarta.servlet.jsp.tagext.Tag
      Overrides:
      release in class jakarta.servlet.jsp.tagext.BodyTagSupport
    • setSeparator

      public void setSeparator(String separator)
    • setGroupBy

      public void setGroupBy(String groupBy)
    • setQuery

      public void setQuery(String query)