陈清红
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
29
30
31
Quintiq file version 2.0
#parent: #root
StaticMethod FindCreate (
  SCK_Manager owner,
  Type violation_type,
  SCK_Group group,
  SCK_Severity severity
) as SCK_Check
{
  Description: 'Retrieves the check for violation type [type] or a newly created one if no such check existed yet.'
  TextBody:
  [*
    verify( violation_type.IsDerivedFrom( typeof( SCK_Violation ) ), "Provided type " + violation_type.Name() + " must be derived from " + typeof( SCK_Violation ).Name() );
    verify( not isnull( group ), "A check must have a group" );
    verify( not isnull( severity ), "A check must have a severity" );
    
    name := violation_type.Name();
    check := select( owner, Check.astype( SCK_Check ), ck, ck.Name() = name );
    
    if ( isnull( check) )
    {
      check := owner.Check( relnew, SCK_Check
                          , Name := name        
                          , Group := group
                          , Severity := severity
                          , ViewNameToOpenMe := SCK_Manager::VIEWNAME_None() );
    }
    
    return check;
  *]
}