Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-3066

Support for "Docbase" document fields in API

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 2.30.00
    • hst-api
    • 0
    • Sprint 90

    Description

      The Document Type Editor provides a "Docbase" field type which can be used in document types to store the UUID of another content item (sort of a weak reference).

      Currently the API does not provide an easy way to resolve a link stored as Docbase field.

      Ard proposed:

      Perhaps the HST can provide some helper utility for it so developers
      can easily account for it in their end project beans. Where we now
      have

      public <T extends HippoBean> T getLinkedBean(String relPath, Class<T>
      beanMappingClass) {

      we could add something like

      public <T extends HippoBean> T getLinkedBean(UUID uuid, Class<T>
      beanMappingClass) {

      Developers should then implement the getter for a
      linked bean through docbase themselves, for example

      public HippoBean getLinkedBean() {
      String docbase = getProperty("gettingstarted:docbase", null);
      try

      { UUID uuid = UUID.fromString(docbase); return getLinkedBean(uuid, HippoBean.class); }

      catch (IllegalArgumentException e) {
      log.info("Cannot get linked bean for docbase that is not a
      uuid {}", uuid);
      return null;
      }
      }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nvankampenhout Niels van Kampenhout
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: