What it’s for
The standard exporting/importing functionality available in the core API exports thebookmarks/ endpoint in the Content Server
as a .json file. However, as the number of bookmarks delivered with
Solutions increases, this option presents a number of issues:
-
The
.jsonfile becomes cumbersome to track in git. - Customizations are increasingly difficult to perform.
- Merging custom bookmarks with any Solution changes is awkward.
- Incorporating changes becomes easier.
- Git is able to track changes to individual files.
- Merging separate sets of bookmarks becomes as simple as copying custom files or directories to the appropriate location.
Exporting
To export bookmarks:- Run as usual.
- Configure the export behavior.
-
Run the
mainmethod of theExportReferenceContentServerclass. - (Optional) To export to a different folder, you can modify the frtb-content-server parameter of the exportBookmarks() call.
src/test/resources folder of the
respective starter module. You can find the properties in the
${solution-name}.test.properties file
Importing
Solutions provide a default set of bookmarks in theaccelerator-ui standalone module included in the release deliverables.
The import behavior of the content service is configurable within the
src/main/resources/${solution-name}.properties file in the
starter project:
The file and folder names will be resolved using a Spring
PathMatchingResourcePatternResolver, and the properties conform to its
required format.
For an application built as a SpringBoot JAR, the properties have to be
replaced with properly formatted absolute paths, as it is impossible to
load folders directly from a JAR file.
Format
Export format
The bookmarks directory exported by this tool will contain the folders and files in the following structure:Bookmarks
Individual bookmarks (withinbookmark-name.json files) conform to the
ActiveUI/Content Server format. The Bookmark Tool offers no additional
features or configuration options for bookmark content.
Metadata
bookmark-name_metadata.json files are configuration files for
ActiveUI/Content Server auxiliary features.
The files support the following format:
Due to all supported properties being optional, the metadata files can
be omitted altogether for new bookmarks. Once imported into the Content
Server, the generated internal metadata must be exported (see
Exporting), to guarantee key persistence.
Permissions
Behavior
- If a folder or file does not have any permissions defined in the relevant metadata file, it uses the permissions of its parent. This inheritance policy is applied right through to the top of the bookmark tree.
- If none of the files or folders have custom permissions, the default permissions passed into the library call will be used.
Impact on export and import
Which permissions get exported or imported depends on whether permissions are defined in the metadata file for the given folder or file in addition to its location in the bookmarks structure.Example
In this example, the default permission is set asUSER/USER and the bookmark structure is as
follows:
- Custom permissions have been set for
Folder1andBookmark3.
So they have their respective permissions filesFolder1_metadata.jsonandBookmark3_metadata.json - All children of
Folder1inherit its permissions[ROOT/USER]except forBookmark3which has its own permissions[USER/USER] - All other folders and files will use the default permissions as they have no permissions files set.
Merging or modifying bookmarks
-
To merge bookmarks, copy the relevant
folders and bookmark files to the appropriate location within
the
bookmarks-listingdirectory, together with thename_metadata.jsonfile, where appropriate. -
To edit a bookmark, modify its
.jsonfile. -
To edit the description and permissions of files and folders in the
UI, modify the relevant
name_metadata.jsonfile. If the file does not exist, create it with the following format: