Class CategoryServiceImpl

    • Constructor Detail

      • CategoryServiceImpl

        public CategoryServiceImpl()
    • 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: CategoryService
        This method does calculation for a pages based on the request.
        Specified by:
        getPaginationFilter in interface CategoryService
        Parameters:
        requestJson - JSON-object of request contains an instructions for search queries
        Returns:
        map-representation of data
      • searchCategories

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

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

        public java.util.List<Category> searchCategories​(java.lang.String query,
                                                         java.lang.String from,
                                                         java.lang.String to)
        Description copied from interface: CategoryService
        This method does search requests and returns data as list.
        Specified by:
        searchCategories in interface CategoryService
        Parameters:
        query - search query
        from - field which filter and returned items
        to - field which filter and returned items
        Returns:
        database entities as list
      • createCategory

        @Transactional
        public java.util.Optional<Category> createCategory​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> categoryAsMap)
        Description copied from interface: CategoryService
        This method creates a database entity.
        Specified by:
        createCategory in interface CategoryService
        Parameters:
        categoryAsMap - map-representation of database entity
        Returns:
        optional value to externally interaction
      • createCategory

        public java.util.Optional<Category> createCategory​(Category category)
        Description copied from interface: CategoryService
        This method creates a database entity.
        Specified by:
        createCategory in interface CategoryService
        Parameters:
        category - database entity
        Returns:
        optional value to externally interaction
      • addChildCategory

        @Transactional
        public Category addChildCategory​(java.lang.String parentId,
                                         java.lang.String childId)
        Description copied from interface: CategoryService
        This method does add child entity in parent entity.
        Specified by:
        addChildCategory in interface CategoryService
        Parameters:
        parentId - identification for database entity which will be updated
        childId - identification for database entity which will be added in parent database entity
        Returns:
        database entity
      • removeChildCategory

        public void removeChildCategory​(java.lang.String parentId,
                                        java.lang.String childId)
        Description copied from interface: CategoryService
        This method does delete child entity in parent entity.
        Specified by:
        removeChildCategory in interface CategoryService
        Parameters:
        parentId - identification for database entity which will be updated
        childId - identification for database entity which will be added in parent database entity
      • updateCategory

        @Transactional
        public Category updateCategory​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> categoryAsMap)
        Description copied from interface: CategoryService
        This method updates of database entity.
        Specified by:
        updateCategory in interface CategoryService
        Parameters:
        categoryAsMap - map-representation of database entity
        Returns:
        updated instance of database entity
      • updateCategory

        @Transactional
        public Category updateCategory​(Category category)
        Description copied from interface: CategoryService
        This method updates of database entity.
        Specified by:
        updateCategory in interface CategoryService
        Parameters:
        category - database entity which will be updated
        Returns:
        updated instance of database entity
      • prepareRelations

        private void prepareRelations​(Category categoryUI,
                                      Category categoryDB)
      • removeRelations

        private void removeRelations​(Category categoryUI,
                                     Category categoryDB)
      • addRelations

        private void addRelations​(Category categoryUI)
      • removeCategoryFromTranslation

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

        @Transactional
        public void removeCategoryWithDescendants​(java.lang.String itemId)
        Description copied from interface: CategoryService
        This method removes database entity with child database entity.
        Specified by:
        removeCategoryWithDescendants in interface CategoryService
        Parameters:
        itemId - identification for child database entity which will be removed and whose parent entity will be removed
      • removeCategoriesByIds

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

        @Transactional
        public java.util.List<Category> rebuildAllCategories​(java.util.ArrayList<java.lang.Object> categories)
        Description copied from interface: CategoryService
        This method rebuilds a list of database entities.
        Specified by:
        rebuildAllCategories in interface CategoryService
        Parameters:
        categories - the list of database entities which will be removed and updated
        Returns:
        list of categories
      • mapCategoryToDto

        public CategoryDTO mapCategoryToDto​(Category category,
                                            boolean optimal)
        Description copied from interface: CategoryService
        This method does map category entity to dto object
        Specified by:
        mapCategoryToDto in interface CategoryService
        Parameters:
        category - database entity which be used to map to dto
        optimal - this pointer optimises the data transfer object
        Returns:
        data transport object
      • lookupToParents

        public java.util.List<java.lang.String> lookupToParents​(java.lang.String categoryId,
                                                                java.util.List<java.lang.String> result)
        Description copied from interface: CategoryService
        This method does call to collect all parent ids
        Specified by:
        lookupToParents in interface CategoryService
        Parameters:
        categoryId - identification of entity object
        result - the collection which will be used to collect all parent ids
        Returns:
        the list of ids