Class ProductTypeSyncStatistics
- java.lang.Object
-
- com.commercetools.sync.commons.helpers.BaseSyncStatistics
-
- com.commercetools.sync.producttypes.helpers.ProductTypeSyncStatistics
-
public class ProductTypeSyncStatistics extends BaseSyncStatistics
-
-
Constructor Summary
Constructors Constructor Description ProductTypeSyncStatistics()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumberOfProductTypesWithMissingNestedProductTypes()Returns the total number of product types with at least one NestedType or a Set of NestedType attribute definition(s) referencing a missing productType.java.util.Map<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap.KeySetView<io.sphere.sdk.products.attributes.AttributeDefinitionDraft,java.lang.Boolean>>>getProductTypeKeysWithMissingParents()java.lang.StringgetReportMessage()Builds a summary of the product type sync statistics instance that looks like the following example:voidputMissingNestedProductType(java.lang.String missingNestedProductTypeKey, java.lang.String referencingProductTypeKey, io.sphere.sdk.products.attributes.AttributeDefinitionDraft referencingAttributeDefinitionDraft)Adds a new entry for areferencingAttributeDefinitionDraftthat is pointed to by areferencingProductTypeKeywhich is pointed to by amissingNestedProductTypeKey.voidremoveReferencingProductTypeKey(java.lang.String referencingProductTypeKey)Removes all occurrences of the referencing product type key frommissingNestedProductTypes.-
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 product type sync statistics instance that looks like the following example:"Summary: 2 product types were processed in total (0 created, 0 updated, 0 failed to sync and 0 product types with at least one NestedType or a Set of NestedType attribute definition(s) referencing a missing productType)."
- Specified by:
getReportMessagein classBaseSyncStatistics- Returns:
- a summary message of the product types sync statistics instance.
-
getNumberOfProductTypesWithMissingNestedProductTypes
public int getNumberOfProductTypesWithMissingNestedProductTypes()
Returns the total number of product types with at least one NestedType or a Set of NestedType attribute definition(s) referencing a missing productType.- Returns:
- the total number of product types with at least one NestedType or a Set of NestedType attribute definition(s) referencing a missing productType.
-
getProductTypeKeysWithMissingParents
public java.util.Map<java.lang.String,java.util.concurrent.ConcurrentHashMap<java.lang.String,java.util.concurrent.ConcurrentHashMap.KeySetView<io.sphere.sdk.products.attributes.AttributeDefinitionDraft,java.lang.Boolean>>> getProductTypeKeysWithMissingParents()
- Returns:
- an unmodifiable
ConcurrentHashMap(missingNestedProductTypes) which keeps track of the keys of missing product types, the keys of the product types which are referencing those missing product types and a list of attribute definitions which contains those references.- key: key of the missing product type
- value: a map of which consists of:
- key: key of the product type referencing the missing product type.
- value: a set of the attribute definition drafts which contains the reference to the missing product type.
-
putMissingNestedProductType
public void putMissingNestedProductType(@Nonnull java.lang.String missingNestedProductTypeKey, @Nonnull java.lang.String referencingProductTypeKey, @Nonnull io.sphere.sdk.products.attributes.AttributeDefinitionDraft referencingAttributeDefinitionDraft)Adds a new entry for areferencingAttributeDefinitionDraftthat is pointed to by areferencingProductTypeKeywhich is pointed to by amissingNestedProductTypeKey.If any of the inner sets/maps is not existing (null), this method will create a new set/map with only this new entry.
Important: This method is meant to be used only for internal use of the library and should not be used by externally.
- Parameters:
missingNestedProductTypeKey- the key of the missing nested product type.referencingProductTypeKey- the key of the referencing product type.referencingAttributeDefinitionDraft- the referencing attribute definition draft.
-
removeReferencingProductTypeKey
public void removeReferencingProductTypeKey(@Nonnull java.lang.String referencingProductTypeKey)Removes all occurrences of the referencing product type key frommissingNestedProductTypes. If there are no referencing product types for any missing nested product type, the whole entry for this missing nested product type will be removed frommissingNestedProductTypes.Important: This method is meant to be used only for internal use of the library and should not be used by externally.
- Parameters:
referencingProductTypeKey- the key that should be removed frommissingNestedProductTypes.
-
-