org.ceryle.wiki.plugin.assertion
Class HasAssertedTagOfPlugin

java.lang.Object
  extended by org.ceryle.wiki.plugin.assertion.AssertedPlugin
      extended by org.ceryle.wiki.plugin.assertion.HasAssertedTagOfPlugin
All Implemented Interfaces:
WikiPlugin

public class HasAssertedTagOfPlugin
extends AssertedPlugin

Subclasses the AssertedPlugin to provide a specific query, returning the list of Assertions with a given tag.

This is the equivalent of the AssertedPlugin called as:

      [{Asserted logic='and' predicate='HasTag' object='TAGNAME'}]
  
where 'TAGNAME' is the tag to query.

Syntax

The plugin does not use any parameters, only a body containing a single tag name (multiple tags may be supported in the future).
    [{HasTagOf tag1 }]
  
Because this subclasses AssertedPlugin, its set of available parameters may be used.

Example

To return the list of all wiki pages having the tag "Honcho", you'd use the syntax:
    [{HasTagOf Honcho }]
  
The wiki page "Honcho" would need to already exist, otherwise an error message is displayed (which does include a link to create the missing page). This latter behaviour needs to be fixed.

Author:
Murray Altheim
See Also:
AssertedPlugin

Field Summary
protected static org.apache.log4j.Logger log
           
static String PARAM_OUTPUT
           
 
Fields inherited from class org.ceryle.wiki.plugin.assertion.AssertedPlugin
PARAM_LOGIC, PARAM_OBJECT, PARAM_PAGE, PARAM_PREDICATE, PARAM_RAW, PARAM_SUBJECT, PARAM_TEMPLATES
 
Fields inherited from interface com.ecyrd.jspwiki.plugin.WikiPlugin
CORE_PLUGINS_RESOURCEBUNDLE
 
Constructor Summary
HasAssertedTagOfPlugin()
           
 
Method Summary
protected  void error(WikiContext context, StringBuffer out, Exception e)
          Process an error by clearing the existing buffer and populating it with an error message.
 String execute(WikiContext context, Map params)
           
protected  void printResult(WikiContext context, StringBuffer out, Collection assertions, int format)
          Generate output from the provided Collection according to the format, writing it to the StringBuffer out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_OUTPUT

public static final String PARAM_OUTPUT
See Also:
Constant Field Values

log

protected static org.apache.log4j.Logger log
Constructor Detail

HasAssertedTagOfPlugin

public HasAssertedTagOfPlugin()
Method Detail

execute

public String execute(WikiContext context,
                      Map params)
Specified by:
execute in interface WikiPlugin
Overrides:
execute in class AssertedPlugin

printResult

protected void printResult(WikiContext context,
                           StringBuffer out,
                           Collection assertions,
                           int format)
Generate output from the provided Collection according to the format, writing it to the StringBuffer out. The output format is as according to PluginTextUtils. This differs from the superclass in that it only prints the Subject, not the entire Assertion.

When the AssertionHandler is active, the Collection should contain Assertion objects; when the TagManager is active they will simply be the names of the tags as Strings.

Overrides:
printResult in class AssertedPlugin

error

protected void error(WikiContext context,
                     StringBuffer out,
                     Exception e)
Process an error by clearing the existing buffer and populating it with an error message. The WikiContext is optional; if provided, it suggests help with a link to the "Assert" wiki page.

Copied directly from Tag.



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.