# IDM Conversion
The Roomle Importer converts the IDM data into Roomle data. A detailed description of it can be found below.
Items (Roomle components) are separated in SERIES. From this the SERIES_NO is used to ensure that there are no duplicate itemIds by using TYPE_NO from the ITEM element. Therefore componentIds are:
# Merge with existing components
To make custom script improvements possible, the importer takes existing components from the targetCatalog and merges the existing data into the newly imported components if a component with the same extId exists.
- existing geometry is replacing any new geometry (since IDM has no geometry information)
- within onUpdate all code within
/*BEGIN CUSTOM CODE*/ <code to be merged> /*END CUSTOM CODE*/is copied to the new component
- subcomponents whos internalId start with "custom_" are copied completly
To speed up and avoid doubling the imported data, maps are created. These maps are then used and/or filled at the begining and during the iteration through the series and items.
This map is created at the beginning and searched for references while creating the componentDefinition for the component while iterating through the items in the IDM file. This results in the conditions for the feature(Option) to be used. It is a map of OPTION_GROUP_KEYs and IDMOptionGroup data objects.
This map is created at the begining and searched for references while creating the componentDefinition for the component while iterating through the items in the IDM file. This results in features associated with a given product group. These are later added to the idmItem object and later to the component. It is a map of FEATURE_NO and IDMFeature data objects.
This map is created to contain all the decisions inside the catalog to later add them, using the reference in the item, to the idmItem object and later from the idmItem object to the Component. It is a map of DECISION_NO and the IDMDecision data objects.
This map contains all the IDMPriceFeatureGroup data objects extracted from the IDM XML, to later access them using the PRICE_FEATURE_NO referenced in the items.
This map contains all the links/paths to the SVG docking files, by collecting them from the DETAIL_INFO elements in GLOBAL_DEFINITION that are of INFO_TYPE == 3. It is a map of the DETAIL_INFO_NO referenced in the item and the path contained in the URL/TEXT data field.
This map contains all the partLists elements with the key being their reference value used inside the items (PART_LIST_KEY).
# Component conversion process
The conversion start by filling the maps from the data contained in the Global Definitions, Feature definitions and Price Definitions. When iterating through Series -> ProductGroups -> Items, lists are populated with references. When in the item, they are added to the IDMItem data object they belong to. At this point, the IDMItem data object is converted into the Component data object. During this conversion, the references are accessed from the maps creating all the parts needed in the Component. Additionaly, during the conversion to ComponentDefinition, also the subComponents from the IDMPartLists and the Prices are added.
For the PartLists the subComponents from the IDMPartLists are added, if the Item references one of them and the logic to the onUpdate. For the Prices, the Price data objects for the Component are added and the logic for the price calculation is added to the onUpdate.
# Material conversion process
The materials are converted from the IDMOption data objects referenced in the IDMFeature data object. While iterating through all features in the catalog, when the idmFeature is of Type.COLOR, the IDMOptions connected to this feature are collected, iterated (using a map with key extId to avoid duplicates) and converted to our Material DTO.