Class SKUServiceImpl

  • All Implemented Interfaces:
    SKUService

    @Service
    public class SKUServiceImpl
    extends java.lang.Object
    implements SKUService
    • Constructor Summary

      Constructors 
      Constructor Description
      SKUServiceImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRelations​(SKU skuUI)
      This method creates all relationships between database entities.
      SKU addSKUToProduct​(java.lang.String productId, java.util.LinkedHashMap<java.lang.String,​java.lang.Object> skuAsMap)
      This method does a relationship between entities.
      java.util.Optional<SKU> createSKU​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> skuAsMap)
      This method creates a database entity.
      java.util.List<SKU> findSKUs()
      This method returns database entities as list.
      java.util.List<Category> getCategoriesBySkuId​(java.lang.String skuId)
      This method retrieves a map, which can be processed in a templates.
      SKURepository getRepository()  
      java.util.List<java.util.Map<java.lang.String,​java.lang.String>> getSortedProductSkus​(java.lang.String productId)
      This method sorted and retrieves a map, which can be processed in a templates.
      boolean isSKUExists​(java.lang.String name)
      This method checks is exists database entity.
      void prepareRelations​(SKU skuUI)
      This method does preparations of relationships between database entities.
      void removeRelations​(SKU skuUI, SKU skuDB)
      This method removes all relationships between database entities.
      void removeSKUAndClean​(java.lang.String skuId)
      This method removes a database entity and clean all relationships from another entities.
      void removeSKUFromAttribute​(java.lang.String skuId, java.lang.String attributeId)
      This method removes relationship between database entities.
      void removeSKUFromAttributes​(java.lang.String skuId)
      This method removes relationship between database entities.
      void removeSKUFromProduct​(java.lang.String skuId, java.lang.String productId)
      This method removes relationship between database entities.
      void removeSKUFromProducts​(java.lang.String skuId)
      This method removes relationship between database entities.
      void removeSKUFromSellerSKU​(java.lang.String skuId, java.lang.String sellerSkuId)
      This method removes relationship between database entities.
      void removeSKUFromSellerSKUs​(java.lang.String skuId)
      This method removes relationship between database entities.
      void removeSKUFromTranslation​(java.lang.String skuId, java.lang.String translationId)
      This method removes relationship between database entities.
      void removeSKUFromTranslations​(java.lang.String skuId)
      This method removes relationship between database entities.
      void removeSkusByIds​(java.util.ArrayList<java.lang.String> skusIds)
      This method removes a list of database entities.
      SKU saveSKU​(SKU sku)
      This method saves a database entity.
      SKU saveSKU​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> skuAsMap)
      This method save an updates of database entity.
      java.util.List<SKU> searchSKUs​(java.lang.String query, java.lang.String offset, java.lang.String limit)
      This method does search requests and returns data as list.
      java.util.List<SKU> searchWithProductFilter​(java.lang.String query, java.lang.String productId, java.lang.String offset, java.lang.String limit)
      This method does search requests and returns data as list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SKUServiceImpl

        public SKUServiceImpl()
    • Method Detail

      • searchSKUs

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

        public java.util.List<SKU> searchWithProductFilter​(java.lang.String query,
                                                           java.lang.String productId,
                                                           java.lang.String offset,
                                                           java.lang.String limit)
        Description copied from interface: SKUService
        This method does search requests and returns data as list.
        Specified by:
        searchWithProductFilter in interface SKUService
        Parameters:
        query - search query
        productId - field "_id" for filter and return items
        offset - offset for returned items
        limit - limit for returned items
        Returns:
        database entities as list
      • findSKUs

        public java.util.List<SKU> findSKUs()
        Description copied from interface: SKUService
        This method returns database entities as list.
        Specified by:
        findSKUs in interface SKUService
        Returns:
        database entities as list
      • getCategoriesBySkuId

        public java.util.List<Category> getCategoriesBySkuId​(java.lang.String skuId)
        Description copied from interface: SKUService
        This method retrieves a map, which can be processed in a templates.
        Specified by:
        getCategoriesBySkuId in interface SKUService
        Parameters:
        skuId - identification for database entity which will be retrieved
        Returns:
        map-representation of data
      • createSKU

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

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

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

        @Transactional
        public SKU saveSKU​(SKU sku)
        Description copied from interface: SKUService
        This method saves a database entity.
        Specified by:
        saveSKU in interface SKUService
        Parameters:
        sku - database entity
        Returns:
        saved instance of database entity
      • prepareRelations

        @Transactional
        public void prepareRelations​(SKU skuUI)
        Description copied from interface: SKUService
        This method does preparations of relationships between database entities.
        Specified by:
        prepareRelations in interface SKUService
        Parameters:
        skuUI - database entity
      • removeRelations

        @Transactional
        public void removeRelations​(SKU skuUI,
                                    SKU skuDB)
        Description copied from interface: SKUService
        This method removes all relationships between database entities.
        Specified by:
        removeRelations in interface SKUService
        Parameters:
        skuUI - source database entity
        skuDB - target database entity
      • addRelations

        @Transactional
        public void addRelations​(SKU skuUI)
        Description copied from interface: SKUService
        This method creates all relationships between database entities.
        Specified by:
        addRelations in interface SKUService
        Parameters:
        skuUI - source database entity
      • removeSKUFromAttribute

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

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

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

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

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

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

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

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

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

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

        public boolean isSKUExists​(java.lang.String name)
        Description copied from interface: SKUService
        This method checks is exists database entity.
        Specified by:
        isSKUExists in interface SKUService
        Parameters:
        name - field "name" for database entity which will be checked
        Returns:
        value as boolean
      • getSortedProductSkus

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