This documentation relates to the latest version of Confluence.
If you are using an earlier version, please go to the documentation home page and select the relevant version.

How do I associate my own properties with a ContentEntityObject?

All Versions

Confluence 3.0 Documentation

How do I associate my own properties with a ContentEntityObject?

You will need the ContentEntityManager (see how to retrieve it). This manager allows you to store and retrieve arbitrary String values associated with a ContentEntityObject.

Properties are stored as simple key/value pairs. We recommend that anyone writing a third-party plugin use the standard Java "reverse domain name" syntax to ensure their keys are unique. Keys may be no longer than 200 characters.

// Set the property
contentPropertyManager.setText(page, "com.example.myProperty", "This is the value")
// Retrieve it
String myProperty = contentPropertyManager.getText(page, "com.example.myProperty")

getText and setText can store strings of arbitrary length (up to the size-limit for CLOBs in your database). There is also a getString and setString which is slightly more efficient, but limited to 255 characters per value.

Labels

faq_conf_dev faq_conf_dev Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 05, 2007

    Leo Haskin says:

    Please link the "how to retrieve it" link to a page that describes how to. ...

    Please link the "how to retrieve it" link to a page that describes how to.  Thanks!

    1. May 02

      Ben Aveling says:

      See http://confluence.atlassian.com/display/DOC/Accessing+Confluence+Components+...
  2. Mar 29, 2007

    Jon Nermut says:

    What's the best way to store properties against a Space, which is not a ContentE...

    What's the best way to store properties against a Space, which is not a ContentEntityObject afaik ?

    1. Mar 29, 2007

      Charles Miller says:

      Each space has a SpaceDescription accessible via space.getDescription(). SpaceDe...

      Each space has a SpaceDescription accessible via space.getDescription(). SpaceDescription is a ContentEntityObject.

      Alternatively, use Bandana to store properties in the space's context.

  3. Dec 09, 2008

    Tim McDougall says:

    The code is missing semicolons.

    The code is missing semicolons.

Add Comment


Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 2.5 Australia License.