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
Quintiq file version 2.0
#parent: #root
Method ParseEntityQuery (String querykind, JSON jsondata) as owning Lib3DS_Entities
{
  TextBody:
  [*
    entities := construct( Lib3DS_Entities );
    
    urlprefix := '';
    urlprefixes := guard( jsondata.Get( 'url_prefixes' ), null( JSON, owning ) );
    if( not isnull( urlprefixes ) )
    {
      key := urlprefixes.GetProperty( 0 );
      urlprefix := guard( urlprefixes.Get( key ).GetString(), '' );
    }
    
    results := guard( jsondata.Get( 'results' ), null( JSON, owning ) );
    
    if( guard( results.IsArray(), false ) )
    {
      for( i := 0; i < results.Size(); i++ )
      {
        result := results.Get( i );
        
        if( not isnull( result ) )
        {
          id := guard( result.Get( 'id' ).GetString(), '' );
          physicalid := guard( result.Get( 'physicalid' ).GetString(), '' );
          
          if( id <> '' and physicalid <> '' )
          {
            obj := this.FindOrCreateEntity( querykind, id, physicalid );
            obj.Synchronize( result, urlprefix );
            entities.Add( obj );
          }
        }
      }
    }
    
    return &entities;
  *]
  InterfaceProperties { Accessibility: 'Module' }
}