Skip to content

Commit d921372

Browse files
committed
DATAES-46 - Apply code formatting
1 parent bb62148 commit d921372

19 files changed

+147
-157
lines changed

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45

56
<groupId>org.springframework.data</groupId>

src/main/java/org/springframework/data/elasticsearch/annotations/CompletionField.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
@Inherited
2929
public @interface CompletionField {
3030

31-
String searchAnalyzer() default "simple";
31+
String searchAnalyzer() default "simple";
3232

33-
String indexAnalyzer() default "simple";
33+
String indexAnalyzer() default "simple";
3434

35-
boolean payloads() default false;
35+
boolean payloads() default false;
3636

37-
boolean preserveSeparators() default true;
37+
boolean preserveSeparators() default true;
3838

39-
boolean preservePositionIncrements() default true;
39+
boolean preservePositionIncrements() default true;
4040

41-
int maxInputLength() default 50;
41+
int maxInputLength() default 50;
4242
}

src/main/java/org/springframework/data/elasticsearch/annotations/Field.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,4 @@
5353
String[] ignoreFields() default {};
5454

5555
boolean includeInParent() default false;
56-
5756
}

src/main/java/org/springframework/data/elasticsearch/core/CriteriaQueryProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ private QueryBuilder processCriteriaEntry(OperationKey key, Object value, String
118118
}
119119
QueryBuilder query = null;
120120

121-
String searchText = StringUtils.toString(value);
121+
String searchText = StringUtils.toString(value);
122122

123-
switch (key) {
123+
switch (key) {
124124
case EQUALS:
125125
query = queryString(searchText).field(fieldName);
126126
break;

src/main/java/org/springframework/data/elasticsearch/core/MappingBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static XContentBuilder buildMapping(Class clazz, String indexType, String idFiel
7979
// Properties
8080
XContentBuilder xContentBuilder = mapping.startObject(FIELD_PROPERTIES);
8181

82-
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY, false, FieldType.Auto,null);
82+
mapEntity(xContentBuilder, clazz, true, idFieldName, EMPTY, false, FieldType.Auto, null);
8383

8484
return xContentBuilder.endObject().endObject().endObject();
8585
}
@@ -95,7 +95,7 @@ private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, bool
9595
type = fieldType.toString().toLowerCase();
9696
}
9797
XContentBuilder t = xContentBuilder.startObject(nestedObjectFieldName).field(FIELD_TYPE, type);
98-
98+
9999
if (nestedOrObjectField && FieldType.Nested == fieldType && fieldAnnotation.includeInParent()) {
100100
t.field("include_in_parent", fieldAnnotation.includeInParent());
101101
}
@@ -117,7 +117,7 @@ private static void mapEntity(XContentBuilder xContentBuilder, Class clazz, bool
117117
continue;
118118
}
119119
boolean nestedOrObject = isNestedOrObjectField(field);
120-
mapEntity(xContentBuilder, getFieldType(field), false, EMPTY, field.getName(), nestedOrObject, singleField.type(),field.getAnnotation(Field.class));
120+
mapEntity(xContentBuilder, getFieldType(field), false, EMPTY, field.getName(), nestedOrObject, singleField.type(), field.getAnnotation(Field.class));
121121
if (nestedOrObject) {
122122
continue;
123123
}

src/main/java/org/springframework/data/elasticsearch/core/ResultsExtractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
import org.elasticsearch.action.search.SearchResponse;
2020

2121
public interface ResultsExtractor<T> {
22+
2223
T extract(SearchResponse response);
2324
}

src/main/java/org/springframework/data/elasticsearch/core/completion/Completion.java

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,48 @@
1010
@JsonInclude(value = JsonInclude.Include.NON_NULL)
1111
public class Completion {
1212

13-
private String[] input;
14-
private String output;
15-
private Integer weight;
16-
private Object payload;
17-
18-
private Completion() {
19-
//required by mapper to instantiate object
20-
}
21-
22-
public Completion(String[] input) {
23-
this.input = input;
24-
}
25-
26-
public String[] getInput() {
27-
return input;
28-
}
29-
30-
public void setInput(String[] input) {
31-
this.input = input;
32-
}
33-
34-
public String getOutput() {
35-
return output;
36-
}
37-
38-
public void setOutput(String output) {
39-
this.output = output;
40-
}
41-
42-
public Object getPayload() {
43-
return payload;
44-
}
45-
46-
public void setPayload(Object payload) {
47-
this.payload = payload;
48-
}
49-
50-
public Integer getWeight() {
51-
return weight;
52-
}
53-
54-
public void setWeight(Integer weight) {
55-
this.weight = weight;
56-
}
13+
private String[] input;
14+
private String output;
15+
private Integer weight;
16+
private Object payload;
17+
18+
private Completion() {
19+
//required by mapper to instantiate object
20+
}
21+
22+
public Completion(String[] input) {
23+
this.input = input;
24+
}
25+
26+
public String[] getInput() {
27+
return input;
28+
}
29+
30+
public void setInput(String[] input) {
31+
this.input = input;
32+
}
33+
34+
public String getOutput() {
35+
return output;
36+
}
37+
38+
public void setOutput(String output) {
39+
this.output = output;
40+
}
41+
42+
public Object getPayload() {
43+
return payload;
44+
}
45+
46+
public void setPayload(Object payload) {
47+
this.payload = payload;
48+
}
49+
50+
public Integer getWeight() {
51+
return weight;
52+
}
53+
54+
public void setWeight(Integer weight) {
55+
this.weight = weight;
56+
}
5757
}

src/main/java/org/springframework/data/elasticsearch/core/query/Criteria.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public Criteria or(String fieldName) {
193193
* @return
194194
*/
195195
public Criteria is(Object o) {
196-
queryCriteria.add(new CriteriaEntry(OperationKey.EQUALS, o));
196+
queryCriteria.add(new CriteriaEntry(OperationKey.EQUALS, o));
197197
return this;
198198
}
199199

src/main/java/org/springframework/data/elasticsearch/repository/cdi/ElasticsearchRepositoryBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
4646
* @param repositoryType must not be {@literal null}.
4747
* @param beanManager must not be {@literal null}.
4848
* @param detector detector for the custom {@link org.springframework.data.repository.Repository} implementations
49-
* {@link CustomRepositoryImplementationDetector}, can be {@literal null}.
49+
* {@link CustomRepositoryImplementationDetector}, can be {@literal null}.
5050
*/
5151
public ElasticsearchRepositoryBean(Bean<ElasticsearchOperations> operations, Set<Annotation> qualifiers,
52-
Class<T> repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) {
52+
Class<T> repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) {
5353
super(qualifiers, repositoryType, beanManager, detector);
5454

5555
Assert.notNull(operations, "Cannot create repository with 'null' for ElasticsearchOperations.");

src/main/java/org/springframework/data/elasticsearch/repository/cdi/ElasticsearchRepositoryExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanMan
6767
}
6868

6969
private <T> CdiRepositoryBean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers,
70-
BeanManager beanManager) {
70+
BeanManager beanManager) {
7171

7272
Bean<ElasticsearchOperations> elasticsearchOperationsBean = this.elasticsearchOperationsMap.get(qualifiers
7373
.toString());

src/main/java/org/springframework/data/elasticsearch/repository/query/parser/ElasticsearchQueryCreator.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected CriteriaQuery complete(CriteriaQuery query, Sort sort) {
9090
}
9191

9292
private Criteria from(Part part, Criteria instance, Iterator<?> parameters) {
93-
Part.Type type = part.getType();
93+
Part.Type type = part.getType();
9494

9595
Criteria criteria = instance;
9696
if (criteria == null) {
@@ -126,24 +126,24 @@ private Criteria from(Part part, Criteria instance, Iterator<?> parameters) {
126126
return criteria.in(asArray(parameters.next()));
127127
case NOT_IN:
128128
return criteria.in(asArray(parameters.next())).not();
129-
case SIMPLE_PROPERTY:
129+
case SIMPLE_PROPERTY:
130130
case WITHIN: {
131131
Object firstParameter = parameters.next();
132132
Object secondParameter = null;
133-
if(type == Part.Type.SIMPLE_PROPERTY) {
134-
if(part.getProperty().getType() != GeoPoint.class)
135-
return criteria.is(firstParameter);
136-
else {
137-
// it means it's a simple find with exact geopoint matching (e.g. findByLocation)
138-
// and because Elasticsearch does not have any kind of query with just a geopoint
139-
// as argument we use a "geo distance" query with a distance of one meter.
140-
secondParameter = ".001km";
141-
}
142-
} else {
143-
secondParameter = parameters.next();
144-
}
145-
146-
if (firstParameter instanceof GeoPoint && secondParameter instanceof String)
133+
if (type == Part.Type.SIMPLE_PROPERTY) {
134+
if (part.getProperty().getType() != GeoPoint.class)
135+
return criteria.is(firstParameter);
136+
else {
137+
// it means it's a simple find with exact geopoint matching (e.g. findByLocation)
138+
// and because Elasticsearch does not have any kind of query with just a geopoint
139+
// as argument we use a "geo distance" query with a distance of one meter.
140+
secondParameter = ".001km";
141+
}
142+
} else {
143+
secondParameter = parameters.next();
144+
}
145+
146+
if (firstParameter instanceof GeoPoint && secondParameter instanceof String)
147147
return criteria.within((GeoPoint) firstParameter, (String) secondParameter);
148148

149149
if (firstParameter instanceof Point && secondParameter instanceof Distance)

src/test/java/org/springframework/data/elasticsearch/NestedObjectTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ public void shouldIndexMultipleLevelNestedObjectWithIncludeInParent() {
168168

169169
final Map mapping = elasticsearchTemplate.getMapping(PersonMultipleLevelNested.class);
170170

171-
assertThat(mapping,is(notNullValue()));
171+
assertThat(mapping, is(notNullValue()));
172172
final Map propertyMap = (Map) mapping.get("properties");
173-
assertThat(propertyMap,is(notNullValue()));
173+
assertThat(propertyMap, is(notNullValue()));
174174
final Map bestCarsAttributes = (Map) propertyMap.get("bestCars");
175-
assertThat(bestCarsAttributes.get("include_in_parent"),is(notNullValue()));
175+
assertThat(bestCarsAttributes.get("include_in_parent"), is(notNullValue()));
176176
}
177177

178178

@@ -189,11 +189,11 @@ public void shouldSearchUsingNestedQueryOnMultipleLevelNestedObject() {
189189
//then
190190
final BoolQueryBuilder builder = boolQuery();
191191
builder.must(nestedQuery("girlFriends", termQuery("girlFriends.type", "temp")))
192-
.must(nestedQuery("girlFriends.cars", termQuery("girlFriends.cars.name", "Ford".toLowerCase())));
192+
.must(nestedQuery("girlFriends.cars", termQuery("girlFriends.cars.name", "Ford".toLowerCase())));
193193

194194
final SearchQuery searchQuery = new NativeSearchQueryBuilder()
195-
.withQuery(builder)
196-
.build();
195+
.withQuery(builder)
196+
.build();
197197

198198
final Page<PersonMultipleLevelNested> personIndexed = elasticsearchTemplate.queryForPage(searchQuery, PersonMultipleLevelNested.class);
199199
assertThat(personIndexed, is(notNullValue()));
@@ -375,8 +375,8 @@ public void shouldIndexAndSearchMapAsNestedType() {
375375
elasticsearchTemplate.refresh(Book.class, true);
376376
//then
377377
final SearchQuery searchQuery = new NativeSearchQueryBuilder()
378-
.withQuery(nestedQuery("buckets", termQuery("buckets.1", "test3")))
379-
.build();
378+
.withQuery(nestedQuery("buckets", termQuery("buckets.1", "test3")))
379+
.build();
380380
final Page<Book> books = elasticsearchTemplate.queryForPage(searchQuery, Book.class);
381381

382382
assertThat(books.getContent().size(), is(1));

src/test/java/org/springframework/data/elasticsearch/core/completion/ElasticsearchTemplateCompletionTests.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public void shouldFindSuggestionsForGivenCriteriaQueryUsingCompletionEntity() {
154154
assertThat(options.size(), is(2));
155155
assertThat(options.get(0).getText().string(), isOneOf("Marchand", "Mohsin Husen"));
156156
assertThat(options.get(1).getText().string(), isOneOf("Marchand", "Mohsin Husen"));
157-
}
157+
}
158158

159159
@Test
160160
public void shouldFindSuggestionsForGivenCriteriaQueryUsingAnnotatedCompletionEntity() {
@@ -171,8 +171,8 @@ public void shouldFindSuggestionsForGivenCriteriaQueryUsingAnnotatedCompletionEn
171171

172172
//then
173173
assertThat(options.size(), is(2));
174-
assertThat(options.get(0).getText().string(), isOneOf("Marchand","Mohsin Husen"));
175-
assertThat(options.get(1).getText().string(), isOneOf("Marchand","Mohsin Husen"));
174+
assertThat(options.get(0).getText().string(), isOneOf("Marchand", "Mohsin Husen"));
175+
assertThat(options.get(1).getText().string(), isOneOf("Marchand", "Mohsin Husen"));
176176
}
177177

178178
@Test
@@ -193,14 +193,11 @@ public void shouldFindSuggestionsWithPayloadsForGivenCriteriaQueryUsingAnnotated
193193
for (CompletionSuggestion.Entry.Option option : options) {
194194
if (option.getText().string().equals("Mewes Kochheim1")) {
195195
assertEquals(Double.MAX_VALUE, option.getPayloadAsDouble(), 0);
196-
}
197-
else if (option.getText().string().equals("Mewes Kochheim2")) {
196+
} else if (option.getText().string().equals("Mewes Kochheim2")) {
198197
assertEquals(Long.MAX_VALUE, option.getPayloadAsLong());
199-
}
200-
else if (option.getText().string().equals("Mewes Kochheim3")) {
198+
} else if (option.getText().string().equals("Mewes Kochheim3")) {
201199
assertEquals("Payload test", option.getPayloadAsString());
202-
}
203-
else if (option.getText().string().equals("Mewes Kochheim4")) {
200+
} else if (option.getText().string().equals("Mewes Kochheim4")) {
204201
assertEquals("Payload", option.getPayloadAsMap().get("someField1"));
205202
assertEquals("test", option.getPayloadAsMap().get("someField2"));
206203
} else {
@@ -227,14 +224,11 @@ public void shouldFindSuggestionsWithWeightsForGivenCriteriaQueryUsingAnnotatedC
227224
for (CompletionSuggestion.Entry.Option option : options) {
228225
if (option.getText().string().equals("Mewes Kochheim1")) {
229226
assertEquals(4, option.getScore(), 0);
230-
}
231-
else if (option.getText().string().equals("Mewes Kochheim2")) {
227+
} else if (option.getText().string().equals("Mewes Kochheim2")) {
232228
assertEquals(0, option.getScore(), 0);
233-
}
234-
else if (option.getText().string().equals("Mewes Kochheim3")) {
229+
} else if (option.getText().string().equals("Mewes Kochheim3")) {
235230
assertEquals(1, option.getScore(), 0);
236-
}
237-
else if (option.getText().string().equals("Mewes Kochheim4")) {
231+
} else if (option.getText().string().equals("Mewes Kochheim4")) {
238232
assertEquals(Integer.MAX_VALUE, option.getScore(), 0);
239233
} else {
240234
fail("Unexpected option");

src/test/java/org/springframework/data/elasticsearch/entities/AbstractInheritedEntity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ public Date getCreatedDate() {
4848
public void setCreatedDate(Date createdDate) {
4949
this.createdDate = createdDate;
5050
}
51-
5251
}

src/test/java/org/springframework/data/elasticsearch/entities/Person.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class Person {
4040
@Field(type = FieldType.Nested)
4141
private List<Car> car;
4242

43-
@Field(type = FieldType.Nested, includeInParent=true)
43+
@Field(type = FieldType.Nested, includeInParent = true)
4444
private List<Book> books;
4545

4646
public String getId() {

src/test/java/org/springframework/data/elasticsearch/entities/PersonMultipleLevelNested.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class PersonMultipleLevelNested {
4343
@Field(type = FieldType.Nested)
4444
private List<Car> cars;
4545

46-
@Field(type = FieldType.Nested, includeInParent=true)
46+
@Field(type = FieldType.Nested, includeInParent = true)
4747
private List<Car> bestCars;
4848

4949
public String getId() {
@@ -85,5 +85,4 @@ public List<Car> getBestCars() {
8585
public void setBestCars(List<Car> bestCars) {
8686
this.bestCars = bestCars;
8787
}
88-
8988
}

src/test/java/org/springframework/data/elasticsearch/entities/SampleInheritedEntity.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,4 @@ public String getMessage() {
3737
public void setMessage(String message) {
3838
this.message = message;
3939
}
40-
41-
4240
}

0 commit comments

Comments
 (0)