Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,7 @@ default Optional<ProductVariant> findVariantBySku(final String sku) {

@Nullable
CategoryOrderHints getCategoryOrderHints();

@Nullable
List<Attribute> getAttributes();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

package com.commercetools.api.models.product;

import java.util.Collections;
import java.util.Optional;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -55,6 +56,9 @@ public static ProductProjection toProjection(final Product template,
.state(StateReference.deepCopy(template.getState()))
.reviewRatingStatistics(ReviewRatingStatistics.deepCopy(template.getReviewRatingStatistics()))
.priceMode(template.getPriceMode())
.attributes(Optional.ofNullable(productDataLike.getAttributes())
.map(a -> a.stream().map(Attribute::deepCopy).collect(Collectors.toList()))
.orElse(Collections.emptyList()))
.build();
}
}