Examples of WebUser


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

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        try {
            WebUser user = SessionUtils.getWebUser(request.getSession());
            MeasurementPreferences preferences = user.getMeasurementPreferences();
            MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();
            long begin = rangePreferences.begin;
            long end = rangePreferences.end;
            long interval = TimeUtil.getInterval(begin, end, DefaultConstants.DEFAULT_CHART_POINTS);

            begin = Long.parseLong(WebUtility.getOptionalRequestParameter(request, "begin", "0"));

            int resourceId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.RESOURCE_ID_PARAM, -1);
            int groupId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.GROUP_ID_PARAM, -1);
            int parent = WebUtility.getOptionalIntRequestParameter(request, "parent", -1);
            int type = WebUtility.getOptionalIntRequestParameter(request, "type", -1);
            String mode = WebUtility.getOptionalRequestParameter(request, "mode", "normal");

            EventManagerLocal eventManager = LookupUtil.getEventManager();

            Subject subject = user.getSubject();
            EntityContext context = new EntityContext(resourceId, groupId, parent, type);
            PageList<EventComposite> events = eventManager.findEventComposites(subject, context, begin, begin
                + interval, null, null, null, new PageControl(0, MAX_EVENTS_PER_DOT));

            MessageResources res = getResources(request);
View Full Code Here

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

        List<DisambiguatedRecentlyAddedResourceComposite> platformList = new ArrayList<DisambiguatedRecentlyAddedResourceComposite>();

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

            WebUserPreferences preferences = user.getWebPreferences();
            RecentlyApprovedPortletPreferences recentlyApprovedPreferences = preferences
                .getRecentlyApprovedPortletPreferences();
            Subject subject = user.getSubject();

            // Based on the user preference, generate a timestamp of the oldest resource to display.
            long range = recentlyApprovedPreferences.hours;
            long ts = 0; // defaults to ANY time in the past
            if (range != -1) {
View Full Code Here

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

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        Log log = LogFactory.getLog(AddResourcesPrepareAction.class);
        AddResourcesForm addForm = (AddResourcesForm) form;
        HttpSession session = request.getSession();
        WebUser user = RequestUtils.getWebUser(request);
        Subject subject = user.getSubject();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

        PageControl pcAvail = WebUtility.getPageControl(request, "a");
        PageControl pcPending = WebUtility.getPageControl(request, "p");
        log.trace("available page control: " + pcAvail);
        log.trace("pending page control: " + pcPending);

        // first, get the pending resources (those that have been added to the RHS
        // pending resources are those on the right side of the "add to list" widget that are awaiting association with the group when the form's "ok" button is clicked. */
        log.debug("check session if there are pending resources");
        List<String> pendingResourceList = new ArrayList<String>();

        if (session.getAttribute(Constants.PENDING_RESOURCES_SES_ATTR) == null) {
            // if hitting the page for the first time, load resources already associated with user via preferences
            log.debug("get pending resources from user preferences");
            WebUserPreferences preferences = user.getWebPreferences();
            pendingResourceList = preferences.getPreferenceAsList(addForm.getKey(), DashboardUtils.DASHBOARD_DELIMITER);

            if (pendingResourceList != null) {
                // otherwise, we've been here for a while but the user paged, performed changed LHS<->RHS, etc
                log.debug("put entire list of pending resources in session");
View Full Code Here

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

        org.rhq.core.domain.util.PageControl pageControl = WebUtility.getPageControl(request);
        Subject subject = RequestUtils.getSubject(request);

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

        // Setup whether we're displaying list view or chart view.
        HubUtils.initView(hubForm, user);

        // Find resources specified by category and potentially type.
View Full Code Here

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

        int resourceId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.RESOURCE_ID_PARAM, -1);
        int groupId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.GROUP_ID_PARAM, -1);
        int parent = WebUtility.getOptionalIntRequestParameter(request, "parent", -1);
        int type = WebUtility.getOptionalIntRequestParameter(request, "type", -1);

        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();
        MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();
        Subject subject = user.getSubject();

        // Get metric range defaults
        long begin = rangePreferences.begin;
        long end = rangePreferences.end;
        eForm.setRn(rangePreferences.lastN);
View Full Code Here

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

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
        Log log = LogFactory.getLog(AddResourcesAction.class);
        HttpSession session = request.getSession();
        WebUser user = SessionUtils.getWebUser(session);
        WebUserPreferences preferences = user.getWebPreferences();
        AddResourcesForm addForm = (AddResourcesForm) form;

        ActionForward forward = checkSubmit(request, mapping, form, Constants.USER_PARAM, user.getId());
        if (forward != null) {
            BaseValidatorForm spiderForm = (BaseValidatorForm) form;

            if (spiderForm.isCancelClicked() || spiderForm.isResetClicked()) {
                log.trace("removing pending resources list");
View Full Code Here

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

    public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        Log log = LogFactory.getLog(EditUserFormPrepareAction.class.getName());
        EditForm userForm = (EditForm) form;

        WebUser user = (WebUser) request.getAttribute(Constants.USER_ATTR);

        if (userForm.getFirstName() == null) {
            userForm.setFirstName(user.getFirstName());
        }

        if (userForm.getLastName() == null) {
            userForm.setLastName(user.getLastName());
        }

        if (userForm.getDepartment() == null) {
            userForm.setDepartment(user.getDepartment());
        }

        if (userForm.getName() == null) {
            userForm.setName(user.getName());
        }

        if (userForm.getEmailAddress() == null) {
            userForm.setEmailAddress(user.getEmailAddress());
        }

        if (userForm.getPhoneNumber() == null) {
            userForm.setPhoneNumber(user.getPhoneNumber());
        }

        setupMyPreferences(request, user, userForm);

        if (user.getActive()) {
            userForm.setEnableLogin("yes");
        } else {
            userForm.setEnableLogin("no");
        }
View Full Code Here

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

     * @param userBeingEdited
     * @param userForm
     */
    private void setupMyPreferences(HttpServletRequest request, WebUser userBeingEdited, EditForm userForm) {
        HttpSession session = request.getSession();
        WebUser currentUser = SessionUtils.getWebUser(session);

        //Integer currentUserId = RequestUtils.getUserId(request);
        Integer currentUserId = currentUser.getId();
        Integer idOfUserBeingEdited = userBeingEdited.getId();

        // if the user being edited is the person who is logged in then setup these preferences for display
        if ((currentUserId != null) && currentUserId.equals(idOfUserBeingEdited)) {
            userForm.setEditingCurrentUser(true);

            // if we're already set, don't overwrite us
            if (userForm.getPageRefreshPeriod() == null) {
                int pageRefreshPeriod = currentUser.getWebPreferences().getPageRefreshPeriod();
                userForm.setPageRefreshPeriod(String.valueOf(pageRefreshPeriod));
            }

            if (userForm.getGroupConfigurationTimeout() == null) {
                int timeoutPeriod = currentUser.getSubjectPreferences().getGroupConfigurationTimeoutPeriod();
                userForm.setGroupConfigurationTimeout(String.valueOf(timeoutPeriod));
            }
        }
    }
View Full Code Here

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

    @Override
    public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        // Get the resource availability
        AvailabilityManagerLocal availabilityManager = LookupUtil.getAvailabilityManager();
        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();

        int resourceId = RequestUtils.getResourceId(request);
        try {
            MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

            List<AvailabilityPoint> data = availabilityManager.findAvailabilitiesForResource(user.getSubject(),
                resourceId, rangePreferences.begin, rangePreferences.end, DefaultConstants.DEFAULT_CHART_POINTS,
                !rangePreferences.readOnly);

            request.setAttribute(AttrConstants.AVAILABILITY_METRICS_ATTR, data);
            request.setAttribute(AttrConstants.AVAIL_METRICS_ATTR, getFormattedAvailability(data));
View Full Code Here

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

    }

    // ---------------------------------------------------- Protected Methods

    protected void prepareForm(HttpServletRequest request, MetricsControlForm form) throws IllegalArgumentException {
        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();
        MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

        form.setReadOnly(rangePreferences.readOnly);
        form.setRn(rangePreferences.lastN);
        form.setRu(rangePreferences.unit);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.