Package org.apache.wiki.plugin

## Class AbstractReferralPlugin

- java.lang.Object
- - org.apache.wiki.plugin.AbstractReferralPlugin

All Implemented Interfaces:
  `Plugin`

Direct Known Subclasses:
  `IndexPlugin`, `PageViewPlugin`, `RecentChangesPlugin`, `ReferringPagesPlugin`, `ReferringUndefinedPagesPlugin`, `UndefinedPagesPlugin`, `UnusedPagesPlugin`

    public abstract class AbstractReferralPlugin
    extends java.lang.Object
    implements Plugin

This is a base class for all plugins using referral things.

Parameters (also valid for all subclasses of this class) :

- maxwidth - maximum width of generated links
- separator - separator between generated links (wikitext)
- after - output after the link
- before - output before the link
- exclude - a regular expression of pages to exclude from the list.
- include - a regular expression of pages to include in the list.
- show - value is either "pages" (default) or "count". When "count" is specified, shows only the count of pages which match. (since 2.8)
- columns - How many columns should the output be displayed on.
- showLastModified - When show=count, shows also the last modified date. (since 2.8)
- sortOrder - specifies the sort order for the resulting list. Options are 'human', 'java', 'locale' or a `RuleBasedCollator` rule string. (since 2.8.3)

### Field Summary

Fields
`static int` `ALL_ITEMS` Magic value for rendering all items.
`protected int` `items`
`protected java.lang.String` `m_after`
`protected java.lang.String` `m_before`
`protected java.text.SimpleDateFormat` `m_dateFormat`
`protected java.util.Date` `m_dateLastModified`
`protected Engine` `m_engine`
`protected org.apache.oro.text.regex.Pattern[]` `m_exclude`
`protected org.apache.oro.text.regex.Pattern[]` `m_include`
`protected boolean` `m_lastModified`
`protected int` `m_maxwidth`
`protected java.lang.String` `m_separator`
`protected java.lang.String` `m_show`
`protected PageSorter` `m_sorter`
`static java.lang.String` `PARAM_AFTER` Parameter name for the output after the link.
`static java.lang.String` `PARAM_BEFORE` Parameter name for the output before the link.
`static java.lang.String` `PARAM_COLUMNS` Parameter name for setting the number of columns that will be displayed by the plugin.
`static java.lang.String` `PARAM_EXCLUDE` Parameter name for setting the list of excluded patterns.
`static java.lang.String` `PARAM_INCLUDE` Parameter name for setting the list of included patterns.
`static java.lang.String` `PARAM_LASTMODIFIED` Parameter name for showing the last modification count.
`static java.lang.String` `PARAM_MAXWIDTH` Parameter name for setting the maximum width.
`static java.lang.String` `PARAM_SEPARATOR` Parameter name for the separator string.
`static java.lang.String` `PARAM_SHOW` Parameter name for the show parameter.
`static java.lang.String` `PARAM_SHOW_VALUE_COUNT` Parameter name for setting show to "count".
`static java.lang.String` `PARAM_SHOW_VALUE_PAGES` Parameter name for setting show to "pages".
`protected static java.lang.String` `PARAM_SORTORDER` Parameter name for specifying the sort order.
`protected static java.lang.String` `PARAM_SORTORDER_HUMAN`
`protected static java.lang.String` `PARAM_SORTORDER_JAVA`
`protected static java.lang.String` `PARAM_SORTORDER_LOCALE`

### Fields inherited from interface org.apache.wiki.api.plugin.Plugin

`CORE_PLUGINS_RESOURCEBUNDLE`

### Constructor Summary

Constructors
`AbstractReferralPlugin()`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected java.lang.String` `applyColumnsStyle​(java.lang.String result)`
`protected java.util.List<java.lang.String>` `filterAndSortCollection​(java.util.Collection<java.lang.String> c)` Filters and sorts a collection according to the include and exclude parameters.
`protected java.util.List<java.lang.String>` `filterCollection​(java.util.Collection<java.lang.String> c)` Filters a collection according to the include and exclude parameters.
`protected java.util.List<Page>` `filterWikiPageCollection​(java.util.Collection<Page> pages)`
`void` `initialize​(Context context, java.util.Map<java.lang.String,​java.lang.String> params)`
`protected java.lang.String` `makeHTML​(Context context, java.lang.String wikitext)` Makes HTML with common parameters.
`protected java.lang.String` `wikitizeCollection​(java.util.Collection<java.lang.String> links, java.lang.String separator, int numItems)` Makes WikiText from a Collection.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.wiki.api.plugin.Plugin

`execute`

### Field Detail

#### ALL_ITEMS

    public static final int ALL_ITEMS

Magic value for rendering all items.

See Also:
  Constant Field Values

#### PARAM_MAXWIDTH

    public static final java.lang.String PARAM_MAXWIDTH

Parameter name for setting the maximum width. Value is `"maxwidth"`.

See Also:
  Constant Field Values

#### PARAM_SEPARATOR

    public static final java.lang.String PARAM_SEPARATOR

Parameter name for the separator string. Value is `"separator"`.

See Also:
  Constant Field Values

#### PARAM_AFTER

    public static final java.lang.String PARAM_AFTER

Parameter name for the output after the link. Value is `"after"`.

See Also:
  Constant Field Values

#### PARAM_BEFORE

    public static final java.lang.String PARAM_BEFORE

Parameter name for the output before the link. Value is `"before"`.

See Also:
  Constant Field Values

#### PARAM_EXCLUDE

    public static final java.lang.String PARAM_EXCLUDE

Parameter name for setting the list of excluded patterns. Value is `"exclude"`.

See Also:
  Constant Field Values

#### PARAM_INCLUDE

    public static final java.lang.String PARAM_INCLUDE

Parameter name for setting the list of included patterns. Value is `"include"`.

See Also:
  Constant Field Values

#### PARAM_SHOW

    public static final java.lang.String PARAM_SHOW

Parameter name for the show parameter. Value is `"show"`.

See Also:
  Constant Field Values

#### PARAM_SHOW_VALUE_PAGES

    public static final java.lang.String PARAM_SHOW_VALUE_PAGES

Parameter name for setting show to "pages". Value is `"pages"`.

See Also:
  Constant Field Values

#### PARAM_SHOW_VALUE_COUNT

    public static final java.lang.String PARAM_SHOW_VALUE_COUNT

Parameter name for setting show to "count". Value is `"count"`.

See Also:
  Constant Field Values

#### PARAM_LASTMODIFIED

    public static final java.lang.String PARAM_LASTMODIFIED

Parameter name for showing the last modification count. Value is `"showLastModified"`.

See Also:
  Constant Field Values

#### PARAM_COLUMNS

    public static final java.lang.String PARAM_COLUMNS

Parameter name for setting the number of columns that will be displayed by the plugin. Value is `"columns"`. Available since 2.11.0.

See Also:
  Constant Field Values

#### PARAM_SORTORDER

    protected static final java.lang.String PARAM_SORTORDER

Parameter name for specifying the sort order. Value is `"sortOrder"`.

See Also:
  Constant Field Values

#### PARAM_SORTORDER_HUMAN

    protected static final java.lang.String PARAM_SORTORDER_HUMAN

See Also:
  Constant Field Values

#### PARAM_SORTORDER_JAVA

    protected static final java.lang.String PARAM_SORTORDER_JAVA

See Also:
  Constant Field Values

#### PARAM_SORTORDER_LOCALE

    protected static final java.lang.String PARAM_SORTORDER_LOCALE

See Also:
  Constant Field Values

#### m_maxwidth

    protected int m_maxwidth

#### m_before

    protected java.lang.String m_before

#### m_separator

    protected java.lang.String m_separator

#### m_after

    protected java.lang.String m_after

#### items

    protected int items

#### m_exclude

    protected org.apache.oro.text.regex.Pattern[] m_exclude

#### m_include

    protected org.apache.oro.text.regex.Pattern[] m_include

#### m_sorter

    protected PageSorter m_sorter

#### m_show

    protected java.lang.String m_show

#### m_lastModified

    protected boolean m_lastModified

#### m_dateLastModified

    protected java.util.Date m_dateLastModified

#### m_dateFormat

    protected java.text.SimpleDateFormat m_dateFormat

#### m_engine

    protected Engine m_engine

### Constructor Detail

#### AbstractReferralPlugin

    public AbstractReferralPlugin()

### Method Detail

#### initialize

    public void initialize​(Context context,
                           java.util.Map<java.lang.String,​java.lang.String> params)
                    throws PluginException

Parameters:
  `context` - the wiki context
  `params` - parameters for initializing the plugin
Throws:
  `PluginException` - if any of the plugin parameters are malformed

#### filterWikiPageCollection

    protected java.util.List<Page> filterWikiPageCollection​(java.util.Collection<Page> pages)

#### filterCollection

    protected java.util.List<java.lang.String> filterCollection​(java.util.Collection<java.lang.String> c)

Filters a collection according to the include and exclude parameters.

Parameters:
  `c` - The collection to filter.
Returns:
  A filtered collection.

#### filterAndSortCollection

    protected java.util.List<java.lang.String> filterAndSortCollection​(java.util.Collection<java.lang.String> c)

Filters and sorts a collection according to the include and exclude parameters.

Parameters:
  `c` - The collection to filter.
Returns:
  A filtered and sorted collection.

#### wikitizeCollection

    protected java.lang.String wikitizeCollection​(java.util.Collection<java.lang.String> links,
                                                  java.lang.String separator,
                                                  int numItems)

Makes WikiText from a Collection.

Parameters:
  `links` - Collection to make into WikiText.
  `separator` - Separator string to use.
  `numItems` - How many items to show.
Returns:
  The WikiText

#### makeHTML

    protected java.lang.String makeHTML​(Context context,
                                        java.lang.String wikitext)

Makes HTML with common parameters.

Parameters:
  `context` - The WikiContext
  `wikitext` - The wikitext to render
Returns:
  HTML
Since:
  1.6.4

#### applyColumnsStyle

    protected java.lang.String applyColumnsStyle​(java.lang.String result)