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
Quintiq file version 2.0
#parent: #root
Method RequestReceive (NamedValueTree nvt_i)
{
  Description:
  [*
    Receive a Request from a System.
    (1) This method is overridden for the HierarchyChannel in order to deal with Hierarchy-related requests.
  *]
  TextBody:
  [*
    sourceKind  := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_SOURCEKIND()  );
    sourceName  := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_SOURCENAME()  );
    messageType := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_MESSAGETYPE() );
    messageID   := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_MESSAGEID()   );
    requestID   := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_REQUESTID()   );
    
    root := this.CommunicationChannelRoot();
    
    // Retrieve IntegrationEvent
    event := root.EventGetLast( sourceKind, sourceName );
    
    // Log this action for tracing and update the IntegrationEvent
    LibDMF_Util::Trace( sourceName, messageID, messageType, "", false, true );
    root.EventUpdateTraceInfo( event, messageID, requestID, messageType, "" );
    
    // In case of a HierarchyChannel some actions have already been done at Hierarchy-level before this method was called.
    // These actions should not be done again.
    if( not this.IsHierarchyChannel() )
    {
      // Temporary store the RequestID, so it can be added to the header of the response that will be send.
      this.RequestID( requestID );
    
      root.EventLogActivity( event,
                             "Received request '" + messageType + "' for CommunicationChannel = '" + this.Name() + "'; MessageID = " + messageID + ", RequestID = " + requestID );
    }
    
    if( messageType = LibDMF_CommunicationChannel::REQUEST_GETSET() )
    {
      this.RequestReceiveGetSet( nvt_i );
    }
    else if( messageType = LibDMF_CommunicationChannel::REQUEST_GETSETSFORTYPE() )
    {
      this.RequestReceiveGetSetsForType( nvt_i );
    }
    else
    {
      root.EventLogActivityError( event,
                                  "Received unknown request '" + messageType + "' for CommunicationChannel = '" + this.Name() + "'",
                                  "Received unknown request '" + messageType + "' for CommunicationChannel = '" + this.Name() + "'; MessageID = " + messageID  + ", RequestID = " + requestID );
    }
    
    // Reset the RequestID
    this.RequestID( LibDMF_CommunicationChannel::REQUEST_NO_ID() );
  *]
}