Package com.adito.properties.forms

Examples of com.adito.properties.forms.PropertyProfileForm


     *      javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        PropertyProfileForm pf = (PropertyProfileForm) form;
        ActionForward forward = super.edit(mapping, form, request, response);
        if (forward.getName().equals("home")){
            // super returned a home, so we must go home.
            return forward;
        }
        String scope = pf.getOwner() == null ? Constants.SCOPE_GLOBAL : Constants.SCOPE_PERSONAL;
        pf.setPropertyScope(scope);
        return forward;
    }
View Full Code Here


     */
    public ActionForward commit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ActionMessages messages = new ActionMessages();
        User user = LogonControllerFactory.getInstance().getUser(request);
        PropertyProfileForm profileForm = (PropertyProfileForm) form;
        PropertyProfile profile = (PropertyProfile) profileForm.getResource();
        if (profileForm.getPropertyScope().equals(Constants.SCOPE_GLOBAL)) {
            PolicyUtil.checkPermissions(PolicyConstants.PROFILE_RESOURCE_TYPE, new Permission[] {
                            PolicyConstants.PERM_CREATE_EDIT_AND_ASSIGN, PolicyConstants.PERM_EDIT_AND_ASSIGN,
                            PolicyConstants.PERM_ASSIGN }, request);
        } else {
            PolicyUtil.checkPermission(PolicyConstants.PERSONAL_PROFILE_RESOURCE_TYPE, PolicyConstants.PERM_MAINTAIN, request);
        }
        profileForm.apply();
        if (profileForm.getEditing()) {
            PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(profile, profileForm.getSelectedPoliciesList(),
                getSessionInfo(request));
            profile.getResourceType().updateResource(profile, getSessionInfo(request));
        } else {
            int baseOn = profileForm.getSelectedPropertyProfile();
            User owner = profileForm.getOwner();
            int realmId = user.getRealm().getRealmID();

            try {
                PropertyProfile newProfile = ProfilesFactory.getInstance().createPropertyProfile(
                    owner == null ? null : owner.getPrincipalName(), profile.getResourceName(), profile.getResourceDescription(),
                    baseOn, realmId);

                PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(newProfile, profileForm.getSelectedPoliciesList(),
                    getSessionInfo(request));
                CoreServlet.getServlet().fireCoreEvent(
                    new ResourceChangeEvent(this, CoreEventConstants.CREATE_PROPERTY_PROFILE, newProfile, getSessionInfo(request),
                                    ResourceChangeEvent.STATE_SUCCESSFUL));
                profileForm.setResource(newProfile);
            } catch (Exception e) {
                CoreServlet.getServlet().fireCoreEvent(
                    new ResourceChangeEvent(this, CoreEventConstants.CREATE_PROPERTY_PROFILE, getSessionInfo(request), e));
                throw e;
            }
View Full Code Here

TOP

Related Classes of com.adito.properties.forms.PropertyProfileForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.