Search in sources :

Example 1 with Declaration

use of org.drools.model.Declaration in project drools by kiegroup.

the class ViewFlowBuilder method addInputFromVariableSource.

private static void addInputFromVariableSource(Map<Variable<?>, InputViewItemImpl<?>> inputs, Variable<?> patterVariable) {
    if (patterVariable instanceof Declaration) {
        Declaration declaration = ((Declaration) patterVariable);
        if (declaration.getSource() instanceof From) {
            Variable var = ((From) declaration.getSource()).getVariable();
            addInputFromVariableSource(inputs, var);
            if (var.isFact()) {
                inputs.putIfAbsent(var, (InputViewItemImpl) input(var));
            }
        }
    }
}
Also used : Variable(org.drools.model.Variable) Declaration(org.drools.model.Declaration) From(org.drools.model.From)

Example 2 with Declaration

use of org.drools.model.Declaration in project drools by kiegroup.

the class BruteForceEngine method getPatternDataStore.

private DataStore getPatternDataStore(Pattern pattern) {
    DeclarationSource source = ((Declaration) pattern.getPatternVariable()).getSource();
    String sourceName = ((DataSourceDefinition) source).getName();
    DataStore dataStore = (DataStore) dataSources.get(sourceName);
    if (dataStore == null) {
        throw new RuntimeException("Unknonw DataSource: " + sourceName);
    }
    return dataStore;
}
Also used : DataStore(org.drools.model.datasources.DataStore) DeclarationSource(org.drools.model.DeclarationSource) DataSourceDefinition(org.drools.model.DataSourceDefinition) Declaration(org.drools.model.Declaration)

Aggregations

Declaration (org.drools.model.Declaration)2 DataSourceDefinition (org.drools.model.DataSourceDefinition)1 DeclarationSource (org.drools.model.DeclarationSource)1 From (org.drools.model.From)1 Variable (org.drools.model.Variable)1 DataStore (org.drools.model.datasources.DataStore)1