public abstract class AdminAbstractController extends BroadleafAbstractController
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 AdminSectionCustomCriteriaService |
customCriteriaService |
static String |
DEFAULT_CONTAINER_VIEW |
protected EntityConfiguration |
entityConfiguration |
protected EntityFormValidator |
entityFormValidator |
protected AdminAbstractControllerExtensionManager |
extensionManager |
static String |
FILTER_VALUE_SEPARATOR |
static String |
FILTER_VALUE_SEPARATOR_REGEX |
protected FilterProductTypePersistenceHandlerExtensionManager |
filterProductTypeExtensionManager |
protected FormBuilderService |
formService |
protected static org.apache.commons.logging.Log |
LOG |
static String |
MODAL_CONTAINER_VIEW |
protected AdminEntityService |
service |
protected ClassNameRequestParamValidationService |
validationService |
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(..) method is invoked.
|
protected SectionCrumb |
createSectionCrumb(String currentSection,
String currentSectionId) |
protected void |
extractDynamicFormFields(ClassMetadata cmd,
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 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) |
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 Long |
getFirstId(Map<String,List<String>> requestParams) |
protected Long |
getLastId(Map<String,List<String>> requestParams) |
protected Integer |
getLowerCount(Map<String,List<String>> requestParams) |
protected Integer |
getMaxIndex(Map<String,List<String>> requestParams)
Obtains the requested max index parameter
|
protected Integer |
getMaxResults(Map<String,List<String>> requestParams)
Obtains the requested max index parameter
|
protected Integer |
getPageSize(Map<String,List<String>> requestParams) |
protected PersistencePackageRequest |
getPersistencePackageRequest(org.springframework.util.MultiValueMap<String,String> requestParams,
Class<?> ceilingEntityClass)
Returns a PersistencePackageRequest for the given sectionClassName.
|
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(..) 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 Integer |
getUpperCount(Map<String,List<String>> requestParams) |
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 |
modifyCriteria(Map<String,FilterAndSortCriteria> fasMap) |
protected void |
modifyEntityForm(EntityForm entityForm,
Map<String,String> pathVars)
This method is invoked whenever an assembled EntityForm is rendered.
|
protected JsonResponse |
populateJsonValidationErrors(EntityForm form,
org.springframework.validation.BindingResult result,
JsonResponse json)
Populates the given json response object based on the given form and result
|
protected void |
setModelAttributes(org.springframework.ui.Model model,
String sectionKey)
Attributes to add to the model on every request
|
protected void |
setSpecializedNameForFields(DynamicEntityFormInfo info,
EntityForm dynamicForm) |
protected String |
translateErrorMessage(org.springframework.validation.ObjectError error) |
addDeepLink, getContextPath, isAjaxRequest, jsonResponse
protected static final org.apache.commons.logging.Log LOG
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
public static final String DEFAULT_CONTAINER_VIEW
public static final String MODAL_CONTAINER_VIEW
protected AdminEntityService service
protected FormBuilderService formService
protected AdminNavigationService adminNavigationService
protected EntityConfiguration entityConfiguration
protected EntityFormValidator entityFormValidator
protected SecurityVerifier adminRemoteSecurityService
protected AdminSectionCustomCriteriaService customCriteriaService
protected AdminAbstractControllerExtensionManager extensionManager
protected ClassNameRequestParamValidationService validationService
protected FilterProductTypePersistenceHandlerExtensionManager filterProductTypeExtensionManager
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 toentity
- collectionProperty
- property that this collection should be based on from the root entityrequestParams
- sectionKey
- the current main section keypersistenceResponse
- sectionCrumbs
- ServiceException
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 toentity
- collectionProperty
- property that this collection should be based on from the root entityrequestParams
- sectionKey
- the current main section keysectionCrumbs
- ServiceException
protected EntityForm getEntityForm(DynamicEntityFormInfo info) throws ServiceException
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
- dynamicFormOverride
- optional dynamic form that already has values to fill outServiceException
protected void setSpecializedNameForFields(DynamicEntityFormInfo info, EntityForm dynamicForm)
protected void extractDynamicFormFields(ClassMetadata cmd, EntityForm entityForm)
cmd
- 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 void modifyCriteria(Map<String,FilterAndSortCriteria> fasMap)
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) throws Exception
entityForm
- Exception
protected void modifyAddEntityForm(EntityForm entityForm, Map<String,String> pathVars)
entityForm
- protected void attachSectionSpecificInfo(PersistencePackageRequest ppr, Map<String,String> pathVars)
ppr
- protected Integer getStartIndex(Map<String,List<String>> requestParams)
requestParams
- protected Integer getMaxIndex(Map<String,List<String>> requestParams)
requestParams
- protected Integer getMaxResults(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 getPersistencePackageRequest(org.springframework.util.MultiValueMap<String,String> requestParams, Class<?> ceilingEntityClass)
getSectionCustomCriteria()
and attachSectionSpecificInfo(PersistencePackageRequest)
to allow
specialized controllers to manipulate the request for every action in this controller.requestParams
- ceilingEntityClass
- protected PersistencePackageRequest getSectionPersistencePackageRequest(String sectionClassName, org.springframework.util.MultiValueMap<String,String> requestParams, List<SectionCrumb> sectionCrumbs, Map<String,String> pathVars)
sectionClassName
- requestParams
- sectionCrumbs
- pathVars
- protected List<SectionCrumb> getSectionCrumbs(javax.servlet.http.HttpServletRequest request, String currentSection, String currentSectionId)
protected SectionCrumb createSectionCrumb(String currentSection, String currentSectionId)
protected JsonResponse populateJsonValidationErrors(EntityForm form, org.springframework.validation.BindingResult result, JsonResponse json)
protected String translateErrorMessage(org.springframework.validation.ObjectError error)
Copyright © 2020. All rights reserved.