Search in sources :

Example 1 with DrlModelContent

use of org.drools.workbench.screens.drltext.model.DrlModelContent 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);
}
Also used : DrlModelContent(org.drools.workbench.screens.drltext.model.DrlModelContent) PackageDataModelOracle(org.kie.soup.project.datamodel.oracle.PackageDataModelOracle) ResourceOpenedEvent(org.uberfire.workbench.events.ResourceOpenedEvent) DSLSentence(org.drools.workbench.models.datamodel.rule.DSLSentence)

Example 2 with DrlModelContent

use of org.drools.workbench.screens.drltext.model.DrlModelContent in project drools-wb by kiegroup.

the class DRLTextEditorServiceImplCDITest method testLoadContent.

@Test
public void testLoadContent() throws Exception {
    final DrlModelContent content = drlService.loadContent(getPath(CAR_DRIVING_LICENSE));
    Assertions.assertThat(content.getDrl()).isEqualTo(drlService.load(getPath(CAR_DRIVING_LICENSE)));
    Assertions.assertThat(content.getFullyQualifiedClassNames()).hasSize(3);
    Assertions.assertThat(content.getFullyQualifiedClassNames()).contains("org.kiegroup.Person", "org.kiegroup.DrivingLicenseApplication", "org.kiegroup.storage.Storage");
}
Also used : DrlModelContent(org.drools.workbench.screens.drltext.model.DrlModelContent) Test(org.junit.Test)

Aggregations

DrlModelContent (org.drools.workbench.screens.drltext.model.DrlModelContent)2 DSLSentence (org.drools.workbench.models.datamodel.rule.DSLSentence)1 Test (org.junit.Test)1 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)1 ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)1