org.ceryle.wiki.plugin
Class Category

java.lang.Object
  extended by org.ceryle.wiki.plugin.assertion.AssertionPlugin
      extended by org.ceryle.wiki.plugin.Category
All Implemented Interfaces:
InitializablePlugin, WikiPlugin, PluginConstants

public class Category
extends AssertionPlugin

Provides a simpler syntax for categorization of the calling wiki page by subclassing the AssertionPlugin.

If not explicitly specified, the categorization predicate defaults to the value of CATEGORY_PREDICATE). This must exist as a wiki page.

Please note that this is different than "tagging" a page, which is done using the Tag.

Syntax

The plugin does not use any parameters, only a body containing the category name. Because this subclasses AssertionPlugin, its set of available parameters may be used. To avoid accidental or deliberate abuse, the template parameter is removed/ignored since it doesn't make any sense in this context.
    [{Category categoryName }]
  
If a predicate is desired, it can be added by preceding the category name with the predicate, e.g.:
    [{Category predicate categoryName }]
  

Example

To categorize the current wiki page as "Chunky", you'd use the syntax:
    [{Category Chunky }]
  
The wiki page "Chunky" would need to already exist, otherwise an error message is displayed (which does include a link to create the missing page).

To use a predicate, simply add it before the tag:

    [{Category KindOf Chunky }]
  

Author:
Murray Altheim
See Also:
Tag

Field Summary
static String CATEGORY_PREDICATE
          The name of the categorization predicate.
 
Fields inherited from class org.ceryle.wiki.plugin.assertion.AssertionPlugin
log, m_context, m_debug, m_echo, m_emptyText, m_engine, m_handler, m_hide, m_isTemplate, m_outputFormat, m_params, m_parser, m_queryManager, NoPagesFound, PARAM_ECHO, PARAM_HIDE, PARAM_OUTPUT, PARAM_TEMPLATE, PLUGIN_NAME
 
Fields inherited from interface com.ecyrd.jspwiki.plugin.WikiPlugin
CORE_PLUGINS_RESOURCEBUNDLE
 
Fields inherited from interface org.ceryle.wiki.plugin.util.PluginConstants
ACL, AOP, APOS_ENT, ASTERISK, BCL, BOP, BR, CAPCL, CAPOP, CLATT, COLON, COMMA, DIV_class, DIV_style, DIVCL, DOT, EQ, EQQUO, EQSQUO, FALSE, FORMCL, FORMOP, GET, ICL, INPUTOP, IOP, LABELCL, LABELFOR, LABELOP, LCURL, LICL, LIOP, LPAR, MT, NBSP, NL, OLCL, OLOP, P_class, PCL, PLUGCL, PLUGO, POP, POST, QUO, QUOCL, QUOETCL, RCURL, RPAR, SEMI, SP, SPAN_class, SPANCL, SPANOP, SQUO, TABLECL, TABLEOP, TDCL, TDOP, THCL, THOP, TRCL, TROP, TRUE, TTCL, TTOP, ULCL, ULOP, UNDER
 
Constructor Summary
Category()
           
 
Method Summary
protected  Stack convertToTerms(Map params, String pagename)
          Converts the terms of the expression.
 
Methods inherited from class org.ceryle.wiki.plugin.assertion.AssertionPlugin
appendErrorMessage, assertionError, error, execute, getEngine, initialize, initialize, processExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_PREDICATE

public static final String CATEGORY_PREDICATE
The name of the categorization predicate. This must exist as a wiki page. The value is "HasCategory".

See Also:
Constant Field Values
Constructor Detail

Category

public Category()
Method Detail

convertToTerms

protected Stack convertToTerms(Map params,
                               String pagename)
                        throws PluginException
Converts the terms of the expression. This overrides the superclass, inserting the Subject (the current page name as a Term) and Predicate (the standard category Predicate) as needed, since the Object is already provided by the user. This permits the user to use between one and three tokens/wiki page names.

This removes any trailing commas as a pathological case.

Overrides:
convertToTerms in class AssertionPlugin
Throws:
PluginException


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