You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/usage/CART_DISCOUNT_SYNC.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@ Therefore, in order to resolve the actual ids of those references in the sync pr
76
76
77
77
##### Syncing from a commercetools project
78
78
79
-
When syncing from a source commercetools project, you can use [`toCartDiscountDrafts`](#todo)
79
+
When syncing from a source commercetools project, you can use [`toCartDiscountDrafts`](/src/main/java/com/commercetools/sync/cartdiscounts/utils/CartDiscountTransformUtils.java)
80
80
method that transforms(resolves by querying and caching key-id pairs) and maps from a `CartDiscount` to `CartDiscountDraft` using cache in order to make them ready for reference resolution by the sync, for example:
81
81
82
82
````java
@@ -92,8 +92,8 @@ final List<CartDiscount> cartDiscounts = QueryUtils.queryAll(byProjectKeyCartDis
92
92
````
93
93
94
94
In order to transform and map the `CartDiscount` to `CartDiscountDraft`,
95
-
Utils method `toCartDiscountDrafts` requires `projectApiRoot`, implementation of [`ReferenceIdToKeyCache`](#todo) and `cartDiscounts` as parameters.
96
-
For cache implementation, You can use your own cache implementation or use the class in the library - which implements the cache using caffeine library with an LRU (Least Recently Used) based cache eviction strategy[`CaffeineReferenceIdToKeyCacheImpl`](#todo).
95
+
Utils method `toCartDiscountDrafts` requires `projectApiRoot`, implementation of [`ReferenceIdToKeyCache`](/src/main/java/com/commercetools/sync/commons/utils/ReferenceIdToKeyCache.java) and `cartDiscounts` as parameters.
96
+
For cache implementation, You can use your own cache implementation or use the class in the library - which implements the cache using caffeine library with an LRU (Least Recently Used) based cache eviction strategy[`CaffeineReferenceIdToKeyCacheImpl`](/src/main/java/com/commercetools/sync/commons/utils/CaffeineReferenceIdToKeyCacheImpl.java).
97
97
Example as shown below:
98
98
99
99
````java
@@ -250,8 +250,8 @@ __Note__ The statistics object contains the processing time of the last batch on
250
250
251
251
#### More examples of how to use the sync
252
252
253
-
1.[Sync from another CTP project as a source](#todo).
254
-
2.[Sync from an external source](#todo).
253
+
1.[Sync from another CTP project as a source](/src/integration-test/java/com/commercetools/sync/integration/ctpprojectsource/cartdiscounts).
254
+
2.[Sync from an external source](/src/integration-test/java/com/commercetools/sync/integration/externalsource/cartdiscounts).
255
255
256
256
*Make sure to read the [Important Usage Tips](IMPORTANT_USAGE_TIPS.md) for optimal performance.*
257
257
@@ -269,7 +269,7 @@ Utility methods provided by the library to compare the specific fields of a `Car
More examples of those utils for different cart discounts can be found [here](#todo).
272
+
More examples of those utils for different cart discounts can be found [here](/src/test/java/com/commercetools/sync/cartdiscounts/utils/CartDiscountUpdateActionUtilsTest.java).
273
273
274
274
## Migration Guide
275
275
@@ -299,14 +299,14 @@ any HTTP client module. The default one is `commercetools-http-client`.
299
299
300
300
### Client configuration and creation
301
301
302
-
For client creation use [ClientConfigurationUtils](#todo) which apply the best practices for `ProjectApiRoot` creation.
302
+
For client creation use [ClientConfigurationUtils](/src/main/java/com/commercetools/sync/commons/utils/ClientConfigurationUtils.java) which apply the best practices for `ProjectApiRoot` creation.
303
303
If you have custom requirements for the client creation make sure to replace `SphereClientFactory` with `ApiRootBuilder` as described in this [Migration Document](https://docs.commercetools.com/sdk/java-sdk-migrate#client-configuration-and-creation).
304
304
305
305
### Signature of CartDiscountSyncOptions
306
306
307
307
As models and update actions have changed in the JVM-SDK-V2 the signature of SyncOptions is different. It's constructor now takes a `ProjectApiRoot` as first argument. The callback functions are signed with `CartDiscount`, `CartDiscountDraft` and `CartDiscountUpdateAction` from `package com.commercetools.api.models.cart_discount.*`
308
308
309
-
> Note: Type `UpdateAction<CartDiscount>` has changed to `CartDiscountUpdateAction`. Make sure you create and supply a specific CartDiscountUpdateAction in `beforeUpdateCallback`. For that you can use the [library-utilities](#todo) or use a JVM-SDK builder ([see also](https://docs.commercetools.com/sdk/java-sdk-migrate#update-resources)):
309
+
> Note: Type `UpdateAction<CartDiscount>` has changed to `CartDiscountUpdateAction`. Make sure you create and supply a specific CartDiscountUpdateAction in `beforeUpdateCallback`. For that you can use the [library-utilities](/src/main/java/com/commercetools/sync/cartdiscounts/utils/CartDiscountSyncUtils.java) or use a JVM-SDK builder ([see also](https://docs.commercetools.com/sdk/java-sdk-migrate#update-resources)):
310
310
311
311
```java
312
312
// Example: Create a cart discount update action to change name taking the 'newName' of the cartDiscountDraft
@@ -371,7 +371,7 @@ For more information, see the [Guide to replace DraftBuilders](https://docs.comm
371
371
372
372
### Query for Cart Discounts (syncing from CTP project)
373
373
374
-
If you sync cart discounts between different commercetools projects you probably use [CartDiscountTransformUtils#toCartDiscountDrafts](#todo) to transform `CartDiscount` into `CartDiscountDraft` which can be used by the cartDiscount-sync.
374
+
If you sync cart discounts between different commercetools projects you probably use [CartDiscountTransformUtils#toCartDiscountDrafts](/src/main/java/com/commercetools/sync/cartdiscounts/utils/CartDiscountTransformUtils.java) to transform `CartDiscount` into `CartDiscountDraft` which can be used by the cartDiscount-sync.
375
375
However, if you need to query `Cart Discounts` from a commercetools project instead of passing `CartDiscountQuery`s to a `sphereClient`, create (and execute) requests directly from the `apiRoot`.
0 commit comments