Package org.rhq.enterprise.gui.legacy

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


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

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

        int refreshPeriod = preferences.getPageRefreshPeriod();
        if (UIConstants.DONT_REFRESH_PAGE != refreshPeriod) {
            request.setAttribute("refreshPeriod", String.valueOf(refreshPeriod));
        }
View Full Code Here


     * Fetch the list of problem metrics for a resource
     */
    @Override
    public ActionForward execute(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();

        Subject subject = RequestUtils.getSubject(request);

        MeasurementProblemManagerLocal problemManager = LookupUtil.getMeasurementProblemManager();

View Full Code Here

        HttpServletRequest request, HttpServletResponse response) throws Exception {

        dataManager = LookupUtil.getMeasurementDataManager();
        chartsManager = LookupUtil.getMeasurementChartsManager();

        WebUser user = SessionUtils.getWebUser(request.getSession());
        Subject subject = user.getSubject();
        Resource resource = (Resource) request.getAttribute(AttrConstants.RESOURCE_ATTR);

        // Get metric time range
        MeasurementPreferences preferences = user.getMeasurementPreferences();
        MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();
        long begin = rangePreferences.begin;
        long end = rangePreferences.end;

        List<AutoGroupComposite> children;
View Full Code Here

        MetricsDisplayForm displayForm = (MetricsDisplayForm) form;

        Map forwardParams = displayForm.getForwardParams();

        Integer id = displayForm.getId();
        WebUser user = SessionUtils.getWebUser(request.getSession());
        MeasurementPreferences preferences = user.getMeasurementPreferences();
        Subject subject = RequestUtils.getSubject(request);

        MeasurementBaselineManagerLocal baselineManager = LookupUtil.getMeasurementBaselineManager();

        if (displayForm.isCompareClicked()) {
            return returnCompare(request, mapping, forwardParams);
        } else if (displayForm.isChartClicked()) {
            forwardParams.put(ParamConstants.METRIC_ID_PARAM, displayForm.getM());
            return returnChart(request, mapping, forwardParams);
        } else if (displayForm.isThresholdClicked()) {
            Integer threshold = displayForm.getT();
            preferences.setMetricThresholdPreference(threshold);
            log.trace("saving threshold pref [" + threshold + "]");
            LogFactory.getLog("user.preferences").trace(
                "Invoking setUserPrefs" + " in MetricsDisplayAction " + " for " + user.getId() + " at "
                    + System.currentTimeMillis() + " user.prefs = " + user.getWebPreferences());
        } else if (displayForm.isUsersetClicked()) {
            Integer[] m = displayForm.getM();
            if ((m != null) && (m.length > 0)) {
                MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

                Long begin = rangePreferences.begin;
                Long end = rangePreferences.end;

                Integer[] resourceIds = displayForm.getR();
                Resource[] resources = null; // TODO hwr: fix this

                // TODO what do we really want here?
                // this looks like users want to see old baselines at display time
                //                    bb.saveBaselines(sessionId.intValue(), resources, m,
                //                                     begin.longValue(), end.longValue());
                log.trace("Set baselines in MetricsDisplayAction " + " for " + id + ": " + StringUtil.arrayToString(m));
            }

            RequestUtils.setConfirmation(request, Constants.CNF_METRICS_BASELINE_SET);
        } else if (displayForm.isEnableClicked()) {
            Integer[] m = displayForm.getM();
            if ((m != null) && (m.length > 0)) {
                Integer[] resources = displayForm.getR();
                baselineManager.enableAutoBaselineCalculation(subject, resources, m);
                log.trace("Enable auto baselines in MetricsDisplayAction " + " for " + id + ": "
                    + StringUtil.arrayToString(m));
            }

            RequestUtils.setConfirmation(request, Constants.CNF_AUTO_BASELINE_SET);
        } else if (displayForm.isAddClicked()) {
            Integer[] m = displayForm.getM();
            if ((m != null) && (m.length > 0)) {
                //addFavoriteMetrics(m, user, id.getTypeName());
                LogFactory.getLog("user.preferences").trace(
                    "Invoking setUserPrefs" + " in MetricsDisplayAction " + " for " + user.getId() + " at "
                        + System.currentTimeMillis() + " user.prefs = " + user.getWebPreferences());
            }

            RequestUtils.setConfirmation(request, Constants.CNF_FAVORITE_METRICS_ADDED);
        } else if (displayForm.isRemoveClicked()) {
            Integer[] m = displayForm.getM();
            if ((m != null) && (m.length > 0)) {
                //removeFavoriteMetrics(m, user, entityId.getTypeName());
                LogFactory.getLog("user.preferences").trace(
                    "Invoking setUserPrefs" + " in MetricsDisplayAction " + " for " + user.getId() + " at "
                        + System.currentTimeMillis() + " user.prefs = " + user.getWebPreferences());
            }

            RequestUtils.setConfirmation(request, Constants.CNF_FAVORITE_METRICS_REMOVED);
        }
View Full Code Here

    @Override
    public ActionForward workflow(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        CompareMetricsForm cform = (CompareMetricsForm) form;

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

        MeasurementPreferences preferences = user.getMeasurementPreferences();
        MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

        if ((cform.childResourceIds != null) && (cform.childResourceIds.length > 0)) {
            int[] definitionIds = LookupUtil.getResourceGroupManager().findDefinitionsForCompatibleGroup(
                user.getSubject(), cform.getGroupId(), false);
            Locale userLocale = request.getLocale();
            cform.setMetrics(getMetrics(user.getSubject(), ArrayUtils.unwrapArray(cform.childResourceIds),
                definitionIds, rangePreferences.begin, rangePreferences.end, userLocale));
            cform.setRb(rangePreferences.begin);
            cform.setRe(rangePreferences.end);
        }
View Full Code Here

        HttpServletResponse response, Long begin, Long end) throws Exception {
        MetricsDisplayForm displayForm = (MetricsDisplayForm) form;
        displayForm.setShowNumberCollecting(getShowNumberCollecting());
        displayForm.setShowBaseline(getShowBaseline());
        displayForm.setShowMetricSource(getShowMetricSource());
        WebUser user = SessionUtils.getWebUser(request.getSession());

        int[] resourceIds;
        groupId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.GROUP_ID_PARAM, -1);
        if (groupId > 0) {
            ResourceGroupManagerLocal resGrpMgr = LookupUtil.getResourceGroupManager();
            List<Resource> resources = resGrpMgr.findResourcesForResourceGroup(user.getSubject(), groupId,
                GroupCategory.COMPATIBLE);

            // Can we put the ResourceType in the Request so we don't need another EJB call in MetricsControlFormPrepareAction.java
            if (resources.size() > 0) {
                ResourceType resourceType = resources.get(0).getResourceType();
                request.setAttribute(AttrConstants.RESOURCE_TYPE_ATTR, resourceType);
            }

            resourceIds = new int[resources.size()];
            int i = 0;
            for (Resource res : resources) {
                resourceIds[i] = res.getId();
                i++;
            }
        } else {
            resourceIds = WebUtility.getResourceIds(request);
        }

        if ((begin == null) || (end == null)) {
            // get the "metric range" user pref
            MeasurementPreferences preferences = user.getMeasurementPreferences();
            MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

            begin = rangePreferences.begin;
            end = rangePreferences.end;
        }

        List<MetricDisplaySummary> metrics;

        if (displayForm.isFilterSubmitClicked()) {
            metrics = getMetrics(request, resourceIds, displayForm.getFilters(), displayForm.getKeyword(), begin, end);
        } else {
            metrics = getMetrics(request, resourceIds, MeasurementConstants.FILTER_NONE, null, begin, end);
        }

        if (metrics != null) {
            //            if (log.isTraceEnabled()) {
            //                log.trace("Got formatted metrics");
            //                MonitorUtils.traceMetricDisplaySummaryMap(log, metrics);
            //            }

            /*
             * Separate numerical and trait metrics
             */
            List<MetricDisplaySummary> metricsTrait = new ArrayList<MetricDisplaySummary>();
            for (MetricDisplaySummary mds : metrics) {
                if (mds.getIsTrait()) {
                    metricsTrait.add(mds);
                }
            }

            metrics.removeAll(metricsTrait);

            // TODO GH: What's this do?
            // hwr: format the raw numerical values. Only good for numerical metrics.
            Integer resourceCount = MonitorUtils.formatMetrics(metrics, request.getLocale(), getResources(request));

            request.setAttribute(AttrConstants.NUM_CHILD_RESOURCES_ATTR, resourceCount);
            request.setAttribute(AttrConstants.METRIC_SUMMARIES_ATTR, metrics);
            request.setAttribute(AttrConstants.METRIC_SUMMARIES_ATTR_TRAIT, metricsTrait);

            //getResourceCurrentHealths  GroupMemberHealthSummaries
            ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
            PageList<ResourceHealthComposite> groupMemberHealthSummaries = resourceManager.findResourceHealth(user
                .getSubject(), resourceIds, new PageControl());
            request.setAttribute(AttrConstants.GROUP_MEMBER_HEALTH_SUMMARIES_ATTR, groupMemberHealthSummaries);

            // populate the form
            //displayForm.setupCategoryList(metrics);
View Full Code Here

     */
    protected abstract List<MetricDisplaySummary> getMetrics(HttpServletRequest request, int[] resourceIds,
        long filters, String keyword, Long begin, Long end) throws Exception;

    private void prepareForm(HttpServletRequest request, MetricsDisplayForm form) throws IllegalArgumentException {
        WebUser user = SessionUtils.getWebUser(request.getSession());

        // set threshold default
        MeasurementPreferences preferences = user.getMeasurementPreferences();
        Integer threshold = preferences.getMetricThresholdPreference();
        switch (threshold) {
        case MonitorUtils.THRESHOLD_HIGH_RANGE_VALUE: {
            form.setDisplayHighRange(Boolean.TRUE);
            break;
View Full Code Here

        ActionForward forward = checkSubmit(request, mapping, form, true);
        if (forward != null) {
            return forward;
        }

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

        if (displayForm.isLastnSelected()) {
            Integer lastN = displayForm.getRn();
            Integer unit = displayForm.getRu();
View Full Code Here

        // decide what timeframe we're showing. it may have been shifted on previous views of this page.
        MetricRange range = (MetricRange) request.getAttribute(Constants.METRIC_RANGE);
        if (range == null) {
            // this is the first time out. get the "metric range" user pref.
            WebUser user = SessionUtils.getWebUser(request.getSession());
            MeasurementPreferences preferences = user.getMeasurementPreferences();
            MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();
            range = new MetricRange();
            range.setBegin(rangePreferences.begin);
            range.setEnd(rangePreferences.end);
        }
View Full Code Here

     */
    public ActionForward workflow(ComponentContext context, ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
        MetricDisplayRangeForm rangeForm = (MetricDisplayRangeForm) form;
        try {
            WebUser user = SessionUtils.getWebUser(request.getSession());
            MeasurementPreferences preferences = user.getMeasurementPreferences();
            MetricRangePreferences rangePreferences = preferences.getMetricRangePreferences();

            if (rangeForm.isResetClicked()) {
                rangeForm.setRn(rangePreferences.lastN);
                rangeForm.setRu(rangePreferences.unit);
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.