Refactoring (#886)

* refactoring

* Update README.md

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* lint fixes

* lint fixes

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* update

* update abaplint

* update

* update

* Update abaplint.jsonc

* Update abaplint.jsonc

* update

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* Update abaplint.jsonc

* update lint

* update

* Update abaplint.jsonc

* Update abaplint.jsonc

* update

* update

* update

* Update abaplint.jsonc

* fixes

* update

* update
This commit is contained in:
oblomov 2024-02-14 20:15:31 +01:00 committed by GitHub
parent ee36617e24
commit fd321c91df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
58 changed files with 1509 additions and 1497 deletions

View File

@ -51,8 +51,8 @@
#### Extensions & Apps
* Integrate your apps to SAP Fiori On-Premise Launchpad [(ext-fiori_launchpad)](https://github.com/abap2UI5/ext-service_integration)
* Connect with the SAP Business Technology Platform [(ext-btp)](https://github.com/abap2UI5/ext-business_technology_platform)
* Enhance functionality with Custom Controls & External Libraries [(custom controls)](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/custom_controls.md)
* Connect with SAP BTP & SAP Mobile Start [(ext-btp)](https://github.com/abap2UI5/ext-business_technology_platform)
* Pimp up your apps with custom controls and external libraries [(ext-cc)](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/custom_controls.md)
* Discover other projects using abap2UI5 [(abap2UI5/links)](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/links.md)
#### More
@ -220,7 +220,7 @@ ENDCLASS.
</details>
#### Credits
* These [**Contributors**](https://github.com/abap2UI5/abap2UI5/graphs/contributors) help to continously evolve this project
* These [**Contributors**](https://github.com/abap2UI5/abap2UI5/graphs/contributors) continuously drive the evolution of this project forward
* Code versioning & distribution are managed via [**abapGit**](https://abapgit.org/) [(authors)](https://abapgit.org/sponsor.html)
* Static code analysis and quality assurance are performed via [**abaplint**](https://abaplint.org/) and [**open-abap**](https://github.com/open-abap) [(larshp)](https://github.com/larshp)
* JSON parsing for frontend-backend communication is implemented with [**ajson**](https://github.com/sbcgua/ajson) [(sbcgua)](https://github.com/sbcgua)

View File

@ -15,14 +15,14 @@
"errorNamespace": "."
},
"rules": {
"7bit_ascii": false,
"7bit_ascii": true,
"abapdoc": false,
"sql_value_conversion" : true,
"select_single_full_key" : true,
"strict_sql" : true,
"easy_to_find_messages" : true,
"fully_type_itabs" : false,
"align_parameters": false,
"fully_type_itabs" : true,
"align_parameters": true,
"smim_consistency": true,
"allowed_object_naming": true,
"allowed_object_types": {
@ -34,7 +34,7 @@
]
},
"ambiguous_statement": true,
"avoid_use": false,
"avoid_use": true,
"begin_end_names": true,
"begin_single_include": true,
"call_transaction_authority_check": true,
@ -42,16 +42,12 @@
"cds_legacy_view": true,
"cds_parser_error": true,
"chain_mainly_declarations": true,
"change_if_to_case": {
"exclude": [],
"severity": "Error",
"skipNames": []
},
"change_if_to_case": true,
"check_abstract": true,
"check_comments": false,
"check_comments": true,
"check_ddic": true,
"check_include": true,
"check_subrc": false,
"check_subrc": true,
"check_syntax": true,
"check_text_elements": true,
"check_transformation_exists": true,
@ -60,11 +56,7 @@
"cloud_types": true,
"colon_missing_space": true,
"commented_code": false,
"constant_classes": {
"exclude": [],
"severity": "Error",
"mapping": []
},
"constant_classes": true,
"constructor_visibility_public": true,
"contains_tab": {
"exclude": [],
@ -75,7 +67,7 @@
"cyclomatic_complexity": {
"exclude": [],
"severity": "Error",
"max": 25
"max": 10
},
"dangerous_statement": true,
"db_operation_in_loop": true,
@ -118,7 +110,7 @@
},
"global_class": true,
"identical_conditions": true,
"identical_contents": false,
"identical_contents": true,
"identical_descriptions": true,
"identical_form_names": true,
"if_in_if": true,
@ -128,11 +120,11 @@
"inline_data_old_versions": true,
"intf_referencing_clas": false,
"keep_single_parameter_on_one_line": false,
"keyword_case": false,
"keyword_case": true,
"line_break_multiple_parameters": false,
"line_break_style": true,
"line_length": false,
"line_only_punc": false,
"line_only_punc": true,
"local_class_naming": false,
"local_testclass_consistency": true,
"local_variable_names": false,
@ -143,7 +135,7 @@
"message_exists": true,
"method_implemented_twice": true,
"method_length": false,
"method_overwrites_builtin": false,
"method_overwrites_builtin": true,
"method_parameter_names": false,
"mix_returning": true,
"modify_only_own_db_tables": {
@ -153,15 +145,15 @@
"msag_consistency": true,
"names_no_dash": true,
"nesting": {
"depth": 7
"depth": 5
},
"newline_between_methods": false,
"newline_between_methods": true,
"no_aliases": true,
"no_chained_assignment": true,
"no_external_form_calls": true,
"no_inline_in_optional_branches": false,
"no_public_attributes": false,
"no_yoda_conditions": false,
"no_yoda_conditions": true,
"nrob_consistency": true,
"object_naming": {
"exclude": [],
@ -189,19 +181,19 @@
"shlp": "^Z"
},
"obsolete_statement": true,
"omit_parameter_name": false,
"omit_parameter_name": true,
"omit_preceding_zeros": true,
"omit_receiving": true,
"parser_702_chaining": true,
"parser_error": true,
"parser_missing_space": false,
"parser_missing_space": true,
"pragma_style": true,
"prefer_corresponding": true,
"prefer_inline": false,
"prefer_is_not": false,
"prefer_is_not": true,
"prefer_raise_exception_new": true,
"prefer_returning_to_exporting": false,
"prefer_xsdbool": false,
"prefer_returning_to_exporting": true,
"prefer_xsdbool": true,
"preferred_compare_operator": true,
"prefix_is_current_class": {
"severity": "Warning"
@ -221,44 +213,41 @@
"sequential_blank": {
"severity": "Warning"
},
"short_case": false,
"short_case": true,
"sicf_consistency": true,
"slow_parameter_passing": true,
"space_before_colon": true,
"space_before_dot": true,
"sql_escape_host_variables": true,
"start_at_tab": false,
"start_at_tab": true,
"static_call_via_instance": {
"allowInTestclassIncludes": false
},
"superclass_final": true,
"superfluous_value": true,
"sy_modification": false,
"sy_modification": true,
"tabl_enhancement_category": true,
"try_without_catch": true,
"type_form_parameters": true,
"types_naming": false,
"uncaught_exception": true,
"unknown_types": true,
"unnecessary_chaining": false,
"unnecessary_chaining": true,
"unnecessary_pragma": true,
"unnecessary_return": true,
"unreachable_code": {
"exclude": ["z2ui5_cl_fw_utility.clas.testclasses.abap"]
},
"unreachable_code": true,
"unsecure_fae": true,
"unused_ddic": true,
"unused_methods": true,
"unused_types": true,
"unused_variables": {
"severity": "Error",
"exclude": ["z2ui5_cl_fw_utility.clas.testclasses.abap"],
"skipNames": ["lv_dummy", "i_mv_editor"]
"skipNames": ["lv_dummy"]
},
"use_bool_expression": true,
"use_class_based_exceptions": true,
"use_line_exists": false,
"use_new": false,
"use_line_exists": true,
"use_new": true,
"when_others_last": true,
"whitespace_end": true,
"xml_consistency": true,

View File

@ -89,6 +89,7 @@ CLASS z2ui5_cl_util IMPLEMENTATION.
AND handle2 = @handle2
AND handle3 = @handle3
INTO CORRESPONDING FIELDS OF TABLE @lt_db.
ASSERT sy-subrc = 0.
DATA(ls_db) = lt_db[ 1 ].
@ -109,6 +110,7 @@ CLASS z2ui5_cl_util IMPLEMENTATION.
FROM z2ui5_t_fw_02
WHERE id = @id
INTO CORRESPONDING FIELDS OF TABLE @lt_db.
ASSERT sy-subrc = 0.
DATA(ls_db) = lt_db[ 1 ].
@ -132,6 +134,7 @@ CLASS z2ui5_cl_util IMPLEMENTATION.
data = xml_stringify( data ) ).
MODIFY z2ui5_t_fw_02 FROM @ls_db.
ASSERT sy-subrc = 0.
IF check_commit = abap_true.
COMMIT WORK AND WAIT.

View File

@ -3,7 +3,7 @@ CLASS ltcl_test DEFINITION FINAL FOR TESTING
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
METHODS
first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
@ -20,17 +20,17 @@ CLASS ltcl_test IMPLEMENTATION.
END OF ty_row.
DATA(ls_row) = VALUE ty_row(
title = `test`
value = `val`
title = `test`
value = `val`
selected = abap_true ).
DATA(ls_row_result) = VALUE ty_row( ).
DATA(lv_id) = z2ui5_cl_util=>db_save(
uname = `name`
handle = `handle1`
handle2 = `handle2`
handle3 = `handle3`
data = ls_row ).
uname = `name`
handle = `handle1`
handle2 = `handle2`
handle3 = `handle3`
data = ls_row ).
z2ui5_cl_util=>db_load_by_id(
EXPORTING
@ -45,10 +45,10 @@ CLASS ltcl_test IMPLEMENTATION.
CLEAR ls_row_result.
z2ui5_cl_util=>db_load_by_handle(
EXPORTING
uname = `name`
handle = `handle1`
handle2 = `handle2`
handle3 = `handle3`
uname = `name`
handle = `handle1`
handle2 = `handle2`
handle3 = `handle3`
IMPORTING
result = ls_row_result ).

View File

@ -1,4 +1,4 @@
CLASS z2ui5_cl_util_api DEFINITION
CLASS z2ui5_cl_util_api DEFINITION
PUBLIC
CREATE PUBLIC
INHERITING FROM z2ui5_cl_util_stmpncfctn.
@ -198,9 +198,9 @@ CLASS z2ui5_cl_util_api DEFINITION
CLASS-METHODS xml_srtti_parse
IMPORTING
!rtti_data TYPE clike
EXPORTING
!e_data TYPE REF TO data.
!rtti_data TYPE clike
RETURNING
VALUE(result) TYPE REF TO data.
CLASS-METHODS time_get_timestampl
RETURNING
@ -265,12 +265,6 @@ CLASS z2ui5_cl_util_api DEFINITION
RETURNING
VALUE(result) TYPE abap_bool.
CLASS-METHODS rtti_get_type_kind_by_descr
IMPORTING
!val TYPE REF TO cl_abap_typedescr
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS rtti_get_type_kind
IMPORTING
!val TYPE any
@ -354,18 +348,7 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
LOOP AT sdescr->components REFERENCE INTO DATA(lr_comp).
DATA(lv_element) = attri && lr_comp->name.
* DATA(ls_attri) = VALUE z2ui5_if_core_types=>ty_s_attri(
* name = lv_element
* type_kind = lr_comp->type_kind ).
*
DATA(ls_attri) = VALUE abap_componentdescr(
name = lv_element
* type_kind = lr_comp->type_kind
).
"todo type of field
DATA(ls_attri) = VALUE abap_componentdescr( name = attri && lr_comp->name ).
INSERT ls_attri INTO TABLE result.
ENDLOOP.
@ -667,6 +650,7 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
LOOP AT lt_cols REFERENCE INTO lr_col.
ASSIGN lr_row->* TO FIELD-SYMBOL(<row>).
ASSIGN COMPONENT sy-tabix OF STRUCTURE <row> TO FIELD-SYMBOL(<field>).
ASSERT sy-subrc = 0.
<field> = lr_col->*.
ENDLOOP.
@ -692,7 +676,7 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
METHOD json_stringify.
TRY.
DATA(li_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
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).
@ -805,8 +789,8 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
LOOP AT result REFERENCE INTO DATA(lr_comp)
WHERE as_include = abap_true.
DATA(lt_attri) = rtti_get_t_attri_by_include( type = lr_comp->type
attri = lr_comp->name ).
DATA(lt_attri) = rtti_get_t_attri_by_include( type = lr_comp->type
attri = lr_comp->name ).
DELETE result.
INSERT LINES OF lt_attri INTO TABLE result.
@ -831,12 +815,11 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
METHOD source_get_method.
DATA(lt_source) = method_get_source(
DATA(lt_source) = method_get_source(
iv_classname = iv_classname
iv_methodname = iv_methodname
).
iv_methodname = iv_methodname ).
result = source_method_to_file( it_source = lt_source ).
result = source_method_to_file( lt_source ).
ENDMETHOD.
@ -1000,8 +983,8 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
lo_datadescr ?= rtti_type.
CREATE DATA e_data TYPE HANDLE lo_datadescr.
ASSIGN e_data->* TO FIELD-SYMBOL(<variable>).
CREATE DATA result TYPE HANDLE lo_datadescr.
ASSIGN result->* TO FIELD-SYMBOL(<variable>).
CALL TRANSFORMATION id SOURCE XML rtti_data RESULT dobj = <variable>.
ENDMETHOD.
@ -1059,36 +1042,11 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
ENDMETHOD.
METHOD rtti_get_type_kind_by_descr.
TRY.
DATA(lo_test) = CAST cl_abap_structdescr( val ).
result = lo_test->type_kind.
RETURN.
CATCH cx_sy_move_cast_error.
ENDTRY.
TRY.
DATA(lo_test2) = CAST cl_abap_objectdescr( val ).
result = lo_test2->type_kind.
RETURN.
CATCH cx_sy_move_cast_error.
ENDTRY.
TRY.
DATA(lo_test3) = CAST cl_abap_refdescr( val ).
result = lo_test3->type_kind.
RETURN.
CATCH cx_sy_move_cast_error.
ENDTRY.
ENDMETHOD.
METHOD unassign_object.
FIELD-SYMBOLS <unassign> TYPE any.
ASSIGN val->* TO <unassign>.
result = <unassign>.
result = <unassign>.
ENDMETHOD.
@ -1096,7 +1054,7 @@ CLASS z2ui5_cl_util_api IMPLEMENTATION.
FIELD-SYMBOLS <unassign> TYPE any.
ASSIGN val->* TO <unassign>.
result = <unassign>.
result = <unassign>.
ENDMETHOD.

View File

@ -126,6 +126,7 @@ CLASS ltcl_unit_test_abap_api IMPLEMENTATION.
DATA(lv_assign) = `LO_APP->` && 'MV_VAL'.
ASSIGN (lv_assign) TO <any>.
ASSERT sy-subrc = 0.
cl_abap_unit_assert=>assert_equals(
act = <any>
@ -329,12 +330,12 @@ CLASS ltcl_unit_test IMPLEMENTATION.
GET REFERENCE OF lv_test INTO lr_data.
cl_abap_unit_assert=>assert_equals(
act = z2ui5_cl_util_api=>rtti_check_ref_data( lr_data )
exp = abap_true ).
act = z2ui5_cl_util_api=>rtti_check_ref_data( lr_data )
exp = abap_true ).
cl_abap_unit_assert=>assert_equals(
act = z2ui5_cl_util_api=>rtti_check_ref_data( lv_test )
exp = abap_false ).
act = z2ui5_cl_util_api=>rtti_check_ref_data( lv_test )
exp = abap_false ).
ENDMETHOD.
@ -359,7 +360,7 @@ CLASS ltcl_unit_test IMPLEMENTATION.
cl_abap_unit_assert=>assert_equals(
act = z2ui5_cl_util=>boolean_abap_2_json( `{ABCD}` )
exp = `{ABCD}`).
exp = `{ABCD}` ).
ENDMETHOD.
@ -423,8 +424,8 @@ CLASS ltcl_unit_test IMPLEMENTATION.
METHOD test_func_get_user_tech.
cl_abap_unit_assert=>assert_equals(
act = sy-uname
exp = z2ui5_cl_util=>user_get_tech( ) ).
act = sy-uname
exp = z2ui5_cl_util=>user_get_tech( ) ).
cl_abap_unit_assert=>assert_not_initial( z2ui5_cl_util=>user_get_tech( ) ).
@ -507,7 +508,7 @@ CLASS ltcl_unit_test IMPLEMENTATION.
exp = `100` ).
cl_abap_unit_assert=>assert_equals(
act = lt_param[ n = `app_start` ]-v
act = lt_param[ n = `app_start` ]-v
exp = `z2ui5_cl_app_hello_world` ).
ENDMETHOD.

View File

@ -205,6 +205,7 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
ro_class = object.
ASSIGN ('OBJECT->IF_XCO_AO_CLASS~IMPLEMENTATION') TO <any>.
ASSERT sy-subrc = 0.
object = <any>.
CALL METHOD object->('IF_XCO_CLAS_IMPLEMENTATION~METHOD')
@ -275,7 +276,7 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
clsname TYPE c LENGTH 30,
refclsname TYPE c LENGTH 30,
END OF ty_s_impl.
DATA lt_impl TYPE STANDARD TABLE OF ty_s_impl WITH DEFAULT KEY.
DATA lt_impl TYPE STANDARD TABLE OF ty_s_impl WITH EMPTY KEY.
TYPES: BEGIN OF ty_s_key,
intkey TYPE c LENGTH 30,
END OF ty_s_key.
@ -336,10 +337,9 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
METHOD rtti_get_data_element_texts.
DATA:
data_element_name TYPE c LENGTH 30,
ddic_ref TYPE REF TO data,
data_element TYPE REF TO object,
content TYPE REF TO object,
ddic_ref TYPE REF TO data,
data_element TYPE REF TO object,
content TYPE REF TO object,
BEGIN OF ddic,
reptext TYPE string,
scrtext_s TYPE string,
@ -348,7 +348,7 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
END OF ddic,
exists TYPE abap_bool.
data_element_name = i_data_element_name.
DATA(data_element_name) = i_data_element_name.
TRY.
cl_abap_typedescr=>describe_by_name( 'T100' ).
@ -361,11 +361,11 @@ CLASS z2ui5_cl_util_stmpncfctn IMPLEMENTATION.
cl_abap_elemdescr=>describe_by_name(
EXPORTING
p_name = data_element_name
p_name = data_element_name
RECEIVING
p_descr_ref = DATA(lo_typedescr)
p_descr_ref = DATA(lo_typedescr)
EXCEPTIONS
OTHERS = 1 ).
OTHERS = 1 ).
IF sy-subrc <> 0.
RETURN.
ENDIF.

View File

@ -42,8 +42,8 @@ CLASS ltcl_test IMPLEMENTATION.
DATA(lv_string3) = z2ui5_cl_util_stmpncfctn=>conv_get_string_by_xstring( lv_xstring2 ).
cl_abap_unit_assert=>assert_equals(
act = lv_string3
exp = lv_string ).
act = lv_string3
exp = lv_string ).
ENDMETHOD.

View File

@ -0,0 +1,164 @@
CLASS z2ui5_cl_core_attri_srv DEFINITION
PUBLIC FINAL
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor
IMPORTING
attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri
app TYPE REF TO object.
METHODS attri_refs_update.
METHODS attri_before_save.
METHODS attri_after_load.
METHODS attri_get_val_ref
IMPORTING
iv_path TYPE clike
RETURNING
VALUE(result) TYPE REF TO data.
METHODS attri_search_a_dissolve
IMPORTING
val TYPE REF TO data
RETURNING
VALUE(result) TYPE REF TO z2ui5_if_core_types=>ty_s_attri.
PROTECTED SECTION.
DATA mt_attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri.
DATA mo_app TYPE REF TO object.
METHODS attri_search
IMPORTING
val TYPE REF TO data
RETURNING
VALUE(result) TYPE REF TO z2ui5_if_core_types=>ty_s_attri.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_core_attri_srv IMPLEMENTATION.
METHOD attri_after_load.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri).
lr_attri->r_ref = attri_get_val_ref( lr_attri->name ).
lr_attri->o_typedescr = cl_abap_datadescr=>describe_by_data_ref( lr_attri->r_ref ).
IF lr_attri->srtti_data IS NOT INITIAL.
ASSIGN lr_attri->r_ref->* TO FIELD-SYMBOL(<val>).
<val> = z2ui5_cl_util=>xml_srtti_parse( lr_attri->srtti_data ).
CLEAR lr_attri->srtti_data.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD attri_before_save.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri).
IF lr_attri->bind_type = z2ui5_if_core_types=>cs_bind_type-one_time.
DELETE mt_attri->*.
CONTINUE.
ENDIF.
IF lr_attri->o_typedescr->type_kind <> cl_abap_classdescr=>typekind_dref.
CLEAR lr_attri->r_ref.
CONTINUE.
ENDIF.
ASSIGN lr_attri->r_ref->* TO FIELD-SYMBOL(<val_ref>).
ASSIGN <val_ref>->* TO FIELD-SYMBOL(<val>).
lr_attri->srtti_data = z2ui5_cl_util=>xml_srtti_stringify( <val> ).
CLEAR <val>.
CLEAR <val_ref>.
CLEAR lr_attri->r_ref.
ENDLOOP.
ENDMETHOD.
METHOD attri_search_a_dissolve.
result = attri_search( val ).
IF result IS BOUND.
RETURN.
ENDIF.
DO 5 TIMES.
DATA(lo_dissolve) = NEW z2ui5_cl_core_dissolve_srv(
attri = mt_attri
app = mo_app ).
lo_dissolve->main( ).
result = attri_search( val ).
IF result IS BOUND.
RETURN.
ENDIF.
ENDDO.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `BINDING_ERROR - No class attribute for binding found - Please check if the binded values are public attributes of your class or switch to bind_local`.
ENDMETHOD.
METHOD attri_get_val_ref.
ASSIGN mo_app->(iv_path) TO FIELD-SYMBOL(<attri>).
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `DEREF_FAILED_TARGET_INITIAL`.
ENDIF.
GET REFERENCE OF <attri> INTO result.
IF sy-subrc <> 0.
ASSERT 1 = 0.
ENDIF.
ENDMETHOD.
METHOD attri_refs_update.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri).
lr_attri->r_ref = attri_get_val_ref( lr_attri->name ).
lr_attri->o_typedescr = cl_abap_datadescr=>describe_by_data_ref( lr_attri->r_ref ).
ENDLOOP.
ENDMETHOD.
METHOD constructor.
mt_attri = attri.
mo_app = app.
ENDMETHOD.
METHOD attri_search.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE o_typedescr->kind = cl_abap_typedescr=>kind_elem
OR o_typedescr->kind = cl_abap_typedescr=>kind_struct
OR o_typedescr->kind = cl_abap_typedescr=>kind_table.
IF lr_attri->r_ref = val.
result = lr_attri.
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,256 @@
*
*CLASS ltcl_test_dissolve DEFINITION DEFERRED.
*CLASS z2ui5_cl_core_model_srv DEFINITION LOCAL FRIENDS ltcl_test_dissolve.
*
*CLASS ltcl_test_dissolve DEFINITION FINAL FOR TESTING
* DURATION SHORT
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* TYPES:
* BEGIN OF s_01,
* input TYPE string,
* BEGIN OF s_02,
* input TYPE string,
* BEGIN OF s_03,
* input TYPE string,
* BEGIN OF s_04,
* input TYPE string,
* END OF s_04,
* END OF s_03,
* END OF s_02,
* END OF s_01.
*
* DATA ms_struc TYPE s_01 ##NEEDED.
* DATA mv_value TYPE string ##NEEDED.
* DATA mr_value TYPE REF TO data.
* DATA mr_struc TYPE REF TO s_01.
* DATA mo_app TYPE REF TO ltcl_test_dissolve.
*
* PRIVATE SECTION.
* METHODS test_dissolve_init FOR TESTING RAISING cx_static_check.
* METHODS test_dissolve_struc FOR TESTING RAISING cx_static_check.
* METHODS test_dissolve_dref FOR TESTING RAISING cx_static_check.
* METHODS test_dissolve_oref FOR TESTING RAISING cx_static_check.
* METHODS test_ref FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_dissolve IMPLEMENTATION.
*
*
* METHOD test_ref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
*
* DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app ).
*
* lo_model->dissolve( ).
*
* DATA(ls_attri) = lt_attri[ name = `MV_VALUE` ].
* GET REFERENCE OF lo_app->mv_value INTO DATA(lr_ref).
*
* IF ls_attri-r_ref <> lr_ref.
* cl_abap_unit_assert=>abort( ).
* ENDIF.
*
* ENDMETHOD.
*
* METHOD test_dissolve_init.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
*
* DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app ).
*
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_dref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* CREATE DATA lo_app->mr_struc.
* CREATE DATA lo_app->mr_value TYPE string.
*
* DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app ).
*
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MR_VALUE->*` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_oref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_app2) = NEW ltcl_test_dissolve( ).
* lo_app2->mo_app = lo_app.
*
* CREATE DATA lo_app->mo_app->mr_struc.
* CREATE DATA lo_app->mo_app->mr_value TYPE string.
*
* DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app2 ).
*
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MV_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MS_STRUC` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_struc.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app ).
*
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
* lo_model->dissolve( ).
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC-S_02-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*
*CLASS ltcl_test_app2 DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* DATA mv_value TYPE string ##NEEDED.
* DATA mr_value TYPE REF TO data.
* DATA mr_value2 TYPE REF TO data.
* DATA mo_app TYPE REF TO ltcl_test_app2.
*
* DATA xx TYPE string ##NEEDED.
* METHODS constructor.
*ENDCLASS.
*
*CLASS ltcl_test_app2 IMPLEMENTATION.
*
* METHOD constructor.
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_search_attri DEFINITION FINAL FOR TESTING
* DURATION SHORT
* RISK LEVEL HARMLESS.
*
* PRIVATE SECTION.
* METHODS first_test FOR TESTING RAISING cx_static_check.
* METHODS second_test FOR TESTING RAISING cx_static_check.
* METHODS third_test FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS z2ui5_cl_core_model_srv DEFINITION LOCAL FRIENDS ltcl_test_search_attri.
*
*CLASS ltcl_test_search_attri IMPLEMENTATION.
*
* METHOD first_test.
*
* DATA(lo_app_client) = NEW ltcl_test_app2( ).
* DATA lr_value TYPE REF TO data.
* GET REFERENCE OF lo_app_client->mv_value INTO lr_value.
*
* DATA(lt_attri) = VALUE z2ui5_if_core_types=>ty_t_attri( ( r_ref = lr_value ) ).
*
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app_client ).
*
* DATA(lr_attri) = lo_model->attri_search_a_dissolve( REF #( lo_app_client->mv_value ) ).
*
* IF lr_attri->r_ref <> lr_value.
* cl_abap_unit_assert=>abort( ).
* ENDIF.
*
* ENDMETHOD.
*
* METHOD second_test.
*
* DATA(lo_app_client) = NEW ltcl_test_app2( ).
* DATA lr_value TYPE REF TO data.
* GET REFERENCE OF lo_app_client->mv_value INTO lr_value.
*
* DATA(lt_attri) = VALUE z2ui5_if_core_types=>ty_t_attri( ( r_ref = REF #( lo_app_client->mv_value ) ) ).
*
* DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
* attri = REF #( lt_attri )
* app = lo_app_client ).
*
* DATA(lr_attri) = lo_model->attri_search_a_dissolve( REF #( lo_app_client->mv_value ) ).
*
* IF lr_attri->r_ref <> lr_value.
* cl_abap_unit_assert=>abort( ).
* ENDIF.
*
* ENDMETHOD.
*
* METHOD third_test.
*
* DATA(lo_app_client) = NEW ltcl_test_app2( ).
* DATA lr_value TYPE REF TO data.
* GET REFERENCE OF lo_app_client->mv_value INTO lr_value.
*
* lo_app_client->mo_app = NEW #( ).
*
* DATA(lt_attri) = VALUE z2ui5_if_core_types=>ty_t_attri(
* ( name = `1` r_ref = REF #( lo_app_client->mr_value ) )
* ( name = `4` r_ref = REF #( lo_app_client->mr_value2 ) )
* ( name = `2` r_ref = REF #( lo_app_client->mo_app ) )
* ( name = `3` r_ref = REF #( lo_app_client->mv_value ) )
* ).
*
* DATA(lr_attri) = REF #( lt_attri[ r_ref = lr_value ] ).
* IF lr_attri->r_ref <> lr_value.
* cl_abap_unit_assert=>abort( ).
* ENDIF.
*
* ENDMETHOD.
*
*
*ENDCLASS.

View File

@ -3,9 +3,9 @@
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_MODEL_SRV</CLSNAME>
<CLSNAME>Z2UI5_CL_CORE_ATTRI_SRV</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - backend model</DESCRIPT>
<DESCRIPT>abap2UI5 - backend attributes</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>

View File

@ -80,6 +80,7 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
LOOP AT lt_attri ASSIGNING FIELD-SYMBOL(<comp>).
ASSIGN COMPONENT <comp>-name OF STRUCTURE <row> TO <ele>.
ASSERT sy-subrc = 0.
lr_ref_in = REF #( <ele> ).
IF i_val = lr_ref_in.
@ -178,7 +179,7 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
result = replace( val = result sub = `>` with = `` ).
result = COND #( WHEN mv_type = z2ui5_if_core_types=>cs_bind_type-two_way
THEN `/` && z2ui5_if_core_types=>cs_ui5-two_way_model )
&& `/` && result.
&& `/` && result.
ENDMETHOD.
@ -198,22 +199,21 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
ms_config = config.
mv_type = type.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
DATA(lo_model) = NEW z2ui5_cl_core_attri_srv(
attri = REF #( mo_app->mt_attri )
app = mo_app->mo_app ).
app = mo_app->mo_app ).
mr_attri = lo_model->search_a_dissolve_attribute( val ).
mr_attri = lo_model->attri_search_a_dissolve( val ).
IF mr_attri->bind_type IS NOT INITIAL.
check_raise_existing( ).
result = mr_attri->name_client.
ELSE.
check_raise_new( ).
update_model_attri( ).
result = mr_attri->name_client.
ENDIF.
result = mr_attri->name_client.
IF result = `/` && z2ui5_if_core_types=>cs_ui5-two_way_model.
IF `/` && z2ui5_if_core_types=>cs_ui5-two_way_model = result.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `<p>Name of variable not allowed - x is reserved word - use anoter name for your attribute`.
@ -236,8 +236,8 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
result = lo_bind->main( val = config-tab type = type config = VALUE #( path_only = abap_true ) ).
result = bind_tab_cell(
iv_name = result
i_val = val ).
iv_name = result
i_val = val ).
IF ms_config-path_only = abap_false.
result = `{` && result && `}`.
@ -249,7 +249,7 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
METHOD main_local.
TRY.
DATA(lo_json) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>new( ) ).
DATA(lo_json) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>new( ) ).
lo_json->set( iv_path = `/` iv_val = val ).
IF config-custom_mapper IS BOUND.
@ -268,8 +268,8 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
INSERT VALUE #( name_client = |/{ lv_id }|
name = lv_id
json_bind_local = lo_json
bind_type = z2ui5_if_core_types=>cs_bind_type-one_time )
INTO TABLE mo_app->mt_attri.
bind_type = z2ui5_if_core_types=>cs_bind_type-one_time )
INTO TABLE mo_app->mt_attri.
result = |/{ lv_id }|.
@ -291,8 +291,9 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
mr_attri->custom_filter_back = ms_config-custom_filter_back.
mr_attri->custom_mapper = ms_config-custom_mapper.
mr_attri->custom_mapper_back = ms_config-custom_mapper_back.
mr_attri->view = COND #( WHEN ms_config-view IS INITIAL THEN z2ui5_if_client=>cs_view-main ELSE ms_config-view ).
mr_attri->name_client = get_client_name( ).
mr_attri->view = COND #( WHEN ms_config-view IS INITIAL THEN z2ui5_if_client=>cs_view-main ELSE ms_config-view ).
mr_attri->name_client = get_client_name( ).
ENDMETHOD.
ENDCLASS.

View File

@ -70,8 +70,8 @@ CLASS ltcl_test_bind IMPLEMENTATION.
TRY.
lo_bind->main(
val = REF #( lo_app_client->xx )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_app_client->xx )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>abort( ).
@ -93,8 +93,8 @@ CLASS ltcl_test_bind IMPLEMENTATION.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_bind) = lo_bind->main(
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_bind
@ -115,13 +115,13 @@ CLASS ltcl_test_bind IMPLEMENTATION.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
lo_bind->main(
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
TRY.
lo_bind->main(
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-two_way ).
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-two_way ).
cl_abap_unit_assert=>abort( ).
@ -144,12 +144,12 @@ CLASS ltcl_test_bind IMPLEMENTATION.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_bind) = lo_bind->main(
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-two_way ).
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-two_way ).
DATA(lv_bind2) = lo_bind->main(
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-two_way ).
val = REF #( lo_app_client->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-two_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_bind
@ -201,14 +201,14 @@ CLASS ltcl_test_main_structure IMPLEMENTATION.
RETURN.
ENDIF.
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_app) = NEW z2ui5_cl_core_app( ).
lo_app->mo_app = lo_test_app.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_result) = lo_bind->main(
val = REF #( lo_test_app->ms_struc-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_test_app->ms_struc-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result
@ -217,7 +217,7 @@ CLASS ltcl_test_main_structure IMPLEMENTATION.
lv_result = lo_bind->main(
val = REF #( lo_test_app->ms_struc-input )
config = VALUE #( path_only = abap_true )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result
@ -231,14 +231,14 @@ CLASS ltcl_test_main_structure IMPLEMENTATION.
RETURN.
ENDIF.
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_app) = NEW z2ui5_cl_core_app( ).
lo_app->mo_app = lo_test_app.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_result) = lo_bind->main(
val = REF #( lo_test_app->ms_struc-s_02-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_test_app->ms_struc-s_02-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result
@ -252,14 +252,14 @@ CLASS ltcl_test_main_structure IMPLEMENTATION.
RETURN.
ENDIF.
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_app) = NEW z2ui5_cl_core_app( ).
lo_app->mo_app = lo_test_app.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_result) = lo_bind->main(
val = REF #( lo_test_app->ms_struc-s_02-s_03-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_test_app->ms_struc-s_02-s_03-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result
@ -273,14 +273,14 @@ CLASS ltcl_test_main_structure IMPLEMENTATION.
RETURN.
ENDIF.
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_test_app) = NEW ltcl_test_main_structure( ).
DATA(lo_app) = NEW z2ui5_cl_core_app( ).
lo_app->mo_app = lo_test_app.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_result) = lo_bind->main(
val = REF #( lo_test_app->ms_struc-s_02-s_03-s_04-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_test_app->ms_struc-s_02-s_03-s_04-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result
@ -332,7 +332,7 @@ CLASS ltcl_test_main_object IMPLEMENTATION.
RETURN.
ENDIF.
DATA(lo_test_app) = NEW ltcl_test_main_object( ).
DATA(lo_test_app) = NEW ltcl_test_main_object( ).
lo_test_app->mo_obj = NEW #( ).
lo_test_app->mo_obj->mv_value = `test`.
DATA(lo_app) = NEW z2ui5_cl_core_app( ).
@ -340,8 +340,8 @@ CLASS ltcl_test_main_object IMPLEMENTATION.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_result) = lo_bind->main(
val = REF #( lo_test_app->mo_obj->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_test_app->mo_obj->mv_value )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result
@ -355,15 +355,15 @@ CLASS ltcl_test_main_object IMPLEMENTATION.
RETURN.
ENDIF.
DATA(lo_test_app) = NEW ltcl_test_main_object( ).
DATA(lo_test_app) = NEW ltcl_test_main_object( ).
lo_test_app->mo_obj = NEW #( ).
DATA(lo_app) = NEW z2ui5_cl_core_app( ).
lo_app->mo_app = lo_test_app.
DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
DATA(lv_result) = lo_bind->main(
val = REF #( lo_test_app->mo_obj->ms_struc-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
val = REF #( lo_test_app->mo_obj->ms_struc-input )
type = z2ui5_if_core_types=>cs_bind_type-one_way ).
cl_abap_unit_assert=>assert_equals(
act = lv_result

View File

@ -0,0 +1,206 @@
CLASS z2ui5_cl_core_dissolve_srv DEFINITION
PUBLIC
FINAL
CREATE PUBLIC.
PUBLIC SECTION.
METHODS constructor
IMPORTING
attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri
app TYPE REF TO object.
METHODS main.
PROTECTED SECTION.
DATA mt_attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri.
DATA mo_app TYPE REF TO object.
METHODS main_run.
METHODS main_init.
METHODS diss_struc
IMPORTING
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS diss_dref
IMPORTING
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS diss_oref
IMPORTING ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS create_new_entry
IMPORTING
name TYPE string
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_s_attri.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_core_dissolve_srv IMPLEMENTATION.
METHOD constructor.
mt_attri = attri.
mo_app = app.
ENDMETHOD.
METHOD create_new_entry.
result = VALUE z2ui5_if_core_types=>ty_s_attri( ).
result-name = name.
DATA(lo_model) = NEW z2ui5_cl_core_attri_srv(
attri = mt_attri
app = mo_app ).
result-r_ref = lo_model->attri_get_val_ref( name ).
result-o_typedescr = cl_abap_datadescr=>describe_by_data_ref( result-r_ref ).
ENDMETHOD.
METHOD diss_dref.
DATA(lr_ref) = z2ui5_cl_util=>unassign_data( ir_attri->r_ref ).
IF lr_ref IS INITIAL.
RETURN.
ENDIF.
DATA(ls_attri2) = VALUE z2ui5_if_core_types=>ty_s_attri( ).
ls_attri2-o_typedescr = cl_abap_datadescr=>describe_by_data_ref( lr_ref ).
CASE ls_attri2-o_typedescr->kind.
WHEN cl_abap_datadescr=>kind_struct.
DATA(lt_attri) = diss_struc( ir_attri ).
INSERT LINES OF lt_attri INTO TABLE result.
WHEN OTHERS.
ls_attri2-name = ir_attri->name && `->*`.
DATA(lo_model) = NEW z2ui5_cl_core_attri_srv(
attri = mt_attri
app = mo_app ).
ls_attri2-r_ref = lo_model->attri_get_val_ref( ls_attri2-name ).
INSERT ls_attri2 INTO TABLE result.
ENDCASE.
ENDMETHOD.
METHOD diss_oref.
IF z2ui5_cl_util=>check_unassign_inital( ir_attri->r_ref ).
RETURN.
ENDIF.
DATA(lv_name) = COND #( WHEN ir_attri->name IS NOT INITIAL THEN ir_attri->name && `->` ).
DATA(lr_ref) = z2ui5_cl_util=>unassign_object( ir_attri->r_ref ).
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_oref( lr_ref ).
LOOP AT lt_attri REFERENCE INTO DATA(lr_attri)
WHERE visibility = cl_abap_objectdescr=>public
AND is_interface = abap_false
AND is_constant = abap_false.
TRY.
DATA(ls_new) = create_new_entry( lv_name && lr_attri->name ).
INSERT ls_new INTO TABLE result.
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD diss_struc.
IF ir_attri->o_typedescr->kind = cl_abap_typedescr=>kind_ref.
DATA(lv_name) = ir_attri->name && `->`.
DATA(lr_ref) = z2ui5_cl_util=>unassign_data( ir_attri->r_ref ).
ELSE.
lv_name = ir_attri->name && `-`.
lr_ref = ir_attri->r_ref.
ENDIF.
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( lr_ref ).
LOOP AT lt_attri INTO DATA(ls_attri).
DATA(ls_new) = create_new_entry( lv_name && ls_attri-name ).
INSERT ls_new INTO TABLE result.
ENDLOOP.
ENDMETHOD.
METHOD main.
IF mt_attri->* IS INITIAL.
main_init( ).
RETURN.
ENDIF.
main_run( ).
ENDMETHOD.
METHOD main_init.
DATA(ls_attri) = VALUE z2ui5_if_core_types=>ty_s_attri( r_ref = REF #( mo_app ) ).
DATA(lt_init) = diss_oref( REF #( ls_attri ) ).
INSERT LINES OF lt_init INTO TABLE mt_attri->*.
ENDMETHOD.
METHOD main_run.
DATA(lt_attri_new) = VALUE z2ui5_if_core_types=>ty_t_attri( ).
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE check_dissolved = abap_false.
lr_attri->check_dissolved = abap_true.
CASE lr_attri->o_typedescr->kind.
WHEN cl_abap_typedescr=>kind_struct.
DATA(lt_attri_struc) = diss_struc( lr_attri ).
INSERT LINES OF lt_attri_struc INTO TABLE lt_attri_new.
WHEN cl_abap_typedescr=>kind_ref.
CASE lr_attri->o_typedescr->type_kind.
WHEN cl_abap_typedescr=>typekind_oref.
DATA(lt_attri_oref) = diss_oref( lr_attri ).
INSERT LINES OF lt_attri_oref INTO TABLE lt_attri_new.
WHEN cl_abap_typedescr=>typekind_dref.
DATA(lt_attri_dref) = diss_dref( lr_attri ).
INSERT LINES OF lt_attri_dref INTO TABLE lt_attri_new.
WHEN OTHERS.
ASSERT 1 = 0.
ENDCASE.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
INSERT LINES OF lt_attri_new INTO TABLE mt_attri->*.
ENDMETHOD.
ENDCLASS.

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_CORE_DISSOLVE_SRV</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - backend attri dissolver</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

View File

@ -5,7 +5,7 @@ CLASS z2ui5_cl_core_draft_srv DEFINITION
PUBLIC SECTION.
METHODS count
METHODS count_entries
RETURNING
VALUE(result) TYPE i.
@ -48,7 +48,7 @@ CLASS z2ui5_cl_core_draft_srv IMPLEMENTATION.
METHOD cleanup.
DATA(lv_four_hours_ago) = z2ui5_cl_util=>time_substract_seconds(
time = z2ui5_cl_util=>time_get_timestampl( )
time = z2ui5_cl_util=>time_get_timestampl( )
seconds = 60 * 60 * 4 ).
DELETE FROM z2ui5_t_core_01 WHERE timestampl < @lv_four_hours_ago.
@ -86,19 +86,18 @@ CLASS z2ui5_cl_core_draft_srv IMPLEMENTATION.
SELECT SINGLE *
FROM z2ui5_t_core_01
WHERE id = @id
INTO @result.
INTO @result ##SUBRC_OK.
ELSE.
SELECT SINGLE id, id_prev, id_prev_app, id_prev_app_stack
FROM z2ui5_t_core_01
WHERE id = @id
INTO CORRESPONDING FIELDS OF @result.
INTO CORRESPONDING FIELDS OF @result ##SUBRC_OK.
ENDIF.
IF sy-subrc <> 0.
* ASSERT 1 = 0.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `NO_DRAFT_ENTRY_OF_PREVIOUS_REQUEST_FOUND`.
@ -123,12 +122,14 @@ CLASS z2ui5_cl_core_draft_srv IMPLEMENTATION.
result = CORRESPONDING #( ls_db ).
ENDMETHOD.
METHOD count.
METHOD count_entries.
SELECT
COUNT( * )
FROM z2ui5_t_core_01
INTO @result.
COUNT( * )
FROM z2ui5_t_core_01
INTO @result.
ENDMETHOD.

View File

@ -50,6 +50,7 @@ CLASS z2ui5_cl_core_event_srv IMPLEMENTATION.
ENDMETHOD.
METHOD get_t_arg.
IF val IS NOT INITIAL.

View File

@ -15,7 +15,7 @@ CLASS ltcl_test IMPLEMENTATION.
METHOD event.
DATA(lo_event) = NEW z2ui5_cl_core_event_srv( ).
DATA(lv_event) = lo_event->get_event( `POST`).
DATA(lv_event) = lo_event->get_event( `POST` ).
cl_abap_unit_assert=>assert_equals(
act = lv_event

View File

@ -19,13 +19,13 @@ CLASS z2ui5_cl_core_json_srv DEFINITION
RETURNING
VALUE(result) TYPE string.
METHODS model_client_to_server
METHODS model_front_to_back
IMPORTING
!view TYPE string
!t_attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri
!model TYPE REF TO z2ui5_if_ajson.
METHODS model_server_to_client
METHODS model_back_to_front
IMPORTING
!t_attri TYPE z2ui5_if_core_types=>ty_t_attri
RETURNING
@ -40,11 +40,11 @@ ENDCLASS.
CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
METHOD model_client_to_server.
METHOD model_front_to_back.
LOOP AT t_attri->* REFERENCE INTO DATA(lr_attri)
WHERE bind_type = z2ui5_if_core_types=>cs_bind_type-two_way
AND view = view.
WHERE bind_type = z2ui5_if_core_types=>cs_bind_type-two_way
AND view = view.
TRY.
DATA(lo_val_front) = model->slice( lr_attri->name_client ).
@ -73,28 +73,22 @@ CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
ENDMETHOD.
METHOD model_server_to_client.
METHOD model_back_to_front.
TRY.
DATA(ajson_result) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
LOOP AT t_attri REFERENCE INTO DATA(lr_attri) WHERE bind_type <> ``.
"(1) set pretty mode
IF lr_attri->custom_mapper IS BOUND.
DATA(ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = lr_attri->custom_mapper ) ).
ELSE.
ajson = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ).
ENDIF.
DATA(ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>new( ) ).
"(2) read attribute of end-user app & write to json
CASE lr_attri->bind_type.
WHEN z2ui5_if_core_types=>cs_bind_type-one_way
OR z2ui5_if_core_types=>cs_bind_type-two_way.
OR z2ui5_if_core_types=>cs_bind_type-two_way.
ASSIGN lr_attri->r_ref->* TO FIELD-SYMBOL(<attribute>).
ASSERT sy-subrc = 0.
ajson->set( iv_ignore_empty = abap_false iv_path = `/` iv_val = <attribute> ).
ajson->set( iv_ignore_empty = abap_false iv_path = `/` iv_val = <attribute> ).
WHEN z2ui5_if_core_types=>cs_bind_type-one_time.
ajson->set( iv_ignore_empty = abap_false iv_path = `/` iv_val = lr_attri->json_bind_local ).
@ -103,16 +97,18 @@ CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
ASSERT `` = `ERROR_UNKNOWN_BIND_MODE`.
ENDCASE.
"(4) set compress mode
"todo performance - add and filter in a single loop
IF lr_attri->custom_mapper IS BOUND.
ajson = ajson->map( lr_attri->custom_mapper ).
ELSE.
ajson = ajson->map( z2ui5_cl_ajson_mapping=>create_upper_case( ) ).
ENDIF.
IF lr_attri->custom_filter IS BOUND.
ajson = ajson->filter( lr_attri->custom_filter ).
ELSE.
ajson = ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ).
ENDIF.
"(5) write into result
"todo performance - write directly into result
ajson_result->set( iv_path = lr_attri->name_client iv_val = ajson ).
ENDLOOP.
@ -130,19 +126,19 @@ CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
DATA(lo_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>parse( val ) ).
data(lv_model_edit_name) = `/` && z2ui5_if_core_types=>cs_ui5-two_way_model.
DATA(lv_model_edit_name) = `/` && z2ui5_if_core_types=>cs_ui5-two_way_model.
result-o_model = z2ui5_cl_ajson=>create_empty( ).
DATA(lo_model) = lo_ajson->slice( lv_model_edit_name ).
result-o_model->set( iv_path = lv_model_edit_name iv_val = lo_model ).
lo_ajson->delete( lv_model_edit_name ).
lo_ajson = lo_ajson->slice( `/S_FRONT`).
lo_ajson = lo_ajson->slice( `/S_FRONT` ).
lo_ajson->to_abap(
EXPORTING
iv_corresponding = abap_true
IMPORTING
ev_container = result-s_front ).
ev_container = result-s_front ).
result-s_control-check_launchpad = xsdbool( result-s_front-search CS `scenario=LAUNCHPAD` ).
IF result-s_front-id IS NOT INITIAL.
@ -171,7 +167,7 @@ CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
ajson_result->set( iv_path = `/` iv_val = val-s_front ).
ajson_result = ajson_result->filter( NEW z2ui5_cl_core_json_srv( ) ).
DATA(lv_frontend) = ajson_result->stringify( ).
DATA(lv_frontend) = ajson_result->stringify( ).
result = `{` &&
|"S_FRONT":{ lv_frontend },| &&

View File

@ -25,7 +25,7 @@ CLASS ltcl_test IMPLEMENTATION.
origin = `ORIGIN`
pathname = `PATHNAME`
search = `SEARCH`
event = `BUTTON_POST` ) ).
event = `BUTTON_POST` ) ).
cl_abap_unit_assert=>assert_equals(
act = ls_result-s_front
@ -44,5 +44,4 @@ CLASS ltcl_test IMPLEMENTATION.
ENDMETHOD.
ENDCLASS.

View File

@ -1,326 +0,0 @@
CLASS z2ui5_cl_core_model_srv DEFINITION
PUBLIC FINAL
CREATE PUBLIC.
PUBLIC SECTION.
DATA mt_attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri.
DATA mo_app TYPE REF TO object.
METHODS constructor
IMPORTING
attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri
app TYPE REF TO object.
METHODS attri_refs_update.
METHODS attri_before_save.
METHODS attri_after_load.
METHODS search_a_dissolve_attribute
IMPORTING
val TYPE REF TO data
RETURNING
VALUE(result) TYPE REF TO z2ui5_if_core_types=>ty_s_attri.
PROTECTED SECTION.
METHODS dissolve.
METHODS dissolve_main.
METHODS dissolve_init.
METHODS attri_get_val_ref
IMPORTING
iv_path TYPE clike
RETURNING
VALUE(result) TYPE REF TO data.
METHODS diss_struc
IMPORTING
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS diss_dref
IMPORTING
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS diss_oref
IMPORTING ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS search_attribute
IMPORTING
val TYPE REF TO data
RETURNING
VALUE(result) TYPE REF TO z2ui5_if_core_types=>ty_s_attri.
METHODS get_new_attri
IMPORTING
name TYPE string
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_s_attri.
ENDCLASS.
CLASS z2ui5_cl_core_model_srv IMPLEMENTATION.
METHOD attri_after_load.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE data_rtti IS NOT INITIAL
AND type_kind = cl_abap_classdescr=>typekind_dref.
lr_attri->r_ref = attri_get_val_ref( lr_attri->name ).
ASSIGN lr_attri->r_ref->* TO FIELD-SYMBOL(<val>).
z2ui5_cl_util=>xml_srtti_parse(
EXPORTING
rtti_data = lr_attri->data_rtti
IMPORTING
e_data = <val> ).
CLEAR lr_attri->data_rtti.
ENDLOOP.
attri_refs_update( ).
ENDMETHOD.
METHOD attri_before_save.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri).
IF lr_attri->bind_type = z2ui5_if_core_types=>cs_bind_type-one_time.
DELETE mt_attri->*.
CONTINUE.
ENDIF.
IF lr_attri->type_kind <> cl_abap_classdescr=>typekind_dref.
CLEAR lr_attri->r_ref.
CONTINUE.
ENDIF.
ASSIGN lr_attri->r_ref->* TO FIELD-SYMBOL(<val_ref>).
ASSIGN <val_ref>->* TO FIELD-SYMBOL(<val>).
lr_attri->data_rtti = z2ui5_cl_util=>xml_srtti_stringify( <val> ).
CLEAR <val>.
CLEAR <val_ref>.
CLEAR lr_attri->r_ref.
ENDLOOP.
ENDMETHOD.
METHOD search_a_dissolve_attribute.
result = search_attribute( val ).
IF result IS BOUND.
RETURN.
ENDIF.
DO 5 TIMES.
dissolve( ).
result = search_attribute( val ).
IF result IS BOUND.
RETURN.
ENDIF.
ENDDO.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `BINDING_ERROR - No class attribute for binding found - Please check if the binded values are public attributes of your class or switch to bind_local`.
ENDMETHOD.
METHOD attri_get_val_ref.
ASSIGN mo_app->(iv_path) TO FIELD-SYMBOL(<attri>).
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `DEREF_FAILED_TARGET_INITIAL`.
ENDIF.
GET REFERENCE OF <attri> INTO result.
IF sy-subrc <> 0.
ASSERT 1 = 0.
ENDIF.
ENDMETHOD.
METHOD attri_refs_update.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE bind_type <> z2ui5_if_core_types=>cs_bind_type-one_time.
lr_attri->r_ref = attri_get_val_ref( lr_attri->name ).
ENDLOOP.
ENDMETHOD.
METHOD constructor.
mt_attri = attri.
mo_app = app.
ENDMETHOD.
METHOD dissolve.
IF mt_attri->* IS INITIAL.
dissolve_init( ).
RETURN.
ENDIF.
dissolve_main( ).
ENDMETHOD.
METHOD dissolve_init.
DATA(ls_attri) = VALUE z2ui5_if_core_types=>ty_s_attri( r_ref = REF #( mo_app ) ).
DATA(lt_init) = diss_oref( REF #( ls_attri ) ).
INSERT LINES OF lt_init INTO TABLE mt_attri->*.
ENDMETHOD.
METHOD dissolve_main.
DATA(lt_attri_new) = VALUE z2ui5_if_core_types=>ty_t_attri( ).
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE check_dissolved = abap_false.
lr_attri->check_dissolved = abap_true.
CASE lr_attri->type_kind.
WHEN cl_abap_typedescr=>typekind_struct1
OR cl_abap_typedescr=>typekind_struct2.
DATA(lt_attri_struc) = diss_struc( lr_attri ).
INSERT LINES OF lt_attri_struc INTO TABLE lt_attri_new.
WHEN cl_abap_typedescr=>typekind_oref.
DATA(lt_attri_oref) = diss_oref( lr_attri ).
INSERT LINES OF lt_attri_oref INTO TABLE lt_attri_new.
WHEN cl_abap_typedescr=>typekind_dref.
DATA(lt_attri_dref) = diss_dref( lr_attri ).
INSERT LINES OF lt_attri_dref INTO TABLE lt_attri_new.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
INSERT LINES OF lt_attri_new INTO TABLE mt_attri->*.
ENDMETHOD.
METHOD diss_dref.
DATA(lr_ref) = z2ui5_cl_util=>unassign_data( ir_attri->r_ref ).
IF lr_ref IS INITIAL.
RETURN.
ENDIF.
DATA(ls_attri2) = VALUE z2ui5_if_core_types=>ty_s_attri( ).
ls_attri2-o_typedescr = cl_abap_datadescr=>describe_by_data_ref( lr_ref ).
ls_attri2-type_kind = z2ui5_cl_util=>rtti_get_type_kind_by_descr( ls_attri2-o_typedescr ).
CASE ls_attri2-o_typedescr->type_kind.
WHEN cl_abap_datadescr=>typekind_struct1
OR cl_abap_datadescr=>typekind_struct2.
DATA(lt_attri) = diss_struc( ir_attri ).
INSERT LINES OF lt_attri INTO TABLE result.
WHEN OTHERS.
ls_attri2-name = ir_attri->name && `->*`.
ls_attri2-r_ref = attri_get_val_ref( ls_attri2-name ).
INSERT ls_attri2 INTO TABLE result.
ENDCASE.
ENDMETHOD.
METHOD diss_oref.
IF z2ui5_cl_util=>check_unassign_inital( ir_attri->r_ref ).
RETURN.
ENDIF.
DATA(lv_name) = COND #( WHEN ir_attri->name IS NOT INITIAL THEN ir_attri->name && `->` ).
DATA(lr_ref) = z2ui5_cl_util=>unassign_object( ir_attri->r_ref ).
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_oref( lr_ref ).
LOOP AT lt_attri REFERENCE INTO DATA(lr_attri)
WHERE visibility = cl_abap_objectdescr=>public
AND is_interface = abap_false
AND is_constant = abap_false.
TRY.
DATA(ls_new) = get_new_attri( lv_name && lr_attri->name ).
INSERT ls_new INTO TABLE result.
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD diss_struc.
IF ir_attri->type_kind = cl_abap_typedescr=>typekind_dref.
DATA(lv_name) = ir_attri->name && `->`.
DATA(lr_ref) = z2ui5_cl_util=>unassign_data( ir_attri->r_ref ).
ELSE.
lv_name = ir_attri->name && `-`.
lr_ref = ir_attri->r_ref.
ENDIF.
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( lr_ref ).
LOOP AT lt_attri INTO DATA(ls_attri).
DATA(ls_new) = get_new_attri( lv_name && ls_attri-name ).
INSERT ls_new INTO TABLE result.
ENDLOOP.
ENDMETHOD.
METHOD search_attribute.
* result = REF #( mt_attri->*[ r_ref = val ] OPTIONAL ).
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE type_kind <> cl_abap_typedescr=>typekind_dref
AND type_kind <> cl_abap_typedescr=>typekind_oref.
IF lr_attri->r_ref = val.
result = lr_attri.
RETURN.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD get_new_attri.
result = VALUE z2ui5_if_core_types=>ty_s_attri( ).
result-name = name.
result-r_ref = attri_get_val_ref( name ).
result-o_typedescr = cl_abap_datadescr=>describe_by_data_ref( result-r_ref ).
result-type_kind = z2ui5_cl_util=>rtti_get_type_kind_by_descr( result-o_typedescr ).
ENDMETHOD.
ENDCLASS.

View File

@ -1,257 +0,0 @@
CLASS ltcl_test_dissolve DEFINITION DEFERRED.
CLASS z2ui5_cl_core_model_srv DEFINITION LOCAL FRIENDS ltcl_test_dissolve.
CLASS ltcl_test_dissolve DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PUBLIC SECTION.
TYPES:
BEGIN OF s_01,
input TYPE string,
BEGIN OF s_02,
input TYPE string,
BEGIN OF s_03,
input TYPE string,
BEGIN OF s_04,
input TYPE string,
END OF s_04,
END OF s_03,
END OF s_02,
END OF s_01.
DATA ms_struc TYPE s_01 ##NEEDED.
DATA mv_value TYPE string ##NEEDED.
DATA mr_value TYPE REF TO data.
DATA mr_struc TYPE REF TO s_01.
DATA mo_app TYPE REF TO ltcl_test_dissolve.
PRIVATE SECTION.
METHODS test_dissolve_init FOR TESTING RAISING cx_static_check.
METHODS test_dissolve_struc FOR TESTING RAISING cx_static_check.
METHODS test_dissolve_dref FOR TESTING RAISING cx_static_check.
METHODS test_dissolve_oref FOR TESTING RAISING cx_static_check.
METHODS test_ref FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_test_dissolve IMPLEMENTATION.
METHOD test_ref.
DATA(lo_app) = NEW ltcl_test_dissolve( ).
DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_model->dissolve( ).
DATA(ls_attri) = lt_attri[ name = `MV_VALUE` ].
GET REFERENCE OF lo_app->mv_value INTO DATA(lr_ref).
IF ls_attri-r_ref <> lr_ref.
cl_abap_unit_assert=>abort( ).
ENDIF.
ENDMETHOD.
METHOD test_dissolve_init.
DATA(lo_app) = NEW ltcl_test_dissolve( ).
DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MR_STRUC` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MR_VALUE` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MV_VALUE` ] OPTIONAL ) ).
ENDMETHOD.
METHOD test_dissolve_dref.
DATA(lo_app) = NEW ltcl_test_dissolve( ).
CREATE DATA lo_app->mr_struc.
CREATE DATA lo_app->mr_value TYPE string.
DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MR_VALUE->*` ] OPTIONAL ) ).
ENDMETHOD.
METHOD test_dissolve_oref.
DATA(lo_app) = NEW ltcl_test_dissolve( ).
lo_app->mo_app = NEW #( ).
DATA(lo_app2) = NEW ltcl_test_dissolve( ).
lo_app2->mo_app = lo_app.
CREATE DATA lo_app->mo_app->mr_struc.
CREATE DATA lo_app->mo_app->mr_value TYPE string.
DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app2 ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MV_VALUE` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MR_STRUC` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MR_VALUE` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MO_APP->MS_STRUC` ] OPTIONAL ) ).
ENDMETHOD.
METHOD test_dissolve_struc.
DATA(lo_app) = NEW ltcl_test_dissolve( ).
DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
lo_model->dissolve( ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC-INPUT` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC-S_02-INPUT` ] OPTIONAL ) ).
cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_attri[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` ] OPTIONAL ) ).
ENDMETHOD.
ENDCLASS.
CLASS ltcl_test_app2 DEFINITION FINAL FOR TESTING
DURATION MEDIUM
RISK LEVEL HARMLESS.
PUBLIC SECTION.
DATA mv_value TYPE string ##NEEDED.
DATA mr_value TYPE REF TO data.
DATA mr_value2 TYPE REF TO data.
DATA mo_app TYPE REF TO ltcl_test_app2.
DATA xx TYPE string ##NEEDED.
METHODS constructor.
ENDCLASS.
CLASS ltcl_test_app2 IMPLEMENTATION.
METHOD constructor.
ENDMETHOD.
ENDCLASS.
CLASS ltcl_test_search_attri DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS first_test FOR TESTING RAISING cx_static_check.
METHODS second_test FOR TESTING RAISING cx_static_check.
METHODS third_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS z2ui5_cl_core_model_srv DEFINITION LOCAL FRIENDS ltcl_test_search_attri.
CLASS ltcl_test_search_attri IMPLEMENTATION.
METHOD first_test.
DATA(lo_app_client) = NEW ltcl_test_app2( ).
DATA lr_value TYPE REF TO data.
GET REFERENCE OF lo_app_client->mv_value INTO lr_value.
DATA(lt_attri) = VALUE z2ui5_if_core_types=>ty_t_attri( ( r_ref = lr_value ) ).
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app_client ).
DATA(lr_attri) = lo_model->search_a_dissolve_attribute( REF #( lo_app_client->mv_value ) ).
IF lr_attri->r_ref <> lr_value.
cl_abap_unit_assert=>abort( ).
ENDIF.
ENDMETHOD.
METHOD second_test.
DATA(lo_app_client) = NEW ltcl_test_app2( ).
DATA lr_value TYPE REF TO data.
GET REFERENCE OF lo_app_client->mv_value INTO lr_value.
DATA(lt_attri) = VALUE z2ui5_if_core_types=>ty_t_attri( ( r_ref = REF #( lo_app_client->mv_value ) ) ).
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app_client ).
DATA(lr_attri) = lo_model->search_a_dissolve_attribute( REF #( lo_app_client->mv_value ) ).
IF lr_attri->r_ref <> lr_value.
cl_abap_unit_assert=>abort( ).
ENDIF.
ENDMETHOD.
METHOD third_test.
DATA(lo_app_client) = NEW ltcl_test_app2( ).
DATA lr_value TYPE REF TO data.
GET REFERENCE OF lo_app_client->mv_value INTO lr_value.
lo_app_client->mo_app = NEW #( ).
DATA(lt_attri) = VALUE z2ui5_if_core_types=>ty_t_attri(
( name = `1` r_ref = REF #( lo_app_client->mr_value ) )
( name = `4` r_ref = REF #( lo_app_client->mr_value2 ) )
( name = `2` r_ref = REF #( lo_app_client->mo_app ) )
( name = `3` r_ref = REF #( lo_app_client->mv_value ) )
).
DATA(lr_attri) = REF #( lt_attri[ r_ref = lr_value ] ).
IF lr_attri->r_ref <> lr_value.
cl_abap_unit_assert=>abort( ).
ENDIF.
ENDMETHOD.
ENDCLASS.

View File

@ -42,11 +42,13 @@ CLASS z2ui5_cl_core_action DEFINITION
val TYPE REF TO z2ui5_cl_core_http_post.
PROTECTED SECTION.
METHODS prepare_app_stack
IMPORTING
val TYPE z2ui5_if_core_types=>ty_s_next-o_app_leave
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_core_action.
PRIVATE SECTION.
ENDCLASS.
@ -73,7 +75,7 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION.
result->ms_actual-view = mo_http_post->ms_request-s_front-view.
result->mo_app->model_json_parse(
iv_view = mo_http_post->ms_request-s_front-view
iv_view = mo_http_post->ms_request-s_front-view
io_model = mo_http_post->ms_request-o_model ).
result->ms_actual-event = mo_http_post->ms_request-s_front-event.

View File

@ -3,7 +3,7 @@ CLASS ltcl_test DEFINITION FINAL FOR TESTING
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
METHODS
first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.

View File

@ -68,7 +68,7 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
TRY.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
DATA(lo_model) = NEW z2ui5_cl_core_attri_srv(
attri = REF #( mt_attri )
app = mo_app ).
lo_model->attri_before_save( ).
@ -92,7 +92,7 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
DATA(ls_db) = lo_db->read_draft( id ).
result = all_xml_parse( ls_db-data ).
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
DATA(lo_model) = NEW z2ui5_cl_core_attri_srv(
attri = REF #( result->mt_attri )
app = result->mo_app ).
@ -109,7 +109,7 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
result->mo_app = app.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
DATA(lo_model) = NEW z2ui5_cl_core_attri_srv(
attri = REF #( result->mt_attri )
app = result->mo_app ).
@ -135,7 +135,7 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
METHOD model_json_parse.
DATA(lo_json_mapper) = NEW z2ui5_cl_core_json_srv( ).
lo_json_mapper->model_client_to_server(
lo_json_mapper->model_front_to_back(
view = iv_view
t_attri = REF #( mt_attri )
model = io_model ).
@ -146,7 +146,7 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
METHOD model_json_stringify.
DATA(lo_json_mapper) = NEW z2ui5_cl_core_json_srv( ).
result = lo_json_mapper->model_server_to_client( mt_attri ).
result = lo_json_mapper->model_back_to_front( mt_attri ).
ENDMETHOD.
ENDCLASS.

View File

@ -3,7 +3,7 @@ CLASS ltcl_test DEFINITION FINAL FOR TESTING
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
METHODS
first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.

View File

@ -31,10 +31,9 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
METHOD z2ui5_if_client~clear.
CASE val.
WHEN z2ui5_if_client=>cs_clear-view.
CLEAR mo_action->ms_next-s_set-s_view.
ENDCASE.
IF val = z2ui5_if_client=>cs_clear-view.
CLEAR mo_action->ms_next-s_set-s_view.
ENDIF.
ENDMETHOD.
@ -47,8 +46,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
t_event_arg = mo_action->ms_actual-t_event_arg
s_draft = CORRESPONDING #( mo_action->mo_app->ms_draft )
check_on_navigated = mo_action->ms_actual-check_on_navigated
s_config = CORRESPONDING #( mo_action->mo_http_post->ms_request-s_front )
).
s_config = CORRESPONDING #( mo_action->mo_http_post->ms_request-s_front ) ).
ENDMETHOD.
@ -222,11 +220,11 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
val = z2ui5_cl_util=>conv_get_as_data_ref( val )
type = z2ui5_if_core_types=>cs_bind_type-one_way
config = VALUE #(
path_only = path
path_only = path
custom_filter = custom_filter
custom_mapper = custom_mapper
tab = z2ui5_cl_util=>conv_get_as_data_ref( tab )
tab_index = tab_index ) ).
tab = z2ui5_cl_util=>conv_get_as_data_ref( tab )
tab_index = tab_index ) ).
ENDMETHOD.
@ -246,13 +244,13 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
val = z2ui5_cl_util=>conv_get_as_data_ref( val )
type = z2ui5_if_core_types=>cs_bind_type-two_way
config = VALUE #(
path_only = path
custom_filter = custom_filter
path_only = path
custom_filter = custom_filter
custom_filter_back = custom_filter_back
custom_mapper = custom_mapper
custom_mapper = custom_mapper
custom_mapper_back = custom_mapper_back
tab = z2ui5_cl_util=>conv_get_as_data_ref( tab )
tab_index = tab_index ) ).
tab = z2ui5_cl_util=>conv_get_as_data_ref( tab )
tab_index = tab_index ) ).
ENDMETHOD.
@ -263,9 +261,9 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
result = lo_bind->main_local(
val = val
config = VALUE #(
path_only = path
path_only = path
custom_mapper = custom_mapper
custom_filter = custom_filter ) ).
custom_filter = custom_filter ) ).
ENDMETHOD.
@ -285,8 +283,8 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
DATA(lo_ui5) = NEW z2ui5_cl_core_event_srv( ).
result = lo_ui5->get_event_client(
val = val
t_arg = t_arg ).
val = val
t_arg = t_arg ).
ENDMETHOD.
ENDCLASS.

View File

@ -1,6 +1,6 @@
CLASS ltcl_test_client DEFINITION FINAL FOR TESTING
DURATION LONG
RISK LEVEL harmless.
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS first_test FOR TESTING RAISING cx_static_check.

View File

@ -52,418 +52,418 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
METHOD get_js.
result = `sap.ui.define("z2ui5/Controller", ["sap/ui/core/mvc/Controller", "sap/ui/core/mvc/XMLView", "sap/ui/model/json/JSONModel", "sap/ui/core/BusyIndicator", "sap/m/MessageBox", "sap/m/MessageToast", "sap/ui/core/Fragment"], function(Control` &&
`ler, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment) {` && |\n| &&
` "use strict";` && |\n| &&
` return Controller.extend("z2ui5.Controller", {` && |\n| &&
` async onAfterRendering() {` && |\n| &&
` try{` && |\n| &&
` if (!sap.z2ui5.oResponse.PARAMS) {` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.busyDialog) {` && |\n| &&
` sap.z2ui5.busyDialog.close();` && |\n| &&
` }` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = sap.z2ui5.oResponse.PARAMS;` && |\n| &&
` if (S_POPUP?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` }` && |\n| &&
` if (S_POPOVER?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
` }` && |\n| &&
` if (S_POPUP?.XML) {` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
` }` && |\n| &&
` if (!sap.z2ui5.checkNestAfter) {` && |\n| &&
` if (S_VIEW_NEST?.XML) {` && |\n| &&
` sap.z2ui5.oController.NestViewDestroy();` && |\n| &&
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
` sap.z2ui5.checkNestAfter = true;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (!sap.z2ui5.checkNestAfter2) {` && |\n| &&
` if (S_VIEW_NEST2?.XML) {` && |\n| &&
` sap.z2ui5.oController.NestViewDestroy2();` && |\n| &&
` await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
` sap.z2ui5.checkNestAfter2 = true;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (S_POPOVER?.XML) {` && |\n| &&
` await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
` }` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.busyDialog) {` && |\n| &&
` sap.z2ui5.busyDialog.close();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.onAfterRendering.forEach(item=>{` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item();` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
`ler, XMLView, JSONModel, BusyIndicator, MessageBox, MessageToast, Fragment) {` && |\n| &&
` "use strict";` && |\n| &&
` return Controller.extend("z2ui5.Controller", {` && |\n| &&
` async onAfterRendering() {` && |\n| &&
` try{` && |\n| &&
` if (!sap.z2ui5.oResponse.PARAMS) {` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.busyDialog) {` && |\n| &&
` sap.z2ui5.busyDialog.close();` && |\n| &&
` }` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` const {S_POPUP, S_VIEW_NEST, S_VIEW_NEST2, S_POPOVER} = sap.z2ui5.oResponse.PARAMS;` && |\n| &&
` if (S_POPUP?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` }` && |\n| &&
` if (S_POPOVER?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
` }` && |\n| &&
` if (S_POPUP?.XML) {` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` await this.displayFragment(S_POPUP.XML, 'oViewPopup');` && |\n| &&
` }` && |\n| &&
` if (!sap.z2ui5.checkNestAfter) {` && |\n| &&
` if (S_VIEW_NEST?.XML) {` && |\n| &&
` sap.z2ui5.oController.NestViewDestroy();` && |\n| &&
` await this.displayNestedView(S_VIEW_NEST.XML, 'oViewNest', 'S_VIEW_NEST');` && |\n| &&
` sap.z2ui5.checkNestAfter = true;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (!sap.z2ui5.checkNestAfter2) {` && |\n| &&
` if (S_VIEW_NEST2?.XML) {` && |\n| &&
` sap.z2ui5.oController.NestViewDestroy2();` && |\n| &&
` await this.displayNestedView2(S_VIEW_NEST2.XML, 'oViewNest2', 'S_VIEW_NEST2');` && |\n| &&
` sap.z2ui5.checkNestAfter2 = true;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` if (S_POPOVER?.XML) {` && |\n| &&
` await this.displayPopover(S_POPOVER.XML, 'oViewPopover', S_POPOVER.OPEN_BY_ID);` && |\n| &&
` }` && |\n| &&
` BusyIndicator.hide();` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.busyDialog) {` && |\n| &&
` sap.z2ui5.busyDialog.close();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.onAfterRendering.forEach(item=>{` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item();` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
` }catch(e){ BusyIndicator.hide(); sap.z2ui5.isBusy = false; MessageBox.error( e.toLocaleString() , { title : "Unexpected Error Occured - App Terminated" , actions : [ ] , onClose : () => { new sap.m.BusyDialog({ text : "Please Restart t` &&
`he App" }).open(); } } ) }` && |\n| &&
` },` && |\n| &&
|\n| &&
` async displayFragment(xml, viewProp, openById) {` && |\n| &&
` const oFragment = await Fragment.load({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerPopup,` && |\n| &&
` id: "popupId"` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` let oControl = openById ? sap.z2ui5.oView.byId(openById) : null;` && |\n| &&
` if (oControl) {` && |\n| &&
` oFragment.openBy(oControl);` && |\n| &&
` } else {` && |\n| &&
` oFragment.open();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` },` && |\n| &&
` async displayPopover(xml, viewProp, openById) {` && |\n| &&
` const oFragment = await Fragment.load({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerPopover,` && |\n| &&
` id: "popoverId"` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` let oControl = openById ? sap.z2ui5.oView.byId(openById) : null;` && |\n| &&
` if (oControl) {` && |\n| &&
` oFragment.openBy(oControl);` && |\n| &&
` } else {` && |\n| &&
` oFragment.open();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` },` && |\n| &&
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerNest,` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
` try {` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
` } catch {}` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oView;` && |\n| &&
` },` && |\n| &&
` async displayNestedView2(xml, viewProp, viewNestId) {` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerNest2,` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
` try {` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
` } catch {}` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oView;` && |\n| &&
` },` && |\n| &&
` PopupDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewPopup) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oViewPopup.close) {` && |\n| &&
` try {` && |\n| &&
` sap.z2ui5.oViewPopup.close();` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewPopup.destroy();` && |\n| &&
` },` && |\n| &&
` PopoverDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewPopover) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oViewPopover.close) {` && |\n| &&
` try {` && |\n| &&
` sap.z2ui5.oViewPopover.close();` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
` },` && |\n| &&
` NestViewDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewNest) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewNest.destroy();` && |\n| &&
` },` && |\n| &&
` NestViewDestroy2() {` && |\n| &&
` if (!sap.z2ui5.oViewNest2) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewNest2.destroy();` && |\n| &&
` },` && |\n| &&
` ViewDestroy() {` && |\n| &&
` if (!sap.z2ui5.oView) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oView.destroy();` && |\n| &&
` },` && |\n| &&
` eF(...args) {` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item(args);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
` let oCrossAppNavigator;` && |\n| &&
` switch (args[0]) {` && |\n| &&
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
` break;` && |\n| &&
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` const hash = (oCrossAppNavigator.hrefForExternal({` && |\n| &&
` target: args[1],` && |\n| &&
` params: args[2]` && |\n| &&
` })) || "";` && |\n| &&
` if (args[3] === 'EXT') {` && |\n| &&
` let url = window.location.href.split('#')[0] + hash;` && |\n| &&
` sap.m.URLHelper.redirect(url, true);` && |\n| &&
` } else {` && |\n| &&
` oCrossAppNavigator.toExternal({` && |\n| &&
` target: {` && |\n| &&
` shellHash: hash` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` break;` && |\n| &&
` case 'LOCATION_RELOAD':` && |\n| &&
` window.location = args[1];` && |\n| &&
` break;` && |\n| &&
` case 'OPEN_NEW_TAB':` && |\n| &&
` window.open(args[1], '_blank');` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_CLOSE':` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` break;` && |\n| &&
` case 'POPOVER_CLOSE':` && |\n| &&
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
` break;` && |\n| &&
` case 'NAV_CONTAINER_TO':` && |\n| &&
` var navCon = sap.z2ui5.oView.byId(args[1]);` && |\n| &&
` var navConTo = sap.z2ui5.oView.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
` navCon = sap.z2ui5.oViewNest.byId(args[1]);` && |\n| &&
` navConTo = sap.z2ui5.oViewNest.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
` navCon = sap.z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
` navConTo = sap.z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_NAV_CONTAINER_TO':` && |\n| &&
` navCon = Fragment.byId("popupId",args[1]);` && |\n| &&
` navConTo = Fragment.byId("popupId",args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` eB(...args) {` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` if (sap.z2ui5.isBusy == true) {` && |\n| &&
` sap.z2ui5.busyDialog = new sap.m.BusyDialog();` && |\n| &&
` sap.z2ui5.busyDialog.open();` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.isBusy = true;` && |\n| &&
` if (!window.navigator.onLine) {` && |\n| &&
` sap.m.MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` BusyIndicator.show();` && |\n| &&
` let appStart = sap.z2ui5.oBody.APP_START;` && |\n| &&
` sap.z2ui5.oBody = {};` && |\n| &&
` sap.z2ui5.oBody.APP_START = appStart;` && |\n| &&
` if ( sap.z2ui5.oController == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oView.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ` && |\n| &&
` ( sap.z2ui5.oControllerPopup == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewPopup.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ( ` && |\n| &&
` sap.z2ui5.oControllerPopover == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewPopover.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ( ` && |\n| &&
` sap.z2ui5.oControllerNest == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewNest.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
` }else if (` && |\n| &&
` sap.z2ui5.oControllerNest2 == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewNest2.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'NEST2';` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip.forEach(item=>{` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item();` && |\n| &&
` }})` && |\n| &&
` if (args[0][1]) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oBody.ID = sap.z2ui5.oResponse.ID;` && |\n| &&
` sap.z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
` sap.z2ui5.oResponseOld = sap.z2ui5.oResponse;` && |\n| &&
` sap.z2ui5.oResponse = {};` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` },` && |\n| &&
` responseError(response) {` && |\n| &&
` document.write(response);` && |\n| &&
` },` && |\n| &&
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS == undefined) { return; }` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
` let model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(model);` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async responseSuccess(response) {` && |\n| &&
` try{` && |\n| &&
` sap.z2ui5.oResponse = response;` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oController.showMessage('S_MSG_TOAST', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
` sap.z2ui5.oController.showMessage('S_MSG_BOX', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML) { if ( sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML !== '') {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` await sap.z2ui5.oController.createView(sap.z2ui5.oResponse.PARAMS.S_VIEW.XML, sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` return; } } ` && |\n| &&
` this.updateModelIfRequired('S_VIEW', sap.z2ui5.oView);` && |\n| &&
` this.updateModelIfRequired('S_VIEW_NEST', sap.z2ui5.oViewNest);` && |\n| &&
` this.updateModelIfRequired('S_VIEW_NEST2', sap.z2ui5.oViewNest2);` && |\n| &&
` this.updateModelIfRequired('S_POPUP', sap.z2ui5.oViewPopup);` && |\n| &&
` this.updateModelIfRequired('S_POPOVER', sap.z2ui5.oViewPopover);` && |\n| &&
` sap.z2ui5.oController.onAfterRendering();` && |\n| &&
` }catch(e){ BusyIndicator.hide(); MessageBox.error(e.toLocaleString()); }` && |\n| &&
` },` && |\n| &&
` showMessage(msgType, params) {` && |\n| &&
` if (params == undefined) { return; }` && |\n| &&
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
` MessageToast.show(params[msgType].TEXT);` && |\n| &&
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async createView(xml, viewModel) {` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oController,` && |\n| &&
` id: 'mainView',` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` if (sap.z2ui5.oParent) {` && |\n| &&
` sap.z2ui5.oParent.removeAllPages();` && |\n| &&
` sap.z2ui5.oParent.insertPage(oView);` && |\n| &&
` } else {` && |\n| &&
` oView.placeAt("content");` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oView = oView;` && |\n| &&
` },` && |\n| &&
` async readHttp() {` && |\n| &&
` const response = await fetch(sap.z2ui5.pathname, {` && |\n| &&
` method: 'POST',` && |\n| &&
` headers: {` && |\n| &&
` 'Content-Type': 'application/json'` && |\n| &&
` },` && |\n| &&
` body: JSON.stringify(sap.z2ui5.oBody)` && |\n| &&
` });` && |\n| &&
` if (!response.ok) {` && |\n| &&
` const responseText = await response.text();` && |\n| &&
` sap.z2ui5.oController.responseError(responseText);` && |\n| &&
` } else {` && |\n| &&
` const responseData = await response.json();` && |\n| &&
` sap.z2ui5.responseData = responseData;` && |\n| &&
` if( !sap.z2ui5.oBody.APP_START ) { sap.z2ui5.oBody.APP_START = sap.z2ui5.responseData.S_FRONT.APP; }` && |\n| &&
` sap.z2ui5.oController.responseSuccess({` && |\n| &&
` ID : responseData.S_FRONT.ID,` && |\n| &&
` PARAMS : responseData.S_FRONT.PARAMS,` && |\n| &&
` OVIEWMODEL : responseData.MODEL,` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` Roundtrip() {` && |\n| &&
` sap.z2ui5.checkTimerActive = false;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
` let event = (args) => { if ( args != undefined ) { return args[0][0]; } };` && |\n| &&
` sap.z2ui5.oBody.S_FRONT = {` && |\n| &&
` ID: sap.z2ui5?.oBody?.ID,` && |\n| &&
` APP_START: sap.z2ui5?.oBody?.APP_START,` && |\n| &&
` XX: sap.z2ui5?.oBody?.XX,` && |\n| &&
` ORIGIN: window.location.origin,` && |\n| &&
` PATHNAME: sap.z2ui5.pathname,` && |\n| &&
` SEARCH: (sap.z2ui5.search) ? sap.z2ui5.search : window.location.search,` && |\n| &&
` VIEW: sap.z2ui5.oBody.VIEWNAME,` && |\n| &&
` T_STARTUP_PARAMETERS: sap.z2ui5.startupParameters,` && |\n| &&
` EVENT: event(sap.z2ui5.oBody?.ARGUMENTS),` && |\n| &&
` };` && |\n| &&
` if ( sap.z2ui5.oBody?.ARGUMENTS != undefined ) { if ( sap.z2ui5.oBody?.ARGUMENTS.length > 0 ) { sap.z2ui5.oBody?.ARGUMENTS.shift(); } }` && |\n| &&
` sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG = sap.z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` delete sap.z2ui5.oBody.ID;` && |\n| &&
` delete sap.z2ui5.oBody?.VIEWNAME;` && |\n| &&
` delete sap.z2ui5.oBody?.APP_START;` && |\n| &&
` delete sap.z2ui5.oBody?.S_FRONT.XX;` && |\n| &&
` delete sap.z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` if (!sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG) { delete sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG; } ` && |\n| &&
` if (sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG) { if (sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG.length == 0 ) { delete sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG; } }` && |\n| &&
` if (sap.z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS == undefined) { delete sap.z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS; } ` && |\n| &&
` if ( sap.z2ui5.oBody.S_FRONT.SEARCH == '' ){ delete sap.z2ui5.oBody.S_FRONT.SEARCH; } ` && |\n| &&
` if (!sap.z2ui5.oBody.XX){ delete sap.z2ui5.oBody.XX; } ` && |\n| &&
` sap.z2ui5.oController.readHttp();` && |\n| &&
` },` && |\n| &&
` })` && |\n| &&
`});` && |\n| &&
`sap.ui.require(["z2ui5/Controller", "sap/ui/core/BusyIndicator", "sap/ui/core/mvc/XMLView", "sap/ui/core/Fragment", "sap/m/MessageToast", "sap/m/MessageBox", "sap/ui/model/json/JSONModel"], (Controller,BusyIndicator)=>{` && |\n| &&
` BusyIndicator.show();` && |\n| &&
` sap.z2ui5.oController = new Controller();` && |\n| &&
` sap.z2ui5.oControllerNest = new Controller();` && |\n| &&
` sap.z2ui5.oControllerNest2 = new Controller();` && |\n| &&
` sap.z2ui5.oControllerPopup = new Controller();` && |\n| &&
` sap.z2ui5.oControllerPopover = new Controller();` && |\n| &&
` sap.z2ui5.pathname = sap.z2ui5.pathname || window.location.pathname;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.oBody = {` && |\n| &&
` APP_START: sap.z2ui5.APP_START` && |\n| &&
` };` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
` sap.z2ui5.onAfterRendering = [];` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend = [];` && |\n| &&
` sap.z2ui5.onAfterRoundtrip = []; }` && |\n| &&
` },` && |\n| &&
|\n| &&
` async displayFragment(xml, viewProp, openById) {` && |\n| &&
` const oFragment = await Fragment.load({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerPopup,` && |\n| &&
` id: "popupId"` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` let oControl = openById ? sap.z2ui5.oView.byId(openById) : null;` && |\n| &&
` if (oControl) {` && |\n| &&
` oFragment.openBy(oControl);` && |\n| &&
` } else {` && |\n| &&
` oFragment.open();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` },` && |\n| &&
` async displayPopover(xml, viewProp, openById) {` && |\n| &&
` const oFragment = await Fragment.load({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerPopover,` && |\n| &&
` id: "popoverId"` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oFragment.setModel(oview_model);` && |\n| &&
` let oControl = openById ? sap.z2ui5.oView.byId(openById) : null;` && |\n| &&
` if (oControl) {` && |\n| &&
` oFragment.openBy(oControl);` && |\n| &&
` } else {` && |\n| &&
` oFragment.open();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oFragment;` && |\n| &&
` },` && |\n| &&
` async displayNestedView(xml, viewProp, viewNestId) {` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerNest,` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
` try {` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
` } catch {}` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oView;` && |\n| &&
` },` && |\n| &&
` async displayNestedView2(xml, viewProp, viewNestId) {` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oControllerNest2,` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` let oParent = sap.z2ui5.oView.byId(sap.z2ui5.oResponse.PARAMS[viewNestId].ID);` && |\n| &&
` if (oParent) {` && |\n| &&
` try {` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_DESTROY]();` && |\n| &&
` } catch {}` && |\n| &&
` oParent[sap.z2ui5.oResponse.PARAMS[viewNestId].METHOD_INSERT](oView);` && |\n| &&
` }` && |\n| &&
` sap.z2ui5[viewProp] = oView;` && |\n| &&
` },` && |\n| &&
` PopupDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewPopup) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oViewPopup.close) {` && |\n| &&
` try {` && |\n| &&
` sap.z2ui5.oViewPopup.close();` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewPopup.destroy();` && |\n| &&
` },` && |\n| &&
` PopoverDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewPopover) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` if (sap.z2ui5.oViewPopover.close) {` && |\n| &&
` try {` && |\n| &&
` sap.z2ui5.oViewPopover.close();` && |\n| &&
` } catch {}` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewPopover.destroy();` && |\n| &&
` },` && |\n| &&
` NestViewDestroy() {` && |\n| &&
` if (!sap.z2ui5.oViewNest) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewNest.destroy();` && |\n| &&
` },` && |\n| &&
` NestViewDestroy2() {` && |\n| &&
` if (!sap.z2ui5.oViewNest2) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oViewNest2.destroy();` && |\n| &&
` },` && |\n| &&
` ViewDestroy() {` && |\n| &&
` if (!sap.z2ui5.oView) {` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oView.destroy();` && |\n| &&
` },` && |\n| &&
` eF(...args) {` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item(args);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` )` && |\n| &&
` let oCrossAppNavigator;` && |\n| &&
` switch (args[0]) {` && |\n| &&
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
` break;` && |\n| &&
` case 'CROSS_APP_NAV_TO_EXT':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` const hash = (oCrossAppNavigator.hrefForExternal({` && |\n| &&
` target: args[1],` && |\n| &&
` params: args[2]` && |\n| &&
` })) || "";` && |\n| &&
` if (args[3] === 'EXT') {` && |\n| &&
` let url = window.location.href.split('#')[0] + hash;` && |\n| &&
` sap.m.URLHelper.redirect(url, true);` && |\n| &&
` } else {` && |\n| &&
` oCrossAppNavigator.toExternal({` && |\n| &&
` target: {` && |\n| &&
` shellHash: hash` && |\n| &&
` }` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` break;` && |\n| &&
` case 'LOCATION_RELOAD':` && |\n| &&
` window.location = args[1];` && |\n| &&
` break;` && |\n| &&
` case 'OPEN_NEW_TAB':` && |\n| &&
` window.open(args[1], '_blank');` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_CLOSE':` && |\n| &&
` sap.z2ui5.oController.PopupDestroy();` && |\n| &&
` break;` && |\n| &&
` case 'POPOVER_CLOSE':` && |\n| &&
` sap.z2ui5.oController.PopoverDestroy();` && |\n| &&
` break;` && |\n| &&
` case 'NAV_CONTAINER_TO':` && |\n| &&
` var navCon = sap.z2ui5.oView.byId(args[1]);` && |\n| &&
` var navConTo = sap.z2ui5.oView.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'NEST_NAV_CONTAINER_TO':` && |\n| &&
` navCon = sap.z2ui5.oViewNest.byId(args[1]);` && |\n| &&
` navConTo = sap.z2ui5.oViewNest.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'NEST2_NAV_CONTAINER_TO':` && |\n| &&
` navCon = sap.z2ui5.oViewNest2.byId(args[1]);` && |\n| &&
` navConTo = sap.z2ui5.oViewNest2.byId(args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` case 'POPUP_NAV_CONTAINER_TO':` && |\n| &&
` navCon = Fragment.byId("popupId",args[1]);` && |\n| &&
` navConTo = Fragment.byId("popupId",args[2]);` && |\n| &&
` navCon.to(navConTo);` && |\n| &&
` break;` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` eB(...args) {` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` if (sap.z2ui5.isBusy == true) {` && |\n| &&
` sap.z2ui5.busyDialog = new sap.m.BusyDialog();` && |\n| &&
` sap.z2ui5.busyDialog.open();` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.isBusy = true;` && |\n| &&
` if (!window.navigator.onLine) {` && |\n| &&
` sap.m.MessageBox.alert('No internet connection! Please reconnect to the server and try again.');` && |\n| &&
` sap.z2ui5.isBusy = false;` && |\n| &&
` return;` && |\n| &&
` }` && |\n| &&
` BusyIndicator.show();` && |\n| &&
` let appStart = sap.z2ui5.oBody.APP_START;` && |\n| &&
` sap.z2ui5.oBody = {};` && |\n| &&
` sap.z2ui5.oBody.APP_START = appStart;` && |\n| &&
` if ( sap.z2ui5.oController == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oView.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ` && |\n| &&
` ( sap.z2ui5.oControllerPopup == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewPopup.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ( ` && |\n| &&
` sap.z2ui5.oControllerPopover == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewPopover.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'MAIN';` && |\n| &&
` }else if ( ` && |\n| &&
` sap.z2ui5.oControllerNest == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewNest.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'NEST';` && |\n| &&
` }else if (` && |\n| &&
` sap.z2ui5.oControllerNest2 == this ) {` && |\n| &&
` sap.z2ui5.oBody.XX = sap.z2ui5.oViewNest2.getModel().getData().XX;` && |\n| &&
` sap.z2ui5.oBody.VIEWNAME = 'NEST2';` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip.forEach(item=>{` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item();` && |\n| &&
` }})` && |\n| &&
` if (args[0][1]) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oBody.ID = sap.z2ui5.oResponse.ID;` && |\n| &&
` sap.z2ui5.oBody.ARGUMENTS = args;` && |\n| &&
` sap.z2ui5.oResponseOld = sap.z2ui5.oResponse;` && |\n| &&
` sap.z2ui5.oResponse = {};` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` },` && |\n| &&
` responseError(response) {` && |\n| &&
` document.write(response);` && |\n| &&
` },` && |\n| &&
` updateModelIfRequired(paramKey, oView) {` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS == undefined) { return; }` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS[paramKey]?.CHECK_UPDATE_MODEL) {` && |\n| &&
` let model = new JSONModel(sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(model);` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async responseSuccess(response) {` && |\n| &&
` try{` && |\n| &&
` sap.z2ui5.oResponse = response;` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.CHECK_DESTROY) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oController.showMessage('S_MSG_TOAST', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
` sap.z2ui5.oController.showMessage('S_MSG_BOX', sap.z2ui5.oResponse.PARAMS);` && |\n| &&
` if (sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML) { if ( sap.z2ui5.oResponse.PARAMS?.S_VIEW?.XML !== '') {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` await sap.z2ui5.oController.createView(sap.z2ui5.oResponse.PARAMS.S_VIEW.XML, sap.z2ui5.oResponse.OVIEWMODEL);` && |\n| &&
` return; } } ` && |\n| &&
` this.updateModelIfRequired('S_VIEW', sap.z2ui5.oView);` && |\n| &&
` this.updateModelIfRequired('S_VIEW_NEST', sap.z2ui5.oViewNest);` && |\n| &&
` this.updateModelIfRequired('S_VIEW_NEST2', sap.z2ui5.oViewNest2);` && |\n| &&
` this.updateModelIfRequired('S_POPUP', sap.z2ui5.oViewPopup);` && |\n| &&
` this.updateModelIfRequired('S_POPOVER', sap.z2ui5.oViewPopover);` && |\n| &&
` sap.z2ui5.oController.onAfterRendering();` && |\n| &&
` }catch(e){ BusyIndicator.hide(); MessageBox.error(e.toLocaleString()); }` && |\n| &&
` },` && |\n| &&
` showMessage(msgType, params) {` && |\n| &&
` if (params == undefined) { return; }` && |\n| &&
` if (params[msgType]?.TEXT !== undefined) {` && |\n| &&
` if (msgType === 'S_MSG_TOAST') {` && |\n| &&
` MessageToast.show(params[msgType].TEXT);` && |\n| &&
` } else if (msgType === 'S_MSG_BOX') {` && |\n| &&
` MessageBox[params[msgType].TYPE](params[msgType].TEXT);` && |\n| &&
` }` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` async createView(xml, viewModel) {` && |\n| &&
` const oView = await XMLView.create({` && |\n| &&
` definition: xml,` && |\n| &&
` controller: sap.z2ui5.oController,` && |\n| &&
` id: 'mainView',` && |\n| &&
` });` && |\n| &&
` let oview_model = new JSONModel(viewModel);` && |\n| &&
` oview_model.setSizeLimit(sap.z2ui5.JSON_MODEL_LIMIT);` && |\n| &&
` oView.setModel(oview_model);` && |\n| &&
` if (sap.z2ui5.oParent) {` && |\n| &&
` sap.z2ui5.oParent.removeAllPages();` && |\n| &&
` sap.z2ui5.oParent.insertPage(oView);` && |\n| &&
` } else {` && |\n| &&
` oView.placeAt("content");` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oView = oView;` && |\n| &&
` },` && |\n| &&
` async readHttp() {` && |\n| &&
` const response = await fetch(sap.z2ui5.pathname, {` && |\n| &&
` method: 'POST',` && |\n| &&
` headers: {` && |\n| &&
` 'Content-Type': 'application/json'` && |\n| &&
` },` && |\n| &&
` body: JSON.stringify(sap.z2ui5.oBody)` && |\n| &&
` });` && |\n| &&
` if (!response.ok) {` && |\n| &&
` const responseText = await response.text();` && |\n| &&
` sap.z2ui5.oController.responseError(responseText);` && |\n| &&
` } else {` && |\n| &&
` const responseData = await response.json();` && |\n| &&
` sap.z2ui5.responseData = responseData;` && |\n| &&
` if( !sap.z2ui5.oBody.APP_START ) { sap.z2ui5.oBody.APP_START = sap.z2ui5.responseData.S_FRONT.APP; }` && |\n| &&
` sap.z2ui5.oController.responseSuccess({` && |\n| &&
` ID : responseData.S_FRONT.ID,` && |\n| &&
` PARAMS : responseData.S_FRONT.PARAMS,` && |\n| &&
` OVIEWMODEL : responseData.MODEL,` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` Roundtrip() {` && |\n| &&
` sap.z2ui5.checkTimerActive = false;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
` let event = (args) => { if ( args != undefined ) { return args[0][0]; } };` && |\n| &&
` sap.z2ui5.oBody.S_FRONT = {` && |\n| &&
` ID: sap.z2ui5?.oBody?.ID,` && |\n| &&
` APP_START: sap.z2ui5?.oBody?.APP_START,` && |\n| &&
` XX: sap.z2ui5?.oBody?.XX,` && |\n| &&
` ORIGIN: window.location.origin,` && |\n| &&
` PATHNAME: sap.z2ui5.pathname,` && |\n| &&
` SEARCH: (sap.z2ui5.search) ? sap.z2ui5.search : window.location.search,` && |\n| &&
` VIEW: sap.z2ui5.oBody.VIEWNAME,` && |\n| &&
` T_STARTUP_PARAMETERS: sap.z2ui5.startupParameters,` && |\n| &&
` EVENT: event(sap.z2ui5.oBody?.ARGUMENTS),` && |\n| &&
` };` && |\n| &&
` if ( sap.z2ui5.oBody?.ARGUMENTS != undefined ) { if ( sap.z2ui5.oBody?.ARGUMENTS.length > 0 ) { sap.z2ui5.oBody?.ARGUMENTS.shift(); } }` && |\n| &&
` sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG = sap.z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` delete sap.z2ui5.oBody.ID;` && |\n| &&
` delete sap.z2ui5.oBody?.VIEWNAME;` && |\n| &&
` delete sap.z2ui5.oBody?.APP_START;` && |\n| &&
` delete sap.z2ui5.oBody?.S_FRONT.XX;` && |\n| &&
` delete sap.z2ui5.oBody?.ARGUMENTS;` && |\n| &&
` if (!sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG) { delete sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG; } ` && |\n| &&
` if (sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG) { if (sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG.length == 0 ) { delete sap.z2ui5.oBody.S_FRONT.T_EVENT_ARG; } }` && |\n| &&
` if (sap.z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS == undefined) { delete sap.z2ui5.oBody.S_FRONT.T_STARTUP_PARAMETERS; } ` && |\n| &&
` if ( sap.z2ui5.oBody.S_FRONT.SEARCH == '' ){ delete sap.z2ui5.oBody.S_FRONT.SEARCH; } ` && |\n| &&
` if (!sap.z2ui5.oBody.XX){ delete sap.z2ui5.oBody.XX; } ` && |\n| &&
` sap.z2ui5.oController.readHttp();` && |\n| &&
` },` && |\n| &&
` })` && |\n| &&
`});` && |\n| &&
`sap.ui.require(["z2ui5/Controller", "sap/ui/core/BusyIndicator", "sap/ui/core/mvc/XMLView", "sap/ui/core/Fragment", "sap/m/MessageToast", "sap/m/MessageBox", "sap/ui/model/json/JSONModel"], (Controller,BusyIndicator)=>{` && |\n| &&
` BusyIndicator.show();` && |\n| &&
` sap.z2ui5.oController = new Controller();` && |\n| &&
` sap.z2ui5.oControllerNest = new Controller();` && |\n| &&
` sap.z2ui5.oControllerNest2 = new Controller();` && |\n| &&
` sap.z2ui5.oControllerPopup = new Controller();` && |\n| &&
` sap.z2ui5.oControllerPopover = new Controller();` && |\n| &&
` sap.z2ui5.pathname = sap.z2ui5.pathname || window.location.pathname;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.oBody = {` && |\n| &&
` APP_START: sap.z2ui5.APP_START` && |\n| &&
` };` && |\n| &&
` sap.z2ui5.oController.Roundtrip();` && |\n| &&
` sap.z2ui5.onBeforeRoundtrip = [];` && |\n| &&
` sap.z2ui5.onAfterRendering = [];` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend = [];` && |\n| &&
` sap.z2ui5.onAfterRoundtrip = []; }` && |\n| &&
`);`.
ENDMETHOD.
@ -495,7 +495,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
THEN get_default_config( )
ELSE ms_request-t_config ).
DATA(lv_sec_policy) = COND #( WHEN ms_request-content_security_policy IS INITIAL
DATA(lv_sec_policy) = COND #( WHEN ms_request-content_security_policy IS INITIAL
THEN get_default_security_policy( )
ELSE ms_request-content_security_policy ).
@ -530,7 +530,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
DATA(lv_add_js) = get_js_cc_startup( ) && ms_request-custom_js.
mv_response = mv_response &&
`<script> sap.z2ui5 = sap.z2ui5 || {};` && |\n| &&
`<script> sap.z2ui5 = sap.z2ui5 || {};` && |\n| &&
get_js( ) && |\n| &&
lv_add_js && |\n| &&
` sap.z2ui5.JSON_MODEL_LIMIT = ` && COND #( WHEN ms_request-json_model_limit IS NOT INITIAL THEN ms_request-json_model_limit ELSE 100 ) && `;`.
@ -540,7 +540,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` sap.ui.require(["z2ui5/DebuggingTools","z2ui5/Controller"], (DebuggingTools) => { sap.z2ui5.DebuggingTools = new DebuggingTools(); ` && |\n| &&
` });`.
mv_response = mv_response && |\n| &&
mv_response = mv_response && |\n| &&
`</script>` && |\n| &&
`<abc/></body></html>`.

View File

@ -84,11 +84,11 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION.
METHOD main_end.
ms_response = VALUE #(
s_front-params = mo_action->ms_next-s_set
s_front-id = mo_action->mo_app->ms_draft-id
s_front-app = z2ui5_cl_util=>rtti_get_classname_by_ref( mo_action->mo_app->mo_app )
s_front-params = mo_action->ms_next-s_set
s_front-id = mo_action->mo_app->ms_draft-id
s_front-app = z2ui5_cl_util=>rtti_get_classname_by_ref( mo_action->mo_app->mo_app )
s_front-app_start = ms_request-s_control-app_start
model = mo_action->mo_app->model_json_stringify( ) ).
model = mo_action->mo_app->model_json_stringify( ) ).
DATA(lo_json_mapper) = NEW z2ui5_cl_core_json_srv( ).
result = lo_json_mapper->response_abap_to_json( ms_response ).

View File

@ -4,7 +4,7 @@ CLASS ltcl_test_handler_post DEFINITION FINAL FOR TESTING
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
METHODS
load_startup_app FOR TESTING RAISING cx_static_check.
ENDCLASS.

View File

@ -31,9 +31,8 @@ INTERFACE z2ui5_if_core_types
BEGIN OF ty_s_attri,
name TYPE string,
name_client TYPE string,
type_kind TYPE string,
bind_type TYPE string,
data_rtti TYPE string,
srtti_data TYPE string,
check_dissolved TYPE abap_bool,
view TYPE string,
json_bind_local TYPE REF TO z2ui5_if_ajson,
@ -42,7 +41,7 @@ INTERFACE z2ui5_if_core_types
custom_mapper TYPE REF TO z2ui5_if_ajson_mapping,
custom_mapper_back TYPE REF TO z2ui5_if_ajson_mapping,
r_ref TYPE REF TO data,
o_typedescr type ref to cl_abap_typedescr,
o_typedescr TYPE REF TO cl_abap_typedescr,
END OF ty_s_attri.
TYPES ty_t_attri TYPE SORTED TABLE OF ty_s_attri WITH UNIQUE KEY name.

View File

@ -45,10 +45,9 @@ CLASS z2ui5_cl_core_app_info IMPLEMENTATION.
DATA(page2) = z2ui5_cl_xml_view=>factory_popup(
)->dialog(
stretch = abap_true
title = `abap2UI5 - System Information`
afterclose = client->_event( `CLOSE` )
).
stretch = abap_true
title = `abap2UI5 - System Information`
afterclose = client->_event( `CLOSE` ) ).
* page2->header_content( )->text( )->title( `abap2UI5 - System Information` )->toolbar_spacer( ).
@ -79,7 +78,7 @@ CLASS z2ui5_cl_core_app_info IMPLEMENTATION.
simple_form2->toolbar( )->title( `Frontend` ).
simple_form2->label( `UI5 Version`).
simple_form2->label( `UI5 Version` ).
simple_form2->text( client->_bind( mv_ui5_version ) ).
simple_form2->label( `Launchpad active` ).
simple_form2->checkbox( enabled = abap_false selected = client->get( )-check_launchpad_active ).
@ -97,19 +96,19 @@ CLASS z2ui5_cl_core_app_info IMPLEMENTATION.
simple_form2->label( `ABAP for Cloud` ).
simple_form2->checkbox( enabled = abap_false selected = z2ui5_cl_util=>rtti_check_lang_version_cloud( ) ).
DATA(lv_count) = CONV string( NEW z2ui5_cl_core_draft_srv( )->count( ) ).
DATA(lv_count) = CONV string( NEW z2ui5_cl_core_draft_srv( )->count_entries( ) ).
simple_form2->toolbar( )->title( `abap2UI5` ).
simple_form2->label( `Version ` ).
simple_form2->text( z2ui5_if_app=>version ).
simple_form2->label( `Draft Entries ` ).
simple_form2->text( lv_count ).
page2->footer( )->overflow_toolbar(
)->toolbar_spacer(
)->button(
text = 'close'
press = client->_event( 'CLOSE' )
type = 'Emphasized' ).
page2->footer( )->overflow_toolbar(
)->toolbar_spacer(
)->button(
text = 'close'
press = client->_event( 'CLOSE' )
type = 'Emphasized' ).
client->popup_display( page2->stringify( ) ).
@ -146,6 +145,7 @@ CLASS z2ui5_cl_core_app_info IMPLEMENTATION.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.

View File

@ -85,10 +85,10 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
* classname = 'z2ui5_cl_core_app_info' ).
page2->header_content(
)->text(
)->title( `abap2UI5 - Developing UI5 Apps Purely in ABAP`
)->toolbar_spacer(
)->button( text = `System` icon = `sap-icon://information`
)->text(
)->title( `abap2UI5 - Developing UI5 Apps Purely in ABAP`
)->toolbar_spacer(
)->button( text = `System` icon = `sap-icon://information`
press = client->_event( `OPEN_INFO` ) ).
* press = client->_event_client( val = client->cs_event-open_new_tab
* t_arg = VALUE #( ( lv_url_info ) ) ) ).
@ -127,7 +127,7 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
IF ms_home-class_editable = abap_true.
simple_form2->input( placeholder = `fill in the class name and press 'check'`
enabled = client->_bind( ms_home-class_editable )
enabled = client->_bind( ms_home-class_editable )
value = client->_bind_edit( ms_home-classname )
submit = client->_event( ms_home-btn_event_id )
valuehelprequest = client->_event( 'VALUE_HELP' )
@ -138,7 +138,7 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
ENDIF.
simple_form2->label( ).
simple_form2->button( press = client->_event( ms_home-btn_event_id )
simple_form2->button( press = client->_event( ms_home-btn_event_id )
text = client->_bind( ms_home-btn_text )
icon = client->_bind( ms_home-btn_icon )
width = `70%` ).
@ -146,7 +146,7 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
)->link( text = `Link to the Application`
target = `_blank`
href = lv_url
enabled = `{= $` && client->_bind( val = ms_home-class_editable ) && ` === false }` ).
enabled = `{= $` && client->_bind( val = ms_home-class_editable ) && ` === false }` ).
DATA(lv_url_samples2) = z2ui5_cl_util=>app_get_url(
@ -155,19 +155,19 @@ CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
simple_form2->toolbar( )->title( `What's next?` ).
IF z2ui5_cl_util=>rtti_check_class_exists( `z2ui5_cl_demo_app_000`).
IF z2ui5_cl_util=>rtti_check_class_exists( `z2ui5_cl_demo_app_000` ).
simple_form2->label( `Start Developing` ).
simple_form2->button(
text = `Check out the samples`
press = client->_event_client( val = client->cs_event-open_new_tab
press = client->_event_client( val = client->cs_event-open_new_tab
t_arg = VALUE #( ( lv_url_samples2 ) ) )
width = `70%` ).
ELSE.
simple_form2->label( `Install the sample repository` ).
simple_form2->link( text = `And explore more than 100 demo apps...`
target = `_blank`
href = `https://github.com/abap2UI5/abap2UI5-samples` ).
target = `_blank`
href = `https://github.com/abap2UI5/abap2UI5-samples` ).
ENDIF.
simple_form2->label( `` ).

View File

@ -20,26 +20,26 @@ CLASS z2ui5_cl_fw_cc_favicon IMPLEMENTATION.
METHOD get_js.
result = `sap.ui.define("z2ui5/Favicon" , ["sap/ui/core/Control"], (Control)=>{` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Favicon", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` favicon: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setFavicon(val) {` && |\n| &&
` this.setProperty("favicon", val);` && |\n| &&
` let headTitle = document.querySelector('head');` && |\n| &&
` let setFavicon = document.createElement('link');` && |\n| &&
` setFavicon.setAttribute('rel','shortcut icon');` && |\n| &&
` setFavicon.setAttribute('href',val);` && |\n| &&
` headTitle.appendChild(setFavicon);` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) {}` && |\n| &&
` });` && |\n| &&
result = `sap.ui.define("z2ui5/Favicon" , ["sap/ui/core/Control"], (Control)=>{` && |\n| &&
` "use strict";` && |\n| &&
` return Control.extend("z2ui5.Favicon", {` && |\n| &&
` metadata: {` && |\n| &&
` properties: {` && |\n| &&
` favicon: {` && |\n| &&
` type: "string"` && |\n| &&
` },` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` setFavicon(val) {` && |\n| &&
` this.setProperty("favicon", val);` && |\n| &&
` let headTitle = document.querySelector('head');` && |\n| &&
` let setFavicon = document.createElement('link');` && |\n| &&
` setFavicon.setAttribute('rel','shortcut icon');` && |\n| &&
` setFavicon.setAttribute('href',val);` && |\n| &&
` headTitle.appendChild(setFavicon);` && |\n| &&
` },` && |\n| &&
` renderer(oRm, oControl) {}` && |\n| &&
` });` && |\n| &&
` });`.
ENDMETHOD.

View File

@ -10,7 +10,7 @@ CLASS z2ui5_cl_fw_cc_scrolling DEFINITION
id TYPE string,
scrollto TYPE string,
END OF ty_s_item.
TYPES ty_t_item TYPE STANDARD TABLE OF ty_s_item WITH DEFAULT KEY ##NEEDED.
TYPES ty_t_item TYPE STANDARD TABLE OF ty_s_item WITH EMPTY KEY ##NEEDED.
CLASS-METHODS get_js
RETURNING

View File

@ -25,7 +25,8 @@ CLASS z2ui5_cl_fw_cc_util IMPLEMENTATION.
` DateCreateObject: (s) => new Date(s),` && |\n| &&
` DateAbapTimestampToDate: (sTimestamp) => new sap.gantt.misc.Format.abapTimestampToDate(sTimestamp),` && |\n| &&
` DateAbapDateToDateObject: (d) => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8)),` && |\n| &&
` DateAbapDateTimeToDateObject: (d, t = '000000') => new Date(d.slice(0, 4), parseInt(d.slice(4, 6)) - 1, d.slice(6, 8), t.slice(0, 2), t.slice(2, 4), t.slice(4, 6)),` && |\n| &&
` DateAbapDateTimeToDateObject: (d, t = '000000') => new Date(d.slice(0, 4), ` && |\n| &&
` parseInt(d.slice(4, 6)) - 1, d.slice(6, 8), t.slice(0, 2), t.slice(2, 4), t.slice(4, 6)),` && |\n| &&
` };` && |\n| &&
` });`.

View File

@ -16,8 +16,8 @@ CLASS z2ui5_cl_cc_chartjs DEFINITION
r TYPE string,
END OF ty_x_y_r_data.
TYPES ty_x_y_r_data_t TYPE STANDARD TABLE OF ty_x_y_r_data WITH DEFAULT KEY.
TYPES ty_bg_color TYPE STANDARD TABLE OF string WITH DEFAULT KEY.
TYPES ty_x_y_r_data_t TYPE STANDARD TABLE OF ty_x_y_r_data WITH EMPTY KEY.
TYPES ty_bg_color TYPE STANDARD TABLE OF string WITH EMPTY KEY.
TYPES:
BEGIN OF ty_padding,
@ -82,7 +82,7 @@ CLASS z2ui5_cl_cc_chartjs DEFINITION
values TYPE string_table,
END OF ty_data_venn .
TYPES ty_data_venn_t TYPE STANDARD TABLE OF ty_data_venn WITH DEFAULT KEY.
TYPES ty_data_venn_t TYPE STANDARD TABLE OF ty_data_venn WITH EMPTY KEY.
TYPES:
BEGIN OF ty_dataset,
@ -111,7 +111,7 @@ CLASS z2ui5_cl_cc_chartjs DEFINITION
tension TYPE string,
END OF ty_dataset.
TYPES ty_datasets TYPE STANDARD TABLE OF ty_dataset WITH DEFAULT KEY.
TYPES ty_datasets TYPE STANDARD TABLE OF ty_dataset WITH EMPTY KEY.
TYPES:
BEGIN OF ty_data,
@ -612,7 +612,7 @@ ENDCLASS.
CLASS Z2UI5_CL_CC_CHARTJS IMPLEMENTATION.
CLASS z2ui5_cl_cc_chartjs IMPLEMENTATION.
METHOD get_chartjs_local.
@ -846,7 +846,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` or is_node-value = `0.00`.
IF is_node-value = `0` OR is_node-value = `0.00`.
rv_keep = abap_false.
ENDIF.
WHEN z2ui5_if_ajson_types=>node_type-string.

View File

@ -69,7 +69,7 @@
on_highlighted TYPE string,
END OF ty_config_steps.
TYPES ty_config_steps_tt TYPE STANDARD TABLE OF ty_config_steps WITH DEFAULT KEY.
TYPES ty_config_steps_tt TYPE STANDARD TABLE OF ty_config_steps WITH EMPTY KEY.
TYPES:
BEGIN OF ty_config,

View File

@ -80,7 +80,7 @@ ENDCLASS.
CLASS Z2UI5_CL_CC_IMAGEMAPSTER IMPLEMENTATION.
CLASS z2ui5_cl_cc_imagemapster IMPLEMENTATION.
METHOD get_js_local.
@ -3302,7 +3302,7 @@ CLASS Z2UI5_CL_CC_IMAGEMAPSTER IMPLEMENTATION.
TRY.
DATA(li_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty( ) ).
li_ajson->set( iv_path = `/` iv_val = is_config ).
li_ajson = li_ajson->filter( NEW Z2UI5_CL_CC_IMAGEMAPSTER( ) ).
li_ajson = li_ajson->filter( NEW z2ui5_cl_cc_imagemapster( ) ).
* li_ajson = li_ajson->filter( z2ui5_cl_ajson_filter_lib=>create_empty_filter( ) ).
li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_to_camel_case( ) ).
* li_ajson = li_ajson->map( z2ui5_cl_ajson_mapping=>create_lower_case( ) ).
@ -3383,45 +3383,45 @@ CLASS Z2UI5_CL_CC_IMAGEMAPSTER IMPLEMENTATION.
ENDMETHOD.
METHOD z2ui5_if_ajson_filter~keep_node.
METHOD z2ui5_if_ajson_filter~keep_node.
rv_keep = abap_true.
rv_keep = abap_true.
CASE iv_visit.
CASE iv_visit.
WHEN z2ui5_if_ajson_filter=>visit_type-open.
WHEN z2ui5_if_ajson_filter=>visit_type-open.
IF is_node-children = 0.
rv_keep = abap_false.
ENDIF.
IF is_node-children = 0.
rv_keep = abap_false.
ENDIF.
WHEN z2ui5_if_ajson_filter=>visit_type-value.
WHEN z2ui5_if_ajson_filter=>visit_type-value.
CASE is_node-type.
WHEN z2ui5_if_ajson_types=>node_type-boolean.
IF is_node-name = `is_selectable`.
RETURN.
ENDIF.
IF is_node-value = `false`.
rv_keep = abap_false.
ENDIF.
WHEN z2ui5_if_ajson_types=>node_type-number.
IF is_node-value = `0` OR is_node-value = `0.00`.
rv_keep = abap_false.
ENDIF.
WHEN z2ui5_if_ajson_types=>node_type-string.
IF is_node-value = ``.
rv_keep = abap_false.
ENDIF.
ENDCASE.
CASE is_node-type.
WHEN z2ui5_if_ajson_types=>node_type-boolean.
IF is_node-name = `is_selectable`.
RETURN.
ENDIF.
IF is_node-value = `false`.
rv_keep = abap_false.
ENDIF.
WHEN z2ui5_if_ajson_types=>node_type-number.
IF is_node-value = `0` OR is_node-value = `0.00`.
rv_keep = abap_false.
ENDIF.
WHEN z2ui5_if_ajson_types=>node_type-string.
IF is_node-value = ``.
rv_keep = abap_false.
ENDIF.
ENDCASE.
WHEN z2ui5_if_ajson_filter=>visit_type-close.
WHEN z2ui5_if_ajson_filter=>visit_type-close.
IF is_node-children = 0.
rv_keep = abap_false.
ENDIF.
IF is_node-children = 0.
rv_keep = abap_false.
ENDIF.
ENDCASE.
ENDCASE.
ENDMETHOD.
ENDMETHOD.
ENDCLASS.

View File

@ -16,18 +16,18 @@ CLASS z2ui5_cl_cc_messaging DEFINITION
descriptionurl TYPE string,
persistent TYPE string,
END OF ty_s_item .
TYPES ty_t_items TYPE STANDARD TABLE OF ty_s_item WITH DEFAULT KEY ##NEEDED.
TYPES ty_t_items TYPE STANDARD TABLE OF ty_s_item WITH EMPTY KEY ##NEEDED.
CLASS-METHODS get_js
RETURNING
VALUE(result) TYPE string .
VALUE(result) TYPE string .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS Z2UI5_CL_CC_MESSAGING IMPLEMENTATION.
CLASS z2ui5_cl_cc_messaging IMPLEMENTATION.
METHOD get_js.

View File

@ -27,6 +27,7 @@ CLASS z2ui5_cl_test_app_hello_world IMPLEMENTATION.
CASE client->get( )-event.
WHEN 'BUTTON_POST'.
client->message_toast_display( |{ product } { quantity } - send to the server| ).
WHEN OTHERS.
ENDCASE.
client->view_display( z2ui5_cl_ui5=>_factory( )->_ns_m(

View File

@ -3,7 +3,7 @@ CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
METHODS
first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.

View File

@ -652,7 +652,7 @@ CLASS z2ui5_cl_xml_view DEFINITION
METHODS column_list_item
IMPORTING
!id TYPE clike OPTIONAL
!id TYPE clike OPTIONAL
!valign TYPE clike OPTIONAL
!selected TYPE clike OPTIONAL
!type TYPE clike OPTIONAL
@ -1516,8 +1516,8 @@ CLASS z2ui5_cl_xml_view DEFINITION
!selectionbehavior TYPE clike DEFAULT 'RowSelector'
!selectedindex TYPE clike OPTIONAL
!id TYPE clike OPTIONAL
!VISIBLEROWCOUNT type CLIKE optional
!VISIBLEROWCOUNTMODE type CLIKE optional
!visiblerowcount TYPE clike OPTIONAL
!visiblerowcountmode TYPE clike OPTIONAL
RETURNING
VALUE(result) TYPE REF TO z2ui5_cl_xml_view .
METHODS tree_columns
@ -3404,7 +3404,7 @@ ENDCLASS.
CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
CLASS z2ui5_cl_xml_view IMPLEMENTATION.
METHOD actions.
@ -4132,20 +4132,20 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
( n = `icon` v = icon )
( n = `stretch` v = stretch )
( n = `state` v = state )
( n = `titleAlignment` v = titleAlignment )
( n = `titleAlignment` v = titlealignment )
( n = `type` v = type )
( n = `showHeader` v = showheader )
( n = `contentWidth` v = contentwidth )
( n = `contentHeight` v = contentheight )
( n = `escapeHandler` v = escapeHandler )
( n = `escapeHandler` v = escapehandler )
( n = `closeOnNavigation` v = z2ui5_cl_util=>boolean_abap_2_json( closeonnavigation ) )
( n = `draggable` v = z2ui5_cl_util=>boolean_abap_2_json( draggable ) )
( n = `resizable` v = z2ui5_cl_util=>boolean_abap_2_json( resizable ) )
( n = `horizontalScrolling` v = z2ui5_cl_util=>boolean_abap_2_json( horizontalscrolling ) )
( n = `verticalScrolling` v = z2ui5_cl_util=>boolean_abap_2_json( verticalscrolling ) )
( n = `afterOpen` v = afterOpen )
( n = `beforeClose` v = beforeClose )
( n = `beforeOpen` v = beforeOpen )
( n = `afterOpen` v = afteropen )
( n = `beforeClose` v = beforeclose )
( n = `beforeOpen` v = beforeopen )
( n = `afterClose` v = afterclose ) ) ).
ENDMETHOD.
@ -7237,8 +7237,8 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
( n = `selectionBehavior` v = selectionbehavior )
( n = `id` v = id )
( n = `selectedIndex` v = selectedindex )
( n = `visibleRowCount` v = visibleRowCount )
( n = `visibleRowCountMode` v = visibleRowCountMode ) ) ).
( n = `visibleRowCount` v = visiblerowcount )
( n = `visibleRowCountMode` v = visiblerowcountmode ) ) ).
ENDMETHOD.
@ -7608,13 +7608,11 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
WHEN `ZZPLAIN`.
result = mt_prop[ n = `VALUE` ]-v.
RETURN.
WHEN OTHERS.
ENDCASE.
IF me = mo_root.
lt_prop = VALUE #(
( n = `xmlns:z2ui5` v = `z2ui5` )
( n = `xmlns:layout` v = `sap.ui.layout` )

View File

@ -258,9 +258,9 @@ CLASS Z2UI5_CL_XML_VIEW_CC IMPLEMENTATION.
METHOD favicon.
result = mo_view.
mo_view->_generic( name = `Favicon`
ns = `z2ui5`
t_prop = VALUE #( ( n = `favicon` v = favicon ) ) ).
mo_view->_generic( name = `Favicon`
ns = `z2ui5`
t_prop = VALUE #( ( n = `favicon` v = favicon ) ) ).
ENDMETHOD.

View File

@ -56,13 +56,13 @@ CLASS z2ui5_cl_ui5 DEFINITION
RETURNING VALUE(result) TYPE REF TO z2ui5_cl_ui5_ui_webc.
METHODS constructor
IMPORTING node TYPE REF TO z2ui5_cl_UI5_tree_xml OPTIONAL.
IMPORTING node TYPE REF TO z2ui5_cl_ui5_tree_xml OPTIONAL.
METHODS _stringify
RETURNING VALUE(result) TYPE string.
PROTECTED SECTION.
DATA _node TYPE REF TO z2ui5_cl_UI5_tree_xml.
DATA _node TYPE REF TO z2ui5_cl_ui5_tree_xml.
CLASS-METHODS _2xml
IMPORTING obj TYPE REF TO z2ui5_cl_ui5
@ -192,7 +192,7 @@ CLASS z2ui5_cl_ui5 IMPLEMENTATION.
CATCH cx_root.
ENDTRY.
DATA(lo_node) = NEW z2ui5_cl_UI5_tree_xml( ).
DATA(lo_node) = NEW z2ui5_cl_ui5_tree_xml( ).
DATA(result2) = NEW z2ui5_cl_ui5( lo_node ).
result2->_node->mv_name = n.
result2->_node->mv_ns = ns.

View File

@ -41,6 +41,7 @@ CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
CASE client->get( )-event.
WHEN 'BUTTON_POST'.
client->message_toast_display( |Your name is { name }| ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.

View File

@ -44,66 +44,9 @@ ENDCLASS.
CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
CLASS Z2UI5_CL_APP_SEARCH_APPS IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF check_initialized = abap_false.
check_initialized = abap_true.
z2ui5_cl_util=>db_load_by_handle(
EXPORTING
uname = sy-uname
handle = 'z2ui5_cl_app_search_apps'
IMPORTING
result = mt_favs ).
mt_apps = VALUE #( FOR row IN z2ui5_cl_util=>rtti_get_classes_impl_intf( `Z2UI5_IF_APP` )
( name = row ) ).
search( ).
view_display( client ).
RETURN.
ENDIF.
IF client->get( )-check_on_navigated = abap_true.
view_display( client ).
ENDIF.
CASE client->get( )-event.
WHEN `ON_PRESS`.
DATA(lt_arg) = client->get( )-t_event_arg.
DATA(lv_app) = lt_arg[ 1 ].
INSERT VALUE #( name = lv_app ) INTO TABLE mt_favs.
z2ui5_cl_util=>db_save(
uname = sy-uname
handle = 'z2ui5_cl_app_search_apps'
data = mt_favs ).
view_action_sheet( lv_app ).
view_nest_display( client ).
WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN 'ON_SEARCH'.
search( ).
client->view_model_update( ).
client->message_toast_display( |backend search done| ).
ENDCASE.
ENDMETHOD.
METHOD search.
@ -121,6 +64,39 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
ENDMETHOD.
METHOD view_action_sheet.
DATA(action_sheet_view) = z2ui5_cl_xml_view=>factory_popup( ).
action_sheet_view->_generic_property( VALUE #( n = `core:require` v = `{ MessageToast: 'sap/m/MessageToast' }` ) ).
action_sheet_view->action_sheet( placement = `Botton`
showcancelbutton = abap_true
title = `Choose Your Action`
)->button( text = `Accept`
icon = `sap-icon://accept`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Reject`
icon = `sap-icon://decline`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Email`
icon = `sap-icon://email`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Forward`
icon = `sap-icon://forward`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Delete`
icon = `sap-icon://delete`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Other`
press = `MessageToast.show('selected action is ' + ${$source>/text})` ).
client->popover_display( xml = action_sheet_view->stringify( )
by_id = val ).
ENDMETHOD.
METHOD view_display.
@ -151,8 +127,12 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
DATA(pages) = page->icon_tab_header( selectedkey = client->_bind_edit( mv_selected_key )
* select = client->_event( `OnSelectIconTabBar` )
* select = client->_event_client( action = 'NAV_TO' t_arg = value #( ( `NavCon` ) ( `${$parameters}` ) ) )
select = client->_event_client( val = client->cs_event-nav_container_to t_arg = VALUE #( ( `NavCon` ) ( `${$parameters>/selectedKey}` ) ) )
* select = client->_event_client(
* action = 'NAV_TO'
* t_arg = value #( ( `NavCon` ) ( `${$parameters}` ) ) )
select = client->_event_client(
val = client->cs_event-nav_container_to
t_arg = VALUE #( ( `NavCon` ) ( `${$parameters>/selectedKey}` ) ) )
mode = `Inline`
)->items(
)->icon_tab_filter( key = `page_favs`
@ -270,7 +250,7 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
row->text( `{DESCR}` ).
row->text( ).
row->checkbox( text = `ABAP for Cloud`
enabled = abap_false
enabled = abap_false
selected = `{CHECK_ABAP_FOR_CLOUD}` ).
row = item->grid( ).
@ -286,52 +266,16 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
row->checkbox( text = `Installed`
selected = `{CHECK_INSTALLED}`
enabled = abap_false
).
enabled = abap_false ).
row->checkbox( text = `Standard ABAP (Min. {MIN_RELEASE})`
selected = `{CHECK_STANDARD_ABAP}`
enabled = abap_false
).
row->text( `{DESCR}` ).
* page_online
enabled = abap_false ).
row->text( `{DESCR}` ).
client->view_display( page->stringify( ) ).
ENDMETHOD.
METHOD view_action_sheet.
DATA(action_sheet_view) = z2ui5_cl_xml_view=>factory_popup( ).
action_sheet_view->_generic_property( VALUE #( n = `core:require` v = `{ MessageToast: 'sap/m/MessageToast' }` ) ).
action_sheet_view->action_sheet( placement = `Botton`
showcancelbutton = abap_true
title = `Choose Your Action`
)->button( text = `Accept`
icon = `sap-icon://accept`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Reject`
icon = `sap-icon://decline`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Email`
icon = `sap-icon://email`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Forward`
icon = `sap-icon://forward`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Delete`
icon = `sap-icon://delete`
press = `MessageToast.show('selected action is ' + ${$source>/text})`
)->button( text = `Other`
press = `MessageToast.show('selected action is ' + ${$source>/text})` ).
client->popover_display( xml = action_sheet_view->stringify( )
by_id = val ).
ENDMETHOD.
METHOD view_nest_display.
@ -344,7 +288,7 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
* page_favs->generic_tile(
class = 'sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout'
press = client->_event( val = `ON_PRESS` t_arg = VALUE #( ( `${$source>/header}` ) ) )
header = client->_bind( val = lr_app->name tab = ref #( mt_favs ) tab_index = lv_tabix ) ).
header = client->_bind( val = lr_app->name tab = REF #( mt_favs ) tab_index = lv_tabix ) ).
* visible = client->_bind( val = lr_app->check_fav tab = mt_apps tab_index = lv_tabix ) ).
ENDLOOP.
@ -354,4 +298,61 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
ENDMETHOD.
METHOD z2ui5_if_app~main.
me->client = client.
IF check_initialized = abap_false.
check_initialized = abap_true.
z2ui5_cl_util=>db_load_by_handle(
EXPORTING
uname = sy-uname
handle = 'z2ui5_cl_app_search_apps'
IMPORTING
result = mt_favs ).
mt_apps = VALUE #( FOR row IN z2ui5_cl_util=>rtti_get_classes_impl_intf( `Z2UI5_IF_APP` )
( name = row ) ).
search( ).
view_display( client ).
RETURN.
ENDIF.
IF client->get( )-check_on_navigated = abap_true.
view_display( client ).
ENDIF.
CASE client->get( )-event.
WHEN `ON_PRESS`.
DATA(lt_arg) = client->get( )-t_event_arg.
DATA(lv_app) = lt_arg[ 1 ].
INSERT VALUE #( name = lv_app ) INTO TABLE mt_favs.
z2ui5_cl_util=>db_save(
uname = sy-uname
handle = 'z2ui5_cl_app_search_apps'
data = mt_favs ).
view_action_sheet( lv_app ).
view_nest_display( client ).
WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN 'ON_SEARCH'.
search( ).
client->view_model_update( ).
client->message_toast_display( |backend search done| ).
ENDCASE.
ENDMETHOD.
ENDCLASS.

View File

@ -39,14 +39,14 @@ CLASS lcl_github IMPLEMENTATION.
result = VALUE #(
(
name = `Table Loader`
descr = `Upload, Edit & Download Table Content (CSV, JSON)`
author_link = `https://github.com/oblomov-dev`
author_name = `oblomov`
name = `Table Loader`
descr = `Upload, Edit & Download Table Content (CSV, JSON)`
author_link = `https://github.com/oblomov-dev`
author_name = `oblomov`
check_abap_for_cloud = abap_true
min_release = `750`
link = `https://github.com/oblomov-dev/a2UI5-db_table_loader`
t_app = VALUE #(
min_release = `750`
link = `https://github.com/oblomov-dev/a2UI5-db_table_loader`
t_app = VALUE #(
(
name = `Upload JSON`
descr = `Modify DB Table with JSON Data`
@ -59,15 +59,15 @@ CLASS lcl_github IMPLEMENTATION.
)
) )
(
name = `The Quest`
descr = `A wizard's adventure game based on a fork of the AXAGE game engine (ABAP teXt Adventure Game Engine) and abap2UI5. The game is set in a fantasy world, where the player takes on the role of a wizard's apprentice. The play` &&
`er explores the wizard's house, interacts with various objects and explores. The Quest is work in progress...`
name = `The Quest`
descr = `A wizard's adventure game based on a fork of the AXAGE game engine (ABAP teXt Adventure Game Engine) and abap2UI5. The game is set in a fantasy world, where the player ` &&
`takes on the role of a wizard's apprentice. The player explores the wizard's house, interacts with various objects and explores. The Quest is work in progress...`
check_abap_for_cloud = abap_true
min_release = `750`
link = `https://github.com/nomssi/axage`
author_link = `https://github.com/nomssi`
author_name = `Nomssi`
t_app = VALUE #(
min_release = `750`
link = `https://github.com/nomssi/axage`
author_link = `https://github.com/nomssi`
author_name = `Nomssi`
t_app = VALUE #(
(
name = `The Quest - Start the Adventure`
descr = `Adventure Game: The Wizard&amp;apos;s Aspirant Quest`
@ -75,17 +75,17 @@ CLASS lcl_github IMPLEMENTATION.
)
) )
(
name = `Advent of Code`
descr = `Advent of Code 2023 in ABAP`
author_link = `https://github.com/joltdx`
author_name = `joltdx`
link = `https://github.com/joltdx/abap-advent-2023`
name = `Advent of Code`
descr = `Advent of Code 2023 in ABAP`
author_link = `https://github.com/joltdx`
author_name = `joltdx`
link = `https://github.com/joltdx/abap-advent-2023`
check_abap_for_cloud = abap_true
min_release = `750`
t_app = VALUE #(
min_release = `750`
t_app = VALUE #(
(
name = `Advent of Code 2023 in ABAP`
descr = `Advent of Code 2023 - ABAP2UI5 app`
descr = `Advent of Code 2023 - ABAP2UI5 app`
classname = `zcl_advent_2023_a2ui5.clas.abap`
)
) ) ).

View File

@ -83,6 +83,7 @@ CLASS z2ui5_cl_popup_error IMPLEMENTATION.
WHEN `BUTTON_CONFIRM`.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.

View File

@ -30,7 +30,7 @@ ENDCLASS.
CLASS Z2UI5_CL_POPUP_JS_LOADER IMPLEMENTATION.
CLASS z2ui5_cl_popup_js_loader IMPLEMENTATION.
METHOD factory.
@ -51,7 +51,7 @@ CLASS Z2UI5_CL_POPUP_JS_LOADER IMPLEMENTATION.
METHOD view_display.
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( )->dialog( title = `load library`
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( )->dialog( `load library`
)->content(
)->_z2ui5( )->timer( client->_event( 'TIMER_FINISHED' )
)->_generic( ns = `html` name = `script` )->_cc_plain_xml( js ).
@ -75,6 +75,7 @@ CLASS Z2UI5_CL_POPUP_JS_LOADER IMPLEMENTATION.
WHEN `TIMER_FINISHED`.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.

View File

@ -57,7 +57,7 @@ CLASS Z2UI5_CL_POPUP_LAYOUT IMPLEMENTATION.
)->content( ).
DATA(tab) = popup->table(
items = client->_bind_edit( ms_result-t_layout ) ).
client->_bind_edit( ms_result-t_layout ) ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( ms_result-t_layout ).
@ -66,8 +66,8 @@ CLASS Z2UI5_CL_POPUP_LAYOUT IMPLEMENTATION.
DATA(columns) = tab->columns( ).
LOOP AT lt_comp INTO DATA(ls_comp2).
DATA(col) = columns->column( width = '8rem' )->header( ns = `` ).
col->text( text = ls_comp2-name ).
DATA(col) = columns->column( '8rem' )->header( `` ).
col->text( ls_comp2-name ).
ENDLOOP.
LOOP AT lt_comp INTO DATA(ls_comp).

View File

@ -58,7 +58,7 @@ CLASS z2ui5_cl_popup_messages IMPLEMENTATION.
afterclose = client->_event( 'BUTTON_CONTINUE' )
)->table(
* mode = 'SingleSelectLeft'
items = client->_bind_edit( mt_msg )
client->_bind_edit( mt_msg )
)->columns(
)->column( )->text( 'Title' )->get_parent(
)->column( )->text( 'Color' )->get_parent(
@ -98,6 +98,7 @@ CLASS z2ui5_cl_popup_messages IMPLEMENTATION.
WHEN `BUTTON_CONTINUE`.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.

View File

@ -53,7 +53,7 @@ CLASS z2ui5_cl_popup_table IMPLEMENTATION.
)->content( ).
DATA(tab) = popup->table(
items = client->_bind( <tab_out> ) ).
client->_bind( <tab_out> ) ).
* )->header_toolbar(
* )->overflow_toolbar(
* )->toolbar_spacer(
@ -67,12 +67,12 @@ CLASS z2ui5_cl_popup_table IMPLEMENTATION.
DATA(cells) = list->cells( ).
LOOP AT lt_comp INTO DATA(ls_comp).
cells->text( text = `{` && ls_comp-name && `}` ).
cells->text( `{` && ls_comp-name && `}` ).
ENDLOOP.
DATA(columns) = tab->columns( ).
LOOP AT lt_comp INTO ls_comp.
columns->column( width = '8rem' )->header( ns = `` )->text( text = ls_comp-name ).
columns->column( '8rem' )->header( `` )->text( ls_comp-name ).
ENDLOOP.
popup->get_parent(

View File

@ -37,7 +37,7 @@ ENDCLASS.
CLASS Z2UI5_CL_POPUP_TO_CONFIRM IMPLEMENTATION.
CLASS z2ui5_cl_popup_to_confirm IMPLEMENTATION.
METHOD result.

View File

@ -78,6 +78,7 @@ CLASS z2ui5_cl_popup_to_inform IMPLEMENTATION.
WHEN `BUTTON_CONFIRM`.
client->popup_destroy( ).
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.

View File

@ -72,17 +72,16 @@ CLASS z2ui5_cl_popup_to_select IMPLEMENTATION.
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ).
DATA(tab) = popup->table_select_dialog(
items = `{path:'`
items = `{path:'`
&& client->_bind_edit( val = <tab_out> path = abap_true )
&& `', sorter : { path : '` && to_upper( sort_field ) && `', descending : `
&& z2ui5_cl_util=>boolean_abap_2_json( me->descending )
&& ` } }`
cancel = client->_event( 'CANCEL' )
search = client->_event( val = 'SEARCH' t_arg = VALUE #( ( `${$parameters>/value}` ) ( `${$parameters>/clearButtonPressed}` ) ) )
confirm = client->_event( val = 'CONFIRM' t_arg = VALUE #( ( `${$parameters>/selectedContexts[0]/sPath}` ) ) )
cancel = client->_event( 'CANCEL' )
search = client->_event( val = 'SEARCH' t_arg = VALUE #( ( `${$parameters>/value}` ) ( `${$parameters>/clearButtonPressed}` ) ) )
confirm = client->_event( val = 'CONFIRM' t_arg = VALUE #( ( `${$parameters>/selectedContexts[0]/sPath}` ) ) )
growing = abap_true
title = title
).
title = title ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( <tab_out> ).
DELETE lt_comp WHERE name = 'ZZSELKZ'.
@ -92,7 +91,7 @@ CLASS z2ui5_cl_popup_to_select IMPLEMENTATION.
DATA(cells) = list->cells( ).
LOOP AT lt_comp INTO DATA(ls_comp).
cells->text( text = `{` && ls_comp-name && `}` ).
cells->text( `{` && ls_comp-name && `}` ).
ENDLOOP.
DATA(columns) = tab->columns( ).
@ -103,7 +102,7 @@ CLASS z2ui5_cl_popup_to_select IMPLEMENTATION.
WHEN medium_label IS NOT INITIAL
THEN medium_label
ELSE ls_comp-name ).
columns->column( width = '8rem' )->header( ns = `` )->text( text = text ).
columns->column( '8rem' )->header( `` )->text( text ).
ENDLOOP.
client->popup_display( popup->stringify( ) ).
@ -253,7 +252,7 @@ CLASS z2ui5_cl_popup_to_select IMPLEMENTATION.
DATA(lt_arg) = client->get( )-t_event_arg.
READ TABLE lt_arg INTO DATA(ls_arg) INDEX 1.
assert sy-subrc = 0.
ASSERT sy-subrc = 0.
ASSIGN mr_tab_popup->* TO <tab_out>.
ASSIGN mr_tab_popup_backup->* TO <tab_out_backup>.