Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working combination of packages? #26

Open
schatzmanj opened this issue Jul 12, 2017 · 3 comments
Open

Working combination of packages? #26

schatzmanj opened this issue Jul 12, 2017 · 3 comments

Comments

@schatzmanj
Copy link

Attempting to use rsql-parser with Mongodb (minimal use of Spring). Have

q-builders-1.6
rsql-parser-2.1.0
spring-data-mongodb-1.10.4.RELEASE

That combination lacks QueryConversionPipeline and my code (below) will not compile.

Using

q-builders-1.6
rest-query-engine-0.7.1
spring-data-mongodb-1.10.4.RELEASE

there is the problem that
com.github.rutledgepaulv.rqe.pipes.QueryConversionPipeline (from restquery-engine-0.7.1)

wants
cz.jirutka.rsql.parser.ast.RSQLVisitor

but that class is in another package:
com.github.rutledgepaulv.qbuilders.visitors (from q-builders-1.6)

I have the impression that there has been some refactoring and the various jars to do not play together.

My goal is to be able to turn arbitrary HTTP queries into MongoDB queries. I would prefer to not use Spring, or to use Spring minimally.

My code looks like

    QueryConversionPipeline pipeline = QueryConversionPipeline.defaultPipeline();
    Condition<GeneralQueryBuilder> condition = pipeline.apply(myQueryString, MyClass.class);
    Criteria crit = condition.query(new MongoVisitor());
    FindIterable<Document> it = myMongo.find((BasicDBObject)crit.getCriteriaObject());

In principal, from what I can tell reading the documentation and looking at the code, this should work, but it won't run due to the above-mentioned packaging issues.

So

  1. How to get the above to work?
  2. Is there a way to accomplish the same ends without using spring-data-mongodb?

Thanks!

Jim

@schatzmanj
Copy link
Author

Also, although the page for q-builders states that it is designed to work with rsql-parser, I am puzzled about how this should work. In particular, the packages include incompatible versions of RSQLVisitor. I don't see how to get something like

    Node rootNode = new RSQLParser().parse(queryStr);
    rootNode.accept(wants a cz.jirutka.rsql.parser.ast.RSQLVisitor<R,A>);

to work. There are no implementations of the RSQLVisitor interface in rsql-parser and the RSQLVisitor in q-builders is not compatible. Are there some other set of versions of rsql-parser and q-builders that do work together?

to work.

@schatzmanj
Copy link
Author

O.k. I got a working arrangement. It requires:

q-builders-1.6
rest-query-engine-0.7.1
rsql-parser-2.1.0
spring-core-3.1.1
spring-dao-1.0.2
spring-data-commons-1.13
spring-data-mongodb-1.10

I am not thrilled that it requires 4 Spring libraries, but the following code works:

    String queryStr = ....;
    QueryConversionPipeline pipeline = QueryConversionPipeline.defaultPipeline();
    Condition<GeneralQueryBuilder> condition = pipeline.apply(queryStr, MyClass.class);
    Criteria crit = condition.query(new MongoVisitor());
    FindIterable<Document> result =   myMongoCollection.find((BasicDBObject)crit.getCriteriaObject());
    ....more MongoDB code....

@RutledgePaulV
Copy link

RutledgePaulV commented Sep 5, 2017

The spring deps are totally my fault, not @jirutka's. Sorry that I've been neglecting updates, I've shifted most of my attention to clojure over the last year and have been rather busy with my day job. I'll see if I can do some cleanup and library updates soon. I'd love to drop spring from the deps too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants