org.broadleafcommerce.openadmin.web.controller.entity
Class BroadleafAdminBasicEntityController

java.lang.Object
  extended by org.broadleafcommerce.common.web.controller.BroadleafAbstractController
      extended by org.broadleafcommerce.openadmin.web.controller.BroadleafAdminAbstractController
          extended by org.broadleafcommerce.openadmin.web.controller.entity.BroadleafAdminAbstractEntityController
              extended by org.broadleafcommerce.openadmin.web.controller.entity.BroadleafAdminBasicEntityController

@Controller(value="blAdminBasicEntityController")
@RequestMapping(value="/{sectionKey}")
public class BroadleafAdminBasicEntityController
extends BroadleafAdminAbstractEntityController

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.

Author:
Andre Azzolini (apazzolini)

Field Summary
 
Fields inherited from class org.broadleafcommerce.openadmin.web.controller.entity.BroadleafAdminAbstractEntityController
entityConfiguration, entityValidator, formService, service
 
Fields inherited from class org.broadleafcommerce.openadmin.web.controller.BroadleafAdminAbstractController
adminNavigationService, currentSectionKey
 
Constructor Summary
BroadleafAdminBasicEntityController()
           
 
Method Summary
 String addCollectionItem(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String sectionKey, 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, String sectionKey, EntityForm entityForm, org.springframework.validation.BindingResult result)
           
 String getCollectionFieldRecords(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String sectionKey, String id, String collectionField, CriteriaForm criteriaForm)
          Returns the records for a given collectionField filtered by a particular criteria
 void initBinder(org.springframework.web.bind.WebDataBinder binder)
           
 String removeCollectionItem(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String sectionKey, 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, String sectionKey, 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, String sectionKey, String id, EntityForm entityForm, org.springframework.validation.BindingResult result, org.springframework.web.servlet.mvc.support.RedirectAttributes ra)
          Attempts to save the given entity.
 String showAddCollectionItem(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String sectionKey, String id, String collectionField)
          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, String sectionKey, String collectionField, CriteriaForm criteriaForm)
          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, String sectionKey, String id, String collectionField, String collectionItemId)
           
 String updateCollectionItem(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String sectionKey, String id, String collectionField, String collectionItemId, EntityForm entityForm)
          Updates the specified collection item
 String viewAddEntityForm(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String sectionKey, 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, String sectionKey, 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, String sectionKey, 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, String sectionKey, CriteriaForm criteriaForm)
          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.openadmin.web.controller.entity.BroadleafAdminAbstractEntityController
attachSectionSpecificInfo, getAddEntityTypes, getBlankDynamicFieldTemplateForm, getClassNameForSection, getCollectionListGrid, getDefaultEntityType, getDynamicFieldTemplateForm, getDynamicForm, getSectionCustomCriteria, getSectionPersistencePackageRequest, getSectionPersistencePackageRequest, setModelAttributes
 
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
 

Constructor Detail

BroadleafAdminBasicEntityController

public BroadleafAdminBasicEntityController()
Method Detail

viewEntityList

@RequestMapping(value="",
                method=GET)
public String viewEntityList(javax.servlet.http.HttpServletRequest request,
                                            javax.servlet.http.HttpServletResponse response,
                                            org.springframework.ui.Model model,
                                            @PathVariable
                                            String sectionKey,
                                            @ModelAttribute
                                            CriteriaForm criteriaForm)
                      throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Renders the main entity listing for the specified class, which is based on the current sectionKey with some optional criteria.

Overrides:
viewEntityList in class BroadleafAdminAbstractEntityController
criteriaForm - criteria from the frontend; can be null
Returns:
the return view path
Throws:
Exception

viewAddEntityForm

@RequestMapping(value="/add",
                method=GET)
public String viewAddEntityForm(javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.http.HttpServletResponse response,
                                               org.springframework.ui.Model model,
                                               @PathVariable
                                               String sectionKey,
                                               @RequestParam(defaultValue="")
                                               String entityType)
                         throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Renders the modal form that is used to add a new parent level entity. Note that this form cannot render any subcollections as operations on those collections require the parent level entity to first be saved and have and id. Once the entity is initially saved, we will redirect the user to the normal manage entity screen where they can then perform operations on sub collections.

Overrides:
viewAddEntityForm in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

addEntity

@RequestMapping(value="/add",
                method=POST)
public String addEntity(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response,
                                       org.springframework.ui.Model model,
                                       @PathVariable
                                       String sectionKey,
                                       @ModelAttribute
                                       EntityForm entityForm,
                                       org.springframework.validation.BindingResult result)
                 throws Exception
Overrides:
addEntity in class BroadleafAdminAbstractEntityController
Throws:
Exception

viewEntityForm

@RequestMapping(value="/{id}",
                method=GET)
public String viewEntityForm(javax.servlet.http.HttpServletRequest request,
                                            javax.servlet.http.HttpServletResponse response,
                                            org.springframework.ui.Model model,
                                            @PathVariable
                                            String sectionKey,
                                            @PathVariable
                                            String id)
                      throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Renders the main entity form for the specified entity

Overrides:
viewEntityForm in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

saveEntity

@RequestMapping(value="/{id}",
                method=POST)
public String saveEntity(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        org.springframework.ui.Model model,
                                        @PathVariable
                                        String sectionKey,
                                        @PathVariable
                                        String id,
                                        @ModelAttribute
                                        EntityForm entityForm,
                                        org.springframework.validation.BindingResult result,
                                        org.springframework.web.servlet.mvc.support.RedirectAttributes ra)
                  throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Attempts to save the given entity. If validation is unsuccessful, it will re-render the entity form with error fields highlighted. On a successful save, it will refresh the entity page.

Overrides:
saveEntity in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

removeEntity

@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
                                          String sectionKey,
                                          @PathVariable
                                          String id,
                                          @ModelAttribute
                                          EntityForm entityForm,
                                          org.springframework.validation.BindingResult result)
                    throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Attempts to remove the given entity.

Overrides:
removeEntity in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

showSelectCollectionItem

@RequestMapping(value="/{collectionField}/select",
                method=GET)
public String showSelectCollectionItem(javax.servlet.http.HttpServletRequest request,
                                                      javax.servlet.http.HttpServletResponse response,
                                                      org.springframework.ui.Model model,
                                                      @PathVariable
                                                      String sectionKey,
                                                      @PathVariable
                                                      String collectionField,
                                                      @ModelAttribute
                                                      CriteriaForm criteriaForm)
                                throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Shows the modal dialog that is used to select a "to-one" collection item. For example, this could be used to show a list of categories for the ManyToOne field "defaultCategory" in Product.

Overrides:
showSelectCollectionItem in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

viewCollectionItemDetails

@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
                                                       String sectionKey,
                                                       @PathVariable
                                                       String collectionField,
                                                       @PathVariable
                                                       String id)
                                 throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Shows the modal popup for the current selected "to-one" field. For instance, if you are viewing a list of products then this method is invoked when a user clicks on the name of the default category field.

Overrides:
viewCollectionItemDetails in class BroadleafAdminAbstractEntityController
Returns:
Throws:
Exception

getCollectionFieldRecords

@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
                                                       String sectionKey,
                                                       @PathVariable
                                                       String id,
                                                       @PathVariable
                                                       String collectionField,
                                                       @ModelAttribute
                                                       CriteriaForm criteriaForm)
                                 throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Returns the records for a given collectionField filtered by a particular criteria

Overrides:
getCollectionFieldRecords in class BroadleafAdminAbstractEntityController
Returns:
Throws:
Exception

showAddCollectionItem

@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
                                                   String sectionKey,
                                                   @PathVariable
                                                   String id,
                                                   @PathVariable
                                                   String collectionField)
                             throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Shows the modal dialog that is used to add an item to a given collection. There are several possible outcomes of this call depending on the type of the specified collection field.

showUpdateCollectionItem

@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
                                                      String sectionKey,
                                                      @PathVariable
                                                      String id,
                                                      @PathVariable
                                                      String collectionField,
                                                      @PathVariable
                                                      String collectionItemId)
                                throws Exception
Overrides:
showUpdateCollectionItem in class BroadleafAdminAbstractEntityController
Throws:
Exception

addCollectionItem

@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
                                               String sectionKey,
                                               @PathVariable
                                               String id,
                                               @PathVariable
                                               String collectionField,
                                               @ModelAttribute
                                               EntityForm entityForm)
                         throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Adds the requested collection item

Overrides:
addCollectionItem in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

updateCollectionItem

@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
                                                  String sectionKey,
                                                  @PathVariable
                                                  String id,
                                                  @PathVariable
                                                  String collectionField,
                                                  @PathVariable
                                                  String collectionItemId,
                                                  @ModelAttribute
                                                  EntityForm entityForm)
                            throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
Updates the specified collection item

Overrides:
updateCollectionItem in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

removeCollectionItem

@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
                                                  String sectionKey,
                                                  @PathVariable
                                                  String id,
                                                  @PathVariable
                                                  String collectionField,
                                                  @PathVariable
                                                  String collectionItemId)
                            throws Exception
Description copied from class: BroadleafAdminAbstractEntityController
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.

Overrides:
removeCollectionItem in class BroadleafAdminAbstractEntityController
Returns:
the return view path
Throws:
Exception

initBinder

@InitBinder
public void initBinder(org.springframework.web.bind.WebDataBinder binder)
Overrides:
initBinder in class BroadleafAdminAbstractEntityController


Copyright © 2013. All Rights Reserved.