Skip to content

Type Mapping

Defining the typeConversion section

The 'typeConversion' section is used to map different entities of the same type class to different mapping sections in the map file. For example: On the custom-entity type, there could be two sub types that refer to different object classes on the destination system. So using different mapping sections will allow different conversion rules for each type.

typeConversion format

In the typeConversion object, define properties with keys for the direction of the transformation. For example: 'vibe2flex' for transforming from VibeIQ to FlexPLM. There are no requirements on the format of the key; but it should be easy to understand the intent.

typeConversion: {
  vibe2flex: {

  }
}
Within that object, the properties should have keys of the entity or object class. And that object value needs to have a getMapKey function with a parameter of the entity / object; and returns the mapping key to use for transformation.
typeConversion: {
  vibe2flex: {
    'custom-entity': {
      getMapKey: (entity) => {
          const typePath = entity['typePath'];
          let mapKey = '';
          switch (typePath) {
          case 'custom-entity:pack':
            mapKey = 'packaging';
            break;
          case 'custom-entity:factory':
            mapKey = 'factory';
            break;
          }

          return mapKey;

      }
    },
    color: {
      getMapKey: (entity) => {
        const colorSystem = entity['colorSystem'];
        let mapKey = '';
        switch (colorSystem) {
        case 'cmyk':
          mapKey = 'colorCMYK';
          break;
        case 'pant':
          mapKey = 'colorPant';
          break;
        }
        return mapKey;
      }
    }

  }
}