public abstract class AdminAbstractController extends BroadleafAbstractController
org.broadleafcommerce.openadmin.web.handler.AdminNavigationHandlerMapping
Modifier and Type | Field and Description |
---|---|
protected AdminNavigationService |
adminNavigationService |
protected SecurityVerifier |
adminRemoteSecurityService |
static String |
CURRENT_ADMIN_MODULE_ATTRIBUTE_NAME |
static String |
CURRENT_ADMIN_SECTION_ATTRIBUTE_NAME |
protected EntityConfiguration |
entityConfiguration |
protected EntityFormValidator |
entityFormValidator |
protected AdminAbstractControllerExtensionManager |
extensionManager |
static String |
FILTER_VALUE_SEPARATOR |
static String |
FILTER_VALUE_SEPARATOR_REGEX |
protected FormBuilderService |
formService |
protected MainEntityActionsExtensionManager |
mainEntityActionsExtensionManager
Deprecated.
|
protected AdminEntityService |
service |
Constructor and Description |
---|
AdminAbstractController() |
Modifier and Type | Method and Description |
---|---|
protected void |
attachSectionSpecificInfo(PersistencePackageRequest ppr)
Deprecated.
|
protected void |
attachSectionSpecificInfo(PersistencePackageRequest ppr,
Map<String,String> pathVars)
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 EntityForm |
getBlankDynamicMasterFieldGroupTemplateForm(DynamicEntityFormInfo info) |
protected EntityForm |
getBlankDynamicMasterFieldGroupTemplateForm(DynamicEntityFormInfo info,
EntityForm dynamicFormOverride)
Convenience method to build a blank form for a Master Field Group.
|
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,
List<SectionCrumb> sectionCrumbs)
Convenience method for obtaining a ListGrid DTO object for a collection.
|
protected ListGrid |
getCollectionListGrid(ClassMetadata mainMetadata,
Entity entity,
Property collectionProperty,
org.springframework.util.MultiValueMap<String,String> requestParams,
String sectionKey,
PersistenceResponse persistenceResponse,
List<SectionCrumb> sectionCrumbs)
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 EntityForm |
getEntityForm(DynamicEntityFormInfo info,
EntityForm dynamicFormOverride) |
protected EntityForm |
getEntityForm(String sectionKey,
String sectionClassName,
String id)
Convenience method for obtaining a fully built EntityForm for the given sectionKey, sectionClassName, and id.
|
protected Integer |
getMaxIndex(Map<String,List<String>> requestParams)
Obtains the requested max index parameter
|
protected List<SectionCrumb> |
getSectionCrumbs(javax.servlet.http.HttpServletRequest request,
String currentSection,
String currentSectionId) |
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,
List<SectionCrumb> sectionCrumbs)
Deprecated.
|
protected PersistencePackageRequest |
getSectionPersistencePackageRequest(String sectionClassName,
List<SectionCrumb> sectionCrumbs,
Map<String,String> pathVars)
Returns a PersistencePackageRequest for the given sectionClassName.
|
protected PersistencePackageRequest |
getSectionPersistencePackageRequest(String sectionClassName,
org.springframework.util.MultiValueMap<String,String> requestParams,
List<SectionCrumb> sectionCrumbs)
Deprecated.
|
protected PersistencePackageRequest |
getSectionPersistencePackageRequest(String sectionClassName,
org.springframework.util.MultiValueMap<String,String> requestParams,
List<SectionCrumb> sectionCrumbs,
Map<String,String> pathVars)
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 |
modifyAddEntityForm(EntityForm entityForm,
Map<String,String> pathVars)
This method is invoked whenever an assembled EntityForm is rendered for the add entity screen.
|
protected void |
modifyEntityForm(EntityForm entityForm,
Map<String,String> pathVars)
This method is invoked whenever an assembled EntityForm is rendered.
|
protected void |
setModelAttributes(org.springframework.ui.Model model,
String sectionKey)
Attributes to add to the model on every request
|
addDeepLink, getContextPath, isAjaxRequest, jsonResponse
public static final String FILTER_VALUE_SEPARATOR
public static final String FILTER_VALUE_SEPARATOR_REGEX
public static final String CURRENT_ADMIN_MODULE_ATTRIBUTE_NAME
public static final String CURRENT_ADMIN_SECTION_ATTRIBUTE_NAME
protected AdminEntityService service
protected FormBuilderService formService
protected AdminNavigationService adminNavigationService
protected EntityConfiguration entityConfiguration
protected EntityFormValidator entityFormValidator
protected SecurityVerifier adminRemoteSecurityService
@Deprecated protected MainEntityActionsExtensionManager mainEntityActionsExtensionManager
AdminAbstractControllerExtensionManager
protected AdminAbstractControllerExtensionManager extensionManager
protected EntityForm getEntityForm(String sectionKey, String sectionClassName, String id) throws ServiceException
sectionKey
- sectionClassName
- id
- ServiceException
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, PersistenceResponse persistenceResponse, List<SectionCrumb> sectionCrumbs) 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 ListGrid getCollectionListGrid(ClassMetadata mainMetadata, Entity entity, Property collectionProperty, org.springframework.util.MultiValueMap<String,String> requestParams, String sectionKey, List<SectionCrumb> sectionCrumbs) 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 getBlankDynamicMasterFieldGroupTemplateForm(DynamicEntityFormInfo info) throws ServiceException
info
- ServiceException
getBlankDynamicMasterFieldGroupTemplateForm(DynamicEntityFormInfo, EntityForm)
protected EntityForm getBlankDynamicMasterFieldGroupTemplateForm(DynamicEntityFormInfo info, EntityForm dynamicFormOverride) throws ServiceException
info
- ServiceException
protected EntityForm getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo info, EntityForm dynamicFormOverride) throws ServiceException
info
- ServiceException
protected EntityForm getEntityForm(DynamicEntityFormInfo info, EntityForm dynamicFormOverride) throws ServiceException
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()
@Deprecated protected void attachSectionSpecificInfo(PersistencePackageRequest ppr)
attachSectionSpecificInfo(PersistencePackageRequest, Map)
protected void modifyEntityForm(EntityForm entityForm, Map<String,String> pathVars)
entityForm
- protected void modifyAddEntityForm(EntityForm entityForm, Map<String,String> pathVars)
entityForm
- protected void attachSectionSpecificInfo(PersistencePackageRequest ppr, Map<String,String> pathVars)
#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
- @Deprecated protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName, List<SectionCrumb> sectionCrumbs)
getSectionPersistencePackageRequest(String, List, Map)
protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName, List<SectionCrumb> sectionCrumbs, Map<String,String> pathVars)
getSectionCustomCriteria()
and attachSectionSpecificInfo(PersistencePackageRequest)
to allow
specialized controllers to manipulate the request for every action in this controller.sectionClassName
- sectionCrumbs
- pathVars
- @Deprecated protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName, org.springframework.util.MultiValueMap<String,String> requestParams, List<SectionCrumb> sectionCrumbs)
getSectionPersistencePackageRequest(String, MultiValueMap, List, Map)
protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName, org.springframework.util.MultiValueMap<String,String> requestParams, List<SectionCrumb> sectionCrumbs, Map<String,String> pathVars)
#getSectionPersistencePackageRequest(String)
with the additional filter
and sort criteria attached.sectionClassName
- filterAndSortCriteria
- protected List<SectionCrumb> getSectionCrumbs(javax.servlet.http.HttpServletRequest request, String currentSection, String currentSectionId)
Copyright © 2017. All rights reserved.