Class ConfigDataMergeProcessorImpl

  • All Implemented Interfaces:
    ConfigDataMergeProcessor

    public class ConfigDataMergeProcessorImpl
    extends java.lang.Object
    implements ConfigDataMergeProcessor
    Default implementation of ConfigDataMergeProcessor.
    Used to merge the UI user input with the existing data from the session. This enables us to not send the entire configuration to the UI and to keep the request small.

    Implementation note: The bean must have prototype scope as we use class members to process the path to the group which is currently selected for display.
    • Constructor Detail

      • ConfigDataMergeProcessorImpl

        public ConfigDataMergeProcessorImpl()
    • Method Detail

      • setTokenizerGroupId

        protected void setTokenizerGroupId​(java.util.StringTokenizer tokenizerGroupId)
      • setTokenizerPath

        protected void setTokenizerPath​(java.util.StringTokenizer tokenizerPath)
      • completeInput

        public void completeInput​(ConfigurationData targetConfigData)
        Description copied from interface: ConfigDataMergeProcessor
        Fetches the actual configuration sate from the underlying layers and uses it to complete the given partial configuration state to build a complete and fully update state. So after the method call the given configuration will contain all values and each value will be updated to the most recent user input.
        Specified by:
        completeInput in interface ConfigDataMergeProcessor
        Parameters:
        targetConfigData - partial configuration to complete
      • mergeConfigurationData

        public void mergeConfigurationData​(ConfigurationData source,
                                           ConfigurationData target)
        Description copied from interface: ConfigDataMergeProcessor
        Merges the source configuration into the target configuration. User input in the target configuration has the highest priority, so that it will be kept. The corresponding values of the source configuration are considered out dated and will be discarded.
        Specified by:
        mergeConfigurationData in interface ConfigDataMergeProcessor
        Parameters:
        source - source configuration, missing data in the target configuration will be read from here
        target - target configuration, any values present will be kept, only missing data is read from source configuration
      • populateChangedValue

        protected void populateChangedValue​(ConfigurationData target)
      • prepareSourceConfiguration

        protected java.util.Map<java.lang.String,​java.lang.Object> prepareSourceConfiguration​(ConfigurationData source)
      • processGroup

        protected void processGroup​(UiGroupData group,
                                    java.util.Map<java.lang.String,​java.lang.Object> sourceConfigMap)
      • updateTargetConfiguration

        protected void updateTargetConfiguration​(ConfigurationData target,
                                                 java.util.Map<java.lang.String,​java.lang.Object> sourceConfigMap)
        Restores the data which was passed from the UI. If a group with empty parents is provided, the parent groups are also equipped with the group ID's, because we need this info later on when digesting the user inputs.

        This information is retrieved from to strings, containing the list of group ID's and a list of indices which indicate where to find these groups: UiGroupForDisplayData.getPath(), UiGroupForDisplayData.getGroupIdPath().

        . Content can look like this: "MainGroup,SubGroup" and "groups[0].subGroups[3]"
        Parameters:
        target -
        sourceConfigMap -
      • updateGroupList

        protected void updateGroupList​(java.util.List<UiGroupData> groups,
                                       java.util.Map<java.lang.String,​java.lang.Object> sourceConfigMap)
        Update list of groups, calls itself recursively for sub groups
        Parameters:
        groups -
        sourceConfigMap -
      • updateGroup

        protected boolean updateGroup​(UiGroupData group,
                                      java.util.Map<java.lang.String,​java.lang.Object> sourceConfigMap)
      • removeOutdatedConflictGroups

        protected void removeOutdatedConflictGroups​(java.util.List<UiGroupData> groups,
                                                    java.util.List<java.lang.Integer> outdatedConflictGroupIndices)
      • updateCstics

        protected void updateCstics​(UiGroupData group,
                                    java.util.Map<java.lang.String,​java.lang.Object> sourceConfigMap)
      • insertChangedValue

        protected void insertChangedValue​(CsticData cstic)
      • isChangedCsticWithAssignedValidationType

        protected boolean isChangedCsticWithAssignedValidationType​(CsticData cstic)
      • updateCsticValues

        protected void updateCsticValues​(CsticData cstic,
                                         CsticData sourceCstic)
      • setConfigFacade

        public void setConfigFacade​(ConfigurationFacade configFacade)
        Parameters:
        configFacade - config facade, which is used to fetch the last complete configuration state