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