Book Versions Developer Documentation
Data structure
The tree is structured with a top page and nested pages. The display order of the pages is based on natural order of the pages name (which is different from the page title) and their hierarchy, but can be changed thanks to the pinned page system. This ordering is common between versions of the book.
In the edit space, each book page has hidden sub-pages, one for each version of the book, storing the versioned content.
The content of unversioned pages is stored directly in the book page themselves.
Hidden sub-pages are hidden as much as possible to the user. In the edit space, when a user navigates to a book page, he is automatically redirected to a hidden sub-page corresponding to the selected version (handled by the navigation menu).
When publishing, a version is selected. The user can select a variant and a library. A copy of the pages is created on the published space, by flattening out the content of the book based on the chosen parameters.
In the published space, the nested structure is kept, but the content of pages is moved from the hidden sub-page to the page itself.
Libraries are independent of books, but have the same data structure. Except for an object distinguishing them from books, libraries share the same code base as books, with features disabled.

Classes
- BookClass: used on the top page of a book.
- LibraryClass: used on the top page of a library.
- BookPageClass: used on every book/library page (not the hidden sub-pages holding the versioned content), even the top page.
- unversioned: set to true if the page is unversioned, thus not needing the hidden sub-pages.
- BookVersionedContentClass: used on every book/library's hidden sub-pages holding the versioned content
- PageStatusClass: used on every book/library's page and hidden sub-pages holding the versioned content, even the top page.
- status: the current status of the page.
- DeletedContentClass: used on every book/library's page and hidden sub-pages holding the versioned content which is set as marked as deleted.
- PageTranslationClass:used on every book/library's page and hidden sub-pages holding the versioned content which is translated. One object is added per language.
- language: the language of the translation,
- title: the translated title,
- status: the status of the translation,
- isDefault: set to true if the language is the default one.
- VariantsListClass: used on every book/library's page and hidden sub-pages holding the versioned content which is associated to one or more variants.
- variantsList: the list of variant references the page is associated to.
- PublicationClass: used only on the top page of a book/library. One object is added per publication's combination of properties:
- id: a combination of the published version page name and, if selected, the published variant page name,
- source: the reference of the page used as the root of pages to be published,
- publishedSpace: the reference of the page used as the root of published pages.
- PublishedBookClass: used on the top page of a published book/library.
- masterName: the name of the original book/library,
- bookVersionName: the name of the version of the publication,
- languages: the list of published languages,
- variantName: the name of the variant of the publication.
- VersionClass: used on version declaration page.
- description: the description of the version.
- precedingVersionReference: the reference of the version to inherit from.
- LibraryReferenceClass: used on book's version declaration pages. One object is added per library version configured for the associated book version.
- libraryReference: the reference of the library,
- libraryVersionReference: the reference of the library's version.
- VariantClass: used on variant declaration page.
- excludePagesOutsideVariant: set to true if only pages associated to the variant will be published
- MultilingualClass: used on the languages administration page of a book.
- enabled: set to true if the book will be translated.
- supportedLanguages: the list of configured languages
- PublicationConfigurationClass: used on each publication configuration page.
- source: the root page of the tree to be published,
- destinationSpace: the space where to publish,
- version: the version,
- variant: the variant,
- language: the language,
- publishOnlyComplete: set to true to only publish "Complete" status pages,
- publishPageOrder: set to true to publish page order,
- publishBehaviour: the behaviour if the destination space is not empty,
- title: the title of the configuration,
- description: the description of the configuration,
Script service
The application script service, called bookversions, is provided to be used from scripts.
In Velocity, it can be called with $services.bookversions.nameOfMethod(methodParameters)
Check BookVersionsScriptService.java to get the list of available methods and their documentation.