Class AttributeServiceImpl

    • Constructor Detail

      • AttributeServiceImpl

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

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

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

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

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

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

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

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

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

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

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

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

        public java.util.List<Option> getOptionsFromAttribute​(java.lang.String attrId)
        Description copied from interface: AttributeService
        This method does request to retrieve data as list.
        Specified by:
        getOptionsFromAttribute in interface AttributeService
        Parameters:
        attrId - this attribute id is used for return all related options
        Returns:
        all related options
      • getMeasurementValueFromAttribute

        public java.lang.String getMeasurementValueFromAttribute​(java.lang.String attrId)
        Description copied from interface: AttributeService
        This method returns a value as text.
        Specified by:
        getMeasurementValueFromAttribute in interface AttributeService
        Parameters:
        attrId - identification for database entity which will be retrieved
        Returns:
        value as text
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String attributeValueId)
        Description copied from interface: AttributeService
        This method returns a value as text.
        Specified by:
        getAttributeValue in interface AttributeService
        Parameters:
        attributeValueId - identification for database entity which will be retrieved
        Returns:
        value as text
      • createMeasurement

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

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

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

        public java.util.Optional<Measurement> createMeasurement​(Measurement measurement)
        Description copied from interface: AttributeService
        This method creates a database entity.
        Specified by:
        createMeasurement in interface AttributeService
        Parameters:
        measurement - database entity
        Returns:
        optional value to externally interaction
      • createOption

        public java.util.Optional<Option> createOption​(Option option)
        Description copied from interface: AttributeService
        This method creates a database entity.
        Specified by:
        createOption in interface AttributeService
        Parameters:
        option - database entity
        Returns:
        optional value to externally interaction
      • createAttribute

        public java.util.Optional<Attribute> createAttribute​(Attribute attribute)
        Description copied from interface: AttributeService
        This method creates a database entity.
        Specified by:
        createAttribute in interface AttributeService
        Parameters:
        attribute - database entity
        Returns:
        optional value to externally interaction
      • addAttributeToProduct

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

        @Transactional
        public Attribute addAttributeToProduct​(java.lang.String productId,
                                               java.lang.String attributeId)
        Description copied from interface: AttributeService
        This method does a relationship between entities.
        Specified by:
        addAttributeToProduct in interface AttributeService
        Parameters:
        productId - identification for database entity which will be updated
        attributeId - attribute identifier
        Returns:
        database entity
      • addAttributeToSKU

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

        @Transactional
        public Attribute addAttributeToSKU​(java.lang.String skuId,
                                           java.lang.String attributeId)
        Description copied from interface: AttributeService
        This method does a relationship between entities.
        Specified by:
        addAttributeToSKU in interface AttributeService
        Parameters:
        skuId - identification for database entity which will be updated
        attributeId - attribute identifier
        Returns:
        database entity
      • saveAttribute

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

        public Measurement saveMeasurement​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> msrAsMap)
        Description copied from interface: AttributeService
        This method save an updates of database entity.
        Specified by:
        saveMeasurement in interface AttributeService
        Parameters:
        msrAsMap - map-representation of database entity
        Returns:
        saved instance of database entity
      • saveOption

        public Option saveOption​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> optAsMap)
        Description copied from interface: AttributeService
        This method save an updates of database entity.
        Specified by:
        saveOption in interface AttributeService
        Parameters:
        optAsMap - map-representation of database entity
        Returns:
        optional value to externally interaction
      • saveOption

        public Option saveOption​(Option option)
        Description copied from interface: AttributeService
        This method save an updates of database entity.
        Specified by:
        saveOption in interface AttributeService
        Parameters:
        option - database entity
        Returns:
        value to externally interaction
      • prepareRelations

        private void prepareRelations​(Attribute aUI)
      • addRelations

        private void addRelations​(Attribute aUI)
      • prepareRelationsForMeasurement

        private void prepareRelationsForMeasurement​(Measurement mUI)
      • removeRelationsForMeasurement

        private void removeRelationsForMeasurement​(Measurement mUI,
                                                   Measurement mDB)
      • addRelationsForMeasurement

        private void addRelationsForMeasurement​(Measurement mUI)
      • prepareRelationsForOption

        private void prepareRelationsForOption​(Option oUI)
      • removeRelationsForOption

        private void removeRelationsForOption​(Option oUI,
                                              Option oDB)
      • addRelationsForOption

        private void addRelationsForOption​(Option oUI)
      • removeAttributeFromProduct

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

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

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

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

        public void removeAttributeValue​(java.lang.String avId)
        Description copied from interface: AttributeService
        This method removes database entity.
        Specified by:
        removeAttributeValue in interface AttributeService
        Parameters:
        avId - identification for database entity which will be removed
      • removeAttributeFromTranslation

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

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

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

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

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

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

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

        public void removeMeasurementFromAttributes​(java.lang.String measureId)
        Description copied from interface: AttributeService
        This method removes relationship between database entities.
        Specified by:
        removeMeasurementFromAttributes in interface AttributeService
        Parameters:
        measureId - identification for database entity which will be removed
      • removeMeasurementAndClean

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

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

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

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

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

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

        public void removeAttributeValuesByAttributeId​(java.lang.String attributeId)
        Description copied from interface: AttributeService
        This method removes all relationships between database entities.
        Specified by:
        removeAttributeValuesByAttributeId in interface AttributeService
        Parameters:
        attributeId - identification for database entity which will be updated
      • removeAttributesByIds

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

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

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

        public AttributeDTO mapAttributeToDto​(Attribute attr,
                                              boolean optimal)
        Description copied from interface: AttributeService
        This method does map product entity to dto object
        Specified by:
        mapAttributeToDto in interface AttributeService
        Parameters:
        attr - database entity which be used to map to dto
        optimal - this pointer optimises the data transfer object
        Returns:
        data transport object
      • mapOptionToDto

        public OptionDTO mapOptionToDto​(Option opt,
                                        boolean optimal)
        Description copied from interface: AttributeService
        This method does map product entity to dto object
        Specified by:
        mapOptionToDto in interface AttributeService
        Parameters:
        opt - database entity which be used to map to dto
        optimal - this pointer optimises the data transfer object
        Returns:
        data transport object
      • mapMeasurementToDto

        public MeasurementDTO mapMeasurementToDto​(Measurement msr,
                                                  boolean optimal)
        Description copied from interface: AttributeService
        This method does map product entity to dto object
        Specified by:
        mapMeasurementToDto in interface AttributeService
        Parameters:
        msr - database entity which be used to map to dto
        optimal - this pointer optimises the data transfer object
        Returns:
        data transport object
      • removeAttributeValuesByAttribute

        private void removeAttributeValuesByAttribute​(Attribute attribute)