yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
StaticMethod SetDatasetCopyHandleRollbackAllowed (LibOpt_Components components) remote as Boolean
{
  Description:
  [*
    Throw a precondition for all components that don't have a 'Handle rollback' component position.
    This method is used for the 'Set dataset copies (Initialize + Rollback)' context menu item in the 'Components' form.
  *]
  TextBody:
  [*
    // evr3 Jun-19-2020 (created)
    feedbackobj := FeedbackObject::LocalFeedback();
    
    traverse( components, Elements, component )
    {
      hasrollbackposition := exists( component, ComponentPosition, cp, cp.Name() = LibOpt_Suboptimizer::ComponentPosition_Rollback() ) 
      if( not feedbackobj.CheckHard( hasrollbackposition ) )
      {
        feedbackobj.AddHard( Translations::LibOpt_Component_Precondition_HasNoRollbackComponentPosition( component ) ); 
      }
    }
    
    return feedbackobj.IsAllowed();
  *]
  InterfaceProperties { Accessibility: 'Module' }
}