Class DefaultEntityViewContext
java.lang.Object
com.foreach.across.modules.entity.views.context.DefaultEntityViewContext
- All Implemented Interfaces:
ConfigurableEntityViewContext
,EntityViewContext
@Component
@Exposed
@Scope(scopeName="request",
proxyMode=INTERFACES)
public class DefaultEntityViewContext
extends Object
implements ConfigurableEntityViewContext
Default implementation of
ConfigurableEntityViewContext
.
Data bean that is also registered as a request-scoped proxy.- Since:
- 2.0.0
- Author:
- Arne Vandamme
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
com.foreach.across.modules.spring.security.actions.AllowableActions
Get the current entity being viewed as raw object.<T> T
Get the current entity being viewed.If set the parent context will hold the parent entity this entity is associated to.int
hashCode()
boolean
boolean
void
setAllowableActions
(com.foreach.across.modules.spring.security.actions.AllowableActions allowableActions) void
void
setEntityAssociation
(EntityAssociation entityAssociation) void
setEntityConfiguration
(EntityConfiguration entityConfiguration) void
setEntityMessages
(EntityMessages entityMessages) void
setEntityModel
(EntityModel entityModel) void
setLinkBuilder
(EntityViewLinkBuilder linkBuilder) void
setMessageCodeResolver
(EntityMessageCodeResolver messageCodeResolver) void
setParentContext
(EntityViewContext parentContext) void
setPropertyRegistry
(EntityPropertyRegistry propertyRegistry) toString()
-
Constructor Details
-
DefaultEntityViewContext
public DefaultEntityViewContext()
-
-
Method Details
-
setEntityConfiguration
- Specified by:
setEntityConfiguration
in interfaceConfigurableEntityViewContext
-
setEntity
- Specified by:
setEntity
in interfaceConfigurableEntityViewContext
-
getEntityLabel
- Specified by:
getEntityLabel
in interfaceEntityViewContext
- Returns:
- the label for the current entity being viewed
-
getEntity
Description copied from interface:EntityViewContext
Get the current entity being viewed.- Specified by:
getEntity
in interfaceEntityViewContext
- Type Parameters:
T
- type the entity should have- Returns:
- entity or
null
if none present
-
holdsEntity
public boolean holdsEntity()- Specified by:
holdsEntity
in interfaceEntityViewContext
- Returns:
true
if an existing entity is present
-
isForAssociation
public boolean isForAssociation()- Specified by:
isForAssociation
in interfaceEntityViewContext
- Returns:
- true if an association is being viewed, if so both
EntityViewContext.getParentContext()
andEntityViewContext.getEntityAssociation()
should return values
-
setAllowableActions
public void setAllowableActions(com.foreach.across.modules.spring.security.actions.AllowableActions allowableActions) - Specified by:
setAllowableActions
in interfaceConfigurableEntityViewContext
-
getAllowableActions
public com.foreach.across.modules.spring.security.actions.AllowableActions getAllowableActions()- Specified by:
getAllowableActions
in interfaceEntityViewContext
- Returns:
- the allowable actions for this entity view, will either return the allowable actions for the specific entity, or for the general entity configuration if no entity is set
-
toString
-
getEntity
Description copied from interface:EntityViewContext
Get the current entity being viewed as raw object.- Specified by:
getEntity
in interfaceEntityViewContext
- Returns:
- entity or
null
if none present
-
getEntityConfiguration
- Specified by:
getEntityConfiguration
in interfaceEntityViewContext
- Returns:
- the current entity configuration being viewed
-
getLinkBuilder
- Specified by:
getLinkBuilder
in interfaceEntityViewContext
- Returns:
- link builder for the entity
-
getMessageCodeResolver
- Specified by:
getMessageCodeResolver
in interfaceEntityViewContext
- Returns:
- message code resolver for the current entity
-
getEntityMessages
- Specified by:
getEntityMessages
in interfaceEntityViewContext
- Returns:
- generic
EntityMessages
for common views
-
getEntityAssociation
- Specified by:
getEntityAssociation
in interfaceEntityViewContext
- Returns:
- association that is being viewed
-
getParentContext
Description copied from interface:EntityViewContext
If set the parent context will hold the parent entity this entity is associated to.- Specified by:
getParentContext
in interfaceEntityViewContext
- Returns:
- parent context, can be
null
ifEntityViewContext.isForAssociation()
returnsfalse
-
getEntityModel
- Specified by:
getEntityModel
in interfaceEntityViewContext
- Returns:
- the model to use for the current entity
-
getPropertyRegistry
- Specified by:
getPropertyRegistry
in interfaceEntityViewContext
- Returns:
- the
EntityPropertyRegistry
that should be used for this view
-
setLinkBuilder
- Specified by:
setLinkBuilder
in interfaceConfigurableEntityViewContext
-
setMessageCodeResolver
- Specified by:
setMessageCodeResolver
in interfaceConfigurableEntityViewContext
-
setEntityMessages
- Specified by:
setEntityMessages
in interfaceConfigurableEntityViewContext
-
setEntityAssociation
- Specified by:
setEntityAssociation
in interfaceConfigurableEntityViewContext
-
setParentContext
- Specified by:
setParentContext
in interfaceConfigurableEntityViewContext
-
setEntityModel
- Specified by:
setEntityModel
in interfaceConfigurableEntityViewContext
-
setPropertyRegistry
- Specified by:
setPropertyRegistry
in interfaceConfigurableEntityViewContext
-
equals
-
canEqual
-
hashCode
public int hashCode()
-