use of org.drools.workbench.screens.guided.rule.backend.server.GuidedRuleModelVisitor in project drools-wb by kiegroup.
the class GuidedDecisionTableModelVisitor method getActionFactTypesFromRuleModel.
private Set<String> getActionFactTypesFromRuleModel(final List<IAction> definition) {
final RuleModel rm = new RuleModel();
rm.setPackageName(model.getPackageName());
rm.setImports(model.getImports());
for (IAction a : definition) {
rm.addRhsItem(a);
}
final GuidedRuleModelVisitor visitor = new GuidedRuleModelVisitor(rm);
return visitor.getConsumedModelClasses();
}
use of org.drools.workbench.screens.guided.rule.backend.server.GuidedRuleModelVisitor in project drools-wb by kiegroup.
the class GuidedDecisionTableModelVisitor method getConditionFactTypesFromRuleModel.
private Set<String> getConditionFactTypesFromRuleModel(final List<IPattern> definition) {
final RuleModel rm = new RuleModel();
rm.setPackageName(model.getPackageName());
rm.setImports(model.getImports());
for (IPattern p : definition) {
rm.addLhsItem(p);
}
final GuidedRuleModelVisitor visitor = new GuidedRuleModelVisitor(rm);
return visitor.getConsumedModelClasses();
}
use of org.drools.workbench.screens.guided.rule.backend.server.GuidedRuleModelVisitor in project drools-wb by kiegroup.
the class GuidedRuleTemplateEditorServiceImpl method constructContent.
@Override
protected GuidedTemplateEditorContent constructContent(Path path, Overview overview) {
final TemplateModel model = load(path);
final PackageDataModelOracle oracle = dataModelService.getDataModel(path);
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
// Get FQCN's used by model
final GuidedRuleModelVisitor visitor = new GuidedRuleModelVisitor(model);
final Set<String> consumedFQCNs = visitor.getConsumedModelClasses();
// Get FQCN's used by Globals
consumedFQCNs.addAll(oracle.getPackageGlobals().values());
// Get FQCN's of collections defined in project settings
// they can be used in From Collect expressions
consumedFQCNs.addAll(oracle.getModuleCollectionTypes().entrySet().stream().filter(entry -> entry.getValue()).map(entry -> entry.getKey()).collect(Collectors.toSet()));
DataModelOracleUtilities.populateDataModel(oracle, dataModel, consumedFQCNs);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return new GuidedTemplateEditorContent(model, overview, dataModel);
}
Aggregations