yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
Method InitializeConversion
{
  Description: 'Initialize the conversion of the object'
  TextBody:
  [*
    this.UpdateVersion();
    this.UpdateStart( DateTime::Now() );
    
    // 1. Get the dataset status
    allInfos := MDSEditor::Editor().ObjectInfos();
    objInfo := select( allInfos, Elements, e, e.MDSID().MDSKey() = this.DatasetMDSID() )
    
    // 1a. If the dataset is not loaded, we load it
    if( not objInfo.IsLoaded() )  
    {
      this.UpdateStatus( DMF_Utility::ID_DatasetLoading() );
      // The dataset is loaded asynchronously, so the only time this conversion
      // will continue is when ConvertorDataset receives the response from the real
      // dataset that it is loaded, the method is DMF_ConvertorDataset::HandleOnConstructed
      // Load the dataset
      this.LoadMDS();
    }
    // 1b. Otherwise, we proceed straight to conversion
    else
    {
      this.UpdateStatus( DMF_Utility::ID_Started() );
      // Look for the first DatasetInConvertorVersion that hasn't begun
      dciv := this.GetNextDatasetInConvertorVersion( this.First() );
      
      if( not isnull( dciv ) )
      {
        // Initialize the conversion of that version
        dciv.InitializeConversion();
      }
    }
  *]
}