org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource Java Examples

The following examples show how to use org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource. 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: SolrRepositoryConfigExtension.java    From dubbox with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {

	AnnotationAttributes attributes = config.getAttributes();
	if (!attributes.getBoolean("multicoreSupport")) {
		builder.addPropertyReference(BeanDefinition.SOLR_OPERATIONS.getBeanName(),
				attributes.getString("solrTemplateRef"));
	} else {
		builder.addPropertyReference(BeanDefinition.SOLR_CLIENT.getBeanName(),
				attributes.getString("solrClientRef"));
	}
	builder.addPropertyValue("schemaCreationSupport", attributes.getBoolean("schemaCreationSupport"));
	builder.addPropertyReference(BeanDefinition.SOLR_MAPPTING_CONTEXT.getBeanName(), "solrMappingContext");
}
 
Example #2
Source File: DatastoreRepositoryConfigurationExtension.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder,
		AnnotationRepositoryConfigurationSource config) {
	AnnotationAttributes attributes = config.getAttributes();

	builder.addPropertyReference("datastoreTemplate",
			attributes.getString("datastoreTemplateRef"));
	builder.addPropertyReference("datastoreMappingContext",
			attributes.getString("datastoreMappingContextRef"));

}
 
Example #3
Source File: SpannerRepositoryConfigurationExtension.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder,
		AnnotationRepositoryConfigurationSource config) {
	AnnotationAttributes attributes = config.getAttributes();

	builder.addPropertyReference("spannerTemplate",
			attributes.getString("spannerTemplateRef"));
	builder.addPropertyReference("spannerMappingContext",
			attributes.getString("spannerMappingContextRef"));

}
 
Example #4
Source File: FirestoreRepositoryConfigurationExtension.java    From spring-cloud-gcp with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder,
		AnnotationRepositoryConfigurationSource config) {
	AnnotationAttributes attributes = config.getAttributes();

	builder.addPropertyReference("firestoreTemplate",
			attributes.getString("firestoreTemplateRef"));
	builder.addPropertyReference("firestoreMappingContext",
			attributes.getString("firestoreMappingContextRef"));
}
 
Example #5
Source File: MybatisRepositoryConfigExtension.java    From spring-data-mybatis with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder,
		AnnotationRepositoryConfigurationSource config) {

	AnnotationAttributes attributes = config.getAttributes();
	builder.addPropertyValue(ENABLE_DEFAULT_TRANSACTIONS_ATTRIBUTE,
			attributes.getBoolean(ENABLE_DEFAULT_TRANSACTIONS_ATTRIBUTE));

}
 
Example #6
Source File: KeyValueRepositoryConfigurationExtension.java    From spring-data-keyvalue with Apache License 2.0 5 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {

	AnnotationAttributes attributes = config.getAttributes();

	builder.addPropertyReference("keyValueOperations", attributes.getString(KEY_VALUE_TEMPLATE_BEAN_REF_ATTRIBUTE));
	builder.addPropertyValue("queryCreator", getQueryCreatorType(config));
	builder.addPropertyValue("queryType", getQueryType(config));
	builder.addPropertyReference("mappingContext", getMappingContextBeanRef());
}
 
Example #7
Source File: KeyValueRepositoryConfigurationExtension.java    From spring-data-keyvalue with Apache License 2.0 5 votes vote down vote up
/**
 * Detects the query creator type to be used for the factory to set. Will lookup a {@link QueryCreatorType} annotation
 * on the {@code @Enable}-annotation or use {@link SpelQueryCreator} if not found.
 *
 * @param config must not be {@literal null}.
 * @return
 */
private static Class<?> getQueryCreatorType(AnnotationRepositoryConfigurationSource config) {

	AnnotationMetadata metadata = config.getEnableAnnotationMetadata();

	Map<String, Object> queryCreatorAnnotationAttributes = metadata
			.getAnnotationAttributes(QueryCreatorType.class.getName());

	if (CollectionUtils.isEmpty(queryCreatorAnnotationAttributes)) {
		return SpelQueryCreator.class;
	}

	AnnotationAttributes queryCreatorAttributes = new AnnotationAttributes(queryCreatorAnnotationAttributes);
	return queryCreatorAttributes.getClass("value");
}
 
Example #8
Source File: KeyValueRepositoryConfigurationExtension.java    From spring-data-keyvalue with Apache License 2.0 5 votes vote down vote up
/**
 * Detects the query creator type to be used for the factory to set. Will lookup a {@link QueryCreatorType} annotation
 * on the {@code @Enable}-annotation or use {@link SpelQueryCreator} if not found.
 *
 * @param config
 * @return
 */
private static Class<?> getQueryType(AnnotationRepositoryConfigurationSource config) {

	AnnotationMetadata metadata = config.getEnableAnnotationMetadata();

	Map<String, Object> queryCreatorAnnotationAttributes = metadata
			.getAnnotationAttributes(QueryCreatorType.class.getName());

	if (queryCreatorAnnotationAttributes == null) {
		return KeyValuePartTreeQuery.class;
	}

	AnnotationAttributes queryCreatorAttributes = new AnnotationAttributes(queryCreatorAnnotationAttributes);
	return queryCreatorAttributes.getClass("repositoryQueryType");
}
 
Example #9
Source File: CrateRepositoryConfigExtension.java    From spring-data-crate with Apache License 2.0 4 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {

	AnnotationAttributes attributes = config.getAttributes();
	builder.addPropertyReference("crateOperations", attributes.getString("crateTemplateRef"));
}
 
Example #10
Source File: DynamoDBRepositoryConfigExtension.java    From spring-data-dynamodb with Apache License 2.0 3 votes vote down vote up
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {
	AnnotationAttributes attributes = config.getAttributes();

	postProcess(builder, attributes.getString("amazonDynamoDBRef"), attributes.getString("dynamoDBMapperConfigRef"),attributes.getString("dynamoDBOperationsRef"));

}
 
Example #11
Source File: SimpleDbRepositoryConfigExtension.java    From spring-data-simpledb with MIT License 2 votes vote down vote up
/**
 * We bind here the provided SimpleDB template bean specified by "simpleDbTemplateRef" annotation property <br/>
 * to our internally used bean simpleDbOperations of class
 * {@link org.springframework.data.simpledb.repository.support.SimpleDbRepositoryFactoryBean}. <br/>
 * The bean will be used to construct repository implementations. <br/>
 */
@Override
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {
	AnnotationAttributes attributes = config.getAttributes();
       builder.addPropertyReference("simpleDbOperations", attributes.getString("simpleDbTemplateRef"));
}