Examples of AlertConditionCategory


Examples of org.rhq.core.domain.alert.AlertConditionCategory

        return toCondition;
    }

    public static void importProperties(Subject subject, AlertCondition fromCondition, ConditionBean toBean) {
        AlertConditionCategory category = fromCondition.getCategory();

        if ((category == AlertConditionCategory.THRESHOLD) || (category == AlertConditionCategory.BASELINE)
            || (category == AlertConditionCategory.CHANGE)) {
            DataType measDataType = null;
            if (fromCondition.getMeasurementDefinition() != null)
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionCategory

    private static final Log log = LogFactory.getLog(AlertConditionCacheCoordinator.class);

    public static AlertConditionOperator getAlertConditionOperator(AlertCondition alertCondition) {

        AlertConditionCategory category = alertCondition.getCategory();
        String name = alertCondition.getName();
        String comparator = alertCondition.getComparator();

        switch (category) {
        case CONTROL:
            // the UI currently only supports one operator for control
            return AlertConditionOperator.EQUALS;

        case EVENT:
            // the UI currently only supports one operator for events
            return AlertConditionOperator.GREATER_THAN_OR_EQUAL_TO;

        case DRIFT:
            // any drift that is detected infers a change to its previous state
            return AlertConditionOperator.CHANGES;

        case RESOURCE_CONFIG:
        case CHANGE:
            // the model currently supports CHANGE as a category type instead of a comparator
            return AlertConditionOperator.CHANGES;

        case TRAIT:
            String regex = alertCondition.getOption();
            return (null == regex || regex.isEmpty()) ? AlertConditionOperator.CHANGES : AlertConditionOperator.REGEX;

        case AVAILABILITY: {
            AlertConditionOperator operator = AlertConditionOperator.valueOf(name.toUpperCase());

            switch (operator) {
            case AVAIL_GOES_DISABLED:
            case AVAIL_GOES_DOWN:
            case AVAIL_GOES_UNKNOWN:
            case AVAIL_GOES_UP:
            case AVAIL_GOES_NOT_UP:
                return operator;

            default:
                throw new UnsupportedAlertConditionOperatorException(
                    "Invalid alertConditionValue for AVAILABILITY category:" + operator);
            }
        }

        case AVAIL_DURATION: {
            AlertConditionOperator operator = AlertConditionOperator.valueOf(name.toUpperCase());

            switch (operator) {
            case AVAIL_DURATION_DOWN:
            case AVAIL_DURATION_NOT_UP:
                return operator;

            default:
                throw new UnsupportedAlertConditionOperatorException(
                    "Invalid alertConditionValue for AVAILABILITY_DURATION category:" + operator);
            }
        }

        case RANGE:
            // range can support <= and >=, which we look for here. It can also support < and >, which is checked down below further.
            // note that RANGE does not support =, so we throw an exception if caller tries that
            if (comparator.equals("<=")) {
                return AlertConditionOperator.LESS_THAN_OR_EQUAL_TO;

            } else if (comparator.equals(">=")) {
                return AlertConditionOperator.GREATER_THAN_OR_EQUAL_TO;

            } else if (comparator.equals("=")) {
                throw new UnsupportedAlertConditionOperatorException("Comparator [" + comparator + "] "
                    + "is not supported for category: " + category.name());
            }

        default:

            if (comparator.equals("<")) {
                return AlertConditionOperator.LESS_THAN;
            } else if (comparator.equals(">")) {
                return AlertConditionOperator.GREATER_THAN;
            } else if (comparator.equals("=")) {
                return AlertConditionOperator.EQUALS;
            } else {
                throw new UnsupportedAlertConditionOperatorException("Comparator [" + comparator + "] "
                    + "is not supported for category: " + category.name());
            }
        }
    }
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionCategory

        AlertConditionCacheStats stats) {

        AlertCondition alertCondition = composite.getCondition();
        int alertConditionId = alertCondition.getId(); // auto-unboxing is safe here because as the PK it's guaranteed to be non-null

        AlertConditionCategory alertConditionCategory = alertCondition.getCategory();
        AlertConditionOperator alertConditionOperator = AlertConditionCacheUtils
            .getAlertConditionOperator(alertCondition);

        if (alertConditionCategory == AlertConditionCategory.AVAILABILITY) {
            AlertConditionAvailabilityCategoryComposite availabilityComposite = (AlertConditionAvailabilityCategoryComposite) composite;
View Full Code Here

Examples of org.rhq.core.domain.alert.AlertConditionCategory

        String conditionName = conditionRest.getName();
        // Set the name for all cases and allow it to be overridden later.
        condition.setName(conditionName);

        AlertConditionCategory category = condition.getCategory();
        switch (category) {
        case ALERT:
            // Looks internal -- noting to do.
            break;
        case AVAIL_DURATION:
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.