public abstract class WebCmsComponentModel extends Object implements com.foreach.across.modules.web.ui.ViewElement, WebCmsObject, WebCmsDomainBound
WebCmsComponent entity.com.foreach.across.modules.web.ui.ViewElement.Wither<T extends com.foreach.across.modules.web.ui.ViewElement>, com.foreach.across.modules.web.ui.ViewElement.WitherGetter<T extends com.foreach.across.modules.web.ui.ViewElement,U>, com.foreach.across.modules.web.ui.ViewElement.WitherRemover<T extends com.foreach.across.modules.web.ui.ViewElement>, com.foreach.across.modules.web.ui.ViewElement.WitherSetter<T extends com.foreach.across.modules.web.ui.ViewElement>| Modifier and Type | Field and Description |
|---|---|
static String |
METADATA_CLASS_ATTRIBUTE
Common attribute used to specify the fully qualified class name of the metadata for a particular component type.
|
static String |
TEMPLATE_ATTRIBUTE
Common attribute used to specify the (Thymeleaf) template that should be used to render components of that type.
|
static String |
TYPE_ATTRIBUTE
Common attribute used to specify the base type of the component type.
|
| Modifier | Constructor and Description |
|---|---|
protected |
WebCmsComponentModel()
Deprecated.
|
protected |
WebCmsComponentModel(WebCmsComponent component) |
protected |
WebCmsComponentModel(WebCmsComponentModel template)
Base constructor for
asComponentTemplate() calls, uses the parent component as template
and attempts to convert the metadata to a new instance. |
protected |
WebCmsComponentModel(WebCmsComponentType componentType) |
| Modifier and Type | Method and Description |
|---|---|
abstract WebCmsComponentModel |
asComponentTemplate()
Convert the current model to a templated version: keep all properties but create a new backing component.
|
protected static Object |
cloneMetadata(WebCmsComponentModel componentModel)
Attempt to forcibly clone the metadata of a
WebCmsComponentModel. |
boolean |
equals(Object o) |
WebCmsComponentType |
getComponentType() |
String |
getCustomTemplate()
Implements
ViewElement.getCustomTemplate(). |
WebCmsDomain |
getDomain() |
String |
getElementType() |
<V extends U,U> |
getMetadata(Class<U> metadataType)
Coerce the metadata to the type specified.
|
String |
getName() |
String |
getObjectId() |
String |
getOwnerObjectId() |
int |
getSortIndex() |
String |
getTitle() |
int |
hashCode() |
boolean |
hasMetadata() |
boolean |
hasOwner() |
abstract boolean |
isEmpty()
Base implementation that can be used to check if the component contains any relevant data.
|
boolean |
isNew() |
void |
setComponent(@NonNull WebCmsComponent component)
Set the original component backing this model, can never be
null. |
void |
setDomain(WebCmsDomain domain)
Set the
WebCmsDomain this entity belongs to. |
void |
setName(String name)
Set the name on the backing component.
|
void |
setObjectId(String objectId)
Set the unique object id of the backing component
|
void |
setOwner(WebCmsObject owner)
Set the owner object of the backing component.
|
void |
setOwnerObjectId(String ownerObjectId)
Set the owner object id of the backing component.
|
void |
setSortIndex(int sortIndex) |
void |
setTitle(String title)
Set the title on the backing component.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitget, matches, predicateFor, remove, set, withforObjectIdpublic static final String TYPE_ATTRIBUTE
public static final String TEMPLATE_ATTRIBUTE
public static final String METADATA_CLASS_ATTRIBUTE
@Deprecated protected WebCmsComponentModel()
protected WebCmsComponentModel(WebCmsComponentType componentType)
protected WebCmsComponentModel(WebCmsComponentModel template)
asComponentTemplate() calls, uses the parent component as template
and attempts to convert the metadata to a new instance.protected WebCmsComponentModel(WebCmsComponent component)
public String getCustomTemplate()
ViewElement.getCustomTemplate(). This method returns the custom template that should be used
for rendering this component model. If none is configured using #setRenderTemplate(String), the template set
as TEMPLATE_ATTRIBUTE attribute on the WebCmsComponentType will be used.getCustomTemplate in interface com.foreach.across.modules.web.ui.ViewElementrenderTemplatepublic boolean hasMetadata()
public <V extends U,U> V getMetadata(Class<U> metadataType)
public void setComponent(@NonNull
@NonNull WebCmsComponent component)
null.
If you want to create a new instance with all settings but remove the attachment
to the original component, use asComponentTemplate().component - that backs this modelpublic WebCmsComponentType getComponentType()
public String getObjectId()
getObjectId in interface WebCmsObjectpublic void setObjectId(String objectId)
objectId - to usepublic String getOwnerObjectId()
public void setOwner(WebCmsObject owner)
owner - instancepublic void setOwnerObjectId(String ownerObjectId)
ownerObjectId - to usepublic boolean hasOwner()
public void setTitle(String title)
title - to usepublic String getTitle()
public String getName()
getName in interface com.foreach.across.modules.web.ui.ViewElementpublic void setName(String name)
name - to usepublic int getSortIndex()
public void setSortIndex(int sortIndex)
sortIndex - of the component in its owner scopepublic WebCmsDomain getDomain()
getDomain in interface WebCmsDomainBoundpublic void setDomain(WebCmsDomain domain)
WebCmsDomainBoundWebCmsDomain this entity belongs to.setDomain in interface WebCmsDomainBounddomain - of the component in its owner scopepublic final String getElementType()
getElementType in interface com.foreach.across.modules.web.ui.ViewElementpublic final boolean isNew()
isNew in interface WebCmsObjectpublic abstract WebCmsComponentModel asComponentTemplate()
WebCmsComponent.asTemplate(),
cloneMetadata(WebCmsComponentModel)public abstract boolean isEmpty()
true if no relevant data is presentprotected static Object cloneMetadata(WebCmsComponentModel componentModel)
WebCmsComponentModel.
Throws an exception if impossible.componentModel - to clone the metadata fromDtoUtils,
EntityWithDtoCopyright © 2020. All rights reserved.