Package com.adito.properties.forms

Examples of com.adito.properties.forms.ProfilesForm


     *      javax.servlet.http.HttpServletResponse)
     */
    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                    HttpServletResponse response) throws Exception {
        ActionForward fwd = super.unspecified(mapping, form, request, response);
        ProfilesForm profilesForm = (ProfilesForm) form;
        SessionInfo session = this.getSessionInfo(request);
        List globalProfiles = null;
        List personalProfiles = null;
        if (session.getNavigationContext() == SessionInfo.MANAGEMENT_CONSOLE_CONTEXT) {
            profilesForm.setProfileScope(Constants.SCOPE_GLOBAL);
            globalProfiles = ProfilesFactory.getInstance().getPropertyProfiles(null, true,
                            session.getUser().getRealm().getResourceId());
        } else {
            profilesForm.setProfileScope(Constants.SCOPE_PERSONAL);
            globalProfiles = ResourceUtil.filterOwned(ResourceUtil.getGrantedResource(
                            getSessionInfo(request), getResourceType()));           
            personalProfiles = ResourceUtil.filterResources(session.getUser(), ProfilesFactory.getInstance().getPropertyProfiles(
                session.getUser().getPrincipalName(), true, session.getUser().getRealm().getResourceId()), false);
        }
        PropertyProfile profile = (PropertyProfile) request.getSession().getAttribute(Constants.SELECTED_PROFILE);
        if (profile != null) {
            profilesForm.initialize(globalProfiles, personalProfiles, request.getSession(), profile.getResourceId());
        } else {
            profilesForm.initialize(globalProfiles, personalProfiles, request.getSession(), -1);
        }
        profilesForm.checkSelectedView(request, response);
        return fwd;
    }
View Full Code Here


     * @return ActionForward
     * @throws Exception
     */
    public ActionForward confirmRemove(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                    HttpServletResponse response) throws Exception {
        ProfilesForm f = (ProfilesForm) form;
        PropertyProfile profile = (PropertyProfile) getResourceById(f.getSelectedResource());
        if (profile == null) {
            throw new Exception("Selected profile '" + f.getSelectedResource() + "' doesn't exist.");
        }
        if(profile.getOwnerUsername() != null) {
            SessionInfo session = getSessionInfo(request);
            if(!session.getUser().getPrincipalName().equals(profile.getOwnerUsername())) {
                throw new Exception("Cannot delete profiles owned by others.");
View Full Code Here

     *      javax.servlet.http.HttpServletRequest,
     *      javax.servlet.http.HttpServletResponse)
     */
    public ActionForward remove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ProfilesForm f = (ProfilesForm) form;
        ActionMessages errors = new ActionMessages();
        PropertyProfile profile = (PropertyProfile) getResourceById(f.getSelectedResource());
        if (profile == null) {
            throw new Exception("Selected profile '" + f.getSelectedResource() + "' doesn't exist.");
        }
        if (profile.getOwnerUsername() == null && Constants.SCOPE_PERSONAL.equals(f.getProfileScope())) {
            errors.add(Globals.ERROR_KEY, new ActionMessage("error.deleteProfile.cantDeleteGlobalProfile"));
        }
        if (profile.getResourceName().equalsIgnoreCase("Default")
                        && (profile.getOwnerUsername() == null || profile.getOwnerUsername().equals(""))) {
            errors.add(Globals.ERROR_KEY, new ActionMessage("error.deleteProfile.cantDeleteDefaultProfile"));
View Full Code Here

     * @return forward
     * @throws Exception on any error
     */
    public ActionForward select(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        ProfilesForm f = (ProfilesForm) form;
        PropertyProfile profile = ProfilesFactory.getInstance().getPropertyProfile(f.getSelectedResource());
        SessionInfo session = getSessionInfo(request);
        ResourceUtil.checkResourceAccessRights(profile, session);
        request.getSession().setAttribute(Constants.SELECTED_PROFILE, profile);
        ActionMessages messages = new ActionMessages();
        messages.add(Globals.MESSAGES_KEY, new ActionMessage("message.profileSelected", profile.getResourceName()));
View Full Code Here

TOP

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

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.