Source:
private F.Promise<Result> pdpx(final ProductProjection product, final ProductVariant variant) { final F.Promise<List<ProductProjection>> suggestionPromise = productService.getSuggestions(categoryService.getSiblingCategories(product), NUM_SUGGESTIONS); final List<RichShippingRate> shippingRates = shippingMethodService.getShippingRates(context().user().zone()); final List<Category> breadcrumbs = categoryService.getBreadCrumbCategories(product); return suggestionPromise.flatMap(suggestions -> withCms("pdp", cms -> { final Translator translator = Translator.of(context().user().language(), context().user().fallbackLanguages(), context().project().languages()); final PriceFinder priceFinder = PriceFinder.of(context().user()); final PriceFormatter priceFormatter = PriceFormatter.of(GERMAN); final ProductThumbnailDataFactory thumbnailDataFactory = ProductThumbnailDataFactory.of(translator, priceFinder, priceFormatter); final ShippingRateDataFactory shippingRateDataFactory = ShippingRateDataFactory.of(priceFormatter); final CategoryLinkDataFactory categoryLinkDataFactory = CategoryLinkDataFactory.of(translator); final String additionalTitle = translator.translate(product.getName()); final PdpStaticData staticData = new PdpStaticData(cms); final List<LinkData> breadcrumbData = breadcrumbs.stream().map(categoryLinkDataFactory::create).collect(toList()); final List<ImageData> galleryData = variant.getImages().stream().map(ImageData::of).collect(toList()); final ProductData productData = ProductDataFactory.of(translator, priceFinder, priceFormatter).create(product, variant); final List<ShippingRateData> deliveryData = shippingRates.stream().map(shippingRateDataFactory::create).collect(toList()); final List<ProductThumbnailData> suggestionData = suggestions.stream().map(thumbnailDataFactory::create).collect(toList()); final ProductDetailPageContent content = new ProductDetailPageContent(additionalTitle, staticData, breadcrumbData, galleryData, productData, deliveryData, suggestionData); return render(view -> ok(view.productDetailPage(content))); })); }

Target:
private F.Promise<Result> pdpx(final ProductProjection product, final ProductVariant variant) { final F.Promise<List<ProductProjection>> suggestionPromise = productService.getSuggestions(categoryService.getSiblingCategories(product.getCategories()), NUM_SUGGESTIONS); final List<ShopShippingRate> shippingRates = shippingMethodService.getShippingRates(context().user().zone()); final List<Category> breadcrumbs = product.getCategories().stream().findFirst() .map(categoryService::getBreadCrumbCategories) .orElse(Collections.<Category>emptyList()); return suggestionPromise.flatMap(suggestions -> withCms("pdp", cms -> { final Translator translator = context().translator(); final PriceFormatter priceFormatter = context().user().priceFormatter(); final PriceFinder priceFinder = context().user().priceFinder(); final ProductThumbnailDataFactory thumbnailDataFactory = ProductThumbnailDataFactory.of(translator, priceFinder, priceFormatter); final ShippingRateDataFactory shippingRateDataFactory = ShippingRateDataFactory.of(priceFormatter); final CategoryLinkDataFactory categoryLinkDataFactory = CategoryLinkDataFactory.of(translator); final String additionalTitle = translator.findTranslation(product.getName()); final PdpStaticData staticData = new PdpStaticData(cms, BagItemDataFactory.of().create(100), RatingDataFactory.of(cms).create()); final List<LinkData> breadcrumbData = breadcrumbs.stream().map(categoryLinkDataFactory::create).collect(toList()); final List<ImageData> galleryData = variant.getImages().stream().map(ImageData::of).collect(toList()); final ProductData productData = ProductDataFactory.of(translator, priceFinder, priceFormatter).create(product, variant); final List<ShippingRateData> deliveryData = shippingRates.stream().map(shippingRateDataFactory::create).collect(toList()); final List<ProductThumbnailData> suggestionData = suggestions.stream().map(thumbnailDataFactory::create).collect(toList()); final ProductDetailPageContent content = new ProductDetailPageContent(additionalTitle, staticData, breadcrumbData, galleryData, productData, deliveryData, suggestionData); return render(view -> ok(view.productDetailPage(content))); })); }