<commit_before>/*
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.  
 */

package org.apache.wiki.event;

import org.apache.wiki.filters.FilterManager;


/**
 * WikiPageEvent indicates a change in the state or processing of a WikiPage. There are basically two types of page events:
 * <dl>
 *   <dt><b>Phase Boundary Events</b></dt>
 *   <dd>Those considered as "beginning-of-phase", and those as "end-of-phase" events (as designated by <tt>*_BEGIN</tt> and
 *        <tt>*_END</tt>), as generated by the WikiEngine. The phases include pre-save, post-save, pre-translate, and post-translate.
 *   </dd>
 *   <dt><b>In-Phase Events</b></dt>
 *   <dd>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.
 *   </dd>
 * </dl>
 * <p>
 * E.g., a typical event sequence for the pre-translate phase would be:
 * </p>
 * <ol>
 *  <li>PRE_TRANSLATE_BEGIN</li>
 *  <li>PRE_TRANSLATE</li>
 *  <li>PRE_TRANSLATE</li>
 *  <li>...</li>
 *  <li>PRE_TRANSLATE_END</li>
 * </ol>
 *
 * <h2>Notes</h2>
 *
 * <h3>Page Requested and Delivered Events</h3>
 * <p>
 * These two events are fired once per page request, at the beginning and after delivery of the page (respectively). They are generated
 * by the {@link org.apache.wiki.ui.WikiServletFilter}.
 * </p>
 *
 * <h3>Page Lock and Unlock Events</h3>
 * <p>
 * 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 {@link org.apache.wiki.pages.PageManager}.
 * </p>
 *
 * <h3>WikiPageEvents</h3>
 * <p>
 * Other WikiPageEvents include both <i>phase boundary</i> and <i>in-phase</i> 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
 * {@link FilterManager}, {@link org.apache.wiki.filters.PageEventFilter}, and potentially other
 * implementing classes.
 * </p>
 *
 * <h3>Firing Order and Phase Boundaries</h3>
 * <p>
 * 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 <tt>*_END</tt> event has
 * been fired.
 * </p>
 *
 * @see     org.apache.wiki.event.WikiEvent
 * @since   2.4.20
 */
public class WikiPageEvent extends WikiEvent {

    private static final long serialVersionUID = 1L;

    // PAGE LOCKING EVENTS ...

    /** Indicates a page lock event. This is based on events generated by {@link org.apache.wiki.pages.PageManager}. */
    public static final int PAGE_LOCK            = 10;

    /** Indicates a page unlock event. This is based on events generated by {@link org.apache.wiki.pages.PageManager}. */
    public static final int PAGE_UNLOCK          = 11;

    // PRE_TRANSLATE .........

    /** Indicates the beginning of all wiki pre-translate page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int PRE_TRANSLATE_BEGIN  = 12;

    /** Indicates a wiki pre-translate page event. This is based on events
      * generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int PRE_TRANSLATE        = 13;

    /** Indicates the end of all wiki pre-translate page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int PRE_TRANSLATE_END    = 14;

    // POST_TRANSLATE ........

    /** Indicates the beginning of all wiki post-translate page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int POST_TRANSLATE_BEGIN = 15;

    /** Indicates a wiki post-translate page event. This is based on events
      * generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int POST_TRANSLATE       = 16;

    /** Indicates the end of all wiki post-translate page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int POST_TRANSLATE_END   = 17;

    // PRE_SAVE ..............

    /** Indicates the beginning of all wiki pre-save page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int PRE_SAVE_BEGIN       = 18;

    /** Indicates a wiki pre-save page event. This is based on events generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int PRE_SAVE             = 19;

    /** Indicates the end of all wiki pre-save page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int PRE_SAVE_END         = 20;

    // POST_SAVE .............

    /** Indicates the beginning of all wiki post-save page events. This is based
      * on events generated by {@link FilterManager}. */
    public static final int POST_SAVE_BEGIN      = 21;

    /** Indicates a wiki post-save page event. This is based on events generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int POST_SAVE            = 22;

    /** Indicates the end of all wiki post-save page events. This is based
     *  on events generated by {@link FilterManager}. */
    public static final int POST_SAVE_END        = 23;

    // PAGE REQUESTS .........

    /** Indicates a wiki page request event (the start of a request). This is based
     *  on events generated by {@link org.apache.wiki.ui.WikiServletFilter}. */
    public static final int PAGE_REQUESTED       = 24;

    /** Indicates a wiki page delivery event (the end of a request). This is based
     *  on events generated by {@link org.apache.wiki.ui.WikiServletFilter}. */
    public static final int PAGE_DELIVERED       = 25;

    /** Indicates a wiki page delete event (the beginning of a delete request). 
     * This is based on events generated by {@link org.apache.wiki.ui.WikiServletFilter}.
     * @since 2.4.65 */
    public static final int PAGE_DELETE_REQUEST  = 26;

    /** Indicates a wiki page deleted event (after the delete has been completed). 
     * This is based on events generated by {@link org.apache.wiki.ui.WikiServletFilter}.
     * @since 2.4.65 */
    public static final int PAGE_DELETED         = 27;

    private String m_pagename;

    // ............

    /**
      * Constructs an instance of this event.
     *
      * @param src  the Object that is the source of the event.<commit_msg>remove unneeded import<commit_after>/*
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.  
 */

package org.apache.wiki.event;

/**
 * WikiPageEvent indicates a change in the state or processing of a WikiPage. There are basically two types of page events:
 * <dl>
 *   <dt><b>Phase Boundary Events</b></dt>
 *   <dd>Those considered as "beginning-of-phase", and those as "end-of-phase" events (as designated by <tt>*_BEGIN</tt> and
 *        <tt>*_END</tt>), as generated by the WikiEngine. The phases include pre-save, post-save, pre-translate, and post-translate.
 *   </dd>
 *   <dt><b>In-Phase Events</b></dt>
 *   <dd>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.
 *   </dd>
 * </dl>
 * <p>
 * E.g., a typical event sequence for the pre-translate phase would be:
 * </p>
 * <ol>
 *  <li>PRE_TRANSLATE_BEGIN</li>
 *  <li>PRE_TRANSLATE</li>
 *  <li>PRE_TRANSLATE</li>
 *  <li>...</li>
 *  <li>PRE_TRANSLATE_END</li>
 * </ol>
 *
 * <h2>Notes</h2>
 *
 * <h3>Page Requested and Delivered Events</h3>
 * <p>
 * These two events are fired once per page request, at the beginning and after delivery of the page (respectively). They are generated
 * by the {@link org.apache.wiki.ui.WikiServletFilter}.
 * </p>
 *
 * <h3>Page Lock and Unlock Events</h3>
 * <p>
 * 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 {@link org.apache.wiki.pages.PageManager}.
 * </p>
 *
 * <h3>WikiPageEvents</h3>
 * <p>
 * Other WikiPageEvents include both <i>phase boundary</i> and <i>in-phase</i> 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
 * {@link org.apache.wiki.filters.FilterManager}, {@link org.apache.wiki.filters.PageEventFilter}, and potentially other
 * implementing classes.
 * </p>
 *
 * <h3>Firing Order and Phase Boundaries</h3>
 * <p>
 * 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 <tt>*_END</tt> event has
 * been fired.
 * </p>
 *
 * @see     org.apache.wiki.event.WikiEvent
 * @since   2.4.20
 */
public class WikiPageEvent extends WikiEvent {

    private static final long serialVersionUID = 1L;

    // PAGE LOCKING EVENTS ...

    /** Indicates a page lock event. This is based on events generated by {@link org.apache.wiki.pages.PageManager}. */
    public static final int PAGE_LOCK            = 10;

    /** Indicates a page unlock event. This is based on events generated by {@link org.apache.wiki.pages.PageManager}. */
    public static final int PAGE_UNLOCK          = 11;

    // PRE_TRANSLATE .........

    /** Indicates the beginning of all wiki pre-translate page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int PRE_TRANSLATE_BEGIN  = 12;

    /** Indicates a wiki pre-translate page event. This is based on events
      * generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int PRE_TRANSLATE        = 13;

    /** Indicates the end of all wiki pre-translate page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int PRE_TRANSLATE_END    = 14;

    // POST_TRANSLATE ........

    /** Indicates the beginning of all wiki post-translate page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int POST_TRANSLATE_BEGIN = 15;

    /** Indicates a wiki post-translate page event. This is based on events
      * generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int POST_TRANSLATE       = 16;

    /** Indicates the end of all wiki post-translate page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int POST_TRANSLATE_END   = 17;

    // PRE_SAVE ..............

    /** Indicates the beginning of all wiki pre-save page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int PRE_SAVE_BEGIN       = 18;

    /** Indicates a wiki pre-save page event. This is based on events generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int PRE_SAVE             = 19;

    /** Indicates the end of all wiki pre-save page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int PRE_SAVE_END         = 20;

    // POST_SAVE .............

    /** Indicates the beginning of all wiki post-save page events. This is based
      * on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int POST_SAVE_BEGIN      = 21;

    /** Indicates a wiki post-save page event. This is based on events generated by {@link org.apache.wiki.filters.PageEventFilter}. */
    public static final int POST_SAVE            = 22;

    /** Indicates the end of all wiki post-save page events. This is based
     *  on events generated by {@link org.apache.wiki.filters.FilterManager}. */
    public static final int POST_SAVE_END        = 23;

    // PAGE REQUESTS .........

    /** Indicates a wiki page request event (the start of a request). This is based
     *  on events generated by {@link org.apache.wiki.ui.WikiServletFilter}. */
    public static final int PAGE_REQUESTED       = 24;

    /** Indicates a wiki page delivery event (the end of a request). This is based
     *  on events generated by {@link org.apache.wiki.ui.WikiServletFilter}. */
    public static final int PAGE_DELIVERED       = 25;

    /** Indicates a wiki page delete event (the beginning of a delete request). 
     * This is based on events generated by {@link org.apache.wiki.ui.WikiServletFilter}.
     * @since 2.4.65 */
    public static final int PAGE_DELETE_REQUEST  = 26;

    /** Indicates a wiki page deleted event (after the delete has been completed). 
     * This is based on events generated by {@link org.apache.wiki.ui.WikiServletFilter}.
     * @since 2.4.65 */
    public static final int PAGE_DELETED         = 27;

    private String m_pagename;

    // ............

    /**
      * Constructs an instance of this event.
     *
      * @param src  the Object that is the source of the event.
{'fraction_non_alphanumeric': 0.10060049929154578, 'fraction_numerical': 0.00850145064435598, 'mean_word_length': 2.838901838901839, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 115, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3872791', 'n_tokens_mistral': 4323, 'n_tokens_neox': 4064, 'n_words': 1715}