Class CategorySyncStatistics
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseSyncStatistics
-
- com.commercetools.sync.categories.helpers.CategorySyncStatistics
-
public class CategorySyncStatistics extends BaseSyncStatistics
-
-
Constructor Summary
Constructors Constructor Description CategorySyncStatistics()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMissingDependency(java.lang.String missingParentCategoryKey, java.lang.String childKey)This method checks if there is an entry with the key of themissingParentCategoryKeyin thecategoryKeysWithMissingParents, if there isn't it creates a new entry with this parent key and as a value a new set containing thechildKey.java.util.Set<java.lang.String>getChildrenKeys(java.lang.String parentKey)Returns the children keys of givenparentKey.intgetNumberOfCategoriesWithMissingParents()Returns the total number of categories with missing parents.java.lang.StringgetReportMessage()Builds a summary of the category sync statistics instance that looks like the following example:voidremoveChildCategoryKeyFromMissingParentsMap(java.lang.String parentKey, java.lang.String childKey)Given a childchildKeythis method removes its occurrences from the mapcategoryKeysWithMissingParents.-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseSyncStatistics
calculateProcessingTime, getCreated, getDefaultReportMessageForResource, getFailed, getLatestBatchHumanReadableProcessingTime, getLatestBatchProcessingTimeInDays, getLatestBatchProcessingTimeInHours, getLatestBatchProcessingTimeInMillis, getLatestBatchProcessingTimeInMinutes, getLatestBatchProcessingTimeInSeconds, getProcessed, getUpdated, incrementCreated, incrementCreated, incrementFailed, incrementFailed, incrementProcessed, incrementProcessed, incrementUpdated, incrementUpdated, startTimer
-
-
-
-
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:
getReportMessagein classBaseSyncStatistics- 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 themissingParentCategoryKeyin thecategoryKeysWithMissingParents, if there isn't it creates a new entry with this parent key and as a value a new set containing thechildKey. Otherwise, if there is already, it just adds thechildKeyto 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 childchildKeythis method removes its occurrences from the mapcategoryKeysWithMissingParents.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 fromcategoryKeysWithMissingParents
-
getChildrenKeys
@Nullable public java.util.Set<java.lang.String> getChildrenKeys(@Nonnull java.lang.String parentKey)Returns the children keys of givenparentKey.- Parameters:
parentKey- parent category key- Returns:
- Returns the children keys of given
parentKey.
-
-