In addition, since we want to keep a hierarchical directory structure, we define a folder item type named book_folder:

<item-descriptor name="book_folder"
                 display-property="folderPath"
                 folder="true"
                 content-path-property="folderPath"
                 folder-id-property="parentFolder">
  <table name="book_folder" id-column-name="id" type="primary">
          <property name="parentFolder" item-type="book_folder"/>
          <property name="folderPath" data-type="big string"/>
  </table>
</item-descriptor>

This item type is specified to be a folder, using the attribute folder="true". The folder-id-property attribute in the item-descriptor tag indicates that this item stores its parent folder ID in the database using a property named parentFolder.

Both the book and the book_folder item type stores their paths in the database using the content-path-property attribute. The content-path-property attribute indicates the property of this item that defines the absolute path name of this item in the folder hierarchy. In this example, the path is stored in the property named folderPath. If our example had especially deep hierarchies, resulting in excessively long path names, we might instead store just the name of this item using the content-name-property attribute, and have the repository calculate the item’s absolute path by determining its parent folders, using the property indicated by the folder-id-property attribute.

 
loading table of contents...