diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..5008ddfc Binary files /dev/null and b/.DS_Store differ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..14afb729 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,1712 @@ +# for Intellij IDE you can import the file ./intellij-java-google-style.xml +# Settings -> Editor -> Code Style -> 'gear icon' -> Import Schema +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 100 +tab_width = 2 +ij_continuation_indent_size = 4 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_block_comment_add_space = false +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.feature] +tab_width = 4 +ij_continuation_indent_size = 8 +ij_gherkin_keep_indents_on_empty_lines = false + +[*.java] +ij_java_align_consecutive_assignments = false +ij_java_align_consecutive_variable_declarations = false +ij_java_align_group_field_declarations = false +ij_java_align_multiline_annotation_parameters = false +ij_java_align_multiline_array_initializer_expression = false +ij_java_align_multiline_assignment = false +ij_java_align_multiline_binary_operation = false +ij_java_align_multiline_chained_methods = false +ij_java_align_multiline_deconstruction_list_components = true +ij_java_align_multiline_extends_list = false +ij_java_align_multiline_for = false +ij_java_align_multiline_method_parentheses = false +ij_java_align_multiline_parameters = false +ij_java_align_multiline_parameters_in_calls = false +ij_java_align_multiline_parenthesized_expression = false +ij_java_align_multiline_records = true +ij_java_align_multiline_resources = false +ij_java_align_multiline_ternary_operation = false +ij_java_align_multiline_text_blocks = false +ij_java_align_multiline_throws_list = false +ij_java_align_subsequent_simple_methods = false +ij_java_align_throws_keyword = false +ij_java_align_types_in_multi_catch = true +ij_java_annotation_parameter_wrap = off +ij_java_array_initializer_new_line_after_left_brace = false +ij_java_array_initializer_right_brace_on_new_line = false +ij_java_array_initializer_wrap = normal +ij_java_assert_statement_colon_on_next_line = false +ij_java_assert_statement_wrap = off +ij_java_assignment_wrap = off +ij_java_binary_operation_sign_on_next_line = true +ij_java_binary_operation_wrap = normal +ij_java_blank_lines_after_anonymous_class_header = 0 +ij_java_blank_lines_after_class_header = 1 +ij_java_blank_lines_after_imports = 1 +ij_java_blank_lines_after_package = 1 +ij_java_blank_lines_around_class = 1 +ij_java_blank_lines_around_field = 0 +ij_java_blank_lines_around_field_in_interface = 0 +ij_java_blank_lines_around_initializer = 1 +ij_java_blank_lines_around_method = 1 +ij_java_blank_lines_around_method_in_interface = 1 +ij_java_blank_lines_before_class_end = 0 +ij_java_blank_lines_before_imports = 1 +ij_java_blank_lines_before_method_body = 0 +ij_java_blank_lines_before_package = 0 +ij_java_block_brace_style = end_of_line +ij_java_block_comment_add_space = false +ij_java_block_comment_at_first_column = true +ij_java_builder_methods = none +ij_java_call_parameters_new_line_after_left_paren = false +ij_java_call_parameters_right_paren_on_new_line = false +ij_java_call_parameters_wrap = normal +ij_java_case_statement_on_separate_line = true +ij_java_catch_on_new_line = false +ij_java_class_annotation_wrap = split_into_lines +ij_java_class_brace_style = end_of_line +ij_java_class_count_to_use_import_on_demand = 999 +ij_java_class_names_in_javadoc = 1 +ij_java_deconstruction_list_wrap = normal +ij_java_do_not_indent_top_level_class_members = false +ij_java_do_not_wrap_after_single_annotation = false +ij_java_do_not_wrap_after_single_annotation_in_parameter = false +ij_java_do_while_brace_force = always +ij_java_doc_add_blank_line_after_description = true +ij_java_doc_add_blank_line_after_param_comments = false +ij_java_doc_add_blank_line_after_return = false +ij_java_doc_add_p_tag_on_empty_lines = true +ij_java_doc_align_exception_comments = true +ij_java_doc_align_param_comments = true +ij_java_doc_do_not_wrap_if_one_line = false +ij_java_doc_enable_formatting = true +ij_java_doc_enable_leading_asterisks = true +ij_java_doc_indent_on_continuation = false +ij_java_doc_keep_empty_lines = true +ij_java_doc_keep_empty_parameter_tag = true +ij_java_doc_keep_empty_return_tag = true +ij_java_doc_keep_empty_throws_tag = true +ij_java_doc_keep_invalid_tags = true +ij_java_doc_param_description_on_new_line = false +ij_java_doc_preserve_line_breaks = false +ij_java_doc_use_throws_not_exception_tag = true +ij_java_else_on_new_line = false +ij_java_entity_dd_suffix = EJB +ij_java_entity_eb_suffix = Bean +ij_java_entity_hi_suffix = Home +ij_java_entity_lhi_prefix = Local +ij_java_entity_lhi_suffix = Home +ij_java_entity_li_prefix = Local +ij_java_entity_pk_class = java.lang.String +ij_java_entity_vo_suffix = VO +ij_java_enum_constants_wrap = off +ij_java_extends_keyword_wrap = off +ij_java_extends_list_wrap = normal +ij_java_field_annotation_wrap = split_into_lines +ij_java_finally_on_new_line = false +ij_java_for_brace_force = always +ij_java_for_statement_new_line_after_left_paren = false +ij_java_for_statement_right_paren_on_new_line = false +ij_java_for_statement_wrap = normal +ij_java_generate_final_locals = false +ij_java_generate_final_parameters = false +ij_java_if_brace_force = always +ij_java_imports_layout = $*, |, * +ij_java_indent_case_from_switch = true +ij_java_insert_inner_class_imports = true +ij_java_insert_override_annotation = true +ij_java_keep_blank_lines_before_right_brace = 2 +ij_java_keep_blank_lines_between_package_declaration_and_header = 2 +ij_java_keep_blank_lines_in_code = 1 +ij_java_keep_blank_lines_in_declarations = 2 +ij_java_keep_builder_methods_indents = false +ij_java_keep_control_statement_in_one_line = false +ij_java_keep_first_column_comment = true +ij_java_keep_indents_on_empty_lines = false +ij_java_keep_line_breaks = true +ij_java_keep_multiple_expressions_in_one_line = false +ij_java_keep_simple_blocks_in_one_line = false +ij_java_keep_simple_classes_in_one_line = false +ij_java_keep_simple_lambdas_in_one_line = false +ij_java_keep_simple_methods_in_one_line = false +ij_java_label_indent_absolute = false +ij_java_label_indent_size = 0 +ij_java_lambda_brace_style = end_of_line +ij_java_layout_static_imports_separately = true +ij_java_line_comment_add_space = false +ij_java_line_comment_add_space_on_reformat = false +ij_java_line_comment_at_first_column = true +ij_java_message_dd_suffix = EJB +ij_java_message_eb_suffix = Bean +ij_java_method_annotation_wrap = split_into_lines +ij_java_method_brace_style = end_of_line +ij_java_method_call_chain_wrap = normal +ij_java_method_parameters_new_line_after_left_paren = false +ij_java_method_parameters_right_paren_on_new_line = false +ij_java_method_parameters_wrap = normal +ij_java_modifier_list_wrap = false +ij_java_multi_catch_types_wrap = normal +ij_java_names_count_to_use_import_on_demand = 999 +ij_java_new_line_after_lparen_in_annotation = false +ij_java_new_line_after_lparen_in_deconstruction_pattern = true +ij_java_new_line_after_lparen_in_record_header = false +ij_java_parameter_annotation_wrap = off +ij_java_parentheses_expression_new_line_after_left_paren = false +ij_java_parentheses_expression_right_paren_on_new_line = false +ij_java_place_assignment_sign_on_next_line = false +ij_java_prefer_longer_names = true +ij_java_prefer_parameters_wrap = false +ij_java_record_components_wrap = normal +ij_java_repeat_synchronized = true +ij_java_replace_instanceof_and_cast = false +ij_java_replace_null_check = true +ij_java_replace_sum_lambda_with_method_ref = true +ij_java_resource_list_new_line_after_left_paren = false +ij_java_resource_list_right_paren_on_new_line = false +ij_java_resource_list_wrap = off +ij_java_rparen_on_new_line_in_annotation = false +ij_java_rparen_on_new_line_in_deconstruction_pattern = true +ij_java_rparen_on_new_line_in_record_header = false +ij_java_session_dd_suffix = EJB +ij_java_session_eb_suffix = Bean +ij_java_session_hi_suffix = Home +ij_java_session_lhi_prefix = Local +ij_java_session_lhi_suffix = Home +ij_java_session_li_prefix = Local +ij_java_session_si_suffix = Service +ij_java_space_after_closing_angle_bracket_in_type_argument = false +ij_java_space_after_colon = true +ij_java_space_after_comma = true +ij_java_space_after_comma_in_type_arguments = true +ij_java_space_after_for_semicolon = true +ij_java_space_after_quest = true +ij_java_space_after_type_cast = true +ij_java_space_before_annotation_array_initializer_left_brace = false +ij_java_space_before_annotation_parameter_list = false +ij_java_space_before_array_initializer_left_brace = false +ij_java_space_before_catch_keyword = true +ij_java_space_before_catch_left_brace = true +ij_java_space_before_catch_parentheses = true +ij_java_space_before_class_left_brace = true +ij_java_space_before_colon = true +ij_java_space_before_colon_in_foreach = true +ij_java_space_before_comma = false +ij_java_space_before_deconstruction_list = false +ij_java_space_before_do_left_brace = true +ij_java_space_before_else_keyword = true +ij_java_space_before_else_left_brace = true +ij_java_space_before_finally_keyword = true +ij_java_space_before_finally_left_brace = true +ij_java_space_before_for_left_brace = true +ij_java_space_before_for_parentheses = true +ij_java_space_before_for_semicolon = false +ij_java_space_before_if_left_brace = true +ij_java_space_before_if_parentheses = true +ij_java_space_before_method_call_parentheses = false +ij_java_space_before_method_left_brace = true +ij_java_space_before_method_parentheses = false +ij_java_space_before_opening_angle_bracket_in_type_parameter = false +ij_java_space_before_quest = true +ij_java_space_before_switch_left_brace = true +ij_java_space_before_switch_parentheses = true +ij_java_space_before_synchronized_left_brace = true +ij_java_space_before_synchronized_parentheses = true +ij_java_space_before_try_left_brace = true +ij_java_space_before_try_parentheses = true +ij_java_space_before_type_parameter_list = false +ij_java_space_before_while_keyword = true +ij_java_space_before_while_left_brace = true +ij_java_space_before_while_parentheses = true +ij_java_space_inside_one_line_enum_braces = false +ij_java_space_within_empty_array_initializer_braces = false +ij_java_space_within_empty_method_call_parentheses = false +ij_java_space_within_empty_method_parentheses = false +ij_java_spaces_around_additive_operators = true +ij_java_spaces_around_annotation_eq = true +ij_java_spaces_around_assignment_operators = true +ij_java_spaces_around_bitwise_operators = true +ij_java_spaces_around_equality_operators = true +ij_java_spaces_around_lambda_arrow = true +ij_java_spaces_around_logical_operators = true +ij_java_spaces_around_method_ref_dbl_colon = false +ij_java_spaces_around_multiplicative_operators = true +ij_java_spaces_around_relational_operators = true +ij_java_spaces_around_shift_operators = true +ij_java_spaces_around_type_bounds_in_type_parameters = true +ij_java_spaces_around_unary_operator = false +ij_java_spaces_within_angle_brackets = false +ij_java_spaces_within_annotation_parentheses = false +ij_java_spaces_within_array_initializer_braces = false +ij_java_spaces_within_braces = false +ij_java_spaces_within_brackets = false +ij_java_spaces_within_cast_parentheses = false +ij_java_spaces_within_catch_parentheses = false +ij_java_spaces_within_deconstruction_list = false +ij_java_spaces_within_for_parentheses = false +ij_java_spaces_within_if_parentheses = false +ij_java_spaces_within_method_call_parentheses = false +ij_java_spaces_within_method_parentheses = false +ij_java_spaces_within_parentheses = false +ij_java_spaces_within_record_header = false +ij_java_spaces_within_switch_parentheses = false +ij_java_spaces_within_synchronized_parentheses = false +ij_java_spaces_within_try_parentheses = false +ij_java_spaces_within_while_parentheses = false +ij_java_special_else_if_treatment = true +ij_java_subclass_name_suffix = Impl +ij_java_ternary_operation_signs_on_next_line = true +ij_java_ternary_operation_wrap = normal +ij_java_test_name_suffix = Test +ij_java_throws_keyword_wrap = normal +ij_java_throws_list_wrap = off +ij_java_use_external_annotations = false +ij_java_use_fq_class_names = false +ij_java_use_relative_indents = false +ij_java_use_single_class_imports = true +ij_java_variable_annotation_wrap = off +ij_java_visibility = public +ij_java_while_brace_force = always +ij_java_while_on_new_line = false +ij_java_wrap_comments = true +ij_java_wrap_first_method_in_call_chain = false +ij_java_wrap_long_lines = false + +[*.less] +tab_width = 4 +ij_continuation_indent_size = 8 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_block_comment_add_space = false +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_line_comment_add_space = false +ij_less_line_comment_at_first_column = false +ij_less_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 + +[*.proto] +max_line_length = 80 +ij_continuation_indent_size = 2 +ij_protobuf_keep_blank_lines_in_code = 2 +ij_protobuf_keep_indents_on_empty_lines = false +ij_protobuf_keep_line_breaks = true +ij_protobuf_space_after_comma = true +ij_protobuf_space_before_comma = false +ij_protobuf_spaces_around_assignment_operators = true +ij_protobuf_spaces_within_braces = false +ij_protobuf_spaces_within_brackets = false + +[*.sass] +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_line_comment_add_space = false +ij_sass_line_comment_at_first_column = false +ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scala] +ij_continuation_indent_size = 2 +ij_scala_align_composite_pattern = true +ij_scala_align_extends_with = 0 +ij_scala_align_group_field_declarations = false +ij_scala_align_if_else = false +ij_scala_align_in_columns_case_branch = false +ij_scala_align_multiline_binary_operation = false +ij_scala_align_multiline_chained_methods = false +ij_scala_align_multiline_for = true +ij_scala_align_multiline_parameters = true +ij_scala_align_multiline_parameters_in_calls = false +ij_scala_align_multiline_parenthesized_expression = false +ij_scala_align_parameter_types_in_multiline_declarations = 0 +ij_scala_align_tuple_elements = false +ij_scala_alternate_continuation_indent_for_params = 4 +ij_scala_binary_operation_wrap = off +ij_scala_blank_lines_after_anonymous_class_header = 0 +ij_scala_blank_lines_after_class_header = 0 +ij_scala_blank_lines_after_imports = 1 +ij_scala_blank_lines_after_package = 1 +ij_scala_blank_lines_around_class = 1 +ij_scala_blank_lines_around_class_in_inner_scopes = 0 +ij_scala_blank_lines_around_field = 0 +ij_scala_blank_lines_around_field_in_inner_scopes = 0 +ij_scala_blank_lines_around_field_in_interface = 0 +ij_scala_blank_lines_around_method = 1 +ij_scala_blank_lines_around_method_in_inner_scopes = 1 +ij_scala_blank_lines_around_method_in_interface = 1 +ij_scala_blank_lines_before_class_end = 0 +ij_scala_blank_lines_before_imports = 1 +ij_scala_blank_lines_before_method_body = 0 +ij_scala_blank_lines_before_package = 0 +ij_scala_block_brace_style = end_of_line +ij_scala_block_comment_add_space = false +ij_scala_block_comment_at_first_column = true +ij_scala_call_parameters_new_line_after_lparen = 0 +ij_scala_call_parameters_right_paren_on_new_line = false +ij_scala_call_parameters_wrap = off +ij_scala_case_clause_brace_force = never +ij_scala_catch_on_new_line = false +ij_scala_class_annotation_wrap = split_into_lines +ij_scala_class_brace_style = end_of_line +ij_scala_closure_brace_force = never +ij_scala_do_not_align_block_expr_params = true +ij_scala_do_not_indent_case_clause_body = false +ij_scala_do_not_indent_tuples_close_brace = true +ij_scala_do_while_brace_force = never +ij_scala_else_on_new_line = false +ij_scala_enable_scaladoc_formatting = true +ij_scala_enforce_functional_syntax_for_unit = true +ij_scala_extends_keyword_wrap = off +ij_scala_extends_list_wrap = off +ij_scala_field_annotation_wrap = split_into_lines +ij_scala_finally_brace_force = never +ij_scala_finally_on_new_line = false +ij_scala_for_brace_force = never +ij_scala_for_statement_wrap = off +ij_scala_formatter = 0 +ij_scala_if_brace_force = never +ij_scala_implicit_value_class_suffix = Ops +ij_scala_indent_braced_function_args = true +ij_scala_indent_case_from_switch = true +ij_scala_indent_first_parameter = true +ij_scala_indent_first_parameter_clause = false +ij_scala_indent_type_arguments = true +ij_scala_indent_type_parameters = true +ij_scala_indent_yield_after_one_line_enumerators = true +ij_scala_keep_blank_lines_before_right_brace = 2 +ij_scala_keep_blank_lines_in_code = 2 +ij_scala_keep_blank_lines_in_declarations = 2 +ij_scala_keep_comments_on_same_line = true +ij_scala_keep_first_column_comment = false +ij_scala_keep_indents_on_empty_lines = false +ij_scala_keep_line_breaks = true +ij_scala_keep_one_line_lambdas_in_arg_list = false +ij_scala_keep_simple_blocks_in_one_line = false +ij_scala_keep_simple_methods_in_one_line = false +ij_scala_keep_xml_formatting = false +ij_scala_line_comment_add_space = false +ij_scala_line_comment_at_first_column = true +ij_scala_method_annotation_wrap = split_into_lines +ij_scala_method_brace_force = never +ij_scala_method_brace_style = end_of_line +ij_scala_method_call_chain_wrap = off +ij_scala_method_parameters_new_line_after_left_paren = false +ij_scala_method_parameters_right_paren_on_new_line = false +ij_scala_method_parameters_wrap = off +ij_scala_modifier_list_wrap = false +ij_scala_multiline_string_align_dangling_closing_quotes = false +ij_scala_multiline_string_closing_quotes_on_new_line = false +ij_scala_multiline_string_insert_margin_on_enter = true +ij_scala_multiline_string_margin_char = | +ij_scala_multiline_string_margin_indent = 2 +ij_scala_multiline_string_opening_quotes_on_new_line = true +ij_scala_multiline_string_process_margin_on_copy_paste = true +ij_scala_new_line_after_case_clause_arrow_when_multiline_body = false +ij_scala_newline_after_annotations = false +ij_scala_not_continuation_indent_for_params = false +ij_scala_parameter_annotation_wrap = off +ij_scala_parentheses_expression_new_line_after_left_paren = false +ij_scala_parentheses_expression_right_paren_on_new_line = false +ij_scala_place_closure_parameters_on_new_line = false +ij_scala_place_self_type_on_new_line = true +ij_scala_prefer_parameters_wrap = false +ij_scala_preserve_space_after_method_declaration_name = false +ij_scala_reformat_on_compile = false +ij_scala_replace_case_arrow_with_unicode_char = false +ij_scala_replace_for_generator_arrow_with_unicode_char = false +ij_scala_replace_lambda_with_greek_letter = false +ij_scala_replace_map_arrow_with_unicode_char = false +ij_scala_scalafmt_fallback_to_default_settings = false +ij_scala_scalafmt_reformat_on_files_save = false +ij_scala_scalafmt_show_invalid_code_warnings = true +ij_scala_scalafmt_use_intellij_formatter_for_range_format = true +ij_scala_sd_align_exception_comments = true +ij_scala_sd_align_list_item_content = true +ij_scala_sd_align_other_tags_comments = true +ij_scala_sd_align_parameters_comments = true +ij_scala_sd_align_return_comments = true +ij_scala_sd_blank_line_after_parameters_comments = false +ij_scala_sd_blank_line_after_return_comments = false +ij_scala_sd_blank_line_before_parameters = false +ij_scala_sd_blank_line_before_tags = true +ij_scala_sd_blank_line_between_parameters = false +ij_scala_sd_keep_blank_lines_between_tags = false +ij_scala_sd_preserve_spaces_in_tags = false +ij_scala_space_after_comma = true +ij_scala_space_after_for_semicolon = true +ij_scala_space_after_modifiers_constructor = false +ij_scala_space_after_type_colon = true +ij_scala_space_before_brace_method_call = true +ij_scala_space_before_class_left_brace = true +ij_scala_space_before_for_parentheses = true +ij_scala_space_before_if_parentheses = true +ij_scala_space_before_infix_like_method_parentheses = false +ij_scala_space_before_infix_method_call_parentheses = false +ij_scala_space_before_infix_operator_like_method_call_parentheses = true +ij_scala_space_before_method_call_parentheses = false +ij_scala_space_before_method_left_brace = true +ij_scala_space_before_method_parentheses = false +ij_scala_space_before_type_colon = false +ij_scala_space_before_type_parameter_in_def_list = false +ij_scala_space_before_type_parameter_leading_context_bound_colon = false +ij_scala_space_before_type_parameter_leading_context_bound_colon_hk = true +ij_scala_space_before_type_parameter_list = false +ij_scala_space_before_type_parameter_rest_context_bound_colons = true +ij_scala_space_before_while_parentheses = true +ij_scala_space_inside_closure_braces = true +ij_scala_space_inside_self_type_braces = true +ij_scala_space_within_empty_method_call_parentheses = false +ij_scala_spaces_around_at_in_patterns = false +ij_scala_spaces_in_imports = false +ij_scala_spaces_in_one_line_blocks = false +ij_scala_spaces_within_brackets = false +ij_scala_spaces_within_for_parentheses = false +ij_scala_spaces_within_if_parentheses = false +ij_scala_spaces_within_method_call_parentheses = false +ij_scala_spaces_within_method_parentheses = false +ij_scala_spaces_within_parentheses = false +ij_scala_spaces_within_while_parentheses = false +ij_scala_special_else_if_treatment = true +ij_scala_trailing_comma_arg_list_enabled = true +ij_scala_trailing_comma_import_selector_enabled = false +ij_scala_trailing_comma_mode = trailing_comma_keep +ij_scala_trailing_comma_params_enabled = true +ij_scala_trailing_comma_pattern_arg_list_enabled = false +ij_scala_trailing_comma_tuple_enabled = false +ij_scala_trailing_comma_tuple_type_enabled = false +ij_scala_trailing_comma_type_params_enabled = false +ij_scala_try_brace_force = never +ij_scala_type_annotation_exclude_constant = true +ij_scala_type_annotation_exclude_in_dialect_sources = true +ij_scala_type_annotation_exclude_in_test_sources = false +ij_scala_type_annotation_exclude_member_of_anonymous_class = false +ij_scala_type_annotation_exclude_member_of_private_class = false +ij_scala_type_annotation_exclude_when_type_is_stable = true +ij_scala_type_annotation_function_parameter = false +ij_scala_type_annotation_implicit_modifier = true +ij_scala_type_annotation_local_definition = false +ij_scala_type_annotation_private_member = false +ij_scala_type_annotation_protected_member = true +ij_scala_type_annotation_public_member = true +ij_scala_type_annotation_structural_type = true +ij_scala_type_annotation_underscore_parameter = false +ij_scala_type_annotation_unit_type = true +ij_scala_use_alternate_continuation_indent_for_params = false +ij_scala_use_scala3_indentation_based_syntax = true +ij_scala_use_scaladoc2_formatting = false +ij_scala_variable_annotation_wrap = off +ij_scala_while_brace_force = never +ij_scala_while_on_new_line = false +ij_scala_wrap_before_with_keyword = false +ij_scala_wrap_first_method_in_call_chain = false +ij_scala_wrap_long_lines = false + +[*.scss] +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_block_comment_add_space = false +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_line_comment_add_space = false +ij_scss_line_comment_at_first_column = false +ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 + +[*.vue] +ij_vue_indent_children_of_top_level = template +ij_vue_interpolation_new_line_after_start_delimiter = true +ij_vue_interpolation_new_line_before_end_delimiter = true +ij_vue_interpolation_wrap = off +ij_vue_keep_indents_on_empty_lines = false +ij_vue_spaces_within_interpolation_expressions = true + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdd,*.wsdl,*.xjb,*.xml,*.xsd,*.xsl,*.xslt,*.xul,phpunit.xml.dist}] +ij_continuation_indent_size = 2 +ij_xml_align_attributes = false +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_add_space = false +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal +ij_xml_use_custom_settings = true + +[{*.ats,*.cts,*.mts,*.ts}] +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_block_comment_add_space = false +ij_typescript_block_comment_at_first_column = true +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_enum_constants_wrap = on_every_item +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = false +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = auto +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash,*.sh,*.zsh}] +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false +ij_shell_use_unix_line_separator = true + +[{*.cjs,*.js}] +max_line_length = 80 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = false +ij_javascript_align_multiline_parameters = false +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = normal +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = true +ij_javascript_binary_operation_wrap = normal +ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_block_comment_add_space = false +ij_javascript_block_comment_at_first_column = true +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = normal +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = always +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = always +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = normal +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = always +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = false +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 1 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = normal +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = true +ij_javascript_ternary_operation_wrap = normal +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = auto +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = always +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.ctp,*.hphp,*.inc,*.module,*.php4,*.php5,*.phtml}] +indent_size = 4 +tab_width = 4 +ij_php_align_assignments = false +ij_php_align_class_constants = false +ij_php_align_enum_cases = false +ij_php_align_group_field_declarations = false +ij_php_align_inline_comments = false +ij_php_align_key_value_pairs = false +ij_php_align_match_arm_bodies = false +ij_php_align_multiline_array_initializer_expression = false +ij_php_align_multiline_binary_operation = false +ij_php_align_multiline_chained_methods = false +ij_php_align_multiline_extends_list = false +ij_php_align_multiline_for = true +ij_php_align_multiline_parameters = true +ij_php_align_multiline_parameters_in_calls = false +ij_php_align_multiline_ternary_operation = false +ij_php_align_named_arguments = false +ij_php_align_phpdoc_comments = false +ij_php_align_phpdoc_param_names = false +ij_php_anonymous_brace_style = end_of_line +ij_php_api_weight = 28 +ij_php_array_initializer_new_line_after_left_brace = false +ij_php_array_initializer_right_brace_on_new_line = false +ij_php_array_initializer_wrap = off +ij_php_assignment_wrap = off +ij_php_attributes_wrap = off +ij_php_author_weight = 28 +ij_php_binary_operation_sign_on_next_line = false +ij_php_binary_operation_wrap = off +ij_php_blank_lines_after_class_header = 0 +ij_php_blank_lines_after_function = 1 +ij_php_blank_lines_after_imports = 1 +ij_php_blank_lines_after_opening_tag = 0 +ij_php_blank_lines_after_package = 0 +ij_php_blank_lines_around_class = 1 +ij_php_blank_lines_around_constants = 0 +ij_php_blank_lines_around_enum_cases = 0 +ij_php_blank_lines_around_field = 0 +ij_php_blank_lines_around_method = 1 +ij_php_blank_lines_before_class_end = 0 +ij_php_blank_lines_before_imports = 1 +ij_php_blank_lines_before_method_body = 0 +ij_php_blank_lines_before_package = 1 +ij_php_blank_lines_before_return_statement = 0 +ij_php_blank_lines_between_imports = 0 +ij_php_block_brace_style = end_of_line +ij_php_call_parameters_new_line_after_left_paren = false +ij_php_call_parameters_right_paren_on_new_line = false +ij_php_call_parameters_wrap = off +ij_php_catch_on_new_line = false +ij_php_category_weight = 28 +ij_php_class_brace_style = next_line +ij_php_comma_after_last_argument = false +ij_php_comma_after_last_array_element = false +ij_php_comma_after_last_closure_use_var = false +ij_php_comma_after_last_match_arm = false +ij_php_comma_after_last_parameter = false +ij_php_concat_spaces = true +ij_php_copyright_weight = 28 +ij_php_deprecated_weight = 28 +ij_php_do_while_brace_force = never +ij_php_else_if_style = as_is +ij_php_else_on_new_line = false +ij_php_example_weight = 28 +ij_php_extends_keyword_wrap = off +ij_php_extends_list_wrap = off +ij_php_fields_default_visibility = private +ij_php_filesource_weight = 28 +ij_php_finally_on_new_line = false +ij_php_for_brace_force = never +ij_php_for_statement_new_line_after_left_paren = false +ij_php_for_statement_right_paren_on_new_line = false +ij_php_for_statement_wrap = off +ij_php_force_empty_methods_in_one_line = false +ij_php_force_short_declaration_array_style = false +ij_php_getters_setters_naming_style = camel_case +ij_php_getters_setters_order_style = getters_first +ij_php_global_weight = 28 +ij_php_group_use_wrap = on_every_item +ij_php_if_brace_force = never +ij_php_if_lparen_on_next_line = false +ij_php_if_rparen_on_next_line = false +ij_php_ignore_weight = 28 +ij_php_import_sorting = alphabetic +ij_php_indent_break_from_case = true +ij_php_indent_case_from_switch = true +ij_php_indent_code_in_php_tags = false +ij_php_internal_weight = 28 +ij_php_keep_blank_lines_after_lbrace = 2 +ij_php_keep_blank_lines_before_right_brace = 2 +ij_php_keep_blank_lines_in_code = 2 +ij_php_keep_blank_lines_in_declarations = 2 +ij_php_keep_control_statement_in_one_line = true +ij_php_keep_first_column_comment = true +ij_php_keep_indents_on_empty_lines = false +ij_php_keep_line_breaks = true +ij_php_keep_rparen_and_lbrace_on_one_line = false +ij_php_keep_simple_classes_in_one_line = false +ij_php_keep_simple_methods_in_one_line = false +ij_php_lambda_brace_style = end_of_line +ij_php_license_weight = 28 +ij_php_line_comment_add_space = false +ij_php_line_comment_at_first_column = true +ij_php_link_weight = 28 +ij_php_lower_case_boolean_const = false +ij_php_lower_case_keywords = true +ij_php_lower_case_null_const = false +ij_php_method_brace_style = next_line +ij_php_method_call_chain_wrap = off +ij_php_method_parameters_new_line_after_left_paren = false +ij_php_method_parameters_right_paren_on_new_line = false +ij_php_method_parameters_wrap = off +ij_php_method_weight = 28 +ij_php_modifier_list_wrap = false +ij_php_multiline_chained_calls_semicolon_on_new_line = false +ij_php_namespace_brace_style = 1 +ij_php_new_line_after_php_opening_tag = false +ij_php_null_type_position = in_the_end +ij_php_package_weight = 28 +ij_php_param_weight = 0 +ij_php_parameters_attributes_wrap = off +ij_php_parentheses_expression_new_line_after_left_paren = false +ij_php_parentheses_expression_right_paren_on_new_line = false +ij_php_phpdoc_blank_line_before_tags = false +ij_php_phpdoc_blank_lines_around_parameters = false +ij_php_phpdoc_keep_blank_lines = true +ij_php_phpdoc_param_spaces_between_name_and_description = 1 +ij_php_phpdoc_param_spaces_between_tag_and_type = 1 +ij_php_phpdoc_param_spaces_between_type_and_name = 1 +ij_php_phpdoc_use_fqcn = false +ij_php_phpdoc_wrap_long_lines = false +ij_php_place_assignment_sign_on_next_line = false +ij_php_place_parens_for_constructor = 0 +ij_php_property_read_weight = 28 +ij_php_property_weight = 28 +ij_php_property_write_weight = 28 +ij_php_return_type_on_new_line = false +ij_php_return_weight = 1 +ij_php_see_weight = 28 +ij_php_since_weight = 28 +ij_php_sort_phpdoc_elements = true +ij_php_space_after_colon = true +ij_php_space_after_colon_in_enum_backed_type = true +ij_php_space_after_colon_in_named_argument = true +ij_php_space_after_colon_in_return_type = true +ij_php_space_after_comma = true +ij_php_space_after_for_semicolon = true +ij_php_space_after_quest = true +ij_php_space_after_type_cast = false +ij_php_space_after_unary_not = false +ij_php_space_before_array_initializer_left_brace = false +ij_php_space_before_catch_keyword = true +ij_php_space_before_catch_left_brace = true +ij_php_space_before_catch_parentheses = true +ij_php_space_before_class_left_brace = true +ij_php_space_before_closure_left_parenthesis = true +ij_php_space_before_colon = true +ij_php_space_before_colon_in_enum_backed_type = false +ij_php_space_before_colon_in_named_argument = false +ij_php_space_before_colon_in_return_type = false +ij_php_space_before_comma = false +ij_php_space_before_do_left_brace = true +ij_php_space_before_else_keyword = true +ij_php_space_before_else_left_brace = true +ij_php_space_before_finally_keyword = true +ij_php_space_before_finally_left_brace = true +ij_php_space_before_for_left_brace = true +ij_php_space_before_for_parentheses = true +ij_php_space_before_for_semicolon = false +ij_php_space_before_if_left_brace = true +ij_php_space_before_if_parentheses = true +ij_php_space_before_method_call_parentheses = false +ij_php_space_before_method_left_brace = true +ij_php_space_before_method_parentheses = false +ij_php_space_before_quest = true +ij_php_space_before_short_closure_left_parenthesis = false +ij_php_space_before_switch_left_brace = true +ij_php_space_before_switch_parentheses = true +ij_php_space_before_try_left_brace = true +ij_php_space_before_unary_not = false +ij_php_space_before_while_keyword = true +ij_php_space_before_while_left_brace = true +ij_php_space_before_while_parentheses = true +ij_php_space_between_ternary_quest_and_colon = false +ij_php_spaces_around_additive_operators = true +ij_php_spaces_around_arrow = false +ij_php_spaces_around_assignment_in_declare = false +ij_php_spaces_around_assignment_operators = true +ij_php_spaces_around_bitwise_operators = true +ij_php_spaces_around_equality_operators = true +ij_php_spaces_around_logical_operators = true +ij_php_spaces_around_multiplicative_operators = true +ij_php_spaces_around_null_coalesce_operator = true +ij_php_spaces_around_pipe_in_union_type = false +ij_php_spaces_around_relational_operators = true +ij_php_spaces_around_shift_operators = true +ij_php_spaces_around_unary_operator = false +ij_php_spaces_around_var_within_brackets = false +ij_php_spaces_within_array_initializer_braces = false +ij_php_spaces_within_brackets = false +ij_php_spaces_within_catch_parentheses = false +ij_php_spaces_within_for_parentheses = false +ij_php_spaces_within_if_parentheses = false +ij_php_spaces_within_method_call_parentheses = false +ij_php_spaces_within_method_parentheses = false +ij_php_spaces_within_parentheses = false +ij_php_spaces_within_short_echo_tags = true +ij_php_spaces_within_switch_parentheses = false +ij_php_spaces_within_while_parentheses = false +ij_php_special_else_if_treatment = false +ij_php_subpackage_weight = 28 +ij_php_ternary_operation_signs_on_next_line = false +ij_php_ternary_operation_wrap = off +ij_php_throws_weight = 2 +ij_php_todo_weight = 28 +ij_php_treat_multiline_arrays_and_lambdas_multiline = false +ij_php_unknown_tag_weight = 28 +ij_php_upper_case_boolean_const = false +ij_php_upper_case_null_const = false +ij_php_uses_weight = 28 +ij_php_var_weight = 28 +ij_php_variable_naming_style = mixed +ij_php_version_weight = 28 +ij_php_while_brace_force = never +ij_php_while_on_new_line = false + +[{*.ft,*.vm,*.vsl}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_vtl_keep_indents_on_empty_lines = false + +[{*.gant,*.groovy,*.gy}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_groovy_align_group_field_declarations = false +ij_groovy_align_multiline_array_initializer_expression = false +ij_groovy_align_multiline_assignment = false +ij_groovy_align_multiline_binary_operation = false +ij_groovy_align_multiline_chained_methods = false +ij_groovy_align_multiline_extends_list = false +ij_groovy_align_multiline_for = true +ij_groovy_align_multiline_list_or_map = true +ij_groovy_align_multiline_method_parentheses = false +ij_groovy_align_multiline_parameters = true +ij_groovy_align_multiline_parameters_in_calls = false +ij_groovy_align_multiline_resources = true +ij_groovy_align_multiline_ternary_operation = false +ij_groovy_align_multiline_throws_list = false +ij_groovy_align_named_args_in_map = true +ij_groovy_align_throws_keyword = false +ij_groovy_array_initializer_new_line_after_left_brace = false +ij_groovy_array_initializer_right_brace_on_new_line = false +ij_groovy_array_initializer_wrap = off +ij_groovy_assert_statement_wrap = off +ij_groovy_assignment_wrap = off +ij_groovy_binary_operation_wrap = off +ij_groovy_blank_lines_after_class_header = 0 +ij_groovy_blank_lines_after_imports = 1 +ij_groovy_blank_lines_after_package = 1 +ij_groovy_blank_lines_around_class = 1 +ij_groovy_blank_lines_around_field = 0 +ij_groovy_blank_lines_around_field_in_interface = 0 +ij_groovy_blank_lines_around_method = 1 +ij_groovy_blank_lines_around_method_in_interface = 1 +ij_groovy_blank_lines_before_imports = 1 +ij_groovy_blank_lines_before_method_body = 0 +ij_groovy_blank_lines_before_package = 0 +ij_groovy_block_brace_style = end_of_line +ij_groovy_block_comment_add_space = false +ij_groovy_block_comment_at_first_column = true +ij_groovy_call_parameters_new_line_after_left_paren = false +ij_groovy_call_parameters_right_paren_on_new_line = false +ij_groovy_call_parameters_wrap = off +ij_groovy_catch_on_new_line = false +ij_groovy_class_annotation_wrap = split_into_lines +ij_groovy_class_brace_style = end_of_line +ij_groovy_class_count_to_use_import_on_demand = 5 +ij_groovy_do_while_brace_force = never +ij_groovy_else_on_new_line = false +ij_groovy_enable_groovydoc_formatting = true +ij_groovy_enum_constants_wrap = off +ij_groovy_extends_keyword_wrap = off +ij_groovy_extends_list_wrap = off +ij_groovy_field_annotation_wrap = split_into_lines +ij_groovy_finally_on_new_line = false +ij_groovy_for_brace_force = never +ij_groovy_for_statement_new_line_after_left_paren = false +ij_groovy_for_statement_right_paren_on_new_line = false +ij_groovy_for_statement_wrap = off +ij_groovy_ginq_general_clause_wrap_policy = 2 +ij_groovy_ginq_having_wrap_policy = 1 +ij_groovy_ginq_indent_having_clause = true +ij_groovy_ginq_indent_on_clause = true +ij_groovy_ginq_on_wrap_policy = 1 +ij_groovy_ginq_space_after_keyword = true +ij_groovy_if_brace_force = never +ij_groovy_import_annotation_wrap = 2 +ij_groovy_imports_layout = *, |, javax.**, java.**, |, $* +ij_groovy_indent_case_from_switch = true +ij_groovy_indent_label_blocks = true +ij_groovy_insert_inner_class_imports = false +ij_groovy_keep_blank_lines_before_right_brace = 2 +ij_groovy_keep_blank_lines_in_code = 2 +ij_groovy_keep_blank_lines_in_declarations = 2 +ij_groovy_keep_control_statement_in_one_line = true +ij_groovy_keep_first_column_comment = true +ij_groovy_keep_indents_on_empty_lines = false +ij_groovy_keep_line_breaks = true +ij_groovy_keep_multiple_expressions_in_one_line = false +ij_groovy_keep_simple_blocks_in_one_line = false +ij_groovy_keep_simple_classes_in_one_line = true +ij_groovy_keep_simple_lambdas_in_one_line = true +ij_groovy_keep_simple_methods_in_one_line = true +ij_groovy_label_indent_absolute = false +ij_groovy_label_indent_size = 0 +ij_groovy_lambda_brace_style = end_of_line +ij_groovy_layout_static_imports_separately = true +ij_groovy_line_comment_add_space = false +ij_groovy_line_comment_add_space_on_reformat = false +ij_groovy_line_comment_at_first_column = true +ij_groovy_method_annotation_wrap = split_into_lines +ij_groovy_method_brace_style = end_of_line +ij_groovy_method_call_chain_wrap = off +ij_groovy_method_parameters_new_line_after_left_paren = false +ij_groovy_method_parameters_right_paren_on_new_line = false +ij_groovy_method_parameters_wrap = off +ij_groovy_modifier_list_wrap = false +ij_groovy_names_count_to_use_import_on_demand = 3 +ij_groovy_packages_to_use_import_on_demand = java.awt.*, javax.swing.* +ij_groovy_parameter_annotation_wrap = off +ij_groovy_parentheses_expression_new_line_after_left_paren = false +ij_groovy_parentheses_expression_right_paren_on_new_line = false +ij_groovy_prefer_parameters_wrap = false +ij_groovy_resource_list_new_line_after_left_paren = false +ij_groovy_resource_list_right_paren_on_new_line = false +ij_groovy_resource_list_wrap = off +ij_groovy_space_after_assert_separator = true +ij_groovy_space_after_colon = true +ij_groovy_space_after_comma = true +ij_groovy_space_after_comma_in_type_arguments = true +ij_groovy_space_after_for_semicolon = true +ij_groovy_space_after_quest = true +ij_groovy_space_after_type_cast = true +ij_groovy_space_before_annotation_parameter_list = false +ij_groovy_space_before_array_initializer_left_brace = false +ij_groovy_space_before_assert_separator = false +ij_groovy_space_before_catch_keyword = true +ij_groovy_space_before_catch_left_brace = true +ij_groovy_space_before_catch_parentheses = true +ij_groovy_space_before_class_left_brace = true +ij_groovy_space_before_closure_left_brace = true +ij_groovy_space_before_colon = true +ij_groovy_space_before_comma = false +ij_groovy_space_before_do_left_brace = true +ij_groovy_space_before_else_keyword = true +ij_groovy_space_before_else_left_brace = true +ij_groovy_space_before_finally_keyword = true +ij_groovy_space_before_finally_left_brace = true +ij_groovy_space_before_for_left_brace = true +ij_groovy_space_before_for_parentheses = true +ij_groovy_space_before_for_semicolon = false +ij_groovy_space_before_if_left_brace = true +ij_groovy_space_before_if_parentheses = true +ij_groovy_space_before_method_call_parentheses = false +ij_groovy_space_before_method_left_brace = true +ij_groovy_space_before_method_parentheses = false +ij_groovy_space_before_quest = true +ij_groovy_space_before_record_parentheses = false +ij_groovy_space_before_switch_left_brace = true +ij_groovy_space_before_switch_parentheses = true +ij_groovy_space_before_synchronized_left_brace = true +ij_groovy_space_before_synchronized_parentheses = true +ij_groovy_space_before_try_left_brace = true +ij_groovy_space_before_try_parentheses = true +ij_groovy_space_before_while_keyword = true +ij_groovy_space_before_while_left_brace = true +ij_groovy_space_before_while_parentheses = true +ij_groovy_space_in_named_argument = true +ij_groovy_space_in_named_argument_before_colon = false +ij_groovy_space_within_empty_array_initializer_braces = false +ij_groovy_space_within_empty_method_call_parentheses = false +ij_groovy_spaces_around_additive_operators = true +ij_groovy_spaces_around_assignment_operators = true +ij_groovy_spaces_around_bitwise_operators = true +ij_groovy_spaces_around_equality_operators = true +ij_groovy_spaces_around_lambda_arrow = true +ij_groovy_spaces_around_logical_operators = true +ij_groovy_spaces_around_multiplicative_operators = true +ij_groovy_spaces_around_regex_operators = true +ij_groovy_spaces_around_relational_operators = true +ij_groovy_spaces_around_shift_operators = true +ij_groovy_spaces_within_annotation_parentheses = false +ij_groovy_spaces_within_array_initializer_braces = false +ij_groovy_spaces_within_braces = true +ij_groovy_spaces_within_brackets = false +ij_groovy_spaces_within_cast_parentheses = false +ij_groovy_spaces_within_catch_parentheses = false +ij_groovy_spaces_within_for_parentheses = false +ij_groovy_spaces_within_gstring_injection_braces = false +ij_groovy_spaces_within_if_parentheses = false +ij_groovy_spaces_within_list_or_map = false +ij_groovy_spaces_within_method_call_parentheses = false +ij_groovy_spaces_within_method_parentheses = false +ij_groovy_spaces_within_parentheses = false +ij_groovy_spaces_within_switch_parentheses = false +ij_groovy_spaces_within_synchronized_parentheses = false +ij_groovy_spaces_within_try_parentheses = false +ij_groovy_spaces_within_tuple_expression = false +ij_groovy_spaces_within_while_parentheses = false +ij_groovy_special_else_if_treatment = true +ij_groovy_ternary_operation_wrap = off +ij_groovy_throws_keyword_wrap = off +ij_groovy_throws_list_wrap = off +ij_groovy_use_flying_geese_braces = false +ij_groovy_use_fq_class_names = false +ij_groovy_use_fq_class_names_in_javadoc = true +ij_groovy_use_relative_indents = false +ij_groovy_use_single_class_imports = true +ij_groovy_variable_annotation_wrap = off +ij_groovy_while_brace_force = never +ij_groovy_while_on_new_line = false +ij_groovy_wrap_chain_calls_after_dot = false +ij_groovy_wrap_long_lines = false + +[{*.gql,*.graphql,*.graphqls}] +indent_size = 4 +tab_width = 4 + +[{*.gradle.kts,*.kt,*.kts,*.main.kts,*.space.kts}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_kotlin_align_in_columns_case_branch = false +ij_kotlin_align_multiline_binary_operation = false +ij_kotlin_align_multiline_extends_list = false +ij_kotlin_align_multiline_method_parentheses = false +ij_kotlin_align_multiline_parameters = true +ij_kotlin_align_multiline_parameters_in_calls = false +ij_kotlin_allow_trailing_comma = false +ij_kotlin_allow_trailing_comma_on_call_site = false +ij_kotlin_assignment_wrap = off +ij_kotlin_blank_lines_after_class_header = 0 +ij_kotlin_blank_lines_around_block_when_branches = 0 +ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1 +ij_kotlin_block_comment_add_space = false +ij_kotlin_block_comment_at_first_column = true +ij_kotlin_call_parameters_new_line_after_left_paren = false +ij_kotlin_call_parameters_right_paren_on_new_line = false +ij_kotlin_call_parameters_wrap = off +ij_kotlin_catch_on_new_line = false +ij_kotlin_class_annotation_wrap = split_into_lines +ij_kotlin_continuation_indent_for_chained_calls = true +ij_kotlin_continuation_indent_for_expression_bodies = true +ij_kotlin_continuation_indent_in_argument_lists = true +ij_kotlin_continuation_indent_in_elvis = true +ij_kotlin_continuation_indent_in_if_conditions = true +ij_kotlin_continuation_indent_in_parameter_lists = true +ij_kotlin_continuation_indent_in_supertype_lists = true +ij_kotlin_else_on_new_line = false +ij_kotlin_enum_constants_wrap = off +ij_kotlin_extends_list_wrap = off +ij_kotlin_field_annotation_wrap = split_into_lines +ij_kotlin_finally_on_new_line = false +ij_kotlin_if_rparen_on_new_line = false +ij_kotlin_import_nested_classes = false +ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^ +ij_kotlin_insert_whitespaces_in_simple_one_line_method = true +ij_kotlin_keep_blank_lines_before_right_brace = 2 +ij_kotlin_keep_blank_lines_in_code = 2 +ij_kotlin_keep_blank_lines_in_declarations = 2 +ij_kotlin_keep_first_column_comment = true +ij_kotlin_keep_indents_on_empty_lines = false +ij_kotlin_keep_line_breaks = true +ij_kotlin_lbrace_on_next_line = false +ij_kotlin_line_break_after_multiline_when_entry = true +ij_kotlin_line_comment_add_space = false +ij_kotlin_line_comment_add_space_on_reformat = false +ij_kotlin_line_comment_at_first_column = true +ij_kotlin_method_annotation_wrap = split_into_lines +ij_kotlin_method_call_chain_wrap = off +ij_kotlin_method_parameters_new_line_after_left_paren = false +ij_kotlin_method_parameters_right_paren_on_new_line = false +ij_kotlin_method_parameters_wrap = off +ij_kotlin_name_count_to_use_star_import = 5 +ij_kotlin_name_count_to_use_star_import_for_members = 3 +ij_kotlin_packages_to_use_import_on_demand = java.util.*, kotlinx.android.synthetic.**, io.ktor.** +ij_kotlin_parameter_annotation_wrap = off +ij_kotlin_space_after_comma = true +ij_kotlin_space_after_extend_colon = true +ij_kotlin_space_after_type_colon = true +ij_kotlin_space_before_catch_parentheses = true +ij_kotlin_space_before_comma = false +ij_kotlin_space_before_extend_colon = true +ij_kotlin_space_before_for_parentheses = true +ij_kotlin_space_before_if_parentheses = true +ij_kotlin_space_before_lambda_arrow = true +ij_kotlin_space_before_type_colon = false +ij_kotlin_space_before_when_parentheses = true +ij_kotlin_space_before_while_parentheses = true +ij_kotlin_spaces_around_additive_operators = true +ij_kotlin_spaces_around_assignment_operators = true +ij_kotlin_spaces_around_equality_operators = true +ij_kotlin_spaces_around_function_type_arrow = true +ij_kotlin_spaces_around_logical_operators = true +ij_kotlin_spaces_around_multiplicative_operators = true +ij_kotlin_spaces_around_range = false +ij_kotlin_spaces_around_relational_operators = true +ij_kotlin_spaces_around_unary_operator = false +ij_kotlin_spaces_around_when_arrow = true +ij_kotlin_variable_annotation_wrap = off +ij_kotlin_while_on_new_line = false +ij_kotlin_wrap_elvis_expressions = 1 +ij_kotlin_wrap_expression_body_functions = 0 +ij_kotlin_wrap_first_method_in_call_chain = false + +[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,composer.lock,jest.config}] +ij_json_array_wrapping = split_into_lines +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = split_into_lines +ij_json_property_alignment = do_not_align +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.hcl,*.nomad}] +tab_width = 4 +ij_continuation_indent_size = 8 +ij_hcl_array_wrapping = normal +ij_hcl_keep_blank_lines_in_code = 2 +ij_hcl_keep_indents_on_empty_lines = false +ij_hcl_keep_line_breaks = true +ij_hcl_object_wrapping = normal +ij_hcl_property_alignment = 2 +ij_hcl_property_line_commenter_character = 1 +ij_hcl_space_after_comma = true +ij_hcl_space_before_comma = false +ij_hcl_spaces_around_assignment_operators = true +ij_hcl_spaces_within_braces = false +ij_hcl_spaces_within_brackets = false +ij_hcl_wrap_long_lines = false + +[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span, pre, textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.http,*.rest}] +indent_size = 0 +ij_http request_call_parameters_wrap = normal + +[{*.jsf,*.jsp,*.jspf,*.tag,*.tagf,*.xjsp}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_jsp_jsp_prefer_comma_separated_import_list = false +ij_jsp_keep_indents_on_empty_lines = false + +[{*.jspx,*.tagx}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_jspx_keep_indents_on_empty_lines = false + +[{*.markdown,*.md}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true + +[{*.pb,*.textproto}] +ij_prototext_keep_blank_lines_in_code = 2 +ij_prototext_keep_indents_on_empty_lines = false +ij_prototext_keep_line_breaks = true +ij_prototext_space_after_colon = true +ij_prototext_space_after_comma = true +ij_prototext_space_before_colon = false +ij_prototext_space_before_comma = false +ij_prototext_spaces_within_braces = true +ij_prototext_spaces_within_brackets = false + +[{*.properties,spring.handlers,spring.schemas}] +ij_properties_align_group_field_declarations = false +ij_properties_keep_blank_lines = false +ij_properties_key_value_delimiter = equals +ij_properties_spaces_around_key_value_delimiter = false + +[{*.py,*.pyw}] +max_line_length = 80 +ij_python_align_collections_and_comprehensions = true +ij_python_align_multiline_imports = true +ij_python_align_multiline_parameters = false +ij_python_align_multiline_parameters_in_calls = true +ij_python_blank_line_at_file_end = true +ij_python_blank_lines_after_imports = 1 +ij_python_blank_lines_after_local_imports = 0 +ij_python_blank_lines_around_class = 1 +ij_python_blank_lines_around_method = 1 +ij_python_blank_lines_around_top_level_classes_functions = 2 +ij_python_blank_lines_before_first_method = 0 +ij_python_call_parameters_new_line_after_left_paren = false +ij_python_call_parameters_right_paren_on_new_line = false +ij_python_call_parameters_wrap = normal +ij_python_dict_alignment = 0 +ij_python_dict_new_line_after_left_brace = false +ij_python_dict_new_line_before_right_brace = false +ij_python_dict_wrapping = 1 +ij_python_from_import_new_line_after_left_parenthesis = false +ij_python_from_import_new_line_before_right_parenthesis = false +ij_python_from_import_parentheses_force_if_multiline = false +ij_python_from_import_trailing_comma_if_multiline = false +ij_python_from_import_wrapping = 1 +ij_python_hang_closing_brackets = false +ij_python_keep_blank_lines_in_code = 1 +ij_python_keep_blank_lines_in_declarations = 1 +ij_python_keep_indents_on_empty_lines = false +ij_python_keep_line_breaks = true +ij_python_method_parameters_new_line_after_left_paren = false +ij_python_method_parameters_right_paren_on_new_line = false +ij_python_method_parameters_wrap = normal +ij_python_new_line_after_colon = false +ij_python_new_line_after_colon_multi_clause = true +ij_python_optimize_imports_always_split_from_imports = false +ij_python_optimize_imports_case_insensitive_order = false +ij_python_optimize_imports_join_from_imports_with_same_source = false +ij_python_optimize_imports_sort_by_type_first = true +ij_python_optimize_imports_sort_imports = true +ij_python_optimize_imports_sort_names_in_from_imports = false +ij_python_space_after_comma = true +ij_python_space_after_number_sign = true +ij_python_space_after_py_colon = true +ij_python_space_before_backslash = true +ij_python_space_before_comma = false +ij_python_space_before_for_semicolon = false +ij_python_space_before_lbracket = false +ij_python_space_before_method_call_parentheses = false +ij_python_space_before_method_parentheses = false +ij_python_space_before_number_sign = true +ij_python_space_before_py_colon = false +ij_python_space_within_empty_method_call_parentheses = false +ij_python_space_within_empty_method_parentheses = false +ij_python_spaces_around_additive_operators = true +ij_python_spaces_around_assignment_operators = true +ij_python_spaces_around_bitwise_operators = true +ij_python_spaces_around_eq_in_keyword_argument = false +ij_python_spaces_around_eq_in_named_parameter = false +ij_python_spaces_around_equality_operators = true +ij_python_spaces_around_multiplicative_operators = true +ij_python_spaces_around_power_operator = true +ij_python_spaces_around_relational_operators = true +ij_python_spaces_around_shift_operators = true +ij_python_spaces_within_braces = false +ij_python_spaces_within_brackets = false +ij_python_spaces_within_method_call_parentheses = false +ij_python_spaces_within_method_parentheses = false +ij_python_use_continuation_indent_for_arguments = true +ij_python_use_continuation_indent_for_collection_and_comprehensions = false +ij_python_use_continuation_indent_for_parameters = true +ij_python_wrap_long_lines = false + +[{*.qute.htm,*.qute.html,*.qute.json,*.qute.txt,*.qute.yaml,*.qute.yml}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_qute_keep_indents_on_empty_lines = false + +[{*.tf,*.tfvars}] +tab_width = 4 +ij_continuation_indent_size = 8 +ij_hcl-terraform_array_wrapping = normal +ij_hcl-terraform_keep_blank_lines_in_code = 2 +ij_hcl-terraform_keep_indents_on_empty_lines = false +ij_hcl-terraform_keep_line_breaks = true +ij_hcl-terraform_object_wrapping = normal +ij_hcl-terraform_property_alignment = 2 +ij_hcl-terraform_property_line_commenter_character = 1 +ij_hcl-terraform_space_after_comma = true +ij_hcl-terraform_space_before_comma = false +ij_hcl-terraform_spaces_around_assignment_operators = true +ij_hcl-terraform_spaces_within_braces = false +ij_hcl-terraform_spaces_within_brackets = false +ij_hcl-terraform_wrap_long_lines = false + +[{*.toml,Cargo.lock,Cargo.toml.orig,Gopkg.lock,Pipfile,poetry.lock}] +indent_size = 4 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_toml_keep_indents_on_empty_lines = false + +[{*.yaml,*.yml,*playbook.yaml,*playbook.yml,main.yaml,main.yml}] +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = false +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml new file mode 100644 index 00000000..f79c1aca --- /dev/null +++ b/.github/workflows/build-deploy.yml @@ -0,0 +1,77 @@ +name: Manual build and deploy + +on: + workflow_dispatch: + inputs: + env: + description: 'Which environment to update.' + type: choice + required: true + default: dev + options: + - dev + - uat + - prod + +defaults: + run: + shell: bash + +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + +jobs: + manual-build: + if: github.event_name == 'workflow_dispatch' + strategy: + matrix: + environment: ["${{ inputs.env }}"] + + name: "manual-build" + runs-on: ubuntu-latest + environment: ${{ matrix.environment }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 + with: + role-to-assume: ${{ secrets.IAM_ROLE }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push docker image to Amazon ECR + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: ${{ vars.DOCKER_IMAGE_NAME}} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -f src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . \ + --build-arg QUARKUS_PROFILE=prod \ + --build-arg APP_NAME=atm-layer-model + docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + + - name: Update Kubernetes Config + run: | + aws eks --region ${{ vars.AWS_REGION }} update-kubeconfig --name pagopa-dev-atm-layer-eks + + - name: Install Helm + run: | + curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 + chmod 700 get_helm.sh + ./get_helm.sh + + - name: Upgrade Helm Chart + run: | + helm upgrade --install ${{ vars.DOCKER_IMAGE_NAME }} helm-chart/ \ + --namespace pagopa \ + -f helm-chart/environments/values-${{ inputs.env }}.yaml \ + --set image.tag=${{ github.sha }} \ + --set image.repository=${{ steps.login-ecr.outputs.registry }}/${{ vars.DOCKER_IMAGE_NAME }} \ + --set serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=${{ secrets.SERVICEACCOUNT_IAM_ROLE }} diff --git a/.github/workflows/build-feature.yml b/.github/workflows/build-feature.yml new file mode 100644 index 00000000..50d0a0c1 --- /dev/null +++ b/.github/workflows/build-feature.yml @@ -0,0 +1,47 @@ +name: Build everytime push or merge + +on: + push: + branches: + - '**' # matches every branch + +defaults: + run: + shell: bash + +permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout + +jobs: + build: + strategy: + matrix: + environment: [dev] + name: "build" + runs-on: ubuntu-latest + environment: ${{ matrix.environment }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 + with: + role-to-assume: ${{ secrets.IAM_ROLE }} + aws-region: ${{ vars.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push docker image to Amazon ECR + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: ${{ vars.DOCKER_IMAGE_NAME}} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -f src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . \ + --build-arg QUARKUS_PROFILE=prod \ + --build-arg APP_NAME=atm-layer-model diff --git a/.gitignore b/.gitignore index 524f0963..c439e661 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,23 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* replay_pid* + +# IntelliJ +.idea +*.iml + +# VS Code +.vscode + +# Project files +/target/ +**/node_modules +**/.env +.cache_ggshield +yarn.lock +package-lock.json + +# Helm +/helm/charts/* +**/.terraform/ +**/*.hcl diff --git a/.mvn/wrapper/.gitignore b/.mvn/wrapper/.gitignore new file mode 100644 index 00000000..e72f5e8b --- /dev/null +++ b/.mvn/wrapper/.gitignore @@ -0,0 +1 @@ +maven-wrapper.jar diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 00000000..e69e0448 --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.*; +import java.net.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + private static final String WRAPPER_VERSION = "3.1.1"; + + /** Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. */ + private static final String DEFAULT_DOWNLOAD_URL = + "https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/" + + WRAPPER_VERSION + + "/maven-wrapper-" + + WRAPPER_VERSION + + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to use + * instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** Path where the maven-wrapper.jar will be saved to. */ + private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if (mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if (mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if (!outputFile.getParentFile().exists()) { + if (!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + + outputFile.getParentFile().getAbsolutePath() + + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault( + new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } +} diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..61a2ef15 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/helm-chart/Chart.yaml b/helm-chart/Chart.yaml new file mode 100644 index 00000000..96c37b4d --- /dev/null +++ b/helm-chart/Chart.yaml @@ -0,0 +1,25 @@ +apiVersion: v2 +name: chart-1 +description: | + Helm Chart for Model ATM Layer + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" \ No newline at end of file diff --git a/helm-chart/environments/values-dev.yaml b/helm-chart/environments/values-dev.yaml new file mode 100644 index 00000000..4a06a834 --- /dev/null +++ b/helm-chart/environments/values-dev.yaml @@ -0,0 +1,140 @@ +# Default values for chart-1. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 2 + +image: + repository: 00000000000.dkr.ecr.eu-south-1.amazonaws.com/xxxxxxx + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: latest + +namespace: pagopa + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +milAdapter: + disableBackoffStrategy: true + lockDuration: 20000 + asyncResponseTimeout: 20000 + milBasePath: https://mil-d-apim.azure-api.net + enableInterceptorLogging: true + logEngineInputVariables: true + restReadTimeout: 20000 + restConnectionTmieout: 20000 + milAuthRelativePath: /mil-auth/token + milAuthClientCredentials: client_credentials + tokenCacheName: token-cache + tokenCacheMaxEntries: 100 + +milAuth: + credentialsSecretName: "pagopa-dev-atm-layer-model-mil-auth" + credentialsSecretKeys: + clientId: CLIENT_ID + clientSecret: CLIENT_SECRET + +camundaWebUser: + address: http://pagopa-dev-atm-layer-wf-engine.pagopa.svc.cluster.local:8080 + credentialsSecretName: "pagopa-dev-atm-layer-model-camunda" + credentialsSecretKeys: + username: WEB_USER + password: WEB_PASSWORD + +database: + driver: org.postgresql.Driver + url: jdbc:postgresql://pagopa-dev-atm-layer-rds.cluster-cyezwzpjc2tj.eu-south-1.rds.amazonaws.com:5431 + db_name: pagopadb + schema: atm_layer_engine + credentialsSecretName: "pagopa-dev-atm-layer-model-database" + credentialsSecretKeys: + username: DB_USERNAME + password: DB_PASSWORD + +secretProviderClass: + name: atm-layer-model-secrets + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: + eks.amazonaws.com/role-arn: arn:aws:iam::00000000000:role/pagopa-dev-atm-layer-xxxxxx-serviceaccount-role + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: pagopa-dev-atm-layer-model + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +deployment: + name: pagopa-dev-atm-layer-model + annotations: + reloader.stakater.com/auto: "true" + secret.reloader.stakater.com/reload: pagopa-dev-atm-layer-mil-adapter-database, pagopa-dev-atm-layer-mil-adapter-camunda, pagopa-dev-atm-layer-mil-adapter-mil-auth + +service: + name: pagopa-dev-atm-layer-model + type: NodePort + port: 8080 + +ingress: + enabled: true + name: pagopa-dev-atm-layer-model + className: "" + annotations: + kubernetes.io/ingress.class: "alb" + alb.ingress.kubernetes.io/scheme: "internal" + alb.ingress.kubernetes.io/group.name: "alb-controller" + alb.ingress.kubernetes.io/load-balancer-name: "pagopa-dev-atm-layer-alb-int" + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTP": 8080}]' + hosts: + - host: + paths: + - path: / + pathType: Prefix + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +Release: + Time: + Seconds: 60 diff --git a/helm-chart/environments/values-prod.yaml b/helm-chart/environments/values-prod.yaml new file mode 100644 index 00000000..992d0a87 --- /dev/null +++ b/helm-chart/environments/values-prod.yaml @@ -0,0 +1,91 @@ +# Default values for chart-1. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 2 + +image: + repository: 00000000000.dkr.ecr.eu-south-1.amazonaws.com/xxxxxxx + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: prod + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: xxxxxx + namespace: pagopa + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: NodePort + port: 8080 + +ingress: + enabled: false + className: "" + annotations: + kubernetes.io/ingress.class: "alb" + alb.ingress.kubernetes.io/scheme: "internal" + alb.ingress.kubernetes.io/group.name: "alb-controller" + alb.ingress.kubernetes.io/load-balancer-name: "pagopa-dev-atm-layer-alb-int" + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTP": 8080}]' + hosts: + - host: chart-example.local + paths: + - path: /microservice5/ + pathType: Prefix + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + + +Release: + Time: + Seconds: 60 diff --git a/helm-chart/environments/values-uat.yaml b/helm-chart/environments/values-uat.yaml new file mode 100644 index 00000000..0b339688 --- /dev/null +++ b/helm-chart/environments/values-uat.yaml @@ -0,0 +1,91 @@ +# Default values for chart-1. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 2 + +image: + repository: 00000000000.dkr.ecr.eu-south-1.amazonaws.com/xxxxxxx + pullPolicy: Always + # Overrides the image tag whose default is the chart appVersion. + tag: uat + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: xxxxxxx + namespace: pagopa + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: NodePort + port: 8080 + +ingress: + enabled: false + className: "" + annotations: + kubernetes.io/ingress.class: "alb" + alb.ingress.kubernetes.io/scheme: "internal" + alb.ingress.kubernetes.io/group.name: "alb-controller" + alb.ingress.kubernetes.io/load-balancer-name: "pagopa-dev-atm-layer-alb-int" + alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTP": 8080}]' + hosts: + - host: chart-example.local + paths: + - path: /microservice5/ + pathType: Prefix + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} + + +Release: + Time: + Seconds: 60 diff --git a/helm-chart/templates/NOTES.txt b/helm-chart/templates/NOTES.txt new file mode 100644 index 00000000..660d4d50 --- /dev/null +++ b/helm-chart/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chart-1.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chart-1.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chart-1.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chart-1.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} \ No newline at end of file diff --git a/helm-chart/templates/_helpers.tpl b/helm-chart/templates/_helpers.tpl new file mode 100644 index 00000000..6ca7929a --- /dev/null +++ b/helm-chart/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "chart-1.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "chart-1.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "chart-1.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "chart-1.labels" -}} +helm.sh/chart: {{ include "chart-1.chart" . }} +{{ include "chart-1.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "chart-1.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chart-1.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "chart-1.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "chart-1.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm-chart/templates/deployment.yaml b/helm-chart/templates/deployment.yaml new file mode 100644 index 00000000..d1bdbcfc --- /dev/null +++ b/helm-chart/templates/deployment.yaml @@ -0,0 +1,125 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Values.deployment.name }} + namespace: {{ .Values.namespace }} + labels: + App: {{ .Values.deployment.name }} + annotations: + {{- toYaml .Values.deployment.annotations | nindent 4 }} + +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + App: {{ .Values.deployment.name }} + template: + metadata: + labels: + App: {{ .Values.deployment.name }} + force-recreate: {{ randAlphaNum 5 | quote }} + spec: + serviceAccountName: {{ include "chart-1.serviceAccountName" . }} + volumes: + - name: secrets-store-inline-1 + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: {{ .Values.secretProviderClass.name }} + - name: secrets-store-inline-2 + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: {{ .Values.secretProviderClass.name }} + - name: secrets-store-inline-3 + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: {{ .Values.secretProviderClass.name }} + containers: + - name: {{ .Values.deployment.name }} + image: {{ .Values.image.repository }}:{{ .Values.image.tag }} + ports: + - containerPort: {{ .Values.service.port }} + imagePullPolicy: Always + env: + - name: MIL_ADAPTER_ENGINE_URL + value: "{{ .Values.camundaWebUser.address }}" + - name: MIL_ADAPTER_DISABLE_BACKOFF_STRATEGY + value: "{{ .Values.milAdapter.disableBackoffStrategy }}" + - name: MIL_ADAPTER_LOCK_DURATION + value: "{{ .Values.milAdapter.lockDuration }}" + - name: MIL_ADAPTER_ASYNC_RESPONSE_TIMEOUT + value: "{{ .Values.milAdapter.asyncResponseTimeout }}" + - name: MIL_ADAPTER_ENGINE_ACCOUNT_USER + valueFrom: + secretKeyRef: + name: {{ .Values.camundaWebUser.credentialsSecretName }} + key: {{ .Values.camundaWebUser.credentialsSecretKeys.username }} + - name: MIL_ADAPTER_ENGINE_ACCOUNT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.camundaWebUser.credentialsSecretName }} + key: {{ .Values.camundaWebUser.credentialsSecretKeys.password }} + - name: MIL_ADAPTER_MIL_BASE_PATH + value: "{{ .Values.milAdapter.milBasePath }}" + - name: MIL_ADAPTER_MIL_AUTH_CLIENT_ID + valueFrom: + secretKeyRef: + name: {{ .Values.milAuth.credentialsSecretName }} + key: {{ .Values.milAuth.credentialsSecretKeys.clientId }} + - name: MIL_ADAPTER_MIL_AUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + name: {{ .Values.milAuth.credentialsSecretName }} + key: {{ .Values.milAuth.credentialsSecretKeys.clientSecret }} + - name: MIL_ADAPTER_ENGINE_DB_BASE_URL + value: "{{ .Values.database.url }}" + - name: MIL_ADAPTER_ENGINE_DB_NAME + value: "{{ .Values.database.db_name }}" + - name: MIL_ADAPTER_ENGINE_DB_SCHEMA + value: "{{ .Values.database.schema }}" + - name: MIL_ADAPTER_ENGINE_DB_USERNAME + valueFrom: + secretKeyRef: + name: {{ .Values.database.credentialsSecretName }} + key: {{ .Values.database.credentialsSecretKeys.username }} + - name: MIL_ADAPTER_ENGINE_DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.database.credentialsSecretName }} + key: {{ .Values.database.credentialsSecretKeys.password }} + - name: MIL_ADAPTER_ENGINE_DB_DRIVER + value: "{{ .Values.database.driver }}" + - name: MIL_ADAPTER_ENABLE_INTERCEPTOR_LOGGING + value: "{{ .Values.milAdapter.enableInterceptorLogging }}" + - name: MIL_ADAPTER_LOG_ENGINE_INPUT_VARIABLES + value: "{{ .Values.milAdapter.logEngineInputVariables }}" + - name: MIL_ADAPTER_REST_READ_TIMEOUT + value: "{{ .Values.milAdapter.restReadTimeout }}" + - name: MIL_ADAPTER_REST_CONNECTION_TIMEOUT + value: "{{ .Values.milAdapter.restConnectionTmieout }}" + - name: MIL_ADAPTER_MIL_AUTH_RELATIVE_PATH + value: "{{ .Values.milAdapter.milAuthRelativePath }}" + - name: MIL_ADAPTER_MIL_AUTH_CLIENT_CREDENTIALS + value: "{{ .Values.milAdapter.milAuthClientCredentials }}" + - name: MIL_ADAPTER_TOKEN_CACHE_NAME + value: "{{ .Values.milAdapter.tokenCacheName }}" + - name: MIL_ADAPTER_TOKEN_CACHE_MAX_ENTRIES + value: "{{ .Values.milAdapter.tokenCacheMaxEntries }}" + volumeMounts: + - name: secrets-store-inline-1 + mountPath: "/mnt/secrets-store/1" + readOnly: true + - name: secrets-store-inline-2 + mountPath: "/mnt/secrets-store/2" + readOnly: true + - name: secrets-store-inline-3 + mountPath: "/mnt/secrets-store/3" + readOnly: true + + strategy: + type: Recreate \ No newline at end of file diff --git a/helm-chart/templates/hpa.yaml b/helm-chart/templates/hpa.yaml new file mode 100644 index 00000000..d33609fe --- /dev/null +++ b/helm-chart/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "chart-1.fullname" . }} + labels: + {{- include "chart-1.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "chart-1.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/helm-chart/templates/ingress.yaml b/helm-chart/templates/ingress.yaml new file mode 100644 index 00000000..1a58de15 --- /dev/null +++ b/helm-chart/templates/ingress.yaml @@ -0,0 +1,22 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ .Values.ingress.name }} + annotations: + {{- toYaml .Values.ingress.annotations | nindent 4 }} +spec: + rules: + - {{- if .host }} + host: {{ .host }} + {{- end }} + http: + paths: + - path: {{ index .Values.ingress.hosts 0 "paths" 0 "path" }} + pathType: {{ index .Values.ingress.hosts 0 "paths" 0 "pathType" }} + backend: + service: + name: {{ .Values.ingress.name }} + port: + number: {{ .Values.service.port }} +{{- end }} \ No newline at end of file diff --git a/helm-chart/templates/secretproviderclass.yaml b/helm-chart/templates/secretproviderclass.yaml new file mode 100644 index 00000000..4147d454 --- /dev/null +++ b/helm-chart/templates/secretproviderclass.yaml @@ -0,0 +1,51 @@ +apiVersion: secrets-store.csi.x-k8s.io/v1alpha1 +kind: SecretProviderClass +metadata: + name: {{ .Values.secretProviderClass.name }} +spec: + provider: aws + parameters: + objects: | + - objectName: "pagopa-dev-atm-layer/rds/credentials" + objectType: "secretsmanager" + jmesPath: + - path: username + objectAlias: username + - path: password + objectAlias: password + - objectName: "pagopa-dev-atm-layer/camunda/credentials" + objectType: "secretsmanager" + jmesPath: + - path: WEB_USER + objectAlias: WEB_USER + - path: WEB_PASSWORD + objectAlias: WEB_PASSWORD + - objectName: "pagopa-dev-atm-layer/mil-auth/credentials" + objectType: "secretsmanager" + jmesPath: + - path: CLIENT_ID + objectAlias: CLIENT_ID + - path: CLIENT_SECRET + objectAlias: CLIENT_SECRET + secretObjects: + - secretName: {{ .Values.database.credentialsSecretName }} + type: Opaque + data: + - objectName: "username" # reference the corresponding parameter + key: DB_USERNAME + - objectName: "password" # reference the corresponding parameter + key: DB_PASSWORD + - secretName: {{ .Values.camundaWebUser.credentialsSecretName }} + type: Opaque + data: + - objectName: "WEB_USER" # reference the corresponding parameter + key: WEB_USER + - objectName: "WEB_PASSWORD" # reference the corresponding parameter + key: WEB_PASSWORD + - secretName: {{ .Values.milAuth.credentialsSecretName }} + type: Opaque + data: + - objectName: "CLIENT_ID" # reference the corresponding parameter + key: CLIENT_ID + - objectName: "CLIENT_SECRET" # reference the corresponding parameter + key: CLIENT_SECRET diff --git a/helm-chart/templates/service.yaml b/helm-chart/templates/service.yaml new file mode 100644 index 00000000..69aa025b --- /dev/null +++ b/helm-chart/templates/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.service.name }} + namespace: {{ .Values.namespace }} +spec: + selector: + App: {{ .Values.service.name }} + ports: + - name: {{ .Values.service.name }} + port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + type: {{ .Values.service.type }} \ No newline at end of file diff --git a/helm-chart/templates/serviceaccount.yaml b/helm-chart/templates/serviceaccount.yaml new file mode 100644 index 00000000..b2e32226 --- /dev/null +++ b/helm-chart/templates/serviceaccount.yaml @@ -0,0 +1,8 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "chart-1.serviceAccountName" . }} + annotations: + {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} +{{- end }} diff --git a/helm-chart/templates/tests/test-connection.yaml b/helm-chart/templates/tests/test-connection.yaml new file mode 100644 index 00000000..670bf9fb --- /dev/null +++ b/helm-chart/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "chart-1.fullname" . }}-test-connection" + labels: + {{- include "chart-1.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "chart-1.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never \ No newline at end of file diff --git a/intellij-java-google-style.xml b/intellij-java-google-style.xml new file mode 100644 index 00000000..cf29951c --- /dev/null +++ b/intellij-java-google-style.xml @@ -0,0 +1,598 @@ + + + + + + diff --git a/mvnw b/mvnw new file mode 100755 index 00000000..eaa3d308 --- /dev/null +++ b/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 00000000..abb7c324 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..1ad8f6ac --- /dev/null +++ b/pom.xml @@ -0,0 +1,277 @@ + + + 4.0.0 + it.gov.pagopa + atm-layer-mil-model + 0.0.1 + atm-layer-mil-model + + 3.11.0 + 0.8.7 + 1.18.26 + 17 + UTF-8 + UTF-8 + quarkus-bom + io.quarkus.platform + 3.2.5.Final + 1.5.5.Final + 2.2.10 + 2.4.5 + 1.1.1 + true + 3.0.0 + 5.4.0 + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + io.quarkiverse.amazonservices + quarkus-amazon-services-bom + ${quarkus-amazon-services.version} + pom + import + + + + + + io.quarkus + quarkus-resteasy-reactive-jackson + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-smallrye-openapi + + + io.quarkus + quarkus-smallrye-health + + + io.quarkus + quarkus-logging-json + + + io.quarkus + quarkus-hibernate-reactive + + + io.quarkus + quarkus-hibernate-reactive-panache + + + io.quarkus + quarkus-reactive-pg-client + + + io.quarkus + quarkus-hibernate-validator + + + io.quarkus + quarkus-rest-client-reactive-jackson + + + io.quarkiverse.amazonservices + quarkus-amazon-s3 + + + software.amazon.awssdk + url-connection-client + + + software.amazon.awssdk.crt + aws-crt + + + software.amazon.awssdk + netty-nio-client + + + io.quarkiverse.logging.logback + quarkus-logging-logback + ${quarkus.logging.logback.version} + + + io.quarkiverse.openapi.generator + quarkus-openapi-generator + ${quarkus.openapi.generator.version} + + + org.projectlombok + lombok + ${lombok.version} + provided + + + org.mapstruct + mapstruct + ${mapstruct.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + provided + + + io.quarkus + quarkus-opentelemetry + + + + + io.quarkus + quarkus-junit5 + test + + + io.quarkus + quarkus-jacoco + test + + + io.rest-assured + rest-assured + test + + + + io.quarkus + quarkus-junit5-mockito + + + org.mockito + mockito-subclass + + + + + org.mockito + mockito-core + ${mockito.core.version} + test + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${compiler-plugin.version} + + + -parameters + + + + org.projectlombok + lombok + ${lombok.version} + + + org.mapstruct + mapstruct-processor + ${mapstruct.version} + + + io.quarkus + quarkus-panache-common + ${quarkus.platform.version} + + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + *QuarkusClassLoader + ${project.build.directory}/jacoco-quarkus.exec + true + + + + + + + + + native + + + native + + + + false + native + + + + diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/App.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/App.java new file mode 100644 index 00000000..fde4d8a3 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/App.java @@ -0,0 +1,42 @@ +package it.gov.pagopa.atmlayer.service.model; + +import io.quarkus.runtime.Startup; +import it.gov.pagopa.atmlayer.service.model.model.ErrorResponse; +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.MediaType; +import org.eclipse.microprofile.openapi.annotations.Components; +import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition; +import org.eclipse.microprofile.openapi.annotations.info.Info; +import org.eclipse.microprofile.openapi.annotations.media.Content; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; + +@OpenAPIDefinition( + components = + @Components( + responses = { + @APIResponse( + name = "InternalServerError", + responseCode = "500", + description = "Internal Server Error", + content = + @Content( + mediaType = MediaType.APPLICATION_JSON, + schema = @Schema(implementation = ErrorResponse.class), + example = + """ + { + "type": "", + "title": "Internal Server Error", + "status": 500, + "detail": "An unexpected error has occurred. Please contact support.", + "instance": "ATML_MI_500" + }""")), + + }), + info = @Info(title = "ATM Layer - MIL Integration service", version = "0.0.1-SNAPSHOT")) +@ApplicationPath("/api") +@Startup +public class App extends Application { +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/client/MILAuthApi.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/client/MILAuthApi.java new file mode 100644 index 00000000..bbf0a916 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/client/MILAuthApi.java @@ -0,0 +1,26 @@ +package it.gov.pagopa.atmlayer.service.model.client; + +import io.quarkus.rest.client.reactive.NotBody; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.model.mil.AuthPayload; +import it.gov.pagopa.atmlayer.service.model.model.mil.MILAccessToken; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.MediaType; +import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam; +import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; + +@Path("/mil-auth") +@RegisterRestClient(configKey = "mil-auth-api") +@ClientHeaderParam(name = "RequestId", value = "{requestId}") +@ClientHeaderParam(name = "AcquirerId", value = "{acquirerId}") +@ClientHeaderParam(name = "Channel", value = "${common.header.channel}") +@ClientHeaderParam(name = "TerminalId", value = "{terminalId}") +public interface MILAuthApi { + + @POST + @Path("/token") + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + Uni getToken(AuthPayload form, @NotBody String requestId, @NotBody String acquirerId, @NotBody String terminalId); +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native b/src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native new file mode 100644 index 00000000..4c9d3b4c --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native @@ -0,0 +1,27 @@ +FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:22.3-java17 AS build +COPY --chown=quarkus:quarkus mvnw /code/mvnw +COPY --chown=quarkus:quarkus .mvn /code/.mvn +COPY --chown=quarkus:quarkus pom.xml /code/ +USER quarkus +WORKDIR /code +RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline +COPY src /code/src +ARG QUARKUS_PROFILE +ARG APP_NAME +RUN ./mvnw package -Pnative -Dquarkus.application.name=atm-layer-model -Dquarkus.profile=prod + +## Stage 2 : create the docker final image +FROM quay.io/quarkus/quarkus-micro-image:2.0 +WORKDIR /work/ +COPY --from=build /code/target/*-runner /work/application + +# set up permissions for user `1001` +RUN chmod 775 /work /work/application \ + && chown -R 1001 /work \ + && chmod -R "g+rwX" /work \ + && chown -R 1001:root /work + +EXPOSE 8080 +USER 1001 + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/dto/PersonDto.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/dto/PersonDto.java new file mode 100644 index 00000000..4be7333e --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/dto/PersonDto.java @@ -0,0 +1,18 @@ +package it.gov.pagopa.atmlayer.service.model.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.UUID; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class PersonDto { + private UUID id; + private String firstName; + private String lastName; +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/entity/Person.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/entity/Person.java new file mode 100644 index 00000000..3a4530fa --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/entity/Person.java @@ -0,0 +1,19 @@ +package it.gov.pagopa.atmlayer.service.model.entity; + +import io.quarkus.hibernate.reactive.panache.PanacheEntityBase; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; + +import java.time.LocalDate; +import java.util.UUID; + +@Entity +public class Person extends PanacheEntityBase { + @Id + @GeneratedValue + public UUID id; + public String firstName; + public String lastName; + public LocalDate birth; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/enumeration/AppErrorCodeEnum.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/enumeration/AppErrorCodeEnum.java new file mode 100644 index 00000000..5f8b9fd9 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/enumeration/AppErrorCodeEnum.java @@ -0,0 +1,20 @@ +package it.gov.pagopa.atmlayer.service.model.enumeration; + +import lombok.Getter; + +/** + * Enumeration for application error codes and messages + */ +@Getter +public enum AppErrorCodeEnum { + + ATML_MI_500("ATML_MI_500", "An unexpected error has occurred, see logs for more info"); + + private final String errorCode; + private final String errorMessage; + + AppErrorCodeEnum(String errorCode, String errorMessage) { + this.errorCode = errorCode; + this.errorMessage = errorMessage; + } +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/AtmLayerException.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/AtmLayerException.java new file mode 100644 index 00000000..2d1f1f2f --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/AtmLayerException.java @@ -0,0 +1,45 @@ +package it.gov.pagopa.atmlayer.service.model.exception; + +import it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorCodeEnum; +import lombok.Getter; + +import java.util.Objects; + +/** + * Base exception for PDF receipts service exceptions + */ +@Getter +public class AtmLayerException extends Exception { + + /** Error code of this exception + * -- GETTER -- + * Returns error code + * + * @return Error code of this exception + */ + private final AppErrorCodeEnum errorCode; + + /** + * Constructs new exception with provided error code and message + * + * @param errorCode Error code + * @param message Detail message + */ + public AtmLayerException(AppErrorCodeEnum errorCode, String message) { + super(message); + this.errorCode = Objects.requireNonNull(errorCode); + } + + /** + * Constructs new exception with provided error code, message and cause + * + * @param errorCode Error code + * @param message Detail message + * @param cause Exception causing the constructed one + */ + public AtmLayerException(AppErrorCodeEnum errorCode, String message, Throwable cause) { + super(message, cause); + this.errorCode = Objects.requireNonNull(errorCode); + } + +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/AtmLayerRestException.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/AtmLayerRestException.java new file mode 100644 index 00000000..0ec03ae3 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/AtmLayerRestException.java @@ -0,0 +1,48 @@ +package it.gov.pagopa.atmlayer.service.model.exception; + +import it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorCodeEnum; +import jakarta.ws.rs.ClientErrorException; +import jakarta.ws.rs.core.Response; +import lombok.Builder; +import lombok.Getter; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +import java.util.List; + +/** + * Base exception for PDF receipts service exceptions + */ +@Getter +public class AtmLayerRestException extends ClientErrorException { + + private AppErrorCodeEnum errorCode; + + @Schema(example = "Validation Error") + private final String type; + + @Schema(example = "500") + private final int statusCode; + + private String message; + + @Schema(example = "An unexpected error has occurred. Please contact support.") + private List errors; + + @Builder + public AtmLayerRestException(String message, Response.Status statusCode, String type, List errors) { + super(message, statusCode); + this.message = message; + this.type = type; + this.errors = errors; + this.statusCode = statusCode.getStatusCode(); + + } + + public AtmLayerRestException(String message, Response.Status status, Throwable cause, String type, List errors) { + super(message, status, cause); + this.message = message; + this.type = type; + this.errors = errors; + this.statusCode = status.getStatusCode(); + } +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/mapper/GlobalExceptionMapperImpl.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/mapper/GlobalExceptionMapperImpl.java new file mode 100644 index 00000000..e3198c1f --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/exception/mapper/GlobalExceptionMapperImpl.java @@ -0,0 +1,90 @@ +package it.gov.pagopa.atmlayer.service.model.exception.mapper; + +import io.quarkus.arc.properties.IfBuildProperty; +import it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorCodeEnum; +import it.gov.pagopa.atmlayer.service.model.utils.ConstraintViolationMappingUtils; +import it.gov.pagopa.atmlayer.service.model.exception.AtmLayerRestException; +import it.gov.pagopa.atmlayer.service.model.model.ATMLayerErrorResponse; +import it.gov.pagopa.atmlayer.service.model.model.ATMLayerValidationErrorResponse; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.ConstraintViolationException; +import jakarta.ws.rs.core.Response; +import lombok.extern.slf4j.Slf4j; +import org.jboss.resteasy.reactive.RestResponse; +import org.jboss.resteasy.reactive.server.ServerExceptionMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.Set; + +import static jakarta.ws.rs.core.Response.Status.BAD_REQUEST; +import static jakarta.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; + +@IfBuildProperty(name = "mapper.enabled", stringValue = "true", enableIfMissing = true) +@Singleton +@Slf4j +public class GlobalExceptionMapperImpl { + + @Inject + ConstraintViolationMappingUtils constraintViolationMappingUtils; + + private final Logger logger = LoggerFactory.getLogger(GlobalExceptionMapperImpl.class); + + @ServerExceptionMapper + public RestResponse ConstraintViolationExceptionMapper(ConstraintViolationException exception) { + String message = "Validation Error on Payload"; + logger.error("Validation Error on Payload: ", exception); + return buildErrorResponse(exception.getConstraintViolations(), BAD_REQUEST, message); + } + + @ServerExceptionMapper + public RestResponse genericExceptionMapper(AtmLayerRestException exception) { + if (exception.getStatusCode() == INTERNAL_SERVER_ERROR.getStatusCode()) { + String message = "Generic Error"; + logger.error("Generic error found: ", exception); + return buildErrorResponse(INTERNAL_SERVER_ERROR, message); + } + return buildErrorResponse(Response.Status.fromStatusCode(exception.getStatusCode()), exception.getMessage()); + } + + @ServerExceptionMapper + public RestResponse genericExceptionMapper(Exception exception) { + Response.Status status = INTERNAL_SERVER_ERROR; + String message = "Generic Error"; + logger.error("Generic error found: ", exception); + return buildErrorResponse(status, message); + } + + private RestResponse buildErrorResponseWithErrorCode(AppErrorCodeEnum errorCode, Response.Status status, String message) { + return RestResponse.status(status, ATMLayerErrorResponse.builder() + .type(status.getReasonPhrase()) + .status(status.getStatusCode()) + .message(message) + .errorCode(errorCode) + .build()); + } + + private RestResponse buildErrorResponse(Response.Status status, String message) { + return RestResponse.status(status, ATMLayerErrorResponse.builder() + .type(status.getReasonPhrase()) + .status(status.getStatusCode()) + .message(message) + .build()); + } + + private RestResponse buildErrorResponse(Set> errors, Response.Status status, String message) { + List errorMessages = constraintViolationMappingUtils.extractErrorMessages(errors); + ATMLayerValidationErrorResponse payload = ATMLayerValidationErrorResponse.builder() + .type(status.getReasonPhrase()) + .status(status.getStatusCode()) + .errors(errorMessages) + .message(message) + .build(); + return RestResponse.status(status, payload); + } + + +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/mapper/PersonMapper.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/mapper/PersonMapper.java new file mode 100644 index 00000000..6852b477 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/mapper/PersonMapper.java @@ -0,0 +1,15 @@ +package it.gov.pagopa.atmlayer.service.model.mapper; + +import it.gov.pagopa.atmlayer.service.model.dto.PersonDto; +import it.gov.pagopa.atmlayer.service.model.entity.Person; +import org.mapstruct.Mapper; + +import java.util.List; + +@Mapper(componentModel = "cdi") +public interface PersonMapper { + PersonDto toDto(Person person); + + List toDtoList(List personList); + +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ATMLayerErrorResponse.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ATMLayerErrorResponse.java new file mode 100644 index 00000000..07f1837a --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ATMLayerErrorResponse.java @@ -0,0 +1,30 @@ +package it.gov.pagopa.atmlayer.service.model.model; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.quarkus.runtime.annotations.RegisterForReflection; +import it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorCodeEnum; +import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +/** + * Model class for the error response + */ +@Getter +@Jacksonized +@JsonPropertyOrder({"type", "errorCode", "status", "message", "errors"}) +@RegisterForReflection +@SuperBuilder +public class ATMLayerErrorResponse { + + private AppErrorCodeEnum errorCode; + + @Schema(example = "Validation Error") + private String type; + + @Schema(example = "500") + private int status; + + private String message; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ATMLayerValidationErrorResponse.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ATMLayerValidationErrorResponse.java new file mode 100644 index 00000000..b1ec1371 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ATMLayerValidationErrorResponse.java @@ -0,0 +1,24 @@ +package it.gov.pagopa.atmlayer.service.model.model; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.quarkus.runtime.annotations.RegisterForReflection; +import lombok.Getter; +import lombok.experimental.SuperBuilder; +import lombok.extern.jackson.Jacksonized; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +import java.util.List; + +/** + * Model class for the error response + */ +@Getter +@Jacksonized +@JsonPropertyOrder({"type", "errorCode", "status", "message", "errors"}) +@RegisterForReflection +@SuperBuilder +public class ATMLayerValidationErrorResponse extends ATMLayerErrorResponse { + + @Schema(example = "Field xxx must be not null") + private List errors; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/DemoValidation.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/DemoValidation.java new file mode 100644 index 00000000..230f66cc --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/DemoValidation.java @@ -0,0 +1,32 @@ +package it.gov.pagopa.atmlayer.service.model.model; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Range; + +import java.util.List; +import java.util.Set; + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +public class DemoValidation { + @NotBlank(message = "must be not null or empty") + private String inputString; + + @NotEmpty(message = "must be not null or empty") + private List<@NotBlank(message = "must be not null or empty") String> inputStringList; + + @NotEmpty(message = "must be not null or empty") + private Set<@NotBlank(message = "must be not null or empty") String> inputStringSet; + + @Range(min = 1, max = 10, message = "Must be between {min} and {max}") + private int inputInt; + + +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ErrorResponse.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ErrorResponse.java new file mode 100644 index 00000000..f335fabd --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/ErrorResponse.java @@ -0,0 +1,33 @@ +package it.gov.pagopa.atmlayer.service.model.model; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.quarkus.runtime.annotations.RegisterForReflection; +import lombok.Builder; +import lombok.Getter; +import lombok.extern.jackson.Jacksonized; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +/** + * Model class for the error response + */ +@Getter +@Builder +@Jacksonized +@JsonPropertyOrder({"type", "title", "status", "detail", "instance"}) +@RegisterForReflection +public class ErrorResponse { + + private String type; + + @Schema(example = "Internal Server Error") + private String title; + + @Schema(example = "500") + private int status; + + @Schema(example = "An unexpected error has occurred. Please contact support.") + private String detail; + + @Schema(example = "PDFS-500") + private String instance; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/InfoResponse.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/InfoResponse.java new file mode 100644 index 00000000..c5fd8c61 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/InfoResponse.java @@ -0,0 +1,28 @@ +package it.gov.pagopa.atmlayer.service.model.model; + +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import lombok.Builder; +import lombok.Getter; +import lombok.extern.jackson.Jacksonized; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +/** + * Model class for the info response + */ +@Getter +@Builder +@Jacksonized +@JsonPropertyOrder({"name", "version", "environment", "description"}) +public class InfoResponse { + @Schema(example = "pagopa-atm layer-pdf-service") + private String name; + + @Schema(example = "1.2.3") + private String version; + + @Schema(example = "dev") + private String environment; + + @Schema(example = "Receipt PDF Service") + private String description; +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/filestorage/FileObject.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/filestorage/FileObject.java new file mode 100644 index 00000000..eec0d32d --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/filestorage/FileObject.java @@ -0,0 +1,39 @@ +package it.gov.pagopa.atmlayer.service.model.model.filestorage; + +import software.amazon.awssdk.services.s3.model.S3Object; + +public class FileObject { + private String objectKey; + + private Long size; + + public FileObject() { + } + + public static FileObject from(S3Object s3Object) { + FileObject file = new FileObject(); + if (s3Object != null) { + file.setObjectKey(s3Object.key()); + file.setSize(s3Object.size()); + } + return file; + } + + public String getObjectKey() { + return objectKey; + } + + public Long getSize() { + return size; + } + + public FileObject setObjectKey(String objectKey) { + this.objectKey = objectKey; + return this; + } + + public FileObject setSize(Long size) { + this.size = size; + return this; + } +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/filestorage/FormData.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/filestorage/FormData.java new file mode 100644 index 00000000..716bd65b --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/filestorage/FormData.java @@ -0,0 +1,22 @@ +package it.gov.pagopa.atmlayer.service.model.model.filestorage; + +import jakarta.ws.rs.core.MediaType; +import org.jboss.resteasy.reactive.PartType; +import org.jboss.resteasy.reactive.RestForm; + +import java.io.File; + +public class FormData { + + @RestForm("data") + public File data; + + @RestForm + @PartType(MediaType.TEXT_PLAIN) + public String filename; + + @RestForm + @PartType(MediaType.TEXT_PLAIN) + public String mimetype; + +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/mil/AuthPayload.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/mil/AuthPayload.java new file mode 100644 index 00000000..6257160a --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/mil/AuthPayload.java @@ -0,0 +1,21 @@ +package it.gov.pagopa.atmlayer.service.model.model.mil; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; +import org.jboss.resteasy.reactive.RestForm; + +@AllArgsConstructor +@NoArgsConstructor +public class AuthPayload { + @JsonProperty("client_secret") + @RestForm("client_secret") + private String clientSecret; + @JsonProperty("client_id") + @RestForm("client_id") + private String clientId; + @JsonProperty("grant_type") + @RestForm("grant_type") + private String grantType; + +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/model/mil/MILAccessToken.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/mil/MILAccessToken.java new file mode 100644 index 00000000..9404ff74 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/model/mil/MILAccessToken.java @@ -0,0 +1,12 @@ +package it.gov.pagopa.atmlayer.service.model.model.mil; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class MILAccessToken { + @JsonProperty("access_token") + public String accessToken; + @JsonProperty("token_type") + public String tokenType; + @JsonProperty("expires_in") + public int expiresIn; +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/repository/PersonRepository.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/repository/PersonRepository.java new file mode 100644 index 00000000..799c583c --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/repository/PersonRepository.java @@ -0,0 +1,17 @@ +package it.gov.pagopa.atmlayer.service.model.repository; + +import io.quarkus.hibernate.reactive.panache.PanacheRepositoryBase; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.entity.Person; +import jakarta.enterprise.context.ApplicationScoped; + +import java.util.UUID; + +@ApplicationScoped +public class PersonRepository implements PanacheRepositoryBase { + + public Uni findByName(String name) { + return find("name", name).firstResult(); + } + +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/AuthResource.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/AuthResource.java new file mode 100644 index 00000000..177be4a5 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/AuthResource.java @@ -0,0 +1,35 @@ +package it.gov.pagopa.atmlayer.service.model.resource; + +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.model.mil.AuthPayload; +import it.gov.pagopa.atmlayer.service.model.model.mil.MILAccessToken; +import it.gov.pagopa.atmlayer.service.model.service.impl.MILAuthService; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.MediaType; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Resource class that expose the API to retrieve info about the service + */ +@Path("/auth") +@Tag(name = "Auth", description = "Auth operations") +public class AuthResource { + + private final Logger logger = LoggerFactory.getLogger(AuthResource.class); + + @Inject + MILAuthService milAuthService; + + + @GET + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + public Uni getToken(AuthPayload authPayload) { + + return this.milAuthService.getToken(authPayload, "6762543c-2660-4622-b4d4-8b2bc596df29", "06789", "64874412"); + } +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/FileStorageResource.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/FileStorageResource.java new file mode 100644 index 00000000..d6ccabf6 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/FileStorageResource.java @@ -0,0 +1,98 @@ +package it.gov.pagopa.atmlayer.service.model.resource; + +import io.smallrye.mutiny.Multi; +import io.smallrye.mutiny.Uni; +import io.vertx.core.buffer.Buffer; +import it.gov.pagopa.atmlayer.service.model.model.filestorage.FileObject; +import it.gov.pagopa.atmlayer.service.model.model.filestorage.FormData; +import it.gov.pagopa.atmlayer.service.model.resource.filestorage.FileStorageCommonResource; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; +import jakarta.ws.rs.core.Response.Status; +import mutiny.zero.flow.adapters.AdaptersToFlow; +import org.jboss.resteasy.reactive.RestMulti; +import org.reactivestreams.Publisher; +import software.amazon.awssdk.core.async.AsyncRequestBody; +import software.amazon.awssdk.core.async.AsyncResponseTransformer; +import software.amazon.awssdk.services.s3.S3AsyncClient; +import software.amazon.awssdk.services.s3.model.ListObjectsRequest; +import software.amazon.awssdk.services.s3.model.ListObjectsResponse; + +import java.nio.ByteBuffer; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@Path("/async-s3") +public class FileStorageResource extends FileStorageCommonResource { + @Inject + S3AsyncClient s3; + + @POST + @Path("upload") + @Consumes(MediaType.MULTIPART_FORM_DATA) + public Uni uploadFile(FormData formData) throws Exception { + + if (formData.filename == null || formData.filename.isEmpty()) { + return Uni.createFrom().item(Response.status(Status.BAD_REQUEST).build()); + } + + if (formData.mimetype == null || formData.mimetype.isEmpty()) { + return Uni.createFrom().item(Response.status(Status.BAD_REQUEST).build()); + } + + return Uni.createFrom() + .completionStage(() -> { + return s3.putObject(buildPutRequest(formData), AsyncRequestBody.fromFile(formData.data)); + }) + .onItem().ignore().andSwitchTo(Uni.createFrom().item(Response.created(null).build())) + .onFailure().recoverWithItem(th -> { + th.printStackTrace(); + return Response.serverError().build(); + }); + } + + @GET + @Path("download/{objectKey}") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public RestMulti downloadFile(String objectKey) { + + return RestMulti.fromUniResponse(Uni.createFrom() + .completionStage(() -> s3.getObject(buildGetRequest(objectKey), + AsyncResponseTransformer.toPublisher())), + response -> Multi.createFrom().safePublisher(AdaptersToFlow.publisher((Publisher) response)) + .map(FileStorageResource::toBuffer), + response -> Map.of("Content-Disposition", List.of("attachment;filename=" + objectKey), "Content-Type", + List.of(response.response().contentType()))); + } + + @GET + public Uni> listFiles() { + ListObjectsRequest listRequest = ListObjectsRequest.builder() + .bucket(bucketName) + .build(); + + return Uni.createFrom().completionStage(() -> s3.listObjects(listRequest)) + .onItem().transform(result -> toFileItems(result)); + } + + private static Buffer toBuffer(ByteBuffer bytebuffer) { + byte[] result = new byte[bytebuffer.remaining()]; + bytebuffer.get(result); + return Buffer.buffer(result); + } + + private List toFileItems(ListObjectsResponse objects) { + return objects.contents().stream() + .map(FileObject::from) + .sorted(Comparator.comparing(FileObject::getObjectKey)) + .collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/InfoResource.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/InfoResource.java new file mode 100644 index 00000000..020ff320 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/InfoResource.java @@ -0,0 +1,84 @@ +package it.gov.pagopa.atmlayer.service.model.resource; + +import io.smallrye.common.annotation.NonBlocking; +import it.gov.pagopa.atmlayer.service.model.model.DemoValidation; +import it.gov.pagopa.atmlayer.service.model.model.InfoResponse; +import it.gov.pagopa.atmlayer.service.model.repository.PersonRepository; +import jakarta.inject.Inject; +import jakarta.validation.Valid; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.core.MediaType; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.eclipse.microprofile.openapi.annotations.Operation; +import org.eclipse.microprofile.openapi.annotations.media.Content; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; +import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Resource class that expose the API to retrieve info about the service + */ +@Path("/info") +@Tag(name = "Info", description = "Info operations") +public class InfoResource { + + private final Logger logger = LoggerFactory.getLogger(InfoResource.class); + + @ConfigProperty(name = "app.name", defaultValue = "app") + String name; + + @ConfigProperty(name = "app.version", defaultValue = "0.0.1") + String version; + + @ConfigProperty(name = "app.environment", defaultValue = "local") + String environment; + + @Inject + PersonRepository personRepository; + + @Operation(summary = "Get info of ATM Layer - MIL Integration services") + @APIResponses( + value = { + @APIResponse(ref = "#/components/responses/InternalServerError"), + @APIResponse( + responseCode = "200", + description = "Success", + content = + @Content( + mediaType = MediaType.APPLICATION_JSON, + schema = @Schema(implementation = InfoResponse.class))) + }) + + @GET + @NonBlocking + public InfoResponse info() throws InterruptedException { + logger.info("Info environment: [{}] - name: [{}] - version: [{}]", environment, name, version); + + + return InfoResponse.builder() + .name(name) + .version(version) + .environment(environment) + .description("ATM Layer - MIL Integration Service") + .build(); + } + + ; + + @POST + public InfoResponse demoValidation(@Valid DemoValidation example) { + logger.info("Info environment: [{}] - name: [{}] - version: [{}]", environment, name, version); + + return InfoResponse.builder() + .name(name) + .version(version) + .environment(environment) + .description("Receipt PDF Service") + .build(); + } +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/PersonResourceRead.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/PersonResourceRead.java new file mode 100644 index 00000000..7985505a --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/PersonResourceRead.java @@ -0,0 +1,53 @@ +package it.gov.pagopa.atmlayer.service.model.resource; + +import io.quarkus.arc.properties.UnlessBuildProperty; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.dto.PersonDto; +import it.gov.pagopa.atmlayer.service.model.mapper.PersonMapper; +import it.gov.pagopa.atmlayer.service.model.service.PersonService; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; +import java.util.UUID; + +/** + * Resource class that expose the API to retrieve info about the service + */ +@Path("/person") +@Tag(name = "Person", description = "Person operations") +@UnlessBuildProperty(name = "app.execution-mode", stringValue = "WRITE", enableIfMissing = true) +@Produces("application/json") +@Consumes("application/json") +@ApplicationScoped +public class PersonResourceRead { + + private final Logger logger = LoggerFactory.getLogger(PersonResourceRead.class); + + @Inject + PersonService personService; + + @Inject + PersonMapper personMapper; + + @GET + public Uni> getAllPersons() { + return personService.getAll() + .map(people -> personMapper.toDtoList(people)); + } + + @GET + @Path("/{id}") + public Uni getPersonById(@PathParam("id") UUID id) { + return personService.getByIdOrThrowException(id) + .map(person -> personMapper.toDto(person)); + } +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/PersonResourceWrite.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/PersonResourceWrite.java new file mode 100644 index 00000000..14fe4727 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/PersonResourceWrite.java @@ -0,0 +1,46 @@ +package it.gov.pagopa.atmlayer.service.model.resource; + +import io.quarkus.arc.properties.UnlessBuildProperty; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.dto.PersonDto; +import it.gov.pagopa.atmlayer.service.model.entity.Person; +import it.gov.pagopa.atmlayer.service.model.mapper.PersonMapper; +import it.gov.pagopa.atmlayer.service.model.service.PersonService; +import jakarta.inject.Inject; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.time.LocalDate; +import java.time.Month; + +/** + * Resource class that expose the API to retrieve info about the service + */ +@Path("/person") +@Tag(name = "Person", description = "Person operations") +@UnlessBuildProperty(name = "app.execution-mode", stringValue = "READ", enableIfMissing = true) +public class PersonResourceWrite { + + private final Logger logger = LoggerFactory.getLogger(PersonResourceWrite.class); + + @Inject + PersonService personService; + + @Inject + PersonMapper personMapper; + + @POST + public Uni createPerson() { + + Person person = new Person(); + person.firstName = "Stef"; + person.lastName = "Brazov"; + person.birth = LocalDate.of(1910, Month.FEBRUARY, 1); + + return personService.createPerson(person) + .map(personEntity -> personMapper.toDto(personEntity)); + } +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/filestorage/FileStorageCommonResource.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/filestorage/FileStorageCommonResource.java new file mode 100644 index 00000000..244608dc --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/resource/filestorage/FileStorageCommonResource.java @@ -0,0 +1,28 @@ +package it.gov.pagopa.atmlayer.service.model.resource.filestorage; + +import it.gov.pagopa.atmlayer.service.model.model.filestorage.FormData; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import software.amazon.awssdk.services.s3.model.GetObjectRequest; +import software.amazon.awssdk.services.s3.model.PutObjectRequest; + +abstract public class FileStorageCommonResource { + + @ConfigProperty(name = "bucket.name") + public String bucketName; + + protected PutObjectRequest buildPutRequest(FormData formData) { + return PutObjectRequest.builder() + .bucket(bucketName) + .key(formData.filename) + .contentType(formData.mimetype) + .build(); + } + + protected GetObjectRequest buildGetRequest(String objectKey) { + return GetObjectRequest.builder() + .bucket(bucketName) + .key(objectKey) + .build(); + } + +} \ No newline at end of file diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/service/PersonService.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/service/PersonService.java new file mode 100644 index 00000000..646b00f4 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/service/PersonService.java @@ -0,0 +1,18 @@ +package it.gov.pagopa.atmlayer.service.model.service; + +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.entity.Person; + +import java.util.List; +import java.util.UUID; + + +public interface PersonService { + + + Uni createPerson(Person inputPerson); + + Uni> getAll(); + + Uni getByIdOrThrowException(UUID id); +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/service/impl/MILAuthService.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/service/impl/MILAuthService.java new file mode 100644 index 00000000..5893ec1f --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/service/impl/MILAuthService.java @@ -0,0 +1,23 @@ +package it.gov.pagopa.atmlayer.service.model.service.impl; + +import io.quarkus.rest.client.reactive.NotBody; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.client.MILAuthApi; +import it.gov.pagopa.atmlayer.service.model.model.mil.AuthPayload; +import it.gov.pagopa.atmlayer.service.model.model.mil.MILAccessToken; +import jakarta.enterprise.context.ApplicationScoped; +import lombok.extern.slf4j.Slf4j; +import org.eclipse.microprofile.rest.client.inject.RestClient; + +@ApplicationScoped +@Slf4j +public class MILAuthService { + + @RestClient + MILAuthApi milAuthApi; + + public Uni getToken(AuthPayload payload, String requestId, @NotBody String acquirerId, @NotBody String terminalId) { + return milAuthApi.getToken(payload, requestId, acquirerId, terminalId); + } + +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/service/impl/PersonServiceImpl.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/service/impl/PersonServiceImpl.java new file mode 100644 index 00000000..0ec356f0 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/service/impl/PersonServiceImpl.java @@ -0,0 +1,57 @@ +package it.gov.pagopa.atmlayer.service.model.service.impl; + +import io.quarkus.hibernate.reactive.panache.common.WithSession; +import io.quarkus.hibernate.reactive.panache.common.WithTransaction; +import io.smallrye.mutiny.Uni; +import it.gov.pagopa.atmlayer.service.model.entity.Person; +import it.gov.pagopa.atmlayer.service.model.exception.AtmLayerRestException; +import it.gov.pagopa.atmlayer.service.model.repository.PersonRepository; +import it.gov.pagopa.atmlayer.service.model.service.PersonService; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.ws.rs.core.Response; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; +import java.util.UUID; + +@Slf4j +@ApplicationScoped +public class PersonServiceImpl implements PersonService { + @Inject + PersonRepository personRepository; + + @Override + @WithTransaction + public Uni createPerson(Person inputPerson) { + return personRepository.persist(inputPerson) + .invoke(person -> log.debug("Created User with id: {}", person.id)); + } + + @Override + @WithSession + public Uni> getAll() { + return personRepository.findAll().list(); + } + + @Override + @WithSession + public Uni getByIdOrThrowException(UUID id) { + return this.getById(id) + .onItem() + .ifNull() + .failWith(() -> + { + String errorMessage = String.format("User with id %s not found", id); + log.error(errorMessage); + return AtmLayerRestException.builder() + .message(errorMessage) + .statusCode(Response.Status.NOT_FOUND).build(); + }); + + } + + private Uni getById(UUID id) { + return personRepository.findById(id); + } +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/utils/ConstraintViolationMappingUtils.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/utils/ConstraintViolationMappingUtils.java new file mode 100644 index 00000000..7b119e41 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/utils/ConstraintViolationMappingUtils.java @@ -0,0 +1,13 @@ +package it.gov.pagopa.atmlayer.service.model.utils; + +import jakarta.validation.ConstraintViolation; + +import java.util.List; +import java.util.Set; + +public interface ConstraintViolationMappingUtils { + + List extractErrorMessages(Set> errors); + + String extractErrorMessage(ConstraintViolation error); +} diff --git a/src/main/java/it/gov/pagopa/atmlayer/service/model/utils/ConstraintViolationMappingUtilsImpl.java b/src/main/java/it/gov/pagopa/atmlayer/service/model/utils/ConstraintViolationMappingUtilsImpl.java new file mode 100644 index 00000000..61f55993 --- /dev/null +++ b/src/main/java/it/gov/pagopa/atmlayer/service/model/utils/ConstraintViolationMappingUtilsImpl.java @@ -0,0 +1,25 @@ +package it.gov.pagopa.atmlayer.service.model.utils; + +import jakarta.inject.Singleton; +import jakarta.validation.ConstraintViolation; +import org.hibernate.validator.internal.engine.path.NodeImpl; +import org.hibernate.validator.internal.engine.path.PathImpl; + +import java.util.List; +import java.util.Set; + +@Singleton +public class ConstraintViolationMappingUtilsImpl implements ConstraintViolationMappingUtils { + + public List extractErrorMessages(Set> errors) { + return errors.stream().map(this::extractErrorMessage).toList(); + } + + public String extractErrorMessage(ConstraintViolation error) { + PathImpl errorNodes = (PathImpl) error.getPropertyPath(); + NodeImpl leafNode = errorNodes.getLeafNode(); + NodeImpl field = leafNode.isInIterable() ? leafNode.getParent() : leafNode; + return field.asString().concat(" ").concat(error.getMessage()); + + } +} diff --git a/src/main/resources/__logback.xml b/src/main/resources/__logback.xml new file mode 100644 index 00000000..9c4f165e --- /dev/null +++ b/src/main/resources/__logback.xml @@ -0,0 +1,73 @@ + + + + + + ${CONSOLE_LOG_THRESHOLD} + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + ${ECS_SERVICE_NAME: ${APP_NAME}} + ${ECS_SERVICE_VERSION: ${APP_VERSION}} + ${ENV} + + + + + + true + 20000 + 0 + + + + + + + + + + + ${FILE_LOG_THRESHOLD} + + + ${FILE_LOG_PATTERN} + ${FILE_LOG_CHARSET} + + ${LOG_FILE} + + ${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz} + ${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false} + ${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB} + ${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0} + ${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-7} + + + + + true + 20000 + 0 + + + + + + + + + + + + diff --git a/src/main/resources/application-local.properties b/src/main/resources/application-local.properties new file mode 100644 index 00000000..6d29cf04 --- /dev/null +++ b/src/main/resources/application-local.properties @@ -0,0 +1,22 @@ +################### +# RELATIONAL DB +################### +# datasource configuration +quarkus.http.port=8084 +quarkus.datasource.db-kind=${REL_DB_TYPE:postgresql} +quarkus.datasource.username=${REL_DB_USERNAME:postgres} +quarkus.datasource.password=${REL_DB_PASSWORD:password} +quarkus.datasource.reactive.url=${REL_DB_URL:postgresql://localhost:5432/postgres?search_path=atm-layer-write} +quarkus.hibernate-orm.database.generation=drop-and-create +quarkus.log.console.json=false +quarkus.console.color=true +quarkus.smallrye-openapi.auto-add-server=true +quarkus.opentelemetry.tracer.exporter.otlp.endpoint=http://localhost:8200 +bucket.name=atm-layer +quarkus.s3.endpoint-override=http://127.0.0.1:9999 +quarkus.s3.aws.credentials.type=static +quarkus.s3.aws.credentials.static-provider.access-key-id=${S3_ACCESS_KEY_ID:admin123} +quarkus.s3.aws.credentials.static-provider.secret-access-key=${S3_ACCESS_KEY_SECRET:admin123} +quarkus.s3.aws.region=eu-west-1 +quarkus.devservices.enabled=false +quarkus.log.category."software.amazon.awssdk.services.s3".level=TRACE diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 00000000..f37e6da5 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,53 @@ +quarkus.http.port=${SERVER_PORT:8084} +################### +## Service info +################### +app.name=${quarkus.application.name} +app.version=${quarkus.application.version} +app.environment=${APP_ENVIRONMENT:local} +app.execution-mode=${APP_EXECUTION_MODE:READ_WRITE} +################### +## LOG +################### +quarkus.log.file.json=false +quarkus.log.level=INFO +quarkus.log.category."it.gov.pagopa.atml.mil.integration".level=INFO +quarkus.log.json.log-format=ecs +%dev.quarkus.log.console.json=false +%test.quarkus.log.console.json=false +%prod.quarkus.log.console.json=false +%openapi.quarkus.log.console.json=false +%openapi_internal.quarkus.log.console.json=false +quarkus.log.console.json.additional-field."app_name".value=${app.name} +quarkus.log.console.json.additional-field."app_version".value=${app.version} +quarkus.log.console.json.additional-field."app_environment".value=${app.environment} +%dev.quarkus.console.color=true +################### +## OPENAPI - SWAGGER +################### +quarkus.smallrye-openapi.info-title=${quarkus.application.name} (${app.environment}) +%dev.quarkus.smallrye-openapi.info-title=${quarkus.application.name} (DEV) +%test.quarkus.smallrye-openapi.info-title=${quarkus.application.name} (TEST) +%docker.quarkus.smallrye-openapi.info-title=${quarkus.application.name} (DOCKER) +quarkus.smallrye-openapi.info-description=Integrate ATM with MIL payment services +quarkus.smallrye-openapi.info-terms-of-service=https://www.pagopa.gov.it/ +################### +# COMMON PROPERTIES +################### +common.header.channel=${COMMON_HEADER_CHANNEL:ATM} +################### +# RELATIONAL DB +################### +# datasource configuration +#quarkus.datasource.db-kind=${REL_DB_TYPE} +#quarkus.datasource.username=${REL_DB_USERNAME} +#quarkus.datasource.password=${REL_DB_PASSWORD} +#quarkus.datasource.reactive.url=${REL_DB_URL} +#quarkus.hibernate-orm.database.generation=none +quarkus.log.category."org.jboss.resteasy.reactive.client.logging".level=${REST_CLIENT_LOG_LEVEL:INFO} +quarkus.rest-client.mil-auth-api.url=${MIL_AUTH_URL:https://mil-d-apim.azure-api.net} +quarkus.rest-client.logging.scope=request-response +quarkus.rest-client.logging.body-limit=-1 +quarkus.devservices.enabled=false +bucket.name=pagopa-dev-atm-layer-s3-model + diff --git a/src/test/java/it/gov/pagopa/atmlayer/service/model/resource/InfoResourceTest.java b/src/test/java/it/gov/pagopa/atmlayer/service/model/resource/InfoResourceTest.java new file mode 100644 index 00000000..a330cf97 --- /dev/null +++ b/src/test/java/it/gov/pagopa/atmlayer/service/model/resource/InfoResourceTest.java @@ -0,0 +1,42 @@ +package it.gov.pagopa.atmlayer.service.model.resource; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.quarkus.test.junit.QuarkusTest; +import it.gov.pagopa.atmlayer.service.model.model.InfoResponse; +import jakarta.inject.Inject; +import lombok.SneakyThrows; +import org.junit.jupiter.api.Test; + +import static io.restassured.RestAssured.given; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@QuarkusTest +class InfoResourceTest { + + @Inject + private InfoResource sut; + + private final ObjectMapper objectMapper = new ObjectMapper(); + + @Test + @SneakyThrows + void infoSuccess() { + String responseString = + given() + .when().get("/api/info") + .then() + .statusCode(200) + .contentType("application/json") + .extract() + .asString(); + + + assertNotNull(responseString); + InfoResponse response = objectMapper.readValue(responseString, InfoResponse.class); + assertNotNull(response); + assertNotNull(response.getName()); + assertNotNull(response.getEnvironment()); + assertNotNull(response.getDescription()); + assertNotNull(response.getVersion()); + } +} \ No newline at end of file diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties new file mode 100644 index 00000000..b6eb3afa --- /dev/null +++ b/src/test/resources/application.properties @@ -0,0 +1 @@ +quarkus.devservices.enabled=false \ No newline at end of file