java.lang.Object
com.broadleafcommerce.pricing.provider.jpa.domain.JpaPriceData
All Implemented Interfaces:
com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware, com.broadleafcommerce.data.tracking.core.ApplicationTrackable<com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking>, com.broadleafcommerce.data.tracking.core.filtering.ActiveAware, com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware, com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable, com.broadleafcommerce.data.tracking.core.Trackable, com.broadleafcommerce.data.tracking.core.TypedTrackable<com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking>, Serializable

@Entity public class JpaPriceData extends Object implements com.broadleafcommerce.data.tracking.core.ApplicationTrackable<com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking>, com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable, com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware, com.broadleafcommerce.data.tracking.core.filtering.ActiveAware, Serializable
Persistent counter-part to a PriceData for use with a JPA datastore.
Author:
Chad Harchar (charchar), Nathan Moore (nathanmoore)
See Also:
  • Constructor Details

    • JpaPriceData

      public JpaPriceData()
  • Method Details

    • preFromMe

      public void preFromMe(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, Object businessDomain)
      Specified by:
      preFromMe in interface com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
    • fromMe

      @NonNull public org.modelmapper.ModelMapper fromMe()
      Specified by:
      fromMe in interface com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
    • toMe

      @NonNull public org.modelmapper.ModelMapper toMe()
      Specified by:
      toMe in interface com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
    • getBusinessDomainType

      public Class<?> getBusinessDomainType()
      Specified by:
      getBusinessDomainType in interface com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware
    • getDisplay

      public Optional<String> getDisplay()
      Specified by:
      getDisplay in interface com.broadleafcommerce.data.tracking.core.Trackable
    • getPrice

      public javax.money.MonetaryAmount getPrice()
    • setPrice

      public void setPrice(javax.money.MonetaryAmount price)
    • getRecurringPrice

      public javax.money.MonetaryAmount getRecurringPrice()
    • setRecurringPrice

      public void setRecurringPrice(javax.money.MonetaryAmount recurringPrice)
    • getUsagePrice

      public javax.money.MonetaryAmount getUsagePrice()
    • setUsagePrice

      public void setUsagePrice(javax.money.MonetaryAmount usagePrice)
    • setComplexAttributes

      public void setComplexAttributes(Map<String,Object> attributes)
      Parameters:
      attributes - the complex object representation of attributes to convert and set
      See Also:
      • attributes
    • getComplexAttributes

      public Map<String,Object> getComplexAttributes()
      Returns:
      the complex object representation of attributes
      See Also:
      • attributes
    • get_id

      public String get_id()
    • getContextId

      public String getContextId()
      Specified by:
      getContextId in interface com.broadleafcommerce.data.tracking.core.Trackable
      See Also:
      • Trackable.getContextId()
    • getPriceListId

      public String getPriceListId()
      See Also:
    • getPriceListName

      public String getPriceListName()
      See Also:
    • getTargetContextId

      public String getTargetContextId()
    • getTargetType

      public String getTargetType()
      See Also:
      • PriceableTarget.getTargetType()
    • getTargetVendorRef

      public String getTargetVendorRef()
    • getCurrency

      public javax.money.CurrencyUnit getCurrency()
      Transient property that holds the parent price list currency in order to convert price to a MonetaryAmount.
    • getActiveStartDate

      public Instant getActiveStartDate()
      Specified by:
      getActiveStartDate in interface com.broadleafcommerce.data.tracking.core.filtering.ActiveAware
      See Also:
    • getActiveEndDate

      public Instant getActiveEndDate()
      Specified by:
      getActiveEndDate in interface com.broadleafcommerce.data.tracking.core.filtering.ActiveAware
      See Also:
    • getStartingQuantity

      public Integer getStartingQuantity()
      See Also:
    • getAvailableQuantity

      public Integer getAvailableQuantity()
      See Also:
    • getTiers

      public List<JpaPriceDataTier> getTiers()
      See Also:
    • getName

      public String getName()
      See Also:
    • getDescription

      public String getDescription()
      See Also:
    • getUsageAmount

      public BigDecimal getUsageAmount()
      See Also:
    • getUsageUnits

      public String getUsageUnits()
      See Also:
    • getRecurringPeriodFrequency

      public Integer getRecurringPeriodFrequency()
      See Also:
    • getRecurringPeriodType

      public String getRecurringPeriodType()
      See Also:
    • getRecurringPeriodLimit

      public Integer getRecurringPeriodLimit()
      See Also:
    • getTermDurationLength

      public Integer getTermDurationLength()
      See Also:
    • getTermDurationType

      public String getTermDurationType()
      See Also:
    • getCharacteristics

      public Map<String,String> getCharacteristics()
    • getPriority

      public Integer getPriority()
      See Also:
    • getAttributes

      public String getAttributes()

      A few special measures have been taken in the interest of making this column queryable.

      Firstly, regarding column size: Oracle's VARCHAR maxes out at a conservative 4000 bytes. Thus, we set the length limit to 4000, which results in a changeset that looks like VARCHAR(4000 CHAR). When using a multi-byte character set (ex: AL32UTF8), the actual length limit may not be 4000 characters and may instead be 1000 characters if using 4 byte characters. However, in practice, multi-byte character sets are variable-width and therefore in most cases each character will continue to only use 1 byte. See this post for more details.

      Regarding RSQL filtration support: This is really a Map with String keys and Object values and is serialized to a JSON string for persistence. In order to allow RSQL filters to target this field as a String, we need to keep its Java type as such to pass Hibernate type consistency validations (Hibernate will otherwise require the filtration parameter to also be a Map, for example). As a result, rather than using Convert with an AttributeConverter to hook into automatic conversion mechanisms, we keep the field as a String and explicitly implement getters and setters and mapping logic to convert between the Map structure and the String representation.

      See Also:
    • getTracking

      public com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking getTracking()
      Specified by:
      getTracking in interface com.broadleafcommerce.data.tracking.core.Trackable
      See Also:
      • ApplicationJpaTracking
    • set_id

      public void set_id(String _id)
    • setContextId

      public void setContextId(String contextId)
      Specified by:
      setContextId in interface com.broadleafcommerce.data.tracking.core.Trackable
      See Also:
      • Trackable.getContextId()
    • setPriceListId

      public void setPriceListId(String priceListId)
      See Also:
    • setPriceListName

      public void setPriceListName(String priceListName)
      See Also:
    • setTargetContextId

      public void setTargetContextId(String targetContextId)
    • setTargetType

      public void setTargetType(String targetType)
      See Also:
      • PriceableTarget.getTargetType()
    • setTargetVendorRef

      public void setTargetVendorRef(String targetVendorRef)
    • setCurrency

      public void setCurrency(javax.money.CurrencyUnit currency)
      Transient property that holds the parent price list currency in order to convert price to a MonetaryAmount.
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      See Also:
    • setActiveEndDate

      public void setActiveEndDate(Instant activeEndDate)
      See Also:
    • setStartingQuantity

      public void setStartingQuantity(Integer startingQuantity)
      See Also:
    • setAvailableQuantity

      public void setAvailableQuantity(Integer availableQuantity)
      See Also:
    • setTiers

      public void setTiers(List<JpaPriceDataTier> tiers)
      See Also:
    • setName

      public void setName(String name)
      See Also:
    • setDescription

      public void setDescription(String description)
      See Also:
    • setUsageAmount

      public void setUsageAmount(BigDecimal usageAmount)
      See Also:
    • setUsageUnits

      public void setUsageUnits(String usageUnits)
      See Also:
    • setRecurringPeriodFrequency

      public void setRecurringPeriodFrequency(Integer recurringPeriodFrequency)
      See Also:
    • setRecurringPeriodType

      public void setRecurringPeriodType(String recurringPeriodType)
      See Also:
    • setRecurringPeriodLimit

      public void setRecurringPeriodLimit(Integer recurringPeriodLimit)
      See Also:
    • setTermDurationLength

      public void setTermDurationLength(Integer termDurationLength)
      See Also:
    • setTermDurationType

      public void setTermDurationType(String termDurationType)
      See Also:
    • setCharacteristics

      public void setCharacteristics(Map<String,String> characteristics)
    • setPriority

      public void setPriority(Integer priority)
      See Also:
    • setAttributes

      public void setAttributes(String attributes)

      A few special measures have been taken in the interest of making this column queryable.

      Firstly, regarding column size: Oracle's VARCHAR maxes out at a conservative 4000 bytes. Thus, we set the length limit to 4000, which results in a changeset that looks like VARCHAR(4000 CHAR). When using a multi-byte character set (ex: AL32UTF8), the actual length limit may not be 4000 characters and may instead be 1000 characters if using 4 byte characters. However, in practice, multi-byte character sets are variable-width and therefore in most cases each character will continue to only use 1 byte. See this post for more details.

      Regarding RSQL filtration support: This is really a Map with String keys and Object values and is serialized to a JSON string for persistence. In order to allow RSQL filters to target this field as a String, we need to keep its Java type as such to pass Hibernate type consistency validations (Hibernate will otherwise require the filtration parameter to also be a Map, for example). As a result, rather than using Convert with an AttributeConverter to hook into automatic conversion mechanisms, we keep the field as a String and explicitly implement getters and setters and mapping logic to convert between the Map structure and the String representation.

      See Also:
    • setTracking

      public void setTracking(com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking tracking)
      Specified by:
      setTracking in interface com.broadleafcommerce.data.tracking.core.TypedTrackable<com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking>
      See Also:
      • ApplicationJpaTracking
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object