All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.verifier.reports.RangeCheckReports.drl Maven / Gradle / Ivy

There is a newer version: 9.44.0.Final
Show newest version
/*
 * Copyright 2010 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

//created on: 7.6.2007
package org.drools.verifier.rangeChecks.reports;

//list any import classes here.
import org.drools.verifier.components.Field;
import org.drools.verifier.report.components.VerifierRangeCheckMessage;
import org.drools.verifier.data.VerifierReport;
import org.drools.verifier.report.components.MissingRange;
import org.drools.verifier.report.components.Severity;
import org.drools.verifier.report.components.MessageType;

import java.util.ArrayList;

//declare any global variables here
global VerifierReport result


//
// Dependencies:
//
//    Needs at least one of the following packages or rules to fire:
//         package org.drools.verifier.rangeChecks.patterns;
//            rule "Range check for number patterns"
//            rule "Range check for number patterns, !="
//        package org.drools.verifier.rangeChecks.integers
//            rule "Range check for integers, if smaller than or equal is missing"
//            rule "Range check for integers, if greater than or equal is missing"
//            rule "Range check for integers, equal and greater than"
//            rule "Range check for integers, equal and smaller than"
//        package org.drools.verifier.rangeChecks.doubles
//            rule "Range check for doubles, if smaller than or equal is missing"
//            rule "Range check for doubles, if greater than or equal is missing"
//            rule "Range check for doubles, equal and greater than"
//            rule "Range check for doubles, equal and smaller than"
//        package org.drools.verifier.rangeChecks.dates
//            rule "Range check for dates, if smaller than or equal is missing"
//            rule "Range check for dates, if greater than or equal is missing"
//            rule "Range check for dates, equal and greater than"
//            rule "Range check for dates, equal and smaller than"
//
//    The following rules are used to clean up the data that this rule uses,
//    but they are not always necessary:
//        package org.drools.verifier.rangeChecks.cleanUp
//            rule "Merge gaps"
//            rule "Remove useless integer gaps lesser or lesser and equal"
//            rule "Remove useless integer gaps greater or greater and equal"
//            rule "Remove useless double gaps lesser or lesser and equal"
//            rule "Remove useless double gaps greater or greater and equal"
//            rule "Remove useless date gaps lesser or lesser and equal"
//            rule "Remove useless date gaps greater or greater and equal"
//
rule "Collect gaps"
    @verifying_scopes(["knowledge-package", "decision-table"])
    salience -100
    when
        $f :Field()
        $list :ArrayList( size > 0)
            from collect(
                MissingRange( field == $f )
            )
    then
        result.add( new VerifierRangeCheckMessage(
                                Severity.WARNING, $f,
                                $f + " has one or more gaps.", $list ) );
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy