Class DefaultDialogDataConverterImpl

java.lang.Object
org.knime.core.webui.node.dialog.defaultdialog.DefaultDialogDataConverterImpl
All Implemented Interfaces:
DefaultDialogDataConverter

public final class DefaultDialogDataConverterImpl extends Object implements DefaultDialogDataConverter
The converter used in the FlowVariableDataServiceImpl of the DefaultNodeDialog.
Author:
Paul Bärnreuther
  • Constructor Details

    • DefaultDialogDataConverterImpl

      public DefaultDialogDataConverterImpl(Map<SettingsType,Class<? extends DefaultNodeSettings>> settingsClasses)
      Parameters:
      settingsClasses - the classes of the DefaultNodeSettings associated to the settings types (model and/or view).
    • DefaultDialogDataConverterImpl

      public DefaultDialogDataConverterImpl(SettingsType type, Class<? extends DefaultNodeSettings> settingsClass)
      Converter for only converting one type of settings. Note that some of its conversion methods might fail when they are used with a different type.
      Parameters:
      type - the type of the settings
      settingsClass - the default node setting of this type
  • Method Details

    • dataJsonToNodeSettings

      public org.knime.core.node.NodeSettings dataJsonToNodeSettings(com.fasterxml.jackson.databind.JsonNode root, SettingsType type)
      Transforms the JSON representation of the data form the front-end to node settings of a certain settings type. This is used by the FlowVariableDataServiceImpl
      • to find out which variables are compatible with which settings by getting the variable types that can overwrite a setting (VariableTypeRegistry.getOverwritingTypes(org.knime.core.node.config.Config, String)).
      • to overwrite a setting of the NodeSettings with a variable and return the overwritten value for displaying it in the frontend.
      Specified by:
      dataJsonToNodeSettings in interface DefaultDialogDataConverter
      Parameters:
      root - the JSON representation of the data. The top level keys are values of SettingsType.getConfigKey(), i.e. either "model" or "view" and it is given that the key for the given type exists.
      type - the type of the to be extracted node settings
      Returns:
      the node settings of the given type
    • nodeSettingsToDataJson

      public com.fasterxml.jackson.databind.JsonNode nodeSettingsToDataJson(SettingsType type, org.knime.core.node.NodeSettingsRO nodeSettings, DefaultNodeSettings.DefaultNodeSettingsContext context) throws org.knime.core.node.InvalidSettingsException
      Transforms node settings to the data representation given to the front-end. This is used by the FlowVariableDataServiceImpl to get the value of settings overwritten by flow variables after the user has selected a variable. The value is returned to the frontend and displayed to the user.
      Specified by:
      nodeSettingsToDataJson in interface DefaultDialogDataConverter
      Parameters:
      type - the type of settings that is used
      nodeSettings - the input node settings of the given type
      Returns:
      The resulting representation of the data as JSON. Its top level keys have to be values of SettingsType.getConfigKey() containing the key of the given type.
      Throws:
      org.knime.core.node.InvalidSettingsException