Package org.guvnor.common.services.shared.validation.model

Examples of org.guvnor.common.services.shared.validation.model.BuilderResult


    @Override
    public BuilderResult validate( final Path path,
                                   final String content ) {
        //TODO {porcelli} validate
        return new BuilderResult();
    }
View Full Code Here


    @Override
    public BuilderResult validate( final Path path,
                                   final GuidedDecisionTable52 content ) {
        //TODO {manstis} validate
        return new BuilderResult();
    }
View Full Code Here

    @Override
    public String toSource( final Path path,
                            final ScoreCardModel model ) {
        try {
            final BuilderResult result = validateScoreCard( model );
            if ( !result.hasLines() ) {
                return toDRL( path, model );
            }
            return toDRL( result );

        } catch ( Exception e ) {
View Full Code Here

    @Override
    public BuilderResult validate( final Path path,
                                   final ScoreCardModel model ) {
        try {
            final BuilderResult result = validateScoreCard( model );
            return result;

        } catch ( Exception e ) {
            throw ExceptionUtilities.handleException( e );
        }
View Full Code Here

        }
        return drl.toString();
    }

    private BuilderResult validateScoreCard( final ScoreCardModel model ) {
        final BuilderResult builderResult = new BuilderResult();
        if ( StringUtils.isBlank( model.getFactName() ) ) {
            builderResult.addLine( createBuilderResultLine( "Fact Name is empty.",
                                                            "Setup Parameters" ) );
        }
        if ( StringUtils.isBlank( model.getFieldName() ) ) {
            builderResult.addLine( createBuilderResultLine( "Resultant Score Field is empty.",
                                                            "Setup Parameters" ) );
        }
        if ( model.getCharacteristics().size() == 0 ) {
            builderResult.addLine( createBuilderResultLine( "No Characteristics Found.",
                                                            "Characteristics" ) );
        }
        int ctr = 1;
        for ( final Characteristic c : model.getCharacteristics() ) {
            String characteristicName = "Characteristic ('#" + ctr + "')";
            if ( StringUtils.isBlank( c.getName() ) ) {
                builderResult.addLine( createBuilderResultLine( "Name is empty.",
                                                                characteristicName ) );
            } else {
                characteristicName = "Characteristic ('" + c.getName() + "')";
            }
            if ( StringUtils.isBlank( c.getFact() ) ) {
                builderResult.addLine( createBuilderResultLine( "Fact is empty.",
                                                                characteristicName ) );
            }
            if ( StringUtils.isBlank( c.getField() ) ) {
                builderResult.addLine( createBuilderResultLine( "Characteristic Field is empty.",
                                                                characteristicName ) );
            } else if ( StringUtils.isBlank( c.getDataType() ) ) {
                builderResult.addLine( createBuilderResultLine( "Internal Error (missing datatype).",
                                                                characteristicName ) );
            }
            if ( c.getAttributes().size() == 0 ) {
                builderResult.addLine( createBuilderResultLine( "No Attributes Found.",
                                                                characteristicName ) );
            }
            if ( model.isUseReasonCodes() ) {
                if ( StringUtils.isBlank( model.getReasonCodeField() ) ) {
                    builderResult.addLine( createBuilderResultLine( "Resultant Reason Codes Field is empty.",
                                                                    characteristicName ) );
                }
                if ( !"none".equalsIgnoreCase( model.getReasonCodesAlgorithm() ) ) {
                    builderResult.addLine( createBuilderResultLine( "Baseline Score is not specified.",
                                                                    characteristicName ) );
                }
            }
            int attrCtr = 1;
            for ( final Attribute attribute : c.getAttributes() ) {
                final String attributeName = "Attribute ('#" + attrCtr + "')";
                if ( StringUtils.isBlank( attribute.getOperator() ) ) {
                    builderResult.addLine( createBuilderResultLine( "Attribute Operator is empty.",
                                                                    attributeName ) );
                }
                if ( StringUtils.isBlank( attribute.getValue() ) ) {
                    builderResult.addLine( createBuilderResultLine( "Attribute Value is empty.",
                                                                    attributeName ) );
                }
                if ( model.isUseReasonCodes() ) {
                    if ( StringUtils.isBlank( c.getReasonCode() ) ) {
                        if ( StringUtils.isBlank( attribute.getReasonCode() ) ) {
                            builderResult.addLine( createBuilderResultLine( "Reason Code must be set at either attribute or characteristic.",
                                                                            attributeName ) );
                        }
                    }
                }
                attrCtr++;
View Full Code Here

    @Override
    public BuilderResult validate( final Path path,
                                   final String content ) {
        //TODO {porcelli} validate
        return new BuilderResult();
    }
View Full Code Here

    @Override
    public BuilderResult validate( final Path path,
                                   final TemplateModel content ) {
        //TODO {porcelli} validate
        return new BuilderResult();
    }
View Full Code Here

    @Override
    public BuilderResult validate( final Path path,
                                   final String content ) {
        //TODO {porcelli} validate
        return new BuilderResult();
    }
View Full Code Here

    @Override
    public BuilderResult validate( final Path path,
                                   final String content ) {
        //TODO {porcelli} validate
        return new BuilderResult();
    }
View Full Code Here

    @Override
    public BuilderResult validate( final Path path,
                                   final FactModels content ) {
        //TODO {porcelli} validate
        return new BuilderResult();
    }
View Full Code Here

TOP

Related Classes of org.guvnor.common.services.shared.validation.model.BuilderResult

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.