org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity Java Examples

The following examples show how to use org.springframework.data.mongodb.core.mapping.BasicMongoPersistentEntity. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlowMappingContext.java    From flow-platform-x with Apache License 2.0 5 votes vote down vote up
@Override
protected <T> BasicMongoPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) {
    String collection = collectionMapping.get(typeInformation);
    if (Objects.isNull(collection)) {
        return super.createPersistentEntity(typeInformation);
    }

    BasicMongoPersistentEntity<T> entity = new FlowPersistentEntity<>(typeInformation, collection);
    if (context != null) {
        entity.setApplicationContext(context);
    }

    return entity;
}
 
Example #2
Source File: CachedEncryptionEventListener.java    From spring-data-mongodb-encrypt with Apache License 2.0 5 votes vote down vote up
Node node(Class clazz) {
    return encrypted.computeIfAbsent(clazz, c -> {
        BasicMongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(c);
        if (entity == null) return Node.EMPTY;

        List<Node> children = processDocument(entity.getType());
        if (!children.isEmpty()) return new Node("", children, Node.Type.ROOT);
        return Node.EMPTY;
    });
}