public AttributeDescrBuilderImpl(P parent, String name) { super( parent, new AttributeDescr( name ) ); }
public AttributeDescrBuilder<P> type( Type type ) { descr.setType( type ); return this; }
public AttributeDescr getAttribute( String name ) { if ( name != null ) { for ( AttributeDescr attr : this.attributes ) { if ( name.equals( attr.getName() ) ) { return attr; } } } return null; }
public String getEnabled() { AttributeDescr enabled = this.attributes.get( "enabled" ); return enabled != null ? enabled.getValue() : null; }
public AttributeDescrBuilderImpl<P> value( String value ) { descr.setValue( value ); return this; }
if (!currentAttributeDescrs.contains(descr)) { addAttribute(descr); descr.setResource(resource);
public void addAttribute(final AttributeDescr attribute) { if ( attribute != null ) { this.attributes.put( attribute.getName(), attribute ); } }
public String getDialect() { AttributeDescr dialect = this.attributes.get( "dialect" ); return dialect != null ? dialect.getValue() : null; }
private String getPackageDialect(PackageDescr packageDescr) { String dialectName = this.defaultDialect; // see if this packageDescr overrides the current default dialect for (AttributeDescr value : packageDescr.getAttributes()) { if ("dialect".equals(value.getName())) { dialectName = value.getValue(); break; } } return dialectName; }
public PackageDescrBuilder attribute( String name, String value, AttributeDescr.Type type ) { descr.addAttribute( new AttributeDescr( name, value, type ) ); return this; }
public void addRule( final RuleDescr rule ) { if ( this.rules == Collections.EMPTY_LIST ) { this.rules = new ArrayList<RuleDescr>( 1 ); } for ( final AttributeDescr at : attributes ) { // check if rule overrides the attribute if ( !rule.getAttributes().containsKey( at.getName() ) ) { // if not, use default value rule.addAttribute( at ); } } this.rules.add( rule ); }
public String getSalience() { AttributeDescr salience = this.attributes.get( "salience" ); return salience != null ? salience.getValue() : null; }
attribute = stringAttribute( as, new String[]{DroolsSoftKeywords.DATE, "-", DroolsSoftKeywords.EFFECTIVE} ); attribute.setType( AttributeDescr.Type.DATE ); } else if ( helper.validateIdentifierKey( DroolsSoftKeywords.DATE ) && helper.validateLT( 2, attribute = stringAttribute( as, new String[]{DroolsSoftKeywords.DATE, "-", DroolsSoftKeywords.EXPIRES} ); attribute.setType( AttributeDescr.Type.DATE ); } else if ( helper.validateIdentifierKey( DroolsSoftKeywords.DIALECT ) ) { attribute = stringAttribute( as,
final String name = attributeDescr.getName(); if ( name.equals( "no-loop" ) ) { rule.setNoLoop( getBooleanValue( attributeDescr, true ) ); } else if ( name.equals( "agenda-group" ) ) { rule.setAgendaGroup( attributeDescr.getValue() ); } else if ( name.equals( "activation-group" ) ) { rule.setActivationGroup( attributeDescr.getValue() ); } else if ( name.equals( "ruleflow-group" ) ) { rule.setRuleFlowGroup( attributeDescr.getValue() ); } 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 );
public PackageDescrBuilder attribute( String name, String value ) { descr.addAttribute( new AttributeDescr( name, value ) ); return this; }
private void inheritPackageAttributes( Map<String, AttributeDescr> pkgAttributes, RuleDescr ruleDescr ) { if (pkgAttributes == null) { return; } for (AttributeDescr attrDescr : pkgAttributes.values()) { String name = attrDescr.getName(); AttributeDescr ruleAttrDescr = ruleDescr.getAttributes().get( name ); if (ruleAttrDescr == null) { ruleDescr.getAttributes().put( name, attrDescr ); } } }
public RuleDescrBuilder attribute( String name, String value ) { descr.addAttribute( new AttributeDescr( name, value ) ); return this; }
pkgAttributes.put( attr.getName(), attr );