| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod CreateOperationOutputMessages ( | 
|   MacroPlan macroplan | 
| ) | 
| { | 
|   Description: 'create sanitycheck message' | 
|   TextBody: | 
|   [* | 
|     // desmondt Oct-3-2014 (created) | 
|     messagelimit := macroplan.GlobalParameters_MP().SanityCheckLimit(); | 
|      | 
|     // collect the InvalidOperationOutput object, sorted on the most severe sanity check | 
|     invalidobjects := selectsortedset( macroplan,  | 
|                                        SanityCheckGroupData.InvalidOperationOutput, | 
|                                        invalidobject, | 
|                                        true, | 
|                                        invalidobject.SanityCheckDataMostSevere() ); | 
|          | 
|     // traverse each InvalidOperationOutput object untill the message limit has been reached                                | 
|     objcount := 0;                                    | 
|     traverse( invalidobjects, | 
|               Elements, | 
|               invalidobject, | 
|               objcount <= messagelimit ) | 
|     { | 
|       objcount := objcount + 1; | 
|      | 
|       feedbacks := construct( Strings ); | 
|       sanitycheckfeedbacks := construct( Strings ); | 
|        | 
|       invalidobject.DoSanityCheckData( feedbacks, sanitycheckfeedbacks ); | 
|        | 
|       // collect the sanity check feedback | 
|       i := 0; | 
|       traverse( feedbacks, Elements, fb ) | 
|       { | 
|         if( not exists( invalidobject, SanityCheckMessageData, msg, msg.Description() = fb ) ) | 
|         { | 
|           //tokenize msg to retrieve category level and seperate the actual feedback | 
|           sanitycheckmessage := SanityCheckMessageData::Create( invalidobject.SanityCheckGroupData(),  | 
|                                                                 fb,  | 
|                                                                 true, | 
|                                                                 sanitycheckfeedbacks.Element( i ) ); | 
|           // Operation output is instatiated decleratively, the realation will set to OperationLink | 
|           sanitycheckmessage.AsSanityCheckMsgForOperationOutput( relset, invalidobject.AsLeadOperationOutput() ); | 
|         } | 
|         i := i + 1; | 
|       } | 
|     } | 
|   *] | 
| } |