Package org.rhq.enterprise.gui.legacy

Examples of org.rhq.enterprise.gui.legacy.WebUser


        user.setPhoneNumber(userForm.getPhoneNumber());
        user.setSmsAddress(userForm.getSmsAddress());
        user.setFactive(userForm.getEnableLogin().equals("yes"));

        // a user can only edit his own configuration
        WebUser currentUser = RequestUtils.getWebUser(request);
        if (currentUser.getId().equals(userForm.getId())) {
            // update the in-memory preferences of the webuser so it takes effect for this session
            try {
                WebUserPreferences webPreferences = currentUser.getWebPreferences();
                int pageRefreshPeriod = Integer.valueOf(userForm.getPageRefreshPeriod());
                webPreferences.setPageRefreshPeriod(pageRefreshPeriod);
            } catch (NumberFormatException e) {
                throw new RuntimeException(
                    "pageRefreshPeriod is not an integer, this should have been caught earlier by the form validation.");
            }

            try {
                SubjectPreferences corePreferences = currentUser.getSubjectPreferences();
                int timeoutPeriod = Integer.valueOf(userForm.getGroupConfigurationTimeout());
                corePreferences.setGroupConfigurationTimeoutPeriod(timeoutPeriod);
            } catch (NumberFormatException e) {
                throw new RuntimeException(
                    "groupConfigurationTimeout is not an integer, this should have been caught earlier by the form validation.");
            }
        }

        subjectManager.updateSubject(currentUser.getSubject(), user);

        return returnSuccess(request, mapping, Constants.USER_PARAM, userForm.getId());
    }
View Full Code Here


     * @param  request
     *
     * @return <code>true</code> if the resource in the request is a user's favorite
     */
    public static Boolean determineIfFavoriteResource(HttpServletRequest request) {
        WebUser user = SessionUtils.getWebUser(request.getSession());
        int id = WebUtility.getResourceId(request);
        Boolean isFavorite = isFavorite(user, id);
        request.setAttribute("isFavorite", isFavorite);
        return isFavorite;
    }
View Full Code Here

        return isFavorite;
    }

    public static Boolean determineIfFavoriteResource(int resourceId) {
        HttpServletRequest request = FacesContextUtility.getRequest();
        WebUser user = SessionUtils.getWebUser(request.getSession());
        Boolean isFavorite = isFavorite(user, resourceId);
        request.setAttribute("isFavorite", isFavorite);
        return isFavorite;
    }
View Full Code Here

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        PropertiesForm propsForm = (PropertiesForm) form;
        HttpSession session = request.getSession();
        WebUser user = SessionUtils.getWebUser(request.getSession());
        WebUserPreferences preferences = user.getWebPreferences();
        String range = propsForm.getRange().toString();

        ActionForward forward = checkSubmit(request, mapping, form);
        if (forward != null) {
            return forward;
View Full Code Here

        request.setAttribute("isFavorite", isFavorite);
        return isFavorite;
    }

    public static Boolean determineIfFavoriteGroup(HttpServletRequest request, int groupId) {
        WebUser user = SessionUtils.getWebUser(request.getSession());
        Boolean isFavorite = isFavoriteGroup(user, groupId);
        request.setAttribute("isFavorite", isFavorite);
        return isFavorite;
    }
View Full Code Here

        Object attr = session.getAttribute(AttrConstants.WEBUSER_SES_ATTR);
        if (attr == null) {
            return null;
        }

        WebUser user = (WebUser) attr;
        log.debug("Loading WebUser");
        /*
        Subject subject = user.getSubject();
        Integer sessionId = subject.getSessionId();
        subject = LookupUtil.getSubjectManager().loadUserConfiguration(subject.getId());
View Full Code Here

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        PropertiesForm propsForm = (PropertiesForm) form;

        HttpSession session = request.getSession();
        WebUser user = SessionUtils.getWebUser(session);
        WebUserPreferences preferences = user.getWebPreferences();

        propsForm.setRange(preferences.getAutoDiscoveryRange());

        return null;
    }
View Full Code Here

        // users logging in with JDBC. the only way we can
        // distinguish these users is by checking to see
        // if they have an entry in the principals table.
        boolean hasPrincipal = LookupUtil.getSubjectManager().isUserWithPrincipal(user.getName());

        WebUser webUser = new WebUser(user);
        webUser.setHasPrincipal(hasPrincipal);

        request.setAttribute(Constants.USER_ATTR, webUser);
        request.setAttribute(Constants.TITLE_PARAM_ATTR, BizappUtils.makeSubjectFullName(user));
    }
View Full Code Here

        // Set title
        MessageResources res = getResources(request);
        feed.setTitle(res.getMessage("dash.home.CriticalAlerts"));

        // Get the alerts
        WebUser user = getWebUser(request);
        if (user != null) {

            AlertsPortletPreferences prefs = user.getWebPreferences().getAlertsPortletPreferences();

            PageControl pageControl = new PageControl(0, prefs.count);

            AlertCriteria criteria = new AlertCriteria();
            criteria.addFilterPriorities(AlertPriority.getByLegacyIndex(prefs.priority));
            criteria.addFilterStartTime(prefs.timeRange);
            criteria.addFilterResourceIds(("all".equals(prefs.displayAll) ? null : ArrayUtils.wrapInArray(prefs
                .asArray())));
            criteria.setPageControl(pageControl);

            PageList<Alert> alerts = alertManager.findAlertsByCriteria(user.getSubject(), criteria);

            if ((alerts != null) && (alerts.size() > 0)) {
                for (Alert alert : alerts) {
                    String link = feed.getBaseUrl() + "/alerts/Alerts.do?mode=viewAlert&id="
                        + alert.getAlertDefinition().getResource().getId() + "&a=" + alert.getId();
View Full Code Here

        try {
            DiscoveryBossLocal discoveryBoss = LookupUtil.getDiscoveryBoss();
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
           
            WebUser user = SessionUtils.getWebUser(request.getSession());
            if (user == null) {
                // session timed out, return prematurely
                return null;
            }

            WebUserPreferences preferences = user.getWebPreferences();
            Subject subject = user.getSubject();
            AIQueueForm queueForm = (AIQueueForm) form;
            PageControl pageControl;

            try {
                int size = preferences.getAutoDiscoveryRange();
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.gui.legacy.WebUser

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.