|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
@Controller(value="blAdminBasicEntityController")
@RequestMapping(value="/{sectionKey:.+}")
public class AdminBasicEntityController
The default implementation of the #BroadleafAdminAbstractEntityController. This delegates every call to
super and does not provide any custom-tailored functionality. It is responsible for rendering the admin for every
entity that is not explicitly customized by its own controller.
| Field Summary | |
|---|---|
protected SecurityVerifier |
adminRemoteSecurityService
|
protected EntityConfiguration |
entityConfiguration
|
protected EntityFormValidator |
entityValidator
|
protected FormBuilderService |
formService
|
protected AdminEntityService |
service
|
| Fields inherited from class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController |
|---|
adminNavigationService |
| Constructor Summary | |
|---|---|
AdminBasicEntityController()
|
|
| Method Summary | |
|---|---|
String |
addCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
EntityForm entityForm)
Adds the requested collection item |
String |
addEntity(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
EntityForm entityForm,
org.springframework.validation.BindingResult result)
Processes the request to add a new entity. |
protected void |
attachSectionSpecificInfo(PersistencePackageRequest ppr)
A hook method that is invoked every time the getSectionPersistencePackageRequest(String) method is invoked. |
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)
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. |
String |
getCollectionFieldRecords(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
org.springframework.util.MultiValueMap<String,String> requestParams)
Returns the records for a given collectionField filtered by a particular criteria |
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)
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 |
void |
initBinder(org.springframework.web.bind.WebDataBinder binder)
Invoked on every request to provide the ability to register specific binders for Spring's binding process. |
String |
removeCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId)
Removes the requested collection item Note that the request must contain a parameter called "key" when attempting to remove a collection item from a map collection. |
String |
removeEntity(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
EntityForm entityForm,
org.springframework.validation.BindingResult result)
Attempts to remove the given entity. |
String |
saveEntity(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
EntityForm entityForm,
org.springframework.validation.BindingResult result,
org.springframework.web.servlet.mvc.support.RedirectAttributes ra)
Attempts to save the given entity. |
protected void |
setModelAttributes(org.springframework.ui.Model model,
String sectionKey)
Attributes to add to the model on every request |
String |
showAddCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
org.springframework.util.MultiValueMap<String,String> requestParams)
Shows the modal dialog that is used to add an item to a given collection. |
String |
showSelectCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String owningClass,
String collectionField,
org.springframework.util.MultiValueMap<String,String> requestParams)
Shows the modal dialog that is used to select a "to-one" collection item. |
String |
showUpdateCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId)
Shows the appropriate modal dialog to edit the selected collection item |
String |
showViewCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId)
Shows the appropriate modal dialog to view the selected collection item |
protected String |
showViewUpdateCollection(javax.servlet.http.HttpServletRequest request,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId,
String modalHeaderType)
|
String |
updateCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId,
EntityForm entityForm)
Updates the specified collection item |
Map<String,Object> |
updateCollectionItemSequence(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId,
String newSequence)
Updates the given colleciton item's sequence. |
String |
viewAddEntityForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String entityType)
Renders the modal form that is used to add a new parent level entity. |
String |
viewCollectionItemDetails(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String collectionField,
String id)
Shows the modal popup for the current selected "to-one" field. |
String |
viewEntityForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id)
Renders the main entity form for the specified entity |
String |
viewEntityList(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
Map<String,String> pathVars,
org.springframework.util.MultiValueMap<String,String> requestParams)
Renders the main entity listing for the specified class, which is based on the current sectionKey with some optional criteria. |
| Methods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController |
|---|
getContextPath, isAjaxRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected AdminEntityService service
protected FormBuilderService formService
protected EntityConfiguration entityConfiguration
protected EntityFormValidator entityValidator
protected SecurityVerifier adminRemoteSecurityService
| Constructor Detail |
|---|
public AdminBasicEntityController()
| Method Detail |
|---|
@RequestMapping(value="",
method=GET)
public String viewEntityList(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@RequestParam
org.springframework.util.MultiValueMap<String,String> requestParams)
throws Exception
request - response - model - pathVars - criteria - a Map of property name -> list critiera values
Exception
@RequestMapping(value="/add",
method=GET)
public String viewAddEntityForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@RequestParam(defaultValue="")
String entityType)
throws Exception
request - response - model - pathVars - entityType -
Exception
@RequestMapping(value="/add",
method=POST)
public String addEntity(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@ModelAttribute(value="entityForm")
EntityForm entityForm,
org.springframework.validation.BindingResult result)
throws Exception
request - response - model - pathVars - entityForm - result -
Exception
@RequestMapping(value="/{id}",
method=GET)
public String viewEntityForm(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id)
throws Exception
request - response - model - pathVars - id - modal - - whether or not to show the entity in a read-only modal
Exception
@RequestMapping(value="/{id}",
method=POST)
public String saveEntity(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@ModelAttribute(value="entityForm")
EntityForm entityForm,
org.springframework.validation.BindingResult result,
org.springframework.web.servlet.mvc.support.RedirectAttributes ra)
throws Exception
request - response - model - pathVars - id - entityForm - result -
Exception
@RequestMapping(value="/{id}/delete",
method=POST)
public String removeEntity(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@ModelAttribute(value="entityForm")
EntityForm entityForm,
org.springframework.validation.BindingResult result)
throws Exception
request - response - model - pathVars - id -
Exception
@RequestMapping(value="/{owningClass:.*}/{collectionField:.*}/select",
method=GET)
public String showSelectCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="owningClass")
String owningClass,
@PathVariable(value="collectionField")
String collectionField,
@RequestParam
org.springframework.util.MultiValueMap<String,String> requestParams)
throws Exception
request - response - model - pathVars - owningClass - collectionField -
Exception
@RequestMapping(value="/{collectionField:.*}/{id}/view",
method=GET)
public String viewCollectionItemDetails(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="collectionField")
String collectionField,
@PathVariable(value="id")
String id)
throws Exception
request - response - model - pathVars - collectionField - id -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}",
method=GET)
public String getCollectionFieldRecords(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@RequestParam
org.springframework.util.MultiValueMap<String,String> requestParams)
throws Exception
request - response - model - pathVars - collectionField - criteriaForm -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}/add",
method=GET)
public String showAddCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@RequestParam
org.springframework.util.MultiValueMap<String,String> requestParams)
throws Exception
request - response - model - sectionKey - id - collectionField - requestParams -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}/{collectionItemId}",
method=GET)
public String showUpdateCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@PathVariable(value="collectionItemId")
String collectionItemId)
throws Exception
request - response - model - pathVars - id - collectionField - collectionItemId -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}/{collectionItemId}/view",
method=GET)
public String showViewCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@PathVariable(value="collectionItemId")
String collectionItemId)
throws Exception
request - response - model - pathVars - id - collectionField - collectionItemId -
Exception
protected String showViewUpdateCollection(javax.servlet.http.HttpServletRequest request,
org.springframework.ui.Model model,
Map<String,String> pathVars,
String id,
String collectionField,
String collectionItemId,
String modalHeaderType)
throws ServiceException
ServiceException
@RequestMapping(value="/{id}/{collectionField:.*}/add",
method=POST)
public String addCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@ModelAttribute(value="entityForm")
EntityForm entityForm)
throws Exception
request - response - model - pathVars - id - collectionField - entityForm -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}/{collectionItemId}",
method=POST)
public String updateCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@PathVariable(value="collectionItemId")
String collectionItemId,
@ModelAttribute(value="entityForm")
EntityForm entityForm)
throws Exception
request - response - model - pathVars - id - collectionField - entityForm -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}/{collectionItemId}/sequence",
method=POST)
@ResponseBody
public Map<String,Object> updateCollectionItemSequence(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@PathVariable(value="collectionItemId")
String collectionItemId,
@RequestParam(value="newSequence")
String newSequence)
throws Exception
request - response - model - pathVars - id - collectionField - collectionItemId -
Exception
@RequestMapping(value="/{id}/{collectionField:.*}/{collectionItemId}/delete",
method=POST)
public String removeCollectionItem(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
org.springframework.ui.Model model,
@PathVariable
Map<String,String> pathVars,
@PathVariable(value="id")
String id,
@PathVariable(value="collectionField")
String collectionField,
@PathVariable(value="collectionItemId")
String collectionItemId)
throws Exception
request - response - model - pathVars - id - collectionField - collectionItemId -
Exception@InitBinder public void initBinder(org.springframework.web.bind.WebDataBinder binder)
binder -
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 key
ServiceException
protected EntityForm getBlankDynamicFieldTemplateForm(DynamicEntityFormInfo info)
throws ServiceException
info -
ServiceException
protected EntityForm getDynamicFieldTemplateForm(DynamicEntityFormInfo info,
String entityId)
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.
info - entityId -
ServiceExceptionprotected String getSectionKey(Map<String,String> pathVars)
pathVars - - the map of all currently bound path variables for this request
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. 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 named
FilterAndSortCriteria to pass to the fetch#getSortPropertyNames(Map)},
#getSortDirections(Map)}protected Integer getStartIndex(Map<String,List<String>> requestParams)
requestParams -
protected Integer getMaxIndex(Map<String,List<String>> requestParams)
requestParams -
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 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 -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||