public class CategorySyncStatistics extends BaseSyncStatistics
Constructor and Description |
---|
CategorySyncStatistics() |
Modifier and Type | Method and Description |
---|---|
void |
addMissingDependency(java.lang.String missingParentCategoryKey,
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 . |
java.util.Set<java.lang.String> |
getChildrenKeys(java.lang.String parentKey)
Returns the children keys of given
parentKey . |
int |
getNumberOfCategoriesWithMissingParents()
Returns the total number of categories with missing parents.
|
java.lang.String |
getReportMessage()
Builds a summary of the category sync statistics instance that looks like the following
example:
|
void |
removeChildCategoryKeyFromMissingParentsMap(java.lang.String parentKey,
java.lang.String childKey)
Given a child
childKey this method removes its occurrences from the map categoryKeysWithMissingParents . |
calculateProcessingTime, getCreated, getDefaultReportMessageForResource, getFailed, getLatestBatchHumanReadableProcessingTime, getLatestBatchProcessingTimeInDays, getLatestBatchProcessingTimeInHours, getLatestBatchProcessingTimeInMillis, getLatestBatchProcessingTimeInMinutes, getLatestBatchProcessingTimeInSeconds, getProcessed, getUpdated, incrementCreated, incrementCreated, incrementFailed, incrementFailed, incrementProcessed, incrementProcessed, incrementUpdated, incrementUpdated, startTimer
public java.lang.String getReportMessage()
"Summary: 2 categories were processed in total (1 created, 1 updated and 0 categories failed to sync and 0 categories with a missing parent)."
getReportMessage
in class BaseSyncStatistics
public int getNumberOfCategoriesWithMissingParents()
public void addMissingDependency(@Nonnull java.lang.String missingParentCategoryKey, @Nonnull java.lang.String childKey)
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.missingParentCategoryKey
- the key of the missing parent.childKey
- the key of the state with a missing parent.public void removeChildCategoryKeyFromMissingParentsMap(@Nonnull java.lang.String parentKey, @Nonnull java.lang.String childKey)
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.
parentKey
- the key of the missing parent.childKey
- the child category key to remove from categoryKeysWithMissingParents
@Nullable public java.util.Set<java.lang.String> getChildrenKeys(@Nonnull java.lang.String parentKey)
parentKey
.parentKey
- parent category keyparentKey
.