java.lang.Object
de.hybris.platform.sap.productconfig.frontend.util.impl.UiStatusSync

public class UiStatusSync extends Object
Used to sync the configuration DTO (which has request scope) with the UIStatus which we store in the session
  • 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

      protected void expandGroupAndCollapseOther(ConfigurationData configData, String selectedGroup)
    • applyUiStatusToConfiguration

      public void applyUiStatusToConfiguration(ConfigurationData configData, UiStatus uiStatus)
      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)
    • isNavigationAction

      protected boolean isNavigationAction(CPQActionType cpqAction)
    • expandGroupInSpecTreeAndExpandGroup

      protected void expandGroupInSpecTreeAndExpandGroup(UiStatus uiStatus)
      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 key
      showFullLongText - show full long text
      uiStatusGroups - list of UI status groups
    • toggleShowExtendedMessageOnUIStatusGroups

      public void toggleShowExtendedMessageOnUIStatusGroups(String csticKey, String csticValueKey, String messageKey, List<UiGroupStatus> uiStatusGroups)
      Parameters:
      csticKey - characteristic key
      csticValueKey - characteristic value key
      messageKey - message key
      uiStatusGroups - 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

      protected void applyUiStatusToCstic(UiCsticStatus uiCsticStatus, CsticData csticData)
    • 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

      public void setInitialStatus(ConfigurationData configData)
      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

      protected boolean isNonConflictGroup(UiGroupData uiGroup)
    • setInitialCsticStatus

      protected void setInitialCsticStatus(List<CsticData> cstics)
    • hasSubGroups

      protected boolean hasSubGroups(UiGroupData uiGroup)
    • notNullAndNotEmpty

      protected boolean notNullAndNotEmpty(List subGroups)
    • hasCstics

      protected boolean hasCstics(UiGroupData uiGroup)
    • extractUiStatusFromConfiguration

      public UiStatus extractUiStatusFromConfiguration(ConfigurationData configData)
      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

      public int getNumberOfConflicts(ConfigurationData configData)
      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 toggle
      groups - list of groups to check
      forceExpand -
      Returns:
      the goup that was toggled, or null if no group with the given ID was found.
    • toggleParentIfNeeded

      protected boolean toggleParentIfNeeded(UiGroupStatus toggledGroup, UiGroupStatus parentGroup)
    • toggleGroupInSpecTree

      protected UiGroupStatus toggleGroupInSpecTree(String groupIdToToggle, List<UiGroupStatus> groups, boolean forceExpand)
    • toggleParentGroupInSpecTreeIfNeeded

      protected void toggleParentGroupInSpecTreeIfNeeded(UiGroupStatus toggledGroup, UiGroupStatus parentGroup)
    • expandGroupAndCollapseOther

      protected void expandGroupAndCollapseOther(String selectedGroup, List<UiGroupStatus> groups)
    • extractUiStatusFromUiGroup

      protected void extractUiStatusFromUiGroup(List<UiGroupData> uiGroups, List<UiGroupStatus> uiGroupsStatus, ConfigurationData configData)
    • extractUiStatusFromCstic

      protected List<UiCsticStatus> extractUiStatusFromCstic(List<CsticData> cstics)
    • extractUiStatusFromMessages

      protected List<UiPromoMessageStatus> extractUiStatusFromMessages(List<ProductConfigMessageData> messages)
    • getMessageId

      protected String getMessageId(ProductConfigMessageData message)
    • extractUiStatusFromCsticValue

      protected List<UiCsticValueStatus> extractUiStatusFromCsticValue(List<CsticValueData> domainvalues)
    • hasCsticValues

      protected boolean hasCsticValues(CsticData cstic)
    • 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 status
      uiTrackingRecorder - recorder for ui activities
      Returns:
      New version of the UI status
    • storeLastNoneConflictGroupId

      protected void storeLastNoneConflictGroupId(UiStatus newUiState, ConfigurationData requestData)
    • handleCPQAction

      protected void handleCPQAction(ConfigurationData requestData, UiStatus oldUiState, UiTrackingRecorder uiTrackingRecorder)
    • notNullAndNotEmpty

      protected boolean notNullAndNotEmpty(String id)
    • 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

      protected <T> Optional<T> findStatusValue(@NotNull @NotNull List<T> statusValues, Predicate<T> idMatch)
    • findStatusValue

      protected <T> Optional<T> findStatusValue(@NotNull @NotNull List<T> statusValues, Predicate<T> idMatch, int index)
    • findStatusGroup

      protected UiGroupStatus findStatusGroup(List<UiGroupStatus> uiStatusGroups, UiGroupData requestGroup, int groupIdx)
    • findStatusGroupForExisting

      protected UiGroupStatus findStatusGroupForExisting(List<UiGroupStatus> uiSateGroups, UiGroupData requestGroup, int groupIdx)
    • uiStatusGroupMatchesUiGroup

      protected boolean uiStatusGroupMatchesUiGroup(UiGroupData uiGroup, UiGroupStatus uiStatusGroup)
    • replaceNewLineForLog

      protected String replaceNewLineForLog(String str)
    • updateNewUiStateFromOld

      public void updateNewUiStateFromOld(UiStatus oldUiStatus, UiStatus uiStatus)
      Update old UI status
      Parameters:
      oldUiStatus - old UI status
      uiStatus - new UI status