DATAES-46 - Apply code formatting

This commit is contained in:
Mohsin Husen 2014-08-17 09:47:36 +01:00
parent a66dc08975
commit 097c5f68ce
12 changed files with 1795 additions and 395 deletions

View File

@ -123,8 +123,8 @@ public class ElasticsearchTemplate implements ElasticsearchOperations, Applicati
public ElasticsearchTemplate(Client client, ElasticsearchConverter elasticsearchConverter, ResultsMapper resultsMapper) {
this.client = client;
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
this.elasticsearchConverter = (elasticsearchConverter == null) ? new MappingElasticsearchConverter(
new SimpleElasticsearchMappingContext()) : elasticsearchConverter;
this.resultsMapper = (resultsMapper == null) ? new DefaultResultMapper(this.elasticsearchConverter.getMappingContext()) : resultsMapper;
}
@ -879,14 +879,14 @@ public class ElasticsearchTemplate implements ElasticsearchOperations, Applicati
return ids;
}
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
if(elasticsearchConverter instanceof ApplicationContextAware){
((ApplicationContextAware)elasticsearchConverter).setApplicationContext(context);
}
}
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
if (elasticsearchConverter instanceof ApplicationContextAware) {
((ApplicationContextAware) elasticsearchConverter).setApplicationContext(context);
}
}
private static String[] toArray(List<String> values) {
private static String[] toArray(List<String> values) {
String[] valuesAsArray = new String[values.size()];
return values.toArray(valuesAsArray);
}

View File

@ -61,8 +61,8 @@ public class MappingElasticsearchConverter implements ElasticsearchConverter, Ap
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
if(mappingContext instanceof ApplicationContextAware){
((ApplicationContextAware)mappingContext).setApplicationContext(applicationContext);
}
if (mappingContext instanceof ApplicationContextAware) {
((ApplicationContextAware) mappingContext).setApplicationContext(applicationContext);
}
}
}

View File

@ -33,19 +33,18 @@ import org.springframework.data.util.TypeInformation;
*/
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) {
final SimpleElasticsearchPersistentEntity<T> persistentEntity =
new SimpleElasticsearchPersistentEntity<T>(typeInformation);
if(context != null)
{
persistentEntity.setApplicationContext(context);
}
return persistentEntity;
final SimpleElasticsearchPersistentEntity<T> persistentEntity =
new SimpleElasticsearchPersistentEntity<T>(typeInformation);
if (context != null) {
persistentEntity.setApplicationContext(context);
}
return persistentEntity;
}
@Override
@ -54,8 +53,8 @@ public class SimpleElasticsearchMappingContext extends
return new SimpleElasticsearchPersistentProperty(field, descriptor, owner, simpleTypeHolder);
}
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
this.context = context;
}
@Override
public void setApplicationContext(ApplicationContext context) throws BeansException {
this.context = context;
}
}

View File

@ -61,7 +61,7 @@ public class SimpleElasticsearchPersistentEntity<T> extends BasicPersistentEntit
public SimpleElasticsearchPersistentEntity(TypeInformation<T> typeInformation) {
super(typeInformation);
this.context = new StandardEvaluationContext();
this.parser = new SpelExpressionParser();
this.parser = new SpelExpressionParser();
Class<T> clazz = typeInformation.getType();
if (clazz.isAnnotationPresent(Document.class)) {

View File

@ -46,7 +46,7 @@ public class UpdateQuery {
public void setUpdateRequest(UpdateRequest updateRequest) {
this.updateRequest = updateRequest;
}
public String getIndexName() {
return indexName;
}

View File

@ -41,7 +41,7 @@ public class UpdateQueryBuilder {
this.updateRequest = updateRequest;
return this;
}
public UpdateQueryBuilder withIndexRequest(IndexRequest indexRequest) {
this.indexRequest = indexRequest;
return this;
@ -76,7 +76,7 @@ public class UpdateQueryBuilder {
if (this.indexRequest != null) {
if (this.updateRequest == null) {
updateRequest = new UpdateRequest();
}
}
updateRequest.doc(indexRequest);
}
updateQuery.setUpdateRequest(updateRequest);

View File

@ -45,7 +45,7 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
* @param repositoryType must not be {@literal null}.
* @param beanManager must not be {@literal null}.
* @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,
Class<T> repositoryType, BeanManager beanManager, Bean<?> customImplementationBean) {

File diff suppressed because it is too large Load Diff

View File

@ -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");
* 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;
/**
* User: akonczak@gmail.com
* Date: 07/08/14
* Time: 22:35
* SpELEntityTest
*
* @author Artur Konczak
*
*/
@RunWith(SpringJUnit4ClassRunner.class)

View File

@ -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");
* 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;
/**
* User: akonczak@gmail.com
* Date: 07/08/14
* Time: 22:26
* SpELEntity
*
* @author Artur Konczak
*
*/
@Document(indexName = "#{'abz'+'-'+'entity'}", type = "spel", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
public class SpELEntity {

View File

@ -24,7 +24,7 @@ import javax.inject.Inject;
class CdiRepositoryClient {
private CdiProductRepository repository;
private SamplePersonRepository samplePersonRepository;
private SamplePersonRepository samplePersonRepository;
public CdiProductRepository getRepository() {

View File

@ -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");
* 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;
/**
* @author Rizwan Idrees
* @author Mohsin Husen
* SpELRepository
*
* @author Artur Konczak
*
*/
public interface SpELRepository extends ElasticsearchRepository<SpELEntity, String> {