Search in sources :

Example 1 with GuidedDecisionTreeEditorContent

use of org.drools.workbench.screens.guided.dtree.model.GuidedDecisionTreeEditorContent 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);
}
Also used : PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) PackageDataModelOracle(org.kie.soup.project.datamodel.oracle.PackageDataModelOracle) GuidedDecisionTree(org.drools.workbench.models.guided.dtree.shared.model.GuidedDecisionTree) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent) GuidedDecisionTreeEditorContent(org.drools.workbench.screens.guided.dtree.model.GuidedDecisionTreeEditorContent)

Example 2 with GuidedDecisionTreeEditorContent

use of org.drools.workbench.screens.guided.dtree.model.GuidedDecisionTreeEditorContent in project drools-wb by kiegroup.

the class GuidedDecisionTreeEditorPresenter method getModelSuccessCallback.

private RemoteCallback<GuidedDecisionTreeEditorContent> getModelSuccessCallback() {
    return new RemoteCallback<GuidedDecisionTreeEditorContent>() {

        @Override
        public void callback(final GuidedDecisionTreeEditorContent content) {
            // Path is set to null when the Editor is closed (which can happen before async calls complete).
            if (versionRecordManager.getCurrentPath() == null) {
                return;
            }
            GuidedDecisionTreeEditorPresenter.this.content = content;
            model = content.getModel();
            metadata = content.getOverview().getMetadata();
            final PackageDataModelOracleBaselinePayload dataModel = content.getDataModel();
            oracle = oracleFactory.makeAsyncPackageDataModelOracle(versionRecordManager.getCurrentPath(), model, dataModel);
            resetEditorPages(content.getOverview());
            addSourcePage();
            addImportsTab(importsWidget);
            importsWidget.setContent(oracle, model.getImports(), isReadOnly);
            view.setModel(model, isReadOnly);
            view.setDataModel(oracle, isReadOnly);
            view.hideBusyIndicator();
            // If there were any parsing errors give the User the option to remove the broken DRL or ignore it
            if (!model.getParserErrors().isEmpty()) {
                final ParserMessagesPopup popup = new ParserMessagesPopup(model);
                popup.show();
            }
            createOriginalHash(model);
        }
    };
}
Also used : PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) ParserMessagesPopup(org.drools.workbench.screens.guided.dtree.client.widget.popups.ParserMessagesPopup) RemoteCallback(org.jboss.errai.common.client.api.RemoteCallback) GuidedDecisionTreeEditorContent(org.drools.workbench.screens.guided.dtree.model.GuidedDecisionTreeEditorContent)

Aggregations

GuidedDecisionTreeEditorContent (org.drools.workbench.screens.guided.dtree.model.GuidedDecisionTreeEditorContent)2 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)2 GuidedDecisionTree (org.drools.workbench.models.guided.dtree.shared.model.GuidedDecisionTree)1 ParserMessagesPopup (org.drools.workbench.screens.guided.dtree.client.widget.popups.ParserMessagesPopup)1 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)1 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)1 ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)1