Wiki Custom Properties API

Last modified by Admin on 2021/03/17 21:07

cogProvides a scripting API to access and manage generic custom properties in the wiki descriptor
TypeJAR
Category
Developed by

Denis Gervalle

Active Installs0
Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Installable with the Extension Manager

Description

The main purpose of this extension is to provide a simplified solution to add some properties to wiki descriptor. It implements a generic WikiPropertyGroup that may persist its properties into an object of XClass XWiki.XWikiExtendedServerClass stored into the same document than the default descriptor. To have your properties persisted, you need to define those properties into this new XClass.

This is the responsibility of the consumer of this API to properly define the properties in the XWiki.XWikiExtendedServerClass, and to provide appropriately typed values for them.

Script Service: $services.wiki.customproperties

This script services allow easy management of the properties from velocity. To be able to change or persist properties, you need to have admin access on the wiki your are editing. The API provides the following features:

Get the value of <propertyName> custom property from the cached descriptor of the current wiki:

$services.wiki.customproperties.<propertyName>

Get the value of <propertyName> custom property from the cached descriptor of the <wikiId> wiki:

$services.wiki.customproperties.get("<wikiId>","<propertyName>")

Set the value of the <propertyName> property in the cached descriptor of the current wiki and save it into the database.

$services.wiki.customproperties.save("<propertyName>", <propertyValue>)

Set the value of the <propertyName> property in the cached descriptor of the <wikiId> wiki and save it into the database.

$services.wiki.customproperties.save("<wikiId>", "<propertyName>", <propertyValue>)

Set the value of <propertyName> custom property in the cached descriptor of the current wiki:

$services.wiki.customproperties.set("<propertyName>", <propertyValue>)

Set the value of <propertyName> custom property in the cached descriptor of the <wikiId> wiki:

$services.wiki.customproperties.set("<wikiId>", "<propertyName>", <propertyValue>)

Save into the database the custom property values currently stored in the cached descriptor of the current wiki:

$services.wiki.customproperties.save()

Save into the database the custom property values currently stored in the cached descriptor of the <wikiId> wiki:

$services.wiki.customproperties.save("<wikiId>")

For more details, you can consult the javadoc.

Java API

For details about the Java API, you can consult the javadoc of the WikiCustomPropertiesManager class.

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.contrib:api-wiki-customproperties 1.0):

  • org.xwiki.commons:xwiki-commons-component-api 5.3
  • org.xwiki.platform:xwiki-platform-wiki-api 5.3
  • org.xwiki.platform:xwiki-platform-wiki-default 5.3
  • org.xwiki.platform:xwiki-platform-oldcore 5.3
  • org.xwiki.platform:xwiki-platform-security-api 5.3
  • org.xwiki.commons:xwiki-commons-script 5.3
Tags:
    

Get Connected