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
41
42
43
44
45
46
47
48
49
50
51
Quintiq file version 2.0
#parent: #root
Method GetSetOfInterest (LibDMF_SystemOnChannel soc_i, String hierarchyName_i, output String feedback_o) as LibDMF_Set
{
  Description: 'Retrieve the Set in the DataManager which the SOC is interested in, returns null if not used in DataManager.'
  TextBody:
  [*
    // Retrieve IntegrationEvent
    root  := this.CommunicationChannelRoot();
    event := root.EventGetLast( soc_i.DatasetKind(), soc_i.DatasetName() );
    
    set := null( LibDMF_Set );
    
    if( this.CommunicationChannelRoot().IsDataManager() )
    {
      hierarchy := select( this, Hierarchy, hier, hier.Name() = hierarchyName_i );
    
      if( not isnull( hierarchy ) )
      {
        if( counter( hierarchy, SetType.Set, s, true ) = 0 )
        {
          feedback_o := "No Sets found for Hierarchy " + hierarchyName_i + "; Channel = " + this.Name();
        }
        else
        {
          // Just take one of the Sets in which the System is interested.
          set := select( hierarchy, SetType.Set, s,
                         exists( s, Interest, interest,
                                 interest.SystemOnChannel() = soc_i ) );
    
          if( isnull( set ) )
          {
            feedback_o := "No interest specified in any of the Sets of Hierarchy " + hierarchyName_i + "; Channel = " + this.Name();
          }
        }
      }
      else
      {
        feedback_o := "Hierarchy '" + hierarchyName_i + "' not found; Channel = " + this.Name();
      }
    }
    
    if( feedback_o.Length() > 0 )
    {
      root.EventLogActivityWarning( event,
                                    feedback_o );
    }
    
    return set;
  *]
}