java.lang.Object
com.broadleafcommerce.asset.provider.jpa.domain.JpaAsset
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.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 @TrackableExtension(APPLICATION) public class JpaAsset 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, Serializable
Persistent counter-part to a Asset for use with a JPA-supported datastore.
Author:
Samarth Dhruva (samarthd)
See Also:
  • Constructor Details

    • JpaAsset

      public JpaAsset()
  • Method Details

    • 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
    • tagValuesToTagEntities

      protected org.modelmapper.Converter<Set<String>,List<JpaAssetTag>> tagValuesToTagEntities()
    • 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
    • getContextId

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

      public String getUrl()
      Location used to resolve this asset by callers using the service such as "/icon.png" for an internal asset or "https://www.youtube.com/watch?v=a1S2d3F4" for external asset.
      Returns:
      the url for this asset
    • getEmbedCode

      public String getEmbedCode()
      If and only if the type is DefaultAssetType.EMBED, this field holds the HTML to embed.

      Note that url and this field can never both be present.

      Returns:
      the HTML to embed
    • getAltText

      public String getAltText()
      Text that corresponds to the HTML alt attribute that should be used when this asset is rendered in a browser. This is used as an alternative for screen-readers and as an SEO enhancement describing the asset.
      Returns:
      the altText for this asset
    • getTitle

      public String getTitle()
      Text that corresponds to the HTML title attribute that should be used when this asset is rendered in a browser. This is used a tooltip or caption.
      Returns:
      the title for this asset
    • getTags

      public List<JpaAssetTag> getTags()

      Descriptive or identifying labels.

      Tags can be used to:

      • provide a means of designating special purposes for the asset
      • group otherwise related assets such as "banners"
      • provide a label for some other, arbitrary purpose

      Returns:
      the tags for this asset
    • getLocale

      public Locale getLocale()
      Designate this asset to be used in a specific Locale
      Returns:
      the locale for this asset
    • getType

      public String getType()
      Describes the general type of the asset. This is used to determine how to render the asset on the frontend. For example, if the type is DefaultAssetType.IMAGE, then the frontend will know to render it in an <img/> tag.

      For assets with an external storageType, this field is required input. For internal assets, this is inferred from the mimeType during upload.

      Returns:
      the general type of the asset
      See Also:
    • getExternalProvider

      public String getExternalProvider()
      For assets with an external storageType, this field is required and names where the external asset is sourced from. This field should be null for assets with an internal storageType.
      Returns:
      the provider (for example, the name of the CDN) that is hosting the external asset
      See Also:
      • Asset.externalProvider
    • getMimeType

      public String getMimeType()

      MIME storageType of the file represented by this asset: image/png, image/jpeg, application/pdf, &c.

      See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types for more info on MIME types

      Returns:
      the mimeType for this asset
    • getSize

      public long getSize()
      Size in bytes of the file represented by this asset.
      Returns:
      the size in bytes for this asset
    • getUploadDate

      public Instant getUploadDate()
      Date the file was uploaded to create this asset.
      Returns:
      the uploadDate for this asset
    • getLastUpdatedDate

      public Instant getLastUpdatedDate()
      Date the file was last updated.
      Returns:
      the lastUpdatedDate for this asset
    • getAuthor

      public String getAuthor()
      User who created this asset.
      Returns:
      the author for this asset
    • getStorageType

      public String getStorageType()
      Defines where the digital content represented by this asset is stored. The default types are DefaultAssetStorageType.INTERNAL and DefaultAssetStorageType.EXTERNAL.
      Returns:
      the storageType for this asset
      See Also:
    • getFolderContextId

      public String getFolderContextId()
      Returns:
      the persistent counter-part to Asset.getFolderId()
    • getAttributes

      public Map<String,String> getAttributes()
      Returns:
      the persisted counter-part of Asset.getAttributes()
    • getTracking

      public com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking getTracking()
      Specified by:
      getTracking in interface com.broadleafcommerce.data.tracking.core.Trackable
      Returns:
      the ApplicationJpaTracking information for this
      See Also:
      • ApplicationJpaTracking
    • setContextId

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

      public void setUrl(String url)
      Location used to resolve this asset by callers using the service such as "/icon.png" for an internal asset or "https://www.youtube.com/watch?v=a1S2d3F4" for external asset.
      Parameters:
      url - the value to set as the url for this asset
    • setEmbedCode

      public void setEmbedCode(String embedCode)
      If and only if the type is DefaultAssetType.EMBED, this field holds the HTML to embed.

      Note that url and this field can never both be present.

      Parameters:
      embedCode - the HTML to embed
    • setAltText

      public void setAltText(String altText)
      Text that corresponds to the HTML alt attribute that should be used when this asset is rendered in a browser. This is used as an alternative for screen-readers and as an SEO enhancement describing the asset.
      Parameters:
      altText - the value to set as the altText for this asset
    • setTitle

      public void setTitle(String title)
      Text that corresponds to the HTML title attribute that should be used when this asset is rendered in a browser. This is used a tooltip or caption.
      Parameters:
      title - the value to set as the title for this asset
    • setTags

      public void setTags(List<JpaAssetTag> tags)

      Descriptive or identifying labels.

      Tags can be used to:

      • provide a means of designating special purposes for the asset
      • group otherwise related assets such as "banners"
      • provide a label for some other, arbitrary purpose

      Parameters:
      tags - the value to set as the tags for this asset
    • setLocale

      public void setLocale(Locale locale)
      Designate this asset to be used in a specific Locale
      Parameters:
      locale - the value to set as the locale for this asset
    • setType

      public void setType(String type)
      Describes the general type of the asset. This is used to determine how to render the asset on the frontend. For example, if the type is DefaultAssetType.IMAGE, then the frontend will know to render it in an <img/> tag.

      For assets with an external storageType, this field is required input. For internal assets, this is inferred from the mimeType during upload.

      Parameters:
      type - the general type of the asset
      See Also:
    • setExternalProvider

      public void setExternalProvider(String externalProvider)
      For assets with an external storageType, this field is required and names where the external asset is sourced from. This field should be null for assets with an internal storageType.
      Parameters:
      externalProvider - the provider (for example, the name of the CDN) that is hosting the external asset
      See Also:
      • Asset.externalProvider
    • setMimeType

      public void setMimeType(String mimeType)

      MIME storageType of the file represented by this asset: image/png, image/jpeg, application/pdf, &c.

      See https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types for more info on MIME types

      Parameters:
      mimeType - the value to set as the mimeType for this asset
    • setSize

      public void setSize(long size)
      Size in bytes of the file represented by this asset.
      Parameters:
      size - the value to set as the size in bytes for this asset
    • setUploadDate

      public void setUploadDate(Instant uploadDate)
      Date the file was uploaded to create this asset.
      Parameters:
      uploadDate - the value to set as the uploadDate for this asset
    • setLastUpdatedDate

      public void setLastUpdatedDate(Instant lastUpdatedDate)
      Date the file was last updated.
      Parameters:
      lastUpdatedDate - the value to set as the lastUpdatedDate for this asset
    • setAuthor

      public void setAuthor(String author)
      User who created this asset.
      Parameters:
      author - the value to set as the author for this asset
    • setStorageType

      public void setStorageType(String storageType)
      Defines where the digital content represented by this asset is stored. The default types are DefaultAssetStorageType.INTERNAL and DefaultAssetStorageType.EXTERNAL.
      Parameters:
      storageType - the value to set as the storageType for this asset
      See Also:
    • setFolderContextId

      public void setFolderContextId(String folderContextId)
      Parameters:
      folderContextId - the persistent counter-part to Asset.getFolderId()
    • setAttributes

      public void setAttributes(Map<String,String> attributes)
      Parameters:
      attributes - the persisted counter-part of Asset.getAttributes()
    • 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>
      Parameters:
      tracking - the ApplicationJpaTracking information for this
      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