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' } 
 | 
} 
 |