}
return result;
}
public void buildAttributes(final RuleBuildContext context) {
final Rule rule = context.getRule();
final RuleDescr ruleDescr = context.getRuleDescr();
for ( final AttributeDescr attributeDescr : ruleDescr.getAttributes().values() ) {
final String name = attributeDescr.getName();
if ( name.equals( "no-loop" ) ) {
rule.setNoLoop( getBooleanValue( attributeDescr,
true ) );
} else if ( name.equals( "auto-focus" ) ) {
rule.setAutoFocus( getBooleanValue( attributeDescr,
true ) );
} else if ( name.equals( "agenda-group" ) ) {
if ( StringUtils.isEmpty(rule.getRuleFlowGroup())) {
rule.setAgendaGroup( attributeDescr.getValue() ); // don't override if RFG has already set this
}
} else if ( name.equals( "activation-group" ) ) {
rule.setActivationGroup( attributeDescr.getValue() );
} else if ( name.equals( "ruleflow-group" ) ) {
rule.setRuleFlowGroup( attributeDescr.getValue() );
rule.setAgendaGroup( attributeDescr.getValue() ); // assign AG to the same name as AG, as they are aliased to AGs anyway
} else if ( name.equals( "lock-on-active" ) ) {
rule.setLockOnActive( getBooleanValue( attributeDescr,
true ) );
} else if ( name.equals( DroolsSoftKeywords.DURATION ) || name.equals( DroolsSoftKeywords.TIMER ) ) {
String duration = attributeDescr.getValue();
buildTimer( rule, duration, context);
} else if ( name.equals( "calendars" ) ) {
buildCalendars( rule, attributeDescr.getValue(), context );
} else if ( name.equals( "date-effective" ) ) {
final Calendar cal = Calendar.getInstance();
cal.setTime( DateUtils.parseDate( attributeDescr.getValue(),
context.getPackageBuilder().getDateFormats() ) );
rule.setDateEffective( cal );
} else if ( name.equals( "date-expires" ) ) {
final Calendar cal = Calendar.getInstance();
cal.setTime( DateUtils.parseDate( attributeDescr.getValue(),
context.getPackageBuilder().getDateFormats() ) );
rule.setDateExpires( cal );
}
}
buildSalience( context );
buildEnabled( context );
AnnotationDescr ann = ruleDescr.getAnnotation( "activationListener" );
if ( ann != null && !StringUtils.isEmpty( (String) ann.getValue() ) ) {
rule.setActivationListener( MVEL.evalToString( (String) ann.getValue() ) );
}
ann = ruleDescr.getAnnotation( "Eager" );
if ( ann != null && !StringUtils.isEmpty( (String) ann.getValue() ) ) {
rule.setEager( true );
}
// buildDuration( context );
}