use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class DRLTextEditorServiceImpl method constructContent.
@Override
protected DrlModelContent constructContent(Path path, Overview overview) {
final PackageDataModelOracle oracle = dataModelService.getDataModel(path);
final String[] fullyQualifiedClassNames = DataModelOracleUtilities.getFactTypes(oracle);
final List<DSLSentence> dslConditions = oracle.getExtensions(DSLConditionSentence.INSTANCE);
final List<DSLSentence> dslActions = oracle.getExtensions(DSLActionSentence.INSTANCE);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return new DrlModelContent(load(path), overview, Arrays.asList(fullyQualifiedClassNames), dslConditions, dslActions);
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class DSLTextEditorServiceImpl method load.
@Override
public String load(final Path path) {
try {
final String content = ioService.readAllString(Paths.convert(path));
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return content;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class GuidedRuleEditorServiceImpl method constructContent.
@Override
protected GuidedEditorContent constructContent(Path path, Overview overview) {
final RuleModel 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 GuidedEditorContent(model, overview, dataModel);
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class GuidedScoreCardEditorServiceImpl method constructContent.
@Override
protected ScoreCardModelContent constructContent(Path path, Overview overview) {
final ScoreCardModel model = load(path);
final PackageDataModelOracle oracle = dataModelService.getDataModel(path);
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
final GuidedScoreCardModelVisitor visitor = new GuidedScoreCardModelVisitor(model);
DataModelOracleUtilities.populateDataModel(oracle, dataModel, visitor.getConsumedModelClasses());
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return new ScoreCardModelContent(model, overview, dataModel);
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorServiceImpl method constructContent.
@Override
protected GuidedDecisionTableEditorGraphContent constructContent(final Path path, final Overview overview) {
final GuidedDecisionTableEditorGraphModel model = load(path);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return new GuidedDecisionTableEditorGraphContent(model, overview);
}
Aggregations