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
28
29
30
31
32
33
34
35
36
37
38
39
40
Quintiq file version 2.0
#parent: #root
Method GetConcept (
  String fileName_i
) as String
{
  Description:
  [*
    Get the concept that is imported from the name of the file.
    The name of the file is expected to start with the name of the concept.
    Is only required for ImportAsIfFrom3DSpace.
  *]
  TextBody:
  [*
    // The name of the file is expected to start with the name of the concept followed by an underscore, e.g. "resource_ids.json".
    concept     := guard( fileName_i.SubString( 0, fileName_i.FindString( "_", 0 ) ).ToLower(), "" );
    isSupported := false;
    
    // Check if the concept is supported.
    if( concept <> "" )
    {
      traverse( this.DoGetConcepts(), Elements, supportedConcept, not isSupported )
      {
        if( concept = supportedConcept.ToLower() )
        {
          concept     := supportedConcept;  // Use uppercase and lowercase of the supportedConcept.
          isSupported := true;
        }
      }
    }
    
    if( not isSupported )
    {
      LibDIF_Util::Error( "Filename should start with the name of a supported concept, followed by an '_' | Filename = '" + fileName_i + "'" );
    }
    
    return concept;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}