Interface EntityViewFactory
- All Superinterfaces:
com.foreach.across.core.support.ReadableAttributes
- All Known Subinterfaces:
DispatchingEntityViewFactory
- All Known Implementing Classes:
DefaultEntityViewFactory
public interface EntityViewFactory
extends com.foreach.across.core.support.ReadableAttributes
Central API for building custom entity views using the generic controllers.
For correct assembly of a view, the methods of the EntityViewFactory are expected to be called in specific order:
- Since:
- 2.0.0
- Author:
- Arne Vandamme
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
authorizeRequest
(EntityViewRequest entityViewRequest) Verify theEntityViewRequest
is valid for this factory.createView
(EntityViewRequest entityViewRequest) Create theEntityView
for the given request.void
initializeCommandObject
(EntityViewRequest entityViewRequest, EntityViewCommand command, org.springframework.web.bind.WebDataBinder dataBinder) Initialize theEntityViewCommand
for the given request.void
prepareEntityViewContext
(ConfigurableEntityViewContext entityViewContext) Apply possible factory modifications to theConfigurableEntityViewContext
.Methods inherited from interface com.foreach.across.core.support.ReadableAttributes
attributeMap, attributeNames, getAttribute, getAttribute, getAttribute, hasAttribute, hasAttribute
-
Method Details
-
prepareEntityViewContext
Apply possible factory modifications to theConfigurableEntityViewContext
. Call this method before creating anEntityViewRequest
that uses the context. This method is called first, beforeauthorizeRequest(EntityViewRequest)
in the default view rendering.- Parameters:
entityViewContext
- to modify
-
authorizeRequest
Verify theEntityViewRequest
is valid for this factory. This usually means things like performing security checks and checking all individual properties are valid. Any invalid requests are expected to throw the most relevant exceptions. Called afterprepareEntityViewContext(ConfigurableEntityViewContext)
but before initializing the command object.- Parameters:
entityViewRequest
- request to validate
-
initializeCommandObject
void initializeCommandObject(EntityViewRequest entityViewRequest, EntityViewCommand command, org.springframework.web.bind.WebDataBinder dataBinder) Initialize theEntityViewCommand
for the given request. Optionally configure theWebDataBinder
that will be used to bind the command object. Called afterauthorizeRequest(EntityViewRequest)
but before data binding.- Parameters:
entityViewRequest
- requestcommand
- objectdataBinder
- to bind the web request to the command
-
createView
Create theEntityView
for the given request. This will execute the controller logic and will build all view elements required. This method requires a valid request and a fully initialized/bound command object.- Parameters:
entityViewRequest
- request- Returns:
- view created
-