From a6af48db42ee878f5186985587bdd61bdb9b9827 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 15:12:46 -0200 Subject: [PATCH 01/11] Adding XML syntax highlighting to the README --- querydsl-collections/README.md | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/querydsl-collections/README.md b/querydsl-collections/README.md index e7b6c4c49..ca8ca00a4 100644 --- a/querydsl-collections/README.md +++ b/querydsl-collections/README.md @@ -6,24 +6,24 @@ The Collections module provides integration with Java Collections and Beans. Add the following dependencies to your Maven project : - - com.mysema.querydsl - querydsl-apt - ${querydsl.version} - provided - - - - com.mysema.querydsl - querydsl-collections - ${querydsl.version} - - - - org.slf4j - slf4j-log4j12 - 1.6.1 - +```XML + + com.mysema.querydsl + querydsl-apt + ${querydsl.version} + provided + + + com.mysema.querydsl + querydsl-collections + ${querydsl.version} + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` If you are not using JPA or JDO you can generate Querydsl query types for your domain types by annotating them with the com.mysema.query.annotations.QueryEntity annotation and adding the following plugin configuration into your Maven configuration (pom.xml) : From 5b5a9f1a9dd69efc35c50500c1577b39fdab17cc Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:22:41 -0200 Subject: [PATCH 02/11] Adding syntax Highlight for querydsl-sql/README.md --- querydsl-sql/README.md | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/querydsl-sql/README.md b/querydsl-sql/README.md index 3b7b34809..21279a381 100644 --- a/querydsl-sql/README.md +++ b/querydsl-sql/README.md @@ -6,17 +6,18 @@ The SQL module provides integration with the JDBC API. Add the following dependencies to your Maven project : - - com.mysema.querydsl - querydsl-sql - ${querydsl.version} - - - - org.slf4j - slf4j-log4j12 - 1.6.1 - +```XML + + com.mysema.querydsl + querydsl-sql + ${querydsl.version} + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` **Code generation via Maven** @@ -63,13 +64,14 @@ Use the goal test-export to add the targetFolder as a test compile source root i **Querying** Querying with Querydsl SQL is as simple as this : - - QCustomer customer = new QCustomer("c"); - SQLTemplates dialect = new HSQLDBTemplates(); // SQL-dialect - SQLQuery query = new SQLQuery(connection, dialect); - List lastNames = query.from(customer) - .where(customer.firstName.eq("Bob")) - .list(customer.lastName); - +```JAVA +QCustomer customer = new QCustomer("c"); + +SQLTemplates dialect = new HSQLDBTemplates(); // SQL-dialect +SQLQuery query = new SQLQuery(connection, dialect); +List lastNames = query.from(customer) + .where(customer.firstName.eq("Bob")) + .list(customer.lastName); +``` For more information on the Querydsl SQL module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s03.html From b4cfdc41efa8e1fc75a9fafaed05ff07cb552efa Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:32:53 -0200 Subject: [PATCH 03/11] Adding syntax Highlight for querydsl-lucene3/README.md --- querydsl-lucene3/README.md | 73 +++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/querydsl-lucene3/README.md b/querydsl-lucene3/README.md index b945b4c30..d47851e9b 100644 --- a/querydsl-lucene3/README.md +++ b/querydsl-lucene3/README.md @@ -5,36 +5,39 @@ The Lucene module provides integration with the Lucene 3 indexing library. **Maven integration** Add the following dependencies to your Maven project : - - - com.mysema.querydsl - querydsl-lucene3 - ${querydsl.version} - - - - org.slf4j - slf4j-log4j12 - 1.6.1 - +```XML + + com.mysema.querydsl + querydsl-lucene3 + ${querydsl.version} + + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` **Creating the query types** With fields year and title a manually created query type could look something like this: - - public class QDocument extends EntityPathBase{ - private static final long serialVersionUID = -4872833626508344081L; - - public QDocument(String var) { - super(Document.class, PathMetadataFactory.forVariable(var)); - } - - public final StringPath year = createString("year"); - - public final StringPath title = createString("title"); + +```JAVA +public class QDocument extends EntityPathBase{ + private static final long serialVersionUID = -4872833626508344081L; + + public QDocument(String var) { + super(Document.class, PathMetadataFactory.forVariable(var)); } + public final StringPath year = createString("year"); + + public final StringPath title = createString("title"); +} +``` + QDocument represents a Lucene document with the fields year and title. Code generation is not available for Lucene, since no schema data is available. @@ -42,17 +45,21 @@ Code generation is not available for Lucene, since no schema data is available. **Querying** Querying with Querydsl Lucene is as simple as this: - - QDocument doc = new QDocument("doc"); - - IndexSearcher searcher = new IndexSearher(index); - LuceneQuery query = new LuceneQuery(true, searcher); - List documents = query - .where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle")) - .list(); + +```JAVA +QDocument doc = new QDocument("doc"); + +IndexSearcher searcher = new IndexSearher(index); +LuceneQuery query = new LuceneQuery(true, searcher); +List documents = query + .where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle")) + .list(); + ``` which is transformed into the following Lucene query : - - +year:[1800 TO 2000] +title:huckle* + +``` ++year:[1800 TO 2000] +title:huckle* +``` For more information on the Querydsl Lucene module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s05.html From 2fd7a090a23b52aea2f5858251c8d8eb1f991a04 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:35:22 -0200 Subject: [PATCH 04/11] Adding syntax Highlight for querydsl-lucene4/README.md --- querydsl-lucene4/README.md | 71 ++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/querydsl-lucene4/README.md b/querydsl-lucene4/README.md index 937607672..ffaf9142b 100644 --- a/querydsl-lucene4/README.md +++ b/querydsl-lucene4/README.md @@ -5,36 +5,38 @@ The Lucene module provides integration with the Lucene 4 indexing library. **Maven integration** Add the following dependencies to your Maven project : - - - com.mysema.querydsl - querydsl-lucene4 - ${querydsl.version} - - - - org.slf4j - slf4j-log4j12 - 1.6.1 - +```XML + + com.mysema.querydsl + querydsl-lucene4 + ${querydsl.version} + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` **Creating the query types** With fields year and title a manually created query type could look something like this: - - public class QDocument extends EntityPathBase{ - private static final long serialVersionUID = -4872833626508344081L; - - public QDocument(String var) { - super(Document.class, PathMetadataFactory.forVariable(var)); - } - - public final StringPath year = createString("year"); - - public final StringPath title = createString("title"); + +```JAVA +public class QDocument extends EntityPathBase{ + private static final long serialVersionUID = -4872833626508344081L; + + public QDocument(String var) { + super(Document.class, PathMetadataFactory.forVariable(var)); } + public final StringPath year = createString("year"); + + public final StringPath title = createString("title"); +} +``` + QDocument represents a Lucene document with the fields year and title. Code generation is not available for Lucene, since no schema data is available. @@ -42,17 +44,20 @@ Code generation is not available for Lucene, since no schema data is available. **Querying** Querying with Querydsl Lucene is as simple as this: - - QDocument doc = new QDocument("doc"); - - IndexSearcher searcher = new IndexSearher(index); - LuceneQuery query = new LuceneQuery(true, searcher); - List documents = query - .where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle")) - .list(); + +``` +QDocument doc = new QDocument("doc"); + +IndexSearcher searcher = new IndexSearher(index); +LuceneQuery query = new LuceneQuery(true, searcher); +List documents = query + .where(doc.year.between("1800", "2000").and(doc.title.startsWith("Huckle")) + .list(); +``` which is transformed into the following Lucene query : - - +year:[1800 TO 2000] +title:huckle* +``` ++year:[1800 TO 2000] +title:huckle* +``` For more information on the Querydsl Lucene module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s05.html From becb48cb8c905d900cf10968eb8a638f82951b66 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:36:04 -0200 Subject: [PATCH 05/11] Adding syntax Highlight for querydsl-lucene4/README.md --- querydsl-lucene4/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/querydsl-lucene4/README.md b/querydsl-lucene4/README.md index ffaf9142b..4a6a8f9a9 100644 --- a/querydsl-lucene4/README.md +++ b/querydsl-lucene4/README.md @@ -45,7 +45,7 @@ Code generation is not available for Lucene, since no schema data is available. Querying with Querydsl Lucene is as simple as this: -``` +```JAVA QDocument doc = new QDocument("doc"); IndexSearcher searcher = new IndexSearher(index); From 17757b7499167f192f55cbd66228ab4125efdc11 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:38:44 -0200 Subject: [PATCH 06/11] Adding Java syntax Highlighting for querydsl-collections/README.md --- querydsl-collections/README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/querydsl-collections/README.md b/querydsl-collections/README.md index ca8ca00a4..b1bfd73c8 100644 --- a/querydsl-collections/README.md +++ b/querydsl-collections/README.md @@ -58,13 +58,15 @@ If you are not using JPA or JDO you can generate Querydsl query types for your d Querying with Querydsl Collections is as simple as this : - import static com.mysema.query.collections.CollQueryFactory.*; - - QCat cat = new QCat("cat"); - for (String name : from(cat,cats) - .where(cat.kittens.size().gt(0)) - .list(cat.name)){ - System.out.println(name); - } +```JAVA +import static com.mysema.query.collections.CollQueryFactory.*; + +QCat cat = new QCat("cat"); +for (String name : from(cat,cats) + .where(cat.kittens.size().gt(0)) + .list(cat.name)){ + System.out.println(name); +} +``` For more information on the Querydsl Collections module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s08.html From 1621142a129f968d750bfa055f076285fa565183 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:41:54 -0200 Subject: [PATCH 07/11] Adding syntax Highlighting for querydsl-jdo/README.md --- querydsl-jdo/README.md | 50 +++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/querydsl-jdo/README.md b/querydsl-jdo/README.md index 850975c47..bfd46dcea 100644 --- a/querydsl-jdo/README.md +++ b/querydsl-jdo/README.md @@ -6,24 +6,26 @@ The JDO module provides integration with the JDO API. Add the following dependencies to your Maven project : - - com.mysema.querydsl - querydsl-apt - ${querydsl.version} - provided - - - - com.mysema.querydsl - querydsl-jdo - ${querydsl.version} - +```XML + + com.mysema.querydsl + querydsl-apt + ${querydsl.version} + provided + - - org.slf4j - slf4j-log4j12 - 1.6.1 - + + com.mysema.querydsl + querydsl-jdo + ${querydsl.version} + + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` And now, configure the Maven APT plugin which generates the query types used by Querydsl : @@ -66,11 +68,13 @@ Now you are able to construct JDOQL query instances and instances of the query d Querying with Querydsl JDO is as simple as this : - QCustomer customer = QCustomer.customer; - JDOQuery query = new JDOQuery(pm); - Customer bob = query.from(customer) - .where(customer.firstName.eq("Bob")) - .uniqueResult(customer); - query.close(); +```JAVA +QCustomer customer = QCustomer.customer; +JDOQuery query = new JDOQuery(pm); +Customer bob = query.from(customer) + .where(customer.firstName.eq("Bob")) + .uniqueResult(customer); +query.close(); +``` For more information on the Querydsl JDO module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s02.html From 5e1e8bd1b1e0b73156bead8f76a340b2ab5dcd4d Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:43:52 -0200 Subject: [PATCH 08/11] Adding syntax Highlighting for querydsl-jpa/README.md --- querydsl-jpa/README.md | 50 +++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/querydsl-jpa/README.md b/querydsl-jpa/README.md index a6500a23c..e2541f749 100644 --- a/querydsl-jpa/README.md +++ b/querydsl-jpa/README.md @@ -6,24 +6,26 @@ The JPA module provides integration with the JPA 2 persistence API. Add the following dependencies to your Maven project : - - com.mysema.querydsl - querydsl-apt - ${querydsl.version} - provided - - - - com.mysema.querydsl - querydsl-jpa - ${querydsl.version} - +```XML + + com.mysema.querydsl + querydsl-apt + ${querydsl.version} + provided + - - org.slf4j - slf4j-log4j12 - 1.6.1 - + + com.mysema.querydsl + querydsl-jpa + ${querydsl.version} + + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` And now, configure the Maven APT plugin : @@ -68,10 +70,12 @@ Now you are able to construct JPQL query instances and instances of the query do Querying with Querydsl JPA is as simple as this : - QCustomer customer = QCustomer.customer; - JPAQuery query = new JPAQuery(entityManager); - Customer bob = query.from(customer) - .where(customer.firstName.eq("Bob")) - .uniqueResult(customer); - +```JAVA +QCustomer customer = QCustomer.customer; +JPAQuery query = new JPAQuery(entityManager); +Customer bob = query.from(customer) + .where(customer.firstName.eq("Bob")) + .uniqueResult(customer); +``` + For more information on the Querydsl JPA module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02.html#jpa_integration From bce6b82607960975f4ff3ec2c4aa0a0ce37995d7 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:46:49 -0200 Subject: [PATCH 09/11] Adding syntax Highlighting for querydsl-mongodb/README.md --- querydsl-mongodb/README.md | 44 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/querydsl-mongodb/README.md b/querydsl-mongodb/README.md index 7a8c751e6..7c6ead58a 100644 --- a/querydsl-mongodb/README.md +++ b/querydsl-mongodb/README.md @@ -6,17 +6,19 @@ The Mongodb module provides integration with the Mongodb API. Add the following dependencies to your Maven project : - - com.mysema.querydsl - querydsl-mongodb - ${querydsl.version} - - - - org.slf4j - slf4j-log4j12 - 1.6.1 - +```XML + + com.mysema.querydsl + querydsl-mongodb + ${querydsl.version} + + + + org.slf4j + slf4j-log4j12 + 1.6.1 + +``` And now, configure the Maven APT plugin which generates the query types used by Querydsl : @@ -49,7 +51,7 @@ And now, configure the Maven APT plugin which generates the query types used by The MorphiaAnnotationProcessor finds domain types annotated with the com.google.code.morphia.annotations.Entity annotation and generates Querydsl query types for them. -Run clean install and you will get your Query types generated into target/generated-sources/java. +Run `clean install` and you will get your Query types generated into target/generated-sources/java. If you use Eclipse, run mvn eclipse:eclipse to update your Eclipse project to include target/generated-sources/java as a source folder. @@ -59,14 +61,16 @@ Now you are able to construct Mongodb queries and instances of the query domain Querying with Querydsl Mongodb with Morphia is as simple as this : - Morphia morphia; - Datastore datastore; - // ... - QUser user = new QUser("user"); - MorphiaQuery query = new MorphiaQuery(morphia, datastore, user); - List list = query - .where(user.firstName.eq("Bob")) - .list(); +```JAVA +Morphia morphia; +Datastore datastore; +// ... +QUser user = new QUser("user"); +MorphiaQuery query = new MorphiaQuery(morphia, datastore, user); +List list = query + .where(user.firstName.eq("Bob")) + .list(); +``` For more information on the Querydsl Mongodb module visit the reference documentation http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s07.html From 0013e519dc99d8b74226680a13ec9a0088c8b3af Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:53:48 -0200 Subject: [PATCH 10/11] Syntax Highlighting for /README.md --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c048b52da..1b04aefcc 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,10 @@ Free support is provided in the Querydsl Google Group https://groups.google.com/ Querydsl provides releases via public Maven repositories, but you can build the sources also yourself like this - cd querydsl-root - mvn -DskipTests=true clean install +```SHELL +$ cd querydsl-root +$ mvn -DskipTests=true clean install +``` For more information visit the project homepage at http://www.querydsl.com/. @@ -54,10 +56,10 @@ place it in the ```devops``` directory. To launch the virtual machine: -``` -$> cd devops -devops$> librarian-puppet install -devops$> vagrant up +```SHELL +$ cd devops +$ librarian-puppet install +$ vagrant up ``` All of the databases' default ports are forwarded to the host machine. See the Vagrantfile for details. From 8198732b8ed981500286196bd959a9af95a77795 Mon Sep 17 00:00:00 2001 From: Vinicius da Costa Pires Date: Mon, 15 Dec 2014 21:55:02 -0200 Subject: [PATCH 11/11] Syntax Highlighting for /README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b04aefcc..514e1ef25 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Free support is provided in the Querydsl Google Group https://groups.google.com/ Querydsl provides releases via public Maven repositories, but you can build the sources also yourself like this -```SHELL +```BASH $ cd querydsl-root $ mvn -DskipTests=true clean install ``` @@ -56,7 +56,7 @@ place it in the ```devops``` directory. To launch the virtual machine: -```SHELL +```BASH $ cd devops $ librarian-puppet install $ vagrant up