Class ContentItem

java.lang.Object
com.broadleafcommerce.content.domain.ContentItem
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable

public class ContentItem extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.ContextStateAware
A domain representing some content that should be displayed on the associated application.
See Also:
  • Constructor Details

    • ContentItem

      public ContentItem()
  • Method Details

    • isActive

      public boolean isActive(@NonNull @NonNull Instant now)
      Determine whether this content is active at the given instant.
      Parameters:
      now - the instant to check if the content is active
      Returns:
      whether this content is active
    • getFullUri

      public String getFullUri()
      Return the full content item URI if the related ContentModel is addressable by URI
      Returns:
      the full content URI
    • getId

      public String getId()
      The system ID of the content item.
      Returns:
      the system ID of the content item
    • getName

      public String getName()
      A unique name for the content item, used for retrieval.
      Returns:
      a unique name for the content item, used for retrieval
    • getUri

      public String getUri()
      SEO-friendly URI to identify this content item. This will be appended to the ContentModel's URI if ContentModel.isAddressableByUri() is true.
      Returns:
      SEO-friendly URI to identify this content item.
    • getModel

      public ContentModel getModel()
      The content model for this content.
      Returns:
      the content model for this content
    • getModelName

      public String getModelName()
      The content model name for this content.
      Returns:
      the content model name for this content
    • getActiveStartDate

      public Instant getActiveStartDate()
      Defines the beginning time for which this content item is active. If both the active start date and the active end date are null, this content item is considered to always be active.
      Returns:
      the beginning time for which this content item is active
      See Also:
    • getActiveEndDate

      @Nullable public Instant getActiveEndDate()
      Defines the ending time for which this content item is active. If the active start date is not null, but the active end date is, the content item is considered to be active forever, starting on the start date.
      Returns:
      the ending time for which this content item is active
      See Also:
    • getFields

      public Map<String,FieldData> getFields()
      The individual field data for this content
      Returns:
      the individual field data for this content
    • getAuthor

      public Author getAuthor()
      Information on the user who created this item.
      Returns:
      Information on the user who created this item.
    • getDisplayRule

      public String getDisplayRule()
      Rule governing when this item can be displayed based on the context. This can be used to restrict this item to only logged in customers or similar restrictions.
      Returns:
      Rule governing when this item can be displayed based on the context.
    • getDisplayOrder

      public Integer getDisplayOrder()
      This item's display order relative to other items. Usually set in post-processing before consumed by the frontend application.
    • getTags

      public List<String> getTags()
      List of simple tags used for filtering and retrieval.
      Returns:
      list of simple tags
    • getEmbedded

      public Boolean getEmbedded()
      Whether this item is considered embedded within another item and should not be retrieved separately.
      Returns:
      if the item is embedded
    • isStarred

      public boolean isStarred()
      Whether this item is starred by a user. This field is typically calculated and not set by external clients.
      Returns:
      if the item is starred
    • getLastUpdated

      public Instant getLastUpdated()
      The date and time that this content item was last modified.
      Returns:
      when this content item was last modified
      See Also:
    • getFolderId

      public String getFolderId()
      The folder ID that this content item belongs to.
      Returns:
      the folder ID that this content item belongs to
    • getContextState

      public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      getContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Returns:
      a subset of Tracking information to expose the context state for this object
    • setId

      public void setId(String id)
      The system ID of the content item.
      Parameters:
      id - the system ID of the content item
    • setName

      public void setName(String name)
      A unique name for the content item, used for retrieval.
      Parameters:
      name - a unique name for the content item, used for retrieval
    • setUri

      public void setUri(String uri)
      SEO-friendly URI to identify this content item. This will be appended to the ContentModel's URI if ContentModel.isAddressableByUri() is true.
      Parameters:
      uri - SEO-friendly URI to identify this content item.
    • setModel

      public void setModel(ContentModel model)
      The content model for this content.
      Parameters:
      model - the content model for this content
    • setModelName

      public void setModelName(String modelName)
      The content model name for this content.
      Parameters:
      modelName - the content model name for this content
    • setActiveStartDate

      public void setActiveStartDate(Instant activeStartDate)
      Defines the beginning time for which this content item is active. If both the active start date and the active end date are null, this content item is considered to always be active.
      Parameters:
      activeStartDate - the beginning time for which this content item is active
      See Also:
    • setActiveEndDate

      public void setActiveEndDate(@Nullable Instant activeEndDate)
      Defines the ending time for which this content item is active. If the active start date is not null, but the active end date is, the content item is considered to be active forever, starting on the start date.
      Parameters:
      activeEndDate - the ending time for which this content item is active
      See Also:
    • setFields

      public void setFields(Map<String,FieldData> fields)
      The individual field data for this content
      Parameters:
      fields - the individual field data for this content
    • setAuthor

      public void setAuthor(Author author)
      Information on the user who created this item.
      Parameters:
      creator - Information on the user who created this item.
    • setDisplayRule

      public void setDisplayRule(String displayRule)
      Rule governing when this item can be displayed based on the context. This can be used to restrict this item to only logged in customers or similar restrictions.
      Parameters:
      displayRule - Rule governing when this item can be displayed based on the context.
    • setDisplayOrder

      public void setDisplayOrder(Integer displayOrder)
      This item's display order relative to other items. Usually set in post-processing before consumed by the frontend application.
    • setTags

      public void setTags(List<String> tags)
      List of simple tags used for filtering and retrieval.
      Parameters:
      tags - list of simple tags
    • setEmbedded

      public void setEmbedded(Boolean embedded)
      Whether this item is considered embedded within another item and should not be retrieved separately.
      Parameters:
      isEmbedded - if this item is embedded in another
    • setStarred

      public void setStarred(boolean starred)
      Whether this item is starred by a user. This field is typically calculated and not set by external clients.
      Parameters:
      isStarred - if this item is starred by a user
    • setLastUpdated

      public void setLastUpdated(Instant lastUpdated)
      The date and time that this content item was last modified.
      Parameters:
      lastUpdated - when this content item was last modified
      See Also:
    • setFolderId

      public void setFolderId(String folderId)
      The folder ID that this content item belongs to.
      Parameters:
      folderId - the folder ID that this content item belongs to
    • setContextState

      public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
      A subset of Tracking information to expose the context state for this object.
      Specified by:
      setContextState in interface com.broadleafcommerce.data.tracking.core.ContextStateAware
      Parameters:
      contextState - a subset of Tracking information to expose the context state for this 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
    • toString

      public String toString()
      Overrides:
      toString in class Object