OFBiz
  1. OFBiz
  2. OFBIZ-4240

Override UiLabels / Properties through tenant specific database

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: SVN trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:

      Description

      UtilProperties being in base gets complied and loaded first ahead of both entity and service modules. So, as such the service and entity classes won't be available there directly. Now the attempt is to have a embedded service call within the UtilProperties.getBundle(.....) method right after the lines below
      Properties newProps = getProperties(resource, candidateLocale);
      if (UtilValidate.isNotEmpty(newProps)) {
      // The last bundle we found becomes the parent of the new bundle

      The idea is that by default a set of properties would be loaded from the UiLabels.xml files. However, right after we should be able to call a service to override any labels (in newProps) passing the newProps as an argument.

      So far, so good ?

      Next the problem... How to configure a service call? Find the below usage in base module
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      Iterator<Init> cachedClassLoaders = ServiceLoader.load(Init.class, loader).iterator();
      while (cachedClassLoaders.hasNext()) {
      Init cachedClassLoader = cachedClassLoaders.next();
      try

      { cachedClassLoader.loadClasses(loader); }

      catch (Exception e)

      { Debug.logError(e, "Could not pre-initialize dynamically loaded class: ", module); }

      }

      So, can we write a class say UtilTenantProperties under webtools and load that dynamically? This class can then be used to load the appropriate delegator to query properties to override and return an updated newProps and rest continues as before? The reason thinking of webtools is to eventually use the webtools label manager to manage and update the override fields into the database.

      Also perhaps we would need UtilTenantProperties or better still UtilPropertiesOverride (to make it useful even in single tenant cases) as interface under base module and then have the implementation under webtools linked to META-INF/services file entry.

        Activity

        Hide
        Adrian Crum added a comment -

        From my perspective, having the ability to override UI label files with entity data is a worthwhile improvement. In multi-tenant deployments, tenants would be able to customize their UI labels.

        Implementing that capability will not be a simple task: Entities to store the properties need to be defined, UtilProperties.java needs to be refactored, and all code that uses UI labels will need to supply a delegator name to the appropriate UtilProperties method.

        Show
        Adrian Crum added a comment - From my perspective, having the ability to override UI label files with entity data is a worthwhile improvement. In multi-tenant deployments, tenants would be able to customize their UI labels. Implementing that capability will not be a simple task: Entities to store the properties need to be defined, UtilProperties.java needs to be refactored, and all code that uses UI labels will need to supply a delegator name to the appropriate UtilProperties method.

          People

          • Assignee:
            Unassigned
            Reporter:
            PR
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development