Class ContentField

java.lang.Object
com.broadleafcommerce.content.domain.ContentField
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware, Serializable, Comparable<ContentField>

public class ContentField extends Object implements Serializable, Comparable<ContentField>, com.broadleafcommerce.data.tracking.core.ContextStateAware
Represents the definition of a FieldData. This includes its type and other metadata.
See Also:
  • Field Details

  • Constructor Details

    • ContentField

      public ContentField()
  • Method Details

    • compareTo

      public int compareTo(@NonNull @NonNull @NonNull ContentField o)
      Specified by:
      compareTo in interface Comparable<ContentField>
    • getId

      public String getId()
      A unique id for the field.
      Returns:
      the unique id for the field
    • getContentModel

      public ContentModel getContentModel()
      The content model this content field belongs to
      Returns:
      the content model this field belongs to
    • getLabel

      public String getLabel()
      The friendly display label for this field
      Returns:
      a friendly display label for this field
    • getName

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

      public String getType()
      The type of this content field
      Returns:
      the type of this field
    • getReferenceType

      public String getReferenceType()
      When the `type` is `REFERENCE`, this field holds the type of entity this field links to
      Returns:
      the type of this field's entity reference
    • getAllowedModels

      public List<String> getAllowedModels()
      When the `referenceType` is `CONTENT`, this field holds allowed content models. If empty, allows all.
      Returns:
      the allowed content models this field can reference
    • isAllowRecommendationConfiguration

      public boolean isAllowRecommendationConfiguration()
      Whether this field can source from recommendations.

      Configurable at the ContentItem level. Only Product Reference type field can be configured with recommendations.

      Returns:
      if the field can source from recommendations
    • isCollection

      public boolean isCollection()
      Whether this field represents a collection
      Returns:
      if the field is a collection
    • isRequired

      public boolean isRequired()
      Whether this field is required
      Returns:
      if the field is required
    • getHelpText

      public String getHelpText()
      Help text to display on the field
      Returns:
      help text to display on the field
    • getHint

      public String getHint()
      Hint text to display below the field in the admin
      Returns:
      hint text to display below the field in the admin
    • getDisplayOrder

      public Integer getDisplayOrder()
      The display order of this field in relation to other fields.
      Returns:
      The display order of this field in relation to other fields.
    • isTranslatable

      public boolean isTranslatable()
      Whether the field should be translatable.
      Returns:
      Whether the field should be translatable.
    • getAttributes

      public Map<String,Object> getAttributes()
      Additional attributes needed to further define this field
      Returns:
      additional attributes needed to further define this field
    • 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)
      A unique id for the field.
      Parameters:
      id - the unique id for the field
    • setContentModel

      public void setContentModel(ContentModel contentModel)
      The content model this content field belongs to
      Parameters:
      contentModel - this content field belongs to
    • setLabel

      public void setLabel(String label)
      The friendly display label for this field
      Parameters:
      label - a friendly display label for this field
    • setName

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

      public void setType(String type)
      The type of this content field
      Parameters:
      type - the type of this field
    • setReferenceType

      public void setReferenceType(String referenceType)
      When the `type` is `REFERENCE`, this field holds the type of entity this field links to
      Parameters:
      referenceType - the type of this field's entity reference
    • setAllowedModels

      public void setAllowedModels(List<String> allowedModels)
      When the `referenceType` is `CONTENT`, this field holds allowed content models. If empty, allows all.
      Parameters:
      allowedModels - the allowed content models this field can reference
    • setAllowRecommendationConfiguration

      public void setAllowRecommendationConfiguration(boolean allowRecommendationConfiguration)
      Whether this field can source from recommendations.

      Configurable at the ContentItem level. Only Product Reference type field can be configured with recommendations.

      Parameters:
      allowRecommendationConfiguration - if the field can source from recommendations
    • setCollection

      public void setCollection(boolean collection)
      Whether this field represents a collection
      Parameters:
      isCollection - if the field is a collection
    • setRequired

      public void setRequired(boolean required)
      Whether this field is required
      Parameters:
      required - if the field is required
    • setHelpText

      public void setHelpText(String helpText)
      Help text to display on the field
      Parameters:
      helpText - text to display on the field
    • setHint

      public void setHint(String hint)
      Hint text to display below the field in the admin
      Parameters:
      hint - text to display below the field in the admin
    • setDisplayOrder

      public void setDisplayOrder(Integer displayOrder)
      The display order of this field in relation to other fields.
      Parameters:
      displayOrder - The display order of this field in relation to other fields.
    • setTranslatable

      public void setTranslatable(boolean translatable)
      Whether the field should be translatable.
      Parameters:
      translatable - Whether the field should be translatable.
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      Additional attributes needed to further define this field
      Parameters:
      attributes - additional information used by this field
    • 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
    • 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