use of org.kie.workbench.common.dmn.client.editors.included.DefaultIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class IncludedModelModal method createIncludedModel.
BaseIncludedModelActiveRecord createIncludedModel(final Map<String, String> metaData) {
final String importType = metaData.get(IMPORT_TYPE_METADATA);
if (Objects.equals(DMNImportTypes.DMN, determineImportType(importType))) {
final DMNIncludedModelActiveRecord dmnIncludedModel = new DMNIncludedModelActiveRecord(recordEngine);
dmnIncludedModel.setDrgElementsCount(Integer.valueOf(metaData.get(DRG_ELEMENT_COUNT_METADATA)));
dmnIncludedModel.setDataTypesCount(Integer.valueOf(metaData.get(ITEM_DEFINITION_COUNT_METADATA)));
return dmnIncludedModel;
} else if (Objects.equals(DMNImportTypes.PMML, determineImportType(importType))) {
final PMMLIncludedModelActiveRecord pmmlIncludedModel = new PMMLIncludedModelActiveRecord(recordEngine);
pmmlIncludedModel.setModelCount(Integer.valueOf(metaData.get(PMML_MODEL_COUNT_METADATA)));
return pmmlIncludedModel;
}
return new DefaultIncludedModelActiveRecord(recordEngine);
}
use of org.kie.workbench.common.dmn.client.editors.included.DefaultIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class IncludedModelsFactory method makeIncludedModel.
private BaseIncludedModelActiveRecord makeIncludedModel(final Import anImport) {
BaseIncludedModelActiveRecord includedModel;
if (anImport instanceof ImportDMN) {
final DMNIncludedModelActiveRecord dmnIncludedModel = new DMNIncludedModelActiveRecord(getRecordEngine());
dmnIncludedModel.setDataTypesCount(getDataTypesCount((ImportDMN) anImport));
dmnIncludedModel.setDrgElementsCount(getDrgElementsCount((ImportDMN) anImport));
includedModel = dmnIncludedModel;
} else if (anImport instanceof ImportPMML) {
final PMMLIncludedModelActiveRecord pmmlIncludedModel = new PMMLIncludedModelActiveRecord(getRecordEngine());
pmmlIncludedModel.setModelCount(getPMMLModelCount((ImportPMML) anImport));
includedModel = pmmlIncludedModel;
} else {
includedModel = new DefaultIncludedModelActiveRecord(getRecordEngine());
}
includedModel.setUuid(uuidWrapper());
includedModel.setName(getName(anImport));
includedModel.setNamespace(getNamespace(anImport));
includedModel.setImportType(getImportType(anImport));
includedModel.setPath(getPath(anImport));
getIncludedModelsIndex().index(includedModel, anImport);
return includedModel;
}
use of org.kie.workbench.common.dmn.client.editors.included.DefaultIncludedModelActiveRecord in project kie-wb-common by kiegroup.
the class DMNCardsGridComponentTest method testRefresh.
@Test
public void testRefresh() {
final DefaultIncludedModelActiveRecord includedModel1 = mock(DefaultIncludedModelActiveRecord.class);
final DMNIncludedModelActiveRecord includedModel2 = mock(DMNIncludedModelActiveRecord.class);
final PMMLIncludedModelActiveRecord includedModel3 = mock(PMMLIncludedModelActiveRecord.class);
final DefaultCardComponent card1 = mock(DefaultCardComponent.class);
final DMNCardComponent card2 = mock(DMNCardComponent.class);
final PMMLCardComponent card3 = mock(PMMLCardComponent.class);
final List<BaseIncludedModelActiveRecord> includedModels = asList(includedModel1, includedModel2, includedModel3);
when(pageState.generateIncludedModels()).thenReturn(includedModels);
when(defaultCardComponent.get()).thenReturn(card1);
when(dmnCardComponent.get()).thenReturn(card2);
when(pmmlCardComponent.get()).thenReturn(card3);
grid.refresh();
verify(card1).setup(grid, includedModel1);
verify(card2).setup(grid, includedModel2);
verify(card3).setup(grid, includedModel3);
verify(cardsGridComponent).setupCards(asList(card1, card2, card3));
}
Aggregations