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
Quintiq file version 2.0
#parent: #root
StaticMethod DoSanityCheck (LibDMF_CommunicationChannelRoot communicationChannelRoot_i)
{
  Description: 'Go through all types and create error messages for each error found in each type'
  TextBody:
  [*
    // soh yee Nov-6-2014 (created)
    
    // Delete sanity check message that has been fixed or sanity check message that is not ignored.
    traverse( communicationChannelRoot_i, SanityCheckGroup.SanityCheckMessage, message,
              message.IsValid() or message.IsShown() )
    {
      message.Delete();
    }
    
    limit := communicationChannelRoot_i.SanityCheckParameters().SanityCheckLimit();
    
    // Traverse invalid object and re-create messages that are not ignored.
    traverse( communicationChannelRoot_i, SanityCheckGroup, group )
    {
      numberofmessages := 0;      // Error which is ignored is not taken into account by the limit in global parameters.
    
      traverse( group, InvalidObject, object, limit > numberofmessages )
      {
        feedbacks := construct( Strings );
        object.DoSanityCheck( feedbacks );
        feedback := feedbacks.ToString( String::NewLine() );
    
        if( not isnull( group ) )
        {
          LibDMF_SanityCheckMessage::Create( group, feedback, object, true );
          numberofmessages++;
        }
      }
    }
  *]
}