Class ProductSyncStatistics
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseSyncStatistics<ProductSyncStatistics>
-
- com.commercetools.sync.products.helpers.ProductSyncStatistics
-
public class ProductSyncStatistics extends BaseSyncStatistics<ProductSyncStatistics>
-
-
Constructor Summary
Constructors Constructor Description ProductSyncStatistics()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMissingDependency(java.lang.String parentKey, java.lang.String childKey)
This method checks if there is an entry with the key of themissingParentCategoryKey
in theproductKeysWithMissingParents
, if there isn't it creates a new entry with this parent key and as a value a new set containing thechildKey
.int
getNumberOfProductsWithMissingParents()
Returns the total number of products with missing parents.java.lang.String
getReportMessage()
Builds a summary of the product sync statistics instance that looks like the following example:protected ProductSyncStatistics
getThis()
java.util.Set<java.lang.String>
removeAndGetReferencingKeys(java.lang.String key)
-
Methods inherited from class com.commercetools.sync.commons.helpers.BaseSyncStatistics
calculateProcessingTime, equals, getCreated, getDefaultReportMessageForResource, getFailed, getLatestBatchHumanReadableProcessingTime, getLatestBatchProcessingTimeInDays, getLatestBatchProcessingTimeInHours, getLatestBatchProcessingTimeInMillis, getLatestBatchProcessingTimeInMinutes, getLatestBatchProcessingTimeInSeconds, getProcessed, getSyncStatisticsClassName, getUpdated, hashCode, incrementCreated, incrementCreated, incrementFailed, incrementFailed, incrementProcessed, incrementProcessed, incrementUpdated, incrementUpdated, startTimer
-
-
-
-
Method Detail
-
getReportMessage
public java.lang.String getReportMessage()
Builds a summary of the product sync statistics instance that looks like the following example:"Summary: 4 product(s) were processed in total (1 created, 1 updated, 1 failed to sync and 1 product(s) with a missing reference(s))."
- Specified by:
getReportMessage
in classBaseSyncStatistics<ProductSyncStatistics>
- Returns:
- a summary message of the product sync statistics instance.
-
getThis
protected ProductSyncStatistics getThis()
Description copied from class:BaseSyncStatistics
Returnsthis
instance ofT
, which extendsBaseSyncStatistics
. The purpose of this method is to make sure thatthis
is an instance of a class which extendsBaseSyncStatistics
in order to be used in the generic methods of the class. Otherwise, without this method, the methods above would need to castthis to T
which could lead to a runtime error of the class was extended in a wrong way.- Specified by:
getThis
in classBaseSyncStatistics<ProductSyncStatistics>
- Returns:
- an instance of the class that overrides this method.
-
getNumberOfProductsWithMissingParents
public int getNumberOfProductsWithMissingParents()
Returns the total number of products with missing parents.- Returns:
- the total number of products with missing parents.
-
addMissingDependency
public void addMissingDependency(@Nonnull java.lang.String parentKey, @Nonnull java.lang.String childKey)
This method checks if there is an entry with the key of themissingParentCategoryKey
in theproductKeysWithMissingParents
, 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 thechildKey
to the existing set.- Parameters:
parentKey
- the key of the missing parent.childKey
- the key of the product with a missing parent.
-
removeAndGetReferencingKeys
@Nullable public java.util.Set<java.lang.String> removeAndGetReferencingKeys(@Nonnull java.lang.String key)
-
-