@Test public void testMakeDMNImport() { final DMNIncludedModelActiveRecord record = new DMNIncludedModelActiveRecord(null); final String expectedImportType = DMNImportTypes.DMN.getDefaultNamespace(); final String nameValue = "name"; final String path = "/src/main/kie/dmn"; final Name expectedName = new Name(nameValue); final LocationURI expectedLocationURI = new LocationURI(path); final String expectedNamespace = ": final int expectedDrgElementsCount = 2; final int expectedItemDefinitionsCount = 3; record.setName(nameValue); record.setPath(path); record.setNamespace(expectedNamespace); record.setImportType(DMNImportTypes.DMN.getDefaultNamespace()); record.setDrgElementsCount(expectedDrgElementsCount); record.setDataTypesCount(expectedItemDefinitionsCount); final Import actualImport = factory.makeImport(record); assertTrue(actualImport instanceof ImportDMN); final ImportDMN dmnImport = (ImportDMN) actualImport; assertEquals(expectedImportType, actualImport.getImportType()); assertEquals(expectedName, actualImport.getName()); assertEquals(expectedLocationURI, actualImport.getLocationURI()); assertEquals(expectedNamespace, actualImport.getNamespace()); assertEquals(expectedImportType, actualImport.getImportType()); assertEquals(expectedDrgElementsCount, dmnImport.getDrgElementsCount()); assertEquals(expectedItemDefinitionsCount, dmnImport.getItemDefinitionsCount()); }
public Import makeImport(final BaseIncludedModelActiveRecord record) { Import anImport; if (record instanceof DMNIncludedModelActiveRecord) { final ImportDMN dmn = new ImportDMN(); final DMNIncludedModelActiveRecord dmnRecord = (DMNIncludedModelActiveRecord) record; dmn.setName(name(record)); dmn.setNamespace(record.getNamespace()); dmn.setLocationURI(location(record)); dmn.setImportType(record.getImportType()); dmn.setDrgElementsCount(dmnRecord.getDrgElementsCount()); dmn.setItemDefinitionsCount(dmnRecord.getDataTypesCount()); anImport = dmn; } else if (record instanceof PMMLIncludedModelActiveRecord) { final ImportPMML pmml = new ImportPMML(); final PMMLIncludedModelActiveRecord pmmlRecord = (PMMLIncludedModelActiveRecord) record; pmml.setName(name(record)); pmml.setNamespace(name(record).getValue()); pmml.setLocationURI(location(record)); pmml.setImportType(record.getImportType()); pmml.setModelCount(pmmlRecord.getModelCount()); anImport = pmml; } else { anImport = new Import(); } anImport.setLocationURI(location(record)); anImport.setImportType(record.getImportType()); return anImport; }
ImportFactory { public Import makeImport(final BaseIncludedModelActiveRecord record) { Import anImport; if (record instanceof DMNIncludedModelActiveRecord) { final ImportDMN dmn = new ImportDMN(); final DMNIncludedModelActiveRecord dmnRecord = (DMNIncludedModelActiveRecord) record; dmn.setName(name(record)); dmn.setNamespace(record.getNamespace()); dmn.setLocationURI(location(record)); dmn.setImportType(record.getImportType()); dmn.setDrgElementsCount(dmnRecord.getDrgElementsCount()); dmn.setItemDefinitionsCount(dmnRecord.getDataTypesCount()); anImport = dmn; } else if (record instanceof PMMLIncludedModelActiveRecord) { final ImportPMML pmml = new ImportPMML(); final PMMLIncludedModelActiveRecord pmmlRecord = (PMMLIncludedModelActiveRecord) record; pmml.setName(name(record)); pmml.setNamespace(name(record).getValue()); pmml.setLocationURI(location(record)); pmml.setImportType(record.getImportType()); pmml.setModelCount(pmmlRecord.getModelCount()); anImport = pmml; } else { anImport = new Import(); } anImport.setLocationURI(location(record)); anImport.setImportType(record.getImportType()); return anImport; } }
ImportFactory { public Import makeImport(final BaseIncludedModelActiveRecord record) { Import anImport; if (record instanceof DMNIncludedModelActiveRecord) { final ImportDMN dmn = new ImportDMN(); final DMNIncludedModelActiveRecord dmnRecord = (DMNIncludedModelActiveRecord) record; dmn.setName(name(record)); dmn.setNamespace(record.getNamespace()); dmn.setLocationURI(location(record)); dmn.setImportType(record.getImportType()); dmn.setDrgElementsCount(dmnRecord.getDrgElementsCount()); dmn.setItemDefinitionsCount(dmnRecord.getDataTypesCount()); anImport = dmn; } else if (record instanceof PMMLIncludedModelActiveRecord) { final ImportPMML pmml = new ImportPMML(); final PMMLIncludedModelActiveRecord pmmlRecord = (PMMLIncludedModelActiveRecord) record; pmml.setName(name(record)); pmml.setNamespace(name(record).getValue()); pmml.setLocationURI(location(record)); pmml.setImportType(record.getImportType()); pmml.setModelCount(pmmlRecord.getModelCount()); anImport = pmml; } else { anImport = new Import(); } anImport.setLocationURI(location(record)); anImport.setImportType(record.getImportType()); return anImport; } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); }
ImportFactory { public Import makeImport(final BaseIncludedModelActiveRecord record) { Import anImport; if (record instanceof DMNIncludedModelActiveRecord) { final ImportDMN dmn = new ImportDMN(); final DMNIncludedModelActiveRecord dmnRecord = (DMNIncludedModelActiveRecord) record; dmn.setName(name(record)); dmn.setNamespace(record.getNamespace()); dmn.setLocationURI(location(record)); dmn.setImportType(record.getImportType()); dmn.setDrgElementsCount(dmnRecord.getDrgElementsCount()); dmn.setItemDefinitionsCount(dmnRecord.getDataTypesCount()); anImport = dmn; } else if (record instanceof PMMLIncludedModelActiveRecord) { final ImportPMML pmml = new ImportPMML(); final PMMLIncludedModelActiveRecord pmmlRecord = (PMMLIncludedModelActiveRecord) record; pmml.setName(name(record)); pmml.setNamespace(name(record).getValue()); pmml.setLocationURI(location(record)); pmml.setImportType(record.getImportType()); pmml.setModelCount(pmmlRecord.getModelCount()); anImport = pmml; } else { anImport = new Import(); } anImport.setLocationURI(location(record)); anImport.setImportType(record.getImportType()); return anImport; } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); Import makeImport(final BaseIncludedModelActiveRecord record); }
ImportFactory { public Import makeImport(final BaseIncludedModelActiveRecord record) { Import anImport; if (record instanceof DMNIncludedModelActiveRecord) { final ImportDMN dmn = new ImportDMN(); final DMNIncludedModelActiveRecord dmnRecord = (DMNIncludedModelActiveRecord) record; dmn.setName(name(record)); dmn.setNamespace(record.getNamespace()); dmn.setLocationURI(location(record)); dmn.setImportType(record.getImportType()); dmn.setDrgElementsCount(dmnRecord.getDrgElementsCount()); dmn.setItemDefinitionsCount(dmnRecord.getDataTypesCount()); anImport = dmn; } else if (record instanceof PMMLIncludedModelActiveRecord) { final ImportPMML pmml = new ImportPMML(); final PMMLIncludedModelActiveRecord pmmlRecord = (PMMLIncludedModelActiveRecord) record; pmml.setName(name(record)); pmml.setNamespace(name(record).getValue()); pmml.setLocationURI(location(record)); pmml.setImportType(record.getImportType()); pmml.setModelCount(pmmlRecord.getModelCount()); anImport = pmml; } else { anImport = new Import(); } anImport.setLocationURI(location(record)); anImport.setImportType(record.getImportType()); return anImport; } @Inject  ImportFactory(final IncludedModelsIndex modelsIndex); Import makeImport(final BaseIncludedModelActiveRecord record);  }