use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class GuidedDecisionTableGraphEditorServiceImplTest method checkConstructContent.
@Test
public void checkConstructContent() {
final Path path = mock(Path.class);
final Overview overview = mock(Overview.class);
when(path.toURI()).thenReturn("default://project/src/main/resources/mypackage/dtable." + dtGraphResourceType.getSuffix());
final GuidedDecisionTableEditorGraphContent content = service.constructContent(path, overview);
verify(resourceOpenedEvent, times(1)).fire(any(ResourceOpenedEvent.class));
assertNotNull(content.getModel());
assertEquals(overview, content.getOverview());
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class GuidedDecisionTreeEditorServiceImpl method constructContent.
@Override
protected GuidedDecisionTreeEditorContent constructContent(Path path, Overview overview) {
final GuidedDecisionTree model = load(path);
final PackageDataModelOracle oracle = dataModelService.getDataModel(path);
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
// Get FQCN's used by model
final GuidedDecisionTreeModelVisitor visitor = new GuidedDecisionTreeModelVisitor(model);
final Set<String> consumedFQCNs = visitor.getConsumedModelClasses();
// Get FQCN's used by Globals
consumedFQCNs.addAll(oracle.getPackageGlobals().values());
DataModelOracleUtilities.populateDataModel(oracle, dataModel, consumedFQCNs);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return new GuidedDecisionTreeEditorContent(model, overview, dataModel);
}
use of org.uberfire.workbench.events.ResourceOpenedEvent 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);
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class ScoreCardXLSServiceImpl method load.
@Override
public InputStream load(final Path path, final String sessionId) {
try {
final InputStream inputStream = ioService.newInputStream(Paths.convert(path), StandardOpenOption.READ);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, getSessionInfo(sessionId)));
return inputStream;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
use of org.uberfire.workbench.events.ResourceOpenedEvent in project drools-wb by kiegroup.
the class DecisionTableXLSServiceImpl method load.
@Override
public InputStream load(final Path path, final String sessionId) {
try {
final InputStream inputStream = ioService.newInputStream(Paths.convert(path), StandardOpenOption.READ);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, getSessionInfo(sessionId)));
return inputStream;
} catch (Exception e) {
throw ExceptionUtilities.handleException(e);
}
}
Aggregations