Search in sources :

Example 1 with DocumentDbMappingContext

use of com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext in project cas by apereo.

the class CosmosDbObjectFactory method createDocumentDbMappingContext.

/**
 * Create document db mapping context.
 *
 * @return the document db mapping context
 */
@SneakyThrows
public DocumentDbMappingContext createDocumentDbMappingContext() {
    final DocumentDbMappingContext documentDbMappingContext = new DocumentDbMappingContext();
    documentDbMappingContext.setInitialEntitySet(new EntityScanner(applicationContext).scan(Persistent.class));
    return documentDbMappingContext;
}
Also used : DocumentDbMappingContext(com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext) Persistent(org.springframework.data.annotation.Persistent) EntityScanner(org.springframework.boot.autoconfigure.domain.EntityScanner) SneakyThrows(lombok.SneakyThrows)

Example 2 with DocumentDbMappingContext

use of com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext in project cas by apereo.

the class CosmosDbObjectFactory method createDocumentDbTemplate.

/**
 * Document db template.
 *
 * @param properties the properties
 * @return the document db template
 */
public DocumentDbTemplate createDocumentDbTemplate(final BaseCosmosDbProperties properties) {
    final DocumentDbFactory documentDbFactory = createDocumentDbFactory(properties);
    final DocumentDbMappingContext documentDbMappingContext = createDocumentDbMappingContext();
    final MappingDocumentDbConverter mappingDocumentDbConverter = createMappingDocumentDbConverter(documentDbMappingContext);
    return new DocumentDbTemplate(documentDbFactory, mappingDocumentDbConverter, properties.getDatabase());
}
Also used : MappingDocumentDbConverter(com.microsoft.azure.spring.data.documentdb.core.convert.MappingDocumentDbConverter) DocumentDbFactory(com.microsoft.azure.spring.data.documentdb.DocumentDbFactory) DocumentDbTemplate(com.microsoft.azure.spring.data.documentdb.core.DocumentDbTemplate) DocumentDbMappingContext(com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext)

Example 3 with DocumentDbMappingContext

use of com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext in project cas by apereo.

the class CosmosDbObjectFactory method createDocumentDbTemplate.

/**
 * Create document db template document db template.
 *
 * @param documentDbFactory the document db factory
 * @param properties        the properties
 * @return the document db template
 */
public DocumentDbTemplate createDocumentDbTemplate(final DocumentDbFactory documentDbFactory, final BaseCosmosDbProperties properties) {
    final DocumentDbMappingContext documentDbMappingContext = createDocumentDbMappingContext();
    final MappingDocumentDbConverter mappingDocumentDbConverter = createMappingDocumentDbConverter(documentDbMappingContext);
    return new DocumentDbTemplate(documentDbFactory, mappingDocumentDbConverter, properties.getDatabase());
}
Also used : MappingDocumentDbConverter(com.microsoft.azure.spring.data.documentdb.core.convert.MappingDocumentDbConverter) DocumentDbTemplate(com.microsoft.azure.spring.data.documentdb.core.DocumentDbTemplate) DocumentDbMappingContext(com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext)

Aggregations

DocumentDbMappingContext (com.microsoft.azure.spring.data.documentdb.core.mapping.DocumentDbMappingContext)3 DocumentDbTemplate (com.microsoft.azure.spring.data.documentdb.core.DocumentDbTemplate)2 MappingDocumentDbConverter (com.microsoft.azure.spring.data.documentdb.core.convert.MappingDocumentDbConverter)2 DocumentDbFactory (com.microsoft.azure.spring.data.documentdb.DocumentDbFactory)1 SneakyThrows (lombok.SneakyThrows)1 EntityScanner (org.springframework.boot.autoconfigure.domain.EntityScanner)1 Persistent (org.springframework.data.annotation.Persistent)1