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 TypeMethodDescriptionvoidauthorizeRequest(EntityViewRequest entityViewRequest) Verify theEntityViewRequestis valid for this factory.createView(EntityViewRequest entityViewRequest) Create theEntityViewfor the given request.voidinitializeCommandObject(EntityViewRequest entityViewRequest, EntityViewCommand command, org.springframework.web.bind.WebDataBinder dataBinder) Initialize theEntityViewCommandfor the given request.voidprepareEntityViewContext(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 anEntityViewRequestthat uses the context. This method is called first, beforeauthorizeRequest(EntityViewRequest)in the default view rendering.- Parameters:
entityViewContext- to modify
-
authorizeRequest
Verify theEntityViewRequestis 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 theEntityViewCommandfor the given request. Optionally configure theWebDataBinderthat 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 theEntityViewfor 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
-