@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); }
void updatePropertiesReferences(final List<DataObject> imported, final Map<String, String> renamed) { for (final DataObject dataObject : imported) { for (final DataObjectProperty property : dataObject.getProperties()) { String propertyType = renamed.getOrDefault(property.getType(), property.getType()); if (!isPropertyTypePresent(propertyType, imported)) { propertyType = BuiltInType.ANY.getName(); } property.setType(propertyType); } } }
DataTypeList { void updatePropertiesReferences(final List<DataObject> imported, final Map<String, String> renamed) { for (final DataObject dataObject : imported) { for (final DataObjectProperty property : dataObject.getProperties()) { String propertyType = renamed.getOrDefault(property.getType(), property.getType()); if (!isPropertyTypePresent(propertyType, imported)) { propertyType = BuiltInType.ANY.getName(); } property.setType(propertyType); } } } }
DataTypeList { void updatePropertiesReferences(final List<DataObject> imported, final Map<String, String> renamed) { for (final DataObject dataObject : imported) { for (final DataObjectProperty property : dataObject.getProperties()) { String propertyType = renamed.getOrDefault(property.getType(), property.getType()); if (!isPropertyTypePresent(propertyType, imported)) { propertyType = BuiltInType.ANY.getName(); } property.setType(propertyType); } } } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); }
DataTypeList { void updatePropertiesReferences(final List<DataObject> imported, final Map<String, String> renamed) { for (final DataObject dataObject : imported) { for (final DataObjectProperty property : dataObject.getProperties()) { String propertyType = renamed.getOrDefault(property.getType(), property.getType()); if (!isPropertyTypePresent(propertyType, imported)) { propertyType = BuiltInType.ANY.getName(); } property.setType(propertyType); } } } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); HTMLElement getElement(); void setupItems(final List<DataType> dataTypes); Optional<DataTypeListItem> findItem(final DataType dataType); DNDListComponent getDNDListComponent(); List<DataTypeListItem> getItems(); void showNoDataTypesFound(); void showListItems(); void collapseAll(); void enableEditMode(final String dataTypeHash); void registerDataTypeListItemUpdateCallback(final Consumer<DataTypeListItem> onDataTypeListItemUpdate); Optional<DataTypeListItem> findItemByDataTypeHash(final String dataTypeHash); String calculateHash(final DataType dataType); void onDataTypeEditModeToggle(final @Observes DataTypeEditModeToggleEvent event); HTMLElement getListItems(); void importDataObjects(final List<DataObject> selectedDataObjects); void disableEditModeForChildren(final DataTypeListItem dataTypeListItem); List<String> getExistingDataTypesNames(); void highlightLevel(final DataType dataType); void highlightLevel(final Element element); void highlight(final Element element); void cleanLevelHighlightClass(); void cleanHighlightClass(); }
DataTypeList { void updatePropertiesReferences(final List<DataObject> imported, final Map<String, String> renamed) { for (final DataObject dataObject : imported) { for (final DataObjectProperty property : dataObject.getProperties()) { String propertyType = renamed.getOrDefault(property.getType(), property.getType()); if (!isPropertyTypePresent(propertyType, imported)) { propertyType = BuiltInType.ANY.getName(); } property.setType(propertyType); } } } @Inject  DataTypeList(final View view,
                        final ManagedInstance<DataTypeListItem> listItems,
                        final DataTypeManager dataTypeManager,
                        final DataTypeSearchBar searchBar,
                        final DNDListComponent dndListComponent,
                        final DataTypeStackHash dataTypeStackHash,
                        final DNDDataTypesHandler dndDataTypesHandler,
                        final DataTypeListHighlightHelper highlightHelper,
                        final IsKogito isKogito); HTMLElement getElement(); void setupItems(final List<DataType> dataTypes); Optional<DataTypeListItem> findItem(final DataType dataType); DNDListComponent getDNDListComponent(); List<DataTypeListItem> getItems(); void showNoDataTypesFound(); void showListItems(); void collapseAll(); void enableEditMode(final String dataTypeHash); void registerDataTypeListItemUpdateCallback(final Consumer<DataTypeListItem> onDataTypeListItemUpdate); Optional<DataTypeListItem> findItemByDataTypeHash(final String dataTypeHash); String calculateHash(final DataType dataType); void onDataTypeEditModeToggle(final @Observes DataTypeEditModeToggleEvent event); HTMLElement getListItems(); void importDataObjects(final List<DataObject> selectedDataObjects); void disableEditModeForChildren(final DataTypeListItem dataTypeListItem); List<String> getExistingDataTypesNames(); void highlightLevel(final DataType dataType); void highlightLevel(final Element element); void highlight(final Element element); void cleanLevelHighlightClass(); void cleanHighlightClass();  }