Class StructuredContentImpl
java.lang.Object
org.broadleafcommerce.cms.structure.domain.StructuredContentImpl
- All Implemented Interfaces:
Serializable
,StructuredContent
,AdminMainEntity
,MultiTenantCloneable<StructuredContent>
,ProfileEntity
@Entity
public class StructuredContentImpl
extends Object
implements StructuredContent, AdminMainEntity, ProfileEntity
Created by bpolster.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected Long
protected Locale
protected Boolean
protected Integer
protected Set<StructuredContentItemCriteria>
static final String
protected Map<String,
StructuredContentFieldXref> protected StructuredContentType
Fields inherited from interface org.broadleafcommerce.common.admin.domain.AdminMainEntity
MAIN_ENTITY_NAME_PROPERTY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<G extends StructuredContent>
CreateResponse<G>Clone this entity for the purpose of multiple tenancy.Gets the name.getFieldValue
(String fieldName) Returns the value of the associatedStructuredContentField
if the given fieldName exists in the map returned byStructuredContent.getStructuredContentFieldXrefs()
, and null otherwise.getId()
Gets the primary key.Gets theLocale
associated with this content item.Returns the offlineFlag.Gets the integer priority of this content item.NOTE: This method is typically only used when wanting to persist newStructuredContentField
s.Gets theStructuredContentType
associated with this content item.void
setContentName
(String contentName) Sets the name.void
setFieldValues
(Map<String, String> fieldValuesMap) Sets the transient fieldValues map on this StructuredContent.void
Sets the primary key.void
Sets the locale associated with this content item.void
setOfflineFlag
(Boolean offlineFlag) Sets the offline flag.void
setPriority
(Integer priority) Sets the display priority of this item.void
setQualifyingItemCriteria
(Set<StructuredContentItemCriteria> qualifyingItemCriteria) void
setStructuredContentFieldXrefs
(Map<String, StructuredContentFieldXref> structuredContentFields) Sets the structured content fields for this item.void
setStructuredContentMatchRules
(Map<String, StructuredContentRule> structuredContentMatchRules) void
setStructuredContentType
(StructuredContentType structuredContentType) Sets theStructuredContentType
associated with this content item.
-
Field Details
-
SC_DONT_DUPLICATE_SC_TYPE_HINT
- See Also:
-
id
-
contentName
-
locale
-
priority
-
qualifyingItemCriteria
-
structuredContentType
-
structuredContentFields
-
offlineFlag
-
fieldValuesMap
-
-
Constructor Details
-
StructuredContentImpl
public StructuredContentImpl()
-
-
Method Details
-
getId
Description copied from interface:StructuredContent
Gets the primary key.- Specified by:
getId
in interfaceStructuredContent
- Returns:
- the primary key
-
setId
Description copied from interface:StructuredContent
Sets the primary key.- Specified by:
setId
in interfaceStructuredContent
- Parameters:
id
- the new primary key
-
getContentName
Description copied from interface:StructuredContent
Gets the name.- Specified by:
getContentName
in interfaceStructuredContent
- Returns:
- the name
-
setContentName
Description copied from interface:StructuredContent
Sets the name.- Specified by:
setContentName
in interfaceStructuredContent
-
getLocale
Description copied from interface:StructuredContent
Gets theLocale
associated with this content item.- Specified by:
getLocale
in interfaceStructuredContent
- Returns:
-
setLocale
Description copied from interface:StructuredContent
Sets the locale associated with this content item.- Specified by:
setLocale
in interfaceStructuredContent
-
getStructuredContentType
Description copied from interface:StructuredContent
Gets theStructuredContentType
associated with this content item.- Specified by:
getStructuredContentType
in interfaceStructuredContent
- Returns:
-
setStructuredContentType
Description copied from interface:StructuredContent
Sets theStructuredContentType
associated with this content item.- Specified by:
setStructuredContentType
in interfaceStructuredContent
-
getStructuredContentFieldXrefs
Description copied from interface:StructuredContent
NOTE: This method is typically only used when wanting to persist newStructuredContentField
s. Users trying to get a field to render should typically invokeStructuredContent.getFieldValues()
.Gets a map with the custom fields associated with this content item.
The map keys are based on the field types. For example, consider a content item with aStructuredContentType
of ad which defined a field named targetUrl. The field could be accessed withstructuredContentItem.getStructuredContentFields().get("targetUrl")
- Specified by:
getStructuredContentFieldXrefs
in interfaceStructuredContent
- Returns:
-
setStructuredContentFieldXrefs
public void setStructuredContentFieldXrefs(@Nullable Map<String, StructuredContentFieldXref> structuredContentFields) Description copied from interface:StructuredContent
Sets the structured content fields for this item. Would not typically be called outside of the ContentManagementSystem.- Specified by:
setStructuredContentFieldXrefs
in interfaceStructuredContent
-
getFieldValue
Description copied from interface:StructuredContent
Returns the value of the associatedStructuredContentField
if the given fieldName exists in the map returned byStructuredContent.getStructuredContentFieldXrefs()
, and null otherwise.- Specified by:
getFieldValue
in interfaceStructuredContent
- Returns:
- the value of the given field
-
getFieldValues
- Specified by:
getFieldValues
in interfaceStructuredContent
- Returns:
- a map of
StructuredContentField
field key names to their associated values
-
setFieldValues
Description copied from interface:StructuredContent
Sets the transient fieldValues map on this StructuredContent.- Specified by:
setFieldValues
in interfaceStructuredContent
-
getOfflineFlag
Description copied from interface:StructuredContent
Returns the offlineFlag. Indicates that the item should no longer appear on the site. The item will still appear within the content administration program but no longer be returned as part of the client facing APIs.- Specified by:
getOfflineFlag
in interfaceStructuredContent
- Returns:
- true if this item is offline
-
setOfflineFlag
Description copied from interface:StructuredContent
Sets the offline flag.- Specified by:
setOfflineFlag
in interfaceStructuredContent
-
getPriority
Description copied from interface:StructuredContent
Gets the integer priority of this content item. Items with a lower priority should be displayed before items with a higher priority.- Specified by:
getPriority
in interfaceStructuredContent
- Returns:
- the priority as a numeric value
-
setPriority
Description copied from interface:StructuredContent
Sets the display priority of this item. Lower priorities should be displayed first.- Specified by:
setPriority
in interfaceStructuredContent
-
getStructuredContentMatchRules
- Specified by:
getStructuredContentMatchRules
in interfaceStructuredContent
- Returns:
-
setStructuredContentMatchRules
public void setStructuredContentMatchRules(Map<String, StructuredContentRule> structuredContentMatchRules) - Specified by:
setStructuredContentMatchRules
in interfaceStructuredContent
-
getQualifyingItemCriteria
- Specified by:
getQualifyingItemCriteria
in interfaceStructuredContent
- Returns:
-
setQualifyingItemCriteria
- Specified by:
setQualifyingItemCriteria
in interfaceStructuredContent
-
getMainEntityName
- Specified by:
getMainEntityName
in interfaceAdminMainEntity
- Returns:
- the display name of this entity for the admin screen
-
createOrRetrieveCopyInstance
public <G extends StructuredContent> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException Description copied from interface:MultiTenantCloneable
Clone this entity for the purpose of multiple tenancy. Note, extending classes should follow this pattern:public CreateResponse<MyClass> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException { CreateResponse<MyClass> createResponse = super.createOrRetrieveCopyInstance(context); if (createResponse.isAlreadyPopulated()) { return createResponse; } MyClass myClone = createResponse.getClone();
Support should also be added for @Embeddable classes that contribute fields (collections or basic) to a cloneable entity://copy extended field values on myClone here
return createResponse; }
public CreateResponse<G extends MyClass> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException { CreateResponse
createResponse = context.createOrRetrieveCopyInstance(this); MyClass myClone = createResponse.getClone(); //copy extended field values on myClone here
return createResponse; }
- Specified by:
createOrRetrieveCopyInstance
in interfaceMultiTenantCloneable<StructuredContent>
- Parameters:
context
- a context object providing persistence and library functionality for copying entities- Returns:
- the resulting copy container, possibly already persisted
- Throws:
CloneNotSupportedException
- if there's a problem detected with the cloning configuration
-