Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

This page content is now deprecated and is no longer applicable due to changes in Confluence v7.0 and later and we do not support user macros use with Comala Document Management.

Overview

This page describes how to access metadata from Confluence User Macros using Value References. This allows even the integration of 3rd party apps, which set metadata, and get it from your custom workflows.

...

1.- A user macro (or the 3rth party app) sets this metadata.auditor:

Code Block
languagetextthemeRDark
#set ($containerManagerClass=$content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set ($getInstanceMethod=$containerManagerClass.getDeclaredMethod('getInstance',null))
#set ($containerManager=$getInstanceMethod.invoke(null,null))
#set ($containerContext=$containerManager.containerContext)
#set ($contentPropertyManager=$containerContext.getComponent('contentPropertyManager'))
##Set property
$contentPropertyManager.setTextProperty($content, "metadata.auditor", VALUE)

2. We can validate that the value is properly populated, again with a user macro:

Code Block
languagetextthemeRDark
##Test property
#set ($managerProperty = $contentPropertyManager.getTextProperty($content, "metadata.auditor"))
<p>$managerProperty</p

3.- Finally, we reference that metadata with a value reference @metadata.auditor@:

Code Block
languagetextthemeRDark
{workflow:name=Metadata example}
  {state:Review|approved=Published|rejected=Review}
    {approval:Editor in Chief|user=@auditor@}
  {state}
  {state:Published|final=true|updated=Draft}
  {state}
{workflow}

Summary

Comala Document Management can use metadata in Confluence, provided:

  • The value reference is inserted/retrieved as a content property with the setTextProperty/getTextProperty methods.

  • The value reference is prefixed with "metadata."