- entityDefinitions:
  - IDE_ReferenceID_Sublist: '{6ce6c490-15bf-47f3-a870-32f58fbeb125}'

  - IDBEM_ExternalIDs: '{8e84a5f4-5639-4f19-bce3-ffb210a3e6e4}'
  - IDBEMP_ExternalIDs: '{8050df23-7232-4174-9552-d3a373b009a3}'

  - IDM_External_ID__process__Related_Updates: '{6dcf8364-17ed-4aee-b1b1-0715263dffd9}'
  - IDMB_External_ID__process__Related_Updates: '{1e000f33-795c-4c01-8fe8-1c8f5eb81160}'

  - IDMB_Class__create__External_ID: '{fa15282f-fe56-47a8-918e-1d974c94798d}'
  - IDMB_External_ID__get__External_ID_or_New_Instance_if_empty: '{ca4711eb-e066-4ada-811e-8aa4ee22821c}'

- library: '&IDL_MochaBaseSystem;'
  instances:
  - buildElementMethod: '&IDBEM_ExternalIDs;'
    hasBemProcess: '&IDBEMP_ExternalIDs;'

  - bemProcess: '&IDBEMP_ExternalIDs;'
    name: 'build external IDs list'
    loopExecutableReturningInstanceSet: '&IDMB_Instance__get__External_IDs_for_Related_Instance;' # the GSI, below

  - returnInstanceSetMethodBinding: '&IDMB_Class__create__External_ID;'
    executesMethod: '&IDM_Class__create__Instance;'
    parameterAssignments:
    - globalIdentifier: '{3c96568e-9284-464e-bad0-8f6e8a64f5c1}'
      assignsToParameter: '&IDI_WorkSet_ClassOfInstanceToCreate;'
      assignsFromWorkData: '&IDMB_External_ID__get__Class;'

  # Common Instance Set@get Set A or Set B if Set A is empty [EBE]
  - returnInstanceSetMethodBinding: '&IDMB_External_ID__get__External_ID_or_New_Instance_if_empty;'
    executesMethod: '&IDM_Common_Instance_Set__get__Set_A_or_Set_B_if_Set_A_is_empty;'
    parameterAssignments:
    - globalIdentifier: '{2ee59a0c-0cf3-4443-a34f-95b73d8f80cc}'
      assignsToParameter: '&IDI_WorkSet_SetA;'
      assignsFromWorkData: '&IDC_ExternalID;'
      evaluateWorkSet: yes
    - globalIdentifier: '{e1d19818-c8aa-472e-abff-69b4fa70cace}'
      assignsToParameter: '&IDI_WorkSet_SetB;'
      assignsFromWorkData: '&IDMB_Class__create__External_ID;'

  - processUpdatesMethodBinding: '&IDMB_External_ID__process__Related_Updates;'
    executesMethod: '&IDM_External_ID__process__Related_Updates;'
    parameterAssignments:
    - globalIdentifier: '{14e37344-93b5-4476-bbc5-d65239308ca7}'
      assignsToParameter: '&IDC_ExternalID;'
      assignsFromWorkData: '&IDMB_External_ID__get__External_ID_or_New_Instance_if_empty;'

  - processRelatedUpdatesMethod: '&IDM_External_ID__process__Related_Updates;'
    forClassId: '&IDC_ExternalID;'
    verb: 'process'
    name: 'Related Updates'
    processesForClass: '&IDC_ExternalID;'
    usesExecutableForPUMB:

    - globalIdentifier: '{ca2f4976-cbd9-4162-a68f-9a9697090fd5}'
      type: '&IDC_AssignRelationshipMethod;'
      forClassId: '&IDC_Instance;'
      verb: 'assign'
      name: 'External ID'
      assignsRelationshipId: '&IDR_Instance__has__External_ID;'
      instanceId: '&IDC_ExternalID;'
    
    - globalIdentifier: '{4af627a5-4c8e-46c1-885b-b8936e50d962}'
      type: '&IDC_AssignRelationshipMethod;'
      forClassId: '&IDC_ExternalID;'
      verb: 'assign'
      name: 'External ID Type'
      assignsRelationshipId: '&IDR_External_ID__has__External_ID_Type;'
      instanceId: '&IDR_External_ID__has__External_ID_Type;'
    
    - globalIdentifier: '{d5b1659b-5215-4cd1-89e7-596de09e5898}'
      type: '&IDC_AssignAttributeMethod;'
      forClassId: '&IDC_ExternalID;'
      verb: 'assign'
      name: 'Value'
      assignsAttribute: '&IDA_Value;'
      usesExecutableReturningAttribute: '&IDA_Value;'
    
  - element: '&IDE_ReferenceID_Sublist;'
    name: 'External IDs'
    processedByPRUMethod: '&IDMB_External_ID__process__Related_Updates;'
    elementContents:
    - globalIdentifier: '{7bd8bf6f-2b0d-4957-9dfc-0c6396dc4a40}'
      defaultDataType: '&IDC_ExternalID;'
      label: 'External ID'
      displayOptions:
      - instance: '&IDI_DisplayOption_DoNotShow;'
    - globalIdentifier: '{470ad26d-7529-4f39-aaf8-eedf23c66118}'
      defaultDataType: '&IDR_External_ID__has__External_ID_Type;'
      label: 'External ID Type'
    - globalIdentifier: '{c6b3ea05-54ee-4fa2-8c49-84e88483c6ad}'
      defaultDataType: '&IDA_Value;'
      label: 'Value'
      
