Class ProductServiceImpl

    • Constructor Detail

      • ProductServiceImpl

        public ProductServiceImpl()
    • Method Detail

      • getPaginationFilter

        public java.util.Deque<java.util.Map<java.lang.String,​java.lang.Object>> getPaginationFilter​(java.lang.String requestJson)
        Description copied from interface: ProductService
        This method does calculation for a pages based on the request.
        Specified by:
        getPaginationFilter in interface ProductService
        Parameters:
        requestJson - JSON-object of request contains an instructions for search queries
        Returns:
        map-representation of data
      • searchProducts

        public java.util.LinkedHashSet<ProductDTO> searchProducts​(java.lang.String requestJson)
        Description copied from interface: ProductService
        This method does search requests and returns data as list.
        Specified by:
        searchProducts in interface ProductService
        Parameters:
        requestJson - search request
        Returns:
        data transport entities as list
      • searchProductsPaged

        public org.springframework.data.domain.Page<Product> searchProductsPaged​(java.lang.String requestJson)
        Description copied from interface: ProductService
        This method does search requests and returns data as pages.
        Specified by:
        searchProductsPaged in interface ProductService
        Parameters:
        requestJson - JSON-object of request contains an instructions for search queries
        Returns:
        database entities separated to pages
      • searchProducts

        @Deprecated
        public java.util.List<Product> searchProducts​(java.lang.String query,
                                                      java.lang.String offset,
                                                      java.lang.String limit)
        Deprecated.
        Description copied from interface: ProductService
        This method does search requests and returns data as list.
        Specified by:
        searchProducts in interface ProductService
        Parameters:
        query - search query
        offset - offset for returned items
        limit - limit for returned items
        Returns:
        database entities as list
      • createProduct

        @Transactional
        public java.util.Optional<Product> createProduct​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> productAsMap)
        Description copied from interface: ProductService
        This method creates a database entity.
        Specified by:
        createProduct in interface ProductService
        Parameters:
        productAsMap - map-representation of database entity
        Returns:
        database entity
      • createProduct

        public java.util.Optional<Product> createProduct​(Product product)
        Description copied from interface: ProductService
        This method creates a database entity.
        Specified by:
        createProduct in interface ProductService
        Parameters:
        product - database entity
        Returns:
        optional value to externally interaction
      • addProductToCategory

        @Transactional
        public Product addProductToCategory​(java.lang.String categoryId,
                                            java.util.LinkedHashMap<java.lang.String,​java.lang.Object> productAsMap)
        Description copied from interface: ProductService
        This method does a relationship between entities.
        Specified by:
        addProductToCategory in interface ProductService
        Parameters:
        categoryId - identification for database entity which will be updated
        productAsMap - map-representation of database entity
        Returns:
        database entity
      • addProductToCategory

        public Product addProductToCategory​(java.lang.String categoryId,
                                            java.lang.String productId)
        Description copied from interface: ProductService
        This method does a relationship between entities.
        Specified by:
        addProductToCategory in interface ProductService
        Parameters:
        categoryId - identification for database entity which will be updated
        productId - identification for database entity which will be updated
        Returns:
        database entity
      • saveProduct

        @Transactional
        public Product saveProduct​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> productAsMap)
        Description copied from interface: ProductService
        This method save an updates of database entity.
        Specified by:
        saveProduct in interface ProductService
        Parameters:
        productAsMap - map-representation of database entity
        Returns:
        saved instance of database entity
      • saveProduct

        @Transactional
        public Product saveProduct​(Product product)
        Description copied from interface: ProductService
        This method saves a database entity.
        Specified by:
        saveProduct in interface ProductService
        Parameters:
        product - database entity
        Returns:
        saved instance of database entity
      • prepareRelations

        private void prepareRelations​(Product productUI,
                                      Product productDB)
      • getSortedProductsByCategory

        @Transactional
        public java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getSortedProductsByCategory​(java.lang.String categoryId)
        Description copied from interface: ProductService
        This method retrieves a map, which can be processed in a templates.
        Specified by:
        getSortedProductsByCategory in interface ProductService
        Parameters:
        categoryId - identification for database entity which will be retrieved
        Returns:
        map-representation of data
      • getProductsByCategoryAndFirstLetter

        public java.util.List<java.util.Map<java.lang.String,​java.lang.Object>> getProductsByCategoryAndFirstLetter​(java.lang.String categoryId,
                                                                                                                          java.lang.String firstLetter)
        Description copied from interface: ProductService
        This method retrieves a map, which can be processed in a templates.
        Specified by:
        getProductsByCategoryAndFirstLetter in interface ProductService
        Parameters:
        categoryId - identification for database entity which will be retrieved
        firstLetter - first letter of the name for the product
        Returns:
        map-representation of data
      • removeRelations

        private void removeRelations​(Product productUI,
                                     Product productDB)
      • addRelations

        private void addRelations​(Product productUI)
      • removeProductFromCategory

        @Transactional
        public void removeProductFromCategory​(java.lang.String productId,
                                              java.lang.String categoryId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromCategory in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
        categoryId - identification for database entity which will be updated
      • removeProductFromSKU

        @Transactional
        public void removeProductFromSKU​(java.lang.String productId,
                                         java.lang.String skuId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromSKU in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
        skuId - identification for database entity which will be updated
      • removeProductFromAttribute

        @Transactional
        public void removeProductFromAttribute​(java.lang.String productId,
                                               java.lang.String attrId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromAttribute in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
        attrId - identification for database entity which will be updated
      • removeProductFromTranslation

        @Transactional
        public void removeProductFromTranslation​(java.lang.String productId,
                                                 java.lang.String tranId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromTranslation in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
        tranId - identification for database entity which will be updated
      • removeProductFromCategories

        @Transactional
        public void removeProductFromCategories​(java.lang.String productId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromCategories in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
      • removeProductFromSKUs

        @Transactional
        public void removeProductFromSKUs​(java.lang.String productId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromSKUs in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
      • removeProductFromAttributes

        @Transactional
        public void removeProductFromAttributes​(java.lang.String productId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromAttributes in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
      • removeProductFromTranslations

        @Transactional
        public void removeProductFromTranslations​(java.lang.String productId)
        Description copied from interface: ProductService
        This method removes relationship between database entities.
        Specified by:
        removeProductFromTranslations in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
      • removeProductAndClean

        @Transactional
        public void removeProductAndClean​(java.lang.String productId)
        Description copied from interface: ProductService
        This method removes a database entity and clean all relationships from another entities.
        Specified by:
        removeProductAndClean in interface ProductService
        Parameters:
        productId - identification for database entity which will be removed
      • removeProductsByIds

        @Transactional
        public void removeProductsByIds​(java.util.ArrayList<java.lang.String> productsIds)
        Description copied from interface: ProductService
        This method removes a list of database entities.
        Specified by:
        removeProductsByIds in interface ProductService
        Parameters:
        productsIds - the list of database entities which will be removed
      • getFallIntoProducts

        @Transactional
        public java.util.HashSet<EmbeddedBean> getFallIntoProducts​(java.lang.String[] productIds)
        Description copied from interface: ProductService
        This method returns data as set.
        Specified by:
        getFallIntoProducts in interface ProductService
        Parameters:
        productIds - the list of database entities which will be retrieved
        Returns:
        database entities as list
      • mapProductToDto

        public ProductDTO mapProductToDto​(Product product,
                                          boolean optimal)
        Description copied from interface: ProductService
        This method does map product entity to dto object
        Specified by:
        mapProductToDto in interface ProductService
        Parameters:
        product - database entity which be used to map to dto
        optimal - this pointer optimises the data transfer object
        Returns:
        data transport object