All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.console.client.shared.general.validation.OtherConstraintsValidation Maven / Gradle / Ivy

Go to download

Bundles the core AS7 console as a GWT module. Includes minor customizations to support extensions.

There is a newer version: 0.7.0.Final
Show newest version
package org.jboss.as.console.client.shared.general.validation;

import org.jboss.as.console.client.shared.general.model.Interface;

import java.util.Map;
import java.util.Set;

/**
 * Validates the other constraints
 *
 * @author Heiko Braun
 * @date 11/15/11
 */
class OtherConstraintsValidation extends AbstractValidationStep {

    private static final String UP = "up";
    private static final String VIRTUAL = "virtual";

    private static final String PUBLIC_ADDRESS = "publicAddress";
    private static final String SITE_LOCAL_ADDRESS= "siteLocal";
    private static final String LINK_LOCAL_ADDRESS = "linkLocal";
    private static final String MULTICAST = "multicast";
    private static final String POINT_TO_POINT = "pointToPoint";

    private static String[] ALL = {
            UP, VIRTUAL, PUBLIC_ADDRESS, SITE_LOCAL_ADDRESS, LINK_LOCAL_ADDRESS, MULTICAST, POINT_TO_POINT
    };

    @Override
    public boolean doesApplyTo(Interface entity, Map changedValues) {
        Map clean = clearChangeset(changedValues);

        boolean hasSetValues = entity.isLoopback() || isSet(entity.getLoopbackAddress());
        boolean relevantChanges = false;

        Set keys = clean.keySet();
        for(String key : keys)
        {
            for(String prop : ALL)
            {
                if(key.equals(prop) )
                {
                    relevantChanges = true;
                    break;
                }
            }

        }

        return hasSetValues || relevantChanges;
    }

    @Override
    protected DecisionTree buildDecisionTree(Interface entity, Map changedValues) {

        final Map changeset = clearChangeset(changedValues);

        final DecisionTree tree =  new DecisionTree(entity);

        // INET ADDRESS
        tree.createRoot(1,"Anything is valid", SUCCESS);

        // TODO: for now we keep it simple

        return tree;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy