- this.method = query.object;
-
- var keys = manifold.metadata.get_key(this.method);
- this.key = (keys && keys.length == 1) ? keys[0] : null;
-
- // xxx temporary hack
- // as of nov. 28 2013 we have here this.key='urn', but in any place where
- // the code tries to access record[this.key] the records only have
- // keys=type,hrn,network_hrn,hostname
- // so for now we force using hrn instead
- // as soon as record have their primary key set this line can be removed
- // see also same hack in googlemap
- this.key= (this.key == 'urn') ? 'hrn' : this.key;
+ this.object = query.object;
+
+ //// we need 2 different keys
+ // * canonical_key is the primary key as derived from metadata (typically: urn)
+ // and is used to communicate about a given record with the other plugins
+ // * init_key is a key that both kinds of records
+ // (i.e. records returned by both queries) must have (typically: hrn or hostname)
+ // in general query_all will return well populated records, but query
+ // returns records with only the fields displayed on startup
+ var keys = manifold.metadata.get_key(this.object);
+ this.canonical_key = (keys && keys.length == 1) ? keys[0] : undefined;
+ //
+ this.init_key = this.options.init_key;
+ // have init_key default to canonical_key
+ this.init_key = this.init_key || this.canonical_key;
+ // sanity check
+ if ( ! this.init_key ) messages.warning ("QueryTable : cannot find init_key");
+ if ( ! this.canonical_key ) messages.warning ("QueryTable : cannot find canonical_key");
+ if (debug) messages.debug("querytable: canonical_key="+this.canonical_key+" init_key="+this.init_key);