Class UiStatusSync
java.lang.Object
de.hybris.platform.sap.productconfig.frontend.util.impl.UiStatusSync
Used to sync the configuration DTO (which has request scope) with the UIStatus which we store in the session
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyUiStatusToConfiguration(ConfigurationData configData, UiStatus uiStatus) Updates the configuration DTO with the UI state (e.g.voidapplyUiStatusToConfiguration(ConfigurationData configData, UiStatus uiStatus, String selectedGroup) Updates the configuration DTO with the UI state (e.g.protected voidapplyUiStatusToCstic(UiCsticStatus uiCsticStatus, CsticData csticData) protected <T,K> void applyUiStatusToData(List<T> uiStatusList, List<K> dataList, BiPredicate<T, K> idMatch, BiConsumer<T, K> applyMethod) protected voidapplyUiStatusToUiGroup(List<UiGroupStatus> uiGroupsStatus, List<UiGroupData> uiGroups) protected voidexpandGroupAndCollapseOther(ConfigurationData configData, String selectedGroup) protected voidexpandGroupAndCollapseOther(String selectedGroup, List<UiGroupStatus> groups) protected voidexpandGroupInSpecTreeAndExpandGroup(UiStatus uiStatus) Expand the group in spec tree and expand the group itselfextractUiStatusFromConfiguration(ConfigurationData configData) Updates UI status with the current state of the configuration DTOprotected List<UiCsticStatus>extractUiStatusFromCstic(List<CsticData> cstics) protected List<UiCsticValueStatus>extractUiStatusFromCsticValue(List<CsticValueData> domainvalues) protected List<UiPromoMessageStatus>protected voidextractUiStatusFromUiGroup(List<UiGroupData> uiGroups, List<UiGroupStatus> uiGroupsStatus, ConfigurationData configData) protected UiGroupStatusfindStatusGroup(List<UiGroupStatus> uiStatusGroups, UiGroupData requestGroup, int groupIdx) protected UiGroupStatusfindStatusGroupForExisting(List<UiGroupStatus> uiSateGroups, UiGroupData requestGroup, int groupIdx) protected <T> Optional<T>findStatusValue(@NotNull List<T> statusValues, Predicate<T> idMatch) protected <T> Optional<T>findStatusValue(@NotNull List<T> statusValues, Predicate<T> idMatch, int index) protected StringgetMessageId(ProductConfigMessageData message) protected List<UiPromoMessageStatus>getMessgesForCsticValue(String csticValueKey, List<UiCsticValueStatus> uiCsticValueStatuses) intgetNumberOfConflicts(ConfigurationData configData) Determine number of conflicts by calculating the conflict groupsprotected voidhandleCPQAction(ConfigurationData requestData, UiStatus oldUiState, UiTrackingRecorder uiTrackingRecorder) protected booleanhasCstics(UiGroupData uiGroup) protected booleanhasCsticValues(CsticData cstic) protected booleanhasSubGroups(UiGroupData uiGroup) protected booleanisNavigationAction(CPQActionType cpqAction) protected booleanisNonConflictGroup(UiGroupData uiGroup) protected booleanprotected booleannotNullAndNotEmpty(List subGroups) protected Stringprotected voidsetInitialCsticStatus(List<CsticData> cstics) protected voidsetInitialGroupStatus(List<UiGroupData> uiGroups, int level, boolean expandedGroupExists) voidsetInitialStatus(ConfigurationData configData) Provides the configuration DTO with UI relevant settings valid in its initial stateprotected voidstoreLastNoneConflictGroupId(UiStatus newUiState, ConfigurationData requestData) protected UiGroupStatustoggleGroup(String groupIdToToggle, List<UiGroupStatus> groups, boolean forceExpand) Recursively checks a group hierarchy.protected UiGroupStatustoggleGroupInSpecTree(String groupIdToToggle, List<UiGroupStatus> groups, boolean forceExpand) protected voidtoggleParentGroupInSpecTreeIfNeeded(UiGroupStatus toggledGroup, UiGroupStatus parentGroup) protected booleantoggleParentIfNeeded(UiGroupStatus toggledGroup, UiGroupStatus parentGroup) protected voidtoggleShowExtendedMessageOnStatusCstics(String csticKey, String csticValueKey, String messageKey, List<UiCsticStatus> uiCsticsStatus) voidtoggleShowExtendedMessageOnUIStatusGroups(String csticKey, String csticValueKey, String messageKey, List<UiGroupStatus> uiStatusGroups) protected booleanuiStatusGroupMatchesUiGroup(UiGroupData uiGroup, UiGroupStatus uiStatusGroup) protected voidupdateCsticUIStatusFromRequestData(List<UiCsticStatus> statusCstics, List<CsticData> requestCstics) protected voidupdateCsticValueUIStatusFromRequestData(List<UiCsticValueStatus> statusCsticValues, List<CsticValueData> requestCsticValues) protected voidupdateGroupUIStatusFromRequestData(List<UiGroupStatus> uiSateGroups, List<UiGroupData> requestGroups) protected voidupdateMessagesUiStatusFromRequestData(List<UiPromoMessageStatus> statusMessages, List<ProductConfigMessageData> requestMessages) voidupdateNewUiStateFromOld(UiStatus oldUiStatus, UiStatus uiStatus) Update old UI statusprotected voidupdateShowFullLongTextInUiStatusCstics(String csticKey, boolean showFullLongText, List<UiCsticStatus> uiCsticsStatus) voidupdateShowFullLongTextinUIStatusGroups(String csticKey, boolean showFullLongText, List<UiGroupStatus> uiStatusGroups) Update the flag of the show long full text in UI status groupsprotected voidupdateSingleStatusGroupFromRequest(UiGroupData requestGroup, UiGroupStatus statusGroup) updateUIStatusFromRequest(ConfigurationData requestData, UiStatus oldUiState, UiTrackingRecorder uiTrackingRecorder) Apply user changes to the UI status (session) object.
-
Constructor Details
-
UiStatusSync
public UiStatusSync()
-
-
Method Details
-
applyUiStatusToConfiguration
public void applyUiStatusToConfiguration(ConfigurationData configData, UiStatus uiStatus, String selectedGroup) Updates the configuration DTO with the UI state (e.g. which group is collapsed/opened, which has been visited already). Takes care of the currently selected group and expands it- Parameters:
configData-uiStatus- UI status (session scope)selectedGroup- ID of the currently selected group
-
expandGroupAndCollapseOther
-
applyUiStatusToConfiguration
Updates the configuration DTO with the UI state (e.g. which group is collapsed/opened, which has been visited already).- Parameters:
configData-uiStatus- UI status (session scope)
-
expandGroupInSpecTreeAndExpandGroup
Expand the group in spec tree and expand the group itself- Parameters:
uiStatus-
-
applyUiStatusToUiGroup
protected void applyUiStatusToUiGroup(List<UiGroupStatus> uiGroupsStatus, List<UiGroupData> uiGroups) -
updateShowFullLongTextinUIStatusGroups
public void updateShowFullLongTextinUIStatusGroups(String csticKey, boolean showFullLongText, List<UiGroupStatus> uiStatusGroups) Update the flag of the show long full text in UI status groups- Parameters:
csticKey- characteristic keyshowFullLongText- show full long textuiStatusGroups- list of UI status groups
-
toggleShowExtendedMessageOnUIStatusGroups
public void toggleShowExtendedMessageOnUIStatusGroups(String csticKey, String csticValueKey, String messageKey, List<UiGroupStatus> uiStatusGroups) - Parameters:
csticKey- characteristic keycsticValueKey- characteristic value keymessageKey- message keyuiStatusGroups- list of UI status groups
-
applyUiStatusToData
protected <T,K> void applyUiStatusToData(List<T> uiStatusList, List<K> dataList, BiPredicate<T, K> idMatch, BiConsumer<T, K> applyMethod) -
applyUiStatusToCstic
-
updateShowFullLongTextInUiStatusCstics
protected void updateShowFullLongTextInUiStatusCstics(String csticKey, boolean showFullLongText, List<UiCsticStatus> uiCsticsStatus) -
toggleShowExtendedMessageOnStatusCstics
protected void toggleShowExtendedMessageOnStatusCstics(@Nonnull String csticKey, String csticValueKey, @Nonnull String messageKey, List<UiCsticStatus> uiCsticsStatus) -
getMessgesForCsticValue
protected List<UiPromoMessageStatus> getMessgesForCsticValue(String csticValueKey, List<UiCsticValueStatus> uiCsticValueStatuses) -
setInitialStatus
Provides the configuration DTO with UI relevant settings valid in its initial state- Parameters:
configData-
-
setInitialGroupStatus
protected void setInitialGroupStatus(List<UiGroupData> uiGroups, int level, boolean expandedGroupExists) -
isNonConflictGroup
-
setInitialCsticStatus
-
hasSubGroups
-
notNullAndNotEmpty
-
hasCstics
-
extractUiStatusFromConfiguration
Updates UI status with the current state of the configuration DTO- Parameters:
configData-- Returns:
- UI status which we put into the session to persist the currently selected group e.g.
-
getNumberOfConflicts
Determine number of conflicts by calculating the conflict groups- Parameters:
configData-- Returns:
- Number of conflict groups
-
toggleGroup
protected UiGroupStatus toggleGroup(String groupIdToToggle, List<UiGroupStatus> groups, boolean forceExpand) Recursively checks a group hierarchy. If a group is found that matches the given group id its collapsed state is Toggled. If the toggle was an expand, all parent groups are expanded as well.- Parameters:
groupIdToToggle- id of group to togglegroups- list of groups to checkforceExpand-- Returns:
- the goup that was toggled, or
nullif no group with the given ID was found.
-
toggleParentIfNeeded
-
toggleGroupInSpecTree
protected UiGroupStatus toggleGroupInSpecTree(String groupIdToToggle, List<UiGroupStatus> groups, boolean forceExpand) -
toggleParentGroupInSpecTreeIfNeeded
protected void toggleParentGroupInSpecTreeIfNeeded(UiGroupStatus toggledGroup, UiGroupStatus parentGroup) -
expandGroupAndCollapseOther
-
extractUiStatusFromUiGroup
protected void extractUiStatusFromUiGroup(List<UiGroupData> uiGroups, List<UiGroupStatus> uiGroupsStatus, ConfigurationData configData) -
extractUiStatusFromCstic
-
extractUiStatusFromMessages
protected List<UiPromoMessageStatus> extractUiStatusFromMessages(List<ProductConfigMessageData> messages) -
getMessageId
-
extractUiStatusFromCsticValue
-
hasCsticValues
-
updateUIStatusFromRequest
public UiStatus updateUIStatusFromRequest(ConfigurationData requestData, UiStatus oldUiState, UiTrackingRecorder uiTrackingRecorder) Apply user changes to the UI status (session) object. User might e.g. open a group which was not visited before- Parameters:
requestData-oldUiState- Previous version of the UI statusuiTrackingRecorder- recorder for ui activities- Returns:
- New version of the UI status
-
storeLastNoneConflictGroupId
-
handleCPQAction
protected void handleCPQAction(ConfigurationData requestData, UiStatus oldUiState, UiTrackingRecorder uiTrackingRecorder) -
notNullAndNotEmpty
-
updateGroupUIStatusFromRequestData
protected void updateGroupUIStatusFromRequestData(List<UiGroupStatus> uiSateGroups, List<UiGroupData> requestGroups) -
updateSingleStatusGroupFromRequest
protected void updateSingleStatusGroupFromRequest(UiGroupData requestGroup, UiGroupStatus statusGroup) -
updateCsticUIStatusFromRequestData
protected void updateCsticUIStatusFromRequestData(List<UiCsticStatus> statusCstics, List<CsticData> requestCstics) -
updateCsticValueUIStatusFromRequestData
protected void updateCsticValueUIStatusFromRequestData(List<UiCsticValueStatus> statusCsticValues, List<CsticValueData> requestCsticValues) -
updateMessagesUiStatusFromRequestData
protected void updateMessagesUiStatusFromRequestData(List<UiPromoMessageStatus> statusMessages, List<ProductConfigMessageData> requestMessages) -
findStatusValue
-
findStatusValue
-
findStatusGroup
protected UiGroupStatus findStatusGroup(List<UiGroupStatus> uiStatusGroups, UiGroupData requestGroup, int groupIdx) -
findStatusGroupForExisting
protected UiGroupStatus findStatusGroupForExisting(List<UiGroupStatus> uiSateGroups, UiGroupData requestGroup, int groupIdx) -
uiStatusGroupMatchesUiGroup
-
replaceNewLineForLog
-
updateNewUiStateFromOld
Update old UI status- Parameters:
oldUiStatus- old UI statusuiStatus- new UI status
-