Model Bridge API

Last modified by Admin on 2024/12/11 01:38

cogTemporary bridge between new components and the old core, until the old core is completely split into components
TypeJAR
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Installable with the Extension Manager

Description

This is a technical module, for XWiki developers.

It offers some Model interfaces that don't make you depend on xwiki-platform-oldcore at compile time, such as:

  • DocumentAccessBridge: exposes methods for accessing Document data, returning DocumentModelBridge to represent a Document.
  • SkinAccessBridge: exposes methods for accessing Skin data.
  • XWiki 14.0+ DocumentAuthors to manipulate the different authors of a document.

It also provides lots of Events that are useful when you wish to write an EventListener (see tutorial). Note that the "Source" and "Data" column below correspond to the parameters of the EventListener.onEvent(Event event, Object source, Object data) call.

  • Document-related events:
    Event NameSourceDataDescription
    DocumentCreatingEventXWikiDocument objectXWikiContext objectSent when a Document is being created, before it's saved to the store. This gives you the ability to modify the Document before the save or even cancel the save altogether (since 8.0M1)
    DocumentCreatedEventXWikiDocument objectXWikiContext objectSent after the Document has been created and saved. Allows you to perform extra actions (index the content, run some code, etc)
    DocumentDeletingEventXWikiDocument objectXWikiContext objectSent when a Document is being deleted, before it's deleted from the store.
    DocumentDeletedEventXWikiDocument objectXWikiContext objectSent after the Document has been deleted from the store.
    DocumentUpdatingEventXWikiDocument objectXWikiContext objectSent when a Document is being modified, before it's saved to the store. This gives you the ability to modify the Document further before the save or even cancel the save altogether (since 8.0M1)
    DocumentUpdatedEventXWikiDocument objectXWikiContext objectSent after the Document has been saved.
    DocumentRollingBackEventXWikiDocument objectXWikiContext objectSent before a Document is rolled-back.
    DocumentRolledBackEventXWikiDocument objectXWikiContext objectSent after a Document has been rolled-back.
    DocumentVersionRangeDeletedEventXWikiDocument objectXWikiContext objectXWiki 13.5+ Sent after one or several document history versions have been deleted
    DocumentVersionRangeDeletingEventXWikiDocument objectXWikiContext objectXWiki 13.7+ Sent before one or several document history versions are about to be deleted
    DocumentRestoringEventXWikiDocument objectXWikiContext objectXWiki 13.7+ Sent before a document is restored from the recycle bin
    DocumentRestoredEventXWikiDocument objectXWikiContext objectXWiki 13.7+ Sent after a document is restored from the recycle bin
  • Wiki-related events:
    Event NameSourceDataDescription
    WikiReadyEventwiki id (String)XWikiContext objectSent when a wiki is ready to service request (and it's store schema has been updated)
    WikiCreatingEventwiki id (String)XWikiContext objectSent just before a wiki is created
    WikiCreatedEventwiki id (String)XWikiContext objectSent just after a wiki has been created (after provisioning has been done, see below)
    WikiCreateFailedEventwiki id (String)XWikiContext objectSent when a wiki has failed to be created
    WikiCopiedEventwiki id (String)XWikiContext objectSent after a wiki has been copied. Note that this event is an Event that predates the wiki provisioning concept and it's not sent when provisioning
    WikiDeletedEventwiki id (String)XWikiContext objectSent after a wiki has been deleted
    WikiProvisioningEventwiki id (String)XWikiContext objectSent before a wiki has been provisioned (i.e. before the content of the wiki has been filled), during the wiki creation process
    WikiProvisionedEventwiki id (String)XWikiContext objectSent after a wiki has been provisioned (i.e. after the content of the wiki has been filled), during the wiki creation process
  • Other types of events:
    Event NameSourceDataDescription
    ApplicationReadyEventXWiki objectXWikiContext objectSent when the XWiki application is ready to service requests. Note that at this stage the store is ready.
    ActionExecutingEventXWikiDocument objectXWikiContext objectSent when an Action is requested (view, edit, etc) but before the Action is performed. Note that this Event is cancelable.
    ActionExecutedEventXWikiDocument objectXWikiContext objectSent after an Action (view, edit, etc) has executed.

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-bridge 16.10.1):

Get Connected