use of org.kie.workbench.common.dmn.api.editors.types.DataObject in project kie-wb-common by kiegroup.
the class ImportDataObjectModalTest method testWrap.
@Test
public void testWrap() {
final Consumer consumer = mock(Consumer.class);
final ServiceCallback service = modal.wrap(consumer);
final List<DataObject> items = mock(List.class);
service.onSuccess(items);
verify(consumer).accept(items);
}
use of org.kie.workbench.common.dmn.api.editors.types.DataObject in project kie-wb-common by kiegroup.
the class DataObjectsServiceImpl method loadDataObjects.
@Override
public List<DataObject> loadDataObjects(final WorkspaceProject workspaceProject) {
final KieModule module = moduleService.resolveModule(workspaceProject.getRootPath());
final ClassLoader classLoader = moduleClassLoaderHelper.getModuleClassLoader(module);
final ModuleDataModelOracle dmo = dataModelService.getModuleDataModel(workspaceProject.getRootPath());
final String[] types = DataModelOracleUtilities.getFactTypes(dmo);
final Map<String, ModelField[]> typesModelFields = dmo.getModuleModelFields();
final Map<String, String> parametersType = dmo.getModuleFieldParametersType();
final List<DataObject> dataObjects = Arrays.stream(types).map(DataObject::new).collect(Collectors.toList());
dataObjects.forEach(dataObject -> convertProperties(dataObject, dataObjects, typesModelFields, classLoader, parametersType));
return dataObjects;
}
use of org.kie.workbench.common.dmn.api.editors.types.DataObject in project kie-wb-common by kiegroup.
the class DataTypeList method removeFullQualifiedNames.
void removeFullQualifiedNames(final List<DataObject> imported) {
final Map<String, Integer> namesCount = getImportedNamesOccurrencesCount();
final Map<String, String> renamed = getRenamedImportedDataTypes();
namesCount.clear();
renamed.clear();
for (final DataObject dataObject : imported) {
final String nameCandidate = dataObject.getClassNameWithoutPackage();
final String newName = buildName(nameCandidate, namesCount);
renamed.put(dataObject.getClassType(), newName);
dataObject.setClassType(newName);
}
updatePropertiesReferences(imported, renamed);
}
use of org.kie.workbench.common.dmn.api.editors.types.DataObject in project kie-wb-common by kiegroup.
the class DataTypeListTest method testUpdatePropertiesReferences.
@Test
public void testUpdatePropertiesReferences() {
final List<DataObject> imported = new ArrayList<>();
final HashMap<String, String> renamed = new HashMap<>();
final String propertyType1 = "type";
final String propertyNewType1 = "type-1";
final String uniqueType = "uniqueType";
renamed.put(propertyType1, propertyNewType1);
final DataObjectProperty prop1 = mock(DataObjectProperty.class);
final DataObjectProperty prop2 = mock(DataObjectProperty.class);
when(prop1.getType()).thenReturn(propertyType1);
when(prop2.getType()).thenReturn(uniqueType);
doReturn(true).when(dataTypeList).isPropertyTypePresent(uniqueType, imported);
doReturn(true).when(dataTypeList).isPropertyTypePresent(propertyNewType1, imported);
final DataObject do1 = new DataObject();
do1.setProperties(Arrays.asList(prop1, prop2));
imported.add(do1);
dataTypeList.updatePropertiesReferences(imported, renamed);
verify(prop1).setType(propertyNewType1);
verify(prop2).setType(uniqueType);
verify(dataTypeList).isPropertyTypePresent(propertyNewType1, imported);
verify(dataTypeList).isPropertyTypePresent(uniqueType, imported);
}
use of org.kie.workbench.common.dmn.api.editors.types.DataObject in project kie-wb-common by kiegroup.
the class DataTypeListTest method createDataObject.
private DataObject createDataObject(final String className) {
final DataObject dataObject = mock(DataObject.class);
when(dataObject.getClassType()).thenReturn(className);
return dataObject;
}
Aggregations