陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
Method RequestReceiveGetHierarchy (NamedValueTree nvt_i)
{
  TextBody:
  [*
    hierarchyName := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_HIERARCHYNAME() );
    sourceKind    := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_SOURCEKIND()    );
    sourceName    := LibInt_MessageAccessor::GetHeaderPropertyAsString( nvt_i, LibDMF_CommunicationChannel::HEADER_SOURCENAME()    );
    
    systemOnChannel := this.GetSystemOnChannel( sourceKind, sourceName );
    root            := this.CommunicationChannelRoot();
    
    // Retrieve IntegrationEvent
    event := root.EventGetLast( sourceKind, sourceName );
    
    if( systemOnChannel.CanSend() )
    {
      // Collecting data for one of the Sets collects data of the whole Hierarchy.
      feedback := "";
      set := this.GetSetOfInterest( systemOnChannel, hierarchyName, feedback );
      gp  := this.CommunicationChannelRoot().GlobalParameters();
    
      if( not isnull( set ) )
      {
        data := this.DataCollect( set );
    
        // Log successful retrieval of hierarchy
        root.EventLogActivity( event,
                               "Requested Hierarchy '" + hierarchyName + "' for CommunicationChannel = '" + this.Name() + "' found. Answering request...; RequestID = " + this.RequestID() );
    
    
        // Set isNotification to false, regardless of the setting of the interest.
        // A request should return the requested data.
        isNotification := false;
    
        this.MessageSendSetUpdatedToSystem( set.SetType().Name(), set.Name(), isNotification, data, systemOnChannel, gp.DM_DatasetKind(), gp.DM_DatasetName(), set.TimestampLastUpdated() );
      }
      else
      {
        // Let the System know that something is not ok.
        this.MessageSendErrorToSystem( LibDMF_CommunicationChannel::REQUEST_GETHIERARCHY(), feedback, systemOnChannel, gp.DM_DatasetKind(), gp.DM_DatasetName() );
      }
    }
    else
    {
      root.EventLogActivityError( event,
                                  "SystemOnChannel is not fully configured",
                                  "SystemOnChannel is not fully configured; Host = '" + systemOnChannel.HostName()
                                + "', Port = " + [String]systemOnChannel.PortNr()
                                + "', IsSoftDeleted = " + [String]systemOnChannel.IsSoftDeleted() );
    }
  *]
}