Skip to content

Commit b366998

Browse files
committed
Update links for cart discount sync
1 parent 9358b34 commit b366998

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/usage/CART_DISCOUNT_SYNC.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Therefore, in order to resolve the actual ids of those references in the sync pr
7676
7777
##### Syncing from a commercetools project
7878

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)
8080
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:
8181

8282
````java
@@ -92,8 +92,8 @@ final List<CartDiscount> cartDiscounts = QueryUtils.queryAll(byProjectKeyCartDis
9292
````
9393

9494
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).
9797
Example as shown below:
9898

9999
````java
@@ -250,8 +250,8 @@ __Note__ The statistics object contains the processing time of the last batch on
250250

251251
#### More examples of how to use the sync
252252

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).
255255

256256
*Make sure to read the [Important Usage Tips](IMPORTANT_USAGE_TIPS.md) for optimal performance.*
257257

@@ -269,7 +269,7 @@ Utility methods provided by the library to compare the specific fields of a `Car
269269
````java
270270
Optional<CartDiscountUpdateAction> updateAction = CartDiscountUpdateActionUtils.buildChangeNameAction(oldCartDiscount, cartDiscountDraft);
271271
````
272-
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).
273273

274274
## Migration Guide
275275

@@ -299,14 +299,14 @@ any HTTP client module. The default one is `commercetools-http-client`.
299299

300300
### Client configuration and creation
301301

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.
303303
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).
304304

305305
### Signature of CartDiscountSyncOptions
306306

307307
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.*`
308308

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)):
310310
311311
```java
312312
// 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
371371

372372
### Query for Cart Discounts (syncing from CTP project)
373373

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.
375375
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`.
376376
Here's an example:
377377

0 commit comments

Comments
 (0)