patternDescr,
null,
"The class '" + patternDescr.getObjectType() + "' is not public"));
return null;
}
PackageRegistry pkgr = context.getPackageBuilder().getPackageRegistry( ClassUtils.getPackage( userProvidedClass ) );
org.drools.rule.Package pkg = pkgr == null ? context.getPkg() : pkgr.getPackage();
final boolean isEvent = pkg.isEvent( userProvidedClass );
objectType = new ClassObjectType( userProvidedClass,
isEvent );
} catch ( final ClassNotFoundException e ) {
// swallow as we'll do another check in a moment and then record the problem
}
}
// lets see if it maps to a query
if ( objectType == null ) {
RuleConditionElement rce = null;
// it might be a recursive query, so check for same names
if ( context.getRule().getName().equals( patternDescr.getObjectType() ) ) {
// it's a query so delegate to the QueryElementBuilder
QueryElementBuilder qeBuilder = new QueryElementBuilder();
rce = qeBuilder.build( context,
descr,
prefixPattern,
(Query) context.getRule() );
}
if ( rce == null ) {
Rule rule = context.getPkg().getRule( patternDescr.getObjectType() );
if ( rule instanceof Query ) {
// it's a query so delegate to the QueryElementBuilder
QueryElementBuilder qeBuilder = new QueryElementBuilder();
rce = qeBuilder.build( context,
descr,
prefixPattern,
(Query) rule );
}
// try package imports
for ( String importName : context.getDialect().getTypeResolver().getImports() ) {
importName = importName.trim();
int pos = importName.indexOf( '*' );
if ( pos >= 0 ) {
String pkgName = importName.substring( 0,
pos - 1 );
PackageRegistry pkgReg = context.getPackageBuilder().getPackageRegistry( pkgName );
if ( pkgReg != null ) {
rule = pkgReg.getPackage().getRule( patternDescr.getObjectType() );
if ( rule instanceof Query ) {
// it's a query so delegate to the QueryElementBuilder
QueryElementBuilder qeBuilder = new QueryElementBuilder();
rce = qeBuilder.build( context,
descr,