org.drools.verifier.consequence.NamedConsequences.drl Maven / Gradle / Ivy
/*
* Copyright 2013 JBoss Inc
*
* 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.
*/
package org.drools.verifier.consequence
//list any import classes here.
import org.drools.verifier.components.VerifierRule;
import org.drools.verifier.components.TextConsequence;
import org.drools.verifier.components.NamedConsequence;
import org.drools.verifier.report.components.VerifierMessage;
import org.drools.verifier.data.VerifierReport;
import org.drools.verifier.report.components.Severity;
import org.drools.verifier.report.components.MessageType;
import java.util.Map;
import java.util.HashMap;
//declare any global variables here
global VerifierReport result;
/**
* For situations where the named consequence is listed in the bottom, but not used in RHS.
*/
rule "Named consequence declared, but not used"
when
$consequence : NamedConsequence( )
$rule :VerifierRule( namedConsequences not contains $consequence.name )
then
Map impactedRules = new HashMap();
impactedRules.put( $rule.getPath(), $rule.getName());
result.add( new VerifierMessage(
impactedRules,
Severity.NOTE,
MessageType.MISSING_COMPONENT,
null,
$rule + " has named consequence: " + $consequence.getName() + " declared, but it is not used." ) );
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy