use of org.broadleafcommerce.openadmin.web.form.entity.EntityForm in project BroadleafCommerce by BroadleafCommerce.
the class AdminTranslationController method showUpdateTranslation.
@RequestMapping(value = "/update", method = RequestMethod.GET)
public String showUpdateTranslation(HttpServletRequest request, HttpServletResponse response, Model model, @PathVariable Map<String, String> pathVars, @ModelAttribute(value = "form") TranslationForm form, BindingResult result) throws Exception {
String sectionKey = getSectionKey(pathVars);
String sectionClassName = getClassNameForSection(sectionKey);
List<SectionCrumb> sectionCrumbs = new ArrayList<>();
PersistencePackageRequest ppr = getSectionPersistencePackageRequest(sectionClassName, sectionCrumbs, pathVars);
ClassMetadata cmd = service.getClassMetadata(ppr).getDynamicResultSet().getClassMetaData();
adminRemoteSecurityService.securityCheck(form.getCeilingEntity(), EntityOperationType.FETCH);
Translation t = translationService.findTranslationById(form.getTranslationId());
form.setTranslatedValue(t.getTranslatedValue());
EntityForm entityForm = formService.buildTranslationForm(cmd, form, TranslationFormAction.UPDATE);
entityForm.setId(String.valueOf(form.getTranslationId()));
model.addAttribute("entityForm", entityForm);
model.addAttribute("viewType", "modal/translationAdd");
model.addAttribute("currentUrl", request.getRequestURL().toString());
model.addAttribute("modalHeaderType", ModalHeaderType.UPDATE_TRANSLATION.getType());
return "modules/modalContainer";
}
use of org.broadleafcommerce.openadmin.web.form.entity.EntityForm in project BroadleafCommerce by BroadleafCommerce.
the class FormBuilderServiceImpl method createEntityForm.
@Override
public EntityForm createEntityForm(ClassMetadata cmd, Entity entity, Map<String, DynamicResultSet> collectionRecords, List<SectionCrumb> sectionCrumbs) throws ServiceException {
EntityForm ef = createStandardEntityForm();
populateEntityForm(cmd, entity, collectionRecords, ef, sectionCrumbs);
addAdditionalFormActions(ef);
extensionManager.getProxy().addAdditionalFormActions(ef);
return ef;
}
use of org.broadleafcommerce.openadmin.web.form.entity.EntityForm in project BroadleafCommerce by BroadleafCommerce.
the class FormBuilderServiceImpl method createStandardAdornedEntityForm.
protected EntityForm createStandardAdornedEntityForm() {
EntityForm ef = new EntityForm();
ef.addAction(DefaultAdornedEntityFormActions.Add);
return ef;
}
use of org.broadleafcommerce.openadmin.web.form.entity.EntityForm in project BroadleafCommerce by BroadleafCommerce.
the class FormBuilderServiceImpl method createStandardEntityForm.
protected EntityForm createStandardEntityForm() {
EntityForm ef = new EntityForm();
ef.addAction(DefaultEntityFormActions.SAVE);
return ef;
}
use of org.broadleafcommerce.openadmin.web.form.entity.EntityForm in project BroadleafCommerce by BroadleafCommerce.
the class AdminOrderController method showViewUpdateCollection.
@Override
protected String showViewUpdateCollection(HttpServletRequest request, Model model, Map<String, String> pathVars, String id, String collectionField, String collectionItemId, String modalHeaderType) throws ServiceException {
String returnPath = super.showViewUpdateCollection(request, model, pathVars, id, collectionField, collectionItemId, modalHeaderType);
if ("orderItems".equals(collectionField)) {
EntityForm ef = (EntityForm) model.asMap().get("entityForm");
ListGrid adjustmentsGrid = ef.findListGrid("orderItemAdjustments");
if (adjustmentsGrid != null && CollectionUtils.isEmpty(adjustmentsGrid.getRecords())) {
ef.removeListGrid("orderItemAdjustments");
}
ListGrid priceDetailsGrid = ef.findListGrid("orderItemPriceDetails");
if (priceDetailsGrid != null && CollectionUtils.isEmpty(priceDetailsGrid.getRecords())) {
ef.removeListGrid("orderItemPriceDetails");
}
}
return returnPath;
}
Aggregations