Package eu.scape_project.planning.validation

Examples of eu.scape_project.planning.validation.ValidationError


    @Override
    protected boolean tryProceed(List<ValidationError> errors) {
        // view-specific validation
        if (editableAlternative != null) {
            errors
                .add(new ValidationError(
                    "You are currently editing an Alternative. Please finish editing first before you proceed to the next step.",
                    editableAlternative));
        }

        // general validation
View Full Code Here


     */
    protected boolean tryProceed(List<ValidationError> errors) {
        try {
            return getWfStep().proceed(errors);
        } catch (Exception e) {
            errors.add(new ValidationError("Failed to save changes."));
            log.error("Failed to save changes.", e);
        }
        return false;
    }
View Full Code Here

     * @see Scale#isCorrectlySpecified(String, List)
     */
    @Override
    public boolean isCompletelySpecified(List<ValidationError> errors) {
        if (this.scale == null) {
            errors.add(new ValidationError("Leaf " + this.getName() + " has no scale", this));
            return false;
        }
        if (scale instanceof YanScale) {
            errors
                .add(new ValidationError(
                    "Criterion "
                        + getName()
                        + " is associated with a 'Yes/Acceptable/No' scale, which is discouraged. We recommend to refine the criterion to be as objective as possible.",
                    this));
        }
View Full Code Here

            }
        }
        if (!validates) {
            // I add an error message to the list, and myself to the list of
            // error nodes
            errors.add(new ValidationError("Leaf " + this.getName() + " is not properly evaluated", this));
        }
        return validates;
    }
View Full Code Here

     * @see TreeNode#isCompletelyTransformed(List)
     */
    @Override
    public boolean isCompletelyTransformed(List<ValidationError> errors) {
        if (this.transformer == null) {
            errors.add(new ValidationError("Leaf " + this.getName() + " is not properly transformed", this));
            log.error("Transformer is NULL in Leaf " + getParent().getName() + " > " + getName());
            return false;
        }
        if (!this.transformer.isTransformable(errors) || !this.transformer.isChanged()) {
            errors.add(new ValidationError("Leaf " + this.getName() + " is not properly transformed", this));
            return false;
        }
        return true;
    }
View Full Code Here

        // A leaf is always weighted correctly as long as its weight is in [0,1]
        if (this.weight >= 0 && this.weight <= 1) {
            return true;
        }
        errors
            .add(new ValidationError("Leaf " + this.getName() + " has an illegal weight (" + this.weight + ")", this));
        return false;
    }
View Full Code Here

    private boolean hasDuplicates(List<ValidationError> errors) {
        boolean duplicates = false;
        Collection<String> childNames = new HashSet<String>();
        for (TreeNode node : this.children) {
            if (childNames.contains(node.getName())) {
                errors.add(new ValidationError("Node '" + this.getName()
                        + "' has several children with the name '" + node.getName() + "'", this));
                duplicates = true;
            } else {
                childNames.add(node.getName());
            }
View Full Code Here

     */
    @Override
    public boolean isCompletelySpecified(List<ValidationError> errors) {
        boolean noError = true;
        if (this.children.size() == 0) {
          errors.add(new ValidationError("Node " + this.getName() + " has no Children.", this));
            noError = false;
        }
        if (this.hasDuplicates(errors)) {
            noError = false;
        }
View Full Code Here

            sum += (int)Math.round(100.0 * child.getWeight());
        }
        if (sum.equals(100)) {
            return true;
        }
        errors.add(new ValidationError("The sum of the weights of node " + this.getName()
                + "'s children is not 1 (but " + sum / 100.0 + ").", this));
        return false;
    }
View Full Code Here

    }

    @Override
    protected boolean restrictionIsValid(String leafName, List<ValidationError> errors) {
        if (this.upperBound <= 0) {
            errors.add(new ValidationError("The upper bound specified for leaf \"" + leafName
                + "\" is not greater than zero!", this));
            return false;
        }
        return true;
    }
View Full Code Here

TOP

Related Classes of eu.scape_project.planning.validation.ValidationError

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.