Package com.volantis.mcs.model.validation

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


        if (!diagnostics.isEmpty()) {
            StringBuffer buffer = new StringBuffer();
            boolean foundError = false;
            for (int i = 0; i < diagnostics.size(); i++) {
                Diagnostic diagnostic = (Diagnostic) diagnostics.get(i);

                // Add the level.
                DiagnosticLevel level = diagnostic.getLevel();
                if (level == DiagnosticLevel.ERROR) {
                    foundError = true;
                }
                buffer.append(level);

                // Add the position in the file
                buffer.append(" ");
                SourceLocation location = diagnostic.getLocation();
                buffer.append(location.getSourceDocumentName());
                buffer.append(":(");
                buffer.append(location.getSourceLineNumber());
                buffer.append(",");
                buffer.append(location.getSourceColumnNumber());
                buffer.append(")");

                // Only add the path if debug is enabled since it is internal
                // but it can be pretty useful.
                if (logger.isDebugEnabled()) {
                    buffer.append(" ");
                    buffer.append(diagnostic.getPath());
                }

                // Add the message
                buffer.append(" - ");
                buffer.append(diagnostic.getMessage());
                buffer.append("\n");
            }

            if (foundError) {
                if (logger.isErrorEnabled()) {
View Full Code Here


            }

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

        // Only change the error message if it has a new value.
        if (!ObjectHelper.equals(getErrorMessage(), errorMessage)) {
View Full Code Here

                    expectedDiagnostics.get(i);

            boolean matched = false;
            for (Iterator d = diagnostics.iterator();
                 !matched && d.hasNext();) {
                Diagnostic diagnostic = (Diagnostic) d.next();
                if (expectedDiagnostic.matches(diagnostic)) {
                    d.remove();
                    matched = true;
                }
            }

            if (!matched) {
                buffer.append("Expected Diagnostic: " + expectedDiagnostic +
                        " was unmatched\n");
            }
        }

        if (!diagnostics.isEmpty()) {
            if (buffer.length() != 0) {
                buffer.append("\n");
            }
            buffer.append("The following diagnostics were unexpected:");
            for (Iterator i = diagnostics.iterator(); i.hasNext();) {
                Diagnostic diagnostic = (Diagnostic) i.next();
                buffer.append(diagnostic).append("\n");
            }
        }

        if (buffer.length() != 0) {
View Full Code Here

        // 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);
            if (internalProxy == null) {
                // System.out.println("Unknown path: " + path.getAsString());
            } else {
                ProxyDiagnostic proxyDiagnostic = new ProxyDiagnosticImpl(
                        diagnostic.getLevel(), internalProxy,
                        diagnostic.getMessage());
                internalProxy.addDiagnostic(proxyDiagnostic);
            }
        }

        // Walk back over the proxies generating events if the diagnostics
View Full Code Here

TOP

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

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.