DATAES-2 - all code reformatted to follow Spring Data code rules

This commit is contained in:
Artur Konczak 2014-02-11 00:44:03 +00:00
parent f768c1698e
commit e9a260235d
183 changed files with 8023 additions and 8875 deletions

View File

@ -133,7 +133,7 @@ Searching entities using Elasticsearch Template
Indexing a single document with Repository Indexing a single document with Repository
```java ```java
@Resource @Autowired
private SampleElasticsearchRepository repository; private SampleElasticsearchRepository repository;
String documentId = "123456"; String documentId = "123456";
@ -147,7 +147,7 @@ Indexing a single document with Repository
Indexing multiple Document(bulk index) using Repository Indexing multiple Document(bulk index) using Repository
```java ```java
@Resource @Autowired
private SampleElasticsearchRepository repository; private SampleElasticsearchRepository repository;
String documentId = "123456"; String documentId = "123456";
@ -371,6 +371,11 @@ Here are some ways for you to get involved in the community:
Before we accept a non-trivial patch or pull request we will need you to sign the [contributor's agreement](https://support.springsource.com/spring_committer_signup). Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests. Before we accept a non-trivial patch or pull request we will need you to sign the [contributor's agreement](https://support.springsource.com/spring_committer_signup). Signing the contributor's agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.
Code formatting for [Eclipse and Intellij](https://github.com/spring-projects/spring-data-build/tree/master/etc/ide)
[More information about contributing to Spring Data](https://github.com/spring-projects/spring-data-build/blob/master/CONTRIBUTING.md)
### Contact Details ### Contact Details
* Rizwan Idrees (rizwan.idrees@biomedcentral.com) * Rizwan Idrees (rizwan.idrees@biomedcentral.com)

View File

@ -1,820 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Spring Data"
version="12">
<setting
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.disabling_tag"
value="@formatter:off" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field"
value="0" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line"
value="false" />
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression"
value="80" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation"
value="2" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package"
value="0" />
<setting id="org.eclipse.jdt.core.compiler.source" value="1.7" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.align_type_members_on_columns"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration"
value="0" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.indentation.size"
value="2" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.enabling_tag"
value="@formatter:on" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration"
value="16" />
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment"
value="0" />
<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier"
value="error" />
<setting id="org.eclipse.jdt.core.formatter.tabulation.char"
value="tab" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body"
value="true" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration"
value="0" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments"
value="do not insert" />
<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier"
value="error" />
<setting
id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch"
value="false" />
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration"
value="end_of_line" />
<setting id="org.eclipse.jdt.core.formatter.compact_else_if"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant"
value="end_of_line" />
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.tabulation.size"
value="2" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter"
value="insert" />
<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.7" />
<setting
id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer"
value="2" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while"
value="do not insert" />
<setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"
value="enabled" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line"
value="true" />
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments"
value="true" />
<setting id="org.eclipse.jdt.core.formatter.comment.line_length"
value="120" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body"
value="0" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration"
value="16" />
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert"
value="insert" />
<setting id="org.eclipse.jdt.core.formatter.comment.format_html"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration"
value="16" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
value="insert" />
<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform"
value="1.7" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try"
value="80" />
<setting
id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation"
value="0" />
<setting id="org.eclipse.jdt.core.formatter.comment.format_header"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.comment.format_block_comments"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant"
value="do not insert" />
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants"
value="0" />
<setting
id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration"
value="end_of_line" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries"
value="true" />
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports"
value="1" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header"
value="true" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for"
value="insert" />
<setting
id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments"
value="do not insert" />
<setting
id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column"
value="false" />
<setting
id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line"
value="false" />
</profile>
</profiles>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<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"> <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">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>

View File

@ -21,7 +21,8 @@
<para> <para>
Version Control - Version Control -
<ulink <ulink
url="git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git">git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git url="git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git">
git://github.com/BioMedCentralLtd/spring-data-elasticsearch.git
</ulink> </ulink>
</para> </para>
</listitem> </listitem>

View File

@ -99,14 +99,16 @@ http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch-1.
</title> </title>
<programlisting language="java"> <programlisting language="java">
@Configuration @Configuration
@EnableElasticsearchRepositories(basePackages = "org/springframework/data/elasticsearch/repositories") @EnableElasticsearchRepositories(basePackages =
"org/springframework/data/elasticsearch/repositories")
static class Config { static class Config {
@Bean @Bean
public ElasticsearchOperations elasticsearchTemplate() { public ElasticsearchOperations elasticsearchTemplate() {
return new ElasticsearchTemplate(nodeBuilder().local(true).node().client()); return new ElasticsearchTemplate(nodeBuilder().local(true).node().client());
} }
}</programlisting> }
</programlisting>
<para> <para>
The configuration above sets up an The configuration above sets up an
<classname>Embedded Elasticsearch Server</classname> <classname>Embedded Elasticsearch Server</classname>
@ -154,7 +156,8 @@ public Page&lt;Product&gt; findAvailableBookByName(String name, Pageable pageabl
public void setRepository(ProductRepository repository) { public void setRepository(ProductRepository repository) {
this.repository = repository; this.repository = repository;
} }
}</programlisting> }
</programlisting>
</example> </example>
</section> </section>
</section> </section>
@ -197,9 +200,11 @@ public void setRepository(ProductRepository repository) {
translates into: translates into:
<example> <example>
<title>Query creation from method names</title> <title>Query creation from method names</title>
<programlisting language="java">public interface BookRepository extends Repository&lt;Book, String&gt; { <programlisting language="java">public interface BookRepository extends Repository&lt;Book, String&gt;
{
List&lt;Book&gt; findByNameAndPrice(String name, Integer price); List&lt;Book&gt; findByNameAndPrice(String name, Integer price);
}</programlisting> }
</programlisting>
<para> <para>
The method name above will be translated into the following The method name above will be translated into the following
Elasticsearch json query Elasticsearch json query
@ -210,7 +215,8 @@ public void setRepository(ProductRepository repository) {
[ [
{ "field" : {"name" : "?"} }, { "field" : {"name" : "?"} },
{ "field" : {"price" : "?"} } { "field" : {"price" : "?"} }
] } }</programlisting> ] } }
</programlisting>
</example> </example>
</para> </para>
<para> <para>
@ -238,7 +244,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must" : [ {"field" : {"name" : "?"}}, <code>{"bool" : {"must" : [ {"field" : {"name" : "?"}},
{"field" : {"price" : "?"}} ]}}</code> {"field" : {"price" : "?"}} ]}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -250,7 +257,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"should" : [ {"field" : {"name" : "?"}}, <code>{"bool" : {"should" : [ {"field" : {"name" : "?"}},
{"field" : {"price" : "?"}} ]}}</code> {"field" : {"price" : "?"}} ]}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -299,7 +307,8 @@ public void setRepository(ProductRepository repository) {
<entry> <entry>
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : <code>{"bool" : {"must" : {"range" : {"price" : {"from" :
null,"to" : ?,"include_lower" : true,"include_upper" : null,"to" : ?,"include_lower" : true,"include_upper" :
true}}}}}</code> true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -312,7 +321,8 @@ public void setRepository(ProductRepository repository) {
<entry> <entry>
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : <code>{"bool" : {"must" : {"range" : {"price" : {"from" :
?,"to" : null,"include_lower" : true,"include_upper" : ?,"to" : null,"include_lower" : true,"include_upper" :
true}}}}}</code> true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -325,7 +335,8 @@ public void setRepository(ProductRepository repository) {
<entry> <entry>
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : <code>{"bool" : {"must" : {"range" : {"price" : {"from" :
null,"to" : ?,"include_lower" : true,"include_upper" : null,"to" : ?,"include_lower" : true,"include_upper" :
true}}}}}</code> true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -338,7 +349,8 @@ public void setRepository(ProductRepository repository) {
<entry> <entry>
<code>{"bool" : {"must" : {"range" : {"price" : {"from" : <code>{"bool" : {"must" : {"range" : {"price" : {"from" :
?,"to" : null,"include_lower" : true,"include_upper" : ?,"to" : null,"include_lower" : true,"include_upper" :
true}}}}}</code> true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -350,7 +362,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : <code>{"bool" : {"must" : {"field" : {"name" : {"query" :
"?*","analyze_wildcard" : true}}}}}</code> "?*","analyze_wildcard" : true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -362,7 +375,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : <code>{"bool" : {"must" : {"field" : {"name" : {"query" :
"?*","analyze_wildcard" : true}}}}}</code> "?*","analyze_wildcard" : true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -374,7 +388,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : <code>{"bool" : {"must" : {"field" : {"name" : {"query" :
"*?","analyze_wildcard" : true}}}}}</code> "*?","analyze_wildcard" : true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -386,7 +401,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must" : {"field" : {"name" : {"query" : <code>{"bool" : {"must" : {"field" : {"name" : {"query" :
"*?*","analyze_wildcard" : true}}}}}</code> "*?*","analyze_wildcard" : true}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -398,7 +414,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must" : {"bool" : {"should" : [ {"field" : <code>{"bool" : {"must" : {"bool" : {"should" : [ {"field" :
{"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}</code> {"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -410,7 +427,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"bool" : {"must_not" : {"bool" : {"should" : {"field" : <code>{"bool" : {"must_not" : {"bool" : {"should" : {"field" :
{"name" : "?"}}}}}}</code> {"name" : "?"}}}}}}
</code>
</entry> </entry>
</row> </row>
<row> <row>
@ -457,7 +475,8 @@ public void setRepository(ProductRepository repository) {
</entry> </entry>
<entry> <entry>
<code>{"sort" : [{ "name" : {"order" : "desc"} }],"bool" : <code>{"sort" : [{ "name" : {"order" : "desc"} }],"bool" :
{"must" : {"field" : {"available" : true}}}}</code> {"must" : {"field" : {"available" : true}}}}
</code>
</entry> </entry>
</row> </row>
</tbody> </tbody>
@ -474,10 +493,12 @@ public void setRepository(ProductRepository repository) {
annotation. annotation.
</title> </title>
<programlisting language="java">public interface BookRepository extends ElasticsearchRepository&lt;Book, String&gt; { <programlisting language="java">public interface BookRepository extends ElasticsearchRepository&lt;Book,
String&gt; {
@Query("{"bool" : {"must" : {"field" : {"name" : "?0"}}}}") @Query("{"bool" : {"must" : {"field" : {"name" : "?0"}}}}")
Page&lt;Book&gt; findByName(String name,Pageable pageable); Page&lt;Book&gt; findByName(String name,Pageable pageable);
}</programlisting> }
</programlisting>
</example> </example>
</section> </section>

View File

@ -28,7 +28,8 @@ SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withQuery(matchAllQuery()) .withQuery(matchAllQuery())
.withFilter(boolFilter().must(termFilter("id", documentId))) .withFilter(boolFilter().must(termFilter("id", documentId)))
.build(); .build();
Page&lt;SampleEntity&gt; sampleEntities = elasticsearchTemplate.queryForPage(searchQuery,SampleEntity.class); Page&lt;SampleEntity&gt; sampleEntities =
elasticsearchTemplate.queryForPage(searchQuery,SampleEntity.class);
</programlisting> </programlisting>
</example> </example>
</section> </section>
@ -55,7 +56,8 @@ String scrollId = elasticsearchTemplate.scan(searchQuery,1000,false);
List&lt;SampleEntity&gt; sampleEntities = new ArrayList&lt;SampleEntity&gt;(); List&lt;SampleEntity&gt; sampleEntities = new ArrayList&lt;SampleEntity&gt;();
boolean hasRecords = true; boolean hasRecords = true;
while (hasRecords){ while (hasRecords){
Page&lt;SampleEntity&gt; page = elasticsearchTemplate.scroll(scrollId, 5000L , new ResultsMapper&lt;SampleEntity&gt;() { Page&lt;SampleEntity&gt; page = elasticsearchTemplate.scroll(scrollId, 5000L , new ResultsMapper&lt;SampleEntity&gt;()
{
@Override @Override
public Page&lt;SampleEntity&gt; mapResults(SearchResponse response) { public Page&lt;SampleEntity&gt; mapResults(SearchResponse response) {
List&lt;SampleEntity&gt; chunk = new ArrayList&lt;SampleEntity&gt;(); List&lt;SampleEntity&gt; chunk = new ArrayList&lt;SampleEntity&gt;();
@ -79,7 +81,8 @@ for(SearchHit searchHit : response.getHits()){
hasRecords = false; hasRecords = false;
} }
} }
}</programlisting> }
</programlisting>
</example> </example>
</section> </section>
</chapter> </chapter>

View File

@ -100,7 +100,8 @@
boolean exists(ID primaryKey); boolean exists(ID primaryKey);
// … more functionality omitted. // … more functionality omitted.
}</programlisting> }
</programlisting>
<calloutlist> <calloutlist>
<callout arearefs="repository.save"> <callout arearefs="repository.save">
@ -151,12 +152,14 @@
<example> <example>
<title>PagingAndSortingRepository</title> <title>PagingAndSortingRepository</title>
<programlisting language="java">public interface PagingAndSortingRepository&lt;T, ID extends Serializable&gt; extends CrudRepository&lt;T, ID&gt; { <programlisting language="java">public interface PagingAndSortingRepository&lt;T, ID extends Serializable&gt;
extends CrudRepository&lt;T, ID&gt; {
Iterable&lt;T&gt; findAll(Sort sort); Iterable&lt;T&gt; findAll(Sort sort);
Page&lt;T&gt; findAll(Pageable pageable); Page&lt;T&gt; findAll(Pageable pageable);
}</programlisting> }
</programlisting>
</example> </example>
<para> <para>
@ -166,8 +169,10 @@
size of 20 you could simply do something like this: size of 20 you could simply do something like this:
</para> </para>
<programlisting language="java">PagingAndSortingRepository&lt;User, Long&gt; repository = // … get access to a bean <programlisting language="java">PagingAndSortingRepository&lt;User, Long&gt; repository = // … get access to a
Page&lt;User&gt; users = repository.findAll(new PageRequest(1, 20));</programlisting> bean
Page&lt;User&gt; users = repository.findAll(new PageRequest(1, 20));
</programlisting>
</section> </section>
<section id="repositories.query-methods"> <section id="repositories.query-methods">
@ -188,7 +193,9 @@
and type it to the domain class it shall handle. and type it to the domain class it shall handle.
</para> </para>
<programlisting language="java">public interface PersonRepository extends Repository&lt;User, Long&gt; { … }</programlisting> <programlisting language="java">public interface PersonRepository extends Repository&lt;User, Long&gt; {
… }
</programlisting>
</listitem> </listitem>
<listitem> <listitem>
@ -240,7 +247,8 @@
public void doSomething() { public void doSomething() {
List&lt;Person&gt; persons = repository.findByLastname("Matthews"); List&lt;Person&gt; persons = repository.findByLastname("Matthews");
}</programlisting> }
</programlisting>
</listitem> </listitem>
</orderedlist> </orderedlist>
@ -295,7 +303,8 @@
<example> <example>
<title>Selectively exposing CRUD methods</title> <title>Selectively exposing CRUD methods</title>
<programlisting language="java">interface MyBaseRepository&lt;T, ID extends Serializable&gt; extends Repository&lt;T, ID&gt; { <programlisting language="java">interface MyBaseRepository&lt;T, ID extends Serializable&gt; extends
Repository&lt;T, ID&gt; {
T findOne(ID id); T findOne(ID id);
T save(T entity); T save(T entity);
} }
@ -303,7 +312,8 @@
interface UserRepository extends MyBaseRepository&lt;User, Long&gt; { interface UserRepository extends MyBaseRepository&lt;User, Long&gt; {
User findByEmailAddress(EmailAddress emailAddress); User findByEmailAddress(EmailAddress emailAddress);
}</programlisting> }
</programlisting>
</example> </example>
<para> <para>
@ -434,10 +444,13 @@
<title>Query creation from method names</title> <title>Query creation from method names</title>
<para> <para>
<programlisting language="java">public interface PersonRepository extends Repository&lt;User, Long&gt; { <programlisting language="java">public interface PersonRepository extends Repository&lt;User,
Long&gt; {
List&lt;Person&gt; findByEmailAddressAndLastname(EmailAddress emailAddress, String lastname); List&lt;Person&gt; findByEmailAddressAndLastname(EmailAddress emailAddress, String
}</programlisting> lastname);
}
</programlisting>
</para> </para>
</example> </example>
@ -482,7 +495,8 @@
of of
</para> </para>
<programlisting language="java">List&lt;Person&gt; findByAddressZipCode(ZipCode zipCode);</programlisting> <programlisting language="java">List&lt;Person&gt; findByAddressZipCode(ZipCode zipCode);
</programlisting>
<para> <para>
will create the property traversal will create the property traversal
@ -551,7 +565,8 @@
List&lt;User&gt; findByLastname(String lastname, Sort sort); List&lt;User&gt; findByLastname(String lastname, Sort sort);
List&lt;User&gt; findByLastname(String lastname, Pageable pageable);</programlisting> List&lt;User&gt; findByLastname(String lastname, Pageable pageable);
</programlisting>
</example> </example>
<para> <para>
@ -665,7 +680,8 @@
details see details see
<ulink <ulink
url="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-scanning-filters" url="http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-scanning-filters"
vendor="">Spring reference documentation</ulink> vendor="">Spring reference documentation
</ulink>
on these on these
elements. elements.
</para> </para>
@ -727,7 +743,8 @@
public EntityManagerFactory entityManagerFactory() { public EntityManagerFactory entityManagerFactory() {
// … // …
} }
}</programlisting> }
</programlisting>
</example> </example>
<para> <para>
@ -759,7 +776,8 @@
<title>Standalone usage of repository factory</title> <title>Standalone usage of repository factory</title>
<programlisting language="java">RepositoryFactorySupport factory = … // Instantiate factory here <programlisting language="java">RepositoryFactorySupport factory = … // Instantiate factory here
UserRepository repository = factory.getRepository(UserRepository.class);</programlisting> UserRepository repository = factory.getRepository(UserRepository.class);
</programlisting>
</example> </example>
</section> </section>
</section> </section>
@ -789,7 +807,8 @@
<programlisting language="java">interface UserRepositoryCustom { <programlisting language="java">interface UserRepositoryCustom {
public void someCustomMethod(User user); public void someCustomMethod(User user);
}</programlisting> }
</programlisting>
</example> </example>
<example> <example>
@ -801,7 +820,8 @@
public void someCustomMethod(User user) { public void someCustomMethod(User user) {
// Your custom implementation // Your custom implementation
} }
}</programlisting> }
</programlisting>
Note that the implementation itself does not depend on Note that the implementation itself does not depend on
Spring Data and can be a regular Spring bean. So you can use standard Spring Data and can be a regular Spring bean. So you can use standard
dependency injection behaviour to inject references to other beans, dependency injection behaviour to inject references to other beans,
@ -813,10 +833,12 @@
<title>Changes to the your basic repository interface</title> <title>Changes to the your basic repository interface</title>
<para> <para>
<programlisting language="java">public interface UserRepository extends CrudRepository&lt;User, Long&gt;, UserRepositoryCustom { <programlisting language="java">public interface UserRepository extends CrudRepository&lt;User, Long&gt;,
UserRepositoryCustom {
// Declare query methods here // Declare query methods here
}</programlisting> }
</programlisting>
Let your standard repository interface extend the custom Let your standard repository interface extend the custom
one. This makes CRUD and custom functionality available to one. This makes CRUD and custom functionality available to
clients. clients.
@ -844,7 +866,8 @@
<para> <para>
<programlisting language="xml">&lt;repositories base-package="com.acme.repository" /&gt; <programlisting language="xml">&lt;repositories base-package="com.acme.repository" /&gt;
&lt;repositories base-package="com.acme.repository" repository-impl-postfix="FooBar" /&gt;</programlisting> &lt;repositories base-package="com.acme.repository" repository-impl-postfix="FooBar"
/&gt;</programlisting>
</para> </para>
</example> </example>
@ -904,7 +927,8 @@
extends JpaRepository&lt;T, ID&gt; { extends JpaRepository&lt;T, ID&gt; {
void sharedCustomMethod(ID id); void sharedCustomMethod(ID id);
}</programlisting> }
</programlisting>
</para> </para>
</example> </example>
@ -969,7 +993,8 @@
public void sharedCustomMethod(ID id) { public void sharedCustomMethod(ID id) {
// implementation goes here // implementation goes here
} }
}</programlisting> }
</programlisting>
</example> </example>
<para> <para>
@ -994,7 +1019,8 @@
<title>Custom repository factory bean</title> <title>Custom repository factory bean</title>
<programlisting language="java"> <programlisting language="java">
public class MyRepositoryFactoryBean&lt;R extends JpaRepository&lt;T, I&gt;, T, I extends Serializable&gt; public class MyRepositoryFactoryBean&lt;R extends JpaRepository&lt;T, I&gt;, T, I extends
Serializable&gt;
extends JpaRepositoryFactoryBean&lt;R, T, I&gt; { extends JpaRepositoryFactoryBean&lt;R, T, I&gt; {
protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) { protected RepositoryFactorySupport createRepositoryFactory(EntityManager entityManager) {
@ -1002,7 +1028,8 @@
return new MyRepositoryFactory(entityManager); return new MyRepositoryFactory(entityManager);
} }
private static class MyRepositoryFactory&lt;T, I extends Serializable&gt; extends JpaRepositoryFactory { private static class MyRepositoryFactory&lt;T, I extends Serializable&gt; extends
JpaRepositoryFactory {
private EntityManager entityManager; private EntityManager entityManager;
@ -1024,7 +1051,8 @@
return MyRepository.class; return MyRepository.class;
} }
} }
}</programlisting> }
</programlisting>
</example> </example>
<para> <para>
@ -1085,7 +1113,8 @@
// Populate model // Populate model
return "user"; return "user";
} }
}</programlisting> }
</programlisting>
<para> <para>
First you pretty much have to declare a repository dependency for First you pretty much have to declare a repository dependency for
@ -1119,7 +1148,8 @@
domain class domain class
</para> </para>
<programlisting language="xml">&lt;bean class="….web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt; <programlisting language="xml">&lt;bean
class="….web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
&lt;property name="webBindingInitializer"&gt; &lt;property name="webBindingInitializer"&gt;
&lt;bean class="….web.bind.support.ConfigurableWebBindingInitializer"&gt; &lt;bean class="….web.bind.support.ConfigurableWebBindingInitializer"&gt;
&lt;property name="propertyEditorRegistrars"&gt; &lt;property name="propertyEditorRegistrars"&gt;
@ -1145,7 +1175,8 @@
// Populate model // Populate model
return "userForm"; return "userForm";
} }
}</programlisting> }
</programlisting>
</simplesect> </simplesect>
<simplesect> <simplesect>
@ -1202,7 +1233,8 @@
model.addAttribute("users", userService.getUsers(pageable)); model.addAttribute("users", userService.getUsers(pageable));
return "users"; return "users";
} }
}</programlisting> }
</programlisting>
<para> <para>
As you can see the naive approach requires the method to contain As you can see the naive approach requires the method to contain
@ -1241,7 +1273,8 @@
model.addAttribute("users", userDao.readAll(pageable)); model.addAttribute("users", userDao.readAll(pageable));
return "users"; return "users";
} }
}</programlisting> }
</programlisting>
<para> <para>
The The
@ -1386,7 +1419,8 @@
"lastname" : "Matthews" }, "lastname" : "Matthews" },
{ "_class" : "com.acme.Person", { "_class" : "com.acme.Person",
"firstname" : "Carter", "firstname" : "Carter",
"lastname" : "Beauford" } ]</programlisting> "lastname" : "Beauford" } ]
</programlisting>
</example> </example>
<para> <para>
@ -1452,7 +1486,8 @@
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm.xsd"&gt; http://www.springframework.org/schema/oxm/spring-oxm.xsd"&gt;
&lt;repository:unmarshaller-populator location="classpath:data.json" unmarshaller-ref="unmarshaller" /&gt; &lt;repository:unmarshaller-populator location="classpath:data.json" unmarshaller-ref="unmarshaller"
/&gt;
&lt;oxm:jaxb2-marshaller contextPath="com.acme" /&gt; &lt;oxm:jaxb2-marshaller contextPath="com.acme" /&gt;

View File

@ -17,7 +17,6 @@ package org.springframework.data.elasticsearch.annotations;
/** /**
* @author Jakub Vavrik * @author Jakub Vavrik
*
* Values based on reference doc - http://www.elasticsearch.org/guide/reference/mapping/date-format/ * Values based on reference doc - http://www.elasticsearch.org/guide/reference/mapping/date-format/
*/ */
public enum DateFormat { public enum DateFormat {

View File

@ -15,10 +15,10 @@
*/ */
package org.springframework.data.elasticsearch.annotations; package org.springframework.data.elasticsearch.annotations;
import org.springframework.data.annotation.Persistent;
import java.lang.annotation.*; import java.lang.annotation.*;
import org.springframework.data.annotation.Persistent;
/** /**
* Document * Document
* *

View File

@ -44,5 +44,4 @@ public @interface Field {
String indexAnalyzer() default ""; String indexAnalyzer() default "";
String[] ignoreFields() default {}; String[] ignoreFields() default {};
} }

View File

@ -30,5 +30,6 @@ import org.springframework.data.annotation.Persistent;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
public @interface Parent { public @interface Parent {
String type(); String type();
} }

View File

@ -42,5 +42,4 @@ public @interface Query {
* @return * @return
*/ */
String name() default ""; String name() default "";
} }

View File

@ -15,6 +15,8 @@
*/ */
package org.springframework.data.elasticsearch.client; package org.springframework.data.elasticsearch.client;
import static org.elasticsearch.node.NodeBuilder.*;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.ImmutableSettings;
@ -24,8 +26,6 @@ import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import static org.elasticsearch.node.NodeBuilder.nodeBuilder;
/** /**
* NodeClientFactoryBean * NodeClientFactoryBean
* *

View File

@ -15,6 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.client; package org.springframework.data.elasticsearch.client;
import static org.apache.commons.lang.StringUtils.*;
import static org.elasticsearch.common.settings.ImmutableSettings.*;
import java.util.Properties;
import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.transport.InetSocketTransportAddress;
@ -25,11 +30,6 @@ import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.Properties;
import static org.apache.commons.lang.StringUtils.*;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
/** /**
* TransportClientFactoryBean * TransportClientFactoryBean
* *

View File

@ -22,8 +22,6 @@ import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.data.elasticsearch.client.TransportClientFactoryBean; import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import static org.apache.commons.lang.StringUtils.split;
/** /**
* TransportClientBeanDefinitionParser * TransportClientBeanDefinitionParser
* *

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import org.springframework.data.elasticsearch.ElasticsearchException; import static org.apache.commons.lang.StringUtils.*;
import java.io.IOException; import java.io.IOException;
import static org.apache.commons.lang.StringUtils.isBlank; import org.springframework.data.elasticsearch.ElasticsearchException;
/** /**
* @author Artur Konczak * @author Artur Konczak

View File

@ -15,19 +15,21 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import org.elasticsearch.index.query.*; import static org.elasticsearch.index.query.FilterBuilders.*;
import org.springframework.data.elasticsearch.core.geo.GeoBox; import static org.springframework.data.elasticsearch.core.query.Criteria.*;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.data.elasticsearch.core.query.Criteria;
import org.springframework.util.Assert;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import static org.elasticsearch.index.query.FilterBuilders.*; import org.elasticsearch.index.query.FilterBuilder;
import static org.springframework.data.elasticsearch.core.query.Criteria.OperationKey; import org.elasticsearch.index.query.GeoBoundingBoxFilterBuilder;
import org.elasticsearch.index.query.GeoDistanceFilterBuilder;
import org.springframework.data.elasticsearch.core.geo.GeoBox;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.data.elasticsearch.core.query.Criteria;
import org.springframework.util.Assert;
/** /**
* CriteriaFilterProcessor * CriteriaFilterProcessor
@ -119,7 +121,6 @@ class CriteriaFilterProcessor {
} else { } else {
((GeoDistanceFilterBuilder) filter).geohash(loc).distance(dist); ((GeoDistanceFilterBuilder) filter).geohash(loc).distance(dist);
} }
} }
break; break;
@ -145,7 +146,6 @@ class CriteriaFilterProcessor {
} }
break; break;
} }
} }
return filter; return filter;

View File

@ -15,19 +15,19 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import org.elasticsearch.index.query.BoolQueryBuilder; import static org.elasticsearch.index.query.QueryBuilders.*;
import org.elasticsearch.index.query.BoostableQueryBuilder; import static org.springframework.data.elasticsearch.core.query.Criteria.*;
import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.data.elasticsearch.core.query.Criteria;
import org.springframework.util.Assert;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import static org.elasticsearch.index.query.QueryBuilders.*; import org.elasticsearch.index.query.BoolQueryBuilder;
import static org.springframework.data.elasticsearch.core.query.Criteria.OperationKey; import org.elasticsearch.index.query.BoostableQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.data.elasticsearch.core.query.Criteria;
import org.springframework.util.Assert;
/** /**
* CriteriaQueryProcessor * CriteriaQueryProcessor
@ -47,7 +47,6 @@ class CriteriaQueryProcessor {
List<QueryBuilder> mustNotQueryBuilderList = new LinkedList<QueryBuilder>(); List<QueryBuilder> mustNotQueryBuilderList = new LinkedList<QueryBuilder>();
List<QueryBuilder> mustQueryBuilderList = new LinkedList<QueryBuilder>(); List<QueryBuilder> mustQueryBuilderList = new LinkedList<QueryBuilder>();
ListIterator<Criteria> chainIterator = criteria.getCriteriaChain().listIterator(); ListIterator<Criteria> chainIterator = criteria.getCriteriaChain().listIterator();
while (chainIterator.hasNext()) { while (chainIterator.hasNext()) {
Criteria chainedCriteria = chainIterator.next(); Criteria chainedCriteria = chainIterator.next();
@ -168,7 +167,5 @@ class CriteriaQueryProcessor {
if (query instanceof BoostableQueryBuilder) { if (query instanceof BoostableQueryBuilder) {
((BoostableQueryBuilder) query).boost(boost); ((BoostableQueryBuilder) query).boost(boost);
} }
} }
} }

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import java.io.IOException;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
/** /**
* DocumentMapper using jackson * DocumentMapper using jackson
* *

View File

@ -16,6 +16,14 @@
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.base.Strings; import org.elasticsearch.common.base.Strings;
@ -34,14 +42,6 @@ import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersiste
import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.mapping.context.MappingContext;
import java.lang.reflect.Method;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/** /**
* @author Artur Konczak * @author Artur Konczak
*/ */

View File

@ -15,14 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import java.util.List;
import java.util.Set;
import org.elasticsearch.action.update.UpdateResponse; import org.elasticsearch.action.update.UpdateResponse;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter; import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.data.elasticsearch.core.query.*; import org.springframework.data.elasticsearch.core.query.*;
import java.util.List;
import java.util.Set;
/** /**
* ElasticsearchOperations * ElasticsearchOperations
* *

View File

@ -15,6 +15,18 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
import static org.apache.commons.lang.StringUtils.*;
import static org.elasticsearch.action.search.SearchType.*;
import static org.elasticsearch.client.Requests.*;
import static org.elasticsearch.common.collect.Sets.*;
import static org.elasticsearch.index.VersionType.*;
import static org.springframework.data.elasticsearch.core.MappingBuilder.*;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
@ -59,21 +71,6 @@ import org.springframework.data.elasticsearch.core.query.*;
import org.springframework.data.mapping.PersistentProperty; import org.springframework.data.mapping.PersistentProperty;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
import static org.apache.commons.lang.StringUtils.isBlank;
import static org.apache.commons.lang.StringUtils.isNotBlank;
import static org.elasticsearch.action.search.SearchType.DFS_QUERY_THEN_FETCH;
import static org.elasticsearch.action.search.SearchType.SCAN;
import static org.elasticsearch.client.Requests.indicesExistsRequest;
import static org.elasticsearch.client.Requests.refreshRequest;
import static org.elasticsearch.common.collect.Sets.newHashSet;
import static org.elasticsearch.index.VersionType.EXTERNAL;
import static org.springframework.data.elasticsearch.core.MappingBuilder.buildMapping;
/** /**
* ElasticsearchTemplate * ElasticsearchTemplate
* *
@ -639,7 +636,6 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
if (id != null) { if (id != null) {
return String.valueOf(id); return String.valueOf(id);
} }
} catch (Throwable t) { } catch (Throwable t) {
t.printStackTrace(); t.printStackTrace();
} }
@ -684,7 +680,6 @@ public class ElasticsearchTemplate implements ElasticsearchOperations {
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);
} }
protected ResultsMapper getResultsMapper() { protected ResultsMapper getResultsMapper() {

View File

@ -15,13 +15,12 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import java.util.List;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.elasticsearch.core.facet.FacetResult; import org.springframework.data.elasticsearch.core.facet.FacetResult;
import java.util.List;
/** /**
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
* @author Artur Konczak * @author Artur Konczak
@ -34,5 +33,4 @@ public interface FacetedPage<T> extends Page<T> {
List<FacetResult> getFacets(); List<FacetResult> getFacets();
FacetResult getFacet(String name); FacetResult getFacet(String name);
} }

View File

@ -15,15 +15,15 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.core.facet.FacetResult; import org.springframework.data.elasticsearch.core.facet.FacetResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* Container for query result and facet results * Container for query result and facet results
* *

View File

@ -24,5 +24,4 @@ import org.elasticsearch.action.get.GetResponse;
public interface GetResultMapper { public interface GetResultMapper {
<T> T mapResult(GetResponse response, Class<T> clazz); <T> T mapResult(GetResponse response, Class<T> clazz);
} }

View File

@ -15,6 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import static org.apache.commons.lang.StringUtils.*;
import static org.elasticsearch.common.xcontent.XContentFactory.*;
import static org.springframework.util.StringUtils.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.springframework.core.GenericCollectionTypeResolver; import org.springframework.core.GenericCollectionTypeResolver;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
@ -25,15 +33,6 @@ import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation; import org.springframework.data.util.TypeInformation;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;
import static org.apache.commons.lang.StringUtils.EMPTY;
import static org.apache.commons.lang.StringUtils.isNotBlank;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.springframework.util.StringUtils.hasText;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
@ -124,7 +123,6 @@ class MappingBuilder {
if (!isRootObject && isAnyPropertyAnnotatedAsField(fields)) { if (!isRootObject && isAnyPropertyAnnotatedAsField(fields)) {
xContentBuilder.endObject().endObject(); xContentBuilder.endObject().endObject();
} }
} }
private static boolean isAnnotated(java.lang.reflect.Field field) { private static boolean isAnnotated(java.lang.reflect.Field field) {
@ -306,5 +304,4 @@ class MappingBuilder {
private static boolean isGeoField(java.lang.reflect.Field field) { private static boolean isGeoField(java.lang.reflect.Field field) {
return field.getType() == GeoPoint.class || field.getAnnotation(GeoPointField.class) != null; return field.getType() == GeoPoint.class || field.getAnnotation(GeoPointField.class) != null;
} }
} }

View File

@ -26,5 +26,4 @@ package org.springframework.data.elasticsearch.core;
public interface ResultsMapper extends SearchResultMapper, GetResultMapper { public interface ResultsMapper extends SearchResultMapper, GetResultMapper {
EntityMapper getEntityMapper(); EntityMapper getEntityMapper();
} }

View File

@ -24,5 +24,4 @@ import org.springframework.data.domain.Pageable;
public interface SearchResultMapper { public interface SearchResultMapper {
<T> FacetedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable); <T> FacetedPage<T> mapResults(SearchResponse response, Class<T> clazz, Pageable pageable);
} }

View File

@ -15,6 +15,8 @@
*/ */
package org.springframework.data.elasticsearch.core.convert; package org.springframework.data.elasticsearch.core.convert;
import java.util.Date;
import org.joda.time.DateTimeZone; import org.joda.time.DateTimeZone;
import org.joda.time.LocalDateTime; import org.joda.time.LocalDateTime;
import org.joda.time.ReadableInstant; import org.joda.time.ReadableInstant;
@ -22,8 +24,6 @@ import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat; import org.joda.time.format.ISODateTimeFormat;
import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.Converter;
import java.util.Date;
/** /**
* DateTimeConverters * DateTimeConverters
* *
@ -74,5 +74,4 @@ public final class DateTimeConverters {
} }
} }
} }

View File

@ -42,5 +42,4 @@ public interface ElasticsearchConverter {
* @return never {@literal null}. * @return never {@literal null}.
*/ */
ConversionService getConversionService(); ConversionService getConversionService();
} }

View File

@ -62,5 +62,4 @@ public class MappingElasticsearchConverter implements ElasticsearchConverter, Ap
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }
} }

View File

@ -23,12 +23,12 @@ import org.springframework.util.Assert;
* @author Artur Konczak * @author Artur Konczak
* @author Jonathan Yan * @author Jonathan Yan
*/ */
public class AbstactFacetResult implements FacetResult { public class AbstractFacetResult implements FacetResult {
private final String name; private final String name;
private final FacetType type; private final FacetType type;
protected AbstactFacetResult(String name, FacetType type) { protected AbstractFacetResult(String name, FacetType type) {
Assert.hasText(name, "Facet name can't be null and should have a value"); Assert.hasText(name, "Facet name can't be null and should have a value");
this.name = name; this.name = name;
this.type = type; this.type = type;

View File

@ -15,6 +15,9 @@
*/ */
package org.springframework.data.elasticsearch.core.facet; package org.springframework.data.elasticsearch.core.facet;
import java.util.ArrayList;
import java.util.List;
import org.elasticsearch.search.facet.Facet; import org.elasticsearch.search.facet.Facet;
import org.elasticsearch.search.facet.histogram.HistogramFacet; import org.elasticsearch.search.facet.histogram.HistogramFacet;
import org.elasticsearch.search.facet.range.RangeFacet; import org.elasticsearch.search.facet.range.RangeFacet;
@ -22,9 +25,6 @@ import org.elasticsearch.search.facet.statistical.StatisticalFacet;
import org.elasticsearch.search.facet.terms.TermsFacet; import org.elasticsearch.search.facet.terms.TermsFacet;
import org.springframework.data.elasticsearch.core.facet.result.*; import org.springframework.data.elasticsearch.core.facet.result.*;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author Artur Konczak * @author Artur Konczak
* @author Petar Tahchiev * @author Petar Tahchiev
@ -78,5 +78,4 @@ public class DefaultFacetMapper {
} }
return new HistogramResult(facet.getName(), entries); return new HistogramResult(facet.getName(), entries);
} }
} }

View File

@ -28,5 +28,4 @@ public interface FacetRequest {
FacetBuilder getFacet(); FacetBuilder getFacet();
boolean applyQueryFilter(); boolean applyQueryFilter();
} }

View File

@ -22,12 +22,10 @@ package org.springframework.data.elasticsearch.core.facet;
* @author Mohsin Husen * @author Mohsin Husen
* @author Artur Konczak * @author Artur Konczak
* @author Jonathan Yan * @author Jonathan Yan
*
*/ */
public interface FacetResult { public interface FacetResult {
String getName(); String getName();
FacetType getType(); FacetType getType();
} }

View File

@ -15,6 +15,8 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.request; package org.springframework.data.elasticsearch.core.facet.request;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.elasticsearch.search.facet.FacetBuilder; import org.elasticsearch.search.facet.FacetBuilder;
import org.elasticsearch.search.facet.FacetBuilders; import org.elasticsearch.search.facet.FacetBuilders;
@ -22,8 +24,6 @@ import org.elasticsearch.search.facet.histogram.HistogramFacetBuilder;
import org.springframework.data.elasticsearch.core.facet.AbstractFacetRequest; import org.springframework.data.elasticsearch.core.facet.AbstractFacetRequest;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.concurrent.TimeUnit;
/** /**
* @author Artur Konczak * @author Artur Konczak
* @author Mohsin Husen * @author Mohsin Husen

View File

@ -15,10 +15,10 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.request; package org.springframework.data.elasticsearch.core.facet.request;
import org.springframework.data.elasticsearch.core.facet.FacetRequest;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.springframework.data.elasticsearch.core.facet.FacetRequest;
/** /**
* @author Artur Konczak * @author Artur Konczak
*/ */

View File

@ -15,6 +15,9 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.request; package org.springframework.data.elasticsearch.core.facet.request;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.elasticsearch.search.facet.FacetBuilder; import org.elasticsearch.search.facet.FacetBuilder;
import org.elasticsearch.search.facet.FacetBuilders; import org.elasticsearch.search.facet.FacetBuilders;
@ -22,9 +25,6 @@ import org.elasticsearch.search.facet.range.RangeFacetBuilder;
import org.springframework.data.elasticsearch.core.facet.AbstractFacetRequest; import org.springframework.data.elasticsearch.core.facet.AbstractFacetRequest;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List;
/** /**
* Range facet for numeric fields * Range facet for numeric fields
* *

View File

@ -15,15 +15,15 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.result; package org.springframework.data.elasticsearch.core.facet.result;
import org.springframework.data.elasticsearch.core.facet.AbstactFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType;
import java.util.List; import java.util.List;
import org.springframework.data.elasticsearch.core.facet.AbstractFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType;
/** /**
* @author Artur Konczak * @author Artur Konczak
*/ */
public class HistogramResult extends AbstactFacetResult { public class HistogramResult extends AbstractFacetResult {
private List<IntervalUnit> terms; private List<IntervalUnit> terms;
@ -35,5 +35,4 @@ public class HistogramResult extends AbstactFacetResult {
public List<IntervalUnit> getIntervalUnit() { public List<IntervalUnit> getIntervalUnit() {
return terms; return terms;
} }
} }

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.result; package org.springframework.data.elasticsearch.core.facet.result;
import org.springframework.data.elasticsearch.core.facet.AbstactFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType;
import java.util.List; import java.util.List;
import org.springframework.data.elasticsearch.core.facet.AbstractFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType;
/** /**
* Basic term facet result * Basic term facet result
* *
@ -28,7 +28,7 @@ import java.util.List;
* @author Artur Konczak * @author Artur Konczak
* @author Jonathan Yan * @author Jonathan Yan
*/ */
public class RangeResult extends AbstactFacetResult { public class RangeResult extends AbstractFacetResult {
private List<Range> ranges; private List<Range> ranges;
@ -40,5 +40,4 @@ public class RangeResult extends AbstactFacetResult {
public List<Range> getRanges() { public List<Range> getRanges() {
return ranges; return ranges;
} }
} }

View File

@ -15,13 +15,13 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.result; package org.springframework.data.elasticsearch.core.facet.result;
import org.springframework.data.elasticsearch.core.facet.AbstactFacetResult; import org.springframework.data.elasticsearch.core.facet.AbstractFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType; import org.springframework.data.elasticsearch.core.facet.FacetType;
/** /**
* @author Petar Tahchiev * @author Petar Tahchiev
*/ */
public class StatisticalResult extends AbstactFacetResult { public class StatisticalResult extends AbstractFacetResult {
private long count; private long count;

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.core.facet.result; package org.springframework.data.elasticsearch.core.facet.result;
import org.springframework.data.elasticsearch.core.facet.AbstactFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType;
import java.util.List; import java.util.List;
import org.springframework.data.elasticsearch.core.facet.AbstractFacetResult;
import org.springframework.data.elasticsearch.core.facet.FacetType;
/** /**
* Basic term facet result * Basic term facet result
* *
@ -28,7 +28,7 @@ import java.util.List;
* @author Artur Konczak * @author Artur Konczak
* @author Jonathan Yan * @author Jonathan Yan
*/ */
public class TermResult extends AbstactFacetResult { public class TermResult extends AbstractFacetResult {
private List<Term> terms; private List<Term> terms;
@ -40,5 +40,4 @@ public class TermResult extends AbstactFacetResult {
public List<Term> getTerms() { public List<Term> getTerms() {
return terms; return terms;
} }
} }

View File

@ -37,5 +37,4 @@ public class GeoBox {
public GeoPoint getBottomRight() { public GeoPoint getBottomRight() {
return bottomRight; return bottomRight;
} }
} }

View File

@ -41,5 +41,4 @@ public class GeoPoint {
public double getLon() { public double getLon() {
return lon; return lon;
} }
} }

View File

@ -37,5 +37,4 @@ public interface ElasticsearchPersistentProperty extends PersistentProperty<Elas
return source.getFieldName(); return source.getFieldName();
} }
} }
} }

View File

@ -15,13 +15,13 @@
*/ */
package org.springframework.data.elasticsearch.core.mapping; package org.springframework.data.elasticsearch.core.mapping;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import org.springframework.data.mapping.context.AbstractMappingContext; import org.springframework.data.mapping.context.AbstractMappingContext;
import org.springframework.data.mapping.model.SimpleTypeHolder; import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.springframework.data.util.TypeInformation; import org.springframework.data.util.TypeInformation;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
/** /**
* SimpleElasticsearchMappingContext * SimpleElasticsearchMappingContext
* *
@ -42,5 +42,4 @@ public class SimpleElasticsearchMappingContext extends
SimpleElasticsearchPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) { SimpleElasticsearchPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) {
return new SimpleElasticsearchPersistentProperty(field, descriptor, owner, simpleTypeHolder); return new SimpleElasticsearchPersistentProperty(field, descriptor, owner, simpleTypeHolder);
} }
} }

View File

@ -15,6 +15,10 @@
*/ */
package org.springframework.data.elasticsearch.core.mapping; package org.springframework.data.elasticsearch.core.mapping;
import static org.springframework.util.StringUtils.*;
import java.util.Locale;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
@ -27,15 +31,10 @@ import org.springframework.data.util.TypeInformation;
import org.springframework.expression.spel.support.StandardEvaluationContext; import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.Locale;
import static org.springframework.util.StringUtils.hasText;
/** /**
* Elasticsearch specific {@link org.springframework.data.mapping.PersistentEntity} implementation holding * Elasticsearch specific {@link org.springframework.data.mapping.PersistentEntity} implementation holding
* *
* @param <T> * @param <T>
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
*/ */

View File

@ -15,16 +15,16 @@
*/ */
package org.springframework.data.elasticsearch.core.mapping; package org.springframework.data.elasticsearch.core.mapping;
import org.springframework.data.mapping.Association;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;
import org.springframework.data.mapping.model.SimpleTypeHolder;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.springframework.data.mapping.Association;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;
import org.springframework.data.mapping.model.SimpleTypeHolder;
/** /**
* Elasticsearch specific {@link org.springframework.data.mapping.PersistentProperty} implementation processing * Elasticsearch specific {@link org.springframework.data.mapping.PersistentProperty} implementation processing
* *
@ -62,5 +62,4 @@ public class SimpleElasticsearchPersistentProperty extends
protected Association<ElasticsearchPersistentProperty> createAssociation() { protected Association<ElasticsearchPersistentProperty> createAssociation() {
return null; return null;
} }
} }

View File

@ -15,14 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import org.springframework.data.domain.Pageable; import static org.apache.commons.collections.CollectionUtils.*;
import org.springframework.data.domain.Sort;
import org.springframework.util.Assert;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.apache.commons.collections.CollectionUtils.addAll; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.util.Assert;
/** /**
* AbstractQuery * AbstractQuery

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import java.util.Map;
import org.elasticsearch.index.query.FilterBuilder; import org.elasticsearch.index.query.FilterBuilder;
import java.util.Map;
/** /**
*
* @author Mohsin Husen * @author Mohsin Husen
*/ */
public class AliasBuilder { public class AliasBuilder {

View File

@ -14,8 +14,11 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import org.elasticsearch.index.query.FilterBuilder;
import java.util.Map; import java.util.Map;
import org.elasticsearch.index.query.FilterBuilder;
/** /**
* AliasQuery is useful for creating new alias or deleting existing ones * AliasQuery is useful for creating new alias or deleting existing ones
* *

View File

@ -15,13 +15,7 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.dao.InvalidDataAccessApiUsageException;
@ -508,7 +502,6 @@ public class Criteria {
public String getConjunctionOperator() { public String getConjunctionOperator() {
return OR_OPERATOR; return OR_OPERATOR;
} }
} }
public enum OperationKey { public enum OperationKey {
@ -532,7 +525,5 @@ public class Criteria {
public Object getValue() { public Object getValue() {
return value; return value;
} }
} }
} }

View File

@ -77,5 +77,4 @@ public class CriteriaQuery extends AbstractQuery {
public Criteria getCriteria() { public Criteria getCriteria() {
return this.criteria; return this.criteria;
} }
} }

View File

@ -29,5 +29,4 @@ public interface Field {
* @return * @return
*/ */
String getName(); String getName();
} }

View File

@ -15,13 +15,13 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import org.springframework.data.domain.Pageable; import static org.apache.commons.collections.CollectionUtils.*;
import static org.springframework.data.elasticsearch.core.query.AbstractQuery.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.apache.commons.collections.CollectionUtils.addAll; import org.springframework.data.domain.Pageable;
import static org.springframework.data.elasticsearch.core.query.AbstractQuery.DEFAULT_PAGE;
/** /**
* MoreLikeThisQuery * MoreLikeThisQuery

View File

@ -15,15 +15,15 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import java.util.ArrayList;
import java.util.List;
import org.elasticsearch.index.query.FilterBuilder; import org.elasticsearch.index.query.FilterBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.highlight.HighlightBuilder; import org.elasticsearch.search.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.SortBuilder; import org.elasticsearch.search.sort.SortBuilder;
import org.springframework.data.elasticsearch.core.facet.FacetRequest; import org.springframework.data.elasticsearch.core.facet.FacetRequest;
import java.util.ArrayList;
import java.util.List;
/** /**
* NativeSearchQuery * NativeSearchQuery
* *

View File

@ -15,6 +15,9 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.elasticsearch.index.query.FilterBuilder; import org.elasticsearch.index.query.FilterBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
@ -23,9 +26,6 @@ import org.elasticsearch.search.sort.SortBuilder;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.core.facet.FacetRequest; import org.springframework.data.elasticsearch.core.facet.FacetRequest;
import java.util.ArrayList;
import java.util.List;
/** /**
* NativeSearchQuery * NativeSearchQuery
* *

View File

@ -15,12 +15,12 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import java.util.List;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import java.util.List;
/** /**
* Query * Query
* *
@ -111,6 +111,7 @@ public interface Query {
/** /**
* Get minimum score * Get minimum score
*
* @return * @return
*/ */
float getMinScore(); float getMinScore();

View File

@ -15,14 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.core.query; package org.springframework.data.elasticsearch.core.query;
import java.util.List;
import org.elasticsearch.index.query.FilterBuilder; import org.elasticsearch.index.query.FilterBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.search.highlight.HighlightBuilder; import org.elasticsearch.search.highlight.HighlightBuilder;
import org.elasticsearch.search.sort.SortBuilder; import org.elasticsearch.search.sort.SortBuilder;
import org.springframework.data.elasticsearch.core.facet.FacetRequest; import org.springframework.data.elasticsearch.core.facet.FacetRequest;
import java.util.List;
/** /**
* NativeSearchQuery * NativeSearchQuery
* *
@ -31,6 +31,7 @@ import java.util.List;
* @author Artur Konczak * @author Artur Konczak
*/ */
public interface SearchQuery extends Query { public interface SearchQuery extends Query {
QueryBuilder getQuery(); QueryBuilder getQuery();
FilterBuilder getFilter(); FilterBuilder getFilter();

View File

@ -38,5 +38,4 @@ public class SimpleField implements Field {
public String toString() { public String toString() {
return this.name; return this.name;
} }
} }

View File

@ -46,5 +46,4 @@ public class StringQuery extends AbstractQuery {
public String getSource() { public String getSource() {
return source; return source;
} }
} }

View File

@ -23,7 +23,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
/** /**
* @param <T> * @param <T>
* @param <ID> * @param <ID>
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
* @author Oliver Gierke * @author Oliver Gierke

View File

@ -15,6 +15,8 @@
*/ */
package org.springframework.data.elasticsearch.repository; package org.springframework.data.elasticsearch.repository;
import java.io.Serializable;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@ -22,12 +24,9 @@ import org.springframework.data.elasticsearch.core.FacetedPage;
import org.springframework.data.elasticsearch.core.query.SearchQuery; import org.springframework.data.elasticsearch.core.query.SearchQuery;
import org.springframework.data.repository.NoRepositoryBean; import org.springframework.data.repository.NoRepositoryBean;
import java.io.Serializable;
/** /**
* @param <T> * @param <T>
* @param <ID> * @param <ID>
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
*/ */

View File

@ -15,17 +15,17 @@
*/ */
package org.springframework.data.elasticsearch.repository.cdi; package org.springframework.data.elasticsearch.repository.cdi;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory;
import org.springframework.data.repository.cdi.CdiRepositoryBean;
import org.springframework.util.Assert;
import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.BeanManager;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
import java.util.Set; import java.util.Set;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactory;
import org.springframework.data.repository.cdi.CdiRepositoryBean;
import org.springframework.util.Assert;
/** /**
* Uses CdiRepositoryBean to create ElasticsearchRepository instances. * Uses CdiRepositoryBean to create ElasticsearchRepository instances.
* *
@ -55,5 +55,4 @@ public class ElasticsearchRepositoryBean<T> extends CdiRepositoryBean<T> {
public Class<? extends Annotation> getScope() { public Class<? extends Annotation> getScope() {
return elasticsearchOperationsBean.getScope(); return elasticsearchOperationsBean.getScope();
} }
} }

View File

@ -15,10 +15,6 @@
*/ */
package org.springframework.data.elasticsearch.repository.cdi; package org.springframework.data.elasticsearch.repository.cdi;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.repository.cdi.CdiRepositoryBean;
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
import javax.enterprise.event.Observes; import javax.enterprise.event.Observes;
import javax.enterprise.inject.UnsatisfiedResolutionException; import javax.enterprise.inject.UnsatisfiedResolutionException;
import javax.enterprise.inject.spi.AfterBeanDiscovery; import javax.enterprise.inject.spi.AfterBeanDiscovery;
@ -32,6 +28,10 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.repository.cdi.CdiRepositoryBean;
import org.springframework.data.repository.cdi.CdiRepositoryExtensionSupport;
/** /**
* ElasticsearchRepositoryExtension * ElasticsearchRepositoryExtension
* *

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch.repository.config; package org.springframework.data.elasticsearch.repository.config;
import java.lang.annotation.Annotation;
import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport; import org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport;
import org.springframework.data.repository.config.RepositoryConfigurationExtension; import org.springframework.data.repository.config.RepositoryConfigurationExtension;
import java.lang.annotation.Annotation;
/** /**
* {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} implementation to trigger configuration * {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} implementation to trigger configuration
* of the {@link EnableElasticsearchRepositories} annotation. * of the {@link EnableElasticsearchRepositories} annotation.

View File

@ -15,14 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.repository.config; package org.springframework.data.elasticsearch.repository.config;
import java.lang.annotation.*;
import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean; import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean;
import org.springframework.data.repository.query.QueryLookupStrategy.Key; import org.springframework.data.repository.query.QueryLookupStrategy.Key;
import java.lang.annotation.*;
/** /**
* Annotation to enable Elasticsearch repositories. Will scan the package of the annotated configuration class for * Annotation to enable Elasticsearch repositories. Will scan the package of the annotated configuration class for
* Spring Data repositories by default. * Spring Data repositories by default.

View File

@ -41,5 +41,4 @@ public abstract class AbstractElasticsearchRepositoryQuery implements Repository
public QueryMethod getQueryMethod() { public QueryMethod getQueryMethod() {
return queryMethod; return queryMethod;
} }
} }

View File

@ -15,6 +15,8 @@
*/ */
package org.springframework.data.elasticsearch.repository.query; package org.springframework.data.elasticsearch.repository.query;
import java.lang.reflect.Method;
import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.data.elasticsearch.annotations.Query; import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformation; import org.springframework.data.elasticsearch.repository.support.ElasticsearchEntityInformation;
@ -23,8 +25,6 @@ import org.springframework.data.repository.core.RepositoryMetadata;
import org.springframework.data.repository.query.QueryMethod; import org.springframework.data.repository.query.QueryMethod;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.lang.reflect.Method;
/** /**
* ElasticsearchQueryMethod * ElasticsearchQueryMethod
* *
@ -56,5 +56,4 @@ public class ElasticsearchQueryMethod extends QueryMethod {
private Query getQueryAnnotation() { private Query getQueryAnnotation() {
return this.method.getAnnotation(Query.class); return this.method.getAnnotation(Query.class);
} }
} }

View File

@ -15,6 +15,9 @@
*/ */
package org.springframework.data.elasticsearch.repository.query; package org.springframework.data.elasticsearch.repository.query;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.core.convert.support.GenericConversionService; import org.springframework.core.convert.support.GenericConversionService;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations; import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.convert.DateTimeConverters; import org.springframework.data.elasticsearch.core.convert.DateTimeConverters;
@ -22,9 +25,6 @@ import org.springframework.data.elasticsearch.core.query.StringQuery;
import org.springframework.data.repository.query.ParametersParameterAccessor; import org.springframework.data.repository.query.ParametersParameterAccessor;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* ElasticsearchStringQuery * ElasticsearchStringQuery
* *
@ -48,7 +48,6 @@ public class ElasticsearchStringQuery extends AbstractElasticsearchRepositoryQue
if (!conversionService.canConvert(org.joda.time.LocalDateTime.class, String.class)) { if (!conversionService.canConvert(org.joda.time.LocalDateTime.class, String.class)) {
conversionService.addConverter(DateTimeConverters.JodaLocalDateTimeConverter.INSTANCE); conversionService.addConverter(DateTimeConverters.JodaLocalDateTimeConverter.INSTANCE);
} }
} }
public ElasticsearchStringQuery(ElasticsearchQueryMethod queryMethod, public ElasticsearchStringQuery(ElasticsearchQueryMethod queryMethod,

View File

@ -15,6 +15,9 @@
*/ */
package org.springframework.data.elasticsearch.repository.query.parser; package org.springframework.data.elasticsearch.repository.query.parser;
import java.util.Collection;
import java.util.Iterator;
import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty; import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
@ -27,9 +30,6 @@ import org.springframework.data.repository.query.parser.AbstractQueryCreator;
import org.springframework.data.repository.query.parser.Part; import org.springframework.data.repository.query.parser.Part;
import org.springframework.data.repository.query.parser.PartTree; import org.springframework.data.repository.query.parser.PartTree;
import java.util.Collection;
import java.util.Iterator;
/** /**
* ElasticsearchQueryCreator * ElasticsearchQueryCreator
* *
@ -133,5 +133,4 @@ public class ElasticsearchQueryCreator extends AbstractQueryCreator<CriteriaQuer
} }
return new Object[]{o}; return new Object[]{o};
} }
} }

View File

@ -15,14 +15,7 @@
*/ */
package org.springframework.data.elasticsearch.repository.support; package org.springframework.data.elasticsearch.repository.support;
import org.elasticsearch.index.query.QueryBuilder; import static org.elasticsearch.index.query.QueryBuilders.*;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.domain.*;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.FacetedPage;
import org.springframework.data.elasticsearch.core.query.*;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.util.Assert;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
@ -32,14 +25,19 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static org.elasticsearch.index.query.QueryBuilders.inQuery; import org.elasticsearch.index.query.QueryBuilder;
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.domain.*;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.FacetedPage;
import org.springframework.data.elasticsearch.core.query.*;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.util.Assert;
/** /**
* Elasticsearch specific repository implementation. Likely to be used as target within * Elasticsearch specific repository implementation. Likely to be used as target within
* {@link ElasticsearchRepositoryFactory} * {@link ElasticsearchRepositoryFactory}
* *
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
* @author Ryan Henszey * @author Ryan Henszey

View File

@ -15,14 +15,13 @@
*/ */
package org.springframework.data.elasticsearch.repository.support; package org.springframework.data.elasticsearch.repository.support;
import org.springframework.data.repository.core.EntityInformation;
import java.io.Serializable; import java.io.Serializable;
import org.springframework.data.repository.core.EntityInformation;
/** /**
* @param <T> * @param <T>
* @param <ID> * @param <ID>
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
*/ */

View File

@ -26,5 +26,4 @@ import java.io.Serializable;
public interface ElasticsearchEntityInformationCreator { public interface ElasticsearchEntityInformationCreator {
<T, ID extends Serializable> ElasticsearchEntityInformation<T, ID> getEntityInformation(Class<T> domainClass); <T, ID extends Serializable> ElasticsearchEntityInformation<T, ID> getEntityInformation(Class<T> domainClass);
} }

View File

@ -15,13 +15,13 @@
*/ */
package org.springframework.data.elasticsearch.repository.support; package org.springframework.data.elasticsearch.repository.support;
import java.io.Serializable;
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity; import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentEntity;
import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty; import org.springframework.data.elasticsearch.core.mapping.ElasticsearchPersistentProperty;
import org.springframework.data.mapping.context.MappingContext; import org.springframework.data.mapping.context.MappingContext;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.io.Serializable;
/** /**
* ElasticsearchEntityInformationCreatorImpl * ElasticsearchEntityInformationCreatorImpl
* *

View File

@ -15,7 +15,7 @@
*/ */
package org.springframework.data.elasticsearch.repository.support; package org.springframework.data.elasticsearch.repository.support;
import static org.springframework.data.querydsl.QueryDslUtils.QUERY_DSL_PRESENT; import static org.springframework.data.querydsl.QueryDslUtils.*;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -117,5 +117,4 @@ public class ElasticsearchRepositoryFactory extends RepositoryFactorySupport {
return new ElasticsearchPartQuery(queryMethod, elasticsearchOperations); return new ElasticsearchPartQuery(queryMethod, elasticsearchOperations);
} }
} }
} }

View File

@ -15,14 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.repository.support; package org.springframework.data.elasticsearch.repository.support;
import java.io.Serializable;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations; import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.repository.Repository; import org.springframework.data.repository.Repository;
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport; import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
import org.springframework.data.repository.core.support.RepositoryFactorySupport; import org.springframework.data.repository.core.support.RepositoryFactorySupport;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.io.Serializable;
/** /**
* Spring {@link org.springframework.beans.factory.FactoryBean} implementation to ease container based configuration for * Spring {@link org.springframework.beans.factory.FactoryBean} implementation to ease container based configuration for
* XML namespace and JavaConfig. * XML namespace and JavaConfig.
@ -59,5 +59,4 @@ public class ElasticsearchRepositoryFactoryBean<T extends Repository<S, ID>, S,
protected RepositoryFactorySupport createRepositoryFactory() { protected RepositoryFactorySupport createRepositoryFactory() {
return new ElasticsearchRepositoryFactory(operations); return new ElasticsearchRepositoryFactory(operations);
} }
} }

View File

@ -31,7 +31,6 @@ import org.springframework.util.Assert;
* *
* @param <T> * @param <T>
* @param <ID> * @param <ID>
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
* @author Ryan Henszey * @author Ryan Henszey

View File

@ -21,7 +21,6 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
* Elasticsearch specific repository implementation. Likely to be used as target within * Elasticsearch specific repository implementation. Likely to be used as target within
* {@link ElasticsearchRepositoryFactory} * {@link ElasticsearchRepositoryFactory}
* *
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
* @author Ryan Henszey * @author Ryan Henszey
@ -45,5 +44,4 @@ public class NumberKeyedRepository<T, ID extends Number> extends AbstractElastic
protected String stringIdRepresentation(ID id) { protected String stringIdRepresentation(ID id) {
return String.valueOf(id); return String.valueOf(id);
} }
} }

View File

@ -21,7 +21,6 @@ import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
* Elasticsearch specific repository implementation. Likely to be used as target within * Elasticsearch specific repository implementation. Likely to be used as target within
* {@link ElasticsearchRepositoryFactory} * {@link ElasticsearchRepositoryFactory}
* *
*
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
* @author Ryan Henszey * @author Ryan Henszey
@ -45,5 +44,4 @@ public class SimpleElasticsearchRepository<T> extends AbstractElasticsearchRepos
protected String stringIdRepresentation(String id) { protected String stringIdRepresentation(String id) {
return id; return id;
} }
} }

View File

@ -17,7 +17,8 @@
<xsd:complexContent> <xsd:complexContent>
<xsd:extension base="repository:repositories"> <xsd:extension base="repository:repositories">
<xsd:attributeGroup ref="repository:repository-attributes"/> <xsd:attributeGroup ref="repository:repository-attributes"/>
<xsd:attribute name="elasticsearch-template-ref" type="elasticsearchTemplateRef" default="elasticsearchTemplate" /> <xsd:attribute name="elasticsearch-template-ref" type="elasticsearchTemplateRef"
default="elasticsearchTemplate"/>
</xsd:extension> </xsd:extension>
</xsd:complexContent> </xsd:complexContent>
</xsd:complexType> </xsd:complexType>
@ -46,12 +47,14 @@
<xsd:extension base="beans:identifiedType"> <xsd:extension base="beans:identifiedType">
<xsd:attribute name="local" type="xsd:boolean" default="false"> <xsd:attribute name="local" type="xsd:boolean" default="false">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[local here means local on the JVM (well, actually class loader) level, meaning that two local servers started within the same JVM will discover themselves and form a cluster]]></xsd:documentation> <xsd:documentation>
<![CDATA[local here means local on the JVM (well, actually class loader) level, meaning that two local servers started within the same JVM will discover themselves and form a cluster]]></xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="cluster-name" type="xsd:string" default="elasticsearch"> <xsd:attribute name="cluster-name" type="xsd:string" default="elasticsearch">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[Name of the cluster in which this instance of node client will connect to]]> </xsd:documentation> <xsd:documentation>
<![CDATA[Name of the cluster in which this instance of node client will connect to]]> </xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="http-enabled" type="xsd:boolean" default="true"> <xsd:attribute name="http-enabled" type="xsd:boolean" default="true">
@ -76,32 +79,38 @@
<xsd:extension base="beans:identifiedType"> <xsd:extension base="beans:identifiedType">
<xsd:attribute name="cluster-nodes" type="xsd:string" default="127.0.0.1:9300"> <xsd:attribute name="cluster-nodes" type="xsd:string" default="127.0.0.1:9300">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[The comma delimited list of host:port entries to use for elasticsearch cluster.]]></xsd:documentation> <xsd:documentation>
<![CDATA[The comma delimited list of host:port entries to use for elasticsearch cluster.]]></xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="cluster-name" type="xsd:string" default="elasticsearch"> <xsd:attribute name="cluster-name" type="xsd:string" default="elasticsearch">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[Name of the cluster in which this instance of node client will connect to]]> </xsd:documentation> <xsd:documentation>
<![CDATA[Name of the cluster in which this instance of node client will connect to]]> </xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="client-transport-sniff" type="xsd:boolean" default="true"> <xsd:attribute name="client-transport-sniff" type="xsd:boolean" default="true">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[The client allows to sniff the rest of the cluster, and add those into its list of machines to use.]]> </xsd:documentation> <xsd:documentation>
<![CDATA[The client allows to sniff the rest of the cluster, and add those into its list of machines to use.]]> </xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="client-transport-ignore-cluster-name" type="xsd:boolean" default="false"> <xsd:attribute name="client-transport-ignore-cluster-name" type="xsd:boolean" default="false">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[Set to true to ignore cluster name validation of connected nodes. (since 0.19.4)]]> </xsd:documentation> <xsd:documentation>
<![CDATA[Set to true to ignore cluster name validation of connected nodes. (since 0.19.4)]]> </xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="client-transport-ping-timeout" type="xsd:string" default="5s"> <xsd:attribute name="client-transport-ping-timeout" type="xsd:string" default="5s">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[The time to wait for a ping response from a node. Defaults to 5s.]]> </xsd:documentation> <xsd:documentation>
<![CDATA[The time to wait for a ping response from a node. Defaults to 5s.]]> </xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
<xsd:attribute name="client-transport-nodes-sampler-interval" type="xsd:string" default="5s"> <xsd:attribute name="client-transport-nodes-sampler-interval" type="xsd:string" default="5s">
<xsd:annotation> <xsd:annotation>
<xsd:documentation><![CDATA[How often to sample / ping the nodes listed and connected. Defaults to 5s.]]> </xsd:documentation> <xsd:documentation>
<![CDATA[How often to sample / ping the nodes listed and connected. Defaults to 5s.]]> </xsd:documentation>
</xsd:annotation> </xsd:annotation>
</xsd:attribute> </xsd:attribute>
</xsd:extension> </xsd:extension>

View File

@ -65,5 +65,4 @@ public class DoubleIDEntity {
public void setVersion(Long version) { public void setVersion(Long version) {
this.version = version; this.version = version;
} }
} }

View File

@ -15,11 +15,11 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import java.util.List;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.List;
/** /**
* @author Mohsin Husen * @author Mohsin Husen
*/ */

View File

@ -65,5 +65,4 @@ public class IntegerIDEntity {
public void setVersion(Long version) { public void setVersion(Long version) {
this.version = version; this.version = version;
} }
} }

View File

@ -17,6 +17,7 @@ package org.springframework.data.elasticsearch;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
/** /**
* MinimalEntity * MinimalEntity
* *
@ -24,6 +25,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
*/ */
@Document(indexName = "index", type = "type") @Document(indexName = "index", type = "type")
public class MinimalEntity { public class MinimalEntity {
@Id @Id
private String id; private String id;
} }

View File

@ -15,6 +15,15 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import static org.apache.commons.lang.RandomStringUtils.*;
import static org.elasticsearch.index.query.QueryBuilders.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
import org.junit.Before; import org.junit.Before;
@ -31,20 +40,6 @@ import org.springframework.data.elasticsearch.repositories.SampleElasticSearchBo
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
import static org.elasticsearch.index.query.QueryBuilders.nestedQuery;
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
@ -54,7 +49,7 @@ import static org.junit.Assert.assertThat;
@ContextConfiguration("classpath:/repository-test-nested-object.xml") @ContextConfiguration("classpath:/repository-test-nested-object.xml")
public class NestedObjectTests { public class NestedObjectTests {
@Resource @Autowired
private SampleElasticSearchBookRepository bookRepository; private SampleElasticSearchBookRepository bookRepository;
@Autowired @Autowired
@ -102,7 +97,6 @@ public class NestedObjectTests {
foo.setId("1"); foo.setId("1");
foo.setCar(cars); foo.setCar(cars);
Car car = new Car(); Car car = new Car();
car.setName("Saturn"); car.setName("Saturn");
car.setModel("Imprezza"); car.setModel("Imprezza");
@ -134,7 +128,6 @@ public class NestedObjectTests {
List<Person> persons = elasticsearchTemplate.queryForList(searchQuery, Person.class); List<Person> persons = elasticsearchTemplate.queryForList(searchQuery, Person.class);
assertThat(persons.size(), is(1)); assertThat(persons.size(), is(1));
} }
@Test @Test
@ -235,7 +228,6 @@ public class NestedObjectTests {
indexQuery1.setId(person1.getId()); indexQuery1.setId(person1.getId());
indexQuery1.setObject(person1); indexQuery1.setObject(person1);
PersonMultipleLevelNested person2 = new PersonMultipleLevelNested(); PersonMultipleLevelNested person2 = new PersonMultipleLevelNested();
person2.setId("2"); person2.setId("2");
@ -252,6 +244,5 @@ public class NestedObjectTests {
indexQueries.add(indexQuery2); indexQueries.add(indexQuery2);
return indexQueries; return indexQueries;
} }
} }

View File

@ -18,6 +18,7 @@ package org.springframework.data.elasticsearch;
import org.springframework.core.style.ToStringCreator; import org.springframework.core.style.ToStringCreator;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*; import org.springframework.data.elasticsearch.annotations.*;
/** /**
* ParentEntity * ParentEntity
* *
@ -26,6 +27,7 @@ import org.springframework.data.elasticsearch.annotations.*;
*/ */
@Document(indexName = ParentEntity.INDEX, type = ParentEntity.PARENT_TYPE, indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1") @Document(indexName = ParentEntity.INDEX, type = ParentEntity.PARENT_TYPE, indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
public class ParentEntity { public class ParentEntity {
public static final String INDEX = "parent-child"; public static final String INDEX = "parent-child";
public static final String PARENT_TYPE = "parent-entity"; public static final String PARENT_TYPE = "parent-entity";
public static final String CHILD_TYPE = "child-entity"; public static final String CHILD_TYPE = "child-entity";
@ -58,6 +60,7 @@ public class ParentEntity {
@Document(indexName = INDEX, type = CHILD_TYPE, indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1") @Document(indexName = INDEX, type = CHILD_TYPE, indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
public static class ChildEntity { public static class ChildEntity {
@Id @Id
private String id; private String id;
@Field(type = FieldType.String, store = true) @Field(type = FieldType.String, store = true)

View File

@ -16,13 +16,13 @@
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import java.util.List;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.List;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen

View File

@ -16,13 +16,13 @@
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import java.util.List;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import java.util.List;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen

View File

@ -15,12 +15,12 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
/** /**
* @author Mohsin Husen * @author Mohsin Husen
*/ */
@ -174,5 +174,4 @@ public class Product {
public void setText(String text) { public void setText(String text) {
this.text = text; this.text = text;
} }
} }

View File

@ -1,21 +1,22 @@
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import static org.springframework.data.elasticsearch.annotations.FieldIndex.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.String;
import java.util.Date;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat; import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import java.util.Date;
import static org.springframework.data.elasticsearch.annotations.FieldIndex.not_analyzed;
import static org.springframework.data.elasticsearch.annotations.FieldType.String;
import static org.springframework.data.elasticsearch.annotations.FieldType.Date;
/** /**
* @author Jakub Vavrik * @author Jakub Vavrik
*/ */
@Document(indexName = "test-datemapping", type = "mapping", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1") @Document(indexName = "test-datemapping", type = "mapping", indexStoreType = "memory", shards = 1, replicas = 0, refreshInterval = "-1")
public class SampleDateMappingEntity { public class SampleDateMappingEntity {
@Id @Id
private String id; private String id;

View File

@ -15,14 +15,12 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import static org.springframework.data.elasticsearch.annotations.FieldIndex.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.String;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;
import static org.springframework.data.elasticsearch.annotations.FieldIndex.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.*;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
@ -56,6 +54,7 @@ public class SampleMappingEntity {
} }
static class NestedEntity { static class NestedEntity {
@Field(type = String) @Field(type = String)
private String someField; private String someField;
@ -67,5 +66,4 @@ public class SampleMappingEntity {
this.someField = someField; this.someField = someField;
} }
} }
} }

View File

@ -15,14 +15,14 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import static org.springframework.data.elasticsearch.annotations.FieldIndex.*;
import static org.springframework.data.elasticsearch.annotations.FieldType.String;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient; import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import static org.springframework.data.elasticsearch.annotations.FieldIndex.not_analyzed;
import static org.springframework.data.elasticsearch.annotations.FieldType.String;
/** /**
* @author Jakub Vavrik * @author Jakub Vavrik
*/ */
@ -55,6 +55,7 @@ public class SampleTransientEntity {
} }
static class NestedEntity { static class NestedEntity {
@Field @Field
private static NestedEntity someField = new NestedEntity(); private static NestedEntity someField = new NestedEntity();
@Field @Field
@ -68,9 +69,12 @@ public class SampleTransientEntity {
this.someField = someField; this.someField = someField;
} }
public Boolean getSomething() { return something; } public Boolean getSomething() {
return something;
public void setSomething(Boolean something) { this.something = something; }
} }
public void setSomething(Boolean something) {
this.something = something;
}
}
} }

View File

@ -15,13 +15,13 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import java.math.BigDecimal;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import java.math.BigDecimal;
/** /**
* @author Artur Konczak * @author Artur Konczak
* @author Mohsin Husen * @author Mohsin Husen

View File

@ -15,10 +15,10 @@
*/ */
package org.springframework.data.elasticsearch; package org.springframework.data.elasticsearch;
import org.springframework.data.elasticsearch.core.query.IndexQuery;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.springframework.data.elasticsearch.core.query.IndexQuery;
/** /**
* @author Artur Konczak * @author Artur Konczak
* @author Mohsin Husen * @author Mohsin Husen

View File

@ -15,21 +15,20 @@
*/ */
package org.springframework.data.elasticsearch.config; package org.springframework.data.elasticsearch.config;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.data.elasticsearch.repositories.SampleElasticsearchRepository;
import org.springframework.data.elasticsearch.client.NodeClientFactoryBean; import org.springframework.data.elasticsearch.client.NodeClientFactoryBean;
import org.springframework.data.elasticsearch.client.TransportClientFactoryBean; import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
import org.springframework.data.elasticsearch.repositories.SampleElasticsearchRepository;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
@ -60,5 +59,4 @@ public class ElasticsearchNamespaceHandlerTests {
assertThat(context.getBean(SampleElasticsearchRepository.class), assertThat(context.getBean(SampleElasticsearchRepository.class),
is(instanceOf(SampleElasticsearchRepository.class))); is(instanceOf(SampleElasticsearchRepository.class)));
} }
} }

View File

@ -15,6 +15,10 @@
*/ */
package org.springframework.data.elasticsearch.config; package org.springframework.data.elasticsearch.config;
import static org.elasticsearch.node.NodeBuilder.*;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -27,11 +31,6 @@ import org.springframework.data.elasticsearch.repository.config.EnableElasticsea
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.elasticsearch.node.NodeBuilder.nodeBuilder;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
/** /**
* @author Rizwan Idrees * @author Rizwan Idrees
* @author Mohsin Husen * @author Mohsin Husen
@ -57,5 +56,4 @@ public class EnableElasticsearchRepositoriesTests {
public void bootstrapsRepository() { public void bootstrapsRepository() {
assertThat(repository, is(notNullValue())); assertThat(repository, is(notNullValue()));
} }
} }

View File

@ -15,16 +15,16 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.io.IOException;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.springframework.data.elasticsearch.Car; import org.springframework.data.elasticsearch.Car;
import org.springframework.data.elasticsearch.CarBuilder; import org.springframework.data.elasticsearch.CarBuilder;
import java.io.IOException;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/** /**
* @author Artur Konczak * @author Artur Konczak
* @author Mohsin Husen * @author Mohsin Husen
@ -63,5 +63,4 @@ public class DefaultEntityMapperTests {
assertThat(result.getName(), is(CAR_NAME)); assertThat(result.getName(), is(CAR_NAME));
assertThat(result.getModel(), is(CAR_MODEL)); assertThat(result.getModel(), is(CAR_MODEL));
} }
} }

View File

@ -15,6 +15,14 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.collections.iterators.ArrayIterator; import org.apache.commons.collections.iterators.ArrayIterator;
import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
@ -28,16 +36,6 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import org.springframework.data.elasticsearch.Car; import org.springframework.data.elasticsearch.Car;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/** /**
* @author Artur Konczak * @author Artur Konczak
* @author Mohsin Husen * @author Mohsin Husen
@ -133,5 +131,4 @@ public class DefaultResultMapperTests {
result.put("model", new InternalSearchHitField("model", Arrays.<Object>asList(model))); result.put("model", new InternalSearchHitField("model", Arrays.<Object>asList(model)));
return result; return result;
} }
} }

View File

@ -15,15 +15,15 @@
*/ */
package org.springframework.data.elasticsearch.core; package org.springframework.data.elasticsearch.core;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/** /**
* @author Artur Konczak * @author Artur Konczak
*/ */
@ -48,5 +48,4 @@ public class ElasticsearchTemplateCustomMapperTests {
assertThat(elasticsearchTemplate.getResultsMapper(), is(resultsMapper)); assertThat(elasticsearchTemplate.getResultsMapper(), is(resultsMapper));
assertThat(elasticsearchTemplate.getResultsMapper().getEntityMapper(), is(entityMapper)); assertThat(elasticsearchTemplate.getResultsMapper().getEntityMapper(), is(entityMapper));
} }
} }

Some files were not shown because too many files have changed in this diff Show More