@RequestMapping(value = "/create", method = RequestMethod.GET) @RequireHardLogIn public String createUserGroup(final Model model) throws CMSItemNotFoundException { storeCmsPageInModel(model, getContentPageForLabelOrId(MANAGE_USERGROUPS_CMS_PAGE)); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(MANAGE_USERGROUPS_CMS_PAGE)); final List<Breadcrumb> breadcrumbs = myCompanyBreadcrumbBuilder.createManageUserGroupBreadCrumbs(); breadcrumbs.add( new Breadcrumb( "/my-company/organization-management/manage-usergroups/create", getMessageSource() .getMessage( "text.company.manageUsergroups.createUsergroup.breadcrumb", null, "Create Usergroup ", getI18nService().getCurrentLocale()), null)); model.addAttribute("breadcrumbs", breadcrumbs); if (!model.containsAttribute("b2BUserGroupForm")) { final B2BUnitData unitData = companyB2BCommerceFacade.getParentUnit(); final B2BUserGroupForm b2BUserGroupForm = new B2BUserGroupForm(); b2BUserGroupForm.setParentUnit(unitData.getUid()); model.addAttribute(b2BUserGroupForm); } model.addAttribute( "branchSelectOptions", getBranchSelectOptions(this.companyB2BCommerceFacade.getBranchNodes())); model.addAttribute("unit", companyB2BCommerceFacade.getParentUnit()); model.addAttribute("metaRobots", "no-index,no-follow"); return ControllerConstants.Views.Pages.MyCompany.MyCompanyManageUsergroupCreatePage; }
@RequestMapping(value = "/edit", method = RequestMethod.GET) @RequireHardLogIn public String editUserGroup(@RequestParam("usergroup") final String usergroup, final Model model) throws CMSItemNotFoundException { storeCmsPageInModel(model, getContentPageForLabelOrId(MANAGE_USERGROUPS_CMS_PAGE)); setUpMetaDataForContentPage(model, getContentPageForLabelOrId(MANAGE_USERGROUPS_CMS_PAGE)); final List<Breadcrumb> breadcrumbs = myCompanyBreadcrumbBuilder.createManageUserGroupDetailsBreadCrumbs(usergroup); breadcrumbs.add( new Breadcrumb( String.format( "/my-company/organization-management/manage-usergroups/edit/?usergroup=%s", urlEncode(usergroup)), getMessageSource() .getMessage( "text.company.manageUsergroups.editUsergroup.breadcrumb", new Object[] {usergroup}, "Edit {0} Usergroup ", getI18nService().getCurrentLocale()), null)); model.addAttribute("breadcrumbs", breadcrumbs); if (!model.containsAttribute("b2BUserGroupForm")) { final B2BUserGroupForm b2BUserGroupForm = new B2BUserGroupForm(); final B2BUserGroupData userGroupData = b2bCommerceB2BUserGroupFacade.getB2BUserGroup(usergroup); if (userGroupData == null) { GlobalMessages.addErrorMessage(model, "usergroup.notfound"); } else { b2BUserGroupForm.setOriginalUid(userGroupData.getUid()); if (userGroupData.getUnit() != null) { b2BUserGroupForm.setParentUnit(userGroupData.getUnit().getUid()); } b2BUserGroupForm.setUid(userGroupData.getUid()); b2BUserGroupForm.setName(userGroupData.getName()); } model.addAttribute(b2BUserGroupForm); } model.addAttribute( "branchSelectOptions", getBranchSelectOptions(this.companyB2BCommerceFacade.getBranchNodes())); model.addAttribute("metaRobots", "no-index,no-follow"); return ControllerConstants.Views.Pages.MyCompany.MyCompanyManageUsergroupEditPage; }