From 9b94d9ad815843dc7670e34d33bad7aeb37a3097 Mon Sep 17 00:00:00 2001 From: lojzatran Date: Wed, 1 Nov 2023 16:27:45 +0100 Subject: [PATCH] Fix compilation error --- .../sync/commons/utils/ChunkUtils.java | 19 +++++++---- .../sync/services/impl/BaseService.java | 6 ++-- .../services/impl/BaseServiceWithKey.java | 7 ++-- .../impl/CartDiscountServiceImpl.java | 2 ++ .../services/impl/CategoryServiceImpl.java | 2 ++ .../services/impl/ChannelServiceImpl.java | 2 ++ .../impl/CustomObjectServiceImpl.java | 33 ++++++++++--------- .../impl/CustomerGroupServiceImpl.java | 2 ++ .../services/impl/CustomerServiceImpl.java | 2 ++ .../services/impl/InventoryServiceImpl.java | 2 ++ .../services/impl/ProductServiceImpl.java | 2 ++ .../services/impl/ProductTypeServiceImpl.java | 2 ++ .../impl/ShoppingListServiceImpl.java | 2 ++ .../sync/services/impl/StateServiceImpl.java | 2 ++ .../services/impl/TaxCategoryServiceImpl.java | 2 ++ .../sync/services/impl/TypeServiceImpl.java | 2 ++ 16 files changed, 62 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/commercetools/sync/commons/utils/ChunkUtils.java b/src/main/java/com/commercetools/sync/commons/utils/ChunkUtils.java index 5c189485f1..1252217ae1 100644 --- a/src/main/java/com/commercetools/sync/commons/utils/ChunkUtils.java +++ b/src/main/java/com/commercetools/sync/commons/utils/ChunkUtils.java @@ -3,8 +3,8 @@ import static com.commercetools.sync.commons.utils.CompletableFutureUtils.collectionOfFuturesToFutureOfCollection; import static java.util.stream.Collectors.toList; +import com.commercetools.api.client.PagedQueryResourceRequest; import com.commercetools.api.client.ProjectApiRoot; -import com.commercetools.api.models.PagedQueryResourceRequest; import com.commercetools.api.models.graph_ql.GraphQLRequest; import com.commercetools.api.models.graph_ql.GraphQLResponse; import io.vrap.rmf.base.client.ApiHttpResponse; @@ -24,16 +24,21 @@ public class ChunkUtils { * * @param requests A list of {@link PagedQueryResourceRequest} implementation to allow {@link * ProjectApiRoot} to execute queries on CTP. - * @param the type of the underlying model. - * @param the type of the request model. + * @param the type of the request model. + * @param the type of the underlying model. + * @param the type of the query builder dsl class (e.g. + * CartDiscountQueryBuilderDsl, CustomerQueryBuilderDsl, ...). * @return a list of lists where each list represents the results of passed {@link * PagedQueryResourceRequest}. */ - public static , ResourceT> - CompletableFuture>> executeChunks( - @Nonnull final List requests) { + public static < + ResourceT extends PagedQueryResourceRequest, + ResultT, + QueryBuilderDslT> + CompletableFuture>> executeChunks( + @Nonnull final List requests) { - final List>> futures = + final List>> futures = requests.stream().map(request -> request.execute()).collect(toList()); return collectionOfFuturesToFutureOfCollection(futures, toList()); diff --git a/src/main/java/com/commercetools/sync/services/impl/BaseService.java b/src/main/java/com/commercetools/sync/services/impl/BaseService.java index 88b84f613e..00eea32ff3 100644 --- a/src/main/java/com/commercetools/sync/services/impl/BaseService.java +++ b/src/main/java/com/commercetools/sync/services/impl/BaseService.java @@ -5,9 +5,9 @@ import static java.util.stream.Collectors.toList; import static org.apache.commons.lang3.StringUtils.isBlank; +import com.commercetools.api.client.PagedQueryResourceRequest; import com.commercetools.api.client.QueryUtils; import com.commercetools.api.models.DomainResource; -import com.commercetools.api.models.PagedQueryResourceRequest; import com.commercetools.api.models.ResourcePagedQueryResponse; import com.commercetools.api.models.graph_ql.GraphQLRequest; import com.commercetools.api.models.graph_ql.GraphQLRequestBuilder; @@ -44,10 +44,12 @@ abstract class BaseService< SyncOptionsT extends BaseSyncOptions, ResourceT extends DomainResource, ResourceDraftT extends Draft, - PagedQueryRequestT extends PagedQueryResourceRequest, + PagedQueryRequestT extends + PagedQueryResourceRequest, PagedQueryResponseT extends ResourcePagedQueryResponse, GetOneResourceQueryT extends ApiMethod, QueryResultT, + QueryBuilderDslT, PostRequestT extends BodyApiMethod> { final SyncOptionsT syncOptions; diff --git a/src/main/java/com/commercetools/sync/services/impl/BaseServiceWithKey.java b/src/main/java/com/commercetools/sync/services/impl/BaseServiceWithKey.java index aa32048247..26dbe3d7c3 100644 --- a/src/main/java/com/commercetools/sync/services/impl/BaseServiceWithKey.java +++ b/src/main/java/com/commercetools/sync/services/impl/BaseServiceWithKey.java @@ -1,7 +1,7 @@ package com.commercetools.sync.services.impl; +import com.commercetools.api.client.PagedQueryResourceRequest; import com.commercetools.api.models.DomainResource; -import com.commercetools.api.models.PagedQueryResourceRequest; import com.commercetools.api.models.ResourcePagedQueryResponse; import com.commercetools.api.models.WithKey; import com.commercetools.sync.commons.BaseSyncOptions; @@ -19,10 +19,12 @@ abstract class BaseServiceWithKey< SyncOptionsT extends BaseSyncOptions, ResourceT extends DomainResource & WithKey, ResourceDraftT extends Draft & WithKey, - PagedQueryT extends PagedQueryResourceRequest, + PagedQueryT extends + PagedQueryResourceRequest, PagedQueryResponseT extends ResourcePagedQueryResponse, GetOneResourceQueryT extends ApiMethod, QueryResultT, + QueryBuilderDslT, PostRequestT extends BodyApiMethod> extends BaseService< SyncOptionsT, @@ -32,6 +34,7 @@ abstract class BaseServiceWithKey< PagedQueryResponseT, GetOneResourceQueryT, QueryResultT, + QueryBuilderDslT, PostRequestT> { BaseServiceWithKey(@Nonnull final SyncOptionsT syncOptions) { diff --git a/src/main/java/com/commercetools/sync/services/impl/CartDiscountServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/CartDiscountServiceImpl.java index 7938dd64e8..6ee899c087 100644 --- a/src/main/java/com/commercetools/sync/services/impl/CartDiscountServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/CartDiscountServiceImpl.java @@ -10,6 +10,7 @@ import com.commercetools.api.models.cart_discount.CartDiscountPagedQueryResponse; import com.commercetools.api.models.cart_discount.CartDiscountUpdateAction; import com.commercetools.api.models.cart_discount.CartDiscountUpdateBuilder; +import com.commercetools.api.predicates.query.cart_discount.CartDiscountQueryBuilderDsl; import com.commercetools.sync.cartdiscounts.CartDiscountSyncOptions; import com.commercetools.sync.services.CartDiscountService; import io.vrap.rmf.base.client.ApiHttpResponse; @@ -31,6 +32,7 @@ public class CartDiscountServiceImpl CartDiscountPagedQueryResponse, ByProjectKeyCartDiscountsKeyByKeyGet, CartDiscount, + CartDiscountQueryBuilderDsl, ByProjectKeyCartDiscountsPost> implements CartDiscountService { diff --git a/src/main/java/com/commercetools/sync/services/impl/CategoryServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/CategoryServiceImpl.java index 3aec178eb3..e1c38ad064 100644 --- a/src/main/java/com/commercetools/sync/services/impl/CategoryServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/CategoryServiceImpl.java @@ -10,6 +10,7 @@ import com.commercetools.api.models.category.CategoryPagedQueryResponse; import com.commercetools.api.models.category.CategoryUpdateAction; import com.commercetools.api.models.category.CategoryUpdateBuilder; +import com.commercetools.api.predicates.query.category.CategoryQueryBuilderDsl; import com.commercetools.sync.categories.CategorySyncOptions; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.CategoryService; @@ -35,6 +36,7 @@ public final class CategoryServiceImpl CategoryPagedQueryResponse, ByProjectKeyCategoriesKeyByKeyGet, Category, + CategoryQueryBuilderDsl, ByProjectKeyCategoriesPost> implements CategoryService { diff --git a/src/main/java/com/commercetools/sync/services/impl/ChannelServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/ChannelServiceImpl.java index f9ca40dec8..39f77c0f1a 100644 --- a/src/main/java/com/commercetools/sync/services/impl/ChannelServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/ChannelServiceImpl.java @@ -8,6 +8,7 @@ import com.commercetools.api.models.channel.ChannelDraftBuilder; import com.commercetools.api.models.channel.ChannelPagedQueryResponse; import com.commercetools.api.models.channel.ChannelRoleEnum; +import com.commercetools.api.predicates.query.channel.ChannelQueryBuilderDsl; import com.commercetools.sync.commons.BaseSyncOptions; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.ChannelService; @@ -28,6 +29,7 @@ public final class ChannelServiceImpl ChannelPagedQueryResponse, ByProjectKeyChannelsByIDGet, Channel, + ChannelQueryBuilderDsl, ByProjectKeyChannelsPost> implements ChannelService { diff --git a/src/main/java/com/commercetools/sync/services/impl/CustomObjectServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/CustomObjectServiceImpl.java index f1ef029d57..4d3f81920a 100644 --- a/src/main/java/com/commercetools/sync/services/impl/CustomObjectServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/CustomObjectServiceImpl.java @@ -6,6 +6,7 @@ import com.commercetools.api.models.custom_object.CustomObject; import com.commercetools.api.models.custom_object.CustomObjectDraft; import com.commercetools.api.models.custom_object.CustomObjectPagedQueryResponse; +import com.commercetools.api.predicates.query.custom_object.CustomObjectQueryBuilderDsl; import com.commercetools.sync.customobjects.CustomObjectSync; import com.commercetools.sync.customobjects.CustomObjectSyncOptions; import com.commercetools.sync.customobjects.helpers.CustomObjectCompositeIdentifier; @@ -17,7 +18,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import javax.annotation.Nonnull; -import org.jetbrains.annotations.NotNull; /** Implementation of CustomObjectService interface. */ public class CustomObjectServiceImpl @@ -29,6 +29,7 @@ public class CustomObjectServiceImpl CustomObjectPagedQueryResponse, ByProjectKeyCustomObjectsByContainerByKeyGet, CustomObject, + CustomObjectQueryBuilderDsl, ByProjectKeyCustomObjectsPost> implements CustomObjectService { @@ -36,10 +37,10 @@ public CustomObjectServiceImpl(@Nonnull final CustomObjectSyncOptions syncOption super(syncOptions); } - @NotNull + @Nonnull @Override public CompletionStage> cacheKeysToIds( - @NotNull final Set identifiers) { + @Nonnull final Set identifiers) { /* * one example representation of the cache: * @@ -57,26 +58,26 @@ public CompletionStage> cacheKeysToIds( }); } - @NotNull + @Nonnull @Override public CompletionStage> fetchCachedCustomObjectId( - @NotNull final CustomObjectCompositeIdentifier identifier) { + @Nonnull final CustomObjectCompositeIdentifier identifier) { return super.fetchCachedResourceId( identifier.toString(), this::keyMapper, queryOneIdentifier(identifier)); } - @NotNull + @Nonnull @Override public CompletionStage> fetchMatchingCustomObjects( - @NotNull final Set identifiers) { + @Nonnull final Set identifiers) { return super.fetchMatchingResources( getKeys(identifiers), this::keyMapper, (keysNotCached) -> createQuery(identifiers)); } - @NotNull + @Nonnull @Override public CompletionStage> fetchCustomObject( - @NotNull final CustomObjectCompositeIdentifier identifier) { + @Nonnull final CustomObjectCompositeIdentifier identifier) { final ByProjectKeyCustomObjectsByContainerByKeyGet query = this.syncOptions .getCtpClient() @@ -87,10 +88,10 @@ public CompletionStage> fetchCustomObject( return super.fetchResource(identifier.toString(), query); } - @NotNull + @Nonnull @Override public CompletionStage> upsertCustomObject( - @NotNull final CustomObjectDraft customObjectDraft) { + @Nonnull final CustomObjectDraft customObjectDraft) { return super.createResource( customObjectDraft, this::keyMapper, @@ -121,11 +122,11 @@ public CompletionStage> upsertCustomObject( @Nonnull @Override CompletionStage> executeCreateCommand( - @NotNull CustomObjectDraft draft, - @NotNull String key, - @NotNull Function idMapper, - @NotNull Function resourceMapper, - @NotNull ByProjectKeyCustomObjectsPost createCommand) { + @Nonnull CustomObjectDraft draft, + @Nonnull String key, + @Nonnull Function idMapper, + @Nonnull Function resourceMapper, + @Nonnull ByProjectKeyCustomObjectsPost createCommand) { return createCommand .execute() .thenApply( diff --git a/src/main/java/com/commercetools/sync/services/impl/CustomerGroupServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/CustomerGroupServiceImpl.java index c8b60fed3d..5b7a093465 100644 --- a/src/main/java/com/commercetools/sync/services/impl/CustomerGroupServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/CustomerGroupServiceImpl.java @@ -6,6 +6,7 @@ import com.commercetools.api.models.customer_group.CustomerGroup; import com.commercetools.api.models.customer_group.CustomerGroupDraft; import com.commercetools.api.models.customer_group.CustomerGroupPagedQueryResponse; +import com.commercetools.api.predicates.query.customer_group.CustomerGroupQueryBuilderDsl; import com.commercetools.sync.commons.BaseSyncOptions; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.CustomerGroupService; @@ -27,6 +28,7 @@ public final class CustomerGroupServiceImpl CustomerGroupPagedQueryResponse, ByProjectKeyCustomerGroupsKeyByKeyGet, CustomerGroup, + CustomerGroupQueryBuilderDsl, ByProjectKeyCustomerGroupsPost> implements CustomerGroupService { diff --git a/src/main/java/com/commercetools/sync/services/impl/CustomerServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/CustomerServiceImpl.java index 4b2ca2ad33..adeeccc3af 100644 --- a/src/main/java/com/commercetools/sync/services/impl/CustomerServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/CustomerServiceImpl.java @@ -12,6 +12,7 @@ import com.commercetools.api.models.customer.CustomerSignInResult; import com.commercetools.api.models.customer.CustomerUpdateAction; import com.commercetools.api.models.customer.CustomerUpdateBuilder; +import com.commercetools.api.predicates.query.customer.CustomerQueryBuilderDsl; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.customers.CustomerSyncOptions; import com.commercetools.sync.services.CustomerService; @@ -34,6 +35,7 @@ public final class CustomerServiceImpl CustomerPagedQueryResponse, ByProjectKeyCustomersKeyByKeyGet, CustomerSignInResult, + CustomerQueryBuilderDsl, ByProjectKeyCustomersPost> implements CustomerService { diff --git a/src/main/java/com/commercetools/sync/services/impl/InventoryServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/InventoryServiceImpl.java index 85bce0e7db..68d51fad57 100644 --- a/src/main/java/com/commercetools/sync/services/impl/InventoryServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/InventoryServiceImpl.java @@ -6,6 +6,7 @@ import com.commercetools.api.client.*; import com.commercetools.api.models.inventory.*; +import com.commercetools.api.predicates.query.inventory.InventoryEntryQueryBuilderDsl; import com.commercetools.sync.commons.utils.ChunkUtils; import com.commercetools.sync.inventories.InventorySyncOptions; import com.commercetools.sync.inventories.helpers.InventoryEntryIdentifier; @@ -28,6 +29,7 @@ public final class InventoryServiceImpl InventoryPagedQueryResponse, ByProjectKeyInventoryByIDGet, InventoryEntry, + InventoryEntryQueryBuilderDsl, ByProjectKeyInventoryPost> implements InventoryService { diff --git a/src/main/java/com/commercetools/sync/services/impl/ProductServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/ProductServiceImpl.java index 50c3a985ec..1d874035b7 100644 --- a/src/main/java/com/commercetools/sync/services/impl/ProductServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/ProductServiceImpl.java @@ -13,6 +13,7 @@ import com.commercetools.api.models.product.ProductProjectionType; import com.commercetools.api.models.product.ProductUpdateAction; import com.commercetools.api.models.product.ProductUpdateBuilder; +import com.commercetools.api.predicates.query.product.ProductProjectionQueryBuilderDsl; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.products.ProductSyncOptions; import com.commercetools.sync.services.ProductService; @@ -35,6 +36,7 @@ public final class ProductServiceImpl ProductProjectionPagedQueryResponse, ByProjectKeyProductProjectionsKeyByKeyGet, Product, + ProductProjectionQueryBuilderDsl, ByProjectKeyProductsPost> implements ProductService { diff --git a/src/main/java/com/commercetools/sync/services/impl/ProductTypeServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/ProductTypeServiceImpl.java index 7207d89f49..9db9d0297d 100644 --- a/src/main/java/com/commercetools/sync/services/impl/ProductTypeServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/ProductTypeServiceImpl.java @@ -11,6 +11,7 @@ import com.commercetools.api.models.product_type.ProductTypePagedQueryResponse; import com.commercetools.api.models.product_type.ProductTypeUpdateAction; import com.commercetools.api.models.product_type.ProductTypeUpdateBuilder; +import com.commercetools.api.predicates.query.product_type.ProductTypeQueryBuilderDsl; import com.commercetools.sync.commons.BaseSyncOptions; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.products.AttributeMetaData; @@ -35,6 +36,7 @@ public final class ProductTypeServiceImpl ProductTypePagedQueryResponse, ByProjectKeyProductTypesKeyByKeyGet, ProductType, + ProductTypeQueryBuilderDsl, ByProjectKeyProductTypesPost> implements ProductTypeService { diff --git a/src/main/java/com/commercetools/sync/services/impl/ShoppingListServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/ShoppingListServiceImpl.java index 3ac6034fcb..cb1860ab16 100644 --- a/src/main/java/com/commercetools/sync/services/impl/ShoppingListServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/ShoppingListServiceImpl.java @@ -10,6 +10,7 @@ import com.commercetools.api.models.shopping_list.ShoppingListPagedQueryResponse; import com.commercetools.api.models.shopping_list.ShoppingListUpdateAction; import com.commercetools.api.models.shopping_list.ShoppingListUpdateBuilder; +import com.commercetools.api.predicates.query.shopping_list.ShoppingListQueryBuilderDsl; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.ShoppingListService; import com.commercetools.sync.shoppinglists.ShoppingListSyncOptions; @@ -34,6 +35,7 @@ public final class ShoppingListServiceImpl ShoppingListPagedQueryResponse, ByProjectKeyShoppingListsKeyByKeyGet, ShoppingList, + ShoppingListQueryBuilderDsl, ByProjectKeyShoppingListsPost> implements ShoppingListService { diff --git a/src/main/java/com/commercetools/sync/services/impl/StateServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/StateServiceImpl.java index 9d4f37072a..1dad3e2e3a 100644 --- a/src/main/java/com/commercetools/sync/services/impl/StateServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/StateServiceImpl.java @@ -10,6 +10,7 @@ import com.commercetools.api.models.state.StatePagedQueryResponse; import com.commercetools.api.models.state.StateUpdateAction; import com.commercetools.api.models.state.StateUpdateBuilder; +import com.commercetools.api.predicates.query.state.StateQueryBuilderDsl; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.StateService; import com.commercetools.sync.states.StateSyncOptions; @@ -34,6 +35,7 @@ public final class StateServiceImpl StatePagedQueryResponse, ByProjectKeyStatesKeyByKeyGet, State, + StateQueryBuilderDsl, ByProjectKeyStatesPost> implements StateService { diff --git a/src/main/java/com/commercetools/sync/services/impl/TaxCategoryServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/TaxCategoryServiceImpl.java index aaeb0f431d..7af2bce59e 100644 --- a/src/main/java/com/commercetools/sync/services/impl/TaxCategoryServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/TaxCategoryServiceImpl.java @@ -10,6 +10,7 @@ import com.commercetools.api.models.tax_category.TaxCategoryPagedQueryResponse; import com.commercetools.api.models.tax_category.TaxCategoryUpdateAction; import com.commercetools.api.models.tax_category.TaxCategoryUpdateBuilder; +import com.commercetools.api.predicates.query.tax_category.TaxCategoryQueryBuilderDsl; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.TaxCategoryService; import com.commercetools.sync.taxcategories.TaxCategorySyncOptions; @@ -34,6 +35,7 @@ public final class TaxCategoryServiceImpl TaxCategoryPagedQueryResponse, ByProjectKeyTaxCategoriesKeyByKeyGet, TaxCategory, + TaxCategoryQueryBuilderDsl, ByProjectKeyTaxCategoriesPost> implements TaxCategoryService { diff --git a/src/main/java/com/commercetools/sync/services/impl/TypeServiceImpl.java b/src/main/java/com/commercetools/sync/services/impl/TypeServiceImpl.java index ae9ddd0511..a9f73441e6 100644 --- a/src/main/java/com/commercetools/sync/services/impl/TypeServiceImpl.java +++ b/src/main/java/com/commercetools/sync/services/impl/TypeServiceImpl.java @@ -10,6 +10,7 @@ import com.commercetools.api.models.type.TypePagedQueryResponse; import com.commercetools.api.models.type.TypeUpdateAction; import com.commercetools.api.models.type.TypeUpdateBuilder; +import com.commercetools.api.predicates.query.type.TypeQueryBuilderDsl; import com.commercetools.sync.commons.BaseSyncOptions; import com.commercetools.sync.commons.models.GraphQlQueryResource; import com.commercetools.sync.services.TypeService; @@ -30,6 +31,7 @@ public final class TypeServiceImpl TypePagedQueryResponse, ByProjectKeyTypesKeyByKeyGet, Type, + TypeQueryBuilderDsl, ByProjectKeyTypesPost> implements TypeService {