Class CategorySyncStatistics

    • Constructor Detail

      • CategorySyncStatistics

        public CategorySyncStatistics()
    • Method Detail

      • getReportMessage

        public java.lang.String getReportMessage()
        Builds a summary of the category sync statistics instance that looks like the following example:

        "Summary: 2 categories were processed in total (1 created, 1 updated and 0 categories failed to sync and 0 categories with a missing parent)."

        Specified by:
        getReportMessage in class BaseSyncStatistics
        Returns:
        a summary message of the category sync statistics instance.
      • getNumberOfCategoriesWithMissingParents

        public int getNumberOfCategoriesWithMissingParents()
        Returns the total number of categories with missing parents.
        Returns:
        the total number of categories with missing parents.
      • addMissingDependency

        public void addMissingDependency​(@Nonnull
                                         java.lang.String missingParentCategoryKey,
                                         @Nonnull
                                         java.lang.String childKey)
        This method checks if there is an entry with the key of the missingParentCategoryKey in the categoryKeysWithMissingParents, if there isn't it creates a new entry with this parent key and as a value a new set containing the childKey. Otherwise, if there is already, it just adds the childKey to the existing set.
        Parameters:
        missingParentCategoryKey - the key of the missing parent.
        childKey - the key of the state with a missing parent.
      • removeChildCategoryKeyFromMissingParentsMap

        public void removeChildCategoryKeyFromMissingParentsMap​(@Nonnull
                                                                java.lang.String parentKey,
                                                                @Nonnull
                                                                java.lang.String childKey)
        Given a child childKey this method removes its occurrences from the map categoryKeysWithMissingParents.

        NOTE: When all the children keys of a missing parent are removed, the value of the map entry will be removed.

        Parameters:
        parentKey - the key of the missing parent.
        childKey - the child category key to remove from categoryKeysWithMissingParents
      • getChildrenKeys

        @Nullable
        public java.util.Set<java.lang.String> getChildrenKeys​(@Nonnull
                                                               java.lang.String parentKey)
        Returns the children keys of given parentKey.
        Returns:
        Returns the children keys of given parentKey.