private void addKieBaseModels(ConfigurableListableBeanFactory beanFactory, KieModuleModelImpl kieModuleModel) {
BeanExpressionContext context = new BeanExpressionContext(beanFactory, null);
for (String beanDef : beanFactory.getBeanDefinitionNames()){
BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanDef);
if ( beanDefinition.getBeanClassName() != null && beanDefinition.getBeanClassName().equalsIgnoreCase(KBaseFactoryBean.class.getName())){
KieBaseModelImpl kBase = new KieBaseModelImpl();
kBase.setKModule(kieModuleModel);
kBase.setName( getPropertyValue( beanDefinition, "kBaseName" ));
kBase.setDefault( "true".equals( getPropertyValue(beanDefinition, "def") ) );
String packages = getPropertyValue( beanDefinition, "packages" );
if ( !packages.isEmpty() ) {
packages = checkAndResolveSpringExpression(beanFactory, context, packages);
for ( String pkg : packages.split( "," ) ) {
kBase.addPackage( pkg.trim() );
}
}
String includes = getPropertyValue( beanDefinition, "includes" );
if ( !includes.isEmpty() ) {
includes = checkAndResolveSpringExpression(beanFactory, context, includes);
for ( String include : includes.split( "," ) ) {
kBase.addInclude(include.trim());
}
}
String eventMode = getPropertyValue(beanDefinition, "eventProcessingMode");
if ( !eventMode.isEmpty() ) {
eventMode = checkAndResolveSpringExpression(beanFactory, context, eventMode);
kBase.setEventProcessingMode( EventProcessingOption.determineEventProcessingMode(eventMode) );
}
String equalsBehavior = getPropertyValue(beanDefinition, "equalsBehavior");
if ( !equalsBehavior.isEmpty() ) {
equalsBehavior = checkAndResolveSpringExpression(beanFactory, context, equalsBehavior);
kBase.setEqualsBehavior( EqualityBehaviorOption.determineEqualityBehavior(equalsBehavior) );
}
String declarativeAgenda = getPropertyValue(beanDefinition, "declarativeAgenda");
if ( !declarativeAgenda.isEmpty() ) {
declarativeAgenda = checkAndResolveSpringExpression(beanFactory, context, declarativeAgenda);
kBase.setDeclarativeAgenda(DeclarativeAgendaOption.determineDeclarativeAgenda(declarativeAgenda));
}
String scope = getPropertyValue(beanDefinition, "scope");
if ( !scope.isEmpty() ) {
scope = checkAndResolveSpringExpression(beanFactory, context, scope);
kBase.setScope( scope.trim() );
}
kieModuleModel.getRawKieBaseModels().put( kBase.getName(), kBase );
beanDefinition.getPropertyValues().addPropertyValue(new PropertyValue("releaseId", releaseId));
addKieSessionModels(beanFactory, kBase);
}
}
}