You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

projectdoc Toolbox

A short introduction to use projectdoc services in the context of velocity to integrate with user macros.

Since
4.1

Services

This section lists services available in the velocity context to be used with user macros in Confluence.

projectdoc Document Manager

projectdoc documents are accessible via the projectdoc document manager by the key projectdocDocumentManager.

getDocumentByPageId

pageIdThe identifier of a Confluence page.

Provides access to a document with all properties set. The document is referenced by a page identifier.

#set ( $document = $projectdocDocumentManager.getDocumentBasicsByPageId(819207)) 
#set ( $property = $document.getProperty($paramName)) 
#set ( $propertyValue = $property.getRenderedValue()) 

getDocumentByPage

pageA Confluence page.

Provides access to a document with all properties set. The document is referenced by a page.

#set ( $page = $pageManager.getPage(819207)) 

#set ( $document = $projectdocDocumentManager.getDocumentBasicsByPage($page)) 
#set ( $property = $document.getProperty($paramName)) 
#set ( $propertyValue = $property.getRenderedValue()) 

getDocumentBasicsByPageId

pageIdThe identifier of a Confluence page.

Provides access to a document with basic properties set. The document is referenced by a page identifier.

This version is faster in case only properties entered by a user are to accessed.

getDocumentBasicsByPage

pageA confluence page.

Provides access to a document with basic properties set. The document is referenced by a page.

This version is faster in case only properties entered by a user are to accessed.

projectdoc Document Property Manager

Properties of projectdoc documents are directly accessible via the projectdoc document property manager by the key  projectdocDocumentPropertyManager .

getDocumentPropertyAsString (by page)

pageA Confluence page.
nameThe name of the property.

Provides access to a document property by page and document property name.

#set ( $page = $pageManager.getPage(819207)) 
#set ( $propertyValue = $projectdocDocumentPropertyManager.getDocumentPropertyAsString($page, "Name")) 

getDocumentPropertyAsString (by page ID)

pageIdThe identifier of a Confluence page.
nameThe name of the property.

Provides access to a document property by page identifier and document property name.

#set ( $propertyValue = $projectdocDocumentPropertyManager.getDocumentPropertyAsString(819207, "Name")) 

getDocumentPropertyByKeyAsString (by page)

pageA Confluence page.
nameThe name of the property.

Provides access to a document property value by page identifier and document property name key.

This allows to access a property dependent on the currently used locale.

#set ( $page = $pageManager.getPage(819207)) 
#set ( $propertyValue = $projectdocDocumentPropertyManager.getDocumentPropertyByKeyAsString($page, "projectdoc.doctype.common.name")) 

getDocumentPropertyByKeyAsString (by page ID)

pageIdThe identifier of a Confluence page.
nameThe name of the property.

Provides access to a document property value by page identifier and document property name.

This allows to access a property dependent on the currently used locale.

#set ( $propertyValue = $projectdocDocumentPropertyManager.getDocumentPropertyByKeyAsString(819207, "projectdoc.doctype.common.name")) 

Resources

Writing User Macros
User macros are useful if you want to create your own custom macros. These can be to perform specific actions, apply custom formatting and much more. 
Confluence objects accessible from Velocity
Confluence has a few distinct Velocity contexts for different purposes in the application (user macros, email templates, and exports), but the most commonly used context is called the "default context".
  • No labels