Search in sources :

Example 11 with ProductAttribute

use of com.salesmanager.core.model.catalog.product.attribute.ProductAttribute in project shopizer by shopizer-ecommerce.

the class CategoryFacadeImpl method categoryProductVariants.

@Override
public List<ReadableProductVariant> categoryProductVariants(Long categoryId, MerchantStore store, Language language) {
    Category category = categoryService.getById(categoryId, store.getId());
    List<ReadableProductVariant> variants = new ArrayList<ReadableProductVariant>();
    if (category == null) {
        throw new ResourceNotFoundException("Category [" + categoryId + "] not found");
    }
    try {
        List<ProductAttribute> attributes = productAttributeService.getProductAttributesByCategoryLineage(store, category.getLineage(), language);
        /**
         * Option NAME OptionValueName OptionValueName
         */
        Map<String, List<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue>> rawFacet = new HashMap<String, List<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue>>();
        Map<String, ProductOption> references = new HashMap<String, ProductOption>();
        for (ProductAttribute attr : attributes) {
            references.put(attr.getProductOption().getCode(), attr.getProductOption());
            List<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue> values = rawFacet.get(attr.getProductOption().getCode());
            if (values == null) {
                values = new ArrayList<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue>();
                rawFacet.put(attr.getProductOption().getCode(), values);
            }
            if (attr.getProductOptionValue() != null) {
                Optional<ProductOptionValueDescription> desc = attr.getProductOptionValue().getDescriptions().stream().filter(o -> o.getLanguage().getId() == language.getId()).findFirst();
                com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue val = new com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue();
                val.setCode(attr.getProductOption().getCode());
                String order = attr.getAttributeSortOrder();
                val.setSortOrder(order == null ? attr.getId().intValue() : Integer.parseInt(attr.getAttributeSortOrder()));
                if (desc.isPresent()) {
                    val.setName(desc.get().getName());
                } else {
                    val.setName(attr.getProductOption().getCode());
                }
                values.add(val);
            }
        }
        // for each reference set Option
        Iterator<Entry<String, ProductOption>> it = references.entrySet().iterator();
        while (it.hasNext()) {
            @SuppressWarnings("rawtypes") Map.Entry pair = (Map.Entry) it.next();
            ProductOption option = (ProductOption) pair.getValue();
            List<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue> values = rawFacet.get(option.getCode());
            ReadableProductVariant productVariant = new ReadableProductVariant();
            Optional<ProductOptionDescription> optionDescription = option.getDescriptions().stream().filter(o -> o.getLanguage().getId() == language.getId()).findFirst();
            if (optionDescription.isPresent()) {
                productVariant.setName(optionDescription.get().getName());
                productVariant.setId(optionDescription.get().getId());
                productVariant.setCode(optionDescription.get().getProductOption().getCode());
                List<ReadableProductVariantValue> optionValues = new ArrayList<ReadableProductVariantValue>();
                for (com.salesmanager.shop.model.catalog.product.attribute.ProductOptionValue value : values) {
                    ReadableProductVariantValue v = new ReadableProductVariantValue();
                    v.setCode(value.getCode());
                    v.setName(value.getName());
                    v.setDescription(value.getName());
                    v.setOption(option.getId());
                    v.setValue(value.getId());
                    v.setOrder(option.getProductOptionSortOrder());
                    optionValues.add(v);
                }
                Comparator<ReadableProductVariantValue> orderComparator = Comparator.comparingInt(ReadableProductVariantValue::getOrder);
                // Arrays.sort(employees, employeeSalaryComparator);
                List<ReadableProductVariantValue> readableValues = optionValues.stream().sorted(orderComparator).collect(Collectors.toList());
                // sort by name
                // remove duplicates
                readableValues = optionValues.stream().distinct().collect(Collectors.toList());
                readableValues.sort(Comparator.comparing(ReadableProductVariantValue::getName));
                productVariant.setOptions(readableValues);
                variants.add(productVariant);
            }
        }
        return variants;
    } catch (Exception e) {
        throw new ServiceRuntimeException("An error occured while retrieving ProductAttributes", e);
    }
}
Also used : CategoryFacade(com.salesmanager.shop.store.controller.category.facade.CategoryFacade) PersistableCategoryPopulator(com.salesmanager.shop.populator.catalog.PersistableCategoryPopulator) HashMap(java.util.HashMap) ReadableProductVariantValue(com.salesmanager.shop.model.catalog.product.attribute.ReadableProductVariantValue) Function(java.util.function.Function) ArrayList(java.util.ArrayList) ServiceException(com.salesmanager.core.business.exception.ServiceException) Inject(javax.inject.Inject) ProductOptionValueDescription(com.salesmanager.core.model.catalog.product.attribute.ProductOptionValueDescription) Language(com.salesmanager.core.model.reference.language.Language) ListCriteria(com.salesmanager.shop.model.entity.ListCriteria) MerchantStore(com.salesmanager.core.model.merchant.MerchantStore) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) Service(org.springframework.stereotype.Service) Map(java.util.Map) ProductOption(com.salesmanager.core.model.catalog.product.attribute.ProductOption) ReadableProductVariant(com.salesmanager.shop.model.catalog.product.attribute.ReadableProductVariant) ReadableCategoryPopulator(com.salesmanager.shop.populator.catalog.ReadableCategoryPopulator) CategoryService(com.salesmanager.core.business.services.catalog.category.CategoryService) MerchantStoreService(com.salesmanager.core.business.services.merchant.MerchantStoreService) ProductAttributeService(com.salesmanager.core.business.services.catalog.product.attribute.ProductAttributeService) OperationNotAllowedException(com.salesmanager.shop.store.api.exception.OperationNotAllowedException) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) Mapper(com.salesmanager.shop.mapper.Mapper) Iterator(java.util.Iterator) ProductOptionDescription(com.salesmanager.core.model.catalog.product.attribute.ProductOptionDescription) Collectors(java.util.stream.Collectors) ReadableCategoryList(com.salesmanager.shop.model.catalog.category.ReadableCategoryList) UnauthorizedException(com.salesmanager.shop.store.api.exception.UnauthorizedException) Objects(java.util.Objects) Category(com.salesmanager.core.model.catalog.category.Category) List(java.util.List) Validate(org.apache.commons.lang3.Validate) CollectionUtils(org.springframework.util.CollectionUtils) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) ReadableCategory(com.salesmanager.shop.model.catalog.category.ReadableCategory) Entry(java.util.Map.Entry) Optional(java.util.Optional) ConversionException(com.salesmanager.core.business.exception.ConversionException) Comparator(java.util.Comparator) PersistableCategory(com.salesmanager.shop.model.catalog.category.PersistableCategory) Entry(java.util.Map.Entry) Category(com.salesmanager.core.model.catalog.category.Category) ReadableCategory(com.salesmanager.shop.model.catalog.category.ReadableCategory) PersistableCategory(com.salesmanager.shop.model.catalog.category.PersistableCategory) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) ProductOptionDescription(com.salesmanager.core.model.catalog.product.attribute.ProductOptionDescription) Entry(java.util.Map.Entry) ArrayList(java.util.ArrayList) ReadableCategoryList(com.salesmanager.shop.model.catalog.category.ReadableCategoryList) List(java.util.List) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) ProductOption(com.salesmanager.core.model.catalog.product.attribute.ProductOption) ReadableProductVariant(com.salesmanager.shop.model.catalog.product.attribute.ReadableProductVariant) ServiceException(com.salesmanager.core.business.exception.ServiceException) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) OperationNotAllowedException(com.salesmanager.shop.store.api.exception.OperationNotAllowedException) UnauthorizedException(com.salesmanager.shop.store.api.exception.UnauthorizedException) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) ConversionException(com.salesmanager.core.business.exception.ConversionException) HashMap(java.util.HashMap) Map(java.util.Map) ProductOptionValueDescription(com.salesmanager.core.model.catalog.product.attribute.ProductOptionValueDescription) ReadableProductVariantValue(com.salesmanager.shop.model.catalog.product.attribute.ReadableProductVariantValue)

Example 12 with ProductAttribute

use of com.salesmanager.core.model.catalog.product.attribute.ProductAttribute in project shopizer by shopizer-ecommerce.

the class ShoppingCartFacadeImpl method createCartItem.

// used for api
private com.salesmanager.core.model.shoppingcart.ShoppingCartItem createCartItem(ShoppingCart cartModel, PersistableShoppingCartItem shoppingCartItem, MerchantStore store) throws Exception {
    Product product = productService.getById(shoppingCartItem.getProduct());
    if (product == null) {
        throw new ResourceNotFoundException("Item with id " + shoppingCartItem.getProduct() + " does not exist");
    }
    if (product.getMerchantStore().getId().intValue() != store.getId().intValue()) {
        throw new ResourceNotFoundException("Item with id " + shoppingCartItem.getProduct() + " does not belong to merchant " + store.getId());
    }
    /**
     * Check if product quantity is 0
     * Check if product is available
     * Check if date available <= now
     */
    Set<ProductAvailability> availabilities = product.getAvailabilities();
    if (availabilities == null) {
        throw new Exception("Item with id " + product.getId() + " is not properly configured");
    }
    for (ProductAvailability availability : availabilities) {
        if (availability.getProductQuantity() == null || availability.getProductQuantity().intValue() == 0) {
            throw new Exception("Item with id " + product.getId() + " is not available");
        }
    }
    if (!product.isAvailable()) {
        throw new Exception("Item with id " + product.getId() + " is not available");
    }
    if (!DateUtil.dateBeforeEqualsDate(product.getDateAvailable(), new Date())) {
        throw new Exception("Item with id " + product.getId() + " is not available");
    }
    com.salesmanager.core.model.shoppingcart.ShoppingCartItem item = shoppingCartService.populateShoppingCartItem(product);
    item.setQuantity(shoppingCartItem.getQuantity());
    item.setShoppingCart(cartModel);
    // set attributes
    List<com.salesmanager.shop.model.catalog.product.attribute.ProductAttribute> attributes = shoppingCartItem.getAttributes();
    if (!CollectionUtils.isEmpty(attributes)) {
        for (com.salesmanager.shop.model.catalog.product.attribute.ProductAttribute attribute : attributes) {
            ProductAttribute productAttribute = productAttributeService.getById(attribute.getId());
            if (productAttribute != null && productAttribute.getProduct().getId().longValue() == product.getId().longValue()) {
                com.salesmanager.core.model.shoppingcart.ShoppingCartAttributeItem attributeItem = new com.salesmanager.core.model.shoppingcart.ShoppingCartAttributeItem(item, productAttribute);
                item.addAttributes(attributeItem);
            }
        }
    }
    return item;
}
Also used : Product(com.salesmanager.core.model.catalog.product.Product) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) NoResultException(javax.persistence.NoResultException) ServiceException(com.salesmanager.core.business.exception.ServiceException) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) CartModificationException(com.salesmanager.shop.model.shoppingcart.CartModificationException) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) Date(java.util.Date) LocalDate(java.time.LocalDate) ProductAvailability(com.salesmanager.core.model.catalog.product.availability.ProductAvailability) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException)

Example 13 with ProductAttribute

use of com.salesmanager.core.model.catalog.product.attribute.ProductAttribute in project shopizer by shopizer-ecommerce.

the class ShoppingCartFacadeImpl method updateCartItems.

// TODO promoCode request parameter
@Override
public ShoppingCartData updateCartItems(Optional<String> promoCode, final List<ShoppingCartItem> shoppingCartItems, final MerchantStore store, final Language language) throws Exception {
    Validate.notEmpty(shoppingCartItems, "shoppingCartItems null or empty");
    ShoppingCart cartModel = null;
    Set<com.salesmanager.core.model.shoppingcart.ShoppingCartItem> cartItems = new HashSet<com.salesmanager.core.model.shoppingcart.ShoppingCartItem>();
    for (ShoppingCartItem item : shoppingCartItems) {
        if (item.getQuantity() < 1) {
            throw new CartModificationException("Quantity must not be less than one");
        }
        if (cartModel == null) {
            cartModel = getCartModel(item.getCode(), store);
        }
        com.salesmanager.core.model.shoppingcart.ShoppingCartItem entryToUpdate = getEntryToUpdate(item.getId(), cartModel);
        if (entryToUpdate == null) {
            throw new CartModificationException("Unknown entry number.");
        }
        entryToUpdate.getProduct();
        LOG.info("Updating cart entry quantity to" + item.getQuantity());
        entryToUpdate.setQuantity((int) item.getQuantity());
        List<ProductAttribute> productAttributes = new ArrayList<ProductAttribute>();
        productAttributes.addAll(entryToUpdate.getProduct().getAttributes());
        final FinalPrice finalPrice = productPriceUtils.getFinalProductPrice(entryToUpdate.getProduct(), productAttributes);
        entryToUpdate.setItemPrice(finalPrice.getFinalPrice());
        cartItems.add(entryToUpdate);
    }
    cartModel.setPromoCode(null);
    if (promoCode.isPresent()) {
        cartModel.setPromoCode(promoCode.get());
        cartModel.setPromoAdded(new Date());
    }
    cartModel.setLineItems(cartItems);
    shoppingCartService.saveOrUpdate(cartModel);
    LOG.info("Cart entry updated with desired quantity");
    ShoppingCartDataPopulator shoppingCartDataPopulator = new ShoppingCartDataPopulator();
    shoppingCartDataPopulator.setShoppingCartCalculationService(shoppingCartCalculationService);
    shoppingCartDataPopulator.setPricingService(pricingService);
    shoppingCartDataPopulator.setimageUtils(imageUtils);
    return shoppingCartDataPopulator.populate(cartModel, store, language);
}
Also used : CartModificationException(com.salesmanager.shop.model.shoppingcart.CartModificationException) ShoppingCartDataPopulator(com.salesmanager.shop.populator.shoppingCart.ShoppingCartDataPopulator) ArrayList(java.util.ArrayList) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) Date(java.util.Date) LocalDate(java.time.LocalDate) ShoppingCart(com.salesmanager.core.model.shoppingcart.ShoppingCart) ReadableShoppingCart(com.salesmanager.shop.model.shoppingcart.ReadableShoppingCart) PersistableShoppingCartItem(com.salesmanager.shop.model.shoppingcart.PersistableShoppingCartItem) ShoppingCartItem(com.salesmanager.shop.model.shoppingcart.ShoppingCartItem) HashSet(java.util.HashSet) FinalPrice(com.salesmanager.core.model.catalog.product.price.FinalPrice)

Example 14 with ProductAttribute

use of com.salesmanager.core.model.catalog.product.attribute.ProductAttribute in project shopizer by shopizer-ecommerce.

the class ShoppingCartFacadeImpl method createCartItem.

private com.salesmanager.core.model.shoppingcart.ShoppingCartItem createCartItem(final ShoppingCart cartModel, final ShoppingCartItem shoppingCartItem, final MerchantStore store) throws Exception {
    Product product = productService.getById(shoppingCartItem.getProductId());
    if (product == null) {
        throw new Exception("Item with id " + shoppingCartItem.getProductId() + " does not exist");
    }
    if (product.getMerchantStore().getId().intValue() != store.getId().intValue()) {
        throw new Exception("Item with id " + shoppingCartItem.getProductId() + " does not belong to merchant " + store.getId());
    }
    /**
     * Check if product quantity is 0
     * Check if product is available
     * Check if date available <= now
     */
    Set<ProductAvailability> availabilities = product.getAvailabilities();
    if (availabilities == null) {
        throw new Exception("Item with id " + product.getId() + " is not properly configured");
    }
    for (ProductAvailability availability : availabilities) {
        if (availability.getProductQuantity() == null || availability.getProductQuantity().intValue() == 0) {
            throw new Exception("Item with id " + product.getId() + " is not available");
        }
    }
    if (!product.isAvailable()) {
        throw new Exception("Item with id " + product.getId() + " is not available");
    }
    if (!DateUtil.dateBeforeEqualsDate(product.getDateAvailable(), new Date())) {
        throw new Exception("Item with id " + product.getId() + " is not available");
    }
    com.salesmanager.core.model.shoppingcart.ShoppingCartItem item = shoppingCartService.populateShoppingCartItem(product);
    item.setQuantity(shoppingCartItem.getQuantity());
    item.setShoppingCart(cartModel);
    // attributes
    List<ShoppingCartAttribute> cartAttributes = shoppingCartItem.getShoppingCartAttributes();
    if (!CollectionUtils.isEmpty(cartAttributes)) {
        for (ShoppingCartAttribute attribute : cartAttributes) {
            ProductAttribute productAttribute = productAttributeService.getById(attribute.getAttributeId());
            if (productAttribute != null && productAttribute.getProduct().getId().longValue() == product.getId().longValue()) {
                com.salesmanager.core.model.shoppingcart.ShoppingCartAttributeItem attributeItem = new com.salesmanager.core.model.shoppingcart.ShoppingCartAttributeItem(item, productAttribute);
                item.addAttributes(attributeItem);
            }
        }
    }
    return item;
}
Also used : Product(com.salesmanager.core.model.catalog.product.Product) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) NoResultException(javax.persistence.NoResultException) ServiceException(com.salesmanager.core.business.exception.ServiceException) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) CartModificationException(com.salesmanager.shop.model.shoppingcart.CartModificationException) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) Date(java.util.Date) LocalDate(java.time.LocalDate) ShoppingCartAttribute(com.salesmanager.shop.model.shoppingcart.ShoppingCartAttribute) ProductAvailability(com.salesmanager.core.model.catalog.product.availability.ProductAvailability)

Example 15 with ProductAttribute

use of com.salesmanager.core.model.catalog.product.attribute.ProductAttribute in project shopizer by shopizer-ecommerce.

the class ShoppingCartFacadeImpl method createCartItems.

// used for api
private List<com.salesmanager.core.model.shoppingcart.ShoppingCartItem> createCartItems(ShoppingCart cartModel, List<PersistableShoppingCartItem> shoppingCartItems, MerchantStore store) throws Exception {
    List<Long> productIds = shoppingCartItems.stream().map(s -> Long.valueOf(s.getProduct())).collect(Collectors.toList());
    List<Product> products = productService.getProductsByIds(productIds);
    if (products == null || products.size() != shoppingCartItems.size()) {
        LOG.warn("----------------------- Items with in id-list " + productIds + " does not exist");
        throw new ResourceNotFoundException("Item with id " + productIds + " does not exist");
    }
    List<Product> wrongStoreProducts = products.stream().filter(p -> p.getMerchantStore().getId() != store.getId()).collect(Collectors.toList());
    if (wrongStoreProducts.size() > 0) {
        throw new ResourceNotFoundException("One or more of the items with id's " + wrongStoreProducts.stream().map(s -> Long.valueOf(s.getId())).collect(Collectors.toList()) + " does not belong to merchant " + store.getId());
    }
    List<com.salesmanager.core.model.shoppingcart.ShoppingCartItem> items = new ArrayList<>();
    for (Product p : products) {
        com.salesmanager.core.model.shoppingcart.ShoppingCartItem item = shoppingCartService.populateShoppingCartItem(p);
        Optional<PersistableShoppingCartItem> oShoppingCartItem = shoppingCartItems.stream().filter(i -> i.getProduct() == p.getId()).findFirst();
        if (!oShoppingCartItem.isPresent()) {
            // Should never happen if not something is updated in realtime or user has item in local storage and add it long time after to cart!
            LOG.warn("Missing shoppingCartItem for product " + p.getSku() + " ( " + p.getId() + " )");
            continue;
        }
        PersistableShoppingCartItem shoppingCartItem = oShoppingCartItem.get();
        item.setQuantity(shoppingCartItem.getQuantity());
        item.setShoppingCart(cartModel);
        /**
         * Check if product is available
         * Check if product quantity is 0
         * Check if date available <= now
         */
        if (!p.isAvailable()) {
            throw new Exception("Item with id " + p.getId() + " is not available");
        }
        Set<ProductAvailability> availabilities = p.getAvailabilities();
        if (availabilities == null) {
            throw new Exception("Item with id " + p.getId() + " is not properly configured");
        }
        for (ProductAvailability availability : availabilities) {
            if (availability.getProductQuantity() == null || availability.getProductQuantity().intValue() == 0) {
                throw new Exception("Item with id " + p.getId() + " is not available");
            }
        }
        if (!DateUtil.dateBeforeEqualsDate(p.getDateAvailable(), new Date())) {
            throw new Exception("Item with id " + p.getId() + " is not available");
        }
        // end qty & availablility checks
        // set attributes
        List<com.salesmanager.shop.model.catalog.product.attribute.ProductAttribute> attributes = shoppingCartItem.getAttributes();
        if (!CollectionUtils.isEmpty(attributes)) {
            for (com.salesmanager.shop.model.catalog.product.attribute.ProductAttribute attribute : attributes) {
                ProductAttribute productAttribute = productAttributeService.getById(attribute.getId());
                if (productAttribute != null && productAttribute.getProduct().getId().longValue() == p.getId().longValue()) {
                    com.salesmanager.core.model.shoppingcart.ShoppingCartAttributeItem attributeItem = new com.salesmanager.core.model.shoppingcart.ShoppingCartAttributeItem(item, productAttribute);
                    item.addAttributes(attributeItem);
                }
            }
        }
        items.add(item);
    }
    return items;
}
Also used : ShoppingCart(com.salesmanager.core.model.shoppingcart.ShoppingCart) Date(java.util.Date) ZonedDateTime(java.time.ZonedDateTime) LoggerFactory(org.slf4j.LoggerFactory) NoResultException(javax.persistence.NoResultException) Autowired(org.springframework.beans.factory.annotation.Autowired) StringUtils(org.apache.commons.lang3.StringUtils) ServiceException(com.salesmanager.core.business.exception.ServiceException) RequestContextHolder(org.springframework.web.context.request.RequestContextHolder) MerchantStore(com.salesmanager.core.model.merchant.MerchantStore) FinalPrice(com.salesmanager.core.model.catalog.product.price.FinalPrice) ShoppingCartDataPopulator(com.salesmanager.shop.populator.shoppingCart.ShoppingCartDataPopulator) PricingService(com.salesmanager.core.business.services.catalog.product.PricingService) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) Set(java.util.Set) ReadableShoppingCart(com.salesmanager.shop.model.shoppingcart.ReadableShoppingCart) UUID(java.util.UUID) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) List(java.util.List) ShoppingCartCalculationService(com.salesmanager.core.business.services.shoppingcart.ShoppingCartCalculationService) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) LocalDate(java.time.LocalDate) Optional(java.util.Optional) ProductAvailability(com.salesmanager.core.model.catalog.product.availability.ProductAvailability) ProductPriceUtils(com.salesmanager.core.business.utils.ProductPriceUtils) ProductService(com.salesmanager.core.business.services.catalog.product.ProductService) Constants(com.salesmanager.shop.constants.Constants) ReadableShoppingCartMapper(com.salesmanager.shop.mapper.cart.ReadableShoppingCartMapper) DateUtil(com.salesmanager.shop.utils.DateUtil) CartModificationException(com.salesmanager.shop.model.shoppingcart.CartModificationException) CollectionUtils(org.apache.commons.collections4.CollectionUtils) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Inject(javax.inject.Inject) Language(com.salesmanager.core.model.reference.language.Language) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) Service(org.springframework.stereotype.Service) Qualifier(org.springframework.beans.factory.annotation.Qualifier) Nullable(org.springframework.lang.Nullable) ShoppingCartAttribute(com.salesmanager.shop.model.shoppingcart.ShoppingCartAttribute) ProductAttributeService(com.salesmanager.core.business.services.catalog.product.attribute.ProductAttributeService) ShoppingCartService(com.salesmanager.core.business.services.shoppingcart.ShoppingCartService) Product(com.salesmanager.core.model.catalog.product.Product) Logger(org.slf4j.Logger) Customer(com.salesmanager.core.model.customer.Customer) PersistableShoppingCartItem(com.salesmanager.shop.model.shoppingcart.PersistableShoppingCartItem) ImageFilePath(com.salesmanager.shop.utils.ImageFilePath) ServletRequestAttributes(org.springframework.web.context.request.ServletRequestAttributes) ShoppingCartData(com.salesmanager.shop.model.shoppingcart.ShoppingCartData) Validate(org.apache.commons.lang3.Validate) ShoppingCartItem(com.salesmanager.shop.model.shoppingcart.ShoppingCartItem) ArrayList(java.util.ArrayList) Product(com.salesmanager.core.model.catalog.product.Product) ProductAttribute(com.salesmanager.core.model.catalog.product.attribute.ProductAttribute) ProductAvailability(com.salesmanager.core.model.catalog.product.availability.ProductAvailability) PersistableShoppingCartItem(com.salesmanager.shop.model.shoppingcart.PersistableShoppingCartItem) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) NoResultException(javax.persistence.NoResultException) ServiceException(com.salesmanager.core.business.exception.ServiceException) ServiceRuntimeException(com.salesmanager.shop.store.api.exception.ServiceRuntimeException) CartModificationException(com.salesmanager.shop.model.shoppingcart.CartModificationException) ResourceNotFoundException(com.salesmanager.shop.store.api.exception.ResourceNotFoundException) Date(java.util.Date) LocalDate(java.time.LocalDate) PersistableShoppingCartItem(com.salesmanager.shop.model.shoppingcart.PersistableShoppingCartItem) ShoppingCartItem(com.salesmanager.shop.model.shoppingcart.ShoppingCartItem)

Aggregations

ProductAttribute (com.salesmanager.core.model.catalog.product.attribute.ProductAttribute)41 Product (com.salesmanager.core.model.catalog.product.Product)25 ArrayList (java.util.ArrayList)20 Language (com.salesmanager.core.model.reference.language.Language)18 MerchantStore (com.salesmanager.core.model.merchant.MerchantStore)16 FinalPrice (com.salesmanager.core.model.catalog.product.price.FinalPrice)15 ServiceException (com.salesmanager.core.business.exception.ServiceException)13 ProductOptionValue (com.salesmanager.core.model.catalog.product.attribute.ProductOptionValue)12 ProductAvailability (com.salesmanager.core.model.catalog.product.availability.ProductAvailability)12 BigDecimal (java.math.BigDecimal)12 HashSet (java.util.HashSet)12 ResourceNotFoundException (com.salesmanager.shop.store.api.exception.ResourceNotFoundException)11 ServiceRuntimeException (com.salesmanager.shop.store.api.exception.ServiceRuntimeException)11 List (java.util.List)11 ProductOption (com.salesmanager.core.model.catalog.product.attribute.ProductOption)10 Date (java.util.Date)10 Category (com.salesmanager.core.model.catalog.category.Category)9 ProductOptionDescription (com.salesmanager.core.model.catalog.product.attribute.ProductOptionDescription)9 ProductOptionValueDescription (com.salesmanager.core.model.catalog.product.attribute.ProductOptionValueDescription)9 ProductDescription (com.salesmanager.core.model.catalog.product.description.ProductDescription)8