Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8ff084f
DEVX-640: adding ProductUtil for transformation from coco product to …
ShipilA Oct 8, 2025
a7ba829
DEVX-640: fixing transformations
ShipilA Oct 8, 2025
0efa419
DEVX-640: adding test
ShipilA Oct 9, 2025
c0a4a48
DEVX-640: fixing NullPointerException
ShipilA Oct 9, 2025
3618811
DEVX-640: updating test with json example + fixing nullPointerExceptions
ShipilA Oct 13, 2025
a0945d6
spotless: Fix code style
ct-sdks[bot] Oct 13, 2025
3863112
spotless: add commit to blame ignore revs file
ct-sdks[bot] Oct 13, 2025
a04de2d
DEVX-640: spotless fixes
ShipilA Oct 13, 2025
187b414
Merge remote-tracking branch 'origin/DEVX-640-helper-method-from-Coco…
ShipilA Oct 13, 2025
f9363b2
Merge branch 'main' into DEVX-640-helper-method-from-Coco-product-to-…
ShipilA Oct 13, 2025
40171ec
DEVX-640: gradle settings
ShipilA Oct 13, 2025
9f643e4
Merge remote-tracking branch 'origin/DEVX-640-helper-method-from-Coco…
ShipilA Oct 13, 2025
a391792
TASK: Updating license information
ct-sdks[bot] Oct 13, 2025
6c09dc0
DEVX-640: keyResolver for not null
ShipilA Oct 21, 2025
bccd7ed
Merge remote-tracking branch 'origin/DEVX-640-helper-method-from-Coco…
ShipilA Oct 21, 2025
86f789f
DEVX-640: adding tests for different attributes
ShipilA Oct 21, 2025
ea7f447
DEVX-640: refactoring
ShipilA Oct 21, 2025
6154ba1
spotless: Fix code style
ct-sdks[bot] Oct 21, 2025
b535237
spotless: add commit to blame ignore revs file
ct-sdks[bot] Oct 21, 2025
0c197c1
DEVX-640: adding tests for different types of sets
ShipilA Oct 24, 2025
45f674d
Merge remote-tracking branch 'origin/DEVX-640-helper-method-from-Coco…
ShipilA Oct 24, 2025
406f0b9
DEVX-640: refactoring resolveKey
ShipilA Oct 24, 2025
7ba4575
DEVX-640: refactoring resolveKey and fixing empty set attribute
ShipilA Oct 24, 2025
382298b
DEVX-640: adding comment for AttributeNestedType
ShipilA Oct 24, 2025
db4ef07
DEVX-640: adding comment for AttributeNestedType
ShipilA Oct 24, 2025
0b5dd8b
spotless: Fix code style
ct-sdks[bot] Oct 24, 2025
5351b4c
spotless: add commit to blame ignore revs file
ct-sdks[bot] Oct 24, 2025
2bc7d63
DEVX-640: refactoring for resolver service injection
ShipilA Oct 29, 2025
a33152e
Merge remote-tracking branch 'origin/DEVX-640-helper-method-from-Coco…
ShipilA Oct 29, 2025
f58dd73
spotless: Fix code style
ct-sdks[bot] Oct 29, 2025
5efe30b
spotless: add commit to blame ignore revs file
ct-sdks[bot] Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ de95c481329aa8b821e6e71ac35c1b8bc67e3e86
78c44064f4ec15091bde7a2dc590aa2b3a99341d
03665b75a1e1c3a3cf28df1dec52e91b308e4368
7e25c796da25ae080a952936de535a1228fed448
a0945d605699e8e7aca9448767ba1286b7ebb2c1
7ceb871552e5d9cb0379fbba014690aa067061eb
af9205fa592e4ae32ceca951c560a48b512b7744
6154ba1d1461d9279a305b52d8dd4b842e848545
0b5dd8bee320456962d94cb845e9d27469a34091
23 changes: 23 additions & 0 deletions commercetools/commercetools-importapi-utils/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
plugins {
id("java")
}

group = "com.commercetools.sdk"
version = "19.5.0-SNAPSHOT"

repositories {
mavenCentral()
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

implementation(project(":commercetools:commercetools-sdk-java-api"))
implementation(project(":commercetools:commercetools-sdk-java-importapi"))
}

tasks.test {
useJUnitPlatform()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

package com.commercetools.sdk;

import java.util.Optional;

import com.commercetools.api.models.IdentifiableObjHolder;
import com.commercetools.api.models.WithKey;
import com.commercetools.api.models.common.Reference;

public class ExpandObjResolverService implements KeyResolverService {

@Override
public <T extends IdentifiableObjHolder<TRes> & Reference, TRes extends WithKey> String resolveKey(T identifiable) {
return Optional.ofNullable(identifiable).map(T::getObj).map(TRes::getKey).orElse(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

package com.commercetools.sdk;

import com.commercetools.api.models.IdentifiableObjHolder;
import com.commercetools.api.models.WithKey;
import com.commercetools.api.models.common.Reference;

public interface KeyResolverService {
public <T extends IdentifiableObjHolder<TRes> & Reference, TRes extends WithKey> String resolveKey(T identifiable);
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

package com.commercetools.sdk;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class TestUtils {
public static String stringFromResource(final String resourcePath) {
try {
return Files.readString(Path.of(resourcePath));
}
catch (final IOException e) {
throw new UncheckedIOException(e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"key": "product-draft-key",
"name": {
"en": "blue shirt"
},
"slug": {
"en": "blue-t-shirt"
},
"productType": {
"typeId": "product-type",
"key": "sample"
},
"masterVariant": {
"key": "master-variant-key",
"attributes": [
{
"type": "reference",
"name": "product-ref-attribute",
"value": {
"key": "category-key",
"typeId": "category"
}
},
{
"type": "reference",
"name": "product-custom-object-ref-attribute",
"value": {
"key": "custom-object-key",
"container": "custom-object-container-key",
"typeId": "key-value-document"
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "080feded-4f74-4d31-9309-f7ef6b7f1279",
"version": 3,
"key": "productKey",
"productType": {
"typeId": "product-type",
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"obj": {
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"version": 1,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"key": "productTypeKey",
"name": "productTypeName",
"description": "productTypeDescription",
"attributes": []
}
},
"name": {
"en": "Some Products"
},
"categories": [],
"slug": {
"en": "product_slug_jxeutnxwkswk"
},
"masterVariant": {
"key": "masterVariantKey",
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "text1",
"value": {
"it": "italian1",
"de": "german1",
"en": "englisch1"
}
}
]
},
"variants": [],
"searchKeywords": {},
"hasStagedChanges": false,
"published": true,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "2014-01-07T15:25:50.034Z",
"attributes": [
{
"name": "attr1",
"value": true
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "080feded-4f74-4d31-9309-f7ef6b7f1279",
"version": 3,
"key": "productKey",
"productType": {
"typeId": "product-type",
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"obj": {
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"version": 1,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"key": "productTypeKey",
"name": "productTypeName",
"description": "productTypeDescription",
"attributes": []
}
},
"name": {
"en": "Some Products"
},
"categories": [],
"slug": {
"en": "product_slug_jxeutnxwkswk"
},
"masterVariant": {
"key": "masterVariantKey",
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "text1",
"value": {
"it": "italian1",
"de": "german1",
"en": "englisch1"
}
}
]
},
"variants": [],
"searchKeywords": {},
"hasStagedChanges": false,
"published": true,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "2014-01-07T15:25:50.034Z",
"attributes": [
{
"name": "datetime",
"value": "2020-01-01T13:15:00.123Z"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "080feded-4f74-4d31-9309-f7ef6b7f1279",
"version": 3,
"key": "productKey",
"productType": {
"typeId": "product-type",
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"obj": {
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"version": 1,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"key": "productTypeKey",
"name": "productTypeName",
"description": "productTypeDescription",
"attributes": []
}
},
"name": {
"en": "Some Products"
},
"categories": [],
"slug": {
"en": "product_slug_jxeutnxwkswk"
},
"masterVariant": {
"key": "masterVariantKey",
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "text1",
"value": {
"it": "italian1",
"de": "german1",
"en": "englisch1"
}
}
]
},
"variants": [],
"searchKeywords": {},
"hasStagedChanges": false,
"published": true,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "2014-01-07T15:25:50.034Z",
"attributes": [
{
"name": "attr1",
"value": 5.2
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"id": "080feded-4f74-4d31-9309-f7ef6b7f1279",
"version": 3,
"key": "productKey",
"productType": {
"typeId": "product-type",
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"obj": {
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"version": 1,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"key": "productTypeKey",
"name": "productTypeName",
"description": "productTypeDescription",
"attributes": []
}
},
"name": {
"en": "Some Products"
},
"categories": [],
"slug": {
"en": "product_slug_jxeutnxwkswk"
},
"masterVariant": {
"key": "masterVariantKey",
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "text1",
"value": {
"it": "italian1",
"de": "german1",
"en": "englisch1"
}
}
]
},
"variants": [],
"searchKeywords": {},
"hasStagedChanges": false,
"published": true,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "2014-01-07T15:25:50.034Z",
"attributes": [
{
"name": "enum",
"value": {
"key": "key",
"label": "meaning"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"id": "080feded-4f74-4d31-9309-f7ef6b7f1279",
"version": 3,
"key": "productKey",
"productType": {
"typeId": "product-type",
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"obj": {
"id": "1c095f1b-e638-4c7e-86c4-c58df873fca6",
"version": 1,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z",
"key": "productTypeKey",
"name": "productTypeName",
"description": "productTypeDescription",
"attributes": []
}
},
"name": {
"en": "Some Products"
},
"categories": [],
"slug": {
"en": "product_slug_jxeutnxwkswk"
},
"masterVariant": {
"key": "masterVariantKey",
"id": 1,
"prices": [],
"images": [],
"attributes": [
{
"name": "text1",
"value": {
"it": "italian1",
"de": "german1",
"en": "englisch1"
}
}
]
},
"variants": [],
"searchKeywords": {},
"hasStagedChanges": false,
"published": true,
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "2014-01-07T15:25:50.034Z",
"attributes": [
{
"name": "attr1",
"value": 5
}
]
}
Loading