Class DefaultPluginFormElementTemplateDescriptor

    • Method Detail

      • getPersistJson

        public URI getPersistJson()
                           throws URISyntaxException
        Description copied from interface: IPluginFormElementTemplateDescriptor
        Gets the URI for the persist JSON with the content of the template. The URI is then passed to loadPersistJson.

        The persist JSON is a JSON string representing a JSON object. The encoding of the persist JSON string must be UTF-8. It has the following structure:

         {
           "charsetName": "UTF-8",
           "persist": "...",
           "versionsNummer": 1
         }
         
        The properties charsetName and versionsNummer should always be set to UTF-8 and 1, respectively. The property persist is another string representing a JSON object with the following structure:
         {
           "items": [
             {
               "properties": { ... },
               "className": "XTextField"
             },
             // more items
           ],
           "version": {
             "time": "23:10:09",
             "date": "09.08.2023",
             "timestamp": 20230809231009,
             "version": "hippocamp-9.0.0-SNAPSHOT",
             "majorVersion": "9",
             "minorVersion": "0",
             "patchVersion": "0",
             "number": 0
           }
         }
         
        The version refers to the formcycle version where the template was created. This version is used to update existing templates when e.g. a later formcycle version adds new properties.

        The items are a list of items contained in the template. The first item is always the main item and must have its className set to the same value as IPluginFormElementTemplateDescriptor.getClassName(). All following items, if present, must be children of the main item, and must have their XPropertyEnum.parentid set to either the main item or another child of the main item.

        The property properties is an object with the configuration of the form element. The keys are Enum.name(), the values are the corresponding values for the XPropertyEnum.

        Note 1: The resource might be cached with the returned URI as the cache key. Plugins should append e.g. a version parameter (such as the plugin version) to the URI if needed.

        Note 2: If you simply want provide static templates with form elements that you have already configured in the form designer, you can simply select the form element in the form designer, press Ctrl+c to copy the form element, go to a text editor and press Ctrl+v to paste the JSON string with the form element into the editor. This is the JSON string that you need to return in this method.

        Specified by:
        getPersistJson in interface IPluginFormElementTemplateDescriptor
        Returns:
        An input stream for the persist JSON content of the template.
        Throws:
        URISyntaxException - When a URI could not be resolved. If this exception is thrown, the template is skipped as if it had not been returned by the plugin.