陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
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
Quintiq file version 2.0
#parent: #root
MethodOverride DeleteCondition (LibOpt_Task task) as Boolean
{
  Description:
  [*
    This method checks if a rollback or an error occured on this component or on any downstream components. If there are no rollbacks and no errors, then the dataset that is attached to the `LibOpt_DatasetCopyOnRollbackOrError` is deleted.
    
    Extending this method (or subclassing the `LibOpt_DatasetCopyOnRollbackOrError` type) will break the unit tests. We recommend you to create a new subclass from the `LibOpt_DatasetCopyConditional` type if you want to modify this method.
  *]
  TextBody:
  [*
    descendants := task.SnapshotComponent().Descendants();
    
    hasrollback := exists( descendants,
                           Elements.astype( LibOpt_SnapshotKPI ),
                           snapshotKPI, 
                           snapshotKPI.IsRolledBack() );
    
    hasrollbackorerror := hasrollback 
                          or exists( descendants,
                                     Elements.astype( LibOpt_SnapshotError ),
                                     snapshoterror, 
                                     true );
    
    return not hasrollbackorerror;
  *]
}