Class AdminBasicEntityController
java.lang.Object
org.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
org.broadleafcommerce.openadmin.web.controller.entity.AdminBasicEntityController
- Direct Known Subclasses:
AdminAssetController
,AdminCategoryController
,AdminFieldController
,AdminOfferController
,AdminOrderController
,AdminPageController
,AdminProductController
,AdminStructuredContentController
,AdminUserManagementController
@Controller("blAdminBasicEntityController")
@RequestMapping("/{sectionKey:.+}")
public class AdminBasicEntityController
extends AdminAbstractController
The default implementation of the
AdminAbstractController
. 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), Jeff Fischer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AdminUserDao
static final String
protected static final String
static final String
protected EntityDuplicator
protected DynamicEntityDao
protected GenericEntityService
static final String
protected static final org.apache.commons.logging.Log
protected MultipleCatalogExtensionManager
protected RowLevelSecurityService
protected 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 TypeMethodDescriptionprotected void
addAddActionIfAllowed
(String sectionClassName, ClassMetadata cmd, List<EntityFormAction> mainActions) Adds the "Add" button to the main entity form if the current user has permissions to create new instances of the entity and all of the fields in the entity aren't marked as read only.protected void
addAuditableDisplayField
(EntityForm entityForm, Field userField) void
addAuditableDisplayFields
(EntityForm entityForm) addCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId) addCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, EntityForm entityForm, org.springframework.validation.BindingResult result) Adds the requested collection itemaddEmptyCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, EntityForm entityForm, org.springframework.validation.BindingResult result) addEntity
(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.addSelectizeCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, EntityForm entityForm, org.springframework.validation.BindingResult result) Adds the requested collection item via Selectizeprotected String
buildAddCollectionItemModel
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String id, String collectionField, String sectionKey, Property collectionProperty, FieldMetadata md, PersistencePackageRequest ppr, EntityForm entityForm, Entity entity) Builds out all of the model information needed for showing the add modal for collection items on both the initial GET as well as after a POST with validation errorsprotected Field
buildAuditableDisplayField
(Field auditableField) buildDirtyList
(Map<String, String> pathVars, jakarta.servlet.http.HttpServletRequest request, String id) protected String[]
protected void
protected String
determineEntityType
(String entityType, ClassMetadata cmd) 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) getCollectionFieldRecords
(jakarta.servlet.http.HttpServletRequest request, jakarta.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 criteriagetCollectionValueDetails
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String collectionField, String ids, org.springframework.util.MultiValueMap<String, String> requestParams) protected String
getCurrentFolderId
(jakarta.servlet.http.HttpServletRequest request) protected String
getCurrentTabName
(Map<String, String> pathVars, ClassMetadata cmd) protected String[]
getCustomCriteria
(Map<String, List<String>> requestParams) Obtains the requested criteria parameterprotected String
getErrorDuplicatingResponse
(jakarta.servlet.http.HttpServletResponse response, String code) protected String
getModalForBlankEntityType
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, String sectionKey, ClassMetadata cmd) getSelectizeCollectionOptions
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, org.springframework.util.MultiValueMap<String, String> requestParams) protected Map<String,
DynamicResultSet> getViewSubRecords
(jakarta.servlet.http.HttpServletRequest request, Map<String, String> pathVars, ClassMetadata cmd, Entity entity, List<SectionCrumb> crumbs) 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.protected boolean
isAddActionAllowed
(String sectionClassName, ClassMetadata cmd) protected boolean
protected void
modifyEntityForm
(Entity entity, EntityForm entityForm, Map<String, String> pathVars) protected EntityForm
reinitializeEntityForm
(EntityForm entityForm, ClassMetadata collectionMetadata, Entity entity, Map<String, DynamicResultSet> subRecordsMap, List<SectionCrumb> sectionCrumbs) removeCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId) Removes the requested collection itemremoveCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId) Removes the requested collection itemremoveEntity
(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, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) Attempts to remove the given entity.protected String
resolveAppropriateEntityView
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, EntityForm entityForm) saveEntity
(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, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) Attempts to save the given entity.saveEntityJson
(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, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) Builds JSON that looks like this:protected void
setTypedEntityModelAttributes
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model) protected void
setupViewEntityListBasicModel
(jakarta.servlet.http.HttpServletRequest request, ClassMetadata cmd, String sectionKey, String sectionClassName, org.springframework.ui.Model model, org.springframework.util.MultiValueMap<String, String> requestParams) showAddCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.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.showUpdateCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId) showUpdateCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId) Shows the appropriate modal dialog to edit the selected collection itemshowViewCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId) showViewCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId) Shows the appropriate modal dialog to view the selected collection item.protected String
showViewUpdateCollection
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String modalHeaderType) protected String
showViewUpdateCollection
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId, String modalHeaderType) protected String
showViewUpdateCollection
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId, String modalHeaderType, EntityForm entityForm, Entity entity) Shows the view and populates the model for updating a collection item.protected String
showViewUpdateCollection
(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String modalHeaderType, EntityForm entityForm, Entity entity) updateCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, EntityForm entityForm, String alternateId, org.springframework.validation.BindingResult result) Updates the specified collection itemupdateCollectionItem
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, EntityForm entityForm, org.springframework.validation.BindingResult result) Updates the specified collection itemupdateCollectionItemSequence
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String newSequence) updateCollectionItemSequence
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String newSequence, String alternateId) Updates the given collection item's sequence.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.viewCollectionItemDetails
(jakarta.servlet.http.HttpServletRequest request, jakarta.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.viewCollectionItemTab
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String tabName, EntityForm entityForm) 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.viewEntityListSelectize
(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) viewEntityTab
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String tabName, EntityForm entityForm, Entity entity) Attempts to get the List Grid for the selected tab.viewReadOnlyCollectionItemTab
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String tabName, EntityForm entityForm) 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, getSectionCustomCriteria, getSectionKey, 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
-
ALTERNATE_ID_PROPERTY
- See Also:
-
CUSTOM_CRITERIA
- See Also:
-
IS_SELECTIZE_REQUEST
- See Also:
-
LOG
protected static final org.apache.commons.logging.Log LOG -
CURRENT_FOLDER_ID
- See Also:
-
sandBoxHelper
-
adminUserDao
-
dynamicEntityDao
-
adornedTargetAutoPopulateExtensionManager
-
rowLevelSecurityService
-
duplicator
-
genericEntityService
-
multipleCatalogExtensionManager
-
-
Constructor Details
-
AdminBasicEntityController
public AdminBasicEntityController()
-
-
Method Details
-
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) Renders the main entity listing for the specified class, which is based on the current sectionKey with some optional criteria.- Parameters:
request
-response
-model
-pathVars
-requestParams
- a Map of property name -> list critiera values- Returns:
- the return view path
- Throws:
Exception
-
setupViewEntityListBasicModel
protected void setupViewEntityListBasicModel(jakarta.servlet.http.HttpServletRequest request, ClassMetadata cmd, String sectionKey, String sectionClassName, org.springframework.ui.Model model, org.springframework.util.MultiValueMap<String, String> requestParams) -
viewEntityListSelectize
@RequestMapping(value="/selectize", method=GET) @ResponseBody public Map<String,Object> viewEntityListSelectize(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) - Throws:
Exception
-
getCustomCriteria
Obtains the requested criteria parameter- Parameters:
requestParams
-- Returns:
-
addAddActionIfAllowed
protected void addAddActionIfAllowed(String sectionClassName, ClassMetadata cmd, List<EntityFormAction> mainActions) Adds the "Add" button to the main entity form if the current user has permissions to create new instances of the entity and all of the fields in the entity aren't marked as read only.- Parameters:
sectionClassName
-cmd
-mainActions
-
-
isAddActionAllowed
-
isNotReadOnly
-
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 ExceptionRenders 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.- Parameters:
request
-response
-model
-pathVars
-entityType
-- Returns:
- the return view path
- Throws:
Exception
-
determineEntityType
protected String determineEntityType(String entityType, ClassMetadata cmd) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
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 ExceptionProcesses the request to add a new entity. If successful, returns a redirect to the newly created entity.- Parameters:
request
-response
-model
-pathVars
-entityForm
-result
-- Returns:
- the return view path
- Throws:
Exception
-
duplicateEntity
@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 Exception- Throws:
Exception
-
getErrorDuplicatingResponse
-
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 ExceptionRenders the main entity form for the specified entity- Parameters:
request
-response
-model
-pathVars
-id
-- Returns:
- the return view path
- Throws:
Exception
-
getViewSubRecords
protected Map<String,DynamicResultSet> getViewSubRecords(jakarta.servlet.http.HttpServletRequest request, Map<String, String> pathVars, ClassMetadata cmd, Entity entity, List<SectionCrumb> crumbs) throws Exception- Throws:
Exception
-
viewEntityTab
@RequestMapping(value="/{id}/{tab:[0-9]+}/{tabName}", method=POST) public String viewEntityTab(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("tabName") String tabName, @ModelAttribute("entityForm") EntityForm entityForm, @ModelAttribute("entity") Entity entity) throws ExceptionAttempts to get the List Grid for the selected tab.- Parameters:
request
-response
-model
-pathVars
-id
-tabName
-entityForm
-entity
-- Returns:
- the return view path
- Throws:
Exception
-
saveEntityJson
@RequestMapping(value="/{id}", method=POST, produces="application/json") public String saveEntityJson(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, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) throws ExceptionBuilds JSON that looks like this:{"errors": [{"message":"This field is Required", "code": "requiredValidationFailure" "field":"defaultSku--name", "errorType", "field", "tab": "General" }, {"message":"This field is Required", "code": "requiredValidationFailure" "field":"defaultSku--name", "errorType", "field", "tab": "General" }] }
- Throws:
Exception
-
buildDirtyList
public List<String> buildDirtyList(Map<String, String> pathVars, jakarta.servlet.http.HttpServletRequest request, String id) throws ServiceException- Throws:
ServiceException
-
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") EntityForm entityForm, org.springframework.validation.BindingResult result, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) throws ExceptionAttempts 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.- Parameters:
request
-response
-model
-pathVars
-id
-entityForm
-result
-- Returns:
- the return view path
- Throws:
Exception
-
modifyEntityForm
protected void modifyEntityForm(Entity entity, EntityForm entityForm, Map<String, String> pathVars) throws Exception- Throws:
Exception
-
resolveAppropriateEntityView
protected String resolveAppropriateEntityView(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, @ModelAttribute("entityForm") EntityForm entityForm) -
removeEntity
@RequestMapping(value="/{id}/delete", method=POST) public String removeEntity(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, org.springframework.web.servlet.mvc.support.RedirectAttributes ra) throws ExceptionAttempts to remove the given entity.- Parameters:
request
-response
-model
-pathVars
-id
-- Returns:
- the return view path
- Throws:
Exception
-
getCollectionValueDetails
@RequestMapping(value="/{collectionField:.*}/details", method=GET) @ResponseBody public Map<String,String> getCollectionValueDetails(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("collectionField") String collectionField, @RequestParam String ids, @RequestParam org.springframework.util.MultiValueMap<String, throws ExceptionString> requestParams) - Throws:
Exception
-
viewCollectionItemDetails
@RequestMapping(value="/{collectionField:.*}/{id}/view", method=GET) public String viewCollectionItemDetails(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("collectionField") String collectionField, @PathVariable("id") String id) throws ExceptionShows 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.- Parameters:
request
-response
-model
-pathVars
-collectionField
-id
-- Returns:
- Throws:
Exception
-
viewCollectionItemTab
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/{tab:[0-9]+}/{tabName}", method=POST) public String viewCollectionItemTab(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @PathVariable("tabName") String tabName, @ModelAttribute("entityForm") EntityForm entityForm) throws Exception- Throws:
Exception
-
viewReadOnlyCollectionItemTab
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/view/{tab:[0-9]+}/{tabName}", method=POST) public String viewReadOnlyCollectionItemTab(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @PathVariable("tabName") String tabName, @ModelAttribute("entityForm") EntityForm entityForm) throws Exception- Throws:
Exception
-
getCollectionFieldRecords
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}", method=GET) public String getCollectionFieldRecords(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @RequestParam org.springframework.util.MultiValueMap<String, throws ExceptionString> requestParams) Returns the records for a given collectionField filtered by a particular criteria- Parameters:
request
-response
-model
-pathVars
-collectionField
-requestParams
-- Returns:
- the return view path
- Throws:
Exception
-
showAddCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/add", method=GET) public String showAddCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @RequestParam org.springframework.util.MultiValueMap<String, throws ExceptionString> requestParams) 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.- Basic Collection (Persist) - Renders a blank form for the specified target entity so that the user may enter information and associate the record with this collection. Used by fields such as ProductAttribute.
- Basic Collection (Lookup) - Renders a list grid that allows the user to click on an entity and select it. Used by fields such as "allParentCategories".
- Adorned Collection (without form) - Renders a list grid that allows the user to click on an entity and select it. The view rendered by this is identical to basic collection (lookup), but will perform the operation on an adorned field, which may carry extra meta-information about the created relationship, such as order.
- Adorned Collection (with form) - Renders a list grid that allows the user to click on an entity and select it. Once the user selects the entity, he will be presented with an empty form based on the specified "maintainedAdornedTargetFields" for this field. Used by fields such as "crossSellProducts", which in addition to linking an entity, provide extra fields, such as a promotional message.
- Map Collection - Renders a form for the target entity that has an additional key field. This field is populated either from the configured map keys, or as a result of a lookup in the case of a key based on another entity. Used by fields such as the mediaMap on a Sku.
- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-requestParams
-- Returns:
- the return view path
- Throws:
Exception
-
getModalForBlankEntityType
protected String getModalForBlankEntityType(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, String sectionKey, ClassMetadata cmd) -
addCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/add/{collectionItemId}/verify", method=POST) @ResponseBody public Map<String,Object> addCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId) throws Exception- Throws:
Exception
-
getSelectizeCollectionOptions
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/selectize", method=GET) @ResponseBody public Map<String,Object> getSelectizeCollectionOptions(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @RequestParam org.springframework.util.MultiValueMap<String, throws ExceptionString> requestParams) - Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-requestParams
-- Returns:
- Json collection data
- Throws:
Exception
-
buildSelectizeCustomCriteria
-
addSelectizeCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/selectize-add", method=POST) @ResponseBody public Map<String,Object> addSelectizeCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws ExceptionAdds the requested collection item via Selectize- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-entityForm
-- Returns:
- the return view path
- Throws:
Exception
-
declareShouldIgnoreAdditionStatusFilter
protected void declareShouldIgnoreAdditionStatusFilter() -
addCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/add", method=POST) public String addCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws ExceptionAdds the requested collection item- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-entityForm
-- Returns:
- the return view path
- Throws:
Exception
-
addEmptyCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/addEmpty", method=POST) @ResponseBody public String addEmptyCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws Exception- Throws:
Exception
-
buildAddCollectionItemModel
protected String buildAddCollectionItemModel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String id, String collectionField, String sectionKey, Property collectionProperty, FieldMetadata md, PersistencePackageRequest ppr, EntityForm entityForm, Entity entity) throws ServiceException Builds out all of the model information needed for showing the add modal for collection items on both the initial GET as well as after a POST with validation errors- Parameters:
request
-model
-id
-collectionField
-sectionKey
-collectionProperty
-md
-ppr
-- Returns:
- the appropriate view to display for the modal
- Throws:
ServiceException
-
showUpdateCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/{alternateId}", method=GET) public String showUpdateCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @PathVariable("alternateId") String alternateId) throws ExceptionShows the appropriate modal dialog to edit the selected collection item- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
-- Returns:
- the return view path
- Throws:
Exception
-
showUpdateCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}", method=GET) public String showUpdateCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId) throws Exception- Throws:
Exception
-
showViewCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/{alternateId}/view", method=GET) public String showViewCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @PathVariable("alternateId") String alternateId) throws ExceptionShows the appropriate modal dialog to view the selected collection item. This will display the modal as readonly- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
-- Returns:
- the return view path
- Throws:
Exception
-
showViewCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/view", method=GET) public String showViewCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId) throws Exception- Throws:
Exception
-
showViewUpdateCollection
protected String showViewUpdateCollection(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId, String modalHeaderType) throws ServiceException- Throws:
ServiceException
-
showViewUpdateCollection
protected String showViewUpdateCollection(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String modalHeaderType) throws ServiceException- Throws:
ServiceException
-
showViewUpdateCollection
protected String showViewUpdateCollection(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String modalHeaderType, EntityForm entityForm, Entity entity) throws ServiceException- Throws:
ServiceException
-
showViewUpdateCollection
protected String showViewUpdateCollection(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String alternateId, String modalHeaderType, EntityForm entityForm, Entity entity) throws ServiceExceptionShows the view and populates the model for updating a collection item. You can also pass in an entityform and entity which are optional. If they are not passed in then they are automatically looked up- Parameters:
request
-model
-pathVars
-id
-collectionField
-collectionItemId
-modalHeaderType
-entityForm
-entity
-- Returns:
- Throws:
ServiceException
-
reinitializeEntityForm
protected EntityForm reinitializeEntityForm(EntityForm entityForm, ClassMetadata collectionMetadata, Entity entity, Map<String, DynamicResultSet> subRecordsMap, List<SectionCrumb> sectionCrumbs) throws ServiceException- Throws:
ServiceException
-
updateCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}", method=POST) public String updateCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws ExceptionUpdates the specified collection item- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
- the collection primary key value (in the case of adorned target collection, this is the primary key value of the target entity)entityForm
-result
-- Returns:
- the return view path
- Throws:
Exception
-
updateCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/{alternateId}", method=POST) public String updateCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @ModelAttribute("entityForm") EntityForm entityForm, @PathVariable("alternateId") String alternateId, org.springframework.validation.BindingResult result) throws ExceptionUpdates the specified collection item- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
- the collection primary key value (in the case of adorned target collection, this is the primary key value of the target entity)entityForm
-alternateId
- in the case of adorned target collections, this is the primary key value of the collection memberresult
-- Returns:
- the return view path
- Throws:
Exception
-
updateCollectionItemSequence
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/sequence", method=POST) @ResponseBody public Map<String,Object> updateCollectionItemSequence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @RequestParam("newSequence") String newSequence) throws Exception- Throws:
Exception
-
updateCollectionItemSequence
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/{alternateId}/sequence", method=POST) @ResponseBody public Map<String,Object> updateCollectionItemSequence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @RequestParam("newSequence") String newSequence, @PathVariable("alternateId") String alternateId) throws ExceptionUpdates the given collection item's sequence. This should only be triggered for adorned target collections where a sort field is specified -- any other invocation is incorrect and will result in an exception.- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
-- Returns:
- an object explaining the state of the operation
- Throws:
Exception
-
removeCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/delete", method=POST) public String removeCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId) throws ExceptionRemoves the requested collection itemNote that the request must contain a parameter called "key" when attempting to remove a collection item from a map collection.
- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
-- Returns:
- the return view path
- Throws:
Exception
-
removeCollectionItem
@RequestMapping(value="/{id}/{collectionField:[^0-9].*}/{collectionItemId}/{alternateId}/delete", method=POST) public String removeCollectionItem(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @PathVariable("id") String id, @PathVariable("collectionField") String collectionField, @PathVariable("collectionItemId") String collectionItemId, @PathVariable("alternateId") String alternateId) throws ExceptionRemoves the requested collection itemNote that the request must contain a parameter called "key" when attempting to remove a collection item from a map collection.
- Parameters:
request
-response
-model
-pathVars
-id
-collectionField
-collectionItemId
-- Returns:
- the return view path
- Throws:
Exception
-
addAuditableDisplayFields
-
addAuditableDisplayField
-
buildAuditableDisplayField
-
getCurrentTabName
-
getCurrentFolderId
-
setTypedEntityModelAttributes
protected void setTypedEntityModelAttributes(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model) -
initBinder
@InitBinder public 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. By default, we register a binder that treats empty Strings as null and a Boolean editor that supports either true or false. If the value is passed in as null, it will treat it as false.- Parameters:
binder
-
-