Package org.apache.wiki.event

# Class WikiPageEvent

java.lang.Object
java.util.EventObject
org.apache.wiki.event.WikiEvent
org.apache.wiki.event.WikiPageEvent

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `WikiPageRenameEvent`

public class WikiPageEvent extends WikiEvent
WikiPageEvent indicates a change in the state or processing of a WikiPage. There are basically two types of page events:

Phase Boundary Events
  Those considered as "beginning-of-phase", and those as "end-of-phase" events (as designated by `*_BEGIN` and `*_END`), as generated by the WikiEngine. The phases include pre-save, post-save, pre-translate, and post-translate.
In-Phase Events
  In-phase events are generated as specific events from the PageEventFilter (or elsewhere), on a per-listener basis. There may be many such events during a particular phase.

E.g., a typical event sequence for the pre-translate phase would be:

1. PRE_TRANSLATE_BEGIN
2. PRE_TRANSLATE
3. PRE_TRANSLATE
4. ...
5. PRE_TRANSLATE_END

## Notes

### Page Requested and Delivered Events

These two events are fired once per page request, at the beginning and after delivery of the page (respectively). They are generated by the `org.apache.wiki.ui.WikiServletFilter`.

### Page Lock and Unlock Events

Page lock and unlock events occur only once during an editing session, so there are no begin and end events. They are generated by the `org.apache.wiki.pages.PageManager`.

### WikiPageEvents

Other WikiPageEvents include both phase boundary and in-phase events for saving, pre- and post-translating content. These are very noisy event types, but are not fired unless a listener is available. They are generated by the `org.apache.wiki.filters.FilterManager`, `org.apache.wiki.filters.PageEventFilter`, and potentially other implementing classes.

### Firing Order and Phase Boundaries

Note that due to the asynchronous nature of event processing, any threads spawned by such events will not necessarily have completed during their specific phase; we can assume only that no more events of that phase will be fired after its `*_END` event has been fired.

Since:
  2.4.20
See Also:
  - `WikiEvent`
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`PAGE_DELETE_REQUEST`
Indicates a wiki page delete event (the beginning of a delete request).
`static final int`
`PAGE_DELETED`
Indicates a wiki page deleted event (after the delete has been completed).
`static final int`
`PAGE_DELIVERED`
Indicates a wiki page delivery event (the end of a request).
`static final int`
`PAGE_LOCK`
Indicates a page lock event.
`static final int`
`PAGE_REINDEX`
Indicates a wiki page reindex event (a page was changed when requested to a provided)
`static final int`
`PAGE_REQUESTED`
Indicates a wiki page request event (the start of a request).
`static final int`
`PAGE_UNLOCK`
Indicates a page unlock event.
`static final int`
`POST_SAVE`
Indicates a wiki post-save page event.
`static final int`
`POST_SAVE_BEGIN`
Indicates the beginning of all wiki post-save page events.
`static final int`
`POST_SAVE_END`
Indicates the end of all wiki post-save page events.
`static final int`
`POST_TRANSLATE`
Indicates a wiki post-translate page event.
`static final int`
`POST_TRANSLATE_BEGIN`
Indicates the beginning of all wiki post-translate page events.
`static final int`
`POST_TRANSLATE_END`
Indicates the end of all wiki post-translate page events.
`static final int`
`PRE_SAVE`
Indicates a wiki pre-save page event.
`static final int`
`PRE_SAVE_BEGIN`
Indicates the beginning of all wiki pre-save page events.
`static final int`
`PRE_SAVE_END`
Indicates the end of all wiki pre-save page events.
`static final int`
`PRE_TRANSLATE`
Indicates a wiki pre-translate page event.
`static final int`
`PRE_TRANSLATE_BEGIN`
Indicates the beginning of all wiki pre-translate page events.
`static final int`
`PRE_TRANSLATE_END`
Indicates the end of all wiki pre-translate page events.

### Fields inherited from class org.apache.wiki.event.WikiEvent

`ERROR, UNDEFINED`

### Fields inherited from class java.util.EventObject

`source`

## Constructor Summary

Constructors
Constructor
Description
`WikiPageEvent(Object src, int type, String pagename)`
Constructs an instance of this event.

## Method Summary

Modifier and Type
Method
Description
`String`
`eventName()`
Returns a textual representation of the event type.
`String`
`getPageName()`
Returns the Wiki page name associated with this event.
`String`
`getTypeDescription()`
Returns a human-readable description of the event type.
`static boolean`
`isValidType(int type)`
Returns true if the int value is a WikiPageEvent type.

### Methods inherited from class org.apache.wiki.event.WikiEvent

`getArg, getArgs, getSrc, getType, getWhen, setType, toString`

### Methods inherited from class java.util.EventObject

`getSource`

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

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

## Field Details

### PAGE_LOCK

public static final int PAGE_LOCK
Indicates a page lock event. This is based on events generated by `org.apache.wiki.pages.PageManager`.

See Also:
  - Constant Field Values

### PAGE_UNLOCK

public static final int PAGE_UNLOCK
Indicates a page unlock event. This is based on events generated by `org.apache.wiki.pages.PageManager`.

See Also:
  - Constant Field Values

### PRE_TRANSLATE_BEGIN

public static final int PRE_TRANSLATE_BEGIN
Indicates the beginning of all wiki pre-translate page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### PRE_TRANSLATE

public static final int PRE_TRANSLATE
Indicates a wiki pre-translate page event. This is based on events generated by `org.apache.wiki.filters.PageEventFilter`.

See Also:
  - Constant Field Values

### PRE_TRANSLATE_END

public static final int PRE_TRANSLATE_END
Indicates the end of all wiki pre-translate page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### POST_TRANSLATE_BEGIN

public static final int POST_TRANSLATE_BEGIN
Indicates the beginning of all wiki post-translate page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### POST_TRANSLATE

public static final int POST_TRANSLATE
Indicates a wiki post-translate page event. This is based on events generated by `org.apache.wiki.filters.PageEventFilter`.

See Also:
  - Constant Field Values

### POST_TRANSLATE_END

public static final int POST_TRANSLATE_END
Indicates the end of all wiki post-translate page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### PRE_SAVE_BEGIN

public static final int PRE_SAVE_BEGIN
Indicates the beginning of all wiki pre-save page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### PRE_SAVE

public static final int PRE_SAVE
Indicates a wiki pre-save page event. This is based on events generated by `org.apache.wiki.filters.PageEventFilter`.

See Also:
  - Constant Field Values

### PRE_SAVE_END

public static final int PRE_SAVE_END
Indicates the end of all wiki pre-save page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### POST_SAVE_BEGIN

public static final int POST_SAVE_BEGIN
Indicates the beginning of all wiki post-save page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### POST_SAVE

public static final int POST_SAVE
Indicates a wiki post-save page event. This is based on events generated by `org.apache.wiki.filters.PageEventFilter`.

See Also:
  - Constant Field Values

### POST_SAVE_END

public static final int POST_SAVE_END
Indicates the end of all wiki post-save page events. This is based on events generated by `org.apache.wiki.filters.FilterManager`.

See Also:
  - Constant Field Values

### PAGE_REQUESTED

public static final int PAGE_REQUESTED
Indicates a wiki page request event (the start of a request). This is based on events generated by `org.apache.wiki.ui.WikiServletFilter`.

See Also:
  - Constant Field Values

### PAGE_DELIVERED

public static final int PAGE_DELIVERED
Indicates a wiki page delivery event (the end of a request). This is based on events generated by `org.apache.wiki.ui.WikiServletFilter`.

See Also:
  - Constant Field Values

### PAGE_DELETE_REQUEST

public static final int PAGE_DELETE_REQUEST
Indicates a wiki page delete event (the beginning of a delete request). This is based on events generated by `org.apache.wiki.ui.WikiServletFilter`.

Since:
  2.4.65
See Also:
  - Constant Field Values

### PAGE_DELETED

public static final int PAGE_DELETED
Indicates a wiki page deleted event (after the delete has been completed). This is based on events generated by `org.apache.wiki.ui.WikiServletFilter`.

Since:
  2.4.65
See Also:
  - Constant Field Values

### PAGE_REINDEX

public static final int PAGE_REINDEX
Indicates a wiki page reindex event (a page was changed when requested to a provided)

See Also:
  - Constant Field Values

## Constructor Details

### WikiPageEvent

public WikiPageEvent(Object src, int type, String pagename)
Constructs an instance of this event.

Parameters:
  `src` - the Object that is the source of the event.
  `type` - the type of the event (see the enumerated int values defined in `WikiEvent`).
  `pagename` - the WikiPage being acted upon.

## Method Details

### getPageName

public String getPageName()
Returns the Wiki page name associated with this event. This may be null if unavailable.

Returns:
  the Wiki page name associated with this WikiEvent, or null.

### isValidType

public static boolean isValidType(int type)
Returns true if the int value is a WikiPageEvent type.

### eventName

public String eventName()
Returns a textual representation of the event type.

Overrides:
  `eventName` in class `WikiEvent`
Returns:
  a String representation of the type

### getTypeDescription

public String getTypeDescription()
Returns a human-readable description of the event type.

Overrides:
  `getTypeDescription` in class `WikiEvent`
Returns:
  a String description of the type