OpenWGA 7.0 - OpenWGA Concepts and Features

Design and development » HDBModel framework » HDBModel in TMLScript

HDBModel and the WGAPI

The content documents created by HDBModel are actually normal WGA content documents, which are just created and maintained by some framework on top of the WGAPI. As such you may use them just like normal content documents and modify their metadata fields via WGAPI.

For example: You may use an item on your content document to control the "pagereaders" field, so you could hide a complete content tree from certain users. As the "pagereaders" field is located on the struct entry a good place to enforce this would be the "postCreate/Update" scripts:

function syncPageReaders(con) {

  con.getStructEntry().setReaders(con.getItemValueList("members"));

  con.getStructEntry().save();

}


this.postCreate(e) {

  syncPageReaders(e.getContent());

}


this.postUpdate(e) {

  syncPageReaders(e.getContent());

}

However some few fields are of internal use by HDBModel and should not be modified by custom code. These are:

  • content().setUniqueName(): The unique name on content documents is used to store the automatic unique name of HDBModel. You may however use the unique name on the struct entry.
  • content().setContentClass(): Content classes are completely controlled by HDBModel automatically and should not be manually modified.
  • content().getStructEntry().setTitle(): The title of the struct entry is automatically kept in sync with the title of the content. So everything you write there will get overwritten. Just use the content title instead.
  • content().setItemValue("$anything"): HDBModel uses some items with names beginning with the dollar sign for internal usage. Please do not use items with names starting with the dollar sign yourself.
  • db().moveStructEntry(): Move support is currently not given in HDBModel, but will be available on later versions.