Skip to content

Commit 4c5234c

Browse files
Implement utility class and helper classes for CustomObjectSync (#561)
* Implement utility class and helper classes for CustomObjectSync * Enhance the CustomObjectSyncUtilsTest to check JsonNode in different datatypes. * Remove non-null annotation in CustomObjectSyncUtils * Fix incorrect javadoc in CustomObjectSyncStatistics * Remove unused variable in CustomObjectSyncUtilsTest * Refactor CustomObjectSyncUtilsTest * Revert "Refactor CustomObjectSyncUtilsTest" This reverts commit 1e6b7b4. * Remove blank line * Refactor CustomObjectSyncUtilsTest * Remove batchElements from CustomObjectSyncUtils * Remove unused import and change the class variables to be local variables * Remove spaces in CustomObjectSyncUtilsTest * Add customobjects sync (#569) * Implement CustomObjectSync * Enhance the CustomObjectSyncUtilsTest to check JsonNode in different datatypes. * Inherit CustomObjetSync from BaseSync * Remove batchElements from CustomObjectSyncUtils * Remove non-null annotation in CustomObjectSyncUtils * Fix import problem in CustomObjectSync * Add override methods for equals and hashCode * Add assertion for CustomObjectSyncStatistics * Create CustomObjectSyncStatisticsAssert class * Add first unit test scenario to CustomObjectSyncTest * Add unit test scenario * Implement unit test for custom object update in CustomObjectSyncTest * Change the deprecated method * Fix checkstyle problem * Fix unit case problem in mocking composite identifier * Remove unused import in CustomObjectCompositeIdentifier * Remove unused import in CustomObjectSyncTest * Revert the change on CustomObjectSyncUtilsTest * Revert the change in CustomObjectSyncUtilsTest * Refactor sync class to increase coverage * Remove unused import in CustomObjectSyncTest * Apply correct style formatting * Fix checkstyleMain issues * Fix checkStyle issue * Add public constructor in CustomObjectSync * Remove blank line after javadoc * Apply method reference in lambda in CustomObjectSync * Update error message * Change javadoc for method CustomObjectSync.validateDraft() * Change error messages * Avoid calling CTP when two custom objects are identical. * Fix unit test expected error message * Correct the javadoc for updateCustomObject() * Add unit test cases and fix bugs * Rename unit test method * Add unit test case to cover update retry failure * Fix expected result in unit test * Remove blank lines * Refactor CustomObjectSyncTest * Fix findbugs problem * Rename Response to be ResponseEntry * Remove blank lines and fix indentation * Fix indentation in CustomObjectServiceImpl * Remove blank lines * Add equals() and hashCode() in CustomObjectCompositeIdentifier * Add unit test cases * Fix indentation in CustomObjectSyncTest * Add CustomObjectCompositeIdentifierTest Co-authored-by: ninalindl <nina.lindl@web.de> * CustomObject sync finalization (#573) * Add integration tests in CustomObjectSyncIT * Fix integration test case for update custom object * Fix CustomObjectSync for ConcurrentModificationException handling * Fix refactoring problem in BaseService * Delete newly created custom object between every test case * Update README.md * Update README.md * Add CUSTOM_OBJECT_SYNC.md * Add release note for v2.1.0 * Update release notes * Update version number to v2.1.0 * Fix documentation * Remove redundant java comment * Fix javadoc and java comments * Remove empty line in BaseService * Remove empty lines in CustomObjectSyncIT * Add javadoc for CustomObjectServiceImpl.executeCreateCommand() * Revert "Add javadoc for CustomObjectServiceImpl.executeCreateCommand()" This reverts commit 390680b. * Add javadoc to describe CustomObjectServiceImpl.executeCreateCommand() * Modify test case method naming in CustomObjectSyncIT * Update RELEASE_NOTES.md * Update CUSTOM_OBJECT_SYNC.md * Remove unused import * Modify javadoc for CustomObjectServiceImpl.executeCreateCommand() * Revert "Modify javadoc for CustomObjectServiceImpl.executeCreateCommand()" This reverts commit 9ad46a0. * Modify javadoc for CustomObjectSerivceImpl.executeCreateCommand() Co-authored-by: ninalindl <nina.lindl@web.de> * Add unit test case for CustomObjectServiceImpl to increase coverage rate * Fix indentation * Add link in mkdocs.yml * Add private constructor to increase coverage * Revert "Add private constructor to increase coverage" This reverts commit 6e71275. * Update RELEASE_NOTES Co-authored-by: ninalindl <nina.lindl@web.de>
1 parent fc5a9a9 commit 4c5234c

36 files changed

Lines changed: 2255 additions & 188 deletions

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# commercetools sync
33
[![Build Status](https://travis-ci.org/commercetools/commercetools-sync-java.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-sync-java)
44
[![codecov](https://codecov.io/gh/commercetools/commercetools-sync-java/branch/master/graph/badge.svg)](https://codecov.io/gh/commercetools/commercetools-sync-java)
5-
[![Benchmarks 2.0.0](https://img.shields.io/badge/Benchmarks-2.0.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
5+
[![Benchmarks 2.1.0](https://img.shields.io/badge/Benchmarks-2.1.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
66
[![Download](https://api.bintray.com/packages/commercetools/maven/commercetools-sync-java/images/download.svg) ](https://bintray.com/commercetools/maven/commercetools-sync-java/_latestVersion)
7-
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/)
7+
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/)
88
[![Known Vulnerabilities](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646/badge.svg)](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646)
99

1010
More at https://commercetools.github.io/commercetools-sync-java
@@ -21,6 +21,7 @@ The library supports synchronising the following entities in commercetools
2121
- [CartDiscounts](/docs/usage/CART_DISCOUNT_SYNC.md)
2222
- [States](/docs/usage/STATE_SYNC.md)
2323
- [TaxCategories](/docs/usage/TAX_CATEGORY_SYNC.md)
24+
- [CustomObjects](/docs/usage/CUSTOM_OBJECT_SYNC.md)
2425

2526
![commercetools-java-sync-final 001](https://user-images.githubusercontent.com/9512131/31230702-0f2255a6-a9e5-11e7-9412-04ed52641dde.png)
2627
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -36,7 +37,7 @@ The library supports synchronising the following entities in commercetools
3637
- [Ivy](#ivy)
3738
- [Roadmap](#roadmap)
3839
- [Release Notes](/docs/RELEASE_NOTES.md)
39-
- [Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/)
40+
- [Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/)
4041
- [Benchmarks](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
4142

4243
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -78,26 +79,26 @@ Here are the most popular ones:
7879
<dependency>
7980
<groupId>com.commercetools</groupId>
8081
<artifactId>commercetools-sync-java</artifactId>
81-
<version>2.0.0</version>
82+
<version>2.1.0</version>
8283
</dependency>
8384
````
8485

8586
#### Gradle
8687

8788
````groovy
88-
implementation 'com.commercetools:commercetools-sync-java:2.0.0'
89+
implementation 'com.commercetools:commercetools-sync-java:2.1.0'
8990
````
9091

9192
#### SBT
9293

9394
````
94-
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.0.0"
95+
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.1.0"
9596
````
9697

9798
#### Ivy
9899

99100
````xml
100-
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.0.0"/>
101+
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.1.0"/>
101102
````
102103

103104

docs/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# commercetools sync
33
[![Build Status](https://travis-ci.org/commercetools/commercetools-sync-java.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-sync-java)
44
[![codecov](https://codecov.io/gh/commercetools/commercetools-sync-java/branch/master/graph/badge.svg)](https://codecov.io/gh/commercetools/commercetools-sync-java)
5-
[![Benchmarks 2.0.0](https://img.shields.io/badge/Benchmarks-2.0.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
5+
[![Benchmarks 2.1.0](https://img.shields.io/badge/Benchmarks-2.1.0-orange.svg)](https://commercetools.github.io/commercetools-sync-java/benchmarks/)
66
[![Download](https://api.bintray.com/packages/commercetools/maven/commercetools-sync-java/images/download.svg) ](https://bintray.com/commercetools/maven/commercetools-sync-java/_latestVersion)
7-
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/)
7+
[![Javadoc](http://javadoc-badge.appspot.com/com.commercetools/commercetools-sync-java.svg?label=Javadoc)](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/)
88
[![Known Vulnerabilities](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646/badge.svg)](https://snyk.io/test/github/commercetools/commercetools-sync-java/4b2e26113d591bda158217c5dc1cf80a88665646)
99

1010

@@ -35,6 +35,7 @@ The library supports synchronising the following entities in commercetools
3535
- [CartDiscounts](usage/CART_DISCOUNT_SYNC.md)
3636
- [States](usage/STATE_SYNC.md)
3737
- [TaxCategories](/docs/usage/TAX_CATEGORY_SYNC.md)
38+
- [CustomObjects](/docs/usage/CUSTOM_OBJECT_SYNC.md)
3839

3940
![commercetools-java-sync-final 001](https://user-images.githubusercontent.com/9512131/31230702-0f2255a6-a9e5-11e7-9412-04ed52641dde.png)
4041

@@ -55,18 +56,18 @@ Here are the most popular ones:
5556
<dependency>
5657
<groupId>com.commercetools</groupId>
5758
<artifactId>commercetools-sync-java</artifactId>
58-
<version>2.0.0</version>
59+
<version>2.1.0</version>
5960
</dependency>
6061
````
6162
#### Gradle
6263
````groovy
63-
implementation 'com.commercetools:commercetools-sync-java:2.0.0'
64+
implementation 'com.commercetools:commercetools-sync-java:2.1.0'
6465
````
6566
#### SBT
6667
````
67-
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.0.0"
68+
libraryDependencies += "com.commercetools" % "commercetools-sync-java" % "2.1.0"
6869
````
6970
#### Ivy
7071
````xml
71-
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.0.0"/>
72+
<dependency org="com.commercetools" name="commercetools-sync-java" rev="2.1.0"/>
7273
````

docs/RELEASE_NOTES.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,20 @@
3333
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/2.0.0...2.0.1) |
3434
[Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.0.1/) |
3535
[Jar](https://bintray.com/commercetools/maven/commercetools-sync-java/2.0.1)
36-
37-
-->
36+
-->
37+
38+
### 2.1.0 - Sep 21, 2020
39+
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/2.0.0...2.1.0) |
40+
[Javadoc](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/) |
41+
[Jar](https://bintray.com/commercetools/maven/commercetools-sync-java/2.1.0)
42+
- 🎉 **New Features** (2)
43+
- **CustomObject Sync** - Added support for syncing custom objects between ctp projects. [#565](https://github.com/commercetools/commercetools-sync-java/issues/565) For more info how to use it please refer to [CustomObject usage doc](/docs/usage/CUSTOM_OBJECT_SYNC.md).
44+
- **CustomObject Sync** - Exposed `CustomObjectSyncUtils#hasIdenticalValue` which determines whether update process is required after comparing a `CustomObject` and a `CustomObjectDraft`. [#565](https://github.com/commercetools/commercetools-sync-java/issues/565)
45+
46+
- 🛠️ **Dependency Updates** (3)
47+
- `org.ajoberstar.git-publish` `2.1.3` -> [`3.0.0`](https://github.com/ajoberstar/gradle-git-publish/releases/tag/3.0.0)
48+
- `org.ajoberstar.grgit` `4.0.2` -> [`4.1.0`](https://github.com/ajoberstar/grgit/releases/tag/4.1.0)
49+
- `mockito-junit-jupiter` `3.5.10` -> [`3.5.11`](https://github.com/mockito/mockito/releases/tag/v3.5.11)
3850

3951
### 2.0.0 - Sept 14, 2020
4052
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/1.9.1...2.0.0) |
@@ -65,7 +77,7 @@
6577
- `junit.jupiterApiVersion` `5.6.2` -> [`5.7.0`](https://github.com/junit-team/junit5/releases/tag/r5.7.0)
6678
- `mockito-junit-jupiter` `3.4.4` -> [`3.5.10`](https://github.com/mockito/mockito/releases/tag/v3.5.10)
6779
- `com.github.ben-manes.versions` `0.29.0` -> [`0.33.0`](https://github.com/ben-manes/gradle-versions-plugin/releases/tag/v0.33.0)
68-
80+
6981
### 1.9.1 - Aug 5, 2020
7082
[Commits](https://github.com/commercetools/commercetools-sync-java/compare/1.9.0...1.9.1) |
7183
[Javadoc](https://commercetools.github.io/commercetools-sync-java/v/1.9.1/) |

docs/usage/CART_DISCOUNT_SYNC.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ fields set, otherwise they won't be matched.
3232
Types are matched by their `key`s. Therefore, in order for the sync to resolve the
3333
actual ids of the type reference, the `key` of the `Type` has to be supplied.
3434

35-
- When syncing from a source commercetools project, you can use [`mapToCartDiscountDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/com/commercetools/sync/cartdiscounts/utils/CartDiscountReferenceResolutionUtils.html#mapToCartDiscountDrafts-java.util.List-)
35+
- When syncing from a source commercetools project, you can use [`mapToCartDiscountDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/cartdiscounts/utils/CartDiscountReferenceResolutionUtils.html#mapToCartDiscountDrafts-java.util.List-)
3636
method that maps from a `CartDiscount` to `CartDiscountDraft` in order to make them ready for reference resolution by the sync:
37+
3738
````java
3839
final List<CartDiscountDraft> cartDiscountDrafts = CartDiscountReferenceResolutionUtils.mapToCartDiscountDrafts(cartDiscounts);
3940
````

docs/usage/CATEGORY_SYNC.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ otherwise they won't be matched.
3434
These references are matched by their `key`s. Therefore, in order for the sync to resolve the
3535
actual ids of the references, their `key`s has to be supplied.
3636

37-
- When syncing from a source commercetools project, you can use [`mapToCategoryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/com/commercetools/sync/categories/utils/CategoryReferenceResolutionUtils.html#mapToCategoryDrafts-java.util.List-)
37+
- When syncing from a source commercetools project, you can use [`mapToCategoryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/categories/utils/CategoryReferenceResolutionUtils.html#mapToCategoryDrafts-java.util.List-)
3838
method that maps from a `Category` to `CategoryDraft` in order to make them ready for reference resolution by the sync:
3939
````java
4040
final List<CategoryDraft> categoryDrafts = CategoryReferenceResolutionUtils.mapToCategoryDrafts(categories);
41-
````
42-
41+
````
42+
4343
3. Create a `sphereClient` [as described here](IMPORTANT_USAGE_TIPS.md#sphereclient-creation).
4444

4545
4. After the `sphereClient` is set up, a `CategorySyncOptions` should be built as follows:

docs/usage/CUSTOM_OBJECT_SYNC.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Custom Object Sync
2+
3+
Module used for importing/syncing CustomObject into a commercetools project.
4+
It also provides utilities for correlating a custom object to a given custom object draft based on the
5+
comparison of a [CustomObject](https://docs.commercetools.com/http-api-projects-custom-objects#customobject)
6+
against a [CustomObjectDraft](https://docs.commercetools.com/http-api-projects-custom-objects#customobjectdraft).
7+
8+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
9+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
10+
11+
12+
- [Usage](#usage)
13+
- [Sync list of CustomObjectDrafts](#sync-list-of-customobjectdrafts)
14+
- [Prerequisites](#prerequisites)
15+
- [Running the sync](#running-the-sync)
16+
- [More examples of how to use the sync](#more-examples-of-how-to-use-the-sync)
17+
18+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
19+
20+
## Usage
21+
22+
### Sync list of CustomObjectDrafts
23+
24+
#### Prerequisites
25+
1. The sync expects a list of `CustomObjectDraft`s that have their `key` and `container` fields set to be matched with
26+
custom objects in the target CTP project. Therefore, the custom objects in the target project are expected to have the
27+
same `key` and `container` fields set, otherwise they won't be matched.
28+
29+
2. Create a `sphereClient` [as described here](IMPORTANT_USAGE_TIPS.md#sphereclient-creation).
30+
31+
3. After the `sphereClient` is set up, a `CustomObjectSyncOptions` should be be built as follows:
32+
````java
33+
// instantiating a CustomObjectSyncOptions
34+
final CustomObjectSyncOptions customObjectSyncOptions = CustomObjectSyncOptionsBuilder.of(sphereClient).build();
35+
````
36+
37+
[More information about Sync Options](SYNC_OPTIONS.md).
38+
39+
#### Running the sync
40+
After all the aforementioned points in the previous section have been fulfilled, to run the sync:
41+
````java
42+
// instantiating a CustomObjectSync
43+
final CustomObjectSync customObjectSync = new CustomObjectSync(customObjectSyncOptions);
44+
45+
// execute the sync on your list of custom object drafts
46+
CompletionStage<CustomObjectSyncStatistics> syncStatisticsStage = customObjectSync.sync(customObjectDrafts);
47+
````
48+
The result of the completing the `syncStatisticsStage` in the previous code snippet contains a `CustomObjectSyncStatistics`
49+
which contains all the stats of the sync process; which includes a report message, the total number of updated, created,
50+
failed, processed custom objects and the processing time of the last sync batch in different time units and in a
51+
human-readable format.
52+
53+
````java
54+
final CustomObjectSyncStatistics stats = syncStatisticsStage.toCompletebleFuture().join();
55+
stats.getReportMessage();
56+
/*"Summary: 2000 custom objects were processed in total (1000 created, 995 updated, 5 failed to sync)."*/
57+
````
58+
59+
__Note__ The statistics object contains the processing time of the last batch only. This is due to two reasons:
60+
61+
1. The sync processing time should not take into account the time between supplying batches to the sync.
62+
2. It is not known by the sync which batch is going to be the last one supplied.
63+
64+
#### More examples of how to use the sync
65+
66+
- [Sync from an external source](https://github.com/commercetools/commercetools-sync-java/tree/master/src/integration-test/java/com/commercetools/sync/integration/externalsource/customobjects/CustomObjectSyncIT.java).
67+
68+
*Make sure to read the [Important Usage Tips](IMPORTANT_USAGE_TIPS.md) for optimal performance.*
69+
70+
More examples of those utils for different custom objects can be found [here](https://github.com/commercetools/commercetools-sync-java/tree/master/src/test/java/com/commercetools/sync/customobjects/utils/CustomObjectSyncUtilsTest.java).

docs/usage/IMPORTANT_USAGE_TIPS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ productSync.sync(batch1)
3131
By design, scaling the sync process should **not** be done by executing the batches themselves in parallel. However, it can be done either by:
3232

3333
- Changing the number of [max parallel requests](https://github.com/commercetools/commercetools-sync-java/tree/master/src/main/java/com/commercetools/sync/commons/utils/ClientConfigurationUtils.java#L116) within the `sphereClient` configuration. It defines how many requests the client can execute in parallel.
34-
- or changing the draft [batch size](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/com/commercetools/sync/commons/BaseSyncOptionsBuilder.html#batchSize-int-). It defines how many drafts can one batch contain.
34+
- or changing the draft [batch size](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/commons/BaseSyncOptionsBuilder.html#batchSize-int-). It defines how many drafts can one batch contain.
3535

3636
The current overridable default [configuration](https://github.com/commercetools/commercetools-sync-java/tree/master/src/main/java/com/commercetools/sync/commons/utils/ClientConfigurationUtils.java#L45) of the `sphereClient`
3737
is the recommended good balance for stability and performance for the sync process.

docs/usage/INVENTORY_SYNC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ against a [InventoryEntryDraft](https://docs.commercetools.com/http-api-projects
3232
references are matched by their `key`s. Therefore, in order for the sync to resolve the actual ids of those references,
3333
their `key`s has to be supplied.
3434

35-
- When syncing from a source commercetools project, you can use [`mapToInventoryEntryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/com/commercetools/sync/inventories/utils/InventoryReferenceResolutionUtils.html#mapToInventoryEntryDrafts-java.util.List-)
35+
- When syncing from a source commercetools project, you can use [`mapToInventoryEntryDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/inventories/utils/InventoryReferenceResolutionUtils.html#mapToInventoryEntryDrafts-java.util.List-)
3636
method that that maps from a `InventoryEntry` to `InventoryEntryDraft` in order to make them ready for reference resolution by the sync:
3737
````java
3838
final List<InventoryEntryDraft> inventoryEntryDrafts = InventoryReferenceResolutionUtils.mapToInventoryEntryDrafts(inventoryEntries);

docs/usage/PRODUCT_SYNC.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,15 @@ all the variants in the target project are expected to have the `sku` fields set
3838
of the product also have prices, where each price also has some references including a reference to the `Type` of its
3939
custom fields and a reference to a `channel`. All these referenced resources are matched by their `key`s. Therefore, in
4040
order for the sync to resolve the actual ids of those references, those `key`s have to be supplied in the following way:
41-
42-
- When syncing from a source commercetools project, you can use [`mapToProductDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.0.0/com/commercetools/sync/products/utils/ProductReferenceResolutionUtils.html#mapToProductDrafts-java.util.List-)
41+
- When syncing from a source commercetools project, you can use [`mapToProductDrafts`](https://commercetools.github.io/commercetools-sync-java/v/2.1.0/com/commercetools/sync/products/utils/ProductReferenceResolutionUtils.html#mapToProductDrafts-java.util.List-)
4342
method that maps from a `Product` to `ProductDraft` in order to make them ready for reference resolution by the sync:
4443
````java
4544
final List<ProductDraft> productDrafts = ProductReferenceResolutionUtils.mapToProductDrafts(products);
4645
````
4746
> Note: Some references in the product like `state`, `customerGroup` of prices, and variant attributes with type `reference` do not support the `ResourceIdentifier` yet,
4847
for those references you need to provide the `key` value on the `id` field of the reference. This means that calling `getId()` on the
4948
reference would return its `key`.
50-
>
49+
5150
4. Create a `sphereClient` [as described here](IMPORTANT_USAGE_TIPS.md#sphereclient-creation).
5251

5352
5. After the `sphereClient` is set up, a `ProductSyncOptions` should be built as follows:

0 commit comments

Comments
 (0)