admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Quintiq file version 2.0
#parent: #root
Method ReceiveMetadataRequestGetChannelsMetadata (NamedValueTree nvt_i, NamedValue body_i, LibDEF_System requestor_i, 
  LibDEF_IntegrationEvent event_i)
{
  Description: 'Receive a Metadata message for requesting Metadata for certain Channels.'
  TextBody:
  [*
    LibDEF_Util::EventLog( event_i, "Receiving system metadata request" );
    
    // Jacky CHAN May-13-2016 (created)
    channelNames := construct( Strings );
    
    traverse( body_i.Children(), Elements, channelMeta,
              channelMeta.Name() = typeof( LibDEF_ChannelMeta ).Name() )
    {
      syncChannel := NamedValueTreeIO::ImportObject( nvt_i, channelMeta, typeof( LibDEF_ChannelMeta ) ).astype( LibDEF_ChannelMeta );
      channelNames.Add( syncChannel.Name() );
    }
    
    if( channelNames.Size() > 0 )
    {
      this.SendMetadataSuccessGetChannelsMetadata( channelNames, requestor_i, event_i );
    }
    else
    {
      LibDEF_Util::EventLogError( event_i, 
                                  "Failed to process system metadata request",
                                  "No channels received from requestor '" + requestor_i.Name() + "'. Ensure that the requestor Systems has at least one Channel implemented." );
    }
  *]
}