Class ConfigDataMergeProcessorImpl
- java.lang.Object
-
- de.hybris.platform.sap.productconfig.frontend.util.impl.ConfigDataMergeProcessorImpl
-
- All Implemented Interfaces:
ConfigDataMergeProcessor
public class ConfigDataMergeProcessorImpl extends java.lang.Object implements ConfigDataMergeProcessor
Default implementation ofConfigDataMergeProcessor.
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 Summary
Constructors Constructor Description ConfigDataMergeProcessorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcompleteInput(ConfigurationData targetConfigData)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.protected ConfigurationFacadegetConfigFacade()protected voidinsertChangedValue(CsticData cstic)protected booleanisChangedCsticWithAssignedValidationType(CsticData cstic)voidmergeConfigurationData(ConfigurationData source, ConfigurationData target)Merges the source configuration into the target configuration.protected voidpopulateChangedValue(ConfigurationData target)protected java.util.Map<java.lang.String,java.lang.Object>prepareSourceConfiguration(ConfigurationData source)protected voidprocessGroup(UiGroupData group, java.util.Map<java.lang.String,java.lang.Object> sourceConfigMap)protected voidremoveOutdatedConflictGroups(java.util.List<UiGroupData> groups, java.util.List<java.lang.Integer> outdatedConflictGroupIndices)voidsetConfigFacade(ConfigurationFacade configFacade)protected voidsetTokenizerGroupId(java.util.StringTokenizer tokenizerGroupId)protected voidsetTokenizerPath(java.util.StringTokenizer tokenizerPath)protected voidupdateCstics(UiGroupData group, java.util.Map<java.lang.String,java.lang.Object> sourceConfigMap)protected voidupdateCsticValues(CsticData cstic, CsticData sourceCstic)protected booleanupdateGroup(UiGroupData group, java.util.Map<java.lang.String,java.lang.Object> sourceConfigMap)protected voidupdateGroupList(java.util.List<UiGroupData> groups, java.util.Map<java.lang.String,java.lang.Object> sourceConfigMap)Update list of groups, calls itself recursively for sub groupsprotected voidupdateTargetConfiguration(ConfigurationData target, java.util.Map<java.lang.String,java.lang.Object> sourceConfigMap)Restores the data which was passed from the UI.
-
-
-
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:ConfigDataMergeProcessorFetches 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:
completeInputin interfaceConfigDataMergeProcessor- Parameters:
targetConfigData- partial configuration to complete
-
mergeConfigurationData
public void mergeConfigurationData(ConfigurationData source, ConfigurationData target)
Description copied from interface:ConfigDataMergeProcessorMerges 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:
mergeConfigurationDatain interfaceConfigDataMergeProcessor- Parameters:
source- source configuration, missing data in the target configuration will be read from heretarget- 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)
-
getConfigFacade
protected ConfigurationFacade getConfigFacade()
-
setConfigFacade
public void setConfigFacade(ConfigurationFacade configFacade)
- Parameters:
configFacade- config facade, which is used to fetch the last complete configuration state
-
-