public class CategorySyncStatistics extends BaseSyncStatistics
| Constructor and Description |
|---|
CategorySyncStatistics() |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getCategoryKeysWithMissingParents() |
java.util.Optional<java.lang.String> |
getMissingParentKey(java.lang.String childCategoryKey)
Given a
childCategoryKey this method, checks in the categoryKeysWithMissingParents if it exists as a child to a missing parent, and returns the
key of first found (since a category can have only one parent) missing parent in an optional. |
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 |
putMissingParentCategoryChildKey(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> |
removeAndGetChildrenKeys(java.lang.String key) |
void |
removeChildCategoryKeyFromMissingParentsMap(java.lang.String childCategoryKey)
Given a child
categoryKey this method removes its occurrences from the map categoryKeysWithMissingParents. |
void |
setCategoryKeysWithMissingParents(java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.Set<java.lang.String>> categoryKeysWithMissingParents) |
calculateProcessingTime, getCreated, getDefaultReportMessageForResource, getFailed, getLatestBatchHumanReadableProcessingTime, getLatestBatchProcessingTimeInDays, getLatestBatchProcessingTimeInHours, getLatestBatchProcessingTimeInMillis, getLatestBatchProcessingTimeInMinutes, getLatestBatchProcessingTimeInSeconds, getProcessed, getUpdated, incrementCreated, incrementCreated, incrementFailed, incrementFailed, incrementProcessed, incrementProcessed, incrementUpdated, incrementUpdated, startTimerpublic java.lang.String getReportMessage()
"Summary: 2 categories were processed in total (0 created, 0 updated and 0 categories failed to sync)."
getReportMessage in class BaseSyncStatisticspublic int getNumberOfCategoriesWithMissingParents()
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getCategoryKeysWithMissingParents()
public void setCategoryKeysWithMissingParents(@Nonnull
java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.Set<java.lang.String>> categoryKeysWithMissingParents)
public void putMissingParentCategoryChildKey(@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 categoryKey to the existing set.missingParentCategoryKey - the key of the missing parent.childKey - the key of the category with a missing parent.@Nonnull
public java.util.Optional<java.lang.String> getMissingParentKey(@Nonnull
java.lang.String childCategoryKey)
childCategoryKey this method, checks in the categoryKeysWithMissingParents if it exists as a child to a missing parent, and returns the
key of first found (since a category can have only one parent) missing parent in an optional.
Otherwise, it returns an empty optional.childCategoryKey - key of the category to find it's has a missing parent key.public void removeChildCategoryKeyFromMissingParentsMap(@Nonnull
java.lang.String childCategoryKey)
categoryKey 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 an empty list. i.e. the entry itself will not be removed. However, this could be investigated whether removing the entry at all when the list is empty will affect the algorithm. TODO: RELATED BUT NOT SAME AS GITHUB ISSUE#77
childCategoryKey - the child category key to remove from categoryKeysWithMissingParents@Nullable
public java.util.Set<java.lang.String> removeAndGetChildrenKeys(@Nonnull
java.lang.String key)