Class 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
Asset
for use with a JPA-supported datastore.- Author:
- Samarth Dhruva (samarthd)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
org.modelmapper.ModelMapper
fromMe()
Text that corresponds to the HTMLalt
attribute that should be used when this asset is rendered in a browser.User who created this asset.Class<?>
If and only if thetype
isDefaultAssetType.EMBED
, this field holds the HTML to embed.For assets with an externalstorageType
, this field is required and names where the external asset is sourced from.Date the file was last updated.Designate this asset to be used in a specificLocale
MIME storageType of the file represented by this asset: image/png, image/jpeg, application/pdf, &c.long
getSize()
Size in bytes of the file represented by this asset.Defines where the digital content represented by this asset is stored.getTags()
Descriptive or identifying labels.getTitle()
Text that corresponds to the HTMLtitle
attribute that should be used when this asset is rendered in a browser.com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking
getType()
Describes the general type of the asset.Date the file was uploaded to create this asset.getUrl()
Location used to resolve this asset by callers using the service such as "/icon.png" for aninternal asset
or "https://www.youtube.com/watch?v=a1S2d3F4" forexternal asset
.int
hashCode()
void
setAltText
(String altText) Text that corresponds to the HTMLalt
attribute that should be used when this asset is rendered in a browser.void
setAttributes
(Map<String, String> attributes) void
User who created this asset.void
setContextId
(String contextId) void
setEmbedCode
(String embedCode) If and only if thetype
isDefaultAssetType.EMBED
, this field holds the HTML to embed.void
setExternalProvider
(String externalProvider) For assets with an externalstorageType
, this field is required and names where the external asset is sourced from.void
setFolderContextId
(String folderContextId) void
setLastUpdatedDate
(Instant lastUpdatedDate) Date the file was last updated.void
Designate this asset to be used in a specificLocale
void
setMimeType
(String mimeType) MIME storageType of the file represented by this asset: image/png, image/jpeg, application/pdf, &c.void
setSize
(long size) Size in bytes of the file represented by this asset.void
setStorageType
(String storageType) Defines where the digital content represented by this asset is stored.void
setTags
(List<JpaAssetTag> tags) Descriptive or identifying labels.void
Text that corresponds to the HTMLtitle
attribute that should be used when this asset is rendered in a browser.void
setTracking
(com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking tracking) void
Describes the general type of the asset.void
setUploadDate
(Instant uploadDate) Date the file was uploaded to create this asset.void
Location used to resolve this asset by callers using the service such as "/icon.png" for aninternal asset
or "https://www.youtube.com/watch?v=a1S2d3F4" forexternal asset
.protected org.modelmapper.Converter<Set<String>,
List<JpaAssetTag>> org.modelmapper.ModelMapper
toMe()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
postFromMe, postToMe, preFromMe, preToMe
Methods inherited from interface com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware
findNotificationState
Methods inherited from interface com.broadleafcommerce.data.tracking.core.Trackable
getNotificationStates, getNotificationStates, setNotificationStates
Methods inherited from interface com.broadleafcommerce.data.tracking.core.TypedTrackable
setTracking
-
Constructor Details
-
JpaAsset
public JpaAsset()
-
-
Method Details
-
fromMe
@NonNull public org.modelmapper.ModelMapper fromMe()- Specified by:
fromMe
in interfacecom.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
-
toMe
@NonNull public org.modelmapper.ModelMapper toMe()- Specified by:
toMe
in interfacecom.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
-
tagValuesToTagEntities
-
getBusinessDomainType
- Specified by:
getBusinessDomainType
in interfacecom.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware
-
getDisplay
- Specified by:
getDisplay
in interfacecom.broadleafcommerce.data.tracking.core.Trackable
-
getContextId
- Specified by:
getContextId
in interfacecom.broadleafcommerce.data.tracking.core.Trackable
-
getUrl
Location used to resolve this asset by callers using the service such as "/icon.png" for aninternal asset
or "https://www.youtube.com/watch?v=a1S2d3F4" forexternal asset
.- Returns:
- the url for this asset
-
getEmbedCode
If and only if thetype
isDefaultAssetType.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
Text that corresponds to the HTMLalt
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
Text that corresponds to the HTMLtitle
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
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
Designate this asset to be used in a specificLocale
- Returns:
- the locale for this asset
-
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 isDefaultAssetType.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 themimeType
during upload.- Returns:
- the general type of the asset
- See Also:
-
DefaultAssetType
Asset.type
-
getExternalProvider
For assets with an externalstorageType
, this field is required and names where the external asset is sourced from. This field should be null for assets with an internalstorageType
.- Returns:
- the provider (for example, the name of the CDN) that is hosting the external asset
- See Also:
-
Asset.externalProvider
-
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
Date the file was uploaded to create this asset.- Returns:
- the uploadDate for this asset
-
getLastUpdatedDate
Date the file was last updated.- Returns:
- the lastUpdatedDate for this asset
-
getAuthor
User who created this asset.- Returns:
- the author for this asset
-
getStorageType
Defines where the digital content represented by this asset is stored. The default types areDefaultAssetStorageType.INTERNAL
andDefaultAssetStorageType.EXTERNAL
.- Returns:
- the storageType for this asset
- See Also:
-
getFolderContextId
- Returns:
- the persistent counter-part to
Asset.getFolderId()
-
getAttributes
- Returns:
- the persisted counter-part of
Asset.getAttributes()
-
getTracking
public com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking getTracking()- Specified by:
getTracking
in interfacecom.broadleafcommerce.data.tracking.core.Trackable
- Returns:
- the
ApplicationJpaTracking
information for this - See Also:
-
ApplicationJpaTracking
-
setContextId
- Specified by:
setContextId
in interfacecom.broadleafcommerce.data.tracking.core.Trackable
-
setUrl
Location used to resolve this asset by callers using the service such as "/icon.png" for aninternal asset
or "https://www.youtube.com/watch?v=a1S2d3F4" forexternal asset
.- Parameters:
url
- the value to set as the url for this asset
-
setEmbedCode
If and only if thetype
isDefaultAssetType.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
Text that corresponds to the HTMLalt
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
Text that corresponds to the HTMLtitle
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
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
Designate this asset to be used in a specificLocale
- Parameters:
locale
- the value to set as the locale for this asset
-
setType
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 isDefaultAssetType.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 themimeType
during upload.- Parameters:
type
- the general type of the asset- See Also:
-
DefaultAssetType
Asset.type
-
setExternalProvider
For assets with an externalstorageType
, this field is required and names where the external asset is sourced from. This field should be null for assets with an internalstorageType
.- Parameters:
externalProvider
- the provider (for example, the name of the CDN) that is hosting the external asset- See Also:
-
Asset.externalProvider
-
setMimeType
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
Date the file was uploaded to create this asset.- Parameters:
uploadDate
- the value to set as the uploadDate for this asset
-
setLastUpdatedDate
Date the file was last updated.- Parameters:
lastUpdatedDate
- the value to set as the lastUpdatedDate for this asset
-
setAuthor
User who created this asset.- Parameters:
author
- the value to set as the author for this asset
-
setStorageType
Defines where the digital content represented by this asset is stored. The default types areDefaultAssetStorageType.INTERNAL
andDefaultAssetStorageType.EXTERNAL
.- Parameters:
storageType
- the value to set as the storageType for this asset- See Also:
-
setFolderContextId
- Parameters:
folderContextId
- the persistent counter-part toAsset.getFolderId()
-
setAttributes
- Parameters:
attributes
- the persisted counter-part ofAsset.getAttributes()
-
setTracking
public void setTracking(com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking tracking) - Specified by:
setTracking
in interfacecom.broadleafcommerce.data.tracking.core.TypedTrackable<com.broadleafcommerce.data.tracking.jpa.filtering.domain.ApplicationJpaTracking>
- Parameters:
tracking
- theApplicationJpaTracking
information for this- See Also:
-
ApplicationJpaTracking
-
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-