Class AdminOfferController
java.lang.Object
org.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
org.broadleafcommerce.admin.web.controller.entity.AdminOfferController
@Controller("blAdminOfferController")
@RequestMapping("/offer")
public class AdminOfferController
extends AdminBasicEntityController
Handles admin operations for the
Offer
entity. Certain Offer fields should only render when specific values
are set for other fields; we provide the support for that in this controller.- Author:
- Andre Azzolini (apazzolini)
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionaddEntity
(jakarta.servlet.http.HttpServletRequest request, jakarta.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.duplicateEntity
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, EntityForm entityForm, org.springframework.validation.BindingResult result) Deprecated.Moved method to superclassString[]
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 void
modifyModelAttributes
(org.springframework.ui.Model model) Offer field visibility is dependent on other fields in the entity.viewAddEntityForm
(jakarta.servlet.http.HttpServletRequest request, jakarta.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.viewEntityForm
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id) Renders the main entity form for the specified entityviewEntityList
(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) 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.AdminBasicEntityController
addAddActionIfAllowed, addAuditableDisplayField, addAuditableDisplayFields, addCollectionItem, addCollectionItem, addEmptyCollectionItem, addSelectizeCollectionItem, buildAddCollectionItemModel, buildAuditableDisplayField, buildDirtyList, buildSelectizeCustomCriteria, declareShouldIgnoreAdditionStatusFilter, determineEntityType, getCollectionFieldRecords, getCollectionValueDetails, getCurrentFolderId, getCurrentTabName, getCustomCriteria, getErrorDuplicatingResponse, getModalForBlankEntityType, getSelectizeCollectionOptions, getViewSubRecords, initBinder, isAddActionAllowed, isNotReadOnly, modifyEntityForm, reinitializeEntityForm, removeCollectionItem, removeCollectionItem, removeEntity, resolveAppropriateEntityView, saveEntity, 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, 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, modifyAddEntityForm, modifyCriteria, modifyEntityForm, populateJsonValidationErrors, setModelAttributes, setSpecializedNameForFields, translateErrorMessage
Methods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController
addDeepLink, getContextPath, isAjaxRequest, jsonResponse
-
Field Details
-
SECTION_KEY
- See Also:
-
customCriteria
-
offerService
-
-
Constructor Details
-
AdminOfferController
public AdminOfferController()
-
-
Method Details
-
getSectionKey
Description copied from class:AdminAbstractController
This method is used to determine the current section key. For this default implementation, the sectionKey is pulled from the pathVariable, {sectionKey}, as defined by the request mapping on this controller. To support controller inheritance and allow more specialized controllers to delegate some methods to this basic controller, overridden implementations of this method could return a hardcoded value instead of reading the map- Overrides:
getSectionKey
in classAdminAbstractController
- Parameters:
pathVars
- - the map of all currently bound path variables for this request- Returns:
- the sectionKey for this request
-
getSectionCustomCriteria
Description copied from class:AdminAbstractController
This method is invoked for every request for this controller. By default, we do not want to specify a custom criteria, but specialized controllers may want to.- Overrides:
getSectionCustomCriteria
in classAdminAbstractController
- Returns:
- the custom criteria for this section for all requests, if any
-
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, throws ExceptionString> requestParams) Description copied from class:AdminBasicEntityController
Renders the main entity listing for the specified class, which is based on the current sectionKey with some optional criteria.- Overrides:
viewEntityList
in classAdminBasicEntityController
requestParams
- a Map of property name -> list critiera values- Returns:
- the return view path
- Throws:
Exception
-
viewEntityForm
@RequestMapping(value="/{id}", method=GET) public String viewEntityForm(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id) throws ExceptionDescription copied from class:AdminBasicEntityController
Renders the main entity form for the specified entity- Overrides:
viewEntityForm
in classAdminBasicEntityController
- Returns:
- the return view path
- 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 ExceptionDescription copied from class:AdminBasicEntityController
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 classAdminBasicEntityController
- Returns:
- the return view path
- 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") EntityForm entityForm, org.springframework.validation.BindingResult result) throws ExceptionDescription copied from class:AdminBasicEntityController
Processes the request to add a new entity. If successful, returns a redirect to the newly created entity.- Overrides:
addEntity
in classAdminBasicEntityController
- Returns:
- the return view path
- Throws:
Exception
-
duplicateEntity
@Deprecated @RequestMapping(value="/{id}/duplicate", method=POST) public String duplicateEntity(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") EntityForm entityForm, org.springframework.validation.BindingResult result) throws ExceptionDeprecated.Moved method to superclass- Overrides:
duplicateEntity
in classAdminBasicEntityController
- Throws:
Exception
-
modifyModelAttributes
protected void modifyModelAttributes(org.springframework.ui.Model model) Offer field visibility is dependent on other fields in the entity. Mark the form with the appropriate class so that the Javascript will know to handle this form.We also want to tell the UI to make item target criteria required. We cannot manage this at the entity level via an
-