/** * Edit the user definition. * * @param mapping * @param form * @param request * @param response * @return forward * @throws Exception */ public ActionForward edit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { AttributeDefinitionForm df = (AttributeDefinitionForm) form; AttributeDefinition def = (AttributeDefinition) request.getSession().getAttribute(Constants.EDITING_ITEM); if (def.isSystem()) { throw new Exception("System attribute definitions may not be edited."); } df.initialise(def); df.setEditing(); df.setReferer(CoreUtil.getReferer(request)); CoreUtil.addRequiredFieldMessage(this, request); return mapping.findForward("display"); }
/** * Commit the attribute definition. * * @param mapping * @param form * @param request * @param response * @return forward * @throws Exception */ public ActionForward commit( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { AttributeDefinitionForm df = (AttributeDefinitionForm) form; df.applyToDefinition(); if (df.getEditing()) { ProfilesFactory.getInstance().updateAttributeDefinition(df.getDefinition()); df.getDefinition().getPropertyClass().registerPropertyDefinition(df.getDefinition()); } else { ProfilesFactory.getInstance().createAttributeDefinition(df.getDefinition()); df.getDefinition().getPropertyClass().registerPropertyDefinition(df.getDefinition()); } return cleanUpAndReturnToReferer(mapping, form, request, response); }