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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Quintiq file version 2.0
#parent: #root
Method ContinueWithoutFinalize (LibOpt_Task task, LibOpt_Link link, LibOpt_Scope scope) as stream[JSON]
{
  TextBody:
  [*
    //Check to add iterationthread
    snapshot := task.SnapshotComponent();
    if( this.CheckAddIterationThreads( task, link ) )
    {
      iterThread := LibOpt_IterationThread::FindCreateAvailableThread( task.Run(), snapshot.GetIterationPartOwner().PrecisionTimeStampStartComponent() );
      snapshot.ExecutingIterationThread( relset, iterThread );
    }
    
    breakpoint_string := LibOpt_Component::ComponentPosition_Continue();
    
    // Conditionally create a dataset copy.
    // If InOneTransaction() is true, then a dataset copy that is robust against errors and rollbacks will be created
    // If InOneTransaction() is false then no errors or rollbacks will occur before the end of the transaction so a quick dataset copy will be created.   
    isrobustdatasetcopy := guard( link.TaskTransporter().InOneTransaction(), false );
    LibOpt_DatasetCopyConditional::CopyDatasetConditionally( breakpoint_string, task, isrobustdatasetcopy ); 
    
    result := stream[JSON]::Success();
    breakpoint_stream := null( stream[Void] );
    
    if( this.HasBreakpoint( breakpoint_string, task, breakpoint_stream ) )
    {
      // Execute with breakpoint
      if( isnull( link ) )
      {
        result := result->After( breakpoint_stream );
      }
      else
      {
        result := breakpoint_stream->|
                  link->Execute( task, scope );
      }
    }
    else if( not isnull( link ) )
    {
      // Execute without breakpoint
      transaction := LibOpt_CurrentTransaction::GetCurrentTransaction( this );
      if( transaction.IsSafe() )
      {
        istaskregistered := transaction.BeforeMethodCall_ExistingSafeTransaction( task );
        // A user error might occur in Execute or in other methods called by Execute. 
        // However, transaction.IsSafe() is true, so we are inside a try{...} block. We have also called BeforeMethodCall_ExistingSafeTransaction. The error is therefore handled gracefully. 
        result := link.Execute( task, scope );
        transaction.AfterMethodCall_ExistingSafeTransaction( task, istaskregistered );
      }
      else
      {
        try
        {
          istaskregistered := transaction.BeforeMethodCall_TryBlock( task );
          // A user error might occur in Execute or in other methods called by Execute. 
          // However, we are inside a try{...} block. We have also called BeforeMethodCall_TryBlock. The error is therefore handled gracefully. 
          result := link.Execute( task, scope );
          transaction.AfterMethodCall_TryBlock( task, task.Run(), istaskregistered );      
        }
        onerror
        {
          transaction.OnError( e );
        }
        onfailure
        {
          transaction.OnFailure( e );
        }
      }
    }
    
    return result;
  *]
}