Search in sources :

Example 1 with ResourceConfigurationImpl

use of org.drools.core.builder.conf.impl.ResourceConfigurationImpl in project drools by kiegroup.

the class BaseResource method setResourceType.

public InternalResource setResourceType(ResourceType resourceType) {
    this.resourceType = resourceType;
    if (this.configuration == null) {
        this.configuration = new ResourceConfigurationImpl();
    }
    this.configuration.setResourceType(resourceType);
    return this;
}
Also used : ResourceConfigurationImpl(org.drools.core.builder.conf.impl.ResourceConfigurationImpl)

Example 2 with ResourceConfigurationImpl

use of org.drools.core.builder.conf.impl.ResourceConfigurationImpl in project drools by kiegroup.

the class AbstractKieModule method addResourceToCompiler.

public final boolean addResourceToCompiler(CompositeKnowledgeBuilder ckbuilder, KieBaseModel kieBaseModel, String fileName, ResourceChangeSet rcs) {
    ResourceConfiguration conf = getResourceConfiguration(fileName);
    Resource resource = getResource(fileName);
    if (resource != null) {
        ResourceType resourceType = conf instanceof ResourceConfigurationImpl && ((ResourceConfigurationImpl) conf).getResourceType() != null ? ((ResourceConfigurationImpl) conf).getResourceType() : ResourceType.determineResourceType(fileName);
        if (resourceType == ResourceType.DTABLE && conf instanceof DecisionTableConfiguration) {
            for (RuleTemplateModel template : kieBaseModel.getRuleTemplates()) {
                if (template.getDtable().equals(fileName)) {
                    Resource templateResource = getResource(template.getTemplate());
                    if (templateResource != null) {
                        ((DecisionTableConfiguration) conf).addRuleTemplateConfiguration(templateResource, template.getRow(), template.getCol());
                    }
                }
            }
        }
        if (conf == null) {
            ckbuilder.add(resource, resourceType, rcs);
        } else {
            ckbuilder.add(resource, resourceType, conf, rcs);
        }
        return true;
    }
    return false;
}
Also used : DecisionTableConfiguration(org.kie.internal.builder.DecisionTableConfiguration) Resource(org.kie.api.io.Resource) ResourceConfigurationImpl(org.drools.core.builder.conf.impl.ResourceConfigurationImpl) ResourceType(org.kie.api.io.ResourceType) RuleTemplateModel(org.kie.api.builder.model.RuleTemplateModel) ResourceConfiguration(org.kie.api.io.ResourceConfiguration)

Aggregations

ResourceConfigurationImpl (org.drools.core.builder.conf.impl.ResourceConfigurationImpl)2 RuleTemplateModel (org.kie.api.builder.model.RuleTemplateModel)1 Resource (org.kie.api.io.Resource)1 ResourceConfiguration (org.kie.api.io.ResourceConfiguration)1 ResourceType (org.kie.api.io.ResourceType)1 DecisionTableConfiguration (org.kie.internal.builder.DecisionTableConfiguration)1