Class DamEvent

java.lang.Object
com.day.cq.dam.api.DamEvent

public class DamEvent extends Object
The DamEvent represents events occurring upon assets within DAM. Such events are sent out from implementations performing any of the specified event DamEvent.Types.
  • Field Details

    • EVENT_TOPIC

      public static final String EVENT_TOPIC
      Event topic for DAM events.
      See Also:
    • PROPERTY_EXPIRATIONDATE

      public static final String PROPERTY_EXPIRATIONDATE
      The expiration date of asset.
      See Also:
    • PROPERTY_CREATEDBY

      public static final String PROPERTY_CREATEDBY
      The creator of asset.
      See Also:
    • PROPERTY_VERSION_ID

      public static final String PROPERTY_VERSION_ID
      The version created for the asset.
      See Also:
    • PROPERTY_LICENSE_INFO

      public static final String PROPERTY_LICENSE_INFO
      The license information (e.g. URL/path) that served for accepting/rejecting events.
      See Also:
    • PROPERTY_ADDITIONAL_INFO

      public static final String PROPERTY_ADDITIONAL_INFO
      Arbitrary additional information settable for the event.
      See Also:
  • Method Details

    • getAssetPath

      public String getAssetPath()
      The path of the asset the event occurred upon.
      Returns:
      A String representing the asset, folder or collection path.
    • getDate

      public Date getDate()
      The date the event occurred on.
      Returns:
      The Date representing the date/time the event occurred on.
    • getLicenseInfo

      public String getLicenseInfo()
      Information about the license upon which the user accepted or rejected.
      Returns:
      A String representing the license information, or null if n/a.
    • getVersionId

      public String getVersionId()
      The ID of the version that was created upon the asset versioning event.
      Returns:
      A String representing the version ID, or null if n/a.
    • getUserId

      public String getUserId()
      The id of the user generating the event.
      Returns:
      A String representing the user id.
    • getType

      public DamEvent.Type getType()
      The DamEvent.Type of event that occurred on the asset.
      Returns:
      The DamEvent.Type
    • getAdditionalInfo

      public String getAdditionalInfo()
      Any additional information provided for certain event types.
      Returns:
      A String representing the additional information, or null if n/a.
    • getExpirationDate

      public Date getExpirationDate()
      Expiration date for the ASSET_EXPIRED event.
      Returns:
      Date representing the expiration date, or null if n/a.
    • getCreatedBy

      public String getCreatedBy()
      Creator of the asset.
      Returns:
      String representing the creator of asset, or null if n/a.
    • isPublishedExternally

      public boolean isPublishedExternally()
      Indicates whether this event represents an asset having been uploaded to an external system.
      Returns:
      true if the event type is DamEvent.Type.PUBLISHED_EXTERNAL.
    • fromEvent

      public static DamEvent fromEvent(Event event)
      Translates a given Event to a DamEvent if the event topic matches EVENT_TOPIC.
      Parameters:
      event - The Event to translate.
      Returns:
      A DamEvent or null if the given event is not of the expected topic.
    • toEvent

      public Event toEvent()
      Create a distributable event.
      Returns:
      An event.
    • toNonDistributableEvent

      public Event toNonDistributableEvent()
      Create a non distributable event.
      Returns:
      An event.
    • accepted

      public static DamEvent accepted(String assetPath, String userId, String licenseInfo)
      Creates a DamEvent that corresponds to the event of the license of a DRM-protected asset having been accepted.
      Parameters:
      assetPath - The path of the asset for which the license has been accepted.
      userId - The id of the user that accepted the license.
      licenseInfo - Information about the license, such as its path or URL.
      Returns:
      The corresponding DamEvent
      See Also:
    • rejected

      public static DamEvent rejected(String assetPath, String userId, String licenseInfo)
      Creates a DamEvent that corresponds to the event of the license of a DRM-protected asset having been rejected.
      Parameters:
      assetPath - The path of the asset for which the license has been rejected.
      userId - The id of the user that rejected the license.
      licenseInfo - Information about the license, such as its path or URL.
      Returns:
      The corresponding DamEvent
      See Also:
    • downloaded

      public static DamEvent downloaded(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset having been downloaded. In case of a DRM-protected asset, this event can only follow a accepted(String, String, String) event.
      Parameters:
      assetPath - The path of the asset that was downloaded.
      userId - The id of the user that downloaded the asset.
      Returns:
      The corresponding DamEvent
      See Also:
    • downloaded

      public static DamEvent downloaded(String assetPath, String userId, String additionalInfo)
      Creates a DamEvent that corresponds to the event of an asset having been downloaded. In case of a DRM-protected asset, this event can only follow a accepted(String, String, String) event.
      Parameters:
      assetPath - The path of the asset that was downloaded.
      userId - The id of the user that downloaded the asset.
      additionalInfo - Name of the source workflow of the downloaded asset, empty value means normal download.
      Returns:
      The corresponding DamEvent
      See Also:
    • versioned

      public static DamEvent versioned(String assetPath, String userId, String versionId)
      Creates a DamEvent that corresponds to the event of an asset having been versioned.
      Parameters:
      assetPath - The path of the asset that was versioned.
      userId - The id of the user that versioned the asset.
      versionId - The id of the version that was created.
      Returns:
      The corresponding DamEvent
      See Also:
    • restored

      public static DamEvent restored(String assetPath, String userId, String versionId)
      Creates a DamEvent that corresponds to the event of an asset having been restored from a previous version.
      Parameters:
      assetPath - The path of the asset that was restored.
      userId - The id of the user that restored the asset.
      versionId - The id of the version from which the asset was restored.
      Returns:
      The corresponding DamEvent
      See Also:
    • metadataUpdated

      public static DamEvent metadataUpdated(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset's metadata having been updated.
      Parameters:
      assetPath - The path of the asset the metadata of which was updated.
      userId - The id of the user that updated the metadata.
      Returns:
      The corresponding DamEvent
      See Also:
    • metadataUpdated

      public static DamEvent metadataUpdated(String assetPath, String userId, String additionalInfo)
      Creates a DamEvent that corresponds to the event of an asset's metadata having been updated.
      Parameters:
      assetPath - The path of the asset the metadata of which was updated.
      userId - The id of the user that updated the metadata.
      additionalInfo - metadata info passed as "property1=value1,property2=value2..."
      Returns:
      The corresponding DamEvent
      See Also:
    • publishedExternally

      public static DamEvent publishedExternally(String assetPath, String userId, String additionalInfo)
      Creates a DamEvent that corresponds to the event of an asset having been uploaded to an external system.
      Parameters:
      assetPath - The path of the asset that was uploaded.
      userId - The id of the user that uploaded the asset.
      additionalInfo - Information about the external system to which the asset was uploaded, such as a URL.
      Returns:
      The corresponding DamEvent
      See Also:
    • originalUpdated

      public static DamEvent originalUpdated(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset's original rendition having been updated.
      Parameters:
      assetPath - The path of the asset the original of which was updated.
      userId - The id of the user that updated the asset's original.
      Returns:
      The corresponding DamEvent
      See Also:
    • renditionUpdated

      public static DamEvent renditionUpdated(String assetPath, String userId, String renditionPath)
      Creates a DamEvent that corresponds to the event of a rendition having been added or updated for an asset.
      Parameters:
      assetPath - The path of the asset for which a rendition was added or updated.
      userId - The id of the user that added/updated the rendition.
      renditionPath - The path of the rendition that was added/updated.
      Returns:
      The corresponding DamEvent
      See Also:
    • renditionRemoved

      public static DamEvent renditionRemoved(String assetPath, String userId, String renditionPath)
      Creates a DamEvent that corresponds to the event of a rendition having been removed for an asset.
      Parameters:
      assetPath - The path of the asset for which a rendition was removed.
      userId - The id of the user that removed the rendition.
      renditionPath - The path of the rendition that was removed.
      Returns:
      The corresponding DamEvent
      See Also:
    • renditionDownloaded

      public static DamEvent renditionDownloaded(String assetPath, String userId, String renditionPath)
      Creates a DamEvent that corresponds to the event of a rendition having been downloaded for an asset.
      Parameters:
      assetPath - The path of the asset for which a rendition was downloaded.
      userId - The id of the user that downloaded the rendition.
      renditionPath - The path of the rendition that was downloaded.
      Returns:
      The corresponding DamEvent
      See Also:
    • subassetUpdated

      public static DamEvent subassetUpdated(String assetPath, String userId, String subassetPath)
      Creates a DamEvent that corresponds to the event of a sub-asset having been added or updated for an asset.
      Parameters:
      assetPath - The path of the asset for which a sub-asset was added or updated.
      userId - The id of the user that added/updated the sub-asset.
      subassetPath - The path of the sub-asset that was added/updated.
      Returns:
      The corresponding DamEvent
      See Also:
    • subassetRemoved

      public static DamEvent subassetRemoved(String assetPath, String userId, String subassetPath)
      Creates a DamEvent that corresponds to the event of a sub-asset having been removed for an asset.
      Parameters:
      assetPath - The path of the asset for which a sub-asset was removed.
      userId - The id of the user that removed the sub-asset.
      subassetPath - The path of the sub-asset that was removed.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetCreated

      public static DamEvent assetCreated(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset having been created.
      Parameters:
      assetPath - The path of the asset that was just created.
      userId - The id of the user that created the asset.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetMoved

      public static DamEvent assetMoved(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset having been ,pved.
      Parameters:
      assetPath - The path of the asset that was just moved.
      userId - The id of the user that moved the asset.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetRemoved

      public static DamEvent assetRemoved(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset having been removed.
      Parameters:
      assetPath - The path of the asset that was just removed.
      userId - The id of the user that removed the asset.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetExpired

      public static DamEvent assetExpired(String assetPath, String userId, Date expirationDate, String createdBy)
      Creates a DamEvent that corresponds to the event of an asset after expiration. By default expiration date property that is considered is jcr:content/offTime
      Parameters:
      assetPath - The path of the asset that was expired.
      userId - The id of the user that expired the asset.
      expirationDate - The expiration date of the asset.
      createdBy - Creator of the asset
      Returns:
      The corresponding DamEvent
      See Also:
    • assetExpiring

      public static DamEvent assetExpiring(String assetPath, String userId, Date expirationDate, String createdBy)
      Creates a DamEvent that corresponds to the event of an asset getting expired in future. By default expiration date property that is considered is jcr:content/offTime
      Parameters:
      assetPath - The path of the asset that is getting expired.
      userId - The id of the user that expired the asset.
      expirationDate - The expiration date of the asset.
      createdBy - Creator of the asset
      Returns:
      The corresponding DamEvent
      See Also:
    • assetViewed

      public static DamEvent assetViewed(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event upon visiting an asset's detail page.
      Parameters:
      assetPath - The path of the asset whose details were accessed.
      userId - The id of the user that accessed the asset details page.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetShared

      public static DamEvent assetShared(String assetPath, String userId, String additionalInfo)
      Creates a DamEvent that corresponds to the event of an asset being shared on different cloud solutions.
      Parameters:
      assetPath - The path of the asset that was shared.
      userId - The id of the user who shared the asset.
      additionalInfo - Place where this asset was shared.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetPublished

      public static DamEvent assetPublished(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of an asset being published.
      Parameters:
      assetPath - The path of the asset that was published.
      userId - The id of the user that updated the metadata.
      Returns:
      The corresponding DamEvent
      See Also:
    • projectViewed

      public static DamEvent projectViewed(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of a project being viewed.
      Parameters:
      assetPath - The path of the project that was viewed.
      userId - The id of the user who viewed the project.
      Returns:
      The corresponding DamEvent
      See Also:
    • collectionViewed

      public static DamEvent collectionViewed(String assetPath, String userId)
      Creates a DamEvent that corresponds to the event of a collection being viewed.
      Parameters:
      assetPath - The path of the collection that was viewed.
      userId - The id of the user who viewed the collection.
      Returns:
      The corresponding DamEvent
      See Also:
    • addedComment

      public static DamEvent addedComment(String assetPath, String userId, String additionalInfo)
      Creates a DamEvent that corresponds to the event of addidng a commment to an asset.
      Parameters:
      assetPath - The path of the asset which was commented upon.
      userId - The id of the user who commented on the asset.
      additionalInfo - Message of added comment.
      Returns:
      The corresponding DamEvent
      See Also:
    • assetUsage

      public static DamEvent assetUsage(String assetPath, String usageType, Date date)
      Creates a DamEvent that corresponds to the event that asset is used in some solution.
      Parameters:
      assetPath - The path of the asset which was used.
      usageType - defines the type of usage, whether asset is used in collection or some third party solution like Campaign, Social.
      date - The time when asset was used.
      Returns:
      The corresponding DamEvent
      See Also:
    • damUpdateAssetWorkflowCompleted

      public static DamEvent damUpdateAssetWorkflowCompleted(String assetPath)
      Creates a DamEvent that corresponds to the event that DAM update asset workflow is completed.
      Parameters:
      assetPath - The path of the asset on which the DAM update asset workflow executed.
      Returns:
      The corresponding DamEvent
      See Also:
    • damMetadataWritebackWorkflowCompleted

      public static DamEvent damMetadataWritebackWorkflowCompleted(String assetPath)
      Creates a DamEvent that corresponds to the event that DAM metadata writeback workflow is completed.
      Parameters:
      assetPath - The path of the asset on which the DAM metadata writeback workflow executed.
      Returns:
      The corresponding DamEvent
      See Also: