@Test public void testAssocQuery_forEach_arr_points_to_ref() throws Exception { GMD gmd = new GMD(projection("{'field':'users','include':1}"), null); CompositeMetadata md = CompositeMetadata.buildCompositeMetadata(getMd("composite/UC.json"), gmd); AnalyzeQuery pq = new AnalyzeQuery(md, md.getResolvedReferenceOfField(new Path("users"))); QueryExpression q = query("{'$and':[ { 'field': '_id','op': '$eq','rfield': '$parent.userId' }," + "{'array': 'authentications','elemMatch': {'$and': [" + "{'field': 'providerName','op': '$eq','rvalue': 'p'}," + "{'field': 'principal','op': '$eq','rfield': '$parent.$parent.userRedHatPrincipal'}]} } ] }"); pq.iterate(q); List<QueryFieldInfo> list = pq.getFieldInfo(); RewriteQuery rw = new RewriteQuery(md, md.getChildMetadata(new Path("users"))); RewriteQuery.RewriteQueryResult result = rw.rewriteQuery(q, list); QueryExpression newq = result.query; List<BoundObject> bindings = result.bindings; Assert.assertEquals(2, bindings.size()); Assert.assertTrue(bindings.get(0) instanceof BoundValue); rw = new RewriteQuery(md, md); result = rw.rewriteQuery(q, list); bindings = result.bindings; newq = result.query; System.out.println(newq); Assert.assertEquals(2, bindings.size()); }
public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } RewriteQuery(CompositeMetadata root,
                        CompositeMetadata currentEntity); }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } RewriteQuery(CompositeMetadata root,
                        CompositeMetadata currentEntity); RewriteQueryResult rewriteQuery(QueryExpression q, List<QueryFieldInfo> fieldInfo); }
RewriteQuery extends QueryIterator { public RewriteQuery(CompositeMetadata root, CompositeMetadata currentEntity) { this.currentEntity = currentEntity; } RewriteQuery(CompositeMetadata root,
                        CompositeMetadata currentEntity); RewriteQueryResult rewriteQuery(QueryExpression q, List<QueryFieldInfo> fieldInfo);  }