Class AdminAdvancedPageController

java.lang.Object
org.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
org.broadleafcommerce.cms.admin.web.controller.AdminPageController
com.broadleafcommerce.advancedcms.admin.web.controller.AdminAdvancedPageController

@RequestMapping("/pages/{typeKey}") public class AdminAdvancedPageController extends org.broadleafcommerce.cms.admin.web.controller.AdminPageController
This customization of the AdminPageController will drive the dynamic form fields for a Page based on the PageType associated with the Page instead of the PageTemplate.

Since we are not using the actual "pageTemplate" field from Page but are leveraging the page controller and custom persistence handler, we massage the data necessary in this class to achieve it. For example, the dynamic forms are still driven by the "pageTemplate" field, but the value of the field corresponds to the value of the PageType that is associated instead. We determine this scenario by using the "constructForm-pageType" custom criteria instead of the normal "constructForm" criteria.

Author:
Andre Azzolini (apazzolini)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.broadleafcommerce.theme.service.PageTypeService
     

    Fields inherited from class org.broadleafcommerce.cms.admin.web.controller.AdminPageController

    SECTION_KEY

    Fields inherited from class org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController

    adminUserDao, adornedTargetAutoPopulateExtensionManager, ALTERNATE_ID_PROPERTY, CURRENT_FOLDER_ID, CUSTOM_CRITERIA, duplicator, dynamicEntityDao, genericEntityService, IS_SELECTIZE_REQUEST, LOG, multipleCatalogExtensionManager, rowLevelSecurityService, sandBoxHelper

    Fields inherited from class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController

    adminNavigationService, adminRemoteSecurityService, CURRENT_ADMIN_MODULE_ATTRIBUTE_NAME, CURRENT_ADMIN_SECTION_ATTRIBUTE_NAME, customCriteriaService, DEFAULT_CONTAINER_VIEW, entityConfiguration, entityFormValidator, eps, extensionManager, FILTER_VALUE_SEPARATOR, FILTER_VALUE_SEPARATOR_REGEX, filterProductTypeExtensionManager, formService, MODAL_CONTAINER_VIEW, service, validationService
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addEntity(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String,String> pathVars, org.broadleafcommerce.openadmin.web.form.entity.EntityForm entityForm, org.springframework.validation.BindingResult result)
     
    protected void
    addOnChangeTrigger(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef)
     
    getDynamicForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String,String> pathVars, String propertyName, String propertyTypeId)
     
    protected org.broadleafcommerce.openadmin.web.form.entity.DynamicEntityFormInfo
    getDynamicForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, String id)
     
    protected com.broadleafcommerce.theme.domain.page.PageType
     
    protected String[]
     
    protected String
     
    protected boolean
     
    protected void
    modifyAddEntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, Map<String,String> pathVars)
     
    protected void
    modifyEntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, Map<String,String> pathVars)
     
    protected void
    processPageTypeField(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, com.broadleafcommerce.theme.domain.page.PageType pageType)
     
    saveEntity(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String,String> pathVars, String id, org.broadleafcommerce.openadmin.web.form.entity.EntityForm entityForm, org.springframework.validation.BindingResult result, org.springframework.web.servlet.mvc.support.RedirectAttributes ra)
     
    viewAddEntityForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String,String> pathVars, String entityType)
     
    viewEntityList(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String,String> pathVars, org.springframework.util.MultiValueMap<String,String> requestParams)
     

    Methods inherited from class org.broadleafcommerce.cms.admin.web.controller.AdminPageController

    attachSectionSpecificInfo, viewEntityForm

    Methods inherited from class org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController

    addAddActionIfAllowed, addAuditableDisplayField, addAuditableDisplayFields, addCollectionItem, addCollectionItem, addEmptyCollectionItem, addSelectizeCollectionItem, buildAddCollectionItemModel, buildAuditableDisplayField, buildDirtyList, buildSelectizeCustomCriteria, declareShouldIgnoreAdditionStatusFilter, determineEntityType, duplicateEntity, getCollectionFieldRecords, getCollectionValueDetails, getCurrentFolderId, getCurrentTabName, getCustomCriteria, getErrorDuplicatingResponse, getModalForBlankEntityType, getSelectizeCollectionOptions, getViewSubRecords, initBinder, isAddActionAllowed, isNotReadOnly, modifyEntityForm, postAddSubCollectionEntityHook, postUpdateSubCollectionEntityHook, reinitializeEntityForm, removeCollectionItem, removeCollectionItem, removeEntity, resolveAppropriateEntityView, saveEntityJson, setTypedEntityModelAttributes, setupViewEntityListBasicModel, showAddCollectionItem, showUpdateCollectionItem, showUpdateCollectionItem, showViewCollectionItem, showViewCollectionItem, showViewUpdateCollection, showViewUpdateCollection, showViewUpdateCollection, showViewUpdateCollection, updateCollectionItem, updateCollectionItem, updateCollectionItemSequence, updateCollectionItemSequence, viewCollectionItemDetails, viewCollectionItemTab, viewEntityListSelectize, viewEntityTab, viewReadOnlyCollectionItemTab

    Methods inherited from class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController

    attachSectionSpecificInfo, createSectionCrumb, declareForceUseAdditionStatusFilter, extractDynamicFormFields, getAddEntityTypes, getClassNameForSection, getCollectionListGrid, getCollectionListGrid, getCriteria, getDefaultEntityType, getDynamicFieldTemplateForm, getDynamicForm, getEntityForm, getEntityForm, getEntityForm, getFirstId, getLastId, getLowerCount, getMaxIndex, getMaxResults, getPageSize, getPersistencePackageRequest, getSectionCrumbs, getSectionPersistencePackageRequest, getSectionPersistencePackageRequest, getSectionPersistencePackageRequest, getSectionPersistencePackageRequest, getSortDirections, getSortPropertyNames, getStartIndex, getUpperCount, modifyCriteria, populateJsonValidationErrors, setModelAttributes, setSpecializedNameForFields, translateErrorMessage

    Methods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController

    addDeepLink, getContextPath, isAjaxRequest, jsonResponse

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • pageTypeService

      protected com.broadleafcommerce.theme.service.PageTypeService pageTypeService
  • Constructor Details

    • AdminAdvancedPageController

      public AdminAdvancedPageController()
  • Method Details

    • isBasicPage

      protected boolean isBasicPage(Map<String,String> pathVars)
    • getPageType

      protected com.broadleafcommerce.theme.domain.page.PageType getPageType(Map<String,String> pathVars)
    • getSectionKey

      protected String getSectionKey(Map<String,String> pathVars)
      Overrides:
      getSectionKey in class org.broadleafcommerce.cms.admin.web.controller.AdminPageController
    • getDynamicForm

      protected org.broadleafcommerce.openadmin.web.form.entity.DynamicEntityFormInfo getDynamicForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, String id)
      Overrides:
      getDynamicForm in class org.broadleafcommerce.cms.admin.web.controller.AdminPageController
    • addOnChangeTrigger

      protected void addOnChangeTrigger(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef)
      Overrides:
      addOnChangeTrigger in class org.broadleafcommerce.cms.admin.web.controller.AdminPageController
    • modifyAddEntityForm

      protected void modifyAddEntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, Map<String,String> pathVars)
      Overrides:
      modifyAddEntityForm in class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
    • modifyEntityForm

      protected void modifyEntityForm(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, Map<String,String> pathVars)
      Overrides:
      modifyEntityForm in class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
    • processPageTypeField

      protected void processPageTypeField(org.broadleafcommerce.openadmin.web.form.entity.EntityForm ef, com.broadleafcommerce.theme.domain.page.PageType pageType)
    • viewEntityList

      @RequestMapping(value="", method=GET) public String viewEntityList(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @RequestParam org.springframework.util.MultiValueMap<String,String> requestParams) throws Exception
      Overrides:
      viewEntityList in class org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
      Throws:
      Exception
    • viewAddEntityForm

      @RequestMapping(value="/add", method=GET) public String viewAddEntityForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @RequestParam(defaultValue="") String entityType) throws Exception
      Overrides:
      viewAddEntityForm in class org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
      Throws:
      Exception
    • addEntity

      @RequestMapping(value="/add", method=POST) public String addEntity(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @ModelAttribute("entityForm") org.broadleafcommerce.openadmin.web.form.entity.EntityForm entityForm, org.springframework.validation.BindingResult result) throws Exception
      Overrides:
      addEntity in class org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
      Throws:
      Exception
    • saveEntity

      @RequestMapping(value="/{id}", method=POST) public String saveEntity(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @PathVariable("id") String id, @ModelAttribute("entityForm") org.broadleafcommerce.openadmin.web.form.entity.EntityForm entityForm, org.springframework.validation.BindingResult result, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) throws Exception
      Overrides:
      saveEntity in class org.broadleafcommerce.cms.admin.web.controller.AdminPageController
      Throws:
      Exception
    • getDynamicForm

      @RequestMapping(value="/{propertyName}/dynamicForm", method=GET) public String getDynamicForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String,String> pathVars, @PathVariable("propertyName") String propertyName, @RequestParam("propertyTypeId") String propertyTypeId) throws Exception
      Overrides:
      getDynamicForm in class org.broadleafcommerce.cms.admin.web.controller.AdminPageController
      Throws:
      Exception
    • getSectionCustomCriteria

      protected String[] getSectionCustomCriteria()
      Overrides:
      getSectionCustomCriteria in class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController