Drools is an inference engine and it let you express your knowledge using rules.
A rule has 2 parts: CONDITION par and ACTION part.
The CONDITION part is expressed in a drools' proprietary syntax, but in the ACTION part you can use plain java code.
What you have described looks like an action that needs to be executed when certain constraints are meet.
So, in your case, you can just write those lines in you action part. They should work fine.
Best Regards,