Class AdminTranslationController
java.lang.Object
org.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
org.broadleafcommerce.openadmin.web.controller.AdminTranslationController
@Controller("blAdminTranslationController")
@RequestMapping("/translation")
public class AdminTranslationController
extends AdminAbstractController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SecurityVerifierprotected FormBuilderExtensionManagerprotected TranslationFormBuilderServiceprotected PersistenceThreadManagerprotected TranslationServiceFields inherited from class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
adminNavigationService, CURRENT_ADMIN_MODULE_ATTRIBUTE_NAME, CURRENT_ADMIN_SECTION_ATTRIBUTE_NAME, customCriteriaService, DEFAULT_CONTAINER_VIEW, entityConfiguration, entityFormValidator, eps, FILTER_VALUE_SEPARATOR, FILTER_VALUE_SEPARATOR_REGEX, filterProductTypeExtensionManager, LOG, MODAL_CONTAINER_VIEW, service, validationService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, EntityForm entityForm, org.springframework.validation.BindingResult result) Saves a new translation to the database.deleteTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, TranslationForm form, org.springframework.validation.BindingResult result) Deletes the translation specified by the translation idprotected StringgetClassNameForSection(String sectionKey) Gets the fully qualified ceiling entity classname for this section.protected TranslationFormgetTranslationForm(EntityForm entityForm) Converts an EntityForm into a TranslationFormprotected voidmodifyRevertButton(EntityForm entityForm) Changing the default button class to "translation-revert-button" so that the JQuery action will be correctprotected voidpopulateTranslationFields(EntityForm entityForm, TranslationForm translationForm) showAddTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, TranslationForm form, org.springframework.validation.BindingResult result) Renders a modal dialog that has a list grid of translations for the specified fieldshowUpdateTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, Map<String, String> pathVars, TranslationForm form, org.springframework.validation.BindingResult result) updateTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, EntityForm entityForm, org.springframework.validation.BindingResult result) Updates the given translation id to the new locale code and translated valueviewTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, TranslationForm form, org.springframework.validation.BindingResult result) Invoked when the translation button is clicked on a given translatable fieldMethods inherited from class org.broadleafcommerce.openadmin.web.controller.AdminAbstractController
attachSectionSpecificInfo, attachSectionSpecificInfo, createSectionCrumb, declareForceUseAdditionStatusFilter, extractDynamicFormFields, getAddEntityTypes, 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, translateErrorMessageMethods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController
addDeepLink, getContextPath, isAjaxRequest, jsonResponse
-
Field Details
-
translationService
-
formService
-
formBuilderExtensionManager
-
adminRemoteSecurityService
-
extensionManager
-
persistenceThreadManager
-
-
Constructor Details
-
AdminTranslationController
public AdminTranslationController()
-
-
Method Details
-
viewTranslation
@RequestMapping(value="", method=GET) public String viewTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @ModelAttribute("form") TranslationForm form, org.springframework.validation.BindingResult result) throws Exception Invoked when the translation button is clicked on a given translatable field- Parameters:
request-response-model-form-result-- Returns:
- the return view path
- Throws:
Exception
-
showAddTranslation
@RequestMapping(value="/add", method=GET) public String showAddTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @ModelAttribute("form") TranslationForm form, org.springframework.validation.BindingResult result) throws ExceptionRenders a modal dialog that has a list grid of translations for the specified field- Parameters:
request-response-model-form-result-- Returns:
- the return view path
- Throws:
Exception
-
addTranslation
@RequestMapping(value="/add", method=POST) public String addTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws Exception Saves a new translation to the database.Note that if the ceiling entity, entity id, property name, and locale code match a previously existing translation, this method will update that translation.
- Parameters:
request-response-model-entityForm-result-- Returns:
- the result of a call to
viewTranslation(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, org.springframework.ui.Model, org.broadleafcommerce.openadmin.web.form.TranslationForm, org.springframework.validation.BindingResult), which renders the list grid - Throws:
Exception
-
showUpdateTranslation
@RequestMapping(value="/update", method=GET) public String showUpdateTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @ModelAttribute("form") TranslationForm form, org.springframework.validation.BindingResult result) throws Exception- Throws:
Exception
-
updateTranslation
@RequestMapping(value="/update", method=POST) public String updateTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @ModelAttribute("entityForm") EntityForm entityForm, org.springframework.validation.BindingResult result) throws Exception Updates the given translation id to the new locale code and translated value- Parameters:
request-response-model-entityForm-result-- Returns:
- the result of a call to
viewTranslation(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, org.springframework.ui.Model, org.broadleafcommerce.openadmin.web.form.TranslationForm, org.springframework.validation.BindingResult), which renders the list grid - Throws:
Exception
-
deleteTranslation
@RequestMapping(value="/delete", method=POST) public String deleteTranslation(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, @PathVariable Map<String, String> pathVars, @ModelAttribute("form") TranslationForm form, org.springframework.validation.BindingResult result) throws ExceptionDeletes the translation specified by the translation id- Parameters:
request-response-model-pathVars-form-result-- Returns:
- the result of a call to
viewTranslation(jakarta.servlet.http.HttpServletRequest, jakarta.servlet.http.HttpServletResponse, org.springframework.ui.Model, org.broadleafcommerce.openadmin.web.form.TranslationForm, org.springframework.validation.BindingResult), which renders the list grid - Throws:
Exception
-
getTranslationForm
Converts an EntityForm into a TranslationForm- Parameters:
entityForm-- Returns:
- the converted translation form
-
getClassNameForSection
Description copied from class:AdminAbstractControllerGets the fully qualified ceiling entity classname for this section. If this section is not explicitly defined in the database, will return the value passed into this function. For example, if there is a mapping from "/myentity" to "com.mycompany.myentity", both "http://localhost/myentity" and "http://localhost/com.mycompany.myentity" are valid request paths.- Overrides:
getClassNameForSectionin classAdminAbstractController- Returns:
- the className for this sectionKey if found in the database or the sectionKey if not
-
modifyRevertButton
Changing the default button class to "translation-revert-button" so that the JQuery action will be correct- Parameters:
entityForm- - EntityForm where revert action will be modified
-
populateTranslationFields
-