Package com.volantis.mcs.model.validation

Examples of com.volantis.mcs.model.validation.Validator


        String errorMessage = null;

        Object object = listBuilder.getObjectControl().getValue();
        if (object != null && object instanceof Validatable) {
            ModelFactory modelFactory = ModelFactory.getDefaultInstance();
            Validator validator = modelFactory.createValidator();

            // Validate the object being created
            validator.validate((Validatable) object);

            // Validate the already created selectors
            List selectors = listBuilder.getItems();
            Iterator it = selectors.iterator();
            while (it.hasNext() && validator.getDiagnostics().isEmpty()) {
                validator.validate((Validatable) it.next());
            }

            // Retrieve the first error message
            List diagnostics = validator.getDiagnostics();
            if (!diagnostics.isEmpty()) {
                Diagnostic firstDiagnostic = (Diagnostic) diagnostics.get(0);
                errorMessage = firstDiagnostic.getMessage().getMessage();
            }
        }
View Full Code Here


        expectedDiagnostics = new ArrayList();
        this.pruning = pruning;
    }

    public void validate(Validatable validatable) {
        Validator validator = ModelFactory.getDefaultInstance()
                .createValidator();
        validator.validate(validatable);

        if (pruning && validatable instanceof Pruneable) {
            ((Pruneable)validatable).prune(validator.getValidationContext(),
                    validator.getDiagnostics());
        }

        StringBuffer buffer = new StringBuffer();

        List diagnostics = validator.getDiagnostics();
        for (int i = 0; i < expectedDiagnostics.size(); i++) {
            ExpectedDiagnostic expectedDiagnostic = (ExpectedDiagnostic)
                    expectedDiagnostics.get(i);

            boolean matched = false;
View Full Code Here

        // Prepare each proxy for validation.
        PREPARE_4_VALIDATION.prepare(proxy);

        // Validate the model.
        Validator validator = MODEL_FACTORY.createValidator();
        Validatable validatable = (Validatable) proxy.getModelObject();
        validator.validate(validatable);

        // Get the diagnostics and iterate over them associating them with
        // the relevant proxy.
        List diagnostics = validator.getDiagnostics();
        for (int i = 0; i < diagnostics.size(); i++) {
            Diagnostic diagnostic = (Diagnostic) diagnostics.get(i);
            Path path = diagnostic.getPath();
            InternalProxy internalProxy = (InternalProxy)
                    proxy.getEnclosingProxy(path);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.model.validation.Validator

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.