-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[incubator-kie-drools-6010] Date Between Dates with globals Not Trigg… #6011
[incubator-kie-drools-6010] Date Between Dates with globals Not Trigg… #6011
Conversation
…ering for Executable Model
if (!(this.identifier.equals(other.identifier))) { | ||
return false; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this check, ConstraintEvaluator.replaceDeclaration
considers that GlobalExtractor
for $startDate
and GlobalExtractor
for $endDate
are the same.
} | ||
|
||
@Test | ||
public void dateBetweenVariables() throws ParseException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test (not using globals) doesn't have the issue, because resolver.getDeclaration()
returns the same Declaration object, so replaceDeclaration()
is not called.
private void replaceDeclarations( DeclarationScopeResolver resolver, Pattern pattern, Constraint constraint ) {
Declaration[] decl = constraint.getRequiredDeclarations();
for ( Declaration aDecl : decl ) {
Declaration resolved = resolver.getDeclaration( aDecl.getIdentifier() );
if ( constraint instanceof IndexableConstraint && ( (IndexableConstraint) constraint ).isUnification() ) {
if ( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) {
Declaration redeclaredDeclr = new Declaration( resolved.getIdentifier(), ( (IndexableConstraint) constraint ).getFieldExtractor(), pattern, false );
pattern.addDeclaration( redeclaredDeclr );
} else if ( resolved.getPattern() != pattern ) {
( (IndexableConstraint ) constraint ).unsetUnification();
}
}
if ( resolved != null && resolved != aDecl && resolved.getPattern() != pattern ) {
constraint.replaceDeclaration( aDecl,
resolved );
} else if ( resolved == null ) {
GHA kogito-apps : not related to this PR
GHA kogito-quarkus-examples : not related to this PR
|
@mariofusco @lucamolteni @pibizza Please review, thanks! |
…ering for Executable Model (apache#6011)
…ering for Executable Model
Issue: