log.info(" :: Added KieModule From KieObjectsInjector ::");
}
}
protected KieModuleModel getKieModuleModel() {
KieModuleModelImpl kieModuleModel = new KieModuleModelImpl();
Set<String> ids = blueprintContainer.getComponentIds();
for (String id: ids) {
ComponentMetadata componentMetadata = blueprintContainer.getComponentMetadata(id);
if ( componentMetadata instanceof BeanMetadata) {
BeanMetadata metadata = (BeanMetadata)componentMetadata;
if (KieObjectsFactoryBean.class.getName().equals(metadata.getClassName())) {
if ("fetchKBase".equalsIgnoreCase(metadata.getFactoryMethod())) {
BeanArgument kbRefArg = metadata.getArguments().get(0);
String kBaseName = ((MutableValueMetadata) kbRefArg.getValue()).getStringValue();
KieBaseModelImpl kBase = new KieBaseModelImpl();
kBase.setKModule(kieModuleModel);
kBase.setName(kBaseName);
BeanArgument kbOptionsArg = metadata.getArguments().get(2);
PassThroughMetadata passThroughMetadata = (PassThroughMetadata) kbOptionsArg.getValue();
KBaseOptions kBaseOptions = (KBaseOptions) passThroughMetadata.getObject();
String packages = kBaseOptions.getPackages();
if ( !kBaseOptions.getPackages().isEmpty()) {
for ( String pkg : packages.split( "," ) ) {
kBase.addPackage( pkg.trim() );
}
}
String includes = kBaseOptions.getIncludes();
if ( !includes.isEmpty() ) {
for ( String include : includes.split( "," ) ) {
kBase.addInclude( include.trim() );
}
}
String equalsBehavior = kBaseOptions.getEqualsBehavior();
if ( !equalsBehavior.isEmpty() ) {
kBase.setEqualsBehavior( EqualityBehaviorOption.determineEqualityBehavior(equalsBehavior) );
}
String eventProcessingMode = kBaseOptions.getEventProcessingMode();
if ( !eventProcessingMode.isEmpty() ) {
kBase.setEventProcessingMode( EventProcessingOption.determineEventProcessingMode(eventProcessingMode) );
}
String declarativeAgenda = kBaseOptions.getDeclarativeAgenda();
if ( !declarativeAgenda.isEmpty() ) {
kBase.setDeclarativeAgenda( DeclarativeAgendaOption.determineDeclarativeAgenda(declarativeAgenda) );
}
kieModuleModel.getRawKieBaseModels().put(kBase.getName(), kBase);
MutablePassThroughMetadata throughMetadata = parserContext.createMetadata(MutablePassThroughMetadata.class);
throughMetadata.setObject(releaseId);
((MutableBeanArgument)metadata.getArguments().get(1)).setValue(throughMetadata);