public abstract class AdminAbstractController extends BroadleafAbstractController
AdminNavigationHandlerMapping
Modifier and Type | Field and Description |
---|---|
protected AdminNavigationService |
adminNavigationService |
protected SecurityVerifier |
adminRemoteSecurityService |
protected EntityConfiguration |
entityConfiguration |
protected EntityFormValidator |
entityFormValidator |
static String |
FILTER_VALUE_SEPARATOR |
static String |
FILTER_VALUE_SEPARATOR_REGEX |
protected FormBuilderService |
formService |
protected MainEntityActionsExtensionManager |
mainEntityActionsExtensionManager |
protected AdminEntityService |
service |
Constructor and Description |
---|
AdminAbstractController() |
Modifier and Type | Method and Description |
---|---|
protected void |
attachSectionSpecificInfo(PersistencePackageRequest ppr)
A hook method that is invoked every time the
getSectionPersistencePackageRequest(String) method is invoked. |
protected void |
extractDynamicFormFields(EntityForm entityForm)
This method will scan the entityForm for all dynamic form fields and pull them out
as appropriate.
|
protected List<ClassTree> |
getAddEntityTypes(ClassTree classTree)
If there are certain types of entities that should not be allowed to be created, an override of this method would be
able to specify that.
|
protected EntityForm |
getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo info) |
protected EntityForm |
getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo info,
EntityForm dynamicFormOverride)
Convenience method for obtaining a blank dynamic field template form.
|
protected String |
getClassNameForSection(String sectionKey)
Gets the fully qualified ceiling entity classname for this section.
|
protected ListGrid |
getCollectionListGrid(ClassMetadata mainMetadata,
Entity entity,
Property collectionProperty,
org.springframework.util.MultiValueMap<String,String> requestParams,
String sectionKey)
Convenience method for obtaining a ListGrid DTO object for a collection.
|
protected FilterAndSortCriteria[] |
getCriteria(Map<String,List<String>> requestParams)
Helper method to return an array of
FilterAndSortCriteria based on a map of propertyName -> list of criteria
value. |
protected String |
getDefaultEntityType()
This method is called when attempting to add new entities that have a polymorphic tree.
|
protected EntityForm |
getDynamicFieldTemplateForm(DynamicEntityFormInfo info,
String entityId,
EntityForm dynamicFormOverride)
Convenience method for obtaining a dynamic field template form for a particular entity.
|
protected String |
getDynamicForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
DynamicEntityFormInfo info)
Returns a partial representing a dynamic form.
|
protected Integer |
getMaxIndex(Map<String,List<String>> requestParams)
Obtains the requested max index parameter
|
protected String[] |
getSectionCustomCriteria()
This method is invoked for every request for this controller.
|
protected String |
getSectionKey(Map<String,String> pathVars)
This method is used to determine the current section key.
|
protected PersistencePackageRequest |
getSectionPersistencePackageRequest(String sectionClassName)
Returns a PersistencePackageRequest for the given sectionClassName.
|
protected PersistencePackageRequest |
getSectionPersistencePackageRequest(String sectionClassName,
org.springframework.util.MultiValueMap<String,String> requestParams)
Returns the result of a call to
getSectionPersistencePackageRequest(String) with the additional filter
and sort criteria attached. |
protected List<String> |
getSortDirections(Map<String,List<String>> requestParams)
Obtains the list of sort directions from the bound request parameters.
|
protected List<String> |
getSortPropertyNames(Map<String,List<String>> requestParams)
Obtains the list of property names to sort on from the bound request parameters.
|
protected Integer |
getStartIndex(Map<String,List<String>> requestParams)
Obtains the requested start index parameter
|
protected void |
setModelAttributes(org.springframework.ui.Model model,
String sectionKey)
Attributes to add to the model on every request
|
getContextPath, isAjaxRequest
public static final String FILTER_VALUE_SEPARATOR
public static final String FILTER_VALUE_SEPARATOR_REGEX
protected AdminEntityService service
protected FormBuilderService formService
protected AdminNavigationService adminNavigationService
protected EntityConfiguration entityConfiguration
protected EntityFormValidator entityFormValidator
protected SecurityVerifier adminRemoteSecurityService
protected MainEntityActionsExtensionManager mainEntityActionsExtensionManager
protected String getDynamicForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String,String> pathVars, DynamicEntityFormInfo info) throws Exception
request
- response
- model
- pathVars
- info
- Exception
protected ListGrid getCollectionListGrid(ClassMetadata mainMetadata, Entity entity, Property collectionProperty, org.springframework.util.MultiValueMap<String,String> requestParams, String sectionKey) throws ServiceException
mainMetadata
- class metadata for the root entity that this collectionProperty relates toid
- foreign key from the root entity for collectionPropertycollectionProperty
- property that this collection should be based on from the root entityform
- the criteria form model attributesectionKey
- the current main section keyServiceException
protected EntityForm getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo info) throws ServiceException
info
- ServiceException
getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo, EntityForm)
protected EntityForm getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo info, EntityForm dynamicFormOverride) throws ServiceException
info
- ServiceException
protected EntityForm getDynamicFieldTemplateForm(DynamicEntityFormInfo info, String entityId, EntityForm dynamicFormOverride) throws ServiceException
getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo)
in that it will fill out the current values for
the fields in this dynamic form from the database. This method is invoked when the initial view of a page containing
a dynamic form is triggered.
Optionally, you can pass in a pre-existing dynamic form to this method that already has updated values. Example usage
would be for after validation has failed and you do not want to lookup old values from the database again.info
- entityId
- dynamicForm
- optional dynamic form that already has values to fill outServiceException
protected void extractDynamicFormFields(EntityForm entityForm)
entityForm
- protected String getSectionKey(Map<String,String> pathVars)
pathVars
- - the map of all currently bound path variables for this requestprotected FilterAndSortCriteria[] getCriteria(Map<String,List<String>> requestParams)
Helper method to return an array of FilterAndSortCriteria
based on a map of propertyName -> list of criteria
value. This will also grab the sorts off of the request parameters, if any.
The multi-valued map allows users to specify multiple criteria values per property, as well as multiple sort
properties and sort directions. For multiple sort properties and sort directions, these would usually come in as
request parameters like:
....?sortProperty=defaultSku.name&sortProperty=manufacturer&sortDirection=ASCENDING&sortDirection=DESCENDING
This would attach criteria such that defaultSku.name was sorted ascending, and manufacturer was sorted descending
requestParams
- usually a MultiValueMap
that has been bound by a controller to receive all of the
request parameters that are not explicitly namedFilterAndSortCriteria
to pass to the fetch#getSortPropertyNames(Map)}
,
#getSortDirections(Map)}
protected List<String> getSortDirections(Map<String,List<String>> requestParams)
getSortPropertyNames(Map)
requestParams
- protected List<String> getSortPropertyNames(Map<String,List<String>> requestParams)
getSortDirections(Map)
.requestParams
- protected String getClassNameForSection(String sectionKey)
sectionKey
- protected List<ClassTree> getAddEntityTypes(ClassTree classTree)
classTree
- protected String getDefaultEntityType()
protected String[] getSectionCustomCriteria()
protected void attachSectionSpecificInfo(PersistencePackageRequest ppr)
getSectionPersistencePackageRequest(String)
method is invoked.
This allows specialized controllers to hook into every request and manipulate the persistence package request as
desired.ppr
- protected Integer getStartIndex(Map<String,List<String>> requestParams)
requestParams
- protected Integer getMaxIndex(Map<String,List<String>> requestParams)
requestParams
- protected void setModelAttributes(org.springframework.ui.Model model, String sectionKey)
model
- sectionKey
- protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName)
getSectionCustomCriteria()
and attachSectionSpecificInfo(PersistencePackageRequest)
to allow
specialized controllers to manipulate the request for every action in this controller.sectionClassName
- protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName, org.springframework.util.MultiValueMap<String,String> requestParams)
getSectionPersistencePackageRequest(String)
with the additional filter
and sort criteria attached.sectionClassName
- filterAndSortCriteria
- Copyright © 2014. All rights reserved.