Package org.rhq.enterprise.gui.legacy.exception

Examples of org.rhq.enterprise.gui.legacy.exception.ParameterNotFoundException


    public static String getRequiredRequestParameter(ServletRequest request, String name) {
        logWarningIfParameterHasMultipleValues(request, name);
        String value = request.getParameter(name);
        if (value == null) {
            throw new ParameterNotFoundException("Required request parameter '" + name + "' does not exist.");
        }

        return value;
    }
View Full Code Here


    }

    public static int getRequiredIntRequestParameter(ServletRequest request, String name) {
        String value = getRequiredRequestParameter(request, name);
        if (value.length() == 0) {
            throw new ParameterNotFoundException("Required request parameter '" + name + "' has an empty value.");
        }

        int intValue;
        try {
            intValue = Integer.parseInt(value);
        } catch (NumberFormatException e) {
            throw new ParameterNotFoundException("Request parameter '" + name + "' has value '" + value
                + "', which is not a valid integer.");
        }

        return intValue;
    }
View Full Code Here

        if (null == alertDefinition) {
            String alertDefinitionParameter = request.getParameter(Constants.ALERT_DEFINITION_PARAM);

            if (null == alertDefinitionParameter) {
                throw new ParameterNotFoundException(Constants.ALERT_DEFINITION_PARAM);
            } else {
                Subject user = RequestUtils.getSubject(request);
                int alertDefinitionId = Integer.parseInt(alertDefinitionParameter);
                alertDefinition = LookupUtil.getAlertDefinitionManager()
                    .getAlertDefinitionById(user, alertDefinitionId);
View Full Code Here

     * @throws ParameterNotFoundException If the parameter name is not found in the request
     */
    public static String getStringParameter(HttpServletRequest request, String name) throws ParameterNotFoundException {
        String[] values = request.getParameterValues(name);
        if (values == null) {
            throw new ParameterNotFoundException(name + " not found");
        } else if (values[0].length() == 0) {
            throw new ParameterNotFoundException(name + " was empty");
        } else {
            return values[0]; // Just return the first value
        }
    }
View Full Code Here

     * @throws ParameterNotFoundException if the parameter was not specified
     */
    public static Integer getRoleId(HttpServletRequest request) throws ParameterNotFoundException {
        String roleId = request.getParameter(Constants.ROLE_PARAM);
        if ((roleId == null) || roleId.equals("")) {
            throw new ParameterNotFoundException("role id not found");
        }

        return new Integer(roleId);
    }
View Full Code Here

     * @throws ParameterNotFoundException if the parameter was not specified
     */
    public static Integer getScheduleId(HttpServletRequest request) throws ParameterNotFoundException {
        String scheduleId = request.getParameter(Constants.SCHEDULE_PARAM);
        if ((scheduleId == null) || scheduleId.equals("")) {
            throw new ParameterNotFoundException("schedule id not found");
        }

        return new Integer(scheduleId);
    }
View Full Code Here

     * @throws ParameterNotFoundException if the parameter was not specified
     */
    public static Integer getResourceTypeId(HttpServletRequest request) throws ParameterNotFoundException {
        String resourceTypeId = request.getParameter(Constants.RESOURCE_TYPE_ID_PARAM);
        if ((resourceTypeId == null) || resourceTypeId.equals("")) {
            throw new ParameterNotFoundException("resource type id not found");
        }

        return new Integer(resourceTypeId);
    }
View Full Code Here

     * @throws ParameterNotFoundException if the parameter was not specified
     */
    public static Integer getAutogroupResourceTypeId(HttpServletRequest request) throws ParameterNotFoundException {
        String autogrouptypeId = request.getParameter(Constants.AUTOGROUP_TYPE_ID_PARAM);
        if ((autogrouptypeId == null) || autogrouptypeId.equals("")) {
            throw new ParameterNotFoundException("autogroup resource type id not found");
        }

        return new Integer(autogrouptypeId);
    }
View Full Code Here

     * @throws ParameterNotFoundException if the parameter was not specified
     */
    public static Integer getUserId(HttpServletRequest request) throws ParameterNotFoundException {
        String userId = request.getParameter(Constants.USER_PARAM);
        if ((userId == null) || userId.equals("")) {
            throw new ParameterNotFoundException("user id not found");
        }

        return new Integer(userId);
    }
View Full Code Here

     * @throws ParameterNotFoundException if the parameter was not specified
     */
    public static Integer getMetricId(HttpServletRequest request) throws ParameterNotFoundException {
        String metricId = request.getParameter(Constants.METRIC_ID_PARAM);
        if ((metricId == null) || metricId.equals("")) {
            throw new ParameterNotFoundException("metric baseline param not found");
        }

        return new Integer(metricId);
    }
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.gui.legacy.exception.ParameterNotFoundException

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.