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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Quintiq file version 2.0
#parent: #root
Method SendSetUpdated
{
  Description: 'Send a SetUpdated full-message or notification, based on SetInterests.'
  TextBody:
  [*
    // Jacky CHAN May-24-2016 (created)
    interestedSystems := construct( LibDEF_Systems );
    traverse( this, SetInterestFromSystem.SystemInterestedIn, interestedSystem )
    {
      // if the System is local, use SetInterestOfDataset
      if( interestedSystem.IsLocalSystem() )
      {
        // forward data to interested datasets
        interestedDatasets := selectset( this, SetInterestOfDataset, datasetInterest, datasetInterest.IsDatasetOnline() );
        //drMDSID            := LibDEF_DataRepository::GetMDSID();
        
        //LibDEF_DataRepository::JobForwardToDatasets( drMDSID, this.GUID(), interestedDatasets );
        
        drDataset := LibDEF_DataRepository::GetDataset();
        drDataset->ForwardToDatasets( this.GUID(), interestedDatasets );
      }
      else
      {
        // forward data to interested Systems
        interestedSystems.Add( interestedSystem );
      }
    }
    
    // For interested Systems, request DataRepository to send full data
    // make sure no Systems receive more than once
    uniqueSystems := interestedSystems.Unique();
    //dbMDSID       := LibDEF_DataBroker::GetMDSID();
    //drMDSID       := LibDEF_DataRepository::GetMDSID();
    //LibDEF_DataBroker::JobSendUpdatedDataToSystems( dbMDSID, this.GUID(), uniqueSystems, drMDSID );
    
    dbDataset     := LibDEF_DataBroker::GetDataset();
    drDataset     := LibDEF_DataRepository::GetDataset();
    dbDataset->SendUpdatedDataToSystems( this.GUID(), uniqueSystems, drDataset );
    
    // For non-interested Systems, send notification of SetUpdated only
    localSystem      := this.SetTypeMeta().System();
    otherSystems     := localSystem.GetOtherSystemsWithCommonChannel( this.ChannelName() );
    remainingSystems := otherSystems.Difference( uniqueSystems );
    
    localSystem.SendMetadataRequestSetUpdated( this, remainingSystems );
  *]
}