Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SynchronizeSolverSettingGroups 
 | 
{ 
 | 
  Description: 'Updates the SolverSettingsGroup and SolverSettings instances with info from the SolverSettings KT.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Martijn van Elzakker Jul-21-2015 (created) 
 | 
    // This method first flags all current solversettinggroups as not being part of the KT 
 | 
    // Then it traverses the KT and checks if there exists a solversettinggroup with the same name as the KT name 
 | 
    // if there does not, it creates a new SolverSettingGroup 
 | 
    // if there does, it updates the SolverSettingGroup 
 | 
    // In any case, it flags the current SolverSettingGroup as being part of the KT 
 | 
    // At the end, the method deletes all SolverSettingGroup that are still flagged as not part of the KT and it synchronizes the SolverSetting 
 | 
     
 | 
    traverse( this, SolverSettingGroup, solversettinggroup ) 
 | 
    { 
 | 
      solversettinggroup.IsInKnowledgeTable( false ); 
 | 
    } 
 | 
     
 | 
    solversettingstable := SolverSettingsTable::Table(); 
 | 
     
 | 
    traverse( solversettingstable, Rows, row ) 
 | 
    { 
 | 
      group := select( this, 
 | 
                       SolverSettingGroup, 
 | 
                       solversettinggroup, 
 | 
                       solversettinggroup.Name() = row.Name() ); 
 | 
     
 | 
      if( isnull( group ) ) 
 | 
      { 
 | 
        group := SolverSettingGroup::Create( this, row.Name() ); 
 | 
      } 
 | 
      else 
 | 
      { 
 | 
        group.Update( row.Name() ); 
 | 
      } 
 | 
      group.IsInKnowledgeTable( true ); 
 | 
    } 
 | 
     
 | 
    traverse( this, SolverSettingGroup, solversettinggroup, not solversettinggroup.IsInKnowledgeTable() ) 
 | 
    { 
 | 
      solversettinggroup.Delete() 
 | 
    } 
 | 
     
 | 
     this.SynchronizeSolverSettings(); 
 | 
  *] 
 | 
} 
 |