Package com.sun.enterprise.tools.common.validation.constraints

Examples of com.sun.enterprise.tools.common.validation.constraints.CardinalConstraint


     */
    private Collection validateCardinalConstraint(Validatee validatee,
            String elementName, String elementDtdName){
        ArrayList failures = new ArrayList();
        int cardinal = validatee.getElementCardinal(elementName);
        CardinalConstraint constraint = getCardinalConstraint(cardinal);

        switch(cardinal){
            case Constants.MANDATORY_ARRAY :
            case Constants.OPTIONAL_ARRAY: {
                Object[] elements =
                    (Object [])validatee.getElements(elementName);
                String name = validatee.getIndexedXPath() +
                    Constants.XPATH_DELIMITER + elementDtdName;
                ///String name = validatee.getXPath() +
                    ///Constants.XPATH_DELIMITER + elementDtdName;
                failures.addAll(constraint.match(elements, name));
                break;
            }
            case Constants.OPTIONAL_ELEMENT : {
                Object element = validatee.getElement(elementName);
                break;
            }
            case Constants.MANDATORY_ELEMENT :
            default : {
                Object element = validatee.getElement(elementName);
                String name = validatee.getIndexedXPath() +
                    Constants.XPATH_DELIMITER + elementDtdName;
                ///String name = validatee.getXPath() +
                    ///Constants.XPATH_DELIMITER + elementDtdName;
                failures.addAll(constraint.match(element, name));
            }
            break;
        }
        return failures;
    }

TOP

Related Classes of com.sun.enterprise.tools.common.validation.constraints.CardinalConstraint

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.