| 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 ); | 
|       } | 
|     } | 
|   *] | 
| } |