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
34
35
36
37
38
39
40
Quintiq file version 2.0
#parent: #root
Method DataInstantiateInChannelOfDataManager (NamedValueTree nvt_i, LibDMF_Set set_i) as LibDMF_Set
{
  Description:
  [*
    Instantiate the data from the NVT as objects in the Channel in the DataManager.
    (1) In the DM the objects must be related to a Set.
  *]
  TextBody:
  [*
    if( not isnull( set_i ) )
    {
      root := this.CommunicationChannelRoot();
    
      sourceKind := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_SOURCEKIND() );
      sourceName := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_SOURCENAME() );
    
      // Retrieve IntegrationEvent.
      event := root.EventGetLast( sourceKind, sourceName );
    
      // Delete the existing instances
      set_i.DeleteObjects();
    
      // Instantiate the data.
      this.DataInstantiateInChannel( nvt_i, set_i );
    
      // Update the sets last updated attribute
      set_i.UpdateTimestampLastUpdated();
    
      // Trigger sanity checks whenever data is received in DM
      set_i.StartSanityCheckOnSetObjects();
    
      root.EventLogActivity( event,
                             "Set '" + set_i.Name() + "' succesfully instantiated" );
    }
    
    return set_i;
  *]
}