// Path: joiner-core/src/main/java/cz/encircled/joiner/query/Q.java
// public class Q {
// 
//     /**
//      * Build tuple query projections (i.e. select clause)
//      *
//      * @param returnProjections path to query projection
//      * @return joiner query with custom tuple query projection
//      */
//     public static FromBuilder<Tuple> select(Expression<?>... returnProjections) {
//         Assert.notNull(returnProjections);
//         return new TupleQueryFromBuilder(returnProjections);
//     }
// 
//     /**
//      * Build  query projection (i.e. select clause)
//      *
//      * @param returnProjection path to query projection
//      * @param <R>              type of source entity
//      * @return joiner query with custom query projection
//      */
//     public static <R> FromBuilder<R> select(Expression<R> returnProjection) {
//         return new ExpressionQueryFromBuilder<>(returnProjection);
//     }
// 
//     /**
//      * Build "from" clause of query
//      *
//      * @param from alias of source entity
//      * @param <T> type of source entity
//      * @return joiner query
//      */
//     public static <T> JoinerQuery<T, T> from(EntityPath<T> from) {
//         return new JoinerQueryBase<>(from, from);
//     }
// 
//     /**
//      * Build count query
//      *
//      * @param from alias of source entity
//      * @param <T> type of source entity
//      * @return count joiner query
//      */
//     public static <T> JoinerQuery<T, Long> count(EntityPath<T> from) {
//         JoinerQueryBase<T, Long> request = new JoinerQueryBase<>(from, true);
//         request.distinct(false);
//         return request;
//     }
// 
// }
// 
// Path: example/spring-webflux-example/src/main/kotlin/cz/encircled/joiner/springwebfluxexample/Employment.java
// @Entity
// @Table
// public class Employment {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_generator")
//     @SequenceGenerator(name = "id_generator", sequenceName = "id_seq", initialValue = 1, allocationSize = 1)
//     public Long id;
// 
//     @Column
//     public String name;
// 
// }


import cz.encircled.joiner.query.Q;
import cz.encircled.joiner.reactive.ReactorJoiner;
import cz.encircled.joiner.springwebfluxexample.Employment;
import cz.encircled.joiner.springwebfluxexample.QEmployment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
package cz.encircled.joiner.springwebfluxexample.controller;


@RestController
@RequestMapping("/java/employment")
public class JavaEmploymentController {

    @Autowired
    ReactorJoiner joiner;

    @GetMapping("{id}")
    Mono<Employment> getOne(@PathVariable Long id) {
        return joiner.findOne(Q.from(QEmployment.employment).where(QEmployment.employment.id.eq(id)));
    }

    @GetMapping
// Path: joiner-core/src/main/java/cz/encircled/joiner/query/Q.java
// public class Q {
// 
//     /**
//      * Build tuple query projections (i.e. select clause)
//      *
//      * @param returnProjections path to query projection
//      * @return joiner query with custom tuple query projection
//      */
//     public static FromBuilder<Tuple> select(Expression<?>... returnProjections) {
//         Assert.notNull(returnProjections);
//         return new TupleQueryFromBuilder(returnProjections);
//     }
// 
//     /**
//      * Build  query projection (i.e. select clause)
//      *
//      * @param returnProjection path to query projection
//      * @param <R>              type of source entity
//      * @return joiner query with custom query projection
//      */
//     public static <R> FromBuilder<R> select(Expression<R> returnProjection) {
//         return new ExpressionQueryFromBuilder<>(returnProjection);
//     }
// 
//     /**
//      * Build "from" clause of query
//      *
//      * @param from alias of source entity
//      * @param <T> type of source entity
//      * @return joiner query
//      */
//     public static <T> JoinerQuery<T, T> from(EntityPath<T> from) {
//         return new JoinerQueryBase<>(from, from);
//     }
// 
//     /**
//      * Build count query
//      *
//      * @param from alias of source entity
//      * @param <T> type of source entity
//      * @return count joiner query
//      */
//     public static <T> JoinerQuery<T, Long> count(EntityPath<T> from) {
//         JoinerQueryBase<T, Long> request = new JoinerQueryBase<>(from, true);
//         request.distinct(false);
//         return request;
//     }
// 
// }
// 
// Path: example/spring-webflux-example/src/main/kotlin/cz/encircled/joiner/springwebfluxexample/Employment.java
// @Entity
// @Table
// public class Employment {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "id_generator")
//     @SequenceGenerator(name = "id_generator", sequenceName = "id_seq", initialValue = 1, allocationSize = 1)
//     public Long id;
// 
//     @Column
//     public String name;
// 
// }


// Path: example/spring-webflux-example/src/main/kotlin/cz/encircled/joiner/springwebfluxexample/controller/JavaEmploymentController.java
import cz.encircled.joiner.query.Q;
import cz.encircled.joiner.reactive.ReactorJoiner;
import cz.encircled.joiner.springwebfluxexample.Employment;
import cz.encircled.joiner.springwebfluxexample.QEmployment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

package cz.encircled.joiner.springwebfluxexample.controller;


@RestController
@RequestMapping("/java/employment")
public class JavaEmploymentController {

    @Autowired
    ReactorJoiner joiner;

    @GetMapping("{id}")
    Mono<Employment> getOne(@PathVariable Long id) {
        return joiner.findOne(Q.from(QEmployment.employment).where(QEmployment.employment.id.eq(id)));
    }

    @GetMapping
    Flux<Employment> getAll() {