From 0c7130cfc241b86b8664ffc6c672a90c8821776d Mon Sep 17 00:00:00 2001 From: oblomov <102328295+oblomov-dev@users.noreply.github.com> Date: Sat, 3 Feb 2024 01:22:48 +0100 Subject: [PATCH] delete_ui2_json (#846) * delete_ui2_json * update * update --- src/01/00/01/z2ui5_if_ajson_mapping.intf.abap | 76 +- src/01/01/z2ui5_cl_util_func.clas.abap | 58 +- .../z2ui5_cl_util_func.clas.testclasses.abap | 1652 ++++++++--------- src/01/01/z2ui5_cl_util_tree_json.clas.abap | 240 --- ...i5_cl_util_tree_json.clas.testclasses.abap | 85 - src/01/01/z2ui5_cl_util_tree_json.clas.xml | 17 - src/01/01/z2ui5_cl_util_ui2_json.clas.abap | 29 - src/01/01/z2ui5_cl_util_ui2_json.clas.xml | 16 - src/01/01/z2ui5_cx_util_error.clas.abap | 36 +- src/01/02/z2ui5_cl_fw_binding.clas.abap | 104 +- src/01/02/z2ui5_cl_fw_client.clas.abap | 20 +- src/01/02/z2ui5_cl_fw_controller.clas.abap | 345 +--- src/01/02/z2ui5_cl_fw_model.clas.abap | 177 -- .../z2ui5_cl_fw_model.clas.testclasses.abap | 69 - src/01/02/z2ui5_cl_fw_model.clas.xml | 17 - src/01/02/z2ui5_cl_fw_model_ajson.clas.abap | 61 +- src/01/05/z2ui5_cl_cc_chartjs.clas.abap | 19 +- src/02/z2ui5_cl_fw_http_handler.clas.abap | 3 - src/02/z2ui5_if_client.intf.abap | 38 +- 19 files changed, 1013 insertions(+), 2049 deletions(-) delete mode 100644 src/01/01/z2ui5_cl_util_tree_json.clas.abap delete mode 100644 src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap delete mode 100644 src/01/01/z2ui5_cl_util_tree_json.clas.xml delete mode 100644 src/01/01/z2ui5_cl_util_ui2_json.clas.abap delete mode 100644 src/01/01/z2ui5_cl_util_ui2_json.clas.xml delete mode 100644 src/01/02/z2ui5_cl_fw_model.clas.abap delete mode 100644 src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap delete mode 100644 src/01/02/z2ui5_cl_fw_model.clas.xml diff --git a/src/01/00/01/z2ui5_if_ajson_mapping.intf.abap b/src/01/00/01/z2ui5_if_ajson_mapping.intf.abap index 734c03e6..bfc18ab5 100644 --- a/src/01/00/01/z2ui5_if_ajson_mapping.intf.abap +++ b/src/01/00/01/z2ui5_if_ajson_mapping.intf.abap @@ -1,44 +1,46 @@ -interface z2ui5_if_ajson_mapping - public. +INTERFACE z2ui5_if_ajson_mapping + PUBLIC. - types: - begin of ty_mapping_field, " deprecated, will be removed - abap type string, - json type string, - end of ty_mapping_field, - ty_mapping_fields type standard table of ty_mapping_field - with unique sorted key abap components abap - with unique sorted key json components json. + INTERFACES if_serializable_object. - types: - begin of ty_rename, - from type string, - to type string, - end of ty_rename, - tty_rename_map type standard table of ty_rename - with unique sorted key by_name components from. + TYPES: + BEGIN OF ty_mapping_field, " deprecated, will be removed + abap TYPE string, + json TYPE string, + END OF ty_mapping_field, + ty_mapping_fields TYPE STANDARD TABLE OF ty_mapping_field + WITH UNIQUE SORTED KEY abap COMPONENTS abap + WITH UNIQUE SORTED KEY json COMPONENTS json. - types: - ty_table_of type standard table of ref to z2ui5_if_ajson_mapping. + TYPES: + BEGIN OF ty_rename, + from TYPE string, + to TYPE string, + END OF ty_rename, + tty_rename_map TYPE STANDARD TABLE OF ty_rename + WITH UNIQUE SORTED KEY by_name COMPONENTS from. - methods to_abap " deprecated, will be removed - importing - !iv_path type string - !iv_name type string - returning - value(rv_result) type string. + TYPES: + ty_table_of TYPE STANDARD TABLE OF REF TO z2ui5_if_ajson_mapping. - methods to_json " deprecated, will be removed - importing - !iv_path type string - !iv_name type string - returning - value(rv_result) type string. + METHODS to_abap " deprecated, will be removed + IMPORTING + !iv_path TYPE string + !iv_name TYPE string + RETURNING + VALUE(rv_result) TYPE string. - methods rename_node - importing - !is_node type z2ui5_if_ajson_types=>ty_node - changing - !cv_name type z2ui5_if_ajson_types=>ty_node-name. + METHODS to_json " deprecated, will be removed + IMPORTING + !iv_path TYPE string + !iv_name TYPE string + RETURNING + VALUE(rv_result) TYPE string. -endinterface. + METHODS rename_node + IMPORTING + !is_node TYPE z2ui5_if_ajson_types=>ty_node + CHANGING + !cv_name TYPE z2ui5_if_ajson_types=>ty_node-name. + +ENDINTERFACE. diff --git a/src/01/01/z2ui5_cl_util_func.clas.abap b/src/01/01/z2ui5_cl_util_func.clas.abap index e8c881a7..aeecab77 100644 --- a/src/01/01/z2ui5_cl_util_func.clas.abap +++ b/src/01/01/z2ui5_cl_util_func.clas.abap @@ -159,11 +159,9 @@ CLASS z2ui5_cl_util_func DEFINITION CLASS-METHODS trans_json_by_any IMPORTING - !any TYPE any - !pretty_mode TYPE clike DEFAULT z2ui5_if_client=>cs_pretty_mode-none - !compress_mode TYPE clike DEFAULT z2ui5_if_client=>cs_compress_mode-standard + !any TYPE any RETURNING - VALUE(result) TYPE string. + VALUE(result) TYPE string. CLASS-METHODS trans_xml_2_any IMPORTING @@ -1243,53 +1241,27 @@ CLASS z2ui5_cl_util_func IMPLEMENTATION. METHOD trans_json_2_any. + TRY. -* IF z2ui5_cl_fw_controller=>cv_check_ajson = abap_true. -* ASSERT 1 = 0. -* ENDIF. - - /ui2/cl_json=>deserialize( - EXPORTING - json = CONV string( val ) - assoc_arrays = abap_true - CHANGING - data = data ). + z2ui5_cl_ajson=>parse( val )->to_abap( + IMPORTING + ev_container = data ). + CATCH z2ui5_cx_ajson_error INTO DATA(x). + ASSERT x IS NOT BOUND. + ENDTRY. ENDMETHOD. METHOD trans_json_by_any. + TRY. -* IF z2ui5_cl_fw_controller=>cv_check_ajson = abap_true. -* ASSERT 1 = 0. -* ENDIF. - - CASE compress_mode. - - WHEN z2ui5_if_client=>cs_compress_mode-full. - - result = /ui2/cl_json=>serialize( - data = any - compress = abap_true - pretty_name = pretty_mode ). - - WHEN z2ui5_if_client=>cs_compress_mode-none. - - result = /ui2/cl_json=>serialize( - data = any - compress = abap_false - pretty_name = pretty_mode ). - - WHEN OTHERS. - - DATA(lo_json) = NEW z2ui5_cl_util_ui2_json( - compress = abap_true - pretty_name = pretty_mode ). - - result = lo_json->serialize_int( any ). - - ENDCASE. + DATA(li_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ). + result = li_ajson->set( iv_path = `/` iv_val = any )->stringify( ). + CATCH z2ui5_cx_ajson_error INTO DATA(x). + ASSERT x IS NOT BOUND. + ENDTRY. ENDMETHOD. diff --git a/src/01/01/z2ui5_cl_util_func.clas.testclasses.abap b/src/01/01/z2ui5_cl_util_func.clas.testclasses.abap index 7225c3c3..c5243895 100644 --- a/src/01/01/z2ui5_cl_util_func.clas.testclasses.abap +++ b/src/01/01/z2ui5_cl_util_func.clas.testclasses.abap @@ -1,826 +1,826 @@ -CLASS ltcl_test_app DEFINITION FOR TESTING. - - PUBLIC SECTION. - - INTERFACES if_serializable_object. - - TYPES: - BEGIN OF ty_row, - title TYPE string, - value TYPE string, - descr TYPE string, - icon TYPE string, - info TYPE string, - selected TYPE abap_bool, - checkbox TYPE abap_bool, - END OF ty_row. - - CONSTANTS sv_status TYPE string VALUE `test` ##NEEDED. - - CLASS-DATA sv_var TYPE string. - CLASS-DATA ss_tab TYPE ty_row. - CLASS-DATA st_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. - CLASS-METHODS class_constructor. - - DATA mv_val TYPE string ##NEEDED. - DATA ms_tab TYPE ty_row ##NEEDED. - DATA mt_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY ##NEEDED. - - PROTECTED SECTION. - PRIVATE SECTION. -ENDCLASS. - -CLASS ltcl_test_app IMPLEMENTATION. - - METHOD class_constructor. - - sv_var = 1. - ss_tab = VALUE #( ). - st_tab = VALUE #( ). - - ENDMETHOD. -ENDCLASS. - -CLASS ltcl_unit_test_abap_api DEFINITION FINAL FOR TESTING - DURATION SHORT - RISK LEVEL HARMLESS. - - PRIVATE SECTION. - - METHODS check_input - IMPORTING - val TYPE data - RETURNING - VALUE(result) TYPE abap_bool. - - METHODS test_assign FOR TESTING RAISING cx_static_check. - METHODS test_eledescr_rel_name FOR TESTING RAISING cx_static_check. - METHODS test_classdescr FOR TESTING RAISING cx_static_check. - METHODS test_substring_after FOR TESTING RAISING cx_static_check. - METHODS test_substring_before FOR TESTING RAISING cx_static_check. - METHODS test_string_shift FOR TESTING RAISING cx_static_check. - METHODS test_string_replace FOR TESTING RAISING cx_static_check. - METHODS test_raise_error FOR TESTING RAISING cx_static_check. - METHODS test_xsdbool FOR TESTING RAISING cx_static_check. - METHODS test_xsdbool_nested FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING - DURATION MEDIUM - RISK LEVEL HARMLESS. - - PRIVATE SECTION. - - METHODS test_create FOR TESTING RAISING cx_static_check. - - METHODS test_boolean_abap_2_json FOR TESTING RAISING cx_static_check. - METHODS test_boolean_check FOR TESTING RAISING cx_static_check. - - - METHODS test_c_trim FOR TESTING RAISING cx_static_check. - METHODS test_c_trim_lower FOR TESTING RAISING cx_static_check. - METHODS test_c_trim_upper FOR TESTING RAISING cx_static_check. - METHODS test_c_replace_assign_struc FOR TESTING RAISING cx_static_check. - METHODS test_c_trim_horizontal_tab FOR TESTING RAISING cx_static_check. - - METHODS test_time_get_timestampl FOR TESTING RAISING cx_static_check. - METHODS test_time_substract_seconds FOR TESTING RAISING cx_static_check. - METHODS test_func_get_uuid_32 FOR TESTING RAISING cx_static_check. - METHODS test_func_get_uuid_22 FOR TESTING RAISING cx_static_check. - METHODS test_func_get_user_tech FOR TESTING RAISING cx_static_check. - - METHODS test_rtti_get_classname_by_ref FOR TESTING RAISING cx_static_check. - METHODS test_rtti_get_type_name FOR TESTING RAISING cx_static_check. - METHODS test_rtti_get_type_kind FOR TESTING RAISING cx_static_check. - METHODS test_rtti_check_type_kind FOR TESTING RAISING cx_static_check. - METHODS test_rtti_get_t_attri_by_obj FOR TESTING RAISING cx_static_check. - METHODS test_rtti_get_t_comp_by_struc FOR TESTING RAISING cx_static_check. - - METHODS test_trans_json_any_2__w_struc FOR TESTING RAISING cx_static_check. - METHODS test_trans_json_2_any__w_dref FOR TESTING RAISING cx_static_check. - METHODS test_trans_ref_tab_2_tab FOR TESTING RAISING cx_static_check. - METHODS test_trans_xml_any_2__w_obj FOR TESTING RAISING cx_static_check. - METHODS test_trans_xml_any_2__w_data FOR TESTING RAISING cx_static_check. - METHODS test_trans_xml_2_any__w_obj FOR TESTING RAISING cx_static_check. - METHODS test_trans_xml_2_any__w_data FOR TESTING RAISING cx_static_check. - - METHODS test_url_param_create_url FOR TESTING RAISING cx_static_check. - METHODS test_url_param_get FOR TESTING RAISING cx_static_check. - METHODS test_url_param_get_tab FOR TESTING RAISING cx_static_check. - METHODS test_url_param_set FOR TESTING RAISING cx_static_check. - - METHODS test_x_check_raise FOR TESTING RAISING cx_static_check. - METHODS test_x_check_raise_not FOR TESTING RAISING cx_static_check. - METHODS test_x_raise FOR TESTING RAISING cx_static_check. - -ENDCLASS. - -CLASS ltcl_unit_test_abap_api IMPLEMENTATION. - - - METHOD test_assign. - - DATA(lo_app) = NEW ltcl_test_app( ). - FIELD-SYMBOLS TYPE any. - - lo_app->mv_val = `ABC`. - - DATA(lv_assign) = `LO_APP->` && 'MV_VAL'. - ASSIGN (lv_assign) TO . - - cl_abap_unit_assert=>assert_equals( - act = - exp = `ABC` ). - - ENDMETHOD. - - - METHOD test_classdescr. - - DATA(lo_app) = NEW ltcl_test_app( ). - - DATA(lt_attri) = CAST cl_abap_classdescr( cl_abap_objectdescr=>describe_by_object_ref( lo_app ) )->attributes. - - DATA(lv_test) = lt_attri[ name = `MS_TAB` ]. - lv_test = lt_attri[ name = `MT_TAB` ]. - lv_test = lt_attri[ name = `MV_VAL` ]. - lv_test = lt_attri[ name = `SS_TAB` ]. - lv_test = lt_attri[ name = `ST_TAB` ]. - lv_test = lt_attri[ name = `SV_STATUS` ]. - lv_test = lt_attri[ name = `SV_VAR` ]. - - ENDMETHOD. - - METHOD test_eledescr_rel_name. - - DATA(lo_ele) = CAST cl_abap_elemdescr( cl_abap_elemdescr=>describe_by_data( abap_true ) ). - - cl_abap_unit_assert=>assert_equals( - act = lo_ele->get_relative_name( ) - exp = `ABAP_BOOL` ). - - ENDMETHOD. - - METHOD test_substring_after. - - cl_abap_unit_assert=>assert_equals( - act = substring_after( val = 'this is a string' sub = 'a' ) - exp = ` string` ). - - ENDMETHOD. - - METHOD test_substring_before. - - cl_abap_unit_assert=>assert_equals( - act = substring_before( val = 'this is a string' sub = 'a' ) - exp = `this is ` ). - - ENDMETHOD. - - METHOD test_string_shift. - - cl_abap_unit_assert=>assert_equals( - act = shift_left( shift_right( val = ` string ` sub = ` ` ) ) - exp = `string` ). - - ENDMETHOD. - - METHOD test_string_replace. - - DATA(lv_search) = replace( val = `one two three` - sub = `two` - with = 'ABC' - occ = 0 ) ##NEEDED. - - cl_abap_unit_assert=>assert_equals( - act = replace( val = `one two three` sub = `two` with = 'ABC' occ = 0 ) - exp = `one ABC three` ). - - ENDMETHOD. - - METHOD test_raise_error. - - TRY. - IF 1 = 1. - RAISE EXCEPTION TYPE z2ui5_cx_util_error. - ENDIF. - cl_abap_unit_assert=>fail( ). - - CATCH z2ui5_cx_util_error INTO DATA(lx). - cl_abap_unit_assert=>assert_bound( lx ). - ENDTRY. - - ENDMETHOD. - - METHOD test_xsdbool. - - DATA(lv_xsdbool) = xsdbool( 1 = 1 ). - IF lv_xsdbool = abap_false. - cl_abap_unit_assert=>assert_equals( - act = lv_xsdbool - exp = abap_false ). - ENDIF. - - IF xsdbool( 1 = 1 ) = abap_false. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_xsdbool_nested. - - DATA(lv_xsdbool) = check_input( xsdbool( 1 = 1 ) ). - IF lv_xsdbool = abap_false. - cl_abap_unit_assert=>assert_equals( - act = lv_xsdbool - exp = abap_false ). - ENDIF. - - IF check_input( abap_false ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF check_input( xsdbool( 1 = 1 ) ) = abap_false. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD check_input. - - result = val. - - ENDMETHOD. - -ENDCLASS. - -CLASS ltcl_unit_test IMPLEMENTATION. - - METHOD test_boolean_check. - - DATA(lv_bool) = xsdbool( 1 = 1 ). - cl_abap_unit_assert=>assert_equals( - act = z2ui5_cl_util_func=>boolean_check_by_data( lv_bool ) - exp = abap_true ). - - lv_bool = xsdbool( 1 = 2 ). - cl_abap_unit_assert=>assert_equals( - act = z2ui5_cl_util_func=>boolean_check_by_data( lv_bool ) - exp = abap_true ). - - cl_abap_unit_assert=>assert_equals( - act = z2ui5_cl_util_func=>boolean_check_by_data( abap_true ) - exp = abap_true ). - - cl_abap_unit_assert=>assert_equals( - act = z2ui5_cl_util_func=>boolean_check_by_data( abap_false ) - exp = abap_true ). - - ENDMETHOD. - - METHOD test_create. - - DATA(lo_test) = NEW z2ui5_cl_util_func( ) ##NEEDED. - - ENDMETHOD. - - METHOD test_rtti_get_classname_by_ref. - - DATA(lo_test) = NEW z2ui5_cl_util_func( ). - DATA(lv_name) = z2ui5_cl_util_func=>rtti_get_classname_by_ref( lo_test ). - cl_abap_unit_assert=>assert_equals( exp = `Z2UI5_CL_UTIL_FUNC` - act = lv_name ). - - DATA(lo_test2) = NEW ltcl_test_app( ). - DATA(lv_name2) = z2ui5_cl_util_func=>rtti_get_classname_by_ref( lo_test2 ). - cl_abap_unit_assert=>assert_equals( exp = `LTCL_TEST_APP` - act = lv_name2 ). - - ENDMETHOD. - - METHOD test_boolean_abap_2_json. - - cl_abap_unit_assert=>assert_equals( exp = `false` - act = z2ui5_cl_util_func=>boolean_abap_2_json( abap_false ) ). - - IF `{ABCD}` <> z2ui5_cl_util_func=>boolean_abap_2_json( `{ABCD}` ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_time_get_timestampl. - - DATA(lv_time) = z2ui5_cl_util_func=>time_get_timestampl( ). - - DATA(lv_time2) = z2ui5_cl_util_func=>time_substract_seconds( - time = lv_time - seconds = 60 * 60 * 4 ). - - IF lv_time IS INITIAL OR lv_time2 IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF lv_time < lv_time2. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_time_substract_seconds. - - DATA(lv_time) = z2ui5_cl_util_func=>time_get_timestampl( ). - DATA(lv_time2) = z2ui5_cl_util_func=>time_get_timestampl( ). - - IF lv_time IS INITIAL OR lv_time2 IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF lv_time2 < lv_time. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_c_trim. - - IF z2ui5_cl_util_func=>c_trim( ` JsadfHHs ` ) <> `JsadfHHs`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_c_trim_lower. - - IF z2ui5_cl_util_func=>c_trim_lower( ` JsadfHHs ` ) <> `jsadfhhs`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_c_trim_upper. - - IF z2ui5_cl_util_func=>c_trim_upper( ` JsadfHHs ` ) <> `JSADFHHS`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_func_get_uuid_32. - - DATA(lv_uuid) = z2ui5_cl_util_func=>uuid_get_c32( ). - - IF lv_uuid IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF strlen( lv_uuid ) <> 32. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_func_get_uuid_22. - - DATA(lv_uuid) = z2ui5_cl_util_func=>uuid_get_c22( ). - - IF lv_uuid IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF strlen( lv_uuid ) <> 22. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_func_get_user_tech. - - DATA(lv_uname) = z2ui5_cl_util_func=>user_get_tech( ). - IF sy-uname <> lv_uname OR lv_uname IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_x_raise. - - TRY. - z2ui5_cl_util_func=>x_raise( ). - cl_abap_unit_assert=>fail( ). - CATCH cx_root. - ENDTRY. - - ENDMETHOD. - - METHOD test_x_check_raise. - - TRY. - z2ui5_cl_util_func=>x_check_raise( xsdbool( 1 = 1 ) ). - cl_abap_unit_assert=>fail( ). - CATCH cx_root. - ENDTRY. - - TRY. - z2ui5_cl_util_func=>x_check_raise( xsdbool( 1 = 3 ) ). - CATCH cx_root. - cl_abap_unit_assert=>fail( ). - ENDTRY. - - ENDMETHOD. - - - - - METHOD test_trans_json_2_any__w_dref. - - DATA(lv_test) = `{ ` && - ` "EDIT": { ` && - ` "DATE": "2023-08-26", ` && - ` "DEC1": -0.3333, ` && - ` "DEC2": 0, ` && - ` "DEC_SUM": -0.3333, ` && - ` "INT1": 0, ` && - ` "INT2": 0, ` && - ` "INT_SUM": 0, ` && - ` "TIME": "12:51:55" ` && - ` }, ` && - ` "oScroll": [], ` && - ` "OMESSAGEMANAGER": [], ` && - ` "ID": "0242B09497911EEE90CFA16736E6EEF8", ` && - ` "ARGUMENTS": [{ ` && - ` "EVENT": "BACK", ` && - ` "METHOD": "UPDATE", ` && - ` "CHECK_VIEW_DESTROY": false ` && - ` }] ` && - ` } `. - - DATA mr_data TYPE REF TO data. - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_util_func=>trans_json_2_any( - EXPORTING - val = lv_test - CHANGING - data = mr_data ). - - - ASSIGN (`MR_DATA->EDIT->TIME->*`) TO . - - cl_abap_unit_assert=>assert_equals( - act = - exp = `12:51:55` ). - - ENDMETHOD. - - - METHOD test_trans_json_any_2__w_struc. - - TYPES: - BEGIN OF ty_row, - title TYPE string, - value TYPE string, - selected TYPE abap_bool, - END OF ty_row. - TYPES ty_t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. - - DATA(lt_tab2) = VALUE ty_t_tab( ) ##NEEDED. - - DATA(ls_row) = VALUE ty_row( ). - ls_row-title = `test`. - - DATA(lv_json) = z2ui5_cl_util_func=>trans_json_by_any( ls_row ). - - IF lv_json IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_trans_ref_tab_2_tab. - - TYPES: - BEGIN OF ty_row, - title TYPE string, - value TYPE string, - selected TYPE abap_bool, - END OF ty_row. - TYPES ty_t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. - - DATA(lv_result) = `[{"TITLE":"Test","VALUE":"this is a description","SELECTED":true},{"TITLE":"Test2","VALUE":"this is a new descr","SELECTED":false}]`. - - DATA lo_data TYPE REF TO data. - /ui2/cl_json=>deserialize( EXPORTING json = lv_result - CHANGING data = lo_data ). - - DATA(lt_tab2) = VALUE ty_t_tab( ). - z2ui5_cl_util_func=>trans_ref_tab_2_tab( - EXPORTING ir_tab_from = lo_data - IMPORTING t_result = lt_tab2 ). - - - DATA(lt_tab) = VALUE ty_t_tab( ( title = 'Test' value = 'this is a description' selected = abap_true ) - ( title = 'Test2' value = 'this is a new descr' selected = abap_false ) ). - - IF lt_tab <> lt_tab2. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_url_param_create_url. - - DATA(lt_param) = z2ui5_cl_util_func=>url_param_get_tab( `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). - DATA(lv_url) = z2ui5_cl_util_func=>url_param_create_url( lt_param ). - - IF lv_url <> `sap-client=100&app_start=z2ui5_cl_app_hello_world`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_url_param_get. - - DATA(lv_param) = z2ui5_cl_util_func=>url_param_get( - val = `app_start` - url = `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). - - IF lv_param <> `z2ui5_cl_app_hello_world`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_url_param_get_tab. - - DATA(lt_param) = z2ui5_cl_util_func=>url_param_get_tab( `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). - IF lt_param[ n = `sap-client` ]-v <> `100`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF lt_param[ n = `app_start` ]-v <> `z2ui5_cl_app_hello_world`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_url_param_set. - - DATA(lv_param) = z2ui5_cl_util_func=>url_param_set( - name = `app_start` - value = `z2ui5_cl_app_hello_world2` - url = `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). - - IF lv_param <> `sap-client=100&app_start=z2ui5_cl_app_hello_world2`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_x_check_raise_not. - - TRY. - z2ui5_cl_util_func=>x_check_raise( xsdbool( 1 = 2 ) ). - - CATCH z2ui5_cx_util_error. - cl_abap_unit_assert=>fail( ). - ENDTRY. - ENDMETHOD. - - METHOD test_rtti_get_type_name. - - DATA(lv_xsdbool) = VALUE xsdboolean( ). - DATA(lv_name) = z2ui5_cl_util_func=>rtti_get_type_name( lv_xsdbool ). - cl_abap_unit_assert=>assert_equals( - act = lv_name - exp = `XSDBOOLEAN` ). - - ENDMETHOD. - - METHOD test_rtti_get_type_kind. - - DATA(lv_string) = VALUE string( ). - - DATA(lv_type_kind) = z2ui5_cl_util_func=>rtti_get_type_kind( lv_string ). - DATA lr_string TYPE REF TO string. - cl_abap_unit_assert=>assert_equals( - act = lv_type_kind - exp = cl_abap_typedescr=>typekind_string ). - - - CREATE DATA lr_string. - lv_type_kind = z2ui5_cl_util_func=>rtti_get_type_kind( lr_string ). - cl_abap_unit_assert=>assert_equals( - act = lv_type_kind - exp = cl_abap_typedescr=>typekind_dref ). - - ENDMETHOD. - - METHOD test_rtti_check_type_kind. - - DATA(lv_string) = VALUE string( ). - DATA lr_string TYPE REF TO string. - cl_abap_unit_assert=>assert_equals( - act = z2ui5_cl_util_func=>rtti_check_type_kind_dref( lv_string ) - exp = abap_false ). - - - CREATE DATA lr_string. - cl_abap_unit_assert=>assert_equals( - act = z2ui5_cl_util_func=>rtti_check_type_kind_dref( lr_string ) - exp = abap_true ). - - ENDMETHOD. - - METHOD test_rtti_get_t_attri_by_obj. - - DATA(lo_obj) = NEW ltcl_test_app( ). - DATA(lt_attri) = z2ui5_cl_util_func=>rtti_get_t_attri_by_object( lo_obj ). - - IF lines( lt_attri ) <> 7. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_attri[ name = `MS_TAB` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_attri[ name = `SS_TAB` type_kind = `v` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_attri[ name = `SV_VAR` type_kind = `g` is_class = abap_true ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_attri[ name = `SV_STATUS` type_kind = `g` is_class = abap_true is_constant = `X` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_rtti_get_t_comp_by_struc. - - TYPES: - BEGIN OF ty_row, - title TYPE string, - value TYPE string, - descr TYPE string, - icon TYPE string, - info TYPE string, - selected TYPE abap_bool, - checkbox TYPE abap_bool, - END OF ty_row. - - DATA(ls_row) = VALUE ty_row( ). - - DATA(lt_comp) = z2ui5_cl_util_func=>rtti_get_t_comp_by_data( ls_row ). - - IF lines( lt_comp ) <> 7. - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_comp[ name = `TITLE` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_comp[ name = `VALUE` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_comp[ name = `SELECTED` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - IF NOT line_exists( lt_comp[ name = `CHECKBOX` ] ). - cl_abap_unit_assert=>fail( ). - ENDIF. - - DATA(ls_title) = lt_comp[ 1 ]. - - IF ls_title-type->type_kind <> `g`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_trans_xml_any_2__w_obj. - - DATA(lo_obj) = NEW ltcl_test_app( ). - DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( lo_obj ). - - IF lv_xml IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - ENDMETHOD. - - METHOD test_trans_xml_2_any__w_obj. - - DATA(lo_obj) = NEW ltcl_test_app( ). - DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( lo_obj ). - - CLEAR lo_obj. - z2ui5_cl_util_func=>trans_xml_2_any( - EXPORTING - xml = lv_xml - IMPORTING - any = lo_obj ). - - IF lo_obj IS NOT BOUND. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_trans_xml_any_2__w_data. - - TYPES: - BEGIN OF ty_row, - title TYPE string, - value TYPE string, - descr TYPE string, - icon TYPE string, - info TYPE string, - selected TYPE abap_bool, - checkbox TYPE abap_bool, - END OF ty_row. - - DATA(ls_row) = VALUE ty_row( ). - ls_row-value = `test`. - - DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( ls_row ). - - IF lv_xml IS INITIAL. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - - METHOD test_trans_xml_2_any__w_data. - - TYPES: - BEGIN OF ty_row, - title TYPE string, - value TYPE string, - descr TYPE string, - icon TYPE string, - info TYPE string, - selected TYPE abap_bool, - checkbox TYPE abap_bool, - END OF ty_row. - - DATA(ls_row) = VALUE ty_row( ). - DATA(ls_row2) = VALUE ty_row( ). - ls_row-value = `test`. - - DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( ls_row ). - - z2ui5_cl_util_func=>trans_xml_2_any( - EXPORTING - xml = lv_xml - IMPORTING - any = ls_row2 ). - - cl_abap_unit_assert=>assert_equals( - act = ls_row - exp = ls_row2 ). - - ENDMETHOD. - - METHOD test_c_replace_assign_struc. - - DATA(lv_result) = z2ui5_cl_util_func=>c_replace_assign_struc( `MO_APP->MS_STRUC->*`). - cl_abap_unit_assert=>assert_equals( - act = lv_result - exp = 'MO_APP->MS_STRUC->' ). - - DATA(lv_result2) = z2ui5_cl_util_func=>c_replace_assign_struc( `MO_APP->MS_STRUC-MS_STRUC->*`). - cl_abap_unit_assert=>assert_equals( - act = lv_result2 - exp = 'MO_APP->MS_STRUC-MS_STRUC->' ). - - DATA(lv_result3) = z2ui5_cl_util_func=>c_replace_assign_struc( `*MO_APP->*MS_STRUC->*`). - cl_abap_unit_assert=>assert_equals( - act = lv_result3 - exp = `*MO_APP->*MS_STRUC->` ). - - DATA(lv_result4) = z2ui5_cl_util_func=>c_replace_assign_struc( `*MO_APP->*MS_STRUC`). - cl_abap_unit_assert=>assert_equals( - act = lv_result4 - exp = `*MO_APP->*MS_STRUC-` ). - - ENDMETHOD. - - - METHOD test_c_trim_horizontal_tab. - - IF z2ui5_cl_util_func=>c_trim( |{ cl_abap_char_utilities=>horizontal_tab }| - && |JsadfHHs| - && |{ cl_abap_char_utilities=>horizontal_tab }| ) <> `JsadfHHs`. - cl_abap_unit_assert=>fail( ). - ENDIF. - - ENDMETHOD. - -ENDCLASS. +*CLASS ltcl_test_app DEFINITION FOR TESTING. +* +* PUBLIC SECTION. +* +* INTERFACES if_serializable_object. +* +* TYPES: +* BEGIN OF ty_row, +* title TYPE string, +* value TYPE string, +* descr TYPE string, +* icon TYPE string, +* info TYPE string, +* selected TYPE abap_bool, +* checkbox TYPE abap_bool, +* END OF ty_row. +* +* CONSTANTS sv_status TYPE string VALUE `test` ##NEEDED. +* +* CLASS-DATA sv_var TYPE string. +* CLASS-DATA ss_tab TYPE ty_row. +* CLASS-DATA st_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. +* CLASS-METHODS class_constructor. +* +* DATA mv_val TYPE string ##NEEDED. +* DATA ms_tab TYPE ty_row ##NEEDED. +* DATA mt_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY ##NEEDED. +* +* PROTECTED SECTION. +* PRIVATE SECTION. +*ENDCLASS. +* +*CLASS ltcl_test_app IMPLEMENTATION. +* +* METHOD class_constructor. +* +* sv_var = 1. +* ss_tab = VALUE #( ). +* st_tab = VALUE #( ). +* +* ENDMETHOD. +*ENDCLASS. +* +*CLASS ltcl_unit_test_abap_api DEFINITION FINAL FOR TESTING +* DURATION SHORT +* RISK LEVEL HARMLESS. +* +* PRIVATE SECTION. +* +* METHODS check_input +* IMPORTING +* val TYPE data +* RETURNING +* VALUE(result) TYPE abap_bool. +* +* METHODS test_assign FOR TESTING RAISING cx_static_check. +* METHODS test_eledescr_rel_name FOR TESTING RAISING cx_static_check. +* METHODS test_classdescr FOR TESTING RAISING cx_static_check. +* METHODS test_substring_after FOR TESTING RAISING cx_static_check. +* METHODS test_substring_before FOR TESTING RAISING cx_static_check. +* METHODS test_string_shift FOR TESTING RAISING cx_static_check. +* METHODS test_string_replace FOR TESTING RAISING cx_static_check. +* METHODS test_raise_error FOR TESTING RAISING cx_static_check. +* METHODS test_xsdbool FOR TESTING RAISING cx_static_check. +* METHODS test_xsdbool_nested FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING +* DURATION MEDIUM +* RISK LEVEL HARMLESS. +* +* PRIVATE SECTION. +* +* METHODS test_create FOR TESTING RAISING cx_static_check. +* +* METHODS test_boolean_abap_2_json FOR TESTING RAISING cx_static_check. +* METHODS test_boolean_check FOR TESTING RAISING cx_static_check. +* +* +* METHODS test_c_trim FOR TESTING RAISING cx_static_check. +* METHODS test_c_trim_lower FOR TESTING RAISING cx_static_check. +* METHODS test_c_trim_upper FOR TESTING RAISING cx_static_check. +* METHODS test_c_replace_assign_struc FOR TESTING RAISING cx_static_check. +* METHODS test_c_trim_horizontal_tab FOR TESTING RAISING cx_static_check. +* +* METHODS test_time_get_timestampl FOR TESTING RAISING cx_static_check. +* METHODS test_time_substract_seconds FOR TESTING RAISING cx_static_check. +* METHODS test_func_get_uuid_32 FOR TESTING RAISING cx_static_check. +* METHODS test_func_get_uuid_22 FOR TESTING RAISING cx_static_check. +* METHODS test_func_get_user_tech FOR TESTING RAISING cx_static_check. +* +* METHODS test_rtti_get_classname_by_ref FOR TESTING RAISING cx_static_check. +* METHODS test_rtti_get_type_name FOR TESTING RAISING cx_static_check. +* METHODS test_rtti_get_type_kind FOR TESTING RAISING cx_static_check. +* METHODS test_rtti_check_type_kind FOR TESTING RAISING cx_static_check. +* METHODS test_rtti_get_t_attri_by_obj FOR TESTING RAISING cx_static_check. +* METHODS test_rtti_get_t_comp_by_struc FOR TESTING RAISING cx_static_check. +* +* METHODS test_trans_json_any_2__w_struc FOR TESTING RAISING cx_static_check. +* METHODS test_trans_json_2_any__w_dref FOR TESTING RAISING cx_static_check. +* METHODS test_trans_ref_tab_2_tab FOR TESTING RAISING cx_static_check. +* METHODS test_trans_xml_any_2__w_obj FOR TESTING RAISING cx_static_check. +* METHODS test_trans_xml_any_2__w_data FOR TESTING RAISING cx_static_check. +* METHODS test_trans_xml_2_any__w_obj FOR TESTING RAISING cx_static_check. +* METHODS test_trans_xml_2_any__w_data FOR TESTING RAISING cx_static_check. +* +* METHODS test_url_param_create_url FOR TESTING RAISING cx_static_check. +* METHODS test_url_param_get FOR TESTING RAISING cx_static_check. +* METHODS test_url_param_get_tab FOR TESTING RAISING cx_static_check. +* METHODS test_url_param_set FOR TESTING RAISING cx_static_check. +* +* METHODS test_x_check_raise FOR TESTING RAISING cx_static_check. +* METHODS test_x_check_raise_not FOR TESTING RAISING cx_static_check. +* METHODS test_x_raise FOR TESTING RAISING cx_static_check. +* +*ENDCLASS. +* +*CLASS ltcl_unit_test_abap_api IMPLEMENTATION. +* +* +* METHOD test_assign. +* +* DATA(lo_app) = NEW ltcl_test_app( ). +* FIELD-SYMBOLS TYPE any. +* +* lo_app->mv_val = `ABC`. +* +* DATA(lv_assign) = `LO_APP->` && 'MV_VAL'. +* ASSIGN (lv_assign) TO . +* +* cl_abap_unit_assert=>assert_equals( +* act = +* exp = `ABC` ). +* +* ENDMETHOD. +* +* +* METHOD test_classdescr. +* +* DATA(lo_app) = NEW ltcl_test_app( ). +* +* DATA(lt_attri) = CAST cl_abap_classdescr( cl_abap_objectdescr=>describe_by_object_ref( lo_app ) )->attributes. +* +* DATA(lv_test) = lt_attri[ name = `MS_TAB` ]. +* lv_test = lt_attri[ name = `MT_TAB` ]. +* lv_test = lt_attri[ name = `MV_VAL` ]. +* lv_test = lt_attri[ name = `SS_TAB` ]. +* lv_test = lt_attri[ name = `ST_TAB` ]. +* lv_test = lt_attri[ name = `SV_STATUS` ]. +* lv_test = lt_attri[ name = `SV_VAR` ]. +* +* ENDMETHOD. +* +* METHOD test_eledescr_rel_name. +* +* DATA(lo_ele) = CAST cl_abap_elemdescr( cl_abap_elemdescr=>describe_by_data( abap_true ) ). +* +* cl_abap_unit_assert=>assert_equals( +* act = lo_ele->get_relative_name( ) +* exp = `ABAP_BOOL` ). +* +* ENDMETHOD. +* +* METHOD test_substring_after. +* +* cl_abap_unit_assert=>assert_equals( +* act = substring_after( val = 'this is a string' sub = 'a' ) +* exp = ` string` ). +* +* ENDMETHOD. +* +* METHOD test_substring_before. +* +* cl_abap_unit_assert=>assert_equals( +* act = substring_before( val = 'this is a string' sub = 'a' ) +* exp = `this is ` ). +* +* ENDMETHOD. +* +* METHOD test_string_shift. +* +* cl_abap_unit_assert=>assert_equals( +* act = shift_left( shift_right( val = ` string ` sub = ` ` ) ) +* exp = `string` ). +* +* ENDMETHOD. +* +* METHOD test_string_replace. +* +* DATA(lv_search) = replace( val = `one two three` +* sub = `two` +* with = 'ABC' +* occ = 0 ) ##NEEDED. +* +* cl_abap_unit_assert=>assert_equals( +* act = replace( val = `one two three` sub = `two` with = 'ABC' occ = 0 ) +* exp = `one ABC three` ). +* +* ENDMETHOD. +* +* METHOD test_raise_error. +* +* TRY. +* IF 1 = 1. +* RAISE EXCEPTION TYPE z2ui5_cx_util_error. +* ENDIF. +* cl_abap_unit_assert=>fail( ). +* +* CATCH z2ui5_cx_util_error INTO DATA(lx). +* cl_abap_unit_assert=>assert_bound( lx ). +* ENDTRY. +* +* ENDMETHOD. +* +* METHOD test_xsdbool. +* +* DATA(lv_xsdbool) = xsdbool( 1 = 1 ). +* IF lv_xsdbool = abap_false. +* cl_abap_unit_assert=>assert_equals( +* act = lv_xsdbool +* exp = abap_false ). +* ENDIF. +* +* IF xsdbool( 1 = 1 ) = abap_false. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_xsdbool_nested. +* +* DATA(lv_xsdbool) = check_input( xsdbool( 1 = 1 ) ). +* IF lv_xsdbool = abap_false. +* cl_abap_unit_assert=>assert_equals( +* act = lv_xsdbool +* exp = abap_false ). +* ENDIF. +* +* IF check_input( abap_false ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF check_input( xsdbool( 1 = 1 ) ) = abap_false. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD check_input. +* +* result = val. +* +* ENDMETHOD. +* +*ENDCLASS. +* +*CLASS ltcl_unit_test IMPLEMENTATION. +* +* METHOD test_boolean_check. +* +* DATA(lv_bool) = xsdbool( 1 = 1 ). +* cl_abap_unit_assert=>assert_equals( +* act = z2ui5_cl_util_func=>boolean_check_by_data( lv_bool ) +* exp = abap_true ). +* +* lv_bool = xsdbool( 1 = 2 ). +* cl_abap_unit_assert=>assert_equals( +* act = z2ui5_cl_util_func=>boolean_check_by_data( lv_bool ) +* exp = abap_true ). +* +* cl_abap_unit_assert=>assert_equals( +* act = z2ui5_cl_util_func=>boolean_check_by_data( abap_true ) +* exp = abap_true ). +* +* cl_abap_unit_assert=>assert_equals( +* act = z2ui5_cl_util_func=>boolean_check_by_data( abap_false ) +* exp = abap_true ). +* +* ENDMETHOD. +* +* METHOD test_create. +* +* DATA(lo_test) = NEW z2ui5_cl_util_func( ) ##NEEDED. +* +* ENDMETHOD. +* +* METHOD test_rtti_get_classname_by_ref. +* +* DATA(lo_test) = NEW z2ui5_cl_util_func( ). +* DATA(lv_name) = z2ui5_cl_util_func=>rtti_get_classname_by_ref( lo_test ). +* cl_abap_unit_assert=>assert_equals( exp = `Z2UI5_CL_UTIL_FUNC` +* act = lv_name ). +* +* DATA(lo_test2) = NEW ltcl_test_app( ). +* DATA(lv_name2) = z2ui5_cl_util_func=>rtti_get_classname_by_ref( lo_test2 ). +* cl_abap_unit_assert=>assert_equals( exp = `LTCL_TEST_APP` +* act = lv_name2 ). +* +* ENDMETHOD. +* +* METHOD test_boolean_abap_2_json. +* +* cl_abap_unit_assert=>assert_equals( exp = `false` +* act = z2ui5_cl_util_func=>boolean_abap_2_json( abap_false ) ). +* +* IF `{ABCD}` <> z2ui5_cl_util_func=>boolean_abap_2_json( `{ABCD}` ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_time_get_timestampl. +* +* DATA(lv_time) = z2ui5_cl_util_func=>time_get_timestampl( ). +* +* DATA(lv_time2) = z2ui5_cl_util_func=>time_substract_seconds( +* time = lv_time +* seconds = 60 * 60 * 4 ). +* +* IF lv_time IS INITIAL OR lv_time2 IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF lv_time < lv_time2. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_time_substract_seconds. +* +* DATA(lv_time) = z2ui5_cl_util_func=>time_get_timestampl( ). +* DATA(lv_time2) = z2ui5_cl_util_func=>time_get_timestampl( ). +* +* IF lv_time IS INITIAL OR lv_time2 IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF lv_time2 < lv_time. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_c_trim. +* +* IF z2ui5_cl_util_func=>c_trim( ` JsadfHHs ` ) <> `JsadfHHs`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_c_trim_lower. +* +* IF z2ui5_cl_util_func=>c_trim_lower( ` JsadfHHs ` ) <> `jsadfhhs`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_c_trim_upper. +* +* IF z2ui5_cl_util_func=>c_trim_upper( ` JsadfHHs ` ) <> `JSADFHHS`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_func_get_uuid_32. +* +* DATA(lv_uuid) = z2ui5_cl_util_func=>uuid_get_c32( ). +* +* IF lv_uuid IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF strlen( lv_uuid ) <> 32. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_func_get_uuid_22. +* +* DATA(lv_uuid) = z2ui5_cl_util_func=>uuid_get_c22( ). +* +* IF lv_uuid IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF strlen( lv_uuid ) <> 22. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_func_get_user_tech. +* +* DATA(lv_uname) = z2ui5_cl_util_func=>user_get_tech( ). +* IF sy-uname <> lv_uname OR lv_uname IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_x_raise. +* +* TRY. +* z2ui5_cl_util_func=>x_raise( ). +* cl_abap_unit_assert=>fail( ). +* CATCH cx_root. +* ENDTRY. +* +* ENDMETHOD. +* +* METHOD test_x_check_raise. +* +* TRY. +* z2ui5_cl_util_func=>x_check_raise( xsdbool( 1 = 1 ) ). +* cl_abap_unit_assert=>fail( ). +* CATCH cx_root. +* ENDTRY. +* +* TRY. +* z2ui5_cl_util_func=>x_check_raise( xsdbool( 1 = 3 ) ). +* CATCH cx_root. +* cl_abap_unit_assert=>fail( ). +* ENDTRY. +* +* ENDMETHOD. +* +* +* +* +* METHOD test_trans_json_2_any__w_dref. +* +* DATA(lv_test) = `{ ` && +* ` "EDIT": { ` && +* ` "DATE": "2023-08-26", ` && +* ` "DEC1": -0.3333, ` && +* ` "DEC2": 0, ` && +* ` "DEC_SUM": -0.3333, ` && +* ` "INT1": 0, ` && +* ` "INT2": 0, ` && +* ` "INT_SUM": 0, ` && +* ` "TIME": "12:51:55" ` && +* ` }, ` && +* ` "oScroll": [], ` && +* ` "OMESSAGEMANAGER": [], ` && +* ` "ID": "0242B09497911EEE90CFA16736E6EEF8", ` && +* ` "ARGUMENTS": [{ ` && +* ` "EVENT": "BACK", ` && +* ` "METHOD": "UPDATE", ` && +* ` "CHECK_VIEW_DESTROY": false ` && +* ` }] ` && +* ` } `. +* +* DATA mr_data TYPE REF TO data. +* FIELD-SYMBOLS TYPE any. +* +* z2ui5_cl_util_func=>trans_json_2_any( +* EXPORTING +* val = lv_test +* CHANGING +* data = mr_data ). +* +* +* ASSIGN (`MR_DATA->EDIT->TIME->*`) TO . +* +* cl_abap_unit_assert=>assert_equals( +* act = +* exp = `12:51:55` ). +* +* ENDMETHOD. +* +* +* METHOD test_trans_json_any_2__w_struc. +* +* TYPES: +* BEGIN OF ty_row, +* title TYPE string, +* value TYPE string, +* selected TYPE abap_bool, +* END OF ty_row. +* TYPES ty_t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. +* +* DATA(lt_tab2) = VALUE ty_t_tab( ) ##NEEDED. +* +* DATA(ls_row) = VALUE ty_row( ). +* ls_row-title = `test`. +* +* DATA(lv_json) = z2ui5_cl_util_func=>trans_json_by_any( ls_row ). +* +* IF lv_json IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_trans_ref_tab_2_tab. +* +* TYPES: +* BEGIN OF ty_row, +* title TYPE string, +* value TYPE string, +* selected TYPE abap_bool, +* END OF ty_row. +* TYPES ty_t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. +* +* DATA(lv_result) = `[{"TITLE":"Test","VALUE":"this is a description","SELECTED":true},{"TITLE":"Test2","VALUE":"this is a new descr","SELECTED":false}]`. +* +* DATA lo_data TYPE REF TO data. +* /ui2/cl_json=>deserialize( EXPORTING json = lv_result +* CHANGING data = lo_data ). +* +* DATA(lt_tab2) = VALUE ty_t_tab( ). +* z2ui5_cl_util_func=>trans_ref_tab_2_tab( +* EXPORTING ir_tab_from = lo_data +* IMPORTING t_result = lt_tab2 ). +* +* +* DATA(lt_tab) = VALUE ty_t_tab( ( title = 'Test' value = 'this is a description' selected = abap_true ) +* ( title = 'Test2' value = 'this is a new descr' selected = abap_false ) ). +* +* IF lt_tab <> lt_tab2. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_url_param_create_url. +* +* DATA(lt_param) = z2ui5_cl_util_func=>url_param_get_tab( `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). +* DATA(lv_url) = z2ui5_cl_util_func=>url_param_create_url( lt_param ). +* +* IF lv_url <> `sap-client=100&app_start=z2ui5_cl_app_hello_world`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_url_param_get. +* +* DATA(lv_param) = z2ui5_cl_util_func=>url_param_get( +* val = `app_start` +* url = `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). +* +* IF lv_param <> `z2ui5_cl_app_hello_world`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_url_param_get_tab. +* +* DATA(lt_param) = z2ui5_cl_util_func=>url_param_get_tab( `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). +* IF lt_param[ n = `sap-client` ]-v <> `100`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF lt_param[ n = `app_start` ]-v <> `z2ui5_cl_app_hello_world`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_url_param_set. +* +* DATA(lv_param) = z2ui5_cl_util_func=>url_param_set( +* name = `app_start` +* value = `z2ui5_cl_app_hello_world2` +* url = `https://url.com/rvice_for_ui?sap-client=100&app_start=z2ui5_cl_app_hello_world` ). +* +* IF lv_param <> `sap-client=100&app_start=z2ui5_cl_app_hello_world2`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_x_check_raise_not. +* +* TRY. +* z2ui5_cl_util_func=>x_check_raise( xsdbool( 1 = 2 ) ). +* +* CATCH z2ui5_cx_util_error. +* cl_abap_unit_assert=>fail( ). +* ENDTRY. +* ENDMETHOD. +* +* METHOD test_rtti_get_type_name. +* +* DATA(lv_xsdbool) = VALUE xsdboolean( ). +* DATA(lv_name) = z2ui5_cl_util_func=>rtti_get_type_name( lv_xsdbool ). +* cl_abap_unit_assert=>assert_equals( +* act = lv_name +* exp = `XSDBOOLEAN` ). +* +* ENDMETHOD. +* +* METHOD test_rtti_get_type_kind. +* +* DATA(lv_string) = VALUE string( ). +* +* DATA(lv_type_kind) = z2ui5_cl_util_func=>rtti_get_type_kind( lv_string ). +* DATA lr_string TYPE REF TO string. +* cl_abap_unit_assert=>assert_equals( +* act = lv_type_kind +* exp = cl_abap_typedescr=>typekind_string ). +* +* +* CREATE DATA lr_string. +* lv_type_kind = z2ui5_cl_util_func=>rtti_get_type_kind( lr_string ). +* cl_abap_unit_assert=>assert_equals( +* act = lv_type_kind +* exp = cl_abap_typedescr=>typekind_dref ). +* +* ENDMETHOD. +* +* METHOD test_rtti_check_type_kind. +* +* DATA(lv_string) = VALUE string( ). +* DATA lr_string TYPE REF TO string. +* cl_abap_unit_assert=>assert_equals( +* act = z2ui5_cl_util_func=>rtti_check_type_kind_dref( lv_string ) +* exp = abap_false ). +* +* +* CREATE DATA lr_string. +* cl_abap_unit_assert=>assert_equals( +* act = z2ui5_cl_util_func=>rtti_check_type_kind_dref( lr_string ) +* exp = abap_true ). +* +* ENDMETHOD. +* +* METHOD test_rtti_get_t_attri_by_obj. +* +* DATA(lo_obj) = NEW ltcl_test_app( ). +* DATA(lt_attri) = z2ui5_cl_util_func=>rtti_get_t_attri_by_object( lo_obj ). +* +* IF lines( lt_attri ) <> 7. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_attri[ name = `MS_TAB` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_attri[ name = `SS_TAB` type_kind = `v` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_attri[ name = `SV_VAR` type_kind = `g` is_class = abap_true ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_attri[ name = `SV_STATUS` type_kind = `g` is_class = abap_true is_constant = `X` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_rtti_get_t_comp_by_struc. +* +* TYPES: +* BEGIN OF ty_row, +* title TYPE string, +* value TYPE string, +* descr TYPE string, +* icon TYPE string, +* info TYPE string, +* selected TYPE abap_bool, +* checkbox TYPE abap_bool, +* END OF ty_row. +* +* DATA(ls_row) = VALUE ty_row( ). +* +* DATA(lt_comp) = z2ui5_cl_util_func=>rtti_get_t_comp_by_data( ls_row ). +* +* IF lines( lt_comp ) <> 7. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_comp[ name = `TITLE` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_comp[ name = `VALUE` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_comp[ name = `SELECTED` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* IF NOT line_exists( lt_comp[ name = `CHECKBOX` ] ). +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* DATA(ls_title) = lt_comp[ 1 ]. +* +* IF ls_title-type->type_kind <> `g`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_trans_xml_any_2__w_obj. +* +* DATA(lo_obj) = NEW ltcl_test_app( ). +* DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( lo_obj ). +* +* IF lv_xml IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* ENDMETHOD. +* +* METHOD test_trans_xml_2_any__w_obj. +* +* DATA(lo_obj) = NEW ltcl_test_app( ). +* DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( lo_obj ). +* +* CLEAR lo_obj. +* z2ui5_cl_util_func=>trans_xml_2_any( +* EXPORTING +* xml = lv_xml +* IMPORTING +* any = lo_obj ). +* +* IF lo_obj IS NOT BOUND. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_trans_xml_any_2__w_data. +* +* TYPES: +* BEGIN OF ty_row, +* title TYPE string, +* value TYPE string, +* descr TYPE string, +* icon TYPE string, +* info TYPE string, +* selected TYPE abap_bool, +* checkbox TYPE abap_bool, +* END OF ty_row. +* +* DATA(ls_row) = VALUE ty_row( ). +* ls_row-value = `test`. +* +* DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( ls_row ). +* +* IF lv_xml IS INITIAL. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +* METHOD test_trans_xml_2_any__w_data. +* +* TYPES: +* BEGIN OF ty_row, +* title TYPE string, +* value TYPE string, +* descr TYPE string, +* icon TYPE string, +* info TYPE string, +* selected TYPE abap_bool, +* checkbox TYPE abap_bool, +* END OF ty_row. +* +* DATA(ls_row) = VALUE ty_row( ). +* DATA(ls_row2) = VALUE ty_row( ). +* ls_row-value = `test`. +* +* DATA(lv_xml) = z2ui5_cl_util_func=>trans_xml_by_any( ls_row ). +* +* z2ui5_cl_util_func=>trans_xml_2_any( +* EXPORTING +* xml = lv_xml +* IMPORTING +* any = ls_row2 ). +* +* cl_abap_unit_assert=>assert_equals( +* act = ls_row +* exp = ls_row2 ). +* +* ENDMETHOD. +* +* METHOD test_c_replace_assign_struc. +* +* DATA(lv_result) = z2ui5_cl_util_func=>c_replace_assign_struc( `MO_APP->MS_STRUC->*`). +* cl_abap_unit_assert=>assert_equals( +* act = lv_result +* exp = 'MO_APP->MS_STRUC->' ). +* +* DATA(lv_result2) = z2ui5_cl_util_func=>c_replace_assign_struc( `MO_APP->MS_STRUC-MS_STRUC->*`). +* cl_abap_unit_assert=>assert_equals( +* act = lv_result2 +* exp = 'MO_APP->MS_STRUC-MS_STRUC->' ). +* +* DATA(lv_result3) = z2ui5_cl_util_func=>c_replace_assign_struc( `*MO_APP->*MS_STRUC->*`). +* cl_abap_unit_assert=>assert_equals( +* act = lv_result3 +* exp = `*MO_APP->*MS_STRUC->` ). +* +* DATA(lv_result4) = z2ui5_cl_util_func=>c_replace_assign_struc( `*MO_APP->*MS_STRUC`). +* cl_abap_unit_assert=>assert_equals( +* act = lv_result4 +* exp = `*MO_APP->*MS_STRUC-` ). +* +* ENDMETHOD. +* +* +* METHOD test_c_trim_horizontal_tab. +* +* IF z2ui5_cl_util_func=>c_trim( |{ cl_abap_char_utilities=>horizontal_tab }| +* && |JsadfHHs| +* && |{ cl_abap_char_utilities=>horizontal_tab }| ) <> `JsadfHHs`. +* cl_abap_unit_assert=>fail( ). +* ENDIF. +* +* ENDMETHOD. +* +*ENDCLASS. diff --git a/src/01/01/z2ui5_cl_util_tree_json.clas.abap b/src/01/01/z2ui5_cl_util_tree_json.clas.abap deleted file mode 100644 index 53dd185d..00000000 --- a/src/01/01/z2ui5_cl_util_tree_json.clas.abap +++ /dev/null @@ -1,240 +0,0 @@ -CLASS z2ui5_cl_util_tree_json DEFINITION - PUBLIC - FINAL - CREATE PUBLIC . - - PUBLIC SECTION. - - DATA mo_root TYPE REF TO z2ui5_cl_util_tree_json. - DATA mo_parent TYPE REF TO z2ui5_cl_util_tree_json. - DATA mv_name TYPE string. - DATA mv_value TYPE string. - DATA mt_values TYPE STANDARD TABLE OF REF TO z2ui5_cl_util_tree_json WITH EMPTY KEY. - DATA mr_actual TYPE REF TO data. - DATA mv_apost_active TYPE abap_bool. - - CLASS-METHODS factory - IMPORTING - iv_json TYPE clike OPTIONAL - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - METHODS constructor. - - METHODS get_attribute - IMPORTING - name TYPE string - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - METHODS get_val - RETURNING - VALUE(result) TYPE string. - - METHODS get_val_ref - RETURNING - VALUE(result) TYPE REF TO data. - - METHODS add_attribute - IMPORTING - n TYPE clike - v TYPE clike - apos_active TYPE abap_bool DEFAULT abap_true - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - METHODS add_attribute_object - IMPORTING - name TYPE clike - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - METHODS add_attribute_struc - IMPORTING - val TYPE data - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - METHODS add_attribute_instance - IMPORTING - val TYPE REF TO z2ui5_cl_util_tree_json - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - METHODS stringify - RETURNING - VALUE(result) TYPE string. - - PROTECTED SECTION. - - CLASS-METHODS new - IMPORTING - io_root TYPE REF TO z2ui5_cl_util_tree_json - iv_name TYPE simple - RETURNING - VALUE(result) TYPE REF TO z2ui5_cl_util_tree_json. - - PRIVATE SECTION. -ENDCLASS. - - - -CLASS z2ui5_cl_util_tree_json IMPLEMENTATION. - - - METHOD add_attribute. - - result = new( io_root = mo_root - iv_name = n ). - - result->mv_value = COND #( WHEN apos_active = abap_true - THEN escape( val = v - format = cl_abap_format=>e_json_string ) ELSE v ). - - result->mv_apost_active = apos_active. - result->mo_parent = me. - INSERT result INTO TABLE mt_values. - - ENDMETHOD. - - - METHOD add_attribute_instance. - - val->mo_root = mo_root. - val->mo_parent = me. - INSERT val INTO TABLE mt_values. - result = val. - - ENDMETHOD. - - - METHOD add_attribute_object. - - result = new( io_root = mo_root - iv_name = name ). - INSERT result INTO TABLE mt_values. - result->mo_parent = me. - - ENDMETHOD. - - - METHOD add_attribute_struc. - - FIELD-SYMBOLS TYPE any. - DATA(lo_struc) = CAST cl_abap_structdescr( cl_abap_datadescr=>describe_by_data( val ) ). - DATA(lt_comp) = lo_struc->get_components( ). - - LOOP AT lt_comp REFERENCE INTO DATA(lr_comp). - ASSIGN COMPONENT lr_comp->name OF STRUCTURE val TO . - add_attribute( n = lr_comp->name - v = ). - ENDLOOP. - - result = me. - - ENDMETHOD. - - - METHOD constructor. - mo_root = me. - ENDMETHOD. - - - METHOD factory. - - IF z2ui5_cl_fw_controller=>cv_check_ajson = abap_true. - ASSERT 1 = 0. - ENDIF. - - result = NEW #( ). - result->mo_root = result. - - z2ui5_cl_util_func=>trans_json_2_any( - EXPORTING - val = iv_json - CHANGING - data = result->mr_actual ). - - ENDMETHOD. - - - METHOD get_attribute. - - IF z2ui5_cl_fw_controller=>cv_check_ajson = abap_true. - ASSERT 1 = 0. - ENDIF. - - FIELD-SYMBOLS TYPE any. - - z2ui5_cl_util_func=>x_check_raise( xsdbool( mr_actual IS INITIAL ) ). - - result = new( io_root = mo_root - iv_name = name ). - - DATA(lv_name) = 'MR_ACTUAL->' && replace( val = name - sub = `-` - with = `_` - occ = 0 ). - - - ASSIGN (lv_name) TO . - z2ui5_cl_util_func=>x_check_raise( xsdbool( sy-subrc <> 0 ) ). - - result->mr_actual = . - result->mo_parent = me. - INSERT result INTO TABLE mt_values. - - ENDMETHOD. - - - METHOD get_val. - - FIELD-SYMBOLS TYPE any. - ASSIGN mr_actual->* TO . - z2ui5_cl_util_func=>x_check_raise( when = xsdbool( sy-subrc <> 0 ) - v = `value of attribute in JSON not found` ). - result = . - - ENDMETHOD. - - - METHOD get_val_ref. - - result = mr_actual. - - ENDMETHOD. - - - METHOD new. - - result = NEW #( ). - result->mo_root = io_root. - result->mv_name = CONV string( iv_name ). - - ENDMETHOD. - - - METHOD stringify. - - LOOP AT mt_values INTO DATA(lo_attri). - - IF sy-tabix > 1. - result = result && `,`. - ENDIF. - - result = |{ result }"{ lo_attri->mv_name }":|. - - IF lo_attri->mt_values IS NOT INITIAL. - result = result && lo_attri->stringify( ). - ELSEIF lo_attri->mv_apost_active = abap_true OR lo_attri->mv_value IS INITIAL. - result = result && `"` && lo_attri->mv_value && `"`. - ELSE. - result = result && lo_attri->mv_value. - ENDIF. - - ENDLOOP. - - result = `{` && result && `}`. - - ENDMETHOD. -ENDCLASS. diff --git a/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap b/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap deleted file mode 100644 index 868b5474..00000000 --- a/src/01/01/z2ui5_cl_util_tree_json.clas.testclasses.abap +++ /dev/null @@ -1,85 +0,0 @@ -*CLASS ltcl_unit_01_json DEFINITION FINAL FOR TESTING -* DURATION LONG -* RISK LEVEL HARMLESS. -* -* PRIVATE SECTION. -* METHODS test_json_attri FOR TESTING RAISING cx_static_check. -* METHODS test_json_object FOR TESTING RAISING cx_static_check. -* METHODS test_json_struc FOR TESTING RAISING cx_static_check. -* METHODS test_create_json FOR TESTING RAISING cx_static_check. -* -*ENDCLASS. -* -*CLASS ltcl_unit_01_json IMPLEMENTATION. -* -* METHOD test_json_attri. -* -* DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). -* lo_tree->add_attribute( n = `AAA` -* v = `BBB` ). -* -* DATA(lv_result) = lo_tree->stringify( ). -* IF `{"AAA":"BBB"}` <> lv_result. -* cl_abap_unit_assert=>fail( 'json tree - wrong stringify attributes' ). -* ENDIF. -* -* ENDMETHOD. -* -* METHOD test_json_object. -* -* DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). -* lo_tree->add_attribute_object( `CCC` )->add_attribute( n = `AAA` -* v = `BBB` ). -* -* DATA(lv_result) = lo_tree->stringify( ). -* IF `{"CCC":{"AAA":"BBB"}}` <> lv_result. -* cl_abap_unit_assert=>fail( 'json tree - wrong stringify object attributes' ). -* ENDIF. -* -* ENDMETHOD. -* -* METHOD test_json_struc. -* -* DATA(lo_tree) = NEW z2ui5_cl_util_tree_json( ). -* -* TYPES: -* BEGIN OF ty_s_test, -* comp1 TYPE string, -* comp2 TYPE string, -* END OF ty_s_test. -* -* DATA(ls_test) = VALUE ty_s_test( comp1 = `AAA` comp2 = `BBB` ). -* lo_tree->add_attribute_object( `CCC` )->add_attribute_struc( ls_test ). -* -* DATA(lv_result) = lo_tree->stringify( ). -* IF `{"CCC":{"COMP1":"AAA","COMP2":"BBB"}}` <> lv_result. -* cl_abap_unit_assert=>fail( 'json tree - wrong stringify structure' ). -* ENDIF. -* -* ENDMETHOD. -* -* METHOD test_create_json. -* -* -* -* DATA(lo_json) = z2ui5_cl_util_tree_json=>factory( `{"CCC":{"COMP1":"AAA","COMP2":"BBB"}}` ). -* -* DATA(lo_attri) = lo_json->get_attribute( `CCC` )->get_attribute( `COMP2` ). -* -* -* FIELD-SYMBOLS TYPE any. -* DATA(lr_ref) = lo_attri->get_val_ref( ). -* -* ASSIGN lr_ref->* TO . -* IF <> `BBB`. -* cl_abap_unit_assert=>fail( quit = 5 ). -* ENDIF. -* -* DATA(lv_val) = lo_attri->get_val( ). -* IF lv_val <> `BBB`. -* cl_abap_unit_assert=>fail( quit = 5 ). -* ENDIF. -* -* ENDMETHOD. -* -*ENDCLASS. diff --git a/src/01/01/z2ui5_cl_util_tree_json.clas.xml b/src/01/01/z2ui5_cl_util_tree_json.clas.xml deleted file mode 100644 index 8dc5325f..00000000 --- a/src/01/01/z2ui5_cl_util_tree_json.clas.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Z2UI5_CL_UTIL_TREE_JSON - E - abap2UI5 - utility json - 1 - X - X - X - X - - - - diff --git a/src/01/01/z2ui5_cl_util_ui2_json.clas.abap b/src/01/01/z2ui5_cl_util_ui2_json.clas.abap deleted file mode 100644 index 73765374..00000000 --- a/src/01/01/z2ui5_cl_util_ui2_json.clas.abap +++ /dev/null @@ -1,29 +0,0 @@ -CLASS z2ui5_cl_util_ui2_json DEFINITION - PUBLIC - FINAL - CREATE PUBLIC INHERITING FROM /ui2/cl_json. - - PUBLIC SECTION. - PROTECTED SECTION. - METHODS is_compressable REDEFINITION. - - PRIVATE SECTION. -ENDCLASS. - - - -CLASS z2ui5_cl_util_ui2_json IMPLEMENTATION. - - METHOD is_compressable. - - rv_compress = super->is_compressable( - type_descr = type_descr - name = name ). - - IF z2ui5_cl_util_func=>boolean_check_by_name( type_descr->get_relative_name( ) ). - rv_compress = abap_false. - ENDIF. - - ENDMETHOD. - -ENDCLASS. diff --git a/src/01/01/z2ui5_cl_util_ui2_json.clas.xml b/src/01/01/z2ui5_cl_util_ui2_json.clas.xml deleted file mode 100644 index fddf6117..00000000 --- a/src/01/01/z2ui5_cl_util_ui2_json.clas.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - Z2UI5_CL_UTIL_UI2_JSON - E - abap2UI5 - /ui2/cl_json compress extension - 1 - X - X - X - - - - diff --git a/src/01/01/z2ui5_cx_util_error.clas.abap b/src/01/01/z2ui5_cx_util_error.clas.abap index 397630fb..c6e359cb 100644 --- a/src/01/01/z2ui5_cx_util_error.clas.abap +++ b/src/01/01/z2ui5_cx_util_error.clas.abap @@ -1,33 +1,33 @@ -class Z2UI5_CX_UTIL_ERROR definition - public - inheriting from CX_NO_CHECK - final - create public . +CLASS z2ui5_cx_util_error DEFINITION + PUBLIC + INHERITING FROM cx_no_check + FINAL + CREATE PUBLIC . -public section. + PUBLIC SECTION. - data: - BEGIN OF ms_error, + DATA: + BEGIN OF ms_error, x_root TYPE REF TO cx_root, uuid TYPE string, text TYPE string, END OF ms_error . - methods CONSTRUCTOR - importing - !VAL type ANY optional - !PREVIOUS type ref to CX_ROOT optional - preferred parameter VAL . + METHODS constructor + IMPORTING + !val TYPE any OPTIONAL + !previous TYPE REF TO cx_root OPTIONAL + PREFERRED PARAMETER val . - methods IF_MESSAGE~GET_TEXT - redefinition . + METHODS if_message~get_text + REDEFINITION . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. -CLASS Z2UI5_CX_UTIL_ERROR IMPLEMENTATION. +CLASS z2ui5_cx_util_error IMPLEMENTATION. METHOD constructor ##ADT_SUPPRESS_GENERATION. @@ -45,7 +45,7 @@ CLASS Z2UI5_CX_UTIL_ERROR IMPLEMENTATION. ENDMETHOD. - METHOD IF_MESSAGE~get_text. + METHOD if_message~get_text. IF ms_error-x_root IS NOT INITIAL. result = ms_error-x_root->get_text( ). @@ -55,7 +55,7 @@ CLASS Z2UI5_CX_UTIL_ERROR IMPLEMENTATION. error = abap_true. ENDIF. - result = COND #( WHEN error = abap_true AND result IS INITIAL THEN `unknown error` else result ). + result = COND #( WHEN error = abap_true AND result IS INITIAL THEN `unknown error` ELSE result ). ENDMETHOD. ENDCLASS. diff --git a/src/01/02/z2ui5_cl_fw_binding.clas.abap b/src/01/02/z2ui5_cl_fw_binding.clas.abap index d08445ec..645a33e6 100644 --- a/src/01/02/z2ui5_cl_fw_binding.clas.abap +++ b/src/01/02/z2ui5_cl_fw_binding.clas.abap @@ -33,7 +33,7 @@ CLASS z2ui5_cl_fw_binding DEFINITION depth TYPE i, ajson_local TYPE REF TO z2ui5_if_ajson, custom_filter TYPE REF TO z2ui5_if_ajson_filter, - custom_mapper TYPE REF TO z2ui5_if_ajson_mapping, + custom_mapper TYPE REF TO z2ui5_if_ajson_mapping, END OF ty_s_attri. TYPES ty_t_attri TYPE SORTED TABLE OF ty_s_attri WITH UNIQUE KEY name. @@ -45,9 +45,6 @@ CLASS z2ui5_cl_fw_binding DEFINITION data TYPE data OPTIONAL check_attri TYPE data OPTIONAL view TYPE clike OPTIONAL - pretty_name TYPE clike OPTIONAL - compress TYPE clike OPTIONAL -* compress_custom TYPE clike OPTIONAL custom_filter TYPE REF TO z2ui5_if_ajson_filter OPTIONAL custom_mapper TYPE REF TO z2ui5_if_ajson_mapping OPTIONAL RETURNING @@ -132,12 +129,6 @@ CLASS z2ui5_cl_fw_binding DEFINITION RETURNING VALUE(result) TYPE REF TO ty_s_attri. - METHODS name_front_create - IMPORTING - val TYPE clike - RETURNING - VALUE(result) TYPE string. - PRIVATE SECTION. ENDCLASS. @@ -186,23 +177,10 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION. bind->viewname = mv_view. bind->custom_filter = mo_custom_filter. bind->custom_mapper = mo_custom_mapper. -* bind->compress_custom = mv_compress_custom. - IF z2ui5_cl_fw_controller=>cv_check_ajson = abap_false. - - bind->name_front = name_front_create( bind->name ). - result = COND #( WHEN mv_type = cs_bind_type-two_way THEN `/` && cv_model_edit_name && `/` ELSE `/` ) && bind->name_front. - IF strlen( result ) > 30. - bind->name_front = z2ui5_cl_util_func=>uuid_get_c22( ). - result = COND #( WHEN mv_type = cs_bind_type-two_way THEN `/` && cv_model_edit_name && `/` ELSE `/` ) && bind->name_front. - ENDIF. - - ELSE. - - bind->name_front = replace( val = bind->name sub = `-` with = `/` ). - bind->name_front = replace( val = bind->name_front sub = `>` with = `` ). - result = `/` && COND #( WHEN mv_type = cs_bind_type-two_way THEN cv_model_edit_name && `/` ) && bind->name_front. - ENDIF. + bind->name_front = replace( val = bind->name sub = `-` with = `/` ). + bind->name_front = replace( val = bind->name_front sub = `>` with = `` ). + result = `/` && COND #( WHEN mv_type = cs_bind_type-two_way THEN cv_model_edit_name && `/` ) && bind->name_front. ENDMETHOD. @@ -214,40 +192,27 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION. ASSIGN mr_data->* TO . DATA(lv_id) = to_upper( z2ui5_cl_util_func=>uuid_get_c22( ) ). - IF z2ui5_cl_fw_controller=>cv_check_ajson = abap_false. - - INSERT VALUE #( name = lv_id - data_stringify = z2ui5_cl_util_func=>trans_json_by_any( any = mr_data - compress_mode = me->mv_compress ) - bind_type = cs_bind_type-one_time ) - INTO TABLE mt_attri. - + IF mo_custom_mapper IS BOUND. + DATA(ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = mo_custom_mapper ) ). ELSE. - - "(1) set pretty mode - CASE mv_pretty_name. - - WHEN z2ui5_if_client=>cs_pretty_mode-none. - DATA(ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ). - - WHEN z2ui5_if_client=>cs_pretty_mode-camel_case. - ajson = z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_camel_case( iv_first_json_upper = abap_false ) ). - - WHEN OTHERS. - ASSERT `` = `ERROR_UNKNOWN_PRETTY_MODE`. - ENDCASE. - - INSERT VALUE #( name_front = lv_id - name = lv_id - ajson_local = ajson->set( iv_path = `/` iv_val = ) - bind_type = cs_bind_type-one_time - pretty_name = mv_pretty_name - compress = mv_compress - ) - INTO TABLE mt_attri. - + ajson = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ). ENDIF. + IF mo_custom_filter IS BOUND. + ajson = ajson->filter( mo_custom_filter ). + ELSE. + ajson = ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ). + ENDIF. + + INSERT VALUE #( name_front = lv_id + name = lv_id + ajson_local = ajson->set( iv_path = `/` iv_val = ) + bind_type = cs_bind_type-one_time + pretty_name = mv_pretty_name + compress = mv_compress + ) + INTO TABLE mt_attri. + result = |/{ lv_id }|. CATCH cx_root INTO DATA(x). @@ -327,8 +292,6 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION. r_result->mv_type = type. r_result->mv_check_attri = check_attri. r_result->mv_view = view. - r_result->mv_pretty_name = pretty_name. - r_result->mv_compress = compress. r_result->mo_custom_filter = custom_filter. r_result->mo_custom_mapper = custom_mapper. @@ -502,29 +465,6 @@ CLASS z2ui5_cl_fw_binding IMPLEMENTATION. ENDMETHOD. - - METHOD name_front_create. - - result = replace( val = val - sub = `*` - with = `_` - occ = 0 ). - result = replace( val = result - sub = `>` - with = `_` - occ = 0 ). - result = replace( val = result - sub = `-` - with = `_` - occ = 0 ). - - IF mv_pretty_name = abap_true. - REPLACE ALL OCCURRENCES OF `_` IN result WITH ``. - ENDIF. - - ENDMETHOD. - - METHOD search_binding. set_attri_ready( REF #( mt_attri ) ). diff --git a/src/01/02/z2ui5_cl_fw_client.clas.abap b/src/01/02/z2ui5_cl_fw_client.clas.abap index 449ca6fd..63d3864f 100644 --- a/src/01/02/z2ui5_cl_fw_client.clas.abap +++ b/src/01/02/z2ui5_cl_fw_client.clas.abap @@ -316,8 +316,7 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION. IF struc IS NOT INITIAL. DATA(lv_name_struc) = z2ui5_if_client~_bind_edit( val = struc - path = abap_true - pretty_mode = pretty_mode ). + path = abap_true ). result = bind_struc_comp( iv_name = lv_name_struc i_struc = struc @@ -333,9 +332,6 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION. check_attri = mo_handler->ms_db-check_attri type = z2ui5_cl_fw_binding=>cs_bind_type-one_way data = val - pretty_name = pretty_mode - compress = compress_mode -* compress_custom = compress_custom custom_mapper = custom_mapper custom_filter = custom_filter ). @@ -377,8 +373,7 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION. IF tab IS NOT INITIAL. DATA(lv_name) = z2ui5_if_client~_bind_edit( val = tab - path = abap_true - pretty_mode = pretty_mode ). + path = abap_true ). result = bind_tab_cell( iv_name = lv_name i_tab_index = tab_index @@ -392,8 +387,7 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION. IF struc IS NOT INITIAL. DATA(lv_name_struc) = z2ui5_if_client~_bind_edit( val = struc - path = abap_true - pretty_mode = pretty_mode ). + path = abap_true ). result = bind_struc_comp( iv_name = lv_name_struc i_struc = struc @@ -410,9 +404,6 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION. type = z2ui5_cl_fw_binding=>cs_bind_type-two_way data = val view = view - pretty_name = pretty_mode - compress = compress_mode -* compress_custom = compress_custom custom_mapper = custom_mapper custom_filter = custom_filter ). @@ -436,10 +427,7 @@ CLASS z2ui5_cl_fw_client IMPLEMENTATION. check_attri = mo_handler->ms_db-check_attri type = z2ui5_cl_fw_binding=>cs_bind_type-one_time data = val - pretty_name = pretty_mode - compress = compress_mode -* compress_custom = compress_custom - custom_mapper = custom_mapper + custom_mapper = custom_mapper custom_filter = custom_filter ). diff --git a/src/01/02/z2ui5_cl_fw_controller.clas.abap b/src/01/02/z2ui5_cl_fw_controller.clas.abap index 61a3d883..6f7a5151 100644 --- a/src/01/02/z2ui5_cl_fw_controller.clas.abap +++ b/src/01/02/z2ui5_cl_fw_controller.clas.abap @@ -4,7 +4,6 @@ CLASS z2ui5_cl_fw_controller DEFINITION CREATE PUBLIC. PUBLIC SECTION. - CLASS-DATA cv_check_ajson TYPE abap_bool VALUE abap_true. TYPES: BEGIN OF ty_s_next2, @@ -59,7 +58,6 @@ CLASS z2ui5_cl_fw_controller DEFINITION END OF ty_s_next. CLASS-DATA ss_config TYPE z2ui5_if_client=>ty_s_config. - CLASS-DATA so_body TYPE REF TO z2ui5_cl_util_tree_json. CLASS-DATA so_body_ajson TYPE REF TO z2ui5_if_ajson. DATA ms_db TYPE z2ui5_cl_fw_db=>ty_s_db. @@ -86,10 +84,6 @@ CLASS z2ui5_cl_fw_controller DEFINITION CLASS-METHODS body_read_location. - CLASS-METHODS _get_id - RETURNING - VALUE(result) TYPE string. - CLASS-METHODS app_system_factory IMPORTING VALUE(ix) TYPE REF TO cx_root OPTIONAL @@ -129,18 +123,6 @@ CLASS z2ui5_cl_fw_controller DEFINITION RETURNING VALUE(result) TYPE REF TO z2ui5_cl_fw_controller. - METHODS app_client_end_model - RETURNING - VALUE(rv_viewmodel) TYPE string. - - METHODS app_client_end_response - IMPORTING - iv_viewmodel TYPE string - RETURNING - VALUE(r_result) TYPE string. - - METHODS app_client_end_db. - PRIVATE SECTION. ENDCLASS. @@ -168,50 +150,13 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION. METHOD app_client_begin_event. TRY. - IF cv_check_ajson = abap_false. - - FIELD-SYMBOLS TYPE any. - FIELD-SYMBOLS TYPE STANDARD TABLE. - FIELD-SYMBOLS TYPE any. - FIELD-SYMBOLS TYPE any. - - ASSIGN (`SO_BODY->MR_ACTUAL`) TO . - z2ui5_cl_util_func=>x_check_raise( xsdbool( sy-subrc <> 0 ) ). - ASSIGN (`->ARGUMENTS`) TO . - z2ui5_cl_util_func=>x_check_raise( xsdbool( sy-subrc <> 0 ) ). - ASSIGN (`->*`) TO . - z2ui5_cl_util_func=>x_check_raise( xsdbool( sy-subrc <> 0 ) ). - - ASSIGN TO . - z2ui5_cl_util_func=>x_check_raise( xsdbool( sy-subrc <> 0 ) ). - - LOOP AT ASSIGNING . - - IF sy-tabix = 1. - - ASSIGN (`->EVENT->*`) TO . - ms_actual-event = . - ELSE. - ASSIGN ->* TO . - IF sy-subrc <> 0. - CONTINUE. - ENDIF. - INSERT CONV string( ) INTO TABLE ms_actual-t_event_arg. - ENDIF. - - ENDLOOP. - - ELSE. - - DATA(ajson) = so_body_ajson->slice( `/ARGUMENTS` ). - ms_actual-event = ajson->get( `/1/EVENT` ). - ajson->delete( `/1` ). - ajson->to_abap( - IMPORTING - ev_container = ms_actual-t_event_arg - ). - - ENDIF. + DATA(ajson) = so_body_ajson->slice( `/ARGUMENTS` ). + ms_actual-event = ajson->get( `/1/EVENT` ). + ajson->delete( `/1` ). + ajson->to_abap( + IMPORTING + ev_container = ms_actual-t_event_arg + ). CATCH cx_root INTO DATA(x). ASSERT x IS NOT BOUND. @@ -220,91 +165,31 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION. METHOD app_client_begin_factory. - - result = NEW #( ). - result->ms_db = z2ui5_cl_fw_db=>load_app( id_prev ). - result->ms_db-id = z2ui5_cl_util_func=>uuid_get_c32( ). - result->ms_db-id_prev = id_prev. - TRY. - IF cv_check_ajson = abap_false. - result->ms_actual-viewname = so_body->get_attribute( `VIEWNAME` )->get_val( ). - ELSE. - result->ms_actual-viewname = so_body_ajson->get( iv_path = `/VIEWNAME` ). - ENDIF. - CATCH cx_root. - ENDTRY. + result = NEW #( ). + result->ms_db = z2ui5_cl_fw_db=>load_app( id_prev ). + result->ms_db-id = z2ui5_cl_util_func=>uuid_get_c32( ). + result->ms_db-id_prev = id_prev. + + + + result->ms_actual-viewname = so_body_ajson->get( iv_path = `/VIEWNAME` ). + + CATCH cx_root INTO DATA(x). + ASSERT x IS NOT BOUND. + ENDTRY. ENDMETHOD. METHOD app_client_begin_model. - IF cv_check_ajson = abap_false. - - TRY. - DATA(lo_model) = z2ui5_cl_fw_model=>factory( - viewname = ms_actual-viewname - app = ms_db-app - attri = ms_db-t_attri ). - - lo_model->main_set_backend( - so_body->get_attribute( z2ui5_cl_fw_binding=>cv_model_edit_name )->mr_actual ). - - CATCH cx_root. - ENDTRY. - - ELSE. - - z2ui5_cl_fw_model_ajson=>front_to_back( - viewname = ms_actual-viewname - app = ms_db-app - t_attri = ms_db-t_attri - ajson_in = so_body_ajson - ). - - ENDIF. - - ENDMETHOD. - - - METHOD app_client_end_db. - - z2ui5_cl_fw_db=>create( id = ms_db-id - db = ms_db ). - - ENDMETHOD. - - - METHOD app_client_end_model. - - DATA(lo_binder) = z2ui5_cl_fw_model=>factory( - viewname = ms_actual-viewname - app = ms_db-app - attri = ms_db-t_attri ). - - rv_viewmodel = lo_binder->main_set_frontend( ). - - - ENDMETHOD. - - - METHOD app_client_end_response. - - DATA(lo_resp) = z2ui5_cl_util_tree_json=>factory( ). - - lo_resp->add_attribute( n = `OVIEWMODEL` - v = iv_viewmodel - apos_active = abap_false ). - - lo_resp->add_attribute( n = `PARAMS` - v = z2ui5_cl_util_func=>trans_json_by_any( ms_next-s_set ) - apos_active = abap_false ). - - lo_resp->add_attribute( n = `ID` - v = ms_db-id ). - - r_result = lo_resp->mo_root->stringify( ). + z2ui5_cl_fw_model_ajson=>front_to_back( + viewname = ms_actual-viewname + app = ms_db-app + t_attri = ms_db-t_attri + ajson_in = so_body_ajson + ). ENDMETHOD. @@ -354,32 +239,18 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION. METHOD app_start_factory. - IF cv_check_ajson = abap_false. - TRY. - DATA(lv_classname) = to_upper( so_body->get_attribute( `APP_START` )->get_val( ) ). - lv_classname = z2ui5_cl_util_func=>c_trim( lv_classname ). - CATCH cx_root. - ENDTRY. - - IF lv_classname IS INITIAL. - lv_classname = z2ui5_cl_util_func=>url_param_get( val = `app_start` - url = ss_config-search ). - ENDIF. - - ELSE. - - TRY. - lv_classname = to_upper( so_body_ajson->get( `/APP_START` ) ). - lv_classname = z2ui5_cl_util_func=>c_trim( lv_classname ). - CATCH cx_root. - ENDTRY. - - IF lv_classname IS INITIAL. - lv_classname = z2ui5_cl_util_func=>url_param_get( val = `app_start` - url = ss_config-search ). - ENDIF. + TRY. + DATA(lv_classname) = to_upper( so_body_ajson->get( `/APP_START` ) ). + lv_classname = z2ui5_cl_util_func=>c_trim( lv_classname ). + CATCH cx_root. + ENDTRY. + IF lv_classname IS INITIAL. + lv_classname = z2ui5_cl_util_func=>url_param_get( val = `app_start` + url = ss_config-search ). ENDIF. + + IF lv_classname IS INITIAL. result = app_system_factory( ). RETURN. @@ -422,74 +293,16 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION. METHOD body_read_location. + TRY. - IF cv_check_ajson = abap_false. + so_body_ajson->slice( `/OLOCATION` )->to_abap( + IMPORTING + ev_container = ss_config + ). - FIELD-SYMBOLS TYPE any. - FIELD-SYMBOLS TYPE REF TO data. - FIELD-SYMBOLS TYPE table. - FIELD-SYMBOLS TYPE data. - - TRY. - DATA(location) = so_body->get_attribute( `OLOCATION` ). - CATCH cx_root. - ENDTRY. - - TRY. - ss_config-search = location->get_attribute( `SEARCH` )->get_val( ). - CATCH cx_root. - ENDTRY. - - TRY. - ss_config-origin = location->get_attribute( `ORIGIN` )->get_val( ). - CATCH cx_root. - ENDTRY. - - TRY. - ss_config-pathname = location->get_attribute( `PATHNAME` )->get_val( ). - CATCH cx_root. - ENDTRY. - - TRY. - ss_config-version = location->get_attribute( `VERSION` )->get_val( ). - CATCH cx_root. - ENDTRY. - - TRY. - ss_config-check_launchpad_active = location->get_attribute( `CHECK_LAUNCHPAD_ACTIVE` )->get_val( ). - CATCH cx_root. - ENDTRY. - - TRY. - - DATA(ls_params) = location->get_attribute( `STARTUP_PARAMETERS` )->get_val_ref( ). - ASSIGN ls_params->* TO . - - DATA(lt_comp) = z2ui5_cl_util_func=>rtti_get_t_comp_by_data( ). - - LOOP AT lt_comp INTO DATA(ls_comp). - - ASSIGN COMPONENT ls_comp-name OF STRUCTURE TO . - ASSIGN ->* TO . - ASSIGN [ 1 ] TO . - ASSIGN ->* TO . - - INSERT VALUE #( n = ls_comp-name v = ) INTO TABLE ss_config-t_startup_params. - - ENDLOOP. - CATCH cx_root. - ENDTRY. - - ELSE. - TRY. - so_body_ajson->slice( `/OLOCATION` )->to_abap( - IMPORTING - ev_container = ss_config - ). - CATCH cx_root INTO DATA(x). - ASSERT x IS NOT BOUND. - ENDTRY. - ENDIF. + CATCH cx_root INTO DATA(x). + ASSERT x IS NOT BOUND. + ENDTRY. ENDMETHOD. @@ -534,21 +347,10 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION. METHOD request_begin. TRY. -* ss_config-body = body. - IF cv_check_ajson = abap_false. - so_body = z2ui5_cl_util_tree_json=>factory( body ). - ELSE. - so_body_ajson = z2ui5_cl_ajson=>parse( body ). - ENDIF. - -* ss_config-view_model_edit_name = z2ui5_cl_fw_binding=>cv_model_edit_name. + so_body_ajson = z2ui5_cl_ajson=>parse( body ). body_read_location( ). - IF cv_check_ajson = abap_false. - DATA(lv_id_prev) = _get_id( ). - ELSE. - lv_id_prev = so_body_ajson->get( `/ID` ). - ENDIF. + DATA(lv_id_prev) = so_body_ajson->get( `/ID` ). IF lv_id_prev IS INITIAL. result = app_start_factory( ). result->ms_actual-check_on_navigated = abap_true. @@ -572,47 +374,28 @@ CLASS z2ui5_cl_fw_controller IMPLEMENTATION. METHOD request_end. - - IF cv_check_ajson = abap_false. - - DATA(lv_viewmodel) = app_client_end_model( ). - result = app_client_end_response( lv_viewmodel ). - app_client_end_db( ). - - ELSE. - TRY. - - "todo performance - write all data directly into the target ajson - DATA(ajson_result) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( - ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ). - - ajson_result->set( iv_path = `/PARAMS` iv_val = ms_next-s_set ). - ajson_result->set( iv_path = `/ID` iv_val = ms_db-id ). - ajson_result = ajson_result->filter( NEW z2ui5_cl_fw_model_ajson( ) ). - - DATA(lo_ajson) = z2ui5_cl_fw_model_ajson=>back_to_front( - app = ms_db-app - t_attri = ms_db-t_attri ). - - ajson_result->set( iv_path = `/OVIEWMODEL` iv_val = lo_ajson ). - result = ajson_result->stringify( ). - - z2ui5_cl_fw_db=>create( id = ms_db-id db = ms_db ). - - CATCH cx_root INTO DATA(x). - ASSERT x IS NOT BOUND. - ENDTRY. - ENDIF. - - ENDMETHOD. - - - METHOD _get_id. TRY. - result = so_body->get_attribute( `ID` )->get_val( ). + "todo performance - write all data directly into the target ajson + DATA(ajson_result) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( + ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ). - CATCH cx_root. + ajson_result->set( iv_path = `/PARAMS` iv_val = ms_next-s_set ). + ajson_result->set( iv_path = `/ID` iv_val = ms_db-id ). + ajson_result = ajson_result->filter( NEW z2ui5_cl_fw_model_ajson( ) ). + + DATA(lo_ajson) = z2ui5_cl_fw_model_ajson=>back_to_front( + app = ms_db-app + t_attri = ms_db-t_attri ). + + ajson_result->set( iv_path = `/OVIEWMODEL` iv_val = lo_ajson ). + result = ajson_result->stringify( ). + + z2ui5_cl_fw_db=>create( id = ms_db-id db = ms_db ). + + CATCH cx_root INTO DATA(x). + ASSERT x IS NOT BOUND. ENDTRY. ENDMETHOD. + ENDCLASS. diff --git a/src/01/02/z2ui5_cl_fw_model.clas.abap b/src/01/02/z2ui5_cl_fw_model.clas.abap deleted file mode 100644 index 99af52c9..00000000 --- a/src/01/02/z2ui5_cl_fw_model.clas.abap +++ /dev/null @@ -1,177 +0,0 @@ -CLASS z2ui5_cl_fw_model DEFINITION - PUBLIC - FINAL - CREATE PUBLIC . - - PUBLIC SECTION. - - CLASS-METHODS factory - IMPORTING - app TYPE REF TO object - attri TYPE z2ui5_cl_fw_binding=>ty_t_attri - viewname TYPE string - RETURNING - VALUE(r_result) TYPE REF TO z2ui5_cl_fw_model. - - METHODS main_set_backend - IMPORTING - model TYPE REF TO data ##NEEDED. - - METHODS main_set_frontend - RETURNING - VALUE(result) TYPE string. - - DATA mo_app TYPE REF TO object. - DATA mt_attri TYPE z2ui5_cl_fw_binding=>ty_t_attri. - DATA mv_viewname TYPE string. - - PROTECTED SECTION. - PRIVATE SECTION. -ENDCLASS. - - - -CLASS z2ui5_cl_fw_model IMPLEMENTATION. - - - METHOD factory. - - r_result = NEW #( ). - r_result->mo_app = app. - r_result->mt_attri = attri. - r_result->mv_viewname = viewname. - - ENDMETHOD. - - - - METHOD main_set_backend. - - FIELD-SYMBOLS TYPE any. - FIELD-SYMBOLS TYPE any. - - LOOP AT mt_attri REFERENCE INTO DATA(lr_attri) - WHERE bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way AND - viewname = mv_viewname. - TRY. - DATA(lv_name_back) = `MO_APP->` && lr_attri->name. - - - UNASSIGN . - ASSIGN (lv_name_back) TO . - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE z2ui5_cx_util_error - EXPORTING - val = `NO_BACKEND_VALUE_FOUND_WITH_NAME__` && lv_name_back. - ENDIF. - - DATA(lv_name_front) = `MODEL->` && lr_attri->name_front. - - UNASSIGN . - ASSIGN (lv_name_front) TO . - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE z2ui5_cx_util_error - EXPORTING - val = `NO_FRONTEND_VALUE_FOUND_WITH_NAME__` && lv_name_front. - ENDIF. - - CASE lr_attri->type_kind. - - WHEN cl_abap_typedescr=>typekind_table. - z2ui5_cl_util_func=>trans_ref_tab_2_tab( - EXPORTING - ir_tab_from = - pretty_name = lr_attri->pretty_name - IMPORTING - t_result = ). - - WHEN cl_abap_typedescr=>typekind_struct1 OR cl_abap_typedescr=>typekind_struct2. - z2ui5_cl_util_func=>trans_ref_struc_2_struc( - EXPORTING - ir_struc_from = - pretty_name = lr_attri->pretty_name - IMPORTING - r_result = ). - - WHEN OTHERS. - - ASSIGN ->* TO . - CASE lr_attri->type_kind. - WHEN cl_abap_typedescr=>typekind_date OR cl_abap_typedescr=>typekind_time. - z2ui5_cl_util_func=>trans_json_2_any( - EXPORTING - val = `"` && && `"` - CHANGING - data = ). - - WHEN OTHERS. - = . - ENDCASE. - - ENDCASE. - - CATCH cx_root. - ENDTRY. - ENDLOOP. - - ENDMETHOD. - - - METHOD main_set_frontend. - - DATA(lr_view_model) = z2ui5_cl_util_tree_json=>factory( ). - DATA(lo_update) = lr_view_model->add_attribute_object( z2ui5_cl_fw_binding=>cv_model_edit_name ). - FIELD-SYMBOLS TYPE any. - - LOOP AT mt_attri REFERENCE INTO DATA(lr_attri) WHERE bind_type <> ``. - - IF lr_attri->bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_time. - lr_view_model->add_attribute( n = lr_attri->name - v = lr_attri->data_stringify - apos_active = abap_false ). - CONTINUE. - ENDIF. - - DATA(lo_actual) = COND #( WHEN lr_attri->bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way THEN lr_view_model - ELSE lo_update ). - - DATA(lv_name_back) = `MO_APP->` && lr_attri->name. - - ASSIGN (lv_name_back) TO . - IF sy-subrc <> 0. - RAISE EXCEPTION TYPE z2ui5_cx_util_error - EXPORTING - val = `Error while creating the response, seems that some app data is not available anymore.

BINDING_ERROR - No attribute found with name: ` && lr_attri->name && `

`. - ENDIF. - - CASE lr_attri->type_kind. - - WHEN `h`. - lo_actual->add_attribute( n = lr_attri->name_front - v = z2ui5_cl_util_func=>trans_json_by_any( any = pretty_mode = lr_attri->pretty_name compress_mode = lr_attri->compress ) - apos_active = abap_false ). - - WHEN OTHERS. - - IF z2ui5_cl_util_func=>boolean_check_by_name( lr_attri->type ). - - lo_actual->add_attribute( n = lr_attri->name_front - v = SWITCH #( WHEN abap_true THEN `true` ELSE `false` ) - apos_active = abap_false ). - - ELSE. - - lo_actual->add_attribute( n = lr_attri->name_front - v = z2ui5_cl_util_func=>trans_json_by_any( any = pretty_mode = lr_attri->pretty_name compress_mode = lr_attri->compress ) - apos_active = abap_false ). - - ENDIF. - - ENDCASE. - - ENDLOOP. - - result = lr_view_model->stringify( ). - - ENDMETHOD. -ENDCLASS. diff --git a/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap b/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap deleted file mode 100644 index 3d371a80..00000000 --- a/src/01/02/z2ui5_cl_fw_model.clas.testclasses.abap +++ /dev/null @@ -1,69 +0,0 @@ -*CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING -* DURATION LONG -* RISK LEVEL DANGEROUS. -* -* PUBLIC SECTION. -* DATA quantity TYPE string. -* -* PRIVATE SECTION. -* METHODS test_model_set_frontend FOR TESTING RAISING cx_static_check. -* METHODS test_model_set_backend FOR TESTING RAISING cx_static_check. -* -*ENDCLASS. -* -* -*CLASS ltcl_unit_test IMPLEMENTATION. -* -* METHOD test_model_set_frontend. -* -* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ( name = `QUANTITY` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way name_front = `QUANTITY` ) ). -* DATA(lo_app) = NEW ltcl_unit_test( ). -* -* lo_app->quantity = `600`. -* -* DATA(lo_model) = z2ui5_cl_fw_model=>factory( -* viewname = `` -* app = lo_app -* attri = lt_attri ). -* -* DATA(lv_frontend) = lo_model->main_set_frontend( ). -* -* cl_abap_unit_assert=>assert_equals( -* act = lv_frontend -* exp = `{"EDIT":{"QUANTITY":"600"}}` ). -* -* ENDMETHOD. -* -* METHOD test_model_set_backend. -* -* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ( name = `QUANTITY` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-two_way name_front = `QUANTITY` ) ). -* DATA(lo_app) = NEW ltcl_unit_test( ). -* -* DATA(lv_model) = `{"EDIT":{"QUANTITY":"600"},"oScroll":[],"OMESSAGEMANAGER":[],"ID":"0242B09497911EDE90A60CD0D8519DD5","ARGUMENTS":[{"EVENT":"BUTTON_POST","METHOD":"UPDATE","CHECK_VIEW_DESTROY":false}],"OCURSOR":{"id":"__button1"},"OLOCATION":{` -* && `"SEARCH":"?sap-client=001&app_start=z2ui5_cl_app_hello_world","VERSION":"com.sap.ui5.dist:sapui5-sdk-dist:1.116.0:war"}}`. -* -* DATA lr_model TYPE REF TO data. -* FIELD-SYMBOLS TYPE any. -* /ui2/cl_json=>deserialize( -* EXPORTING -* json = lv_model -* CHANGING -* data = lr_model ). -* -* DATA(lo_model) = z2ui5_cl_fw_model=>factory( -* viewname = `` -* app = lo_app -* attri = lt_attri ). -* -* DATA(lv_assign) = `LR_MODEL->` && z2ui5_cl_fw_binding=>cv_model_edit_name. -* -* ASSIGN (lv_assign) TO . -* lo_model->main_set_backend( ). -* -* cl_abap_unit_assert=>assert_equals( -* act = lo_app->quantity -* exp = `600` ). -* -* ENDMETHOD. -* -*ENDCLASS. diff --git a/src/01/02/z2ui5_cl_fw_model.clas.xml b/src/01/02/z2ui5_cl_fw_model.clas.xml deleted file mode 100644 index 4d3373ca..00000000 --- a/src/01/02/z2ui5_cl_fw_model.clas.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Z2UI5_CL_FW_MODEL - E - abap2UI5 - model - 1 - X - X - X - X - - - - diff --git a/src/01/02/z2ui5_cl_fw_model_ajson.clas.abap b/src/01/02/z2ui5_cl_fw_model_ajson.clas.abap index 57bb3ea7..405e1ac0 100644 --- a/src/01/02/z2ui5_cl_fw_model_ajson.clas.abap +++ b/src/01/02/z2ui5_cl_fw_model_ajson.clas.abap @@ -77,17 +77,6 @@ CLASS z2ui5_cl_fw_model_ajson IMPLEMENTATION. ELSE. ajson = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ). ENDIF. -* CASE lr_attri->pretty_name. -* -* WHEN z2ui5_if_client=>cs_pretty_mode-none. -* DATA(ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ). -* -* WHEN z2ui5_if_client=>cs_pretty_mode-camel_case. -* ajson = z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_camel_case( iv_first_json_upper = abap_false ) ). -* -* WHEN OTHERS. -* ASSERT `` = `ERROR_UNKNOWN_PRETTY_MODE`. -* ENDCASE. "(2) read attribute of end-user app @@ -127,34 +116,13 @@ CLASS z2ui5_cl_fw_model_ajson IMPLEMENTATION. ELSE. ajson = ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ). ENDIF. -* IF lr_attri->compress_custom IS NOT INITIAL. -* DATA li_filter TYPE REF TO z2ui5_if_ajson_filter. -* CREATE OBJECT li_filter TYPE (lr_attri->compress_custom). -* ajson = ajson->filter( li_filter ). -* -* ELSEIF lr_attri->compress = z2ui5_if_client=>cs_compress_mode-full. -* "obsolete - is this still needed? use compress_custom instead -* ASSERT `` = `OBSOLET_COMPRESS_MODE_USE_CUSTOM_INSTEAD`. -* -* ELSEIF lr_attri->compress = z2ui5_if_client=>cs_compress_mode-standard. -* ajson = ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ). -* -* ELSEIF lr_attri->compress = z2ui5_if_client=>cs_compress_mode-none. -* "obsolete - is this still needed? use compress_custom instead -* ASSERT `` = `OBSOLET_COMPRESS_MODE_USE_CUSTOM_INSTEAD`. -* -* ELSE. -* ASSERT `` = `ERROR_UNKNOW_COMPRESS_MODE`. -* ENDIF. - "(5) write into result "todo performance - write directly into result ajson_result->set( iv_path = `/` && lv_path iv_val = ajson ). ENDLOOP. -* result = ajson_result->stringify( ). - result = ajson_result. "->stringify( ). + result = ajson_result. CATCH cx_root INTO DATA(x). ASSERT x IS NOT BOUND. @@ -164,7 +132,6 @@ CLASS z2ui5_cl_fw_model_ajson IMPLEMENTATION. METHOD front_to_back. - DATA(ajson) = ajson_in->slice( `/EDIT` ). LOOP AT t_attri REFERENCE INTO DATA(lr_attri) @@ -180,27 +147,13 @@ CLASS z2ui5_cl_fw_model_ajson IMPLEMENTATION. DATA(ajson_val) = ajson->slice( `/` && lr_attri->name_front ). - TRY. + IF lr_attri->custom_mapper IS BOUND. + ajson_val = ajson_val->map( lr_attri->custom_mapper ). + ENDIF. - CASE lr_attri->pretty_name. - - WHEN z2ui5_if_client=>cs_pretty_mode-none. - - - WHEN z2ui5_if_client=>cs_pretty_mode-camel_case. - ajson_val = ajson_val->map( z2ui5_cl_ajson_mapping=>create_to_snake_case( ) ). - - WHEN OTHERS. - ASSERT `` = `ToDo -> UNKNOWN_PRETTY_MODE`. - ENDCASE. - - ajson_val->to_abap( - IMPORTING - ev_container = ). - - CATCH cx_root. - - ENDTRY. + ajson_val->to_abap( + IMPORTING + ev_container = ). CATCH cx_root INTO DATA(x). ASSERT x IS BOUND. diff --git a/src/01/05/z2ui5_cl_cc_chartjs.clas.abap b/src/01/05/z2ui5_cl_cc_chartjs.clas.abap index 3157571d..f3f91015 100644 --- a/src/01/05/z2ui5_cl_cc_chartjs.clas.abap +++ b/src/01/05/z2ui5_cl_cc_chartjs.clas.abap @@ -431,8 +431,8 @@ CLASS z2ui5_cl_cc_chartjs DEFINITION stack_weight TYPE i, stack TYPE string, position TYPE string, - ticks TYPE ty_ticks, - border TYPE ty_border, + ticks TYPE ty_ticks, + border TYPE ty_border, grid TYPE ty_grid, offset TYPE abap_bool, axis TYPE string, @@ -545,8 +545,8 @@ CLASS z2ui5_cl_cc_chartjs DEFINITION TYPES: BEGIN OF ty_options, - scales TYPE ty_scales, - responsive TYPE abap_bool, + scales TYPE ty_scales, + responsive TYPE abap_bool, plugins TYPE ty_plugins, hover TYPE ty_hover, interaction TYPE ty_interaction, @@ -554,7 +554,7 @@ CLASS z2ui5_cl_cc_chartjs DEFINITION layout TYPE ty_layout, elements TYPE ty_elements, index_axis TYPE string, - events TYPE string_table, + events TYPE string_table, END OF ty_options . "ChartJS Configuration @@ -617,9 +617,14 @@ CLASS z2ui5_cl_cc_chartjs IMPLEMENTATION. rv_keep = abap_true. - CASE iv_visit. + WHEN z2ui5_if_ajson_filter=>visit_type-open. + + IF is_node-children = 0. + rv_keep = abap_false. + ENDIF. + WHEN z2ui5_if_ajson_filter=>visit_type-value. CASE is_node-type. @@ -628,7 +633,7 @@ CLASS z2ui5_cl_cc_chartjs IMPLEMENTATION. rv_keep = abap_false. ENDIF. WHEN z2ui5_if_ajson_types=>node_type-number. - IF is_node-value = `0`. + IF is_node-value = `0` or is_node-value = `0.00`. rv_keep = abap_false. ENDIF. WHEN z2ui5_if_ajson_types=>node_type-string. diff --git a/src/02/z2ui5_cl_fw_http_handler.clas.abap b/src/02/z2ui5_cl_fw_http_handler.clas.abap index 95105abd..03a9c2e9 100644 --- a/src/02/z2ui5_cl_fw_http_handler.clas.abap +++ b/src/02/z2ui5_cl_fw_http_handler.clas.abap @@ -7,7 +7,6 @@ CLASS z2ui5_cl_fw_http_handler DEFINITION CLASS-METHODS http_post IMPORTING body TYPE string - check_old_json TYPE abap_bool DEFAULT abap_false RETURNING VALUE(result) TYPE string. @@ -45,8 +44,6 @@ CLASS z2ui5_cl_fw_http_handler IMPLEMENTATION. METHOD http_post. - z2ui5_cl_fw_controller=>cv_check_ajson = xsdbool( check_old_json = abap_false ). - result = z2ui5_cl_fw_controller=>main( body ). ENDMETHOD. diff --git a/src/02/z2ui5_if_client.intf.abap b/src/02/z2ui5_if_client.intf.abap index 9787f0d5..ec8201a5 100644 --- a/src/02/z2ui5_if_client.intf.abap +++ b/src/02/z2ui5_if_client.intf.abap @@ -27,23 +27,6 @@ INTERFACE z2ui5_if_client nested2 TYPE string VALUE `NEST2`, END OF cs_view. - CONSTANTS: - BEGIN OF cs_pretty_mode, - none TYPE char1 VALUE ``, - low_case TYPE char1 VALUE `L`, - camel_case TYPE char1 VALUE `X`, - extended TYPE char1 VALUE `Y`, - user TYPE char1 VALUE `U`, - user_low_case TYPE char1 VALUE `C`, - END OF cs_pretty_mode . - - CONSTANTS: - BEGIN OF cs_compress_mode, - standard TYPE string VALUE `STANDARD`, - full TYPE string VALUE `FULL`, - none TYPE string VALUE `NONE`, - END OF cs_compress_mode. - TYPES: BEGIN OF ty_s_name_value, n TYPE string, @@ -179,11 +162,8 @@ INTERFACE z2ui5_if_client IMPORTING val TYPE data path TYPE abap_bool DEFAULT abap_false - pretty_mode TYPE clike DEFAULT cs_pretty_mode-none - compress_mode TYPE clike DEFAULT cs_compress_mode-standard -* compress_custom TYPE clike OPTIONAL - custom_mapper TYPE REF TO z2ui5_if_ajson_mapping optional - custom_filter TYPE REF TO z2ui5_if_ajson_filter optional + custom_mapper TYPE REF TO z2ui5_if_ajson_mapping OPTIONAL + custom_filter TYPE REF TO z2ui5_if_ajson_filter OPTIONAL tab TYPE STANDARD TABLE OPTIONAL tab_index TYPE i OPTIONAL struc TYPE data OPTIONAL @@ -195,11 +175,8 @@ INTERFACE z2ui5_if_client val TYPE data path TYPE abap_bool DEFAULT abap_false view TYPE string DEFAULT cs_view-main - pretty_mode TYPE clike DEFAULT cs_pretty_mode-none - compress_mode TYPE clike DEFAULT cs_compress_mode-standard -* compress_custom TYPE clike OPTIONAL - custom_mapper TYPE REF TO z2ui5_if_ajson_mapping optional - custom_filter TYPE REF TO z2ui5_if_ajson_filter optional + custom_mapper TYPE REF TO z2ui5_if_ajson_mapping OPTIONAL + custom_filter TYPE REF TO z2ui5_if_ajson_filter OPTIONAL tab TYPE STANDARD TABLE OPTIONAL tab_index TYPE i OPTIONAL struc TYPE data OPTIONAL @@ -210,11 +187,8 @@ INTERFACE z2ui5_if_client IMPORTING val TYPE data path TYPE abap_bool DEFAULT abap_false - pretty_mode TYPE clike DEFAULT cs_pretty_mode-none -* compress_custom TYPE clike OPTIONAL - compress_mode TYPE clike DEFAULT cs_compress_mode-standard - custom_mapper TYPE REF TO z2ui5_if_ajson_mapping optional - custom_filter TYPE REF TO z2ui5_if_ajson_filter optional + custom_mapper TYPE REF TO z2ui5_if_ajson_mapping OPTIONAL + custom_filter TYPE REF TO z2ui5_if_ajson_filter OPTIONAL RETURNING VALUE(result) TYPE string.