lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
StaticMethod SyncDatasetStatusExternally (LibDEF_DataBroker dataBroker_i)
{
  Description: 'Check and update the interest status (online/offline) for all the planning datasets, synchronize with the respective external DataBrokers.'
  TextBody:
  [*
    // Jacky CHAN Feb-8-2017 (created)
    traverse( LibDEF_SetInterestOfDataset::GetAllDatasetInterests( dataBroker_i ), Elements, di )
    {
      // check if can sync
      if( LibDEF_Util::GetSettingValueConnectOnStartup() )
      {
        // offline, making assumption that permanent deletion should only be executed by calling LibDEF_API::DatasetsDelete()
        if( di.IsDatasetOffline() )
        {
          di.Delete( true );
        }
        // online
        else
        { 
          setMeta := di.SetMeta();
          // only if it has no other online dataset interest
          if( not setMeta.HasOtherOnlineDatasetInterest( di.DatasetMDSID() ) )
          {
            // Send a 'SetInterest-Created' message to the Set owner
            setMeta.GetSystem().SendMetadataRequestSetInterestCreated( di, setMeta );
          }
        }
      }
    }
  *]
}