org.ceryle.wiki.plugin.tag
Class HasTagOfPlugin

java.lang.Object
  extended by org.ceryle.wiki.plugin.tag.HasTagOfPlugin
All Implemented Interfaces:
WikiPlugin
Direct Known Subclasses:
HasTagOf

public class HasTagOfPlugin
extends Object
implements WikiPlugin

Provides a simple logical query feature on wiki page tags.

Syntax

The plugin does not require any parameters, only a body containing one tag name
    [{HasTagOf tag1 }]
  
or more than one tag names separated by the logical operators AND, OR and NOT (in uppercase only).
    [{HasTagOf tag1 OR tag2 OR tag3 }]
  
This also permits bracketed logic statements
    [{HasTagOf ( ( tag1 AND tag2 ) NOT ( tag3 OR tag4 ) ) }]
  

See the PluginTextUtils.formatOutput(WikiEngine,Collection,int,boolean) for information on optional output formatting.

Example

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

Author:
Murray Altheim
See Also:
AssertedPlugin, PluginTextUtils

Field Summary
static String CLASS_HASTAG
          View anchor class attribute value for 'has tag' messages.
protected static org.apache.log4j.Logger log
           
static boolean NO_UNITS
          When true the output using the 'none' output format will include only the numeric value, no units.
static String PARAM_OUTPUT
           
 
Fields inherited from interface com.ecyrd.jspwiki.plugin.WikiPlugin
CORE_PLUGINS_RESOURCEBUNDLE
 
Constructor Summary
HasTagOfPlugin()
           
 
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.
protected  void tagsAsTerms(Map params, TagManager manager)
          Preprocesses the parameter Map, wrapping tags with square brackets so that the parser treats them as wiki page names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_HASTAG

public static String CLASS_HASTAG
View anchor class attribute value for 'has tag' messages. The default value is "hastag".


NO_UNITS

public static boolean NO_UNITS
When true the output using the 'none' output format will include only the numeric value, no units.


PARAM_OUTPUT

public static final String PARAM_OUTPUT
See Also:
Constant Field Values

log

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

HasTagOfPlugin

public HasTagOfPlugin()
Method Detail

execute

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

tagsAsTerms

protected void tagsAsTerms(Map params,
                           TagManager manager)
Preprocesses the parameter Map, wrapping tags with square brackets so that the parser treats them as wiki page names.


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.


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.