[rules-users] Agenda filter based on package name

james_d jamesdull at gmail.com
Mon Nov 5 14:52:16 EST 2007


I've run into the same problem --  I get null when I call Rule.getPackage(). 
Is this a bug?  Should this be tied to a JIRA feature request?

Thanks,
James



Hooman Mozaffari wrote:
> 
> 
> It seems "Rule" class doesn't store its parent "Package" information and
> Rule.getPackage() always returns null.
> I would like to create an AgendaFilter based on package name but there is
> no way to get the parent package of each rule.
>  
> Thanks,
> Hooman
>  
>  
> public class PackageNameAgendaFilter implements AgendaFilter {
>    private final String packageSuffix;
>    private final boolean accept;
>    
>    public PackageNameAgendaFilter(String packageSuffix){
>       this(packageSuffix, true);
>    }
>    
>    public PackageNameAgendaFilter(String packageSuffix, boolean accept){
>       this.packageSuffix = packageSuffix;
>       this.accept = accept;
>    }
>    
>    public boolean accept(Activation activation) {
>       if(activation.getRule().getPackage().startsWith(packageSuffix))
>          return accept;
>       else
>          return false;
>    }
> }
> _________________________________________________________________
> Discover the new Windows Vista
> http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Agenda-filter-based-on-package-name-tf3835586.html#a13594215
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list