Search in sources :

Example 1 with Criteria

use of org.immutables.mongo.fixture.ent.EntRepository.Criteria in project immutables by immutables.

the class Ent method main.

public static void main(String... args) throws UnknownHostException {
    MongoClient client = new MongoClient("localhost");
    RepositorySetup setup = RepositorySetup.builder().database(client.getDB("test")).executor(MoreExecutors.listeningDecorator(Executors.newCachedThreadPool())).gson(new GsonBuilder().registerTypeAdapterFactory(new GsonAdaptersEnt()).create()).build();
    EntRepository repository = new EntRepository(setup);
    EntRepository.Criteria where = repository.criteria().uuid("8b7a881c-6ccb-4ada-8f6a-60cc99e6aa20").actionIn("BAN", "IPBAN");
    Criteria or = where.expiresAbsent().or().with(where).expiresGreaterThan(TimeInstant.of(1467364749679L));
    System.out.println(or);
    repository.find(or).fetchAll().getUnchecked();
}
Also used : Criteria(org.immutables.mongo.fixture.ent.EntRepository.Criteria) MongoClient(com.mongodb.MongoClient) GsonBuilder(com.google.gson.GsonBuilder) RepositorySetup(org.immutables.mongo.repository.RepositorySetup) Criteria(org.immutables.mongo.fixture.ent.EntRepository.Criteria)

Aggregations

GsonBuilder (com.google.gson.GsonBuilder)1 MongoClient (com.mongodb.MongoClient)1 Criteria (org.immutables.mongo.fixture.ent.EntRepository.Criteria)1 RepositorySetup (org.immutables.mongo.repository.RepositorySetup)1