Example usage for org.springframework.data.mongodb.core MongoTemplate MongoTemplate

List of usage examples for org.springframework.data.mongodb.core MongoTemplate MongoTemplate

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core MongoTemplate MongoTemplate.

Prototype

private MongoTemplate(MongoDbFactory dbFactory, MongoTemplate that) 

Source Link

Usage

From source file:io.gravitee.repository.mongodb.ratelimit.RateLimitRepositoryConfiguration.java

@Bean(name = "rateLimitMongoTemplate")
public MongoOperations mongoOperations() {
    return new MongoTemplate(mongo, getDatabaseName());
}

From source file:com.example.MongoDBContainerDemo.java

@Override
protected void init(VaadinRequest request) {
    this.setContent(tabSheet);
    try {/*from  www . j a v  a 2  s  . c  om*/
        mongoOperations = new MongoTemplate(new MongoClient(), "scratch");
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
    // mongoOperations.remove(new Query(), Person.class);
    // generateRecords();

    final AbstractMongoDemo basic = new BasicMongoDemo(mongoOperations).initLayout();
    final AbstractMongoDemo buffered = new BufferedMongoDemo(mongoOperations).initLayout();

    tabSheet.addTab(basic, "Basic");
    tabSheet.addTab(buffered, "Buffered");

    tabSheet.setSelectedTab(basic);

    tabSheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
            if (tabSheet.getSelectedTab().equals(buffered)) {
                buffered.mongoContainer.refresh();
                buffered.table.refreshRowCache();
            } else {
                basic.mongoContainer.refresh();
                basic.table.refreshRowCache();
            }
        }
    });
}

From source file:uk.gov.nationalarchives.discovery.taxonomy.common.repository.mongo.MongoConfigurationTest.java

public @Bean MongoTemplate mongoTemplate() throws Exception {
    return new MongoTemplate(fongo().getMongo(), database);
}

From source file:com.comcast.video.dawg.service.house.AbstractDawgService.java

@PostConstruct
public void init() throws UnknownHostException {
    mongo = new Mongo(config.getDawgDbHost());
    template = new MongoTemplate(mongo, "test");
}

From source file:com.comcast.video.dawg.service.pound.DawgPoundMongoService.java

@PostConstruct
public void init() throws UnknownHostException {
    mongoTemplate = new MongoTemplate(new Mongo(config.getDawgDbHost()), "test");
}

From source file:org.icgc.dcc.metadata.server.config.RepositoryConfig.java

@Override
public @Bean MongoTemplate mongoTemplate() throws Exception {
    return new MongoTemplate(mongo(), getDatabaseName());
}

From source file:eu.trentorise.smartcampus.mobility.test.TestConfig.java

@Bean(name = "domainMongoTemplate")
public MongoTemplate getDomainMongo() throws UnknownHostException, MongoException {
    return new MongoTemplate(new Mongo(), "test-mobility");
}

From source file:com.card.loop.xyz.config.AppConfig.java

@Bean
public MongoOperations mongoOps() throws Exception {
    Mongo mongo = mongo();
    return new MongoTemplate(mongo, AppConfig.DATABASE_LOOP);
}

From source file:com.card.loop.xyz.config.AppConfig.java

@Bean
public MongoOperations user() throws Exception {
    Mongo mongo = mongo();
    return new MongoTemplate(mongo, AppConfig.DATABASE_LOOP);
}

From source file:com.telefonica.euro_iaas.sdc.pupperwrapper.services.integration.tests.CatalogManagerMongoIntegrationTest.java

@Before
public void setUp() throws Exception {
    catalogManagerMongo = new CatalogManagerMongoImpl4Test();
    template = new MongoTemplate(mongo, DB_NAME);
    catalogManagerMongo.setMongoTemplate(template);
}