mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-21 19:42:10 +00:00
DATAES-46 - Apply code formatting
This commit is contained in:
parent
a66dc08975
commit
097c5f68ce
@ -123,8 +123,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations, Applicati
|
|||||||
|
|
||||||
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter, ResultsMapper resultsMapper) {
|
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter, ResultsMapper resultsMapper) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
|
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
|
||||||
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
|
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
|
||||||
this.resultsMapper = (resultsMapper == null) ? new DefaultResultMapper(this.elasticsearchConverter.getMappingContext()) : resultsMapper;
|
this.resultsMapper = (resultsMapper == null) ? new DefaultResultMapper(this.elasticsearchConverter.getMappingContext()) : resultsMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -879,14 +879,14 @@ public class ElasticsearchTemplate implements ElasticsearchOperations, Applicati
|
|||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||||
if(elasticsearchConverter instanceof ApplicationContextAware){
|
if (elasticsearchConverter instanceof ApplicationContextAware) {
|
||||||
((ApplicationContextAware)elasticsearchConverter).setApplicationContext(context);
|
((ApplicationContextAware) elasticsearchConverter).setApplicationContext(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] toArray(List<String> values) {
|
private static String[] toArray(List<String> values) {
|
||||||
String[] valuesAsArray = new String[values.size()];
|
String[] valuesAsArray = new String[values.size()];
|
||||||
return values.toArray(valuesAsArray);
|
return values.toArray(valuesAsArray);
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,8 @@ public class MappingElasticsearchConverter implements ElasticsearchConverter, Ap
|
|||||||
@Override
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
this.applicationContext = applicationContext;
|
this.applicationContext = applicationContext;
|
||||||
if(mappingContext instanceof ApplicationContextAware){
|
if (mappingContext instanceof ApplicationContextAware) {
|
||||||
((ApplicationContextAware)mappingContext).setApplicationContext(applicationContext);
|
((ApplicationContextAware) mappingContext).setApplicationContext(applicationContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,19 +33,18 @@ import org.springframework.data.util.TypeInformation;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class SimpleElasticsearchMappingContext extends
|
public class SimpleElasticsearchMappingContext extends
|
||||||
AbstractMappingContext<SimpleElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> implements ApplicationContextAware{
|
AbstractMappingContext<SimpleElasticsearchPersistentEntity<?>, ElasticsearchPersistentProperty> implements ApplicationContextAware {
|
||||||
|
|
||||||
private ApplicationContext context;
|
private ApplicationContext context;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected <T> SimpleElasticsearchPersistentEntity<?> createPersistentEntity(TypeInformation<T> typeInformation) {
|
protected <T> SimpleElasticsearchPersistentEntity<?> createPersistentEntity(TypeInformation<T> typeInformation) {
|
||||||
final SimpleElasticsearchPersistentEntity<T> persistentEntity =
|
final SimpleElasticsearchPersistentEntity<T> persistentEntity =
|
||||||
new SimpleElasticsearchPersistentEntity<T>(typeInformation);
|
new SimpleElasticsearchPersistentEntity<T>(typeInformation);
|
||||||
if(context != null)
|
if (context != null) {
|
||||||
{
|
persistentEntity.setApplicationContext(context);
|
||||||
persistentEntity.setApplicationContext(context);
|
}
|
||||||
}
|
return persistentEntity;
|
||||||
return persistentEntity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,8 +53,8 @@ public class SimpleElasticsearchMappingContext extends
|
|||||||
return new SimpleElasticsearchPersistentProperty(field, descriptor, owner, simpleTypeHolder);
|
return new SimpleElasticsearchPersistentProperty(field, descriptor, owner, simpleTypeHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
public void setApplicationContext(ApplicationContext context) throws BeansException {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
|
|||||||
public SimpleElasticsearchPersistentEntity(TypeInformation<T> typeInformation) {
|
public SimpleElasticsearchPersistentEntity(TypeInformation<T> typeInformation) {
|
||||||
super(typeInformation);
|
super(typeInformation);
|
||||||
this.context = new StandardEvaluationContext();
|
this.context = new StandardEvaluationContext();
|
||||||
this.parser = new SpelExpressionParser();
|
this.parser = new SpelExpressionParser();
|
||||||
|
|
||||||
Class<T> clazz = typeInformation.getType();
|
Class<T> clazz = typeInformation.getType();
|
||||||
if (clazz.isAnnotationPresent(Document.class)) {
|
if (clazz.isAnnotationPresent(Document.class)) {
|
||||||
|
@ -46,7 +46,7 @@ public class UpdateQuery {
|
|||||||
public void setUpdateRequest(UpdateRequest updateRequest) {
|
public void setUpdateRequest(UpdateRequest updateRequest) {
|
||||||
this.updateRequest = updateRequest;
|
this.updateRequest = updateRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIndexName() {
|
public String getIndexName() {
|
||||||
return indexName;
|
return indexName;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class UpdateQueryBuilder {
|
|||||||
this.updateRequest = updateRequest;
|
this.updateRequest = updateRequest;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateQueryBuilder withIndexRequest(IndexRequest indexRequest) {
|
public UpdateQueryBuilder withIndexRequest(IndexRequest indexRequest) {
|
||||||
this.indexRequest = indexRequest;
|
this.indexRequest = indexRequest;
|
||||||
return this;
|
return this;
|
||||||
@ -76,7 +76,7 @@ public class UpdateQueryBuilder {
|
|||||||
if (this.indexRequest != null) {
|
if (this.indexRequest != null) {
|
||||||
if (this.updateRequest == null) {
|
if (this.updateRequest == null) {
|
||||||
updateRequest = new UpdateRequest();
|
updateRequest = new UpdateRequest();
|
||||||
}
|
}
|
||||||
updateRequest.doc(indexRequest);
|
updateRequest.doc(indexRequest);
|
||||||
}
|
}
|
||||||
updateQuery.setUpdateRequest(updateRequest);
|
updateQuery.setUpdateRequest(updateRequest);
|
||||||
|
@ -45,7 +45,7 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
|
|||||||
* @param repositoryType must not be {@literal null}.
|
* @param repositoryType must not be {@literal null}.
|
||||||
* @param beanManager must not be {@literal null}.
|
* @param beanManager must not be {@literal null}.
|
||||||
* @param customImplementationBean the bean for the custom implementation of the
|
* @param customImplementationBean the bean for the custom implementation of the
|
||||||
* {@link org.springframework.data.repository.Repository}, can be {@literal null}.
|
* {@link org.springframework.data.repository.Repository}, can be {@literal null}.
|
||||||
*/
|
*/
|
||||||
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
|
||||||
Class<T> repositoryType, BeanManager beanManager, Bean<?> customImplementationBean) {
|
Class<T> repositoryType, BeanManager beanManager, Bean<?> customImplementationBean) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2014 the original author or authors.
|
* Copyright 2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -31,9 +31,10 @@ import org.springframework.test.context.ContextConfiguration;
|
|||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: akonczak@gmail.com
|
* SpELEntityTest
|
||||||
* Date: 07/08/14
|
*
|
||||||
* Time: 22:35
|
* @author Artur Konczak
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2014 the original author or authors.
|
* Copyright 2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,9 +19,10 @@ import org.springframework.data.annotation.Id;
|
|||||||
import org.springframework.data.elasticsearch.annotations.Document;
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: akonczak@gmail.com
|
* SpELEntity
|
||||||
* Date: 07/08/14
|
*
|
||||||
* Time: 22:26
|
* @author Artur Konczak
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Document(indexName = "#{'abz'+'-'+'entity'}", type = "spel", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
|
@Document(indexName = "#{'abz'+'-'+'entity'}", type = "spel", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
|
||||||
public class SpELEntity {
|
public class SpELEntity {
|
||||||
|
@ -24,7 +24,7 @@ import javax.inject.Inject;
|
|||||||
class CdiRepositoryClient {
|
class CdiRepositoryClient {
|
||||||
|
|
||||||
private CdiProductRepository repository;
|
private CdiProductRepository repository;
|
||||||
private SamplePersonRepository samplePersonRepository;
|
private SamplePersonRepository samplePersonRepository;
|
||||||
|
|
||||||
|
|
||||||
public CdiProductRepository getRepository() {
|
public CdiProductRepository getRepository() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013-2014 the original author or authors.
|
* Copyright 2014 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -19,8 +19,10 @@ import org.springframework.data.elasticsearch.entities.SpELEntity;
|
|||||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Rizwan Idrees
|
* SpELRepository
|
||||||
* @author Mohsin Husen
|
*
|
||||||
|
* @author Artur Konczak
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public interface SpELRepository extends ElasticsearchRepository<SpELEntity, String> {
|
public interface SpELRepository extends ElasticsearchRepository<SpELEntity, String> {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user