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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Quintiq file version 2.0
#parent: #root
Method SendToInterestedSystems (String messageType_i)
{
  Description: 'Send the data of the Set to the Systems that have interest in the set or its set type.'
  TextBody:
  [*
    // Make sure the declarative relations are calculated.
    Transaction::Transaction().PropagateAll();
    
    channel := this.SetType().SystemOnChannel().CommunicationChannel();
    
    // find the set and set type interests
    setInterests     := selectset( channel, SystemOnChannel.Interest, interest,
                                   interest.Data() = this );
    setTypeInterests := selectset( channel, SystemOnChannel.Interest, interest,
                                   interest.Data() = this.SetType() );
    
    // find the intersecting SOCs
    socA := selectset( setInterests, Elements.SystemOnChannel, soc, true );
    socB := selectset( setTypeInterests, Elements.SystemOnChannel, soc, true );
    socInt := socA.Intersect( socB );
    
    // combine the interests without the intersected SOCs
    // collect set before set type, since delta is always at set level
    interests := setInterests;
    traverse( setTypeInterests, Elements, inter,
              not exists( socInt, Elements, system, true, system = inter.SystemOnChannel() ) )
    {
      interests.Add( inter );
    }
    
    traverse( interests, Elements, interest )
    {
      soc := interest.SystemOnChannel();
    
      // If not fully configured, flag warning
      if( soc.CanSend() )
      {
        isNotificationOnly := interest.NotificationOnly();
    
        //data := null( structured_Object, owning );
        lastUpdated := DateTime::MaxDateTime();
    
        setType := null( LibDMF_SetType );
        set     := null( LibDMF_Set     );
    
        data := channel.DataCollectBasedOnInterest( interest, isNotificationOnly,
                                                    setType, set, lastUpdated );  // OUTPUT PARAMETERS
    
        gp := this.GetCommunicationChannelRoot().GlobalParameters();
        LibDMF_CommunicationChannelRoot::TriggerMessageSendToSystem( channel,
                                                                     messageType_i,
                                                                     guard( setType.Name(), "NIL" ),
                                                                     guard( set.Name(), "NIL" ),
                                                                     isNotificationOnly,
                                                                     data,
                                                                     soc,
                                                                     gp.DM_DatasetKind(),
                                                                     gp.DM_DatasetName(),
                                                                     lastUpdated );
      }
      else
      {
        ccr := soc.GetCommunicationChannelRoot();
    
        // Create IntegrationEvent for system to log non-fully configured activity
        event := ccr.EventCreate( soc.DatasetKind(), soc.DatasetName(), false );
    
        ccr.EventLogActivityWarning( event,
                                     ccr.GetTranslation( "DM_DataExchange_ViolateIsConfigured", soc.SystemName() ) );
    
        // Intentionally end the event as a violation is encountered.
        ccr.EventComplete( event );
      }
    }
  *]
}