[DEV] update th format of the code
This commit is contained in:
parent
29a6e7602c
commit
4517854749
375
Formatter.xml
375
Formatter.xml
@ -1,365 +1,400 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE xml>
|
<profiles version="23">
|
||||||
<profiles version="18">
|
<profile kind="CodeFormatterProfile" name="EWOL" version="23">
|
||||||
<profile kind="CodeFormatterProfile" name="Scenarium" version="18">
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" 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.insert_space_after_comma_in_enum_declarations" 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.insert_space_before_comma_in_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.parentheses_positions_in_for_statment" value="common_lines"/>
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
|
||||||
<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_comma_in_constructor_declaration_parameters" 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.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
|
||||||
<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_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not 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.formatter.comment.insert_new_line_before_root_tags" value="do not insert"/>
|
|
||||||
<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_space_between_empty_parens_in_annotation_type_member_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.comment.format_javadoc_comments" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="preserve_positions"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" 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.insert_space_after_arrow_in_switch_default" value="insert"/>
|
|
||||||
<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.insert_space_after_semicolon_in_for" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
<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_multiple_local_declarations" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
|
||||||
<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_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="49"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||||
<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_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
|
||||||
<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_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" 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.blank_lines_between_type_declarations" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="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_after_opening_paren_in_catch" value="do not 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_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||||
<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.alignment_for_parameterized_type_references" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||||
<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.alignment_for_logical_operator" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||||
<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_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_if_empty"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" 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_after_and_in_type_parameter" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
|
||||||
<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_question_in_wildcard" value="do not 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_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="200"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
|
|
||||||
<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.keep_loop_body_block_on_one_line" value="one_line_if_empty"/>
|
|
||||||
<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_between_empty_parens_in_method_invocation" 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_space_after_assignment_operator" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="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_before_opening_brace_in_type_declaration" value="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_after_opening_paren_in_for" 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.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||||
<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_after_annotation_on_local_variable" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_if_empty"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||||
<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_method_invocation" 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.alignment_for_union_type_in_multicatch" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_if_empty"/>
|
|
||||||
<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.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||||
<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.keep_else_statement_on_same_line" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
|
||||||
<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_parameterized_type_reference" value="insert"/>
|
||||||
<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_before_comma_in_array_initializer" 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_comma_in_annotation" value="do not 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.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
<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_relational_operator" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
<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_after_comma_in_superinterfaces" 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_after_question_in_conditional" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
|
||||||
<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_paren_in_catch" value="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_before_bitwise_operator" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
|
||||||
<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_try" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||||
<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_new_line_at_end_of_file_if_missing" 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.wrap_before_switch_case_arrow_operator" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
|
||||||
<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_after_comma_in_array_initializer" value="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_unary_operator" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
|
||||||
<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_semicolon_in_try_resources" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="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.alignment_for_annotations_on_enum_constant" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" 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_before_and_in_type_parameter" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="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_after_opening_paren_in_parenthesized_expression" 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_colon_in_labeled_statement" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
<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_between_empty_parens_in_method_declaration" value="do not insert"/>
|
<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.number_of_blank_lines_after_code_block" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" 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_enum_constant" 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.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
|
||||||
<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_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||||
<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_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
<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_opening_paren_in_if" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||||
<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_comma_in_permitted_types" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="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_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||||
<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_opening_paren_in_while" value="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_closing_paren_in_switch" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="1"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
|
||||||
<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.wrap_before_conditional_operator" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
|
||||||
<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.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
<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_space_before_colon_in_for" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
<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.parentheses_positions_in_try_clause" value="common_lines"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
|
|
||||||
<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_opening_paren_in_synchronized" value="do not 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.tabulation.size" value="4"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" 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_allocation_expression" value="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.insert_space_after_colon_in_conditional" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||||
<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_before_opening_brace_in_array_initializer" value="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_semicolon_in_try_resources" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
|
||||||
<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_parenthesized_expression_in_throw" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
|
||||||
<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_after_not_operator" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" 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_before_comma_in_superinterfaces" value="do not 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.insert_new_line_after_type_annotation" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" 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.insert_space_after_opening_brace_in_array_initializer" value="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_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||||
<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_after_at_in_annotation_type_declaration" 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.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/>
|
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||||
<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.insert_space_after_unary_operator" 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_before_opening_paren_in_enum_constant" value="do not insert"/>
|
<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_arguments_in_annotation" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||||
<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.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||||
<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_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_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.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" 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.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not 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.insert_space_before_colon_in_conditional" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" 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_before_comma_in_method_declaration_parameters" value="do not 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_before_closing_angle_bracket_in_type_arguments" value="do not 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.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
|
||||||
<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.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
|
||||||
<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_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||||
<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_closing_angle_bracket_in_parameterized_type_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_new_line_after_opening_brace_in_array_initializer" 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.indent_breaks_compare_to_cases" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" 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_method_declaration" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||||
<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.javadoc_do_not_separate_block_tags" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" 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_after_opening_paren_in_try" 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.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="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_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/>
|
||||||
<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_brace_in_enum_declaration" 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_between_brackets_in_array_type_reference" value="do not 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_before_opening_angle_bracket_in_type_parameters" value="do not 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.alignment_for_string_concatenation" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||||
<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_semicolon_in_for" value="do not insert"/>
|
||||||
<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_opening_bracket_in_array_allocation_expression" 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.blank_lines_after_last_class_body_declaration" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||||
<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_comma_in_enum_constant_arguments" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" 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.brace_position_for_array_initializer" value="end_of_line"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="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.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="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_closing_paren_in_catch" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" 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_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||||
|
<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.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||||
|
<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_before_opening_paren_in_synchronized" value="insert"/>
|
||||||
|
<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.alignment_for_expressions_in_for_loop_header" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||||
|
<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.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" 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.blank_lines_between_import_groups" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||||
|
<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.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" 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.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||||
|
<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.disabling_tag" value="@formatter:off"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||||
|
<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_parenthesized_expression_in_return" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/>
|
||||||
|
<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_after_opening_paren_in_catch" value="do not insert"/>
|
||||||
|
<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_before_opening_brace_in_anonymous_type_declaration" 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_after_comma_in_for_inits" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||||
|
<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_question_in_wildcard" value="do not 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_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="200"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<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.keep_loop_body_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<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.alignment_for_additive_operator" value="16"/>
|
||||||
|
<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_opening_brace_in_record_constructor" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<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_after_question_in_conditional" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||||
|
<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_paren_in_catch" value="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_comma_in_method_invocation_arguments" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||||
|
<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_try" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||||
|
<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_relational_operator" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="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.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/>
|
||||||
|
<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_annotations_on_local_variable" value="49"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="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_opening_paren_in_while" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||||
|
<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.alignment_for_annotations_on_field" value="49"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||||
|
<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.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="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.insert_space_after_colon_in_conditional" value="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_semicolon_in_try_resources" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||||
|
<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_record_declaration" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||||
|
<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.brace_position_for_switch" value="end_of_line"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not 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.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/>
|
||||||
|
<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.keep_record_constructor_on_one_line" value="one_line_never"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_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.alignment_for_assertion_message" value="0"/>
|
||||||
|
<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.blank_lines_before_new_chunk" value="1"/>
|
||||||
|
<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_after_opening_paren_in_constructor_declaration" value="do not 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_before_closing_angle_bracket_in_type_arguments" 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.blank_lines_before_member_type" value="1"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="33"/>
|
||||||
|
<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.insert_space_before_semicolon" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" 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.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="48"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||||
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||||
<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_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
<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_enum_constant_arguments" value="do not insert"/>
|
<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.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" 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_before_colon_in_case" value="do not insert"/>
|
<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_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
|
||||||
<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.insert_space_before_opening_bracket_in_array_reference" value="do not 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.keep_enum_declaration_on_one_line" value="one_line_if_empty"/>
|
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
|
||||||
<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_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" 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.brace_position_for_enum_constant" value="end_of_line"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
<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_multiplicative_operator" value="insert"/>
|
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||||
<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_before_opening_paren_in_for" value="insert"/>
|
||||||
<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_before_comma_in_for_increments" value="do not 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_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
|
||||||
<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.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
<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.insert_space_before_comma_in_explicitconstructorcall_arguments" 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_closing_paren_in_annotation" value="do not 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_opening_angle_bracket_in_type_parameters" value="do not 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.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="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.insert_space_before_opening_brace_in_constructor_declaration" value="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_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
|
||||||
<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_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||||
<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_question_in_conditional" value="insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
||||||
<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_before_finally_in_try_statement" value="do not insert"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" 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.wrap_before_string_concatenation" value="true"/>
|
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
|
||||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="200"/>
|
|
||||||
<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.insert_space_after_opening_paren_in_annotation" 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_opening_paren_in_switch" value="insert"/>
|
||||||
</profile>
|
</profile>
|
||||||
|
@ -7,7 +7,9 @@ public class GlobalConfiguration {
|
|||||||
public static DBConfig dbConfig = null;
|
public static DBConfig dbConfig = null;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
dbConfig = new DBConfig(ConfigBaseVariable.getDBType(), ConfigBaseVariable.getDBHost(), Integer.parseInt(ConfigBaseVariable.getDBPort()), ConfigBaseVariable.getDBLogin(),
|
dbConfig = new DBConfig(ConfigBaseVariable.getDBType(), ConfigBaseVariable.getDBHost(),
|
||||||
ConfigBaseVariable.getDBPassword(), ConfigBaseVariable.getDBName(), ConfigBaseVariable.getDBKeepConnected());
|
Integer.parseInt(ConfigBaseVariable.getDBPort()), ConfigBaseVariable.getDBLogin(),
|
||||||
|
ConfigBaseVariable.getDBPassword(), ConfigBaseVariable.getDBName(),
|
||||||
|
ConfigBaseVariable.getDBKeepConnected());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@ public class UserDB {
|
|||||||
return DataAccess.get(User.class, userId, option);
|
return DataAccess.get(User.class, userId, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static User getUserOrCreate(final long userId, final String userLogin, QueryOption... option) throws Exception {
|
public static User getUserOrCreate(final long userId, final String userLogin, QueryOption... option)
|
||||||
|
throws Exception {
|
||||||
final User user = getUsers(userId);
|
final User user = getUsers(userId);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
return user;
|
return user;
|
||||||
@ -28,7 +29,8 @@ public class UserDB {
|
|||||||
return getUsers(userId);
|
return getUsers(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createUsersInfoFromOAuth(final long userId, final String login, QueryOption... option) throws IOException {
|
private static void createUsersInfoFromOAuth(final long userId, final String login, QueryOption... option)
|
||||||
|
throws IOException {
|
||||||
QueryOptions options = new QueryOptions(option);
|
QueryOptions options = new QueryOptions(option);
|
||||||
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
||||||
final String query = "INSERT INTO `user` (`id`, `login`, `lastConnection`, `admin`, `blocked`, `removed`) VALUE (?,?,now(3),'0','0','0')";
|
final String query = "INSERT INTO `user` (`id`, `login`, `lastConnection`, `admin`, `blocked`, `removed`) VALUE (?,?,now(3),'0','0','0')";
|
||||||
|
@ -59,7 +59,8 @@ public class AnnotationTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((Schema) annotation[0]).readOnly();
|
return ((Schema) annotation[0]).readOnly();
|
||||||
}
|
}
|
||||||
@ -70,7 +71,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((Schema) annotation[0]).example();
|
return ((Schema) annotation[0]).example();
|
||||||
}
|
}
|
||||||
@ -81,7 +83,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((Schema) annotation[0]).description();
|
return ((Schema) annotation[0]).description();
|
||||||
}
|
}
|
||||||
@ -92,7 +95,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Schema on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((Schema) annotation[0]).description();
|
return ((Schema) annotation[0]).description();
|
||||||
}
|
}
|
||||||
@ -103,7 +107,8 @@ public class AnnotationTools {
|
|||||||
return getSchemaDescription(element);
|
return getSchemaDescription(element);
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @DataComment on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @DataComment on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((DataComment) annotation[0]).value();
|
return ((DataComment) annotation[0]).value();
|
||||||
}
|
}
|
||||||
@ -114,7 +119,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @DataDefault on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @DataDefault on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((DefaultValue) annotation[0]).value();
|
return ((DefaultValue) annotation[0]).value();
|
||||||
}
|
}
|
||||||
@ -125,7 +131,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @ManyToOne on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @ManyToOne on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return (ManyToOne) annotation[0];
|
return (ManyToOne) annotation[0];
|
||||||
}
|
}
|
||||||
@ -136,7 +143,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @ManyToOne on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @ManyToOne on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return (DataJson) annotation[0];
|
return (DataJson) annotation[0];
|
||||||
}
|
}
|
||||||
@ -169,7 +177,8 @@ public class AnnotationTools {
|
|||||||
return 255;
|
return 255;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
final int length = ((Column) annotation[0]).length();
|
final int length = ((Column) annotation[0]).length();
|
||||||
return length <= 0 ? 0 : length;
|
return length <= 0 ? 0 : length;
|
||||||
@ -192,7 +201,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Pattern on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Pattern on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((Pattern) annotation[0]).regexp();
|
return ((Pattern) annotation[0]).regexp();
|
||||||
}
|
}
|
||||||
@ -226,7 +236,8 @@ public class AnnotationTools {
|
|||||||
return element.getName();
|
return element.getName();
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
final String name = ((Column) annotation[0]).name();
|
final String name = ((Column) annotation[0]).name();
|
||||||
if (name.isBlank()) {
|
if (name.isBlank()) {
|
||||||
@ -241,7 +252,8 @@ public class AnnotationTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return !((Column) annotation[0]).nullable();
|
return !((Column) annotation[0]).nullable();
|
||||||
}
|
}
|
||||||
@ -252,7 +264,8 @@ public class AnnotationTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @NotNull on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @NotNull on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -284,7 +297,8 @@ public class AnnotationTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((Column) annotation[0]).unique();
|
return ((Column) annotation[0]).unique();
|
||||||
}
|
}
|
||||||
@ -295,7 +309,8 @@ public class AnnotationTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (annotation.length > 1) {
|
if (annotation.length > 1) {
|
||||||
throw new Exception("Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
throw new Exception(
|
||||||
|
"Must not have more than 1 element @Column on " + element.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
return ((GeneratedValue) annotation[0]).strategy();
|
return ((GeneratedValue) annotation[0]).strategy();
|
||||||
}
|
}
|
||||||
@ -395,7 +410,8 @@ public class AnnotationTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isGenericField(final Field elem) throws Exception {
|
public static boolean isGenericField(final Field elem) throws Exception {
|
||||||
return AnnotationTools.isPrimaryKey(elem) || AnnotationTools.isCreatedAtField(elem) || AnnotationTools.isUpdateAtField(elem) || AnnotationTools.isDeletedField(elem);
|
return AnnotationTools.isPrimaryKey(elem) || AnnotationTools.isCreatedAtField(elem)
|
||||||
|
|| AnnotationTools.isUpdateAtField(elem) || AnnotationTools.isDeletedField(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Field getFieldOfId(final Class<?> clazz) throws Exception {
|
public static Field getFieldOfId(final Class<?> clazz) throws Exception {
|
||||||
|
@ -85,7 +85,8 @@ public class DataResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileDataOld(final long tmpFolderId) {
|
public static String getFileDataOld(final long tmpFolderId) {
|
||||||
final String filePath = ConfigBaseVariable.getMediaDataFolder() + File.separator + tmpFolderId + File.separator + "data";
|
final String filePath = ConfigBaseVariable.getMediaDataFolder() + File.separator + tmpFolderId + File.separator
|
||||||
|
+ "data";
|
||||||
try {
|
try {
|
||||||
createFolder(ConfigBaseVariable.getMediaDataFolder() + File.separator + tmpFolderId + File.separator);
|
createFolder(ConfigBaseVariable.getMediaDataFolder() + File.separator + tmpFolderId + File.separator);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
@ -100,7 +101,8 @@ public class DataResource {
|
|||||||
final String part2 = stringUUID.substring(2, 4);
|
final String part2 = stringUUID.substring(2, 4);
|
||||||
final String part3 = stringUUID.substring(4);
|
final String part3 = stringUUID.substring(4);
|
||||||
final String finalPath = part1 + File.separator + part2;
|
final String finalPath = part1 + File.separator + part2;
|
||||||
String filePath = ConfigBaseVariable.getMediaDataFolder() + "_uuid" + File.separator + finalPath + File.separator;
|
String filePath = ConfigBaseVariable.getMediaDataFolder() + "_uuid" + File.separator + finalPath
|
||||||
|
+ File.separator;
|
||||||
try {
|
try {
|
||||||
createFolder(filePath);
|
createFolder(filePath);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
@ -136,19 +138,20 @@ public class DataResource {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Data createNewData(final long tmpUID, final String originalFileName, final String sha512) throws IOException {
|
public static Data createNewData(final long tmpUID, final String originalFileName, final String sha512)
|
||||||
|
throws IOException {
|
||||||
// determine mime type:
|
// determine mime type:
|
||||||
Data injectedData = new Data();
|
Data injectedData = new Data();
|
||||||
String mimeType = "";
|
String mimeType = "";
|
||||||
final String extension = originalFileName.substring(originalFileName.lastIndexOf('.') + 1);
|
final String extension = originalFileName.substring(originalFileName.lastIndexOf('.') + 1);
|
||||||
mimeType = switch (extension.toLowerCase()) {
|
mimeType = switch (extension.toLowerCase()) {
|
||||||
case "jpg", "jpeg" -> "image/jpeg";
|
case "jpg", "jpeg" -> "image/jpeg";
|
||||||
case "png" -> "image/png";
|
case "png" -> "image/png";
|
||||||
case "webp" -> "image/webp";
|
case "webp" -> "image/webp";
|
||||||
case "mka" -> "audio/x-matroska";
|
case "mka" -> "audio/x-matroska";
|
||||||
case "mkv" -> "video/x-matroska";
|
case "mkv" -> "video/x-matroska";
|
||||||
case "webm" -> "video/webm";
|
case "webm" -> "video/webm";
|
||||||
default -> throw new IOException("Can not find the mime type of data input: '" + extension + "'");
|
default -> throw new IOException("Can not find the mime type of data input: '" + extension + "'");
|
||||||
};
|
};
|
||||||
injectedData.mimeType = mimeType;
|
injectedData.mimeType = mimeType;
|
||||||
injectedData.sha512 = sha512;
|
injectedData.sha512 = sha512;
|
||||||
@ -261,7 +264,10 @@ public class DataResource {
|
|||||||
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
@Consumes({ MediaType.MULTIPART_FORM_DATA })
|
||||||
@RolesAllowed("ADMIN")
|
@RolesAllowed("ADMIN")
|
||||||
@Operation(description = "Insert a new data in the data environment", tags = "SYSTEM")
|
@Operation(description = "Insert a new data in the data environment", tags = "SYSTEM")
|
||||||
public void uploadFile(@Context final SecurityContext sc, @FormDataParam("file") final InputStream fileInputStream, @FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
public void uploadFile(
|
||||||
|
@Context final SecurityContext sc,
|
||||||
|
@FormDataParam("file") final InputStream fileInputStream,
|
||||||
|
@FormDataParam("file") final FormDataContentDisposition fileMetaData) {
|
||||||
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||||
LOGGER.info("===================================================");
|
LOGGER.info("===================================================");
|
||||||
LOGGER.info("== DATA uploadFile {}", (gc == null ? "null" : gc.userByToken));
|
LOGGER.info("== DATA uploadFile {}", (gc == null ? "null" : gc.userByToken));
|
||||||
@ -283,7 +289,10 @@ public class DataResource {
|
|||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
@Operation(description = "Get back some data from the data environment", tags = "SYSTEM")
|
@Operation(description = "Get back some data from the data environment", tags = "SYSTEM")
|
||||||
public Response retrieveDataId(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range,
|
public Response retrieveDataId(
|
||||||
|
@Context final SecurityContext sc,
|
||||||
|
@QueryParam(HttpHeaders.AUTHORIZATION) final String token,
|
||||||
|
@HeaderParam("Range") final String range,
|
||||||
@PathParam("uuid") final UUID uuid) throws Exception {
|
@PathParam("uuid") final UUID uuid) throws Exception {
|
||||||
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||||
// logger.info("===================================================");
|
// logger.info("===================================================");
|
||||||
@ -303,7 +312,10 @@ public class DataResource {
|
|||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
@Operation(description = "Get a thumbnail of from the data environment (if resize is possible)", tags = "SYSTEM")
|
@Operation(description = "Get a thumbnail of from the data environment (if resize is possible)", tags = "SYSTEM")
|
||||||
// @CacheMaxAge(time = 10, unit = TimeUnit.DAYS)
|
// @CacheMaxAge(time = 10, unit = TimeUnit.DAYS)
|
||||||
public Response retrieveDataThumbnailId(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range,
|
public Response retrieveDataThumbnailId(
|
||||||
|
@Context final SecurityContext sc,
|
||||||
|
@QueryParam(HttpHeaders.AUTHORIZATION) final String token,
|
||||||
|
@HeaderParam("Range") final String range,
|
||||||
@PathParam("uuid") final UUID uuid) throws Exception {
|
@PathParam("uuid") final UUID uuid) throws Exception {
|
||||||
// GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
// GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||||
// logger.info("===================================================");
|
// logger.info("===================================================");
|
||||||
@ -316,7 +328,8 @@ public class DataResource {
|
|||||||
final String filePathName = getFileData(uuid);
|
final String filePathName = getFileData(uuid);
|
||||||
final File inputFile = new File(filePathName);
|
final File inputFile = new File(filePathName);
|
||||||
if (!inputFile.exists()) {
|
if (!inputFile.exists()) {
|
||||||
return Response.status(404).entity("{\"error\":\"media Does not exist: " + uuid + "\"}").type("application/json").build();
|
return Response.status(404).entity("{\"error\":\"media Does not exist: " + uuid + "\"}")
|
||||||
|
.type("application/json").build();
|
||||||
}
|
}
|
||||||
if (value.mimeType.contentEquals("image/jpeg") || value.mimeType.contentEquals("image/png")
|
if (value.mimeType.contentEquals("image/jpeg") || value.mimeType.contentEquals("image/png")
|
||||||
// || value.mimeType.contentEquals("image/webp")
|
// || value.mimeType.contentEquals("image/webp")
|
||||||
@ -324,7 +337,8 @@ public class DataResource {
|
|||||||
// reads input image
|
// reads input image
|
||||||
final BufferedImage inputImage = ImageIO.read(inputFile);
|
final BufferedImage inputImage = ImageIO.read(inputFile);
|
||||||
final int scaledWidth = 250;
|
final int scaledWidth = 250;
|
||||||
final int scaledHeight = (int) ((float) inputImage.getHeight() / (float) inputImage.getWidth() * scaledWidth);
|
final int scaledHeight = (int) ((float) inputImage.getHeight() / (float) inputImage.getWidth()
|
||||||
|
* scaledWidth);
|
||||||
// creates output image
|
// creates output image
|
||||||
final BufferedImage outputImage = new BufferedImage(scaledWidth, scaledHeight, inputImage.getType());
|
final BufferedImage outputImage = new BufferedImage(scaledWidth, scaledHeight, inputImage.getType());
|
||||||
|
|
||||||
@ -339,11 +353,13 @@ public class DataResource {
|
|||||||
ImageIO.write(outputImage, "JPG", baos);
|
ImageIO.write(outputImage, "JPG", baos);
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return Response.status(500).entity("Internal Error: resize fail: " + e.getMessage()).type("text/plain").build();
|
return Response.status(500).entity("Internal Error: resize fail: " + e.getMessage()).type("text/plain")
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
final byte[] imageData = baos.toByteArray();
|
final byte[] imageData = baos.toByteArray();
|
||||||
// Response.ok(new ByteArrayInputStream(imageData)).build();
|
// Response.ok(new ByteArrayInputStream(imageData)).build();
|
||||||
final Response.ResponseBuilder out = Response.ok(imageData).header(HttpHeaders.CONTENT_LENGTH, imageData.length);
|
final Response.ResponseBuilder out = Response.ok(imageData).header(HttpHeaders.CONTENT_LENGTH,
|
||||||
|
imageData.length);
|
||||||
out.type("image/jpeg");
|
out.type("image/jpeg");
|
||||||
// TODO: move this in a decorator !!!
|
// TODO: move this in a decorator !!!
|
||||||
final CacheControl cc = new CacheControl();
|
final CacheControl cc = new CacheControl();
|
||||||
@ -361,8 +377,12 @@ public class DataResource {
|
|||||||
@RolesAllowed("USER")
|
@RolesAllowed("USER")
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
@Operation(description = "Get back some data from the data environment (with a beautiful name (permit download with basic name)", tags = "SYSTEM")
|
@Operation(description = "Get back some data from the data environment (with a beautiful name (permit download with basic name)", tags = "SYSTEM")
|
||||||
public Response retrieveDataFull(@Context final SecurityContext sc, @QueryParam(HttpHeaders.AUTHORIZATION) final String token, @HeaderParam("Range") final String range,
|
public Response retrieveDataFull(
|
||||||
@PathParam("uuid") final UUID uuid, @PathParam("name") final String name) throws Exception {
|
@Context final SecurityContext sc,
|
||||||
|
@QueryParam(HttpHeaders.AUTHORIZATION) final String token,
|
||||||
|
@HeaderParam("Range") final String range,
|
||||||
|
@PathParam("uuid") final UUID uuid,
|
||||||
|
@PathParam("name") final String name) throws Exception {
|
||||||
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
final GenericContext gc = (GenericContext) sc.getUserPrincipal();
|
||||||
// logger.info("===================================================");
|
// logger.info("===================================================");
|
||||||
LOGGER.info("== DATA retrieveDataFull ? id={} user={}", uuid, (gc == null ? "null" : gc.userByToken));
|
LOGGER.info("== DATA retrieveDataFull ? id={} user={}", uuid, (gc == null ? "null" : gc.userByToken));
|
||||||
@ -431,8 +451,10 @@ public class DataResource {
|
|||||||
|
|
||||||
final long len = to - from + 1;
|
final long len = to - from + 1;
|
||||||
final MediaStreamer streamer = new MediaStreamer(len, raf);
|
final MediaStreamer streamer = new MediaStreamer(len, raf);
|
||||||
final Response.ResponseBuilder out = Response.ok(streamer).status(Response.Status.PARTIAL_CONTENT).header("Accept-Ranges", "bytes").header("Content-Range", responseRange)
|
final Response.ResponseBuilder out = Response.ok(streamer).status(Response.Status.PARTIAL_CONTENT)
|
||||||
.header(HttpHeaders.CONTENT_LENGTH, streamer.getLenth()).header(HttpHeaders.LAST_MODIFIED, new Date(file.lastModified()));
|
.header("Accept-Ranges", "bytes").header("Content-Range", responseRange)
|
||||||
|
.header(HttpHeaders.CONTENT_LENGTH, streamer.getLenth())
|
||||||
|
.header(HttpHeaders.LAST_MODIFIED, new Date(file.lastModified()));
|
||||||
if (mimeType != null) {
|
if (mimeType != null) {
|
||||||
out.type(mimeType);
|
out.type(mimeType);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ public class MediaStreamer implements StreamingOutput {
|
|||||||
public void write(final OutputStream outputStream) {
|
public void write(final OutputStream outputStream) {
|
||||||
try {
|
try {
|
||||||
while (this.length != 0) {
|
while (this.length != 0) {
|
||||||
final int read = this.raf.read(this.buf, 0, this.buf.length > this.length ? (int) this.length : this.buf.length);
|
final int read = this.raf.read(this.buf, 0,
|
||||||
|
this.buf.length > this.length ? (int) this.length : this.buf.length);
|
||||||
try {
|
try {
|
||||||
outputStream.write(this.buf, 0, read);
|
outputStream.write(this.buf, 0, read);
|
||||||
} catch (final IOException ex) {
|
} catch (final IOException ex) {
|
||||||
|
@ -27,7 +27,8 @@ public class openApiResource extends BaseOpenApiResource {
|
|||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@Operation(hidden = true, description = "Get the OPEN-API description", tags = "SYSTEM")
|
@Operation(hidden = true, description = "Get the OPEN-API description", tags = "SYSTEM")
|
||||||
public Response getDescription(@Context final HttpHeaders headers, @Context final UriInfo uriInfo) throws Exception {
|
public Response getDescription(@Context final HttpHeaders headers, @Context final UriInfo uriInfo)
|
||||||
|
throws Exception {
|
||||||
return getOpenApi(headers, this.config, this.app, uriInfo, "json");
|
return getOpenApi(headers, this.config, this.app, uriInfo, "json");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,13 @@ public class ExceptionCatcher implements ExceptionMapper<Exception> {
|
|||||||
final RestErrorResponse ret = build(exception);
|
final RestErrorResponse ret = build(exception);
|
||||||
LOGGER.error("Error UUID={}", ret.uuid);
|
LOGGER.error("Error UUID={}", ret.uuid);
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ret).type(MediaType.APPLICATION_JSON).build();
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ret).type(MediaType.APPLICATION_JSON)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestErrorResponse build(final Exception exception) {
|
private RestErrorResponse build(final Exception exception) {
|
||||||
return new RestErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Catch Unknown Exception", exception.getMessage());
|
return new RestErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Catch Unknown Exception",
|
||||||
|
exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,13 @@ public class FailException404API implements ExceptionMapper<ClientErrorException
|
|||||||
public Response toResponse(final ClientErrorException exception) {
|
public Response toResponse(final ClientErrorException exception) {
|
||||||
final RestErrorResponse ret = build(exception);
|
final RestErrorResponse ret = build(exception);
|
||||||
LOGGER.error("Error UUID={}", ret.uuid);
|
LOGGER.error("Error UUID={}", ret.uuid);
|
||||||
return Response.status(exception.getResponse().getStatusInfo().toEnum()).entity(ret).type(MediaType.APPLICATION_JSON).build();
|
return Response.status(exception.getResponse().getStatusInfo().toEnum()).entity(ret)
|
||||||
|
.type(MediaType.APPLICATION_JSON).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestErrorResponse build(final ClientErrorException exception) {
|
private RestErrorResponse build(final ClientErrorException exception) {
|
||||||
return new RestErrorResponse(exception.getResponse().getStatusInfo().toEnum(), "Catch system exception", exception.getMessage());
|
return new RestErrorResponse(exception.getResponse().getStatusInfo().toEnum(), "Catch system exception",
|
||||||
|
exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,15 @@ public class InputExceptionCatcher implements ExceptionMapper<InputException> {
|
|||||||
public Response toResponse(final InputException exception) {
|
public Response toResponse(final InputException exception) {
|
||||||
LOGGER.warn("Catch InputException:");
|
LOGGER.warn("Catch InputException:");
|
||||||
final RestErrorResponse ret = build(exception);
|
final RestErrorResponse ret = build(exception);
|
||||||
LOGGER.error("Error UUID={} ==> '{}'=>'{}'", ret.uuid, exception.missingVariable, exception.getLocalizedMessage());
|
LOGGER.error("Error UUID={} ==> '{}'=>'{}'", ret.uuid, exception.missingVariable,
|
||||||
|
exception.getLocalizedMessage());
|
||||||
// exception.printStackTrace();
|
// exception.printStackTrace();
|
||||||
return Response.status(exception.status).entity(ret).type(MediaType.APPLICATION_JSON).build();
|
return Response.status(exception.status).entity(ret).type(MediaType.APPLICATION_JSON).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestErrorResponse build(final InputException exception) {
|
private RestErrorResponse build(final InputException exception) {
|
||||||
return new RestErrorResponse(exception.status, "Error on input='" + exception.missingVariable + "'", exception.getMessage());
|
return new RestErrorResponse(exception.status, "Error on input='" + exception.missingVariable + "'",
|
||||||
|
exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,13 @@ public class JacksonCatcher implements ExceptionMapper<JsonProcessingException>
|
|||||||
final RestErrorResponse ret = build(exception);
|
final RestErrorResponse ret = build(exception);
|
||||||
LOGGER.error("Error UUID={}", ret.uuid);
|
LOGGER.error("Error UUID={}", ret.uuid);
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ret).type(MediaType.APPLICATION_JSON).build();
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ret).type(MediaType.APPLICATION_JSON)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private RestErrorResponse build(final Exception exception) {
|
private RestErrorResponse build(final Exception exception) {
|
||||||
return new RestErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Catch JSON Exception", exception.getMessage());
|
return new RestErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Catch JSON Exception",
|
||||||
|
exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,8 @@ public class RestErrorResponse {
|
|||||||
final public int status;
|
final public int status;
|
||||||
final public String statusMessage;
|
final public String statusMessage;
|
||||||
|
|
||||||
public RestErrorResponse(final Response.Status status, final String time, final String error, final String message) {
|
public RestErrorResponse(final Response.Status status, final String time, final String error,
|
||||||
|
final String message) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.name = error;
|
this.name = error;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
@ -74,7 +74,8 @@ public class DataAccess {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDBExist(final String name, final QueryOption... option) throws InternalServerErrorException {
|
public static boolean isDBExist(final String name, final QueryOption... option)
|
||||||
|
throws InternalServerErrorException {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
if ("sqlite".equals(ConfigBaseVariable.getDBType())) {
|
if ("sqlite".equals(ConfigBaseVariable.getDBType())) {
|
||||||
// no base manage in sqLite ...
|
// no base manage in sqLite ...
|
||||||
@ -134,7 +135,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isTableExist(final String name, final QueryOption... option) throws InternalServerErrorException {
|
public static boolean isTableExist(final String name, final QueryOption... option)
|
||||||
|
throws InternalServerErrorException {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
try {
|
try {
|
||||||
String request = "";
|
String request = "";
|
||||||
@ -180,7 +182,8 @@ public class DataAccess {
|
|||||||
* @param iii Id in the result set
|
* @param iii Id in the result set
|
||||||
* @return The list of Long value
|
* @return The list of Long value
|
||||||
* @throws SQLException if an error is generated in the SQL request. */
|
* @throws SQLException if an error is generated in the SQL request. */
|
||||||
public static List<Long> getListOfIds(final ResultSet rs, final int iii, final String separator) throws SQLException {
|
public static List<Long> getListOfIds(final ResultSet rs, final int iii, final String separator)
|
||||||
|
throws SQLException {
|
||||||
final String trackString = rs.getString(iii);
|
final String trackString = rs.getString(iii);
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
return null;
|
return null;
|
||||||
@ -199,7 +202,8 @@ public class DataAccess {
|
|||||||
* @param iii Id in the result set
|
* @param iii Id in the result set
|
||||||
* @return The list of Long value
|
* @return The list of Long value
|
||||||
* @throws SQLException if an error is generated in the SQL request. */
|
* @throws SQLException if an error is generated in the SQL request. */
|
||||||
public static List<UUID> getListOfUUIDs(final ResultSet rs, final int iii, final String separator) throws SQLException {
|
public static List<UUID> getListOfUUIDs(final ResultSet rs, final int iii, final String separator)
|
||||||
|
throws SQLException {
|
||||||
final String trackString = rs.getString(iii);
|
final String trackString = rs.getString(iii);
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
return null;
|
return null;
|
||||||
@ -227,7 +231,8 @@ public class DataAccess {
|
|||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<UUID> getListOfRawUUIDs(final ResultSet rs, final int iii) throws SQLException, DataAccessException {
|
public static List<UUID> getListOfRawUUIDs(final ResultSet rs, final int iii)
|
||||||
|
throws SQLException, DataAccessException {
|
||||||
final byte[] trackString = rs.getBytes(iii);
|
final byte[] trackString = rs.getBytes(iii);
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
return null;
|
return null;
|
||||||
@ -241,7 +246,12 @@ public class DataAccess {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static <T> void setValuedb(final Class<?> type, final T data, final CountInOut iii, final Field field, final PreparedStatement ps) throws Exception {
|
protected static <T> void setValuedb(
|
||||||
|
final Class<?> type,
|
||||||
|
final T data,
|
||||||
|
final CountInOut iii,
|
||||||
|
final Field field,
|
||||||
|
final PreparedStatement ps) throws Exception {
|
||||||
if (type == UUID.class) {
|
if (type == UUID.class) {
|
||||||
final Object tmp = field.get(data);
|
final Object tmp = field.get(data);
|
||||||
if (tmp == null) {
|
if (tmp == null) {
|
||||||
@ -354,7 +364,13 @@ public class DataAccess {
|
|||||||
iii.inc();
|
iii.inc();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static <T> void setValueFromDb(final Class<?> type, final Object data, final CountInOut count, final Field field, final ResultSet rs, final CountInOut countNotNull) throws Exception {
|
protected static <T> void setValueFromDb(
|
||||||
|
final Class<?> type,
|
||||||
|
final Object data,
|
||||||
|
final CountInOut count,
|
||||||
|
final Field field,
|
||||||
|
final ResultSet rs,
|
||||||
|
final CountInOut countNotNull) throws Exception {
|
||||||
if (type == UUID.class) {
|
if (type == UUID.class) {
|
||||||
final byte[] tmp = rs.getBytes(count.value);
|
final byte[] tmp = rs.getBytes(count.value);
|
||||||
// final UUID tmp = rs.getObject(count.value, UUID.class);
|
// final UUID tmp = rs.getObject(count.value, UUID.class);
|
||||||
@ -877,7 +893,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
LOGGER.warn("generate the query: '{}'", query.toString());
|
LOGGER.warn("generate the query: '{}'", query.toString());
|
||||||
// prepare the request:
|
// prepare the request:
|
||||||
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);
|
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(),
|
||||||
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
|
|
||||||
final CountInOut iii = new CountInOut(1);
|
final CountInOut iii = new CountInOut(1);
|
||||||
UUID uuid = null;
|
UUID uuid = null;
|
||||||
@ -998,11 +1015,13 @@ public class DataAccess {
|
|||||||
return insert(data);
|
return insert(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <ID_TYPE> QueryCondition getTableIdCondition(final Class<?> clazz, final ID_TYPE idKey) throws Exception {
|
public static <ID_TYPE> QueryCondition getTableIdCondition(final Class<?> clazz, final ID_TYPE idKey)
|
||||||
|
throws Exception {
|
||||||
// Find the ID field type ....
|
// Find the ID field type ....
|
||||||
final Field idField = AnnotationTools.getIdField(clazz);
|
final Field idField = AnnotationTools.getIdField(clazz);
|
||||||
if (idField == null) {
|
if (idField == null) {
|
||||||
throw new DataAccessException("The class have no annotation @Id ==> can not determine the default type searching");
|
throw new DataAccessException(
|
||||||
|
"The class have no annotation @Id ==> can not determine the default type searching");
|
||||||
}
|
}
|
||||||
// check the compatibility of the id and the declared ID
|
// check the compatibility of the id and the declared ID
|
||||||
final Class<?> typeClass = idField.getType();
|
final Class<?> typeClass = idField.getType();
|
||||||
@ -1011,7 +1030,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
if (idKey.getClass() != typeClass) {
|
if (idKey.getClass() != typeClass) {
|
||||||
if (idKey.getClass() == Condition.class) {
|
if (idKey.getClass() == Condition.class) {
|
||||||
throw new DataAccessException("Try to identify the ID type on a condition 'close' internal API error use xxxWhere(...) instead.");
|
throw new DataAccessException(
|
||||||
|
"Try to identify the ID type on a condition 'close' internal API error use xxxWhere(...) instead.");
|
||||||
}
|
}
|
||||||
throw new DataAccessException("Request update with the wrong type ...");
|
throw new DataAccessException("Request update with the wrong type ...");
|
||||||
}
|
}
|
||||||
@ -1027,7 +1047,11 @@ public class DataAccess {
|
|||||||
* @param jsonData Json data (partial) values to update
|
* @param jsonData Json data (partial) values to update
|
||||||
* @return the number of object updated
|
* @return the number of object updated
|
||||||
* @throws Exception */
|
* @throws Exception */
|
||||||
public static <T, ID_TYPE> int updateWithJson(final Class<T> clazz, final ID_TYPE id, final String jsonData, final QueryOption... option) throws Exception {
|
public static <T, ID_TYPE> int updateWithJson(
|
||||||
|
final Class<T> clazz,
|
||||||
|
final ID_TYPE id,
|
||||||
|
final String jsonData,
|
||||||
|
final QueryOption... option) throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
final Condition condition = options.get(Condition.class);
|
final Condition condition = options.get(Condition.class);
|
||||||
if (condition != null) {
|
if (condition != null) {
|
||||||
@ -1039,7 +1063,8 @@ public class DataAccess {
|
|||||||
return updateWhereWithJson(clazz, jsonData, options.getAllArray());
|
return updateWhereWithJson(clazz, jsonData, options.getAllArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> int updateWhereWithJson(final Class<T> clazz, final String jsonData, final QueryOption... option) throws Exception {
|
public static <T> int updateWhereWithJson(final Class<T> clazz, final String jsonData, final QueryOption... option)
|
||||||
|
throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
final Condition condition = options.get(Condition.class);
|
final Condition condition = options.get(Condition.class);
|
||||||
if (condition == null) {
|
if (condition == null) {
|
||||||
@ -1067,7 +1092,11 @@ public class DataAccess {
|
|||||||
* @param filterValue
|
* @param filterValue
|
||||||
* @return the affected rows.
|
* @return the affected rows.
|
||||||
* @throws Exception */
|
* @throws Exception */
|
||||||
public static <T, ID_TYPE> int update(final T data, final ID_TYPE id, final List<String> updateColomn, final QueryOption... option) throws Exception {
|
public static <T, ID_TYPE> int update(
|
||||||
|
final T data,
|
||||||
|
final ID_TYPE id,
|
||||||
|
final List<String> updateColomn,
|
||||||
|
final QueryOption... option) throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
options.add(new Condition(getTableIdCondition(data.getClass(), id)));
|
options.add(new Condition(getTableIdCondition(data.getClass(), id)));
|
||||||
options.add(new FilterValue(updateColomn));
|
options.add(new FilterValue(updateColomn));
|
||||||
@ -1159,7 +1188,8 @@ public class DataAccess {
|
|||||||
if (!firstField) {
|
if (!firstField) {
|
||||||
LOGGER.debug("generate the query: '{}'", query.toString());
|
LOGGER.debug("generate the query: '{}'", query.toString());
|
||||||
// prepare the request:
|
// prepare the request:
|
||||||
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);
|
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(),
|
||||||
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
final CountInOut iii = new CountInOut(1);
|
final CountInOut iii = new CountInOut(1);
|
||||||
for (final Field field : clazz.getFields()) {
|
for (final Field field : clazz.getFields()) {
|
||||||
// static field is only for internal global declaration ==> remove it ..
|
// static field is only for internal global declaration ==> remove it ..
|
||||||
@ -1249,14 +1279,16 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int executeSimpleQuery(final String query, final QueryOption... option) throws SQLException, IOException {
|
public static int executeSimpleQuery(final String query, final QueryOption... option)
|
||||||
|
throws SQLException, IOException {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
||||||
final Statement stmt = entry.connection.createStatement();
|
final Statement stmt = entry.connection.createStatement();
|
||||||
return stmt.executeUpdate(query);
|
return stmt.executeUpdate(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean executeQuery(final String query, final QueryOption... option) throws SQLException, IOException {
|
public static boolean executeQuery(final String query, final QueryOption... option)
|
||||||
|
throws SQLException, IOException {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
||||||
final Statement stmt = entry.connection.createStatement();
|
final Statement stmt = entry.connection.createStatement();
|
||||||
@ -1360,7 +1392,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
LOGGER.warn("generate the query: '{}'", query.toString());
|
LOGGER.warn("generate the query: '{}'", query.toString());
|
||||||
// prepare the request:
|
// prepare the request:
|
||||||
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);
|
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(),
|
||||||
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
final CountInOut iii = new CountInOut(1);
|
final CountInOut iii = new CountInOut(1);
|
||||||
condition.injectQuery(ps, iii);
|
condition.injectQuery(ps, iii);
|
||||||
if (limit != null) {
|
if (limit != null) {
|
||||||
@ -1390,7 +1423,12 @@ public class DataAccess {
|
|||||||
return outs;
|
return outs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object createObjectFromSQLRequest(final ResultSet rs, final Class<?> clazz, final CountInOut count, final CountInOut countNotNull, final QueryOptions options,
|
public static Object createObjectFromSQLRequest(
|
||||||
|
final ResultSet rs,
|
||||||
|
final Class<?> clazz,
|
||||||
|
final CountInOut count,
|
||||||
|
final CountInOut countNotNull,
|
||||||
|
final QueryOptions options,
|
||||||
final List<LazyGetter> lazyCall) throws Exception {
|
final List<LazyGetter> lazyCall) throws Exception {
|
||||||
final boolean readAllfields = QueryOptions.readAllColomn(options);
|
final boolean readAllfields = QueryOptions.readAllColomn(options);
|
||||||
// TODO: manage class that is defined inside a class ==> Not manage for now...
|
// TODO: manage class that is defined inside a class ==> Not manage for now...
|
||||||
@ -1401,7 +1439,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
throw new DataAccessException("Can not find the default constructor for the class: " + clazz.getCanonicalName());
|
throw new DataAccessException(
|
||||||
|
"Can not find the default constructor for the class: " + clazz.getCanonicalName());
|
||||||
}
|
}
|
||||||
for (final Field elem : clazz.getFields()) {
|
for (final Field elem : clazz.getFields()) {
|
||||||
// static field is only for internal global declaration ==> remove it ..
|
// static field is only for internal global declaration ==> remove it ..
|
||||||
@ -1452,7 +1491,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
LOGGER.warn("generate the query: '{}'", query.toString());
|
LOGGER.warn("generate the query: '{}'", query.toString());
|
||||||
// prepare the request:
|
// prepare the request:
|
||||||
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);
|
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(),
|
||||||
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
final CountInOut iii = new CountInOut(1);
|
final CountInOut iii = new CountInOut(1);
|
||||||
condition.injectQuery(ps, iii);
|
condition.injectQuery(ps, iii);
|
||||||
if (limit != null) {
|
if (limit != null) {
|
||||||
@ -1475,7 +1515,8 @@ public class DataAccess {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T, ID_TYPE> T get(final Class<T> clazz, final ID_TYPE id, final QueryOption... option) throws Exception {
|
public static <T, ID_TYPE> T get(final Class<T> clazz, final ID_TYPE id, final QueryOption... option)
|
||||||
|
throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
options.add(new Condition(getTableIdCondition(clazz, id)));
|
options.add(new Condition(getTableIdCondition(clazz, id)));
|
||||||
return DataAccess.getWhere(clazz, options.getAllArray());
|
return DataAccess.getWhere(clazz, options.getAllArray());
|
||||||
@ -1499,7 +1540,8 @@ public class DataAccess {
|
|||||||
* @param id Unique Id of the model
|
* @param id Unique Id of the model
|
||||||
* @param options (Optional) Options of the request
|
* @param options (Optional) Options of the request
|
||||||
* @return Number of element that is removed. */
|
* @return Number of element that is removed. */
|
||||||
public static <ID_TYPE> int delete(final Class<?> clazz, final ID_TYPE id, final QueryOption... options) throws Exception {
|
public static <ID_TYPE> int delete(final Class<?> clazz, final ID_TYPE id, final QueryOption... options)
|
||||||
|
throws Exception {
|
||||||
final String hasDeletedFieldName = AnnotationTools.getDeletedFieldName(clazz);
|
final String hasDeletedFieldName = AnnotationTools.getDeletedFieldName(clazz);
|
||||||
if (hasDeletedFieldName != null) {
|
if (hasDeletedFieldName != null) {
|
||||||
return deleteSoft(clazz, id, options);
|
return deleteSoft(clazz, id, options);
|
||||||
@ -1523,7 +1565,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <ID_TYPE> int deleteHard(final Class<?> clazz, final ID_TYPE id, final QueryOption... option) throws Exception {
|
public static <ID_TYPE> int deleteHard(final Class<?> clazz, final ID_TYPE id, final QueryOption... option)
|
||||||
|
throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
options.add(new Condition(getTableIdCondition(clazz, id)));
|
options.add(new Condition(getTableIdCondition(clazz, id)));
|
||||||
return deleteHardWhere(clazz, options.getAllArray());
|
return deleteHardWhere(clazz, options.getAllArray());
|
||||||
@ -1555,7 +1598,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <ID_TYPE> int deleteSoft(final Class<?> clazz, final ID_TYPE id, final QueryOption... option) throws Exception {
|
private static <ID_TYPE> int deleteSoft(final Class<?> clazz, final ID_TYPE id, final QueryOption... option)
|
||||||
|
throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
options.add(new Condition(getTableIdCondition(clazz, id)));
|
options.add(new Condition(getTableIdCondition(clazz, id)));
|
||||||
return deleteSoftWhere(clazz, options.getAllArray());
|
return deleteSoftWhere(clazz, options.getAllArray());
|
||||||
@ -1596,7 +1640,8 @@ public class DataAccess {
|
|||||||
return unsetDeleteWhere(clazz, new Condition(getTableIdCondition(clazz, id)));
|
return unsetDeleteWhere(clazz, new Condition(getTableIdCondition(clazz, id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <ID_TYPE> int unsetDelete(final Class<?> clazz, final ID_TYPE id, final QueryOption... option) throws Exception {
|
public static <ID_TYPE> int unsetDelete(final Class<?> clazz, final ID_TYPE id, final QueryOption... option)
|
||||||
|
throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
options.add(new Condition(getTableIdCondition(clazz, id)));
|
options.add(new Condition(getTableIdCondition(clazz, id)));
|
||||||
return unsetDeleteWhere(clazz, options.getAllArray());
|
return unsetDeleteWhere(clazz, options.getAllArray());
|
||||||
@ -1706,12 +1751,20 @@ public class DataAccess {
|
|||||||
* @param option Optional parameters
|
* @param option Optional parameters
|
||||||
* @return The list of element requested
|
* @return The list of element requested
|
||||||
* @throws Exception */
|
* @throws Exception */
|
||||||
public static <TYPE> List<TYPE> query(final Class<TYPE> clazz, final String query, final List<Object> parameters, final QueryOption... option) throws Exception {
|
public static <TYPE> List<TYPE> query(
|
||||||
|
final Class<TYPE> clazz,
|
||||||
|
final String query,
|
||||||
|
final List<Object> parameters,
|
||||||
|
final QueryOption... option) throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
return query(clazz, query, parameters, options);
|
return query(clazz, query, parameters, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <TYPE> List<TYPE> query(final Class<TYPE> clazz, final String queryBase, final List<Object> parameters, final QueryOptions options) throws Exception {
|
public static <TYPE> List<TYPE> query(
|
||||||
|
final Class<TYPE> clazz,
|
||||||
|
final String queryBase,
|
||||||
|
final List<Object> parameters,
|
||||||
|
final QueryOptions options) throws Exception {
|
||||||
final List<LazyGetter> lazyCall = new ArrayList<>();
|
final List<LazyGetter> lazyCall = new ArrayList<>();
|
||||||
// TODO ... final String deletedFieldName = AnnotationTools.getDeletedFieldName(clazz);
|
// TODO ... final String deletedFieldName = AnnotationTools.getDeletedFieldName(clazz);
|
||||||
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
||||||
@ -1741,7 +1794,8 @@ public class DataAccess {
|
|||||||
}
|
}
|
||||||
LOGGER.warn("generate the query: '{}'", query.toString());
|
LOGGER.warn("generate the query: '{}'", query.toString());
|
||||||
// prepare the request:
|
// prepare the request:
|
||||||
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);
|
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(),
|
||||||
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
final CountInOut iii = new CountInOut(1);
|
final CountInOut iii = new CountInOut(1);
|
||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
for (final Object elem : parameters) {
|
for (final Object elem : parameters) {
|
||||||
|
@ -29,7 +29,8 @@ public interface DataAccessAddOn {
|
|||||||
* @param iii The index of injection
|
* @param iii The index of injection
|
||||||
* @return the new index of injection in case of multiple value management
|
* @return the new index of injection in case of multiple value management
|
||||||
* @throws SQLException */
|
* @throws SQLException */
|
||||||
void insertData(PreparedStatement ps, final Field field, Object data, CountInOut iii) throws Exception, SQLException, IllegalArgumentException, IllegalAccessException;
|
void insertData(PreparedStatement ps, final Field field, Object data, CountInOut iii)
|
||||||
|
throws Exception, SQLException, IllegalArgumentException, IllegalAccessException;
|
||||||
|
|
||||||
/** Element can insert in the single request
|
/** Element can insert in the single request
|
||||||
* @param field
|
* @param field
|
||||||
@ -45,19 +46,24 @@ public interface DataAccessAddOn {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generateQuery(//
|
void generateQuery(
|
||||||
@NotNull String tableName, //
|
@NotNull String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull Field field, //
|
@NotNull Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull String name, //
|
@NotNull String name,
|
||||||
@NotNull CountInOut count, //
|
@NotNull CountInOut count,
|
||||||
QueryOptions options//
|
QueryOptions options) throws Exception;
|
||||||
) throws Exception;
|
|
||||||
|
|
||||||
// Return the number of colomn read
|
// Return the number of colomn read
|
||||||
void fillFromQuery(ResultSet rs, Field field, Object data, CountInOut count, QueryOptions options, final List<LazyGetter> lazyCall)
|
void fillFromQuery(
|
||||||
|
ResultSet rs,
|
||||||
|
Field field,
|
||||||
|
Object data,
|
||||||
|
CountInOut count,
|
||||||
|
QueryOptions options,
|
||||||
|
final List<LazyGetter> lazyCall)
|
||||||
throws Exception, SQLException, IllegalArgumentException, IllegalAccessException;
|
throws Exception, SQLException, IllegalArgumentException, IllegalAccessException;
|
||||||
|
|
||||||
/** Create associated table of the specific element.
|
/** Create associated table of the specific element.
|
||||||
@ -69,17 +75,16 @@ public interface DataAccessAddOn {
|
|||||||
* @param createDrop
|
* @param createDrop
|
||||||
* @param fieldId
|
* @param fieldId
|
||||||
* @throws Exception */
|
* @throws Exception */
|
||||||
void createTables(//
|
void createTables(
|
||||||
String tableName, //
|
String tableName,
|
||||||
final Field primaryField, //
|
final Field primaryField,
|
||||||
Field field, //
|
Field field,
|
||||||
StringBuilder mainTableBuilder, //
|
StringBuilder mainTableBuilder,
|
||||||
List<String> preActionList, //
|
List<String> preActionList,
|
||||||
List<String> postActionList, //
|
List<String> postActionList,
|
||||||
boolean createIfNotExist, //
|
boolean createIfNotExist,
|
||||||
boolean createDrop, //
|
boolean createDrop,
|
||||||
int fieldId //
|
int fieldId) throws Exception;
|
||||||
) throws Exception;
|
|
||||||
|
|
||||||
/** Some action must be done asynchronously for update or remove element
|
/** Some action must be done asynchronously for update or remove element
|
||||||
* @param field
|
* @param field
|
||||||
@ -94,7 +99,12 @@ public interface DataAccessAddOn {
|
|||||||
* @param field Field that is updated.
|
* @param field Field that is updated.
|
||||||
* @param data Data that might be inserted.
|
* @param data Data that might be inserted.
|
||||||
* @param actions Asynchronous action to do after main request. */
|
* @param actions Asynchronous action to do after main request. */
|
||||||
default void asyncInsert(final String tableName, final Object localId, final Field field, final Object data, final List<LazyGetter> actions) throws Exception {
|
default void asyncInsert(
|
||||||
|
final String tableName,
|
||||||
|
final Object localId,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final List<LazyGetter> actions) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +121,12 @@ public interface DataAccessAddOn {
|
|||||||
* @param field Field that is updated.
|
* @param field Field that is updated.
|
||||||
* @param data Data that might be inserted.
|
* @param data Data that might be inserted.
|
||||||
* @param actions Asynchronous action to do after main request. */
|
* @param actions Asynchronous action to do after main request. */
|
||||||
default void asyncUpdate(final String tableName, final Object localId, final Field field, final Object data, final List<LazyGetter> actions) throws Exception {
|
default void asyncUpdate(
|
||||||
|
final String tableName,
|
||||||
|
final Object localId,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final List<LazyGetter> actions) throws Exception {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,10 @@ public class DataExport {
|
|||||||
public static final String CSV_TYPE = "text/csv";
|
public static final String CSV_TYPE = "text/csv";
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
protected static RetreiveFromDB createSetValueFromDbCallbackTable(final int count, final Class<?> type, final int id) throws Exception {
|
protected static RetreiveFromDB createSetValueFromDbCallbackTable(
|
||||||
|
final int count,
|
||||||
|
final Class<?> type,
|
||||||
|
final int id) throws Exception {
|
||||||
if (type == UUID.class) {
|
if (type == UUID.class) {
|
||||||
return (final ResultSet rs, final Object obj) -> {
|
return (final ResultSet rs, final Object obj) -> {
|
||||||
final UUID tmp = rs.getObject(count, UUID.class);
|
final UUID tmp = rs.getObject(count, UUID.class);
|
||||||
@ -228,7 +231,8 @@ public class DataExport {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getQueryPropertyId(final List<TableQueryTypes> properties, final String name) throws DataAccessException {
|
private static int getQueryPropertyId(final List<TableQueryTypes> properties, final String name)
|
||||||
|
throws DataAccessException {
|
||||||
for (int iii = 0; iii < properties.size(); iii++) {
|
for (int iii = 0; iii < properties.size(); iii++) {
|
||||||
if (properties.get(iii).name.equals(name)) {
|
if (properties.get(iii).name.equals(name)) {
|
||||||
return iii;
|
return iii;
|
||||||
@ -237,12 +241,20 @@ public class DataExport {
|
|||||||
throw new DataAccessException("Query with unknown field: '" + name + "'");
|
throw new DataAccessException("Query with unknown field: '" + name + "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TableQuery queryTable(final List<TableQueryTypes> headers, final String query, final List<Object> parameters, final QueryOption... option) throws Exception {
|
public static TableQuery queryTable(
|
||||||
|
final List<TableQueryTypes> headers,
|
||||||
|
final String query,
|
||||||
|
final List<Object> parameters,
|
||||||
|
final QueryOption... option) throws Exception {
|
||||||
final QueryOptions options = new QueryOptions(option);
|
final QueryOptions options = new QueryOptions(option);
|
||||||
return queryTable(headers, query, parameters, options);
|
return queryTable(headers, query, parameters, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TableQuery queryTable(final List<TableQueryTypes> headers, final String queryBase, final List<Object> parameters, final QueryOptions options) throws Exception {
|
public static TableQuery queryTable(
|
||||||
|
final List<TableQueryTypes> headers,
|
||||||
|
final String queryBase,
|
||||||
|
final List<Object> parameters,
|
||||||
|
final QueryOptions options) throws Exception {
|
||||||
final List<LazyGetter> lazyCall = new ArrayList<>();
|
final List<LazyGetter> lazyCall = new ArrayList<>();
|
||||||
// TODO ... final String deletedFieldName = AnnotationTools.getDeletedFieldName(clazz);
|
// TODO ... final String deletedFieldName = AnnotationTools.getDeletedFieldName(clazz);
|
||||||
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
final DBEntry entry = DBInterfaceOption.getAutoEntry(options);
|
||||||
@ -272,7 +284,8 @@ public class DataExport {
|
|||||||
}
|
}
|
||||||
LOGGER.warn("generate the query: '{}'", query.toString());
|
LOGGER.warn("generate the query: '{}'", query.toString());
|
||||||
// prepare the request:
|
// prepare the request:
|
||||||
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(), Statement.RETURN_GENERATED_KEYS);
|
final PreparedStatement ps = entry.connection.prepareStatement(query.toString(),
|
||||||
|
Statement.RETURN_GENERATED_KEYS);
|
||||||
final CountInOut iii = new CountInOut(1);
|
final CountInOut iii = new CountInOut(1);
|
||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
for (final Object elem : parameters) {
|
for (final Object elem : parameters) {
|
||||||
@ -294,7 +307,8 @@ public class DataExport {
|
|||||||
final String typeName = rsmd.getColumnTypeName(jjj + 1);
|
final String typeName = rsmd.getColumnTypeName(jjj + 1);
|
||||||
final int typeId = rsmd.getColumnType(jjj + 1);
|
final int typeId = rsmd.getColumnType(jjj + 1);
|
||||||
final int id = getQueryPropertyId(headers, label);
|
final int id = getQueryPropertyId(headers, label);
|
||||||
LOGGER.info(" - {}:{} type=[{}] {} REQUEST={}", jjj, label, typeId, typeName, headers.get(id).type.getCanonicalName());
|
LOGGER.info(" - {}:{} type=[{}] {} REQUEST={}", jjj, label, typeId, typeName,
|
||||||
|
headers.get(id).type.getCanonicalName());
|
||||||
// create the callback...
|
// create the callback...
|
||||||
final RetreiveFromDB element = createSetValueFromDbCallbackTable(jjj + 1, headers.get(id).type, id);
|
final RetreiveFromDB element = createSetValueFromDbCallbackTable(jjj + 1, headers.get(id).type, id);
|
||||||
actionToRetreive.add(element);
|
actionToRetreive.add(element);
|
||||||
@ -363,7 +377,8 @@ public class DataExport {
|
|||||||
return out.toString();
|
return out.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Response convertInResponse(final TableQuery dataOut, final String accept) throws DataAccessException, IOException {
|
public static Response convertInResponse(final TableQuery dataOut, final String accept)
|
||||||
|
throws DataAccessException, IOException {
|
||||||
if (CSV_TYPE.equals(accept)) {
|
if (CSV_TYPE.equals(accept)) {
|
||||||
// CSV serialization
|
// CSV serialization
|
||||||
String out = null;
|
String out = null;
|
||||||
|
@ -142,8 +142,16 @@ public class DataFactory {
|
|||||||
throw new DataAccessException("Imcompatible type of element in object for: " + type.getCanonicalName());
|
throw new DataAccessException("Imcompatible type of element in object for: " + type.getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createTablesSpecificType(final String tableName, final Field elem, final StringBuilder mainTableBuilder, final List<String> preOtherTables, final List<String> postOtherTables,
|
public static void createTablesSpecificType(
|
||||||
final boolean createIfNotExist, final boolean createDrop, final int fieldId, final Class<?> classModel) throws Exception {
|
final String tableName,
|
||||||
|
final Field elem,
|
||||||
|
final StringBuilder mainTableBuilder,
|
||||||
|
final List<String> preOtherTables,
|
||||||
|
final List<String> postOtherTables,
|
||||||
|
final boolean createIfNotExist,
|
||||||
|
final boolean createDrop,
|
||||||
|
final int fieldId,
|
||||||
|
final Class<?> classModel) throws Exception {
|
||||||
final String name = AnnotationTools.getFieldName(elem);
|
final String name = AnnotationTools.getFieldName(elem);
|
||||||
final int limitSize = AnnotationTools.getLimitSize(elem);
|
final int limitSize = AnnotationTools.getLimitSize(elem);
|
||||||
final boolean notNull = AnnotationTools.getColumnNotNull(elem);
|
final boolean notNull = AnnotationTools.getColumnNotNull(elem);
|
||||||
@ -372,16 +380,20 @@ public class DataFactory {
|
|||||||
LOGGER.trace(" + '{}'", elem.getName());
|
LOGGER.trace(" + '{}'", elem.getName());
|
||||||
if (DataAccess.isAddOnField(elem)) {
|
if (DataAccess.isAddOnField(elem)) {
|
||||||
final DataAccessAddOn addOn = DataAccess.findAddOnforField(elem);
|
final DataAccessAddOn addOn = DataAccess.findAddOnforField(elem);
|
||||||
LOGGER.trace("Create type for: {} ==> {} (ADD-ON)", AnnotationTools.getFieldName(elem), elem.getType());
|
LOGGER.trace("Create type for: {} ==> {} (ADD-ON)", AnnotationTools.getFieldName(elem),
|
||||||
|
elem.getType());
|
||||||
if (addOn != null) {
|
if (addOn != null) {
|
||||||
addOn.createTables(tableName, primaryField, elem, tmpOut, preActionList, postActionList, createIfNotExist, createDrop, fieldId);
|
addOn.createTables(tableName, primaryField, elem, tmpOut, preActionList, postActionList,
|
||||||
|
createIfNotExist, createDrop, fieldId);
|
||||||
} else {
|
} else {
|
||||||
throw new DataAccessException(
|
throw new DataAccessException("Element matked as add-on but add-on does not loaded: table:"
|
||||||
"Element matked as add-on but add-on does not loaded: table:" + tableName + " field name=" + AnnotationTools.getFieldName(elem) + " type=" + elem.getType());
|
+ tableName + " field name=" + AnnotationTools.getFieldName(elem) + " type="
|
||||||
|
+ elem.getType());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOGGER.trace("Create type for: {} ==> {}", AnnotationTools.getFieldName(elem), elem.getType());
|
LOGGER.trace("Create type for: {} ==> {}", AnnotationTools.getFieldName(elem), elem.getType());
|
||||||
DataFactory.createTablesSpecificType(tableName, elem, tmpOut, preActionList, postActionList, createIfNotExist, createDrop, fieldId, elem.getType());
|
DataFactory.createTablesSpecificType(tableName, elem, tmpOut, preActionList, postActionList,
|
||||||
|
createIfNotExist, createDrop, fieldId, elem.getType());
|
||||||
}
|
}
|
||||||
fieldId++;
|
fieldId++;
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,17 @@ import jakarta.ws.rs.core.Response;
|
|||||||
public class DataFactoryTsApi {
|
public class DataFactoryTsApi {
|
||||||
static final Logger LOGGER = LoggerFactory.getLogger(DataFactoryTsApi.class);
|
static final Logger LOGGER = LoggerFactory.getLogger(DataFactoryTsApi.class);
|
||||||
|
|
||||||
record APIModel(String data, String className) {
|
record APIModel(
|
||||||
}
|
String data,
|
||||||
|
String className) {}
|
||||||
|
|
||||||
/** Request the generation of the TypeScript file for the "Zod" export model
|
/** Request the generation of the TypeScript file for the "Zod" export model
|
||||||
* @param classs List of class used in the model
|
* @param classs List of class used in the model
|
||||||
* @throws Exception */
|
* @throws Exception */
|
||||||
public static List<String> createApi(final List<Class<?>> classs, final GeneratedTypes previous, final String pathPackage) throws Exception {
|
public static List<String> createApi(
|
||||||
|
final List<Class<?>> classs,
|
||||||
|
final GeneratedTypes previous,
|
||||||
|
final String pathPackage) throws Exception {
|
||||||
final List<String> apis = new ArrayList<>();
|
final List<String> apis = new ArrayList<>();
|
||||||
final String globalheader = """
|
final String globalheader = """
|
||||||
/**
|
/**
|
||||||
@ -281,7 +285,11 @@ public class DataFactoryTsApi {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static APIModel createSingleApi(final Class<?> clazz, final Set<Class<?>> includeModel, final Set<Class<?>> includeCheckerModel, final GeneratedTypes previous) throws Exception {
|
public static APIModel createSingleApi(
|
||||||
|
final Class<?> clazz,
|
||||||
|
final Set<Class<?>> includeModel,
|
||||||
|
final Set<Class<?>> includeCheckerModel,
|
||||||
|
final GeneratedTypes previous) throws Exception {
|
||||||
final StringBuilder builder = new StringBuilder();
|
final StringBuilder builder = new StringBuilder();
|
||||||
// the basic path has no specific elements...
|
// the basic path has no specific elements...
|
||||||
final String basicPath = apiAnnotationGetPath(clazz);
|
final String basicPath = apiAnnotationGetPath(clazz);
|
||||||
@ -296,7 +304,8 @@ public class DataFactoryTsApi {
|
|||||||
final String methodPath = apiAnnotationGetPath(method);
|
final String methodPath = apiAnnotationGetPath(method);
|
||||||
final String methodType = apiAnnotationGetTypeRequest(method);
|
final String methodType = apiAnnotationGetTypeRequest(method);
|
||||||
if (methodType == null) {
|
if (methodType == null) {
|
||||||
LOGGER.error(" [{}] {} => {}/{} ==> No methode type @PATH, @GET ...", methodType, methodName, basicPath, methodPath);
|
LOGGER.error(" [{}] {} => {}/{} ==> No methode type @PATH, @GET ...", methodType, methodName,
|
||||||
|
basicPath, methodPath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String methodDescription = apiAnnotationGetOperationDescription(method);
|
final String methodDescription = apiAnnotationGetOperationDescription(method);
|
||||||
@ -437,7 +446,8 @@ public class DataFactoryTsApi {
|
|||||||
builder.append("\n\t */");
|
builder.append("\n\t */");
|
||||||
}
|
}
|
||||||
if (isUnmanagedReturnType) {
|
if (isUnmanagedReturnType) {
|
||||||
builder.append("\n\t// TODO: unmanaged \"Response\" type: please specify @AsyncType or considered as 'void'.");
|
builder.append(
|
||||||
|
"\n\t// TODO: unmanaged \"Response\" type: please specify @AsyncType or considered as 'void'.");
|
||||||
}
|
}
|
||||||
builder.append("\n\texport function ");
|
builder.append("\n\texport function ");
|
||||||
builder.append(methodName);
|
builder.append(methodName);
|
||||||
@ -601,7 +611,8 @@ public class DataFactoryTsApi {
|
|||||||
builder.append("\n\t\t\tcallback,");
|
builder.append("\n\t\t\tcallback,");
|
||||||
}
|
}
|
||||||
builder.append("\n\t\t}");
|
builder.append("\n\t\t}");
|
||||||
if (tmpReturn.size() != 0 && tmpReturn.get(0).tsTypeName != null && !tmpReturn.get(0).tsTypeName.equals("void")) {
|
if (tmpReturn.size() != 0 && tmpReturn.get(0).tsTypeName != null
|
||||||
|
&& !tmpReturn.get(0).tsTypeName.equals("void")) {
|
||||||
builder.append(", ");
|
builder.append(", ");
|
||||||
// TODO: correct this it is really bad ...
|
// TODO: correct this it is really bad ...
|
||||||
builder.append(convertInTypeScriptCheckType(tmpReturn));
|
builder.append(convertInTypeScriptCheckType(tmpReturn));
|
||||||
@ -613,7 +624,10 @@ public class DataFactoryTsApi {
|
|||||||
return new APIModel(builder.toString(), classSimpleName);
|
return new APIModel(builder.toString(), classSimpleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void generatePackage(final List<Class<?>> classApi, final List<Class<?>> classModel, final String pathPackage) throws Exception {
|
public static void generatePackage(
|
||||||
|
final List<Class<?>> classApi,
|
||||||
|
final List<Class<?>> classModel,
|
||||||
|
final String pathPackage) throws Exception {
|
||||||
final GeneratedTypes previous = DataFactoryZod.createBasicType();
|
final GeneratedTypes previous = DataFactoryZod.createBasicType();
|
||||||
DataFactoryZod.createTable(RestErrorResponse.class, previous);
|
DataFactoryZod.createTable(RestErrorResponse.class, previous);
|
||||||
final List<String> listApi = createApi(classApi, previous, pathPackage);
|
final List<String> listApi = createApi(classApi, previous, pathPackage);
|
||||||
|
@ -36,7 +36,8 @@ public class DataFactoryZod {
|
|||||||
public boolean isEnum = false;
|
public boolean isEnum = false;
|
||||||
public boolean nativeType;
|
public boolean nativeType;
|
||||||
|
|
||||||
public ClassElement(final Class<?> model[], final String zodName, final String tsTypeName, final String tsCheckType, final String declaration, final boolean nativeType) {
|
public ClassElement(final Class<?> model[], final String zodName, final String tsTypeName,
|
||||||
|
final String tsCheckType, final String declaration, final boolean nativeType) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
this.zodName = zodName;
|
this.zodName = zodName;
|
||||||
this.tsTypeName = tsTypeName;
|
this.tsTypeName = tsTypeName;
|
||||||
@ -90,7 +91,8 @@ public class DataFactoryZod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClassElement convertTypeZodEnum(final Class<?> clazz, final GeneratedTypes previous) throws Exception {
|
public static ClassElement convertTypeZodEnum(final Class<?> clazz, final GeneratedTypes previous)
|
||||||
|
throws Exception {
|
||||||
final ClassElement element = new ClassElement(clazz);
|
final ClassElement element = new ClassElement(clazz);
|
||||||
previous.add(element);
|
previous.add(element);
|
||||||
final Object[] arr = clazz.getEnumConstants();
|
final Object[] arr = clazz.getEnumConstants();
|
||||||
@ -150,7 +152,8 @@ public class DataFactoryZod {
|
|||||||
return convertTypeZodEnum(type, previous).zodName;
|
return convertTypeZodEnum(type, previous).zodName;
|
||||||
}
|
}
|
||||||
if (type == List.class) {
|
if (type == List.class) {
|
||||||
throw new DataAccessException("Imcompatible type of element in object for: " + type.getCanonicalName() + " Unmanaged List of List ... ");
|
throw new DataAccessException("Imcompatible type of element in object for: " + type.getCanonicalName()
|
||||||
|
+ " Unmanaged List of List ... ");
|
||||||
}
|
}
|
||||||
final ClassElement elemCreated = createTable(type, previous);
|
final ClassElement elemCreated = createTable(type, previous);
|
||||||
if (elemCreated != null) {
|
if (elemCreated != null) {
|
||||||
@ -188,7 +191,11 @@ public class DataFactoryZod {
|
|||||||
return ".optional()";
|
return ".optional()";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createTablesSpecificType(final Field elem, final int fieldId, final StringBuilder builder, final GeneratedTypes previous) throws Exception {
|
public static void createTablesSpecificType(
|
||||||
|
final Field elem,
|
||||||
|
final int fieldId,
|
||||||
|
final StringBuilder builder,
|
||||||
|
final GeneratedTypes previous) throws Exception {
|
||||||
final String name = elem.getName();
|
final String name = elem.getName();
|
||||||
final Class<?> classModel = elem.getType();
|
final Class<?> classModel = elem.getType();
|
||||||
final int limitSize = AnnotationTools.getLimitSize(elem);
|
final int limitSize = AnnotationTools.getLimitSize(elem);
|
||||||
@ -240,21 +247,33 @@ public class DataFactoryZod {
|
|||||||
public static GeneratedTypes createBasicType() throws Exception {
|
public static GeneratedTypes createBasicType() throws Exception {
|
||||||
final GeneratedTypes previous = new GeneratedTypes();
|
final GeneratedTypes previous = new GeneratedTypes();
|
||||||
previous.add(new ClassElement(new Class<?>[] { Void.class, void.class }, "void", "void", null, null, true));
|
previous.add(new ClassElement(new Class<?>[] { Void.class, void.class }, "void", "void", null, null, true));
|
||||||
previous.add(new ClassElement(new Class<?>[] { String.class }, "zod.string()", "string", null, "zod.string()", true));
|
previous.add(new ClassElement(new Class<?>[] { String.class }, "zod.string()", "string", null, "zod.string()",
|
||||||
previous.add(new ClassElement(new Class<?>[] { InputStream.class, FormDataContentDisposition.class }, "z.instanceof(File)", "File", null, "z.instanceof(File)", true));
|
true));
|
||||||
previous.add(new ClassElement(new Class<?>[] { Boolean.class, boolean.class }, "zod.boolean()", "boolean", null, "zod.boolean()", true));
|
previous.add(new ClassElement(new Class<?>[] { InputStream.class, FormDataContentDisposition.class },
|
||||||
previous.add(new ClassElement(new Class<?>[] { UUID.class }, "ZodUUID", "UUID", "isUUID", "zod.string().uuid()", false), true);
|
"z.instanceof(File)", "File", null, "z.instanceof(File)", true));
|
||||||
|
previous.add(new ClassElement(new Class<?>[] { Boolean.class, boolean.class }, "zod.boolean()", "boolean", null,
|
||||||
|
"zod.boolean()", true));
|
||||||
|
previous.add(new ClassElement(new Class<?>[] { UUID.class }, "ZodUUID", "UUID", "isUUID", "zod.string().uuid()",
|
||||||
|
false), true);
|
||||||
previous.add(new ClassElement(new Class<?>[] { Long.class, long.class }, "ZodLong", "Long", "isLong",
|
previous.add(new ClassElement(new Class<?>[] { Long.class, long.class }, "ZodLong", "Long", "isLong",
|
||||||
// "zod.bigint()",
|
// "zod.bigint()",
|
||||||
"zod.number()", false), true);
|
"zod.number()", false), true);
|
||||||
previous.add(new ClassElement(new Class<?>[] { Integer.class, int.class }, "ZodInteger", "Integer", "isInteger", "zod.number().safe()", false), true);
|
previous.add(new ClassElement(new Class<?>[] { Integer.class, int.class }, "ZodInteger", "Integer", "isInteger",
|
||||||
previous.add(new ClassElement(new Class<?>[] { Double.class, double.class }, "ZodDouble", "Double", "isDouble", "zod.number()", true), true);
|
"zod.number().safe()", false), true);
|
||||||
previous.add(new ClassElement(new Class<?>[] { Float.class, float.class }, "ZodFloat", "Float", "isFloat", "zod.number()", false), true);
|
previous.add(new ClassElement(new Class<?>[] { Double.class, double.class }, "ZodDouble", "Double", "isDouble",
|
||||||
previous.add(new ClassElement(new Class<?>[] { Instant.class }, "ZodInstant", "Instant", "isInstant", "zod.string()", false), true);
|
"zod.number()", true), true);
|
||||||
previous.add(new ClassElement(new Class<?>[] { Date.class }, "ZodDate", "Date", "isDate", "zod.date()", false), true);
|
previous.add(new ClassElement(new Class<?>[] { Float.class, float.class }, "ZodFloat", "Float", "isFloat",
|
||||||
previous.add(new ClassElement(new Class<?>[] { Timestamp.class }, "ZodTimestamp", "Timestamp", "isTimestamp", "zod.date()", false), true);
|
"zod.number()", false), true);
|
||||||
previous.add(new ClassElement(new Class<?>[] { LocalDate.class }, "ZodLocalDate", "LocalDate", "isLocalDate", "zod.date()", false), true);
|
previous.add(new ClassElement(new Class<?>[] { Instant.class }, "ZodInstant", "Instant", "isInstant",
|
||||||
previous.add(new ClassElement(new Class<?>[] { LocalTime.class }, "ZodLocalTime", "LocalTime", "isLocalTime", "zod.date()", false), true);
|
"zod.string()", false), true);
|
||||||
|
previous.add(new ClassElement(new Class<?>[] { Date.class }, "ZodDate", "Date", "isDate", "zod.date()", false),
|
||||||
|
true);
|
||||||
|
previous.add(new ClassElement(new Class<?>[] { Timestamp.class }, "ZodTimestamp", "Timestamp", "isTimestamp",
|
||||||
|
"zod.date()", false), true);
|
||||||
|
previous.add(new ClassElement(new Class<?>[] { LocalDate.class }, "ZodLocalDate", "LocalDate", "isLocalDate",
|
||||||
|
"zod.date()", false), true);
|
||||||
|
previous.add(new ClassElement(new Class<?>[] { LocalTime.class }, "ZodLocalTime", "LocalTime", "isLocalTime",
|
||||||
|
"zod.date()", false), true);
|
||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,7 +312,8 @@ public class DataFactoryZod {
|
|||||||
return generatedData.toString();
|
return generatedData.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ClassElement> createTables(final Class<?>[] classs, final GeneratedTypes previous) throws Exception {
|
public static List<ClassElement> createTables(final Class<?>[] classs, final GeneratedTypes previous)
|
||||||
|
throws Exception {
|
||||||
final List<ClassElement> out = new ArrayList<>();
|
final List<ClassElement> out = new ArrayList<>();
|
||||||
for (final Class<?> clazz : classs) {
|
for (final Class<?> clazz : classs) {
|
||||||
if (clazz == Response.class) {
|
if (clazz == Response.class) {
|
||||||
@ -344,7 +364,8 @@ public class DataFactoryZod {
|
|||||||
LOGGER.trace(" + '{}'", elem.getName());
|
LOGGER.trace(" + '{}'", elem.getName());
|
||||||
if (false && DataAccess.isAddOnField(elem)) {
|
if (false && DataAccess.isAddOnField(elem)) {
|
||||||
final DataAccessAddOn addOn = DataAccess.findAddOnforField(elem);
|
final DataAccessAddOn addOn = DataAccess.findAddOnforField(elem);
|
||||||
LOGGER.error("Create type for: {} ==> {} (ADD-ON) ==> Not managed now ....", AnnotationTools.getFieldName(elem), elem.getType());
|
LOGGER.error("Create type for: {} ==> {} (ADD-ON) ==> Not managed now ....",
|
||||||
|
AnnotationTools.getFieldName(elem), elem.getType());
|
||||||
/* LOGGER.trace("Create type for: {} ==> {} (ADD-ON)", AnnotationTools.getFieldName(elem), elem.getType()); if (addOn != null) { addOn.createTables(tableName, elem, tmpOut,
|
/* LOGGER.trace("Create type for: {} ==> {} (ADD-ON)", AnnotationTools.getFieldName(elem), elem.getType()); if (addOn != null) { addOn.createTables(tableName, elem, tmpOut,
|
||||||
* preActionList, postActionList, createIfNotExist, createDrop, fieldId); } else { throw new DataAccessException( "Element matked as add-on but add-on does not loaded: table:" +
|
* preActionList, postActionList, createIfNotExist, createDrop, fieldId); } else { throw new DataAccessException( "Element matked as add-on but add-on does not loaded: table:" +
|
||||||
* tableName + " field name=" + AnnotationTools.getFieldName(elem) + " type=" + elem.getType()); } fieldId++; */
|
* tableName + " field name=" + AnnotationTools.getFieldName(elem) + " type=" + elem.getType()); } fieldId++; */
|
||||||
|
@ -52,7 +52,8 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii) throws Exception {
|
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii)
|
||||||
|
throws Exception {
|
||||||
final Object data = field.get(rootObject);
|
final Object data = field.get(rootObject);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
ps.setNull(iii.value, Types.VARCHAR);
|
ps.setNull(iii.value, Types.VARCHAR);
|
||||||
@ -79,16 +80,15 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateQuery(//
|
public void generateQuery(
|
||||||
@NotNull final String tableName, //
|
@NotNull final String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull final Field field, //
|
@NotNull final Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull final String name, //
|
@NotNull final String name,
|
||||||
@NotNull final CountInOut count, //
|
@NotNull final CountInOut count,
|
||||||
final QueryOptions options//
|
final QueryOptions options) throws Exception {
|
||||||
) throws Exception {
|
|
||||||
querySelect.append(" ");
|
querySelect.append(" ");
|
||||||
querySelect.append(tableName);
|
querySelect.append(tableName);
|
||||||
querySelect.append(".");
|
querySelect.append(".");
|
||||||
@ -98,7 +98,13 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFromQuery(final ResultSet rs, final Field field, final Object data, final CountInOut count, final QueryOptions options, final List<LazyGetter> lazyCall) throws Exception {
|
public void fillFromQuery(
|
||||||
|
final ResultSet rs,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final CountInOut count,
|
||||||
|
final QueryOptions options,
|
||||||
|
final List<LazyGetter> lazyCall) throws Exception {
|
||||||
final String jsonData = rs.getString(count.value);
|
final String jsonData = rs.getString(count.value);
|
||||||
count.inc();
|
count.inc();
|
||||||
if (!rs.wasNull()) {
|
if (!rs.wasNull()) {
|
||||||
@ -149,23 +155,25 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTables(//
|
public void createTables(
|
||||||
final String tableName, //
|
final String tableName,
|
||||||
final Field primaryField, //
|
final Field primaryField,
|
||||||
final Field field, //
|
final Field field,
|
||||||
final StringBuilder mainTableBuilder, //
|
final StringBuilder mainTableBuilder,
|
||||||
final List<String> preActionList, //
|
final List<String> preActionList,
|
||||||
final List<String> postActionList, //
|
final List<String> postActionList,
|
||||||
final boolean createIfNotExist, //
|
final boolean createIfNotExist,
|
||||||
final boolean createDrop, //
|
final boolean createDrop,
|
||||||
final int fieldId //
|
final int fieldId) throws Exception {
|
||||||
) throws Exception {
|
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList,
|
||||||
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, JsonValue.class);
|
createIfNotExist, createDrop, fieldId, JsonValue.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id, new OverrideTableName(tableName));
|
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
data.covers = new ArrayList<>();
|
data.covers = new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -178,9 +186,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final Long id, final String column, final UUID remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final Long id, final String column, final UUID remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongUUID data = DataAccess.get(TableCoversLongUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversLongUUID data = DataAccess.get(TableCoversLongUUID.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
data.covers = new ArrayList<>();
|
data.covers = new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -193,9 +203,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
data.covers = new ArrayList<>();
|
data.covers = new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -208,9 +220,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
data.covers = new ArrayList<>();
|
data.covers = new ArrayList<>();
|
||||||
}
|
}
|
||||||
@ -223,9 +237,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final Long remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDLong data = DataAccess.get(TableCoversUUIDLong.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -240,9 +256,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final UUID id, final String column, final UUID remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversUUIDUUID data = DataAccess.get(TableCoversUUIDUUID.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -257,9 +275,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final Long id, final String column, final Long remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id, new OverrideTableName(tableName));
|
final TableCoversLongLong data = DataAccess.get(TableCoversLongLong.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -274,9 +294,11 @@ public class AddOnDataJson implements DataAccessAddOn {
|
|||||||
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
DataAccess.update(data, data.id, List.of("covers"), new OverrideTableName(tableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeLink(final Class<?> clazz, final Long id, final String column, final UUID remoteKey) throws Exception {
|
public static void removeLink(final Class<?> clazz, final Long id, final String column, final UUID remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final TableCoversLongUUID data = DataAccess.get(TableCoversLongUUID.class, id, new OverrideTableName(tableName));
|
final TableCoversLongUUID data = DataAccess.get(TableCoversLongUUID.class, id,
|
||||||
|
new OverrideTableName(tableName));
|
||||||
if (data.covers == null) {
|
if (data.covers == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,8 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii) throws SQLException, IllegalArgumentException, IllegalAccessException {
|
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii)
|
||||||
|
throws SQLException, IllegalArgumentException, IllegalAccessException {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +71,8 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
if (field.getType() != List.class) {
|
if (field.getType() != List.class) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass == Long.class || objectClass == UUID.class) {
|
if (objectClass == Long.class || objectClass == UUID.class) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -97,18 +99,18 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
return tableName + "_link_" + localName;
|
return tableName + "_link_" + localName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateConcatQuery(//
|
public void generateConcatQuery(
|
||||||
@NotNull final String tableName, //
|
@NotNull final String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull final Field field, //
|
@NotNull final Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull final String name, //
|
@NotNull final String name,
|
||||||
@NotNull final CountInOut count, //
|
@NotNull final CountInOut count,
|
||||||
final QueryOptions options//
|
final QueryOptions options) throws Exception {
|
||||||
) throws Exception {
|
|
||||||
final String linkTableName = generateLinkTableName(tableName, name);
|
final String linkTableName = generateLinkTableName(tableName, name);
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
final String tmpVariable = "tmp_" + Integer.toString(count.value);
|
final String tmpVariable = "tmp_" + Integer.toString(count.value);
|
||||||
querySelect.append(" (SELECT GROUP_CONCAT(");
|
querySelect.append(" (SELECT GROUP_CONCAT(");
|
||||||
querySelect.append(tmpVariable);
|
querySelect.append(tmpVariable);
|
||||||
@ -154,20 +156,20 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateQuery(//
|
public void generateQuery(
|
||||||
@NotNull final String tableName, //
|
@NotNull final String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull final Field field, //
|
@NotNull final Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull final String name, //
|
@NotNull final String name,
|
||||||
@NotNull final CountInOut count, //
|
@NotNull final CountInOut count,
|
||||||
final QueryOptions options//
|
final QueryOptions options) throws Exception {
|
||||||
) throws Exception {
|
|
||||||
if (field.getType() != List.class) {
|
if (field.getType() != List.class) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass == Long.class || objectClass == UUID.class) {
|
if (objectClass == Long.class || objectClass == UUID.class) {
|
||||||
generateConcatQuery(tableName, primaryKey, field, querySelect, query, name, count, options);
|
generateConcatQuery(tableName, primaryKey, field, querySelect, query, name, count, options);
|
||||||
}
|
}
|
||||||
@ -185,19 +187,19 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFromQuery( //
|
public void fillFromQuery(
|
||||||
final ResultSet rs, //
|
final ResultSet rs,
|
||||||
final Field field, //
|
final Field field,
|
||||||
final Object data, //
|
final Object data,
|
||||||
final CountInOut count, //
|
final CountInOut count,
|
||||||
final QueryOptions options, //
|
final QueryOptions options,
|
||||||
final List<LazyGetter> lazyCall //
|
final List<LazyGetter> lazyCall) throws Exception {
|
||||||
) throws Exception {
|
|
||||||
if (field.getType() != List.class) {
|
if (field.getType() != List.class) {
|
||||||
LOGGER.error("Can not ManyToMany with other than List Model: {}", field.getType().getCanonicalName());
|
LOGGER.error("Can not ManyToMany with other than List Model: {}", field.getType().getCanonicalName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass == Long.class) {
|
if (objectClass == Long.class) {
|
||||||
final List<Long> idList = DataAccess.getListOfIds(rs, count.value, SEPARATOR_LONG);
|
final List<Long> idList = DataAccess.getListOfIds(rs, count.value, SEPARATOR_LONG);
|
||||||
field.set(data, idList);
|
field.set(data, idList);
|
||||||
@ -228,7 +230,8 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
final List<Long> childs = new ArrayList<>(idList);
|
final List<Long> childs = new ArrayList<>(idList);
|
||||||
// TODO: update to have get with abstract types ....
|
// TODO: update to have get with abstract types ....
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Object foreignData = DataAccess.getsWhere(decorators.targetEntity(), new Condition(new QueryInList<>(idField, childs)));
|
final Object foreignData = DataAccess.getsWhere(decorators.targetEntity(),
|
||||||
|
new Condition(new QueryInList<>(idField, childs)));
|
||||||
if (foreignData == null) {
|
if (foreignData == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -247,7 +250,8 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
final List<UUID> childs = new ArrayList<>(idList);
|
final List<UUID> childs = new ArrayList<>(idList);
|
||||||
// TODO: update to have get with abstract types ....
|
// TODO: update to have get with abstract types ....
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
final Object foreignData = DataAccess.getsWhere(decorators.targetEntity(), new Condition(new QueryInList<>(idField, childs)));
|
final Object foreignData = DataAccess.getsWhere(decorators.targetEntity(),
|
||||||
|
new Condition(new QueryInList<>(idField, childs)));
|
||||||
if (foreignData == null) {
|
if (foreignData == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -265,14 +269,21 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void asyncUpdate(final String tableName, final Object localKey, final Field field, final Object data, final List<LazyGetter> actions) throws Exception {
|
public void asyncUpdate(
|
||||||
|
final String tableName,
|
||||||
|
final Object localKey,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final List<LazyGetter> actions) throws Exception {
|
||||||
if (field.getType() != List.class) {
|
if (field.getType() != List.class) {
|
||||||
LOGGER.error("Can not ManyToMany with other than List Model: {}", field.getType().getCanonicalName());
|
LOGGER.error("Can not ManyToMany with other than List Model: {}", field.getType().getCanonicalName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass != Long.class && objectClass != UUID.class) {
|
if (objectClass != Long.class && objectClass != UUID.class) {
|
||||||
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<" + objectClass.getCanonicalName() + ">");
|
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<"
|
||||||
|
+ objectClass.getCanonicalName() + ">");
|
||||||
}
|
}
|
||||||
final String columnName = AnnotationTools.getFieldName(field);
|
final String columnName = AnnotationTools.getFieldName(field);
|
||||||
final String linkTableName = generateLinkTableName(tableName, columnName);
|
final String linkTableName = generateLinkTableName(tableName, columnName);
|
||||||
@ -280,24 +291,28 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
if (localKey instanceof final Long localKeyLong) {
|
if (localKey instanceof final Long localKeyLong) {
|
||||||
if (objectClass == Long.class) {
|
if (objectClass == Long.class) {
|
||||||
actions.add(() -> {
|
actions.add(() -> {
|
||||||
DataAccess.deleteWhere(LinkTableLongLong.class, new OverrideTableName(linkTableName), new Condition(new QueryCondition("object1Id", "=", localKeyLong)));
|
DataAccess.deleteWhere(LinkTableLongLong.class, new OverrideTableName(linkTableName),
|
||||||
|
new Condition(new QueryCondition("object1Id", "=", localKeyLong)));
|
||||||
});
|
});
|
||||||
asyncInsert(tableName, localKey, field, data, actions);
|
asyncInsert(tableName, localKey, field, data, actions);
|
||||||
} else {
|
} else {
|
||||||
actions.add(() -> {
|
actions.add(() -> {
|
||||||
DataAccess.deleteWhere(LinkTableLongUUID.class, new OverrideTableName(linkTableName), new Condition(new QueryCondition("object1Id", "=", localKeyLong)));
|
DataAccess.deleteWhere(LinkTableLongUUID.class, new OverrideTableName(linkTableName),
|
||||||
|
new Condition(new QueryCondition("object1Id", "=", localKeyLong)));
|
||||||
});
|
});
|
||||||
asyncInsert(tableName, localKey, field, data, actions);
|
asyncInsert(tableName, localKey, field, data, actions);
|
||||||
}
|
}
|
||||||
} else if (localKey instanceof final UUID localKeyUUID) {
|
} else if (localKey instanceof final UUID localKeyUUID) {
|
||||||
if (objectClass == Long.class) {
|
if (objectClass == Long.class) {
|
||||||
actions.add(() -> {
|
actions.add(() -> {
|
||||||
DataAccess.deleteWhere(LinkTableUUIDLong.class, new OverrideTableName(linkTableName), new Condition(new QueryCondition("object1Id", "=", localKeyUUID)));
|
DataAccess.deleteWhere(LinkTableUUIDLong.class, new OverrideTableName(linkTableName),
|
||||||
|
new Condition(new QueryCondition("object1Id", "=", localKeyUUID)));
|
||||||
});
|
});
|
||||||
asyncInsert(tableName, localKey, field, data, actions);
|
asyncInsert(tableName, localKey, field, data, actions);
|
||||||
} else {
|
} else {
|
||||||
actions.add(() -> {
|
actions.add(() -> {
|
||||||
DataAccess.deleteWhere(LinkTableUUIDUUID.class, new OverrideTableName(linkTableName), new Condition(new QueryCondition("object1Id", "=", localKeyUUID)));
|
DataAccess.deleteWhere(LinkTableUUIDUUID.class, new OverrideTableName(linkTableName),
|
||||||
|
new Condition(new QueryCondition("object1Id", "=", localKeyUUID)));
|
||||||
});
|
});
|
||||||
asyncInsert(tableName, localKey, field, data, actions);
|
asyncInsert(tableName, localKey, field, data, actions);
|
||||||
}
|
}
|
||||||
@ -310,7 +325,12 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void asyncInsert(final String tableName, final Object localKey, final Field field, final Object data, final List<LazyGetter> actions) throws Exception {
|
public void asyncInsert(
|
||||||
|
final String tableName,
|
||||||
|
final Object localKey,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final List<LazyGetter> actions) throws Exception {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -318,9 +338,11 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
LOGGER.error("Can not ManyToMany with other than List Model: {}", field.getType().getCanonicalName());
|
LOGGER.error("Can not ManyToMany with other than List Model: {}", field.getType().getCanonicalName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass != Long.class && objectClass != UUID.class) {
|
if (objectClass != Long.class && objectClass != UUID.class) {
|
||||||
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<" + objectClass.getCanonicalName() + ">");
|
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<"
|
||||||
|
+ objectClass.getCanonicalName() + ">");
|
||||||
}
|
}
|
||||||
final String columnName = AnnotationTools.getFieldName(field);
|
final String columnName = AnnotationTools.getFieldName(field);
|
||||||
final String linkTableName = generateLinkTableName(tableName, columnName);
|
final String linkTableName = generateLinkTableName(tableName, columnName);
|
||||||
@ -421,7 +443,8 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new DataAccessException("Not manage access of remte key like ManyToMany other than Long or UUID: " + localKey.getClass().getCanonicalName());
|
throw new DataAccessException("Not manage access of remte key like ManyToMany other than Long or UUID: "
|
||||||
|
+ localKey.getClass().getCanonicalName());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -430,9 +453,11 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
public void drop(final String tableName, final Field field) throws Exception {
|
public void drop(final String tableName, final Field field) throws Exception {
|
||||||
final String columnName = AnnotationTools.getFieldName(field);
|
final String columnName = AnnotationTools.getFieldName(field);
|
||||||
final String linkTableName = generateLinkTableName(tableName, columnName);
|
final String linkTableName = generateLinkTableName(tableName, columnName);
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass != Long.class && objectClass != UUID.class) {
|
if (objectClass != Long.class && objectClass != UUID.class) {
|
||||||
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<" + objectClass.getCanonicalName() + ">");
|
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<"
|
||||||
|
+ objectClass.getCanonicalName() + ">");
|
||||||
}
|
}
|
||||||
DataAccess.drop(LinkTableLongLong.class, new OverrideTableName(linkTableName));
|
DataAccess.drop(LinkTableLongLong.class, new OverrideTableName(linkTableName));
|
||||||
}
|
}
|
||||||
@ -441,14 +466,17 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
public void cleanAll(final String tableName, final Field field) throws Exception {
|
public void cleanAll(final String tableName, final Field field) throws Exception {
|
||||||
final String columnName = AnnotationTools.getFieldName(field);
|
final String columnName = AnnotationTools.getFieldName(field);
|
||||||
final String linkTableName = generateLinkTableName(tableName, columnName);
|
final String linkTableName = generateLinkTableName(tableName, columnName);
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass != Long.class && objectClass != UUID.class) {
|
if (objectClass != Long.class && objectClass != UUID.class) {
|
||||||
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<" + objectClass.getCanonicalName() + ">");
|
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<"
|
||||||
|
+ objectClass.getCanonicalName() + ">");
|
||||||
}
|
}
|
||||||
DataAccess.cleanAll(LinkTableLongLong.class, new OverrideTableName(linkTableName));
|
DataAccess.cleanAll(LinkTableLongLong.class, new OverrideTableName(linkTableName));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addLink(final Class<?> clazz, final long localKey, final String column, final long remoteKey) throws Exception {
|
public static void addLink(final Class<?> clazz, final long localKey, final String column, final long remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final String linkTableName = generateLinkTableName(tableName, column);
|
final String linkTableName = generateLinkTableName(tableName, column);
|
||||||
/* final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]; if (objectClass != Long.class && objectClass != UUID.class) { throw new
|
/* final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]; if (objectClass != Long.class && objectClass != UUID.class) { throw new
|
||||||
@ -458,30 +486,33 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int removeLink(final Class<?> clazz, final long localKey, final String column, final long remoteKey) throws Exception {
|
public static int removeLink(final Class<?> clazz, final long localKey, final String column, final long remoteKey)
|
||||||
|
throws Exception {
|
||||||
final String tableName = AnnotationTools.getTableName(clazz);
|
final String tableName = AnnotationTools.getTableName(clazz);
|
||||||
final String linkTableName = generateLinkTableName(tableName, column);
|
final String linkTableName = generateLinkTableName(tableName, column);
|
||||||
return DataAccess.deleteWhere(LinkTableLongLong.class, new OverrideTableName(linkTableName),
|
return DataAccess.deleteWhere(LinkTableLongLong.class, new OverrideTableName(linkTableName),
|
||||||
new Condition(new QueryAnd(new QueryCondition("object1Id", "=", localKey), new QueryCondition("object2Id", "=", remoteKey))));
|
new Condition(new QueryAnd(new QueryCondition("object1Id", "=", localKey),
|
||||||
|
new QueryCondition("object2Id", "=", remoteKey))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTables( //
|
public void createTables(
|
||||||
final String tableName, //
|
final String tableName,
|
||||||
final Field primaryField, //
|
final Field primaryField,
|
||||||
final Field field, //
|
final Field field,
|
||||||
final StringBuilder mainTableBuilder, //
|
final StringBuilder mainTableBuilder,
|
||||||
final List<String> preActionList, //
|
final List<String> preActionList,
|
||||||
final List<String> postActionList, //
|
final List<String> postActionList,
|
||||||
final boolean createIfNotExist, //
|
final boolean createIfNotExist,
|
||||||
final boolean createDrop, //
|
final boolean createDrop,
|
||||||
final int fieldId//
|
final int fieldId) throws Exception {
|
||||||
) throws Exception {
|
|
||||||
final String linkTableName = generateLinkTableNameField(tableName, field);
|
final String linkTableName = generateLinkTableNameField(tableName, field);
|
||||||
final QueryOptions options = new QueryOptions(new OverrideTableName(linkTableName));
|
final QueryOptions options = new QueryOptions(new OverrideTableName(linkTableName));
|
||||||
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
|
final Class<?> objectClass = (Class<?>) ((ParameterizedType) field.getGenericType())
|
||||||
|
.getActualTypeArguments()[0];
|
||||||
if (objectClass != Long.class && objectClass != UUID.class) {
|
if (objectClass != Long.class && objectClass != UUID.class) {
|
||||||
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<" + objectClass.getCanonicalName() + ">");
|
throw new DataAccessException("Can not ManyToMany with other than List<Long> or List<UUID> Model: List<"
|
||||||
|
+ objectClass.getCanonicalName() + ">");
|
||||||
}
|
}
|
||||||
final Class<?> primaryType = primaryField.getType();
|
final Class<?> primaryType = primaryField.getType();
|
||||||
if (primaryType == Long.class) {
|
if (primaryType == Long.class) {
|
||||||
@ -502,7 +533,8 @@ public class AddOnManyToMany implements DataAccessAddOn {
|
|||||||
postActionList.addAll(sqlCommand);
|
postActionList.addAll(sqlCommand);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new DataAccessException("Can not ManyToMany with other than primary key type Long or UUID Model: " + primaryType.getCanonicalName());
|
throw new DataAccessException("Can not ManyToMany with other than primary key type Long or UUID Model: "
|
||||||
|
+ primaryType.getCanonicalName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii) throws Exception {
|
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii)
|
||||||
|
throws Exception {
|
||||||
final Object data = field.get(rootObject);
|
final Object data = field.get(rootObject);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
if (field.getType() == Long.class) {
|
if (field.getType() == Long.class) {
|
||||||
@ -95,11 +96,8 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsert(final Field field) {
|
public boolean canInsert(final Field field) {
|
||||||
if (field.getType() == Long.class //
|
if (field.getType() == Long.class || field.getType() == Integer.class || field.getType() == Short.class
|
||||||
|| field.getType() == Integer.class //
|
|| field.getType() == String.class || field.getType() == UUID.class) {
|
||||||
|| field.getType() == Short.class //
|
|
||||||
|| field.getType() == String.class //
|
|
||||||
|| field.getType() == UUID.class) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final ManyToOne decorators = field.getDeclaredAnnotation(ManyToOne.class);
|
final ManyToOne decorators = field.getDeclaredAnnotation(ManyToOne.class);
|
||||||
@ -117,11 +115,8 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canRetrieve(final Field field) {
|
public boolean canRetrieve(final Field field) {
|
||||||
final Class<?> classType = field.getType();
|
final Class<?> classType = field.getType();
|
||||||
if (classType == Long.class //
|
if (classType == Long.class || classType == Integer.class || classType == Short.class
|
||||||
|| classType == Integer.class //
|
|| classType == String.class || classType == UUID.class) {
|
||||||
|| classType == Short.class //
|
|
||||||
|| classType == String.class //
|
|
||||||
|| classType == UUID.class) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final ManyToOne decorators = field.getDeclaredAnnotation(ManyToOne.class);
|
final ManyToOne decorators = field.getDeclaredAnnotation(ManyToOne.class);
|
||||||
@ -132,21 +127,17 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateQuery(//
|
public void generateQuery(
|
||||||
@NotNull final String tableName, //
|
@NotNull final String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull final Field field, //
|
@NotNull final Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull final String name, //
|
@NotNull final String name,
|
||||||
@NotNull final CountInOut count, //
|
@NotNull final CountInOut count,
|
||||||
final QueryOptions options//
|
final QueryOptions options) throws Exception {
|
||||||
) throws Exception {
|
if (field.getType() == Long.class || field.getType() == Integer.class || field.getType() == Short.class
|
||||||
if (field.getType() == Long.class //
|
|| field.getType() == String.class || field.getType() == UUID.class) {
|
||||||
|| field.getType() == Integer.class //
|
|
||||||
|| field.getType() == Short.class //
|
|
||||||
|| field.getType() == String.class //
|
|
||||||
|| field.getType() == UUID.class) {
|
|
||||||
querySelect.append(" ");
|
querySelect.append(" ");
|
||||||
querySelect.append(tableName);
|
querySelect.append(tableName);
|
||||||
querySelect.append(".");
|
querySelect.append(".");
|
||||||
@ -186,7 +177,13 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFromQuery(final ResultSet rs, final Field field, final Object data, final CountInOut count, final QueryOptions options, final List<LazyGetter> lazyCall) throws Exception {
|
public void fillFromQuery(
|
||||||
|
final ResultSet rs,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final CountInOut count,
|
||||||
|
final QueryOptions options,
|
||||||
|
final List<LazyGetter> lazyCall) throws Exception {
|
||||||
if (field.getType() == Long.class) {
|
if (field.getType() == Long.class) {
|
||||||
final Long foreignKey = rs.getLong(count.value);
|
final Long foreignKey = rs.getLong(count.value);
|
||||||
count.inc();
|
count.inc();
|
||||||
@ -236,7 +233,8 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
if (objectClass == decorators.targetEntity()) {
|
if (objectClass == decorators.targetEntity()) {
|
||||||
if (decorators.fetch() == FetchType.EAGER) {
|
if (decorators.fetch() == FetchType.EAGER) {
|
||||||
final CountInOut countNotNull = new CountInOut(0);
|
final CountInOut countNotNull = new CountInOut(0);
|
||||||
final Object dataNew = DataAccess.createObjectFromSQLRequest(rs, objectClass, count, countNotNull, options, lazyCall);
|
final Object dataNew = DataAccess.createObjectFromSQLRequest(rs, objectClass, count, countNotNull,
|
||||||
|
options, lazyCall);
|
||||||
if (dataNew != null && countNotNull.value != 0) {
|
if (dataNew != null && countNotNull.value != 0) {
|
||||||
field.set(data, dataNew);
|
field.set(data, dataNew);
|
||||||
}
|
}
|
||||||
@ -262,27 +260,25 @@ public class AddOnManyToOne implements DataAccessAddOn {
|
|||||||
|
|
||||||
// TODO : refacto this table to manage a generic table with dynamic name to be serialisable with the default system
|
// TODO : refacto this table to manage a generic table with dynamic name to be serialisable with the default system
|
||||||
@Override
|
@Override
|
||||||
public void createTables(//
|
public void createTables(
|
||||||
final String tableName, //
|
final String tableName,
|
||||||
final Field primaryField, //
|
final Field primaryField,
|
||||||
final Field field, //
|
final Field field,
|
||||||
final StringBuilder mainTableBuilder, //
|
final StringBuilder mainTableBuilder,
|
||||||
final List<String> preActionList, //
|
final List<String> preActionList,
|
||||||
final List<String> postActionList, //
|
final List<String> postActionList,
|
||||||
final boolean createIfNotExist, //
|
final boolean createIfNotExist,
|
||||||
final boolean createDrop, //
|
final boolean createDrop,
|
||||||
final int fieldId //
|
final int fieldId) throws Exception {
|
||||||
) throws Exception {
|
|
||||||
final Class<?> classType = field.getType();
|
final Class<?> classType = field.getType();
|
||||||
if (classType == Long.class //
|
if (classType == Long.class || classType == Integer.class || classType == Short.class
|
||||||
|| classType == Integer.class //
|
|| classType == String.class || classType == UUID.class) {
|
||||||
|| classType == Short.class //
|
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList,
|
||||||
|| classType == String.class //
|
createIfNotExist, createDrop, fieldId, classType);
|
||||||
|| classType == UUID.class) {
|
|
||||||
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, classType);
|
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Support only the Long remote field of ecternal primary keys...");
|
LOGGER.error("Support only the Long remote field of ecternal primary keys...");
|
||||||
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, Long.class);
|
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList,
|
||||||
|
createIfNotExist, createDrop, fieldId, Long.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,8 @@ public class AddOnOneToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii) throws SQLException, IllegalArgumentException, IllegalAccessException {
|
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii)
|
||||||
|
throws SQLException, IllegalArgumentException, IllegalAccessException {
|
||||||
final Object data = field.get(rootObject);
|
final Object data = field.get(rootObject);
|
||||||
iii.inc();
|
iii.inc();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@ -103,16 +104,15 @@ public class AddOnOneToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateQuery(//
|
public void generateQuery(
|
||||||
@NotNull final String tableName, //
|
@NotNull final String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull final Field field, //
|
@NotNull final Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull final String name, //
|
@NotNull final String name,
|
||||||
@NotNull final CountInOut count, //
|
@NotNull final CountInOut count,
|
||||||
final QueryOptions options//
|
final QueryOptions options) {
|
||||||
) {
|
|
||||||
querySelect.append(" ");
|
querySelect.append(" ");
|
||||||
querySelect.append(tableName);
|
querySelect.append(tableName);
|
||||||
querySelect.append(".");
|
querySelect.append(".");
|
||||||
@ -121,8 +121,13 @@ public class AddOnOneToMany implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFromQuery(final ResultSet rs, final Field field, final Object data, final CountInOut count, final QueryOptions options, final List<LazyGetter> lazyCall)
|
public void fillFromQuery(
|
||||||
throws SQLException, IllegalArgumentException, IllegalAccessException {
|
final ResultSet rs,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final CountInOut count,
|
||||||
|
final QueryOptions options,
|
||||||
|
final List<LazyGetter> lazyCall) throws SQLException, IllegalArgumentException, IllegalAccessException {
|
||||||
final Long foreignKey = rs.getLong(count.value);
|
final Long foreignKey = rs.getLong(count.value);
|
||||||
count.inc();
|
count.inc();
|
||||||
if (!rs.wasNull()) {
|
if (!rs.wasNull()) {
|
||||||
@ -133,17 +138,17 @@ public class AddOnOneToMany implements DataAccessAddOn {
|
|||||||
|
|
||||||
// TODO : refacto this table to manage a generic table with dynamic name to be serializable with the default system
|
// TODO : refacto this table to manage a generic table with dynamic name to be serializable with the default system
|
||||||
@Override
|
@Override
|
||||||
public void createTables(//
|
public void createTables(
|
||||||
final String tableName, //
|
final String tableName,
|
||||||
final Field primaryField, //
|
final Field primaryField,
|
||||||
final Field field, //
|
final Field field,
|
||||||
final StringBuilder mainTableBuilder, //
|
final StringBuilder mainTableBuilder,
|
||||||
final List<String> preActionList, //
|
final List<String> preActionList,
|
||||||
final List<String> postActionList, //
|
final List<String> postActionList,
|
||||||
final boolean createIfNotExist, //
|
final boolean createIfNotExist,
|
||||||
final boolean createDrop, //
|
final boolean createDrop,
|
||||||
final int fieldId //
|
final int fieldId) throws Exception {
|
||||||
) throws Exception {
|
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList,
|
||||||
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, Long.class);
|
createIfNotExist, createDrop, fieldId, Long.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,12 +55,14 @@ public class AddOnSQLTableExternalForeinKeyAsList implements DataAccessAddOn {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCompatibleField(final Field field) {
|
public boolean isCompatibleField(final Field field) {
|
||||||
final SQLTableExternalForeinKeyAsList decorators = field.getDeclaredAnnotation(SQLTableExternalForeinKeyAsList.class);
|
final SQLTableExternalForeinKeyAsList decorators = field
|
||||||
|
.getDeclaredAnnotation(SQLTableExternalForeinKeyAsList.class);
|
||||||
return decorators != null;
|
return decorators != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii) throws SQLException, IllegalArgumentException, IllegalAccessException {
|
public void insertData(final PreparedStatement ps, final Field field, final Object rootObject, final CountInOut iii)
|
||||||
|
throws SQLException, IllegalArgumentException, IllegalAccessException {
|
||||||
final Object data = field.get(rootObject);
|
final Object data = field.get(rootObject);
|
||||||
iii.inc();
|
iii.inc();
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@ -88,16 +90,15 @@ public class AddOnSQLTableExternalForeinKeyAsList implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateQuery(//
|
public void generateQuery(
|
||||||
@NotNull final String tableName, //
|
@NotNull final String tableName,
|
||||||
@NotNull final String primaryKey, //
|
@NotNull final String primaryKey,
|
||||||
@NotNull final Field field, //
|
@NotNull final Field field,
|
||||||
@NotNull final StringBuilder querySelect, //
|
@NotNull final StringBuilder querySelect,
|
||||||
@NotNull final StringBuilder query, //
|
@NotNull final StringBuilder query,
|
||||||
@NotNull final String name, //
|
@NotNull final String name,
|
||||||
@NotNull final CountInOut count, //
|
@NotNull final CountInOut count,
|
||||||
final QueryOptions options//
|
final QueryOptions options) {
|
||||||
) {
|
|
||||||
count.inc();
|
count.inc();
|
||||||
querySelect.append(" ");
|
querySelect.append(" ");
|
||||||
querySelect.append(tableName);
|
querySelect.append(tableName);
|
||||||
@ -106,27 +107,30 @@ public class AddOnSQLTableExternalForeinKeyAsList implements DataAccessAddOn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFromQuery(final ResultSet rs, final Field field, final Object data, final CountInOut count, final QueryOptions options, final List<LazyGetter> lazyCall)
|
public void fillFromQuery(
|
||||||
throws SQLException, IllegalArgumentException, IllegalAccessException {
|
final ResultSet rs,
|
||||||
|
final Field field,
|
||||||
|
final Object data,
|
||||||
|
final CountInOut count,
|
||||||
|
final QueryOptions options,
|
||||||
|
final List<LazyGetter> lazyCall) throws SQLException, IllegalArgumentException, IllegalAccessException {
|
||||||
final List<Long> idList = DataAccess.getListOfIds(rs, count.value, SEPARATOR);
|
final List<Long> idList = DataAccess.getListOfIds(rs, count.value, SEPARATOR);
|
||||||
field.set(data, idList);
|
field.set(data, idList);
|
||||||
count.inc();
|
count.inc();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createTables(//
|
public void createTables(
|
||||||
final String tableName, //
|
final String tableName,
|
||||||
final Field primaryField, //
|
final Field primaryField,
|
||||||
final Field field, //
|
final Field field,
|
||||||
final StringBuilder mainTableBuilder, //
|
final StringBuilder mainTableBuilder,
|
||||||
final List<String> preActionList, //
|
final List<String> preActionList,
|
||||||
final List<String> postActionList, //
|
final List<String> postActionList,
|
||||||
final boolean createIfNotExist, //
|
final boolean createIfNotExist,
|
||||||
final boolean createDrop, //
|
final boolean createDrop,
|
||||||
final int fieldId //
|
final int fieldId) throws Exception {
|
||||||
) throws Exception {
|
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList,
|
||||||
// TODO Auto-generated method stub
|
createIfNotExist, createDrop, fieldId, String.class);
|
||||||
|
|
||||||
DataFactory.createTablesSpecificType(tableName, field, mainTableBuilder, preActionList, postActionList, createIfNotExist, createDrop, fieldId, String.class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
final String fieldName = field.getName(); // AnnotationTools.getFieldName(field);
|
final String fieldName = field.getName(); // AnnotationTools.getFieldName(field);
|
||||||
if (AnnotationTools.isPrimaryKey(field)) {
|
if (AnnotationTools.isPrimaryKey(field)) {
|
||||||
add(fieldName, (final String baseName, final T data) -> {
|
add(fieldName, (final String baseName, final T data) -> {
|
||||||
throw new InputException(baseName + fieldName, "This is a '@Id' (primaryKey) ==> can not be change");
|
throw new InputException(baseName + fieldName,
|
||||||
|
"This is a '@Id' (primaryKey) ==> can not be change");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (AnnotationTools.getConstraintsNotNull(field)) {
|
if (AnnotationTools.getConstraintsNotNull(field)) {
|
||||||
@ -120,7 +121,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
}
|
}
|
||||||
final long count = DataAccess.count(annotationManyToOne.targetEntity(), elem);
|
final long count = DataAccess.count(annotationManyToOne.targetEntity(), elem);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
throw new InputException(baseName + fieldName, "Foreign element does not exist in the DB:" + elem);
|
throw new InputException(baseName + fieldName,
|
||||||
|
"Foreign element does not exist in the DB:" + elem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -163,7 +165,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
}
|
}
|
||||||
final long count = DataAccess.count(annotationManyToOne.targetEntity(), elem);
|
final long count = DataAccess.count(annotationManyToOne.targetEntity(), elem);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
throw new InputException(baseName + fieldName, "Foreign element does not exist in the DB:" + elem);
|
throw new InputException(baseName + fieldName,
|
||||||
|
"Foreign element does not exist in the DB:" + elem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -177,7 +180,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
}
|
}
|
||||||
final long count = DataAccess.count(annotationManyToOne.targetEntity(), elem);
|
final long count = DataAccess.count(annotationManyToOne.targetEntity(), elem);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
throw new InputException(baseName + fieldName, "Foreign element does not exist in the DB:" + elem);
|
throw new InputException(baseName + fieldName,
|
||||||
|
"Foreign element does not exist in the DB:" + elem);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -257,7 +261,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
}
|
}
|
||||||
final String elemTyped = (String) elem;
|
final String elemTyped = (String) elem;
|
||||||
if (elemTyped.length() > maxSizeString) {
|
if (elemTyped.length() > maxSizeString) {
|
||||||
throw new InputException(baseName + fieldName, "Too long size must be <= " + maxSizeString);
|
throw new InputException(baseName + fieldName,
|
||||||
|
"Too long size must be <= " + maxSizeString);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -270,10 +275,12 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
}
|
}
|
||||||
final String elemTyped = (String) elem;
|
final String elemTyped = (String) elem;
|
||||||
if (elemTyped.length() > limitSize.max()) {
|
if (elemTyped.length() > limitSize.max()) {
|
||||||
throw new InputException(baseName + fieldName, "Too long size (constraints) must be <= " + limitSize.max());
|
throw new InputException(baseName + fieldName,
|
||||||
|
"Too long size (constraints) must be <= " + limitSize.max());
|
||||||
}
|
}
|
||||||
if (elemTyped.length() < limitSize.min()) {
|
if (elemTyped.length() < limitSize.min()) {
|
||||||
throw new InputException(baseName + fieldName, "Too small size (constraints) must be >= " + limitSize.max());
|
throw new InputException(baseName + fieldName,
|
||||||
|
"Too small size (constraints) must be >= " + limitSize.max());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -287,7 +294,9 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
}
|
}
|
||||||
final String elemTyped = (String) elem;
|
final String elemTyped = (String) elem;
|
||||||
if (!pattern.matcher(elemTyped).find()) {
|
if (!pattern.matcher(elemTyped).find()) {
|
||||||
throw new InputException(baseName + fieldName, "does not match the required pattern (constraints) must be '" + patternString + "'");
|
throw new InputException(baseName + fieldName,
|
||||||
|
"does not match the required pattern (constraints) must be '" + patternString
|
||||||
|
+ "'");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -295,7 +304,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
final DataJson jsonAnnotation = AnnotationTools.getDataJson(field);
|
final DataJson jsonAnnotation = AnnotationTools.getDataJson(field);
|
||||||
if (jsonAnnotation != null && jsonAnnotation.checker() != CheckFunctionVoid.class) {
|
if (jsonAnnotation != null && jsonAnnotation.checker() != CheckFunctionVoid.class) {
|
||||||
// Here if we have an error it crash at start and no new instance after creation...
|
// Here if we have an error it crash at start and no new instance after creation...
|
||||||
final CheckFunctionInterface instance = jsonAnnotation.checker().getDeclaredConstructor().newInstance();
|
final CheckFunctionInterface instance = jsonAnnotation.checker().getDeclaredConstructor()
|
||||||
|
.newInstance();
|
||||||
add(fieldName, (final String baseName, final T data) -> {
|
add(fieldName, (final String baseName, final T data) -> {
|
||||||
instance.checkAll(baseName + fieldName + ".", field.get(data));
|
instance.checkAll(baseName + fieldName + ".", field.get(data));
|
||||||
});
|
});
|
||||||
@ -307,7 +317,8 @@ public class CheckJPA<T> implements CheckFunctionInterface {
|
|||||||
if (AnnotationTools.isUnique(field)) {
|
if (AnnotationTools.isUnique(field)) {
|
||||||
// Create the request ...
|
// Create the request ...
|
||||||
add(fieldName, (final String baseName, final T data) -> {
|
add(fieldName, (final String baseName, final T data) -> {
|
||||||
final Object other = DataAccess.getWhere(this.clazz, new Condition(new QueryCondition(fieldName, "==", field.get(data))));
|
final Object other = DataAccess.getWhere(this.clazz,
|
||||||
|
new Condition(new QueryCondition(fieldName, "==", field.get(data))));
|
||||||
if (other != null) {
|
if (other != null) {
|
||||||
throw new InputException(baseName + fieldName, "Name already exist in the DB");
|
throw new InputException(baseName + fieldName, "Name already exist in the DB");
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,11 @@ public class Condition extends QueryOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void whereAppendQuery(final StringBuilder query, final String tableName, final QueryOptions options, final String deletedFieldName) {
|
public void whereAppendQuery(
|
||||||
|
final StringBuilder query,
|
||||||
|
final String tableName,
|
||||||
|
final QueryOptions options,
|
||||||
|
final String deletedFieldName) {
|
||||||
boolean exclude_deleted = true;
|
boolean exclude_deleted = true;
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
exclude_deleted = !options.exist(AccessDeletedItems.class);
|
exclude_deleted = !options.exist(AccessDeletedItems.class);
|
||||||
|
@ -14,7 +14,8 @@ public class DBConfig {
|
|||||||
private final String dbName;
|
private final String dbName;
|
||||||
private final boolean keepConnected;
|
private final boolean keepConnected;
|
||||||
|
|
||||||
public DBConfig(final String type, final String hostname, final Integer port, final String login, final String password, final String dbName, final boolean keepConnected) {
|
public DBConfig(final String type, final String hostname, final Integer port, final String login,
|
||||||
|
final String password, final String dbName, final boolean keepConnected) {
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
this.type = "mysql";
|
this.type = "mysql";
|
||||||
} else {
|
} else {
|
||||||
@ -38,8 +39,9 @@ public class DBConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DBConfig{type='" + this.type + '\'' + ", hostname='" + this.hostname + '\'' + ", port=" + this.port + ", login='" + this.login + '\'' + ", password='" + this.password + '\''
|
return "DBConfig{type='" + this.type + '\'' + ", hostname='" + this.hostname + '\'' + ", port=" + this.port
|
||||||
+ ", dbName='" + this.dbName + "' }";
|
+ ", login='" + this.login + '\'' + ", password='" + this.password + '\'' + ", dbName='" + this.dbName
|
||||||
|
+ "' }";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHostname() {
|
public String getHostname() {
|
||||||
@ -81,8 +83,10 @@ public class DBConfig {
|
|||||||
return "jdbc:sqlite:" + this.hostname + ".db";
|
return "jdbc:sqlite:" + this.hostname + ".db";
|
||||||
}
|
}
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
return "jdbc:" + this.type + "://" + this.hostname + ":" + this.port + "/?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC";
|
return "jdbc:" + this.type + "://" + this.hostname + ":" + this.port
|
||||||
|
+ "/?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC";
|
||||||
}
|
}
|
||||||
return "jdbc:" + this.type + "://" + this.hostname + ":" + this.port + "/" + this.dbName + "?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC";
|
return "jdbc:" + this.type + "://" + this.hostname + ":" + this.port + "/" + this.dbName
|
||||||
|
+ "?allowPublicKeyRetrieval=true&useSSL=false&serverTimezone=UTC";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,8 @@ public class DBEntry implements Closeable {
|
|||||||
|
|
||||||
public void connectRoot() throws IOException {
|
public void connectRoot() throws IOException {
|
||||||
try {
|
try {
|
||||||
this.connection = DriverManager.getConnection(this.config.getUrl(true), this.config.getLogin(), this.config.getPassword());
|
this.connection = DriverManager.getConnection(this.config.getUrl(true), this.config.getLogin(),
|
||||||
|
this.config.getPassword());
|
||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
throw new IOException("Connection db fail: " + ex.getMessage() + " On URL: " + this.config.getUrl(true));
|
throw new IOException("Connection db fail: " + ex.getMessage() + " On URL: " + this.config.getUrl(true));
|
||||||
}
|
}
|
||||||
@ -59,7 +60,8 @@ public class DBEntry implements Closeable {
|
|||||||
|
|
||||||
public void connect() throws IOException {
|
public void connect() throws IOException {
|
||||||
try {
|
try {
|
||||||
this.connection = DriverManager.getConnection(this.config.getUrl(), this.config.getLogin(), this.config.getPassword());
|
this.connection = DriverManager.getConnection(this.config.getUrl(), this.config.getLogin(),
|
||||||
|
this.config.getPassword());
|
||||||
} catch (final SQLException ex) {
|
} catch (final SQLException ex) {
|
||||||
throw new IOException("Connection db fail: " + ex.getMessage() + " On URL: " + this.config.getUrl(true));
|
throw new IOException("Connection db fail: " + ex.getMessage() + " On URL: " + this.config.getUrl(true));
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@ public class RESTErrorResponseExeption extends Exception {
|
|||||||
this.statusMessage = null;
|
this.statusMessage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RESTErrorResponseExeption(final UUID uuid, final String time, final String name, final String message, final int status, final String statusMessage) {
|
public RESTErrorResponseExeption(final UUID uuid, final String time, final String name, final String message,
|
||||||
|
final int status, final String statusMessage) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -30,8 +31,9 @@ public class RESTErrorResponseExeption extends Exception {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "RESTErrorResponseExeption [uuid=" + this.uuid + ", time=" + this.time + ", name=" + this.name + ", message=" + this.message + ", status=" + this.status + ", statusMessage="
|
return "RESTErrorResponseExeption [uuid=" + this.uuid + ", time=" + this.time + ", name=" + this.name
|
||||||
+ this.statusMessage + "]";
|
+ ", message=" + this.message + ", status=" + this.status + ", statusMessage=" + this.statusMessage
|
||||||
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||||||
if (authorizationHeader == null && apikeyHeader == null && method.isAnnotationPresent(PermitTokenInURI.class)) {
|
if (authorizationHeader == null && apikeyHeader == null && method.isAnnotationPresent(PermitTokenInURI.class)) {
|
||||||
final MultivaluedMap<String, String> quaryparam = requestContext.getUriInfo().getQueryParameters();
|
final MultivaluedMap<String, String> quaryparam = requestContext.getUriInfo().getQueryParameters();
|
||||||
for (final Entry<String, List<String>> item : quaryparam.entrySet()) {
|
for (final Entry<String, List<String>> item : quaryparam.entrySet()) {
|
||||||
if ((authorizationHeader == null && HttpHeaders.AUTHORIZATION.equals(item.getKey())) && !item.getValue().isEmpty()) {
|
if ((authorizationHeader == null && HttpHeaders.AUTHORIZATION.equals(item.getKey()))
|
||||||
|
&& !item.getValue().isEmpty()) {
|
||||||
authorizationHeader = item.getValue().get(0);
|
authorizationHeader = item.getValue().get(0);
|
||||||
}
|
}
|
||||||
if ((apikeyHeader == null && APIKEY.equals(item.getKey())) && !item.getValue().isEmpty()) {
|
if ((apikeyHeader == null && APIKEY.equals(item.getKey())) && !item.getValue().isEmpty()) {
|
||||||
@ -148,7 +149,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||||||
// Is user valid?
|
// Is user valid?
|
||||||
if (!haveRight) {
|
if (!haveRight) {
|
||||||
LOGGER.error("REJECTED not enought right : {} require: {}", requestContext.getUriInfo().getPath(), roles);
|
LOGGER.error("REJECTED not enought right : {} require: {}", requestContext.getUriInfo().getPath(), roles);
|
||||||
requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).entity("Not enought RIGHT !!!").build());
|
requestContext
|
||||||
|
.abortWith(Response.status(Response.Status.UNAUTHORIZED).entity("Not enought RIGHT !!!").build());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
requestContext.setSecurityContext(userContext);
|
requestContext.setSecurityContext(userContext);
|
||||||
@ -159,7 +161,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||||||
// Check if the Authorization header is valid
|
// Check if the Authorization header is valid
|
||||||
// It must not be null and must be prefixed with "Bearer" plus a whitespace
|
// It must not be null and must be prefixed with "Bearer" plus a whitespace
|
||||||
// The authentication scheme comparison must be case-insensitive
|
// The authentication scheme comparison must be case-insensitive
|
||||||
return authorizationHeader != null && authorizationHeader.toLowerCase().startsWith(AUTHENTICATION_SCHEME.toLowerCase() + " ");
|
return authorizationHeader != null
|
||||||
|
&& authorizationHeader.toLowerCase().startsWith(AUTHENTICATION_SCHEME.toLowerCase() + " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void abortWithUnauthorized(final ContainerRequestContext requestContext, final String message) {
|
private void abortWithUnauthorized(final ContainerRequestContext requestContext, final String message) {
|
||||||
@ -169,14 +172,17 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||||||
LOGGER.warn("abortWithUnauthorized:");
|
LOGGER.warn("abortWithUnauthorized:");
|
||||||
final RestErrorResponse ret = new RestErrorResponse(Response.Status.UNAUTHORIZED, "Unauthorized", message);
|
final RestErrorResponse ret = new RestErrorResponse(Response.Status.UNAUTHORIZED, "Unauthorized", message);
|
||||||
LOGGER.error("Error UUID={}", ret.uuid);
|
LOGGER.error("Error UUID={}", ret.uuid);
|
||||||
requestContext.abortWith(Response.status(ret.status).header(HttpHeaders.WWW_AUTHENTICATE, AUTHENTICATION_SCHEME + " base64(HEADER).base64(CONTENT).base64(KEY)").entity(ret)
|
requestContext.abortWith(Response.status(ret.status)
|
||||||
.type(MediaType.APPLICATION_JSON).build());
|
.header(HttpHeaders.WWW_AUTHENTICATE,
|
||||||
|
AUTHENTICATION_SCHEME + " base64(HEADER).base64(CONTENT).base64(KEY)")
|
||||||
|
.entity(ret).type(MediaType.APPLICATION_JSON).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void abortWithForbidden(final ContainerRequestContext requestContext, final String message) {
|
private void abortWithForbidden(final ContainerRequestContext requestContext, final String message) {
|
||||||
final RestErrorResponse ret = new RestErrorResponse(Response.Status.FORBIDDEN, "FORBIDDEN", message);
|
final RestErrorResponse ret = new RestErrorResponse(Response.Status.FORBIDDEN, "FORBIDDEN", message);
|
||||||
LOGGER.error("Error UUID={}", ret.uuid);
|
LOGGER.error("Error UUID={}", ret.uuid);
|
||||||
requestContext.abortWith(Response.status(ret.status).header(HttpHeaders.WWW_AUTHENTICATE, message).entity(ret).type(MediaType.APPLICATION_JSON).build());
|
requestContext.abortWith(Response.status(ret.status).header(HttpHeaders.WWW_AUTHENTICATE, message).entity(ret)
|
||||||
|
.type(MediaType.APPLICATION_JSON).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected UserByToken validateToken(final String authorization) throws Exception {
|
protected UserByToken validateToken(final String authorization) throws Exception {
|
||||||
@ -206,7 +212,8 @@ public class AuthenticationFilter implements ContainerRequestFilter {
|
|||||||
if (rights.containsKey(this.applicationName)) {
|
if (rights.containsKey(this.applicationName)) {
|
||||||
user.right = rights.get(this.applicationName);
|
user.right = rights.get(this.applicationName);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.error("Connect with no right for this application='{}' full Right='{}'", this.applicationName, rights);
|
LOGGER.error("Connect with no right for this application='{}' full Right='{}'", this.applicationName,
|
||||||
|
rights);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// logger.debug("request user: '{}' right: '{}' row='{}'", userUID, user.right, rowRight);
|
// logger.debug("request user: '{}' right: '{}' row='{}'", userUID, user.right, rowRight);
|
||||||
|
@ -11,11 +11,13 @@ import jakarta.ws.rs.ext.Provider;
|
|||||||
public class CORSFilter implements ContainerResponseFilter {
|
public class CORSFilter implements ContainerResponseFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void filter(final ContainerRequestContext request, final ContainerResponseContext response) throws IOException {
|
public void filter(final ContainerRequestContext request, final ContainerResponseContext response)
|
||||||
|
throws IOException {
|
||||||
// System.err.println("filter cors ..." + request.toString());
|
// System.err.println("filter cors ..." + request.toString());
|
||||||
|
|
||||||
response.getHeaders().add("Access-Control-Allow-Origin", "*");
|
response.getHeaders().add("Access-Control-Allow-Origin", "*");
|
||||||
response.getHeaders().add("Access-Control-Allow-Headers", "Origin, content-type, Content-type, Accept, Authorization, mime-type, filename");
|
response.getHeaders().add("Access-Control-Allow-Headers",
|
||||||
|
"Origin, content-type, Content-type, Accept, Authorization, mime-type, filename");
|
||||||
response.getHeaders().add("Access-Control-Allow-Credentials", "true");
|
response.getHeaders().add("Access-Control-Allow-Credentials", "true");
|
||||||
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD");
|
response.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD");
|
||||||
}
|
}
|
||||||
|
@ -162,14 +162,16 @@ public class MigrationEngine {
|
|||||||
sqlQuery = DataFactory.createTable(Migration.class);
|
sqlQuery = DataFactory.createTable(Migration.class);
|
||||||
} catch (final Exception ex) {
|
} catch (final Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
throw new MigrationException("Fail to create the local DB SQL model for migaration ==> wait administrator interventions");
|
throw new MigrationException(
|
||||||
|
"Fail to create the local DB SQL model for migaration ==> wait administrator interventions");
|
||||||
}
|
}
|
||||||
LOGGER.info("Create Table with : {}", sqlQuery.get(0));
|
LOGGER.info("Create Table with : {}", sqlQuery.get(0));
|
||||||
try {
|
try {
|
||||||
DataAccess.executeQuery(sqlQuery.get(0));
|
DataAccess.executeQuery(sqlQuery.get(0));
|
||||||
} catch (SQLException | IOException ex) {
|
} catch (SQLException | IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
throw new MigrationException("Fail to create the local DB model for migaration ==> wait administrator interventions");
|
throw new MigrationException(
|
||||||
|
"Fail to create the local DB model for migaration ==> wait administrator interventions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Migration currentVersion = getCurrentVersion();
|
final Migration currentVersion = getCurrentVersion();
|
||||||
@ -188,7 +190,8 @@ public class MigrationEngine {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!currentVersion.terminated) {
|
if (!currentVersion.terminated) {
|
||||||
throw new MigrationException("An error occured in the last migration: '" + currentVersion.name + "' defect @" + currentVersion.stepId + "/" + currentVersion.count);
|
throw new MigrationException("An error occured in the last migration: '" + currentVersion.name
|
||||||
|
+ "' defect @" + currentVersion.stepId + "/" + currentVersion.count);
|
||||||
}
|
}
|
||||||
LOGGER.info("Upgrade the system Current version: {}", currentVersion.name);
|
LOGGER.info("Upgrade the system Current version: {}", currentVersion.name);
|
||||||
boolean find = this.init != null && this.init.getName().equals(currentVersion.name);
|
boolean find = this.init != null && this.init.getName().equals(currentVersion.name);
|
||||||
@ -220,7 +223,8 @@ public class MigrationEngine {
|
|||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new MigrationException("An error occured in the migration (can not access to the DB): '" + currentVersion.name + "' defect @" + currentVersion.stepId + "/" + currentVersion.count);
|
throw new MigrationException("An error occured in the migration (can not access to the DB): '"
|
||||||
|
+ currentVersion.name + "' defect @" + currentVersion.stepId + "/" + currentVersion.count);
|
||||||
}
|
}
|
||||||
if (needPlaceholder) {
|
if (needPlaceholder) {
|
||||||
if (this.datas.size() == 0) {
|
if (this.datas.size() == 0) {
|
||||||
@ -246,7 +250,8 @@ public class MigrationEngine {
|
|||||||
LOGGER.info("Execute migration ... [ END ]");
|
LOGGER.info("Execute migration ... [ END ]");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void migrateSingle(final DBEntry entry, final MigrationInterface elem, final int id, final int count) throws MigrationException {
|
public void migrateSingle(final DBEntry entry, final MigrationInterface elem, final int id, final int count)
|
||||||
|
throws MigrationException {
|
||||||
LOGGER.info("---------------------------------------------------------");
|
LOGGER.info("---------------------------------------------------------");
|
||||||
LOGGER.info("-- Migrate: [{}/{}] {} [BEGIN]", id, count, elem.getName());
|
LOGGER.info("-- Migrate: [{}/{}] {} [BEGIN]", id, count, elem.getName());
|
||||||
LOGGER.info("---------------------------------------------------------");
|
LOGGER.info("---------------------------------------------------------");
|
||||||
@ -260,14 +265,16 @@ public class MigrationEngine {
|
|||||||
migrationResult.count = elem.getNumberOfStep();
|
migrationResult.count = elem.getNumberOfStep();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new MigrationException("Fail to get number of migration step (maybe generation fail): " + e.getLocalizedMessage());
|
throw new MigrationException(
|
||||||
|
"Fail to get number of migration step (maybe generation fail): " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
migrationResult.log = log.toString();
|
migrationResult.log = log.toString();
|
||||||
try {
|
try {
|
||||||
migrationResult = DataAccess.insert(migrationResult);
|
migrationResult = DataAccess.insert(migrationResult);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new MigrationException("Fail to insert migration Log in the migration table: " + e.getLocalizedMessage());
|
throw new MigrationException(
|
||||||
|
"Fail to insert migration Log in the migration table: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
boolean ret = true;
|
boolean ret = true;
|
||||||
try {
|
try {
|
||||||
@ -276,7 +283,8 @@ public class MigrationEngine {
|
|||||||
log.append("\nFail in the migration apply ");
|
log.append("\nFail in the migration apply ");
|
||||||
log.append(e.getLocalizedMessage());
|
log.append(e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new MigrationException("Migration fail: '" + migrationResult.name + "' defect @" + migrationResult.stepId + "/" + migrationResult.count);
|
throw new MigrationException("Migration fail: '" + migrationResult.name + "' defect @"
|
||||||
|
+ migrationResult.stepId + "/" + migrationResult.count);
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
migrationResult.terminated = true;
|
migrationResult.terminated = true;
|
||||||
@ -284,7 +292,8 @@ public class MigrationEngine {
|
|||||||
DataAccess.update(migrationResult, migrationResult.id, List.of("terminated"));
|
DataAccess.update(migrationResult, migrationResult.id, List.of("terminated"));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new MigrationException("Fail to update migration Log in the migration table: " + e.getLocalizedMessage());
|
throw new MigrationException(
|
||||||
|
"Fail to update migration Log in the migration table: " + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -293,10 +302,12 @@ public class MigrationEngine {
|
|||||||
DataAccess.update(migrationResult, migrationResult.id, List.of("log"));
|
DataAccess.update(migrationResult, migrationResult.id, List.of("log"));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new MigrationException("Fail to update migration Log in the migration table: " + e.getLocalizedMessage() + " WITH: An error occured in the migration (OUTSIDE detection): '"
|
throw new MigrationException("Fail to update migration Log in the migration table: "
|
||||||
|
+ e.getLocalizedMessage() + " WITH: An error occured in the migration (OUTSIDE detection): '"
|
||||||
+ migrationResult.name + "' defect @" + migrationResult.stepId + "/" + migrationResult.count);
|
+ migrationResult.name + "' defect @" + migrationResult.stepId + "/" + migrationResult.count);
|
||||||
}
|
}
|
||||||
throw new MigrationException("An error occured in the migration (OUTSIDE detection): '" + migrationResult.name + "' defect @" + migrationResult.stepId + "/" + migrationResult.count);
|
throw new MigrationException("An error occured in the migration (OUTSIDE detection): '"
|
||||||
|
+ migrationResult.name + "' defect @" + migrationResult.stepId + "/" + migrationResult.count);
|
||||||
}
|
}
|
||||||
LOGGER.info("Migrate: [{}/{}] {} [ END ]", id, count, elem.getName());
|
LOGGER.info("Migrate: [{}/{}] {} [ END ]", id, count, elem.getName());
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,10 @@ import org.kar.archidata.tools.ConfigBaseVariable;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
record Action(String action, AsyncCall async, List<String> filterDB) {
|
record Action(
|
||||||
|
String action,
|
||||||
|
AsyncCall async,
|
||||||
|
List<String> filterDB) {
|
||||||
public Action(final String action) {
|
public Action(final String action) {
|
||||||
this(action, null, List.of());
|
this(action, null, List.of());
|
||||||
}
|
}
|
||||||
@ -49,9 +52,11 @@ public class MigrationSqlStep implements MigrationInterface {
|
|||||||
for (int iii = 0; iii < this.actions.size(); iii++) {
|
for (int iii = 0; iii < this.actions.size(); iii++) {
|
||||||
final Action action = this.actions.get(iii);
|
final Action action = this.actions.get(iii);
|
||||||
if (action.action() != null) {
|
if (action.action() != null) {
|
||||||
LOGGER.info(" >>>> SQL ACTION : {}/{} ==> filter='{}'\n{}", iii, this.actions.size(), action.filterDB(), action.action());
|
LOGGER.info(" >>>> SQL ACTION : {}/{} ==> filter='{}'\n{}", iii, this.actions.size(), action.filterDB(),
|
||||||
|
action.action());
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info(" >>>> SQL ACTION : {}/{} ==> filter='{}'\nAsync lambda", iii, this.actions.size(), action.filterDB());
|
LOGGER.info(" >>>> SQL ACTION : {}/{} ==> filter='{}'\nAsync lambda", iii, this.actions.size(),
|
||||||
|
action.filterDB());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +70,8 @@ public class MigrationSqlStep implements MigrationInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applyMigration(final DBEntry entry, final StringBuilder log, final Migration model) throws Exception {
|
public boolean applyMigration(final DBEntry entry, final StringBuilder log, final Migration model)
|
||||||
|
throws Exception {
|
||||||
if (!this.isGenerated) {
|
if (!this.isGenerated) {
|
||||||
this.isGenerated = true;
|
this.isGenerated = true;
|
||||||
generateStep();
|
generateStep();
|
||||||
@ -76,10 +82,12 @@ public class MigrationSqlStep implements MigrationInterface {
|
|||||||
final Action action = this.actions.get(iii);
|
final Action action = this.actions.get(iii);
|
||||||
|
|
||||||
if (action.action() != null) {
|
if (action.action() != null) {
|
||||||
LOGGER.info("SQL request: ```{}``` on '{}' current={}", action.action(), action.filterDB(), ConfigBaseVariable.getDBType());
|
LOGGER.info("SQL request: ```{}``` on '{}' current={}", action.action(), action.filterDB(),
|
||||||
|
ConfigBaseVariable.getDBType());
|
||||||
log.append("SQL: " + action.action() + " on " + action.filterDB() + "\n");
|
log.append("SQL: " + action.action() + " on " + action.filterDB() + "\n");
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("SQL request: <Lambda> on '{}' current={}", action.filterDB(), ConfigBaseVariable.getDBType());
|
LOGGER.info("SQL request: <Lambda> on '{}' current={}", action.filterDB(),
|
||||||
|
ConfigBaseVariable.getDBType());
|
||||||
log.append("SQL: <Lambda> on " + action.filterDB() + "\n");
|
log.append("SQL: <Lambda> on " + action.filterDB() + "\n");
|
||||||
}
|
}
|
||||||
boolean isValid = true;
|
boolean isValid = true;
|
||||||
|
@ -3,5 +3,5 @@ package org.kar.archidata.model;
|
|||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public record GetToken(String jwt) {
|
public record GetToken(
|
||||||
}
|
String jwt) {}
|
||||||
|
@ -12,7 +12,8 @@ public class Token {
|
|||||||
|
|
||||||
public Token() {}
|
public Token() {}
|
||||||
|
|
||||||
public Token(final long id, final long userId, final String token, final String createTime, final String endValidityTime) {
|
public Token(final long id, final long userId, final String token, final String createTime,
|
||||||
|
final String endValidityTime) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
@ -35,6 +36,7 @@ public class Token {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Token{" + "id=" + this.id + ", userId=" + this.userId + ", token='" + this.token + '\'' + ", createTime=" + this.createTime + ", endValidityTime=" + this.endValidityTime + '}';
|
return "Token{" + "id=" + this.id + ", userId=" + this.userId + ", token='" + this.token + '\''
|
||||||
|
+ ", createTime=" + this.createTime + ", endValidityTime=" + this.endValidityTime + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,8 +127,10 @@ public class ConfigBaseVariable {
|
|||||||
return Boolean.parseBoolean(testMode);
|
return Boolean.parseBoolean(testMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public record EMailConfig(String from, String login, String password) {
|
public record EMailConfig(
|
||||||
};
|
String from,
|
||||||
|
String login,
|
||||||
|
String password) {};
|
||||||
|
|
||||||
public static EMailConfig getEMailConfig() {
|
public static EMailConfig getEMailConfig() {
|
||||||
if (eMailFrom == null || eMailLogin == null || eMailPassword == null) {
|
if (eMailFrom == null || eMailLogin == null || eMailPassword == null) {
|
||||||
|
@ -69,7 +69,8 @@ public class DataTools {
|
|||||||
|
|
||||||
public static Data getWithSha512(final String sha512) {
|
public static Data getWithSha512(final String sha512) {
|
||||||
try {
|
try {
|
||||||
return DataAccess.getWhere(Data.class, new Condition(new QueryCondition("sha512", "=", sha512)), new ReadAllColumn());
|
return DataAccess.getWhere(Data.class, new Condition(new QueryCondition("sha512", "=", sha512)),
|
||||||
|
new ReadAllColumn());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -79,7 +80,8 @@ public class DataTools {
|
|||||||
|
|
||||||
public static Data getWithId(final long id) {
|
public static Data getWithId(final long id) {
|
||||||
try {
|
try {
|
||||||
return DataAccess.getWhere(Data.class, new Condition(new QueryAnd(List.of(new QueryCondition("deleted", "=", false), new QueryCondition("id", "=", id)))));
|
return DataAccess.getWhere(Data.class, new Condition(new QueryAnd(
|
||||||
|
List.of(new QueryCondition("deleted", "=", false), new QueryCondition("id", "=", id)))));
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -87,18 +89,19 @@ public class DataTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Data createNewData(final long tmpUID, final String originalFileName, final String sha512) throws IOException, SQLException {
|
public static Data createNewData(final long tmpUID, final String originalFileName, final String sha512)
|
||||||
|
throws IOException, SQLException {
|
||||||
// determine mime type:
|
// determine mime type:
|
||||||
String mimeType = "";
|
String mimeType = "";
|
||||||
final String extension = originalFileName.substring(originalFileName.lastIndexOf('.') + 1);
|
final String extension = originalFileName.substring(originalFileName.lastIndexOf('.') + 1);
|
||||||
mimeType = switch (extension.toLowerCase()) {
|
mimeType = switch (extension.toLowerCase()) {
|
||||||
case "jpg", "jpeg" -> "image/jpeg";
|
case "jpg", "jpeg" -> "image/jpeg";
|
||||||
case "png" -> "image/png";
|
case "png" -> "image/png";
|
||||||
case "webp" -> "image/webp";
|
case "webp" -> "image/webp";
|
||||||
case "mka" -> "audio/x-matroska";
|
case "mka" -> "audio/x-matroska";
|
||||||
case "mkv" -> "video/x-matroska";
|
case "mkv" -> "video/x-matroska";
|
||||||
case "webm" -> "video/webm";
|
case "webm" -> "video/webm";
|
||||||
default -> throw new IOException("Can not find the mime type of data input: '" + extension + "'");
|
default -> throw new IOException("Can not find the mime type of data input: '" + extension + "'");
|
||||||
};
|
};
|
||||||
final String tmpPath = getTmpFileInData(tmpUID);
|
final String tmpPath = getTmpFileInData(tmpUID);
|
||||||
final long fileSize = Files.size(Paths.get(tmpPath));
|
final long fileSize = Files.size(Paths.get(tmpPath));
|
||||||
@ -211,7 +214,11 @@ public class DataTools {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <CLASS_TYPE, ID_TYPE> Response uploadCover(final Class<CLASS_TYPE> clazz, final ID_TYPE id, String fileName, final InputStream fileInputStream,
|
public static <CLASS_TYPE, ID_TYPE> Response uploadCover(
|
||||||
|
final Class<CLASS_TYPE> clazz,
|
||||||
|
final ID_TYPE id,
|
||||||
|
String fileName,
|
||||||
|
final InputStream fileInputStream,
|
||||||
final FormDataContentDisposition fileMetaData) {
|
final FormDataContentDisposition fileMetaData) {
|
||||||
try {
|
try {
|
||||||
// correct input string stream :
|
// correct input string stream :
|
||||||
|
@ -78,7 +78,8 @@ public class JWTWrapper {
|
|||||||
public PublicKey() {}
|
public PublicKey() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void initLocalTokenRemote(final String ssoUri, final String application) throws IOException, ParseException {
|
public static void initLocalTokenRemote(final String ssoUri, final String application)
|
||||||
|
throws IOException, ParseException {
|
||||||
// check Token:
|
// check Token:
|
||||||
final URL obj = new URL(ssoUri + "public_key");
|
final URL obj = new URL(ssoUri + "public_key");
|
||||||
// LOGGER.debug("Request token from: {}", obj);
|
// LOGGER.debug("Request token from: {}", obj);
|
||||||
@ -169,7 +170,13 @@ public class JWTWrapper {
|
|||||||
* @param isuer The one who provide the Token
|
* @param isuer The one who provide the Token
|
||||||
* @param timeOutInMunites Expiration of the token.
|
* @param timeOutInMunites Expiration of the token.
|
||||||
* @return the encoded token */
|
* @return the encoded token */
|
||||||
public static String generateJWToken(final long userID, final String userLogin, final String isuer, final String application, final Map<String, Object> rights, final int timeOutInMunites) {
|
public static String generateJWToken(
|
||||||
|
final long userID,
|
||||||
|
final String userLogin,
|
||||||
|
final String isuer,
|
||||||
|
final String application,
|
||||||
|
final Map<String, Object> rights,
|
||||||
|
final int timeOutInMunites) {
|
||||||
if (rsaJWK == null) {
|
if (rsaJWK == null) {
|
||||||
LOGGER.warn("JWT private key is not present !!!");
|
LOGGER.warn("JWT private key is not present !!!");
|
||||||
return null;
|
return null;
|
||||||
@ -186,7 +193,8 @@ public class JWTWrapper {
|
|||||||
final Date expiration = new Date(new Date().getTime() - 60 * timeOutInMunites * 1000 /* millisecond */);
|
final Date expiration = new Date(new Date().getTime() - 60 * timeOutInMunites * 1000 /* millisecond */);
|
||||||
|
|
||||||
LOGGER.warn("expiration= {}", expiration);
|
LOGGER.warn("expiration= {}", expiration);
|
||||||
final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder().subject(Long.toString(userID)).claim("login", userLogin).claim("application", application).issuer(isuer).issueTime(now)
|
final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder().subject(Long.toString(userID))
|
||||||
|
.claim("login", userLogin).claim("application", application).issuer(isuer).issueTime(now)
|
||||||
.expirationTime(expiration); // Do not ask why we need a "-" here ... this have no meaning
|
.expirationTime(expiration); // Do not ask why we need a "-" here ... this have no meaning
|
||||||
// add right if needed:
|
// add right if needed:
|
||||||
if (rights != null && !rights.isEmpty()) {
|
if (rights != null && !rights.isEmpty()) {
|
||||||
@ -194,7 +202,8 @@ public class JWTWrapper {
|
|||||||
}
|
}
|
||||||
// Prepare JWT with claims set
|
// Prepare JWT with claims set
|
||||||
final JWTClaimsSet claimsSet = builder.build();
|
final JWTClaimsSet claimsSet = builder.build();
|
||||||
final SignedJWT signedJWT = new SignedJWT(new JWSHeader.Builder(JWSAlgorithm.RS256).type(JOSEObjectType.JWT)/* .keyID(rsaJWK.getKeyID()) */.build(), claimsSet);
|
final SignedJWT signedJWT = new SignedJWT(new JWSHeader.Builder(JWSAlgorithm.RS256).type(JOSEObjectType.JWT)
|
||||||
|
/* .keyID(rsaJWK.getKeyID()) */.build(), claimsSet);
|
||||||
|
|
||||||
// Compute the RSA signature
|
// Compute the RSA signature
|
||||||
signedJWT.sign(signer);
|
signedJWT.sign(signer);
|
||||||
@ -230,12 +239,15 @@ public class JWTWrapper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ConfigBaseVariable.getTestMode() && !new Date().before(signedJWT.getJWTClaimsSet().getExpirationTime())) {
|
if (!ConfigBaseVariable.getTestMode()
|
||||||
LOGGER.error("JWT token is expired now = " + new Date() + " with=" + signedJWT.getJWTClaimsSet().getExpirationTime());
|
&& !new Date().before(signedJWT.getJWTClaimsSet().getExpirationTime())) {
|
||||||
|
LOGGER.error("JWT token is expired now = " + new Date() + " with="
|
||||||
|
+ signedJWT.getJWTClaimsSet().getExpirationTime());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!isuer.equals(signedJWT.getJWTClaimsSet().getIssuer())) {
|
if (!isuer.equals(signedJWT.getJWTClaimsSet().getIssuer())) {
|
||||||
LOGGER.error("JWT issuer is wong: '" + isuer + "' != '" + signedJWT.getJWTClaimsSet().getIssuer() + "'");
|
LOGGER.error(
|
||||||
|
"JWT issuer is wong: '" + isuer + "' != '" + signedJWT.getJWTClaimsSet().getIssuer() + "'");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (application != null) {
|
if (application != null) {
|
||||||
@ -251,7 +263,12 @@ public class JWTWrapper {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createJwtTestToken(final long userID, final String userLogin, final String isuer, final String application, final Map<String, Map<String, Object>> rights) {
|
public static String createJwtTestToken(
|
||||||
|
final long userID,
|
||||||
|
final String userLogin,
|
||||||
|
final String isuer,
|
||||||
|
final String application,
|
||||||
|
final Map<String, Map<String, Object>> rights) {
|
||||||
if (!ConfigBaseVariable.getTestMode()) {
|
if (!ConfigBaseVariable.getTestMode()) {
|
||||||
LOGGER.error("Test mode disable !!!!!");
|
LOGGER.error("Test mode disable !!!!!");
|
||||||
return null;
|
return null;
|
||||||
@ -262,7 +279,8 @@ public class JWTWrapper {
|
|||||||
final Date now = new Date();
|
final Date now = new Date();
|
||||||
final Date expiration = new Date(new Date().getTime() + timeOutInMunites * 1000 /* ms */);
|
final Date expiration = new Date(new Date().getTime() + timeOutInMunites * 1000 /* ms */);
|
||||||
|
|
||||||
final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder().subject(Long.toString(userID)).claim("login", userLogin).claim("application", application).issuer(isuer).issueTime(now)
|
final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder().subject(Long.toString(userID))
|
||||||
|
.claim("login", userLogin).claim("application", application).issuer(isuer).issueTime(now)
|
||||||
.expirationTime(expiration); // Do not ask why we need a "-" here ... this have no meaning
|
.expirationTime(expiration); // Do not ask why we need a "-" here ... this have no meaning
|
||||||
// add right if needed:
|
// add right if needed:
|
||||||
if (rights != null && !rights.isEmpty()) {
|
if (rights != null && !rights.isEmpty()) {
|
||||||
@ -270,7 +288,8 @@ public class JWTWrapper {
|
|||||||
}
|
}
|
||||||
// Prepare JWT with claims set
|
// Prepare JWT with claims set
|
||||||
final JWTClaimsSet claimsSet = builder.build();
|
final JWTClaimsSet claimsSet = builder.build();
|
||||||
final SignedJWT signedJWT = new SignedJWT(new JWSHeader.Builder(JWSAlgorithm.RS256).type(JOSEObjectType.JWT)/* .keyID(rsaJWK.getKeyID()) */.build(), claimsSet);
|
final SignedJWT signedJWT = new SignedJWT(new JWSHeader.Builder(JWSAlgorithm.RS256).type(JOSEObjectType.JWT)
|
||||||
|
/* .keyID(rsaJWK.getKeyID()) */.build(), claimsSet);
|
||||||
|
|
||||||
// Compute the RSA signature
|
// Compute the RSA signature
|
||||||
signedJWT.sign(new TestSigner());
|
signedJWT.sign(new TestSigner());
|
||||||
|
@ -36,9 +36,11 @@ public class RESTApi {
|
|||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> List<T> gets(final Class<T> clazz, final String urlOffset) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T> List<T> gets(final Class<T> clazz, final String urlOffset)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
final HttpClient client = HttpClient.newHttpClient();
|
final HttpClient client = HttpClient.newHttpClient();
|
||||||
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1).uri(URI.create(this.baseUrl + urlOffset));
|
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1)
|
||||||
|
.uri(URI.create(this.baseUrl + urlOffset));
|
||||||
if (this.token != null) {
|
if (this.token != null) {
|
||||||
requestBuilding = requestBuilding.header(HttpHeaders.AUTHORIZATION, "Bearer " + this.token);
|
requestBuilding = requestBuilding.header(HttpHeaders.AUTHORIZATION, "Bearer " + this.token);
|
||||||
}
|
}
|
||||||
@ -46,56 +48,69 @@ public class RESTApi {
|
|||||||
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
||||||
try {
|
try {
|
||||||
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(), RESTErrorResponseExeption.class);
|
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(),
|
||||||
|
RESTErrorResponseExeption.class);
|
||||||
throw out;
|
throw out;
|
||||||
} catch (final MismatchedInputException ex) {
|
} catch (final MismatchedInputException ex) {
|
||||||
throw new IOException("Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
throw new IOException(
|
||||||
|
"Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.mapper.readValue(httpResponse.body(), new TypeReference<List<T>>() {});
|
return this.mapper.readValue(httpResponse.body(), new TypeReference<List<T>>() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T get(final Class<T> clazz, final String urlOffset) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T> T get(final Class<T> clazz, final String urlOffset)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendJson("GET", clazz, urlOffset, null);
|
return modelSendJson("GET", clazz, urlOffset, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> T post(final Class<T> clazz, final String urlOffset, final U data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> T post(final Class<T> clazz, final String urlOffset, final U data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSend("POST", clazz, urlOffset, data);
|
return modelSend("POST", clazz, urlOffset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> T postJson(final Class<T> clazz, final String urlOffset, final String body) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> T postJson(final Class<T> clazz, final String urlOffset, final String body)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendJson("POST", clazz, urlOffset, body);
|
return modelSendJson("POST", clazz, urlOffset, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T postMap(final Class<T> clazz, final String urlOffset, final Map<String, Object> data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T> T postMap(final Class<T> clazz, final String urlOffset, final Map<String, Object> data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendMap("POST", clazz, urlOffset, data);
|
return modelSendMap("POST", clazz, urlOffset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> T put(final Class<T> clazz, final String urlOffset, final U data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> T put(final Class<T> clazz, final String urlOffset, final U data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSend("PUT", clazz, urlOffset, data);
|
return modelSend("PUT", clazz, urlOffset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> T putJson(final Class<T> clazz, final String urlOffset, final String body) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> T putJson(final Class<T> clazz, final String urlOffset, final String body)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendJson("PUT", clazz, urlOffset, body);
|
return modelSendJson("PUT", clazz, urlOffset, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T putMap(final Class<T> clazz, final String urlOffset, final Map<String, Object> data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T> T putMap(final Class<T> clazz, final String urlOffset, final Map<String, Object> data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendMap("PUT", clazz, urlOffset, data);
|
return modelSendMap("PUT", clazz, urlOffset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> T patch(final Class<T> clazz, final String urlOffset, final U data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> T patch(final Class<T> clazz, final String urlOffset, final U data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSend("PATCH", clazz, urlOffset, data);
|
return modelSend("PATCH", clazz, urlOffset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> T patchJson(final Class<T> clazz, final String urlOffset, final String body) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> T patchJson(final Class<T> clazz, final String urlOffset, final String body)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendJson("PATCH", clazz, urlOffset, body);
|
return modelSendJson("PATCH", clazz, urlOffset, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T patchMap(final Class<T> clazz, final String urlOffset, final Map<String, Object> data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T> T patchMap(final Class<T> clazz, final String urlOffset, final Map<String, Object> data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
return modelSendMap("PATCH", clazz, urlOffset, data);
|
return modelSendMap("PATCH", clazz, urlOffset, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T, U> T modelSend(final String model, final Class<T> clazz, final String urlOffset, final U data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
protected <T, U> T modelSend(final String model, final Class<T> clazz, final String urlOffset, final U data)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return modelSendJson(model, clazz, urlOffset, null);
|
return modelSendJson(model, clazz, urlOffset, null);
|
||||||
} else {
|
} else {
|
||||||
@ -104,10 +119,12 @@ public class RESTApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T, U> T modelSendJson(final String model, final Class<T> clazz, final String urlOffset, String body) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
protected <T, U> T modelSendJson(final String model, final Class<T> clazz, final String urlOffset, String body)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
final HttpClient client = HttpClient.newHttpClient();
|
final HttpClient client = HttpClient.newHttpClient();
|
||||||
// client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
// client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
|
||||||
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1).uri(URI.create(this.baseUrl + urlOffset));
|
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1)
|
||||||
|
.uri(URI.create(this.baseUrl + urlOffset));
|
||||||
LOGGER.trace("call {}: {}", model, URI.create(this.baseUrl + urlOffset));
|
LOGGER.trace("call {}: {}", model, URI.create(this.baseUrl + urlOffset));
|
||||||
LOGGER.trace("DATA: {}", body);
|
LOGGER.trace("DATA: {}", body);
|
||||||
if (this.token != null) {
|
if (this.token != null) {
|
||||||
@ -123,14 +140,17 @@ public class RESTApi {
|
|||||||
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
||||||
LOGGER.trace("Receive Error: {}", httpResponse.body());
|
LOGGER.trace("Receive Error: {}", httpResponse.body());
|
||||||
try {
|
try {
|
||||||
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(), RESTErrorResponseExeption.class);
|
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(),
|
||||||
|
RESTErrorResponseExeption.class);
|
||||||
throw out;
|
throw out;
|
||||||
} catch (final MismatchedInputException ex) {
|
} catch (final MismatchedInputException ex) {
|
||||||
throw new IOException("Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
throw new IOException(
|
||||||
|
"Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
||||||
} catch (final JsonParseException ex) {
|
} catch (final JsonParseException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
LOGGER.error("body: {}", httpResponse.body());
|
LOGGER.error("body: {}", httpResponse.body());
|
||||||
throw new IOException("Fail to get the ERROR data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
throw new IOException(
|
||||||
|
"Fail to get the ERROR data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clazz.equals(String.class)) {
|
if (clazz.equals(String.class)) {
|
||||||
@ -140,10 +160,15 @@ public class RESTApi {
|
|||||||
return this.mapper.readValue(httpResponse.body(), clazz);
|
return this.mapper.readValue(httpResponse.body(), clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <T> T modelSendMap(final String model, final Class<T> clazz, final String urlOffset, final Map<String, Object> data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
protected <T> T modelSendMap(
|
||||||
|
final String model,
|
||||||
|
final Class<T> clazz,
|
||||||
|
final String urlOffset,
|
||||||
|
final Map<String, Object> data) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
final HttpClient client = HttpClient.newHttpClient();
|
final HttpClient client = HttpClient.newHttpClient();
|
||||||
String body = null;
|
String body = null;
|
||||||
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1).uri(URI.create(this.baseUrl + urlOffset));
|
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1)
|
||||||
|
.uri(URI.create(this.baseUrl + urlOffset));
|
||||||
if (this.token != null) {
|
if (this.token != null) {
|
||||||
requestBuilding = requestBuilding.header(HttpHeaders.AUTHORIZATION, "Bearer " + this.token);
|
requestBuilding = requestBuilding.header(HttpHeaders.AUTHORIZATION, "Bearer " + this.token);
|
||||||
}
|
}
|
||||||
@ -157,10 +182,12 @@ public class RESTApi {
|
|||||||
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
||||||
try {
|
try {
|
||||||
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(), RESTErrorResponseExeption.class);
|
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(),
|
||||||
|
RESTErrorResponseExeption.class);
|
||||||
throw out;
|
throw out;
|
||||||
} catch (final MismatchedInputException ex) {
|
} catch (final MismatchedInputException ex) {
|
||||||
throw new IOException("Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
throw new IOException(
|
||||||
|
"Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clazz.equals(String.class)) {
|
if (clazz.equals(String.class)) {
|
||||||
@ -169,9 +196,11 @@ public class RESTApi {
|
|||||||
return this.mapper.readValue(httpResponse.body(), clazz);
|
return this.mapper.readValue(httpResponse.body(), clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T, U> void delete(final Class<T> clazz, final String urlOffset) throws RESTErrorResponseExeption, IOException, InterruptedException {
|
public <T, U> void delete(final Class<T> clazz, final String urlOffset)
|
||||||
|
throws RESTErrorResponseExeption, IOException, InterruptedException {
|
||||||
final HttpClient client = HttpClient.newHttpClient();
|
final HttpClient client = HttpClient.newHttpClient();
|
||||||
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1).uri(URI.create(this.baseUrl + urlOffset));
|
Builder requestBuilding = HttpRequest.newBuilder().version(Version.HTTP_1_1)
|
||||||
|
.uri(URI.create(this.baseUrl + urlOffset));
|
||||||
if (this.token != null) {
|
if (this.token != null) {
|
||||||
requestBuilding = requestBuilding.header(HttpHeaders.AUTHORIZATION, "Bearer " + this.token);
|
requestBuilding = requestBuilding.header(HttpHeaders.AUTHORIZATION, "Bearer " + this.token);
|
||||||
}
|
}
|
||||||
@ -179,10 +208,12 @@ public class RESTApi {
|
|||||||
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
final HttpResponse<String> httpResponse = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
if (httpResponse.statusCode() < 200 || httpResponse.statusCode() >= 300) {
|
||||||
try {
|
try {
|
||||||
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(), RESTErrorResponseExeption.class);
|
final RESTErrorResponseExeption out = this.mapper.readValue(httpResponse.body(),
|
||||||
|
RESTErrorResponseExeption.class);
|
||||||
throw out;
|
throw out;
|
||||||
} catch (final MismatchedInputException ex) {
|
} catch (final MismatchedInputException ex) {
|
||||||
throw new IOException("Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
throw new IOException(
|
||||||
|
"Fail to get the data [" + httpResponse.statusCode() + "] " + httpResponse.body());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,13 @@ public class StepwiseExtension implements ExecutionCondition, TestExecutionExcep
|
|||||||
final ExtensionContext.Store store = storeFor(extensionContext, namespace);
|
final ExtensionContext.Store store = storeFor(extensionContext, namespace);
|
||||||
final String value = store.get(StepwiseExtension.class, String.class);
|
final String value = store.get(StepwiseExtension.class, String.class);
|
||||||
return value == null ? ConditionEvaluationResult.enabled("No test failures in stepwise tests")
|
return value == null ? ConditionEvaluationResult.enabled("No test failures in stepwise tests")
|
||||||
: ConditionEvaluationResult.disabled(String.format("Stepwise test disabled due to previous failure in '%s'", value));
|
: ConditionEvaluationResult
|
||||||
|
.disabled(String.format("Stepwise test disabled due to previous failure in '%s'", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleTestExecutionException(final ExtensionContext extensionContext, final Throwable throwable) throws Throwable {
|
public void handleTestExecutionException(final ExtensionContext extensionContext, final Throwable throwable)
|
||||||
|
throws Throwable {
|
||||||
final ExtensionContext.Namespace namespace = namespaceFor(extensionContext);
|
final ExtensionContext.Namespace namespace = namespaceFor(extensionContext);
|
||||||
final ExtensionContext.Store store = storeFor(extensionContext, namespace);
|
final ExtensionContext.Store store = storeFor(extensionContext, namespace);
|
||||||
store.put(StepwiseExtension.class, extensionContext.getDisplayName());
|
store.put(StepwiseExtension.class, extensionContext.getDisplayName());
|
||||||
@ -27,7 +29,9 @@ public class StepwiseExtension implements ExecutionCondition, TestExecutionExcep
|
|||||||
return ExtensionContext.Namespace.create(StepwiseExtension.class, extensionContext.getParent());
|
return ExtensionContext.Namespace.create(StepwiseExtension.class, extensionContext.getParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExtensionContext.Store storeFor(final ExtensionContext extensionContext, final ExtensionContext.Namespace namespace) {
|
private ExtensionContext.Store storeFor(
|
||||||
|
final ExtensionContext extensionContext,
|
||||||
|
final ExtensionContext.Namespace namespace) {
|
||||||
return extensionContext.getParent().get().getStore(namespace);
|
return extensionContext.getParent().get().getStore(namespace);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -91,7 +91,8 @@ public class TestSimpleTable {
|
|||||||
@Test
|
@Test
|
||||||
public void testReadAllValuesUnreadable() throws Exception {
|
public void testReadAllValuesUnreadable() throws Exception {
|
||||||
// check the full values
|
// check the full values
|
||||||
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject, QueryOptions.READ_ALL_COLOMN);
|
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject,
|
||||||
|
QueryOptions.READ_ALL_COLOMN);
|
||||||
|
|
||||||
Assertions.assertNotNull(retrieve);
|
Assertions.assertNotNull(retrieve);
|
||||||
Assertions.assertNotNull(retrieve.id);
|
Assertions.assertNotNull(retrieve.id);
|
||||||
@ -114,7 +115,8 @@ public class TestSimpleTable {
|
|||||||
final SimpleTable test = new SimpleTable();
|
final SimpleTable test = new SimpleTable();
|
||||||
test.data = TestSimpleTable.DATA_INJECTED_2;
|
test.data = TestSimpleTable.DATA_INJECTED_2;
|
||||||
DataAccess.update(test, TestSimpleTable.idOfTheObject, List.of("data"));
|
DataAccess.update(test, TestSimpleTable.idOfTheObject, List.of("data"));
|
||||||
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject, QueryOptions.READ_ALL_COLOMN);
|
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject,
|
||||||
|
QueryOptions.READ_ALL_COLOMN);
|
||||||
Assertions.assertNotNull(retrieve);
|
Assertions.assertNotNull(retrieve);
|
||||||
Assertions.assertNotNull(retrieve.id);
|
Assertions.assertNotNull(retrieve.id);
|
||||||
Assertions.assertEquals(TestSimpleTable.idOfTheObject, retrieve.id);
|
Assertions.assertEquals(TestSimpleTable.idOfTheObject, retrieve.id);
|
||||||
@ -139,7 +141,8 @@ public class TestSimpleTable {
|
|||||||
public void testReadDeletedObject() throws Exception {
|
public void testReadDeletedObject() throws Exception {
|
||||||
|
|
||||||
// check if we set get deleted element
|
// check if we set get deleted element
|
||||||
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS);
|
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject,
|
||||||
|
QueryOptions.ACCESS_DELETED_ITEMS);
|
||||||
Assertions.assertNull(retrieve);
|
Assertions.assertNull(retrieve);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -148,7 +151,8 @@ public class TestSimpleTable {
|
|||||||
@Test
|
@Test
|
||||||
public void testReadAllValuesUnreadableOfDeletedObject() throws Exception {
|
public void testReadAllValuesUnreadableOfDeletedObject() throws Exception {
|
||||||
// check if we set get deleted element with all data
|
// check if we set get deleted element with all data
|
||||||
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS, QueryOptions.READ_ALL_COLOMN);
|
final SimpleTable retrieve = DataAccess.get(SimpleTable.class, TestSimpleTable.idOfTheObject,
|
||||||
|
QueryOptions.ACCESS_DELETED_ITEMS, QueryOptions.READ_ALL_COLOMN);
|
||||||
Assertions.assertNull(retrieve);
|
Assertions.assertNull(retrieve);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,14 +92,16 @@ public class TestSimpleTableSoftDelete {
|
|||||||
@Test
|
@Test
|
||||||
public void testReadAllValuesUnreadable() throws Exception {
|
public void testReadAllValuesUnreadable() throws Exception {
|
||||||
// check the full values
|
// check the full values
|
||||||
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.READ_ALL_COLOMN);
|
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class,
|
||||||
|
TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.READ_ALL_COLOMN);
|
||||||
|
|
||||||
Assertions.assertNotNull(retrieve);
|
Assertions.assertNotNull(retrieve);
|
||||||
Assertions.assertNotNull(retrieve.id);
|
Assertions.assertNotNull(retrieve.id);
|
||||||
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
||||||
Assertions.assertEquals(TestSimpleTableSoftDelete.DATA_INJECTED, retrieve.data);
|
Assertions.assertEquals(TestSimpleTableSoftDelete.DATA_INJECTED, retrieve.data);
|
||||||
Assertions.assertNotNull(retrieve.createdAt);
|
Assertions.assertNotNull(retrieve.createdAt);
|
||||||
LOGGER.info("start @ {} create @ {}", retrieve.createdAt.toInstant(), TestSimpleTableSoftDelete.startAction.toInstant());
|
LOGGER.info("start @ {} create @ {}", retrieve.createdAt.toInstant(),
|
||||||
|
TestSimpleTableSoftDelete.startAction.toInstant());
|
||||||
// Gros travail sur les timestamp a faire pour que ce soit correct ...
|
// Gros travail sur les timestamp a faire pour que ce soit correct ...
|
||||||
// Assertions.assertTrue(retrieve.createdAt.after(this.startAction));
|
// Assertions.assertTrue(retrieve.createdAt.after(this.startAction));
|
||||||
Assertions.assertNotNull(retrieve.updatedAt);
|
Assertions.assertNotNull(retrieve.updatedAt);
|
||||||
@ -118,7 +120,9 @@ public class TestSimpleTableSoftDelete {
|
|||||||
final SimpleTableSoftDelete test = new SimpleTableSoftDelete();
|
final SimpleTableSoftDelete test = new SimpleTableSoftDelete();
|
||||||
test.data = TestSimpleTableSoftDelete.DATA_INJECTED_2;
|
test.data = TestSimpleTableSoftDelete.DATA_INJECTED_2;
|
||||||
DataAccess.update(test, TestSimpleTableSoftDelete.idOfTheObject, List.of("data"));
|
DataAccess.update(test, TestSimpleTableSoftDelete.idOfTheObject, List.of("data"));
|
||||||
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS, QueryOptions.READ_ALL_COLOMN);
|
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class,
|
||||||
|
TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS,
|
||||||
|
QueryOptions.READ_ALL_COLOMN);
|
||||||
Assertions.assertNotNull(retrieve);
|
Assertions.assertNotNull(retrieve);
|
||||||
Assertions.assertNotNull(retrieve.id);
|
Assertions.assertNotNull(retrieve.id);
|
||||||
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
||||||
@ -141,7 +145,8 @@ public class TestSimpleTableSoftDelete {
|
|||||||
}
|
}
|
||||||
// Delete the entry:
|
// Delete the entry:
|
||||||
DataAccess.delete(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject);
|
DataAccess.delete(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject);
|
||||||
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject);
|
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class,
|
||||||
|
TestSimpleTableSoftDelete.idOfTheObject);
|
||||||
Assertions.assertNull(retrieve);
|
Assertions.assertNull(retrieve);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,7 +155,8 @@ public class TestSimpleTableSoftDelete {
|
|||||||
public void testReadDeletedObject() throws Exception {
|
public void testReadDeletedObject() throws Exception {
|
||||||
|
|
||||||
// check if we set get deleted element
|
// check if we set get deleted element
|
||||||
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS);
|
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class,
|
||||||
|
TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS);
|
||||||
Assertions.assertNotNull(retrieve);
|
Assertions.assertNotNull(retrieve);
|
||||||
Assertions.assertNotNull(retrieve.id);
|
Assertions.assertNotNull(retrieve.id);
|
||||||
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
||||||
@ -165,7 +171,9 @@ public class TestSimpleTableSoftDelete {
|
|||||||
@Test
|
@Test
|
||||||
public void testReadAllValuesUnreadableOfDeletedObject() throws Exception {
|
public void testReadAllValuesUnreadableOfDeletedObject() throws Exception {
|
||||||
// check if we set get deleted element with all data
|
// check if we set get deleted element with all data
|
||||||
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class, TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS, QueryOptions.READ_ALL_COLOMN);
|
final SimpleTableSoftDelete retrieve = DataAccess.get(SimpleTableSoftDelete.class,
|
||||||
|
TestSimpleTableSoftDelete.idOfTheObject, QueryOptions.ACCESS_DELETED_ITEMS,
|
||||||
|
QueryOptions.READ_ALL_COLOMN);
|
||||||
Assertions.assertNotNull(retrieve);
|
Assertions.assertNotNull(retrieve);
|
||||||
Assertions.assertNotNull(retrieve.id);
|
Assertions.assertNotNull(retrieve.id);
|
||||||
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
Assertions.assertEquals(TestSimpleTableSoftDelete.idOfTheObject, retrieve.id);
|
||||||
|
@ -267,7 +267,8 @@ public class TestTypes {
|
|||||||
Assertions.assertNotNull(retrieve.timeStampData);
|
Assertions.assertNotNull(retrieve.timeStampData);
|
||||||
// Can not compare the exact timestamp due to aproximation and model of storing data :
|
// Can not compare the exact timestamp due to aproximation and model of storing data :
|
||||||
// Assertions.assertEquals(insertedData.timeStampData, retrieve.timeStampData);
|
// Assertions.assertEquals(insertedData.timeStampData, retrieve.timeStampData);
|
||||||
Assertions.assertEquals(insertedData.timeStampData.toInstant().toEpochMilli(), retrieve.timeStampData.toInstant().toEpochMilli());
|
Assertions.assertEquals(insertedData.timeStampData.toInstant().toEpochMilli(),
|
||||||
|
retrieve.timeStampData.toInstant().toEpochMilli());
|
||||||
|
|
||||||
DataAccess.delete(TypesTable.class, insertedData.id);
|
DataAccess.delete(TypesTable.class, insertedData.id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user