Refactoring (#880)

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* README.md aktualisieren

* README.md aktualisieren

* README.md aktualisieren

* README.md aktualisieren

* README.md aktualisieren

* Update README.md

* README.md aktualisieren

* Update README.md

* update

* refactoring

* Update abaplint.jsonc

* Update abaplint.jsonc

* refactoring

* update

* lint fixes

* refactoring

* fixes unit tests

* update

* update
This commit is contained in:
oblomov 2024-02-12 17:01:05 +01:00 committed by GitHub
parent b9baa320d6
commit 7e7cfb95c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 1843 additions and 2809 deletions

View File

@ -49,21 +49,18 @@
* Showcased at SAP TechEd 2023 [(youtube - 02.11.2023)](https://www.youtube.com/watch?v=kLbF0ooStZs&t=3052s)
* Featured on SAP Developer News [(youtube - 15.12.2023)](https://www.youtube.com/watch?v=CfH9L03WUCg&t=350s)
#### Apps & Extensions
#### 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)
* Explore abap2UI5-tools, a collection of tools & utility functions [(abap2UI5-tools)](https://github.com/abap2UI5/abap2ui5-tools)
* Enhance functionality with Custom Controls & External Libraries [(custom controls)](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
* Experiment with abap2UI5 compiled to JS on open-abap under Node.js [(abap2UI5-web)](https://twitter.com/LarsHvam/status/1648575595897405446)
* Install S-RTTI to create apps with dynamically typed tables [(github/s-rtti)](https://github.com/sandraros/S-RTTI)
* Import & Export Excel files in pure ABAP with abap2xslt [(twitter/xslt)](https://twitter.com/abap2UI5/status/1703787345588162907)
* Analyse your Views & Models with this Codesandbox [(abap2UI5-debug-tools)](https://codesandbox.io/p/sandbox/abap2ui5-debug-tool-ppyfcs)
* Join the Advent of Code 2023 with abap2UI5 [(SCN - 27.11.2023)](https://blogs.sap.com/2023/11/27/preparing-for-advent-of-code-2023/)
* And finally, don't forget to explore the [Samples Repository](https://github.com/abap2UI5/abap2UI5-samples) 🧭
#### Installation
Install with [abapGit](https://abapgit.org) ![abapGit](https://docs.abapgit.org/img/favicon.png) and set up a new HTTP service with the following handler:
##### Standard ABAP 🏠
@ -222,8 +219,20 @@ ENDCLASS.
</details>
#### Credits
* These [**Contributors**](https://github.com/abap2UI5/abap2UI5/graphs/contributors) help to continously evolve this project
* 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)
* Support for Serialization of variables created at runtime is provided via [**S-RTTI**](https://github.com/sandraros/S-RTTI) [(sandrarossi)](https://github.com/sandraros)
* Compatibility with lower releases is ensured through automatic syntax downport with [**abaplint**](https://abaplint.org/) [(larshp)](https://github.com/larshp)
* ABAP for Cloud & Standard ABAP compatibility in a single codeline is achieved with [**Steampuncification**](https://github.com/heliconialabs/steampunkification)
* The code is primarily developed on an SAP ABAP Developer Edition 7.52 hosted by [**Nuve Platform**](https://www.nuveplatform.com/)
* Checks for compatibility with "ABAP for Cloud" are performed on [**BTP ABAP Trial**](https://discovery-center.cloud.sap/serviceCatalog/abap-environment?region=all) [(by SAP)](https://www.sap.com/germany/index.html)
_Thanks to everyone who submits PRs or enriches my knowledge in issues, via Slack, or through other channels. This project greatly benefits from your support, making it a joy to work on!_ 👷‍♂️
#### FAQ
* Check out the [documentation](https://github.com/abap2UI5/abap2UI5-documentation/) for more installation & configuration guidelines
* Still have open questions? Find an answer in the [FAQ](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/faq.md)
* Still have open questions? Check out the [documentation](https://github.com/abap2UI5/abap2UI5-documentation/) or find an answer in the [FAQ](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/docs/faq.md)
* Want to help out? Check out the contribution [guidelines](https://github.com/abap2UI5/abap2UI5-documentation/blob/main/CONTRIBUTING.md)
* As always - your comments, questions, wishes and bug reports are welcome, please create an [issue](https://github.com/abap2UI5/abap2UI5/issues)

View File

@ -5,6 +5,19 @@ CLASS z2ui5_cl_util DEFINITION
PUBLIC SECTION.
CLASS-METHODS app_get_url_source_code
IMPORTING
!client TYPE REF TO z2ui5_if_client
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS app_get_url
IMPORTING
!client TYPE REF TO z2ui5_if_client
VALUE(classname) TYPE string OPTIONAL
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS db_save
IMPORTING
!uname TYPE clike OPTIONAL
@ -39,6 +52,30 @@ ENDCLASS.
CLASS z2ui5_cl_util IMPLEMENTATION.
METHOD app_get_url.
IF classname IS INITIAL.
classname = rtti_get_classname_by_ref( client->get_app( ) ).
ENDIF.
DATA(lv_url) = to_lower( client->get( )-s_config-origin && client->get( )-s_config-pathname ) && `?`.
DATA(lt_param) = url_param_get_tab( client->get( )-s_config-search ).
DELETE lt_param WHERE n = `app_start`.
INSERT VALUE #( n = `app_start` v = to_lower( classname ) ) INTO TABLE lt_param.
result = lv_url && url_param_create_url( lt_param ).
ENDMETHOD.
METHOD app_get_url_source_code.
DATA(ls_config) = client->get( )-s_config.
result = ls_config-origin && `/sap/bc/adt/oo/classes/`
&& rtti_get_classname_by_ref( client->get_app( ) ) && `/source/main`.
ENDMETHOD.
METHOD db_load_by_handle.

View File

@ -50,8 +50,7 @@ CLASS ltcl_test IMPLEMENTATION.
handle2 = `handle2`
handle3 = `handle3`
IMPORTING
result = ls_row_result
).
result = ls_row_result ).
cl_abap_unit_assert=>assert_equals(
act = ls_row_result

View File

@ -31,6 +31,13 @@ CLASS z2ui5_cl_util_api DEFINITION
table TYPE string,
END OF ty_s_sql_result.
CLASS-METHODS rtti_get_t_attri_by_include
IMPORTING
type TYPE REF TO cl_abap_datadescr
attri TYPE clike
RETURNING
VALUE(result) TYPE abap_component_tab.
CLASS-METHODS source_get_method
IMPORTING
iv_classname TYPE clike
@ -50,6 +57,18 @@ CLASS z2ui5_cl_util_api DEFINITION
RETURNING
VALUE(result) TYPE abap_bool.
CLASS-METHODS unassign_object
IMPORTING
val TYPE any
RETURNING
VALUE(result) TYPE REF TO object.
CLASS-METHODS unassign_data
IMPORTING
val TYPE any
RETURNING
VALUE(result) TYPE REF TO object.
CLASS-METHODS conv_get_as_data_ref
IMPORTING
val TYPE data
@ -86,19 +105,6 @@ CLASS z2ui5_cl_util_api DEFINITION
RETURNING
VALUE(result) TYPE ty_s_sql_result.
CLASS-METHODS app_get_url_source_code
IMPORTING
!client TYPE REF TO z2ui5_if_client
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS app_get_url
IMPORTING
!client TYPE REF TO z2ui5_if_client
VALUE(classname) TYPE string OPTIONAL
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS url_param_get
IMPORTING
!val TYPE string
@ -172,12 +178,6 @@ CLASS z2ui5_cl_util_api DEFINITION
RETURNING
VALUE(result) TYPE string.
CLASS-METHODS c_replace_assign_struc
IMPORTING
!iv_attri TYPE clike
RETURNING
VALUE(rv_attri) TYPE string.
CLASS-METHODS json_parse
IMPORTING
!val TYPE any
@ -231,13 +231,13 @@ CLASS z2ui5_cl_util_api DEFINITION
RETURNING
VALUE(rt_params) TYPE z2ui5_if_types=>ty_t_name_value.
CLASS-METHODS rtti_get_t_attri_by_object
CLASS-METHODS rtti_get_t_attri_by_oref
IMPORTING
!val TYPE REF TO object
!val TYPE any
RETURNING
VALUE(result) TYPE abap_attrdescr_tab.
CLASS-METHODS rtti_get_t_comp_by_data
CLASS-METHODS rtti_get_t_attri_by_struc
IMPORTING
!val TYPE any
RETURNING
@ -265,6 +265,12 @@ 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
@ -339,30 +345,30 @@ ENDCLASS.
CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
CLASS z2ui5_cl_util_api IMPLEMENTATION.
METHOD app_get_url.
METHOD rtti_get_t_attri_by_include.
IF classname IS INITIAL.
classname = rtti_get_classname_by_ref( client->get_app( ) ).
ENDIF.
DATA(sdescr) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( type->absolute_name ) ).
DATA(lv_url) = to_lower( client->get( )-s_config-origin && client->get( )-s_config-pathname ) && `?`.
DATA(lt_param) = url_param_get_tab( client->get( )-s_config-search ).
DELETE lt_param WHERE n = `app_start`.
INSERT VALUE #( n = `app_start` v = to_lower( classname ) ) INTO TABLE lt_param.
LOOP AT sdescr->components REFERENCE INTO DATA(lr_comp).
result = lv_url && url_param_create_url( lt_param ).
DATA(lv_element) = attri && lr_comp->name.
ENDMETHOD.
* 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
INSERT ls_attri INTO TABLE result.
METHOD app_get_url_source_code.
DATA(ls_config) = client->get( )-s_config.
result = ls_config-origin && `/sap/bc/adt/oo/classes/`
&& rtti_get_classname_by_ref( client->get_app( ) ) && `/source/main`.
ENDLOOP.
ENDMETHOD.
@ -452,24 +458,6 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
ENDMETHOD.
METHOD c_replace_assign_struc.
rv_attri = iv_attri.
DATA(lv_length) = strlen( rv_attri ) - 2.
DATA(lv_attri_end) = rv_attri+lv_length.
IF lv_attri_end = `>*`.
lv_attri_end = `>`.
lv_length = lv_length.
ELSE.
lv_attri_end = `-`.
lv_length = lv_length + 2.
ENDIF.
rv_attri = rv_attri(lv_length) && lv_attri_end.
ENDMETHOD.
METHOD c_trim.
result = shift_left( shift_right( CONV string( val ) ) ).
@ -498,7 +486,7 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
METHOD filter_get_multi_by_data.
LOOP AT rtti_get_t_comp_by_data( val ) REFERENCE INTO DATA(lr_comp).
LOOP AT rtti_get_t_attri_by_struc( val ) REFERENCE INTO DATA(lr_comp).
INSERT VALUE #( name = lr_comp->name ) INTO TABLE result.
ENDLOOP.
@ -614,11 +602,7 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
METHOD itab_get_csv_by_itab.
FIELD-SYMBOLS <tab> TYPE table.
ASSIGN val TO <tab>.
DATA(tab) = CAST cl_abap_tabledescr( cl_abap_typedescr=>describe_by_data( <tab> ) ).
DATA(struc) = CAST cl_abap_structdescr( tab->get_table_line_type( ) ).
@ -649,6 +633,7 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
METHOD itab_get_itab_by_csv.
DATA lt_comp TYPE cl_abap_structdescr=>component_table.
FIELD-SYMBOLS <tab> TYPE STANDARD TABLE.
DATA lr_row TYPE REF TO data.
@ -672,15 +657,12 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
p_unique = abap_false ).
CREATE DATA result TYPE HANDLE o_table_desc.
ASSIGN result->* TO <tab>.
DELETE lt_rows WHERE table_line IS INITIAL.
LOOP AT lt_rows REFERENCE INTO DATA(lr_rows) FROM 2.
SPLIT lr_rows->* AT ';' INTO TABLE lt_cols.
CREATE DATA lr_row TYPE HANDLE struc.
LOOP AT lt_cols REFERENCE INTO lr_col.
@ -789,15 +771,15 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
ENDMETHOD.
METHOD rtti_get_t_attri_by_object.
METHOD rtti_get_t_attri_by_oref.
DATA(lo_obj_ref) = cl_abap_objectdescr=>describe_by_object_ref( val ).
result = CAST cl_abap_classdescr( lo_obj_ref )->attributes.
result = CAST cl_abap_classdescr( lo_obj_ref )->attributes.
ENDMETHOD.
METHOD rtti_get_t_comp_by_data.
METHOD rtti_get_t_attri_by_struc.
TRY.
DATA(lo_type) = cl_abap_typedescr=>describe_by_data( val ).
@ -819,6 +801,16 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
result = lo_struct->get_components( ).
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 ).
DELETE result.
INSERT LINES OF lt_attri INTO TABLE result.
ENDLOOP.
ENDMETHOD.
@ -1065,4 +1057,46 @@ CLASS Z2UI5_CL_UTIL_API IMPLEMENTATION.
RAISE EXCEPTION TYPE z2ui5_cx_util_error EXPORTING val = v.
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>.
ENDMETHOD.
METHOD unassign_data.
FIELD-SYMBOLS <unassign> TYPE any.
ASSIGN val->* TO <unassign>.
result = <unassign>.
ENDMETHOD.
ENDCLASS.

File diff suppressed because it is too large Load Diff

View File

@ -55,12 +55,9 @@ CLASS z2ui5_cl_core_bind_srv DEFINITION
VALUE(result) TYPE string.
METHODS update_model_attri.
METHODS check_raise_existing.
METHODS check_raise_new.
PRIVATE SECTION.
ENDCLASS.
@ -79,7 +76,7 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
ASSIGN ms_config-tab->* TO <tab>.
ASSIGN <tab>[ ms_config-tab_index ] TO <row>.
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_comp_by_data( ms_config-tab ).
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( ms_config-tab ).
LOOP AT lt_attri ASSIGNING FIELD-SYMBOL(<comp>).
ASSIGN COMPONENT <comp>-name OF STRUCTURE <row> TO <ele>.
@ -178,8 +175,10 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
METHOD get_client_name.
result = replace( val = mr_attri->name sub = `-` with = `/` ).
result = replace( val = result sub = `>` with = `*` ).
result = COND #( WHEN mv_type = z2ui5_if_core_types=>cs_bind_type-two_way THEN `/EDIT` ) && `/` && result.
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.
ENDMETHOD.
@ -209,6 +208,13 @@ CLASS z2ui5_cl_core_bind_srv IMPLEMENTATION.
result = mr_attri->name_client.
ENDIF.
IF result = `/` && z2ui5_if_core_types=>cs_ui5-two_way_model.
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`.
ENDIF.
IF ms_config-path_only = abap_false.
result = `{` && result && `}`.
ENDIF.

View File

@ -1,21 +1,327 @@
CLASS ltcl_test_binder DEFINITION FINAL FOR TESTING
DURATION LONG
RISK LEVEL DANGEROUS.
PRIVATE SECTION.
METHODS first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS z2ui5_cl_core_bind_srv DEFINITION LOCAL FRIENDS ltcl_test_binder.
CLASS ltcl_test_binder IMPLEMENTATION.
METHOD first_test.
* DATA(lo_http) = NEW z2ui5_cl_fw_http_post( `` ).
* DATA(lo_app) = NEW z2ui5_cl_fw_controller( lo_http ).
* DATA(lo_client) = NEW z2ui5_cl_fw_client( lo_app ) ##NEEDED.
ENDMETHOD.
ENDCLASS.
*
*CLASS ltcl_test_bind DEFINITION DEFERRED.
*CLASS z2ui5_cl_core_bind_srv DEFINITION LOCAL FRIENDS ltcl_test_bind.
*
*CLASS ltcl_test_app DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* 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 ##NEEDED.
* DATA mr_struc TYPE REF TO s_01 ##NEEDED.
* DATA mo_app TYPE REF TO ltcl_test_bind ##NEEDED.
*
* DATA xx TYPE string.
*ENDCLASS.
*
*CLASS ltcl_test_bind DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
* PROTECTED SECTION.
* PRIVATE SECTION.
* METHODS test_one_way FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_w_x_error FOR TESTING RAISING cx_static_check.
* METHODS test_error_diff FOR TESTING RAISING cx_static_check.
* METHODS test_two_way FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_bind IMPLEMENTATION.
*
* METHOD test_one_way_w_x_error.
*
* DATA(lo_app_client) = NEW ltcl_test_app( ).
* DATA(lo_app) = NEW z2ui5_cl_core_app( ).
* lo_app->mo_app = lo_app_client.
*
* DATA(lo_bind) = NEW z2ui5_cl_core_bind_srv( lo_app ).
*
* TRY.
* lo_bind->main(
* val = REF #( lo_app_client->xx )
* type = z2ui5_if_core_types=>cs_bind_type-one_way ).
*
* cl_abap_unit_assert=>abort( ).
*
* CATCH cx_root.
* ENDTRY.
*
* ENDMETHOD.
*
* METHOD test_one_way.
*
* DATA(lo_app_client) = NEW ltcl_test_app( ).
* DATA(lo_app) = NEW z2ui5_cl_core_app( ).
* lo_app->mo_app = lo_app_client.
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_bind
* exp = `{/MV_VALUE}` ).
*
* cl_abap_unit_assert=>assert_not_initial( lv_bind ).
*
* ENDMETHOD.
*
* METHOD test_error_diff.
*
* DATA(lo_app_client) = NEW ltcl_test_app( ).
* DATA(lo_app) = NEW z2ui5_cl_core_app( ).
* lo_app->mo_app = lo_app_client.
*
* 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 ).
*
* TRY.
* lo_bind->main(
* val = REF #( lo_app_client->mv_value )
* type = z2ui5_if_core_types=>cs_bind_type-two_way ).
*
* cl_abap_unit_assert=>abort( ).
*
* CATCH cx_root.
* ENDTRY.
*
* ENDMETHOD.
*
*
* METHOD test_two_way.
*
* DATA(lo_app_client) = NEW ltcl_test_app( ).
* DATA(lo_app) = NEW z2ui5_cl_core_app( ).
* lo_app->mo_app = lo_app_client.
*
* 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 ).
*
* DATA(lv_bind2) = lo_bind->main(
* 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
* exp = lv_bind2 ).
*
* cl_abap_unit_assert=>assert_not_initial( lv_bind ).
*
* ENDMETHOD.
*ENDCLASS.
*
*
*CLASS ltcl_test_main_structure DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* 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.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_lev1 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev2 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev3 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev4_long_name FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_structure IMPLEMENTATION.
*
* METHOD test_one_way_lev1.
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `{/MS_STRUC/INPUT}` ).
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev2.
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `{/MS_STRUC/S_02-INPUT}` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev3.
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `{/MS_STRUC/S_02-S_03-INPUT}` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev4_long_name.
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `{/MS_STRUC/S_02-S_03-S_04-INPUT}` ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*
*CLASS ltcl_test_main_object DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* DATA mo_obj TYPE REF TO ltcl_test_main_object.
* DATA mv_value TYPE string.
*
* 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.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_value FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object IMPLEMENTATION.
*
* METHOD test_one_way_value.
*
* 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( ).
* 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->mv_value )
* type = z2ui5_if_core_types=>cs_bind_type-one_way ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `{/MO_OBJ/MV_VALUE}` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_struc.
*
* 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 ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `{/MO_OBJ/MS_STRUC-INPUT}` ).
*
* ENDMETHOD.
*
*ENDCLASS.

View File

@ -66,8 +66,7 @@ CLASS z2ui5_cl_core_draft_srv IMPLEMENTATION.
id_prev_app_stack = draft-id_prev_app_stack
uname = z2ui5_cl_util=>user_get_tech( )
timestampl = z2ui5_cl_util=>time_get_timestampl( )
data = model_xml
).
data = model_xml ).
MODIFY z2ui5_t_core_01 FROM @ls_db.
IF sy-subrc <> 0.

View File

@ -33,13 +33,11 @@ CLASS z2ui5_cl_core_event_srv DEFINITION
ENDCLASS.
CLASS z2ui5_cl_core_event_srv IMPLEMENTATION.
METHOD get_event.
result = `onEvent( { 'EVENT' : '` && val && `', 'METHOD' : 'UPDATE' , 'CHECK_VIEW_DESTROY' : ` && z2ui5_cl_util=>boolean_abap_2_json( check_view_destroy ) && ` }`.
result = |{ z2ui5_if_core_types=>cs_ui5-event_backend_function }(['{ val }'{ COND #( WHEN check_view_destroy = abap_true THEN `,true`) }]|.
result = result && get_t_arg( t_arg ).
ENDMETHOD.
@ -47,11 +45,11 @@ CLASS z2ui5_cl_core_event_srv IMPLEMENTATION.
METHOD get_event_client.
result = `onEventFrontend( { 'EVENT' : '` && val && `' }` && get_t_arg( t_arg ).
result = |{ z2ui5_if_core_types=>cs_ui5-event_frontend_function }('{ val }'|.
result = result && get_t_arg( t_arg ).
ENDMETHOD.
METHOD get_t_arg.
IF val IS NOT INITIAL.

View File

@ -1,22 +1,36 @@
CLASS ltcl_test_db DEFINITION FINAL FOR TESTING
CLASS ltcl_test DEFINITION FINAL FOR TESTING
DURATION LONG
RISK LEVEL DANGEROUS.
RISK LEVEL HARMLESS.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
DATA mr_data TYPE REF TO data ##NEEDED.
METHODS event FOR TESTING.
METHODS event_backend FOR TESTING.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ltcl_test_db IMPLEMENTATION.
CLASS ltcl_test IMPLEMENTATION.
METHOD event.
METHOD z2ui5_if_app~main.
DATA(lo_event) = NEW z2ui5_cl_core_event_srv( ).
DATA(lv_event) = lo_event->get_event( `POST`).
cl_abap_unit_assert=>assert_equals(
act = lv_event
exp = `eB(['POST'])` ).
ENDMETHOD.
METHOD event_backend.
DATA(lo_event) = NEW z2ui5_cl_core_event_srv( ).
DATA(lv_event) = lo_event->get_event_client( z2ui5_if_client=>cs_event-popover_close ).
cl_abap_unit_assert=>assert_equals(
act = lv_event
exp = `eF('POPOVER_CLOSE')` ).
ENDMETHOD.
ENDCLASS.

View File

@ -130,28 +130,30 @@ CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
DATA(lo_ajson) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>parse( val ) ).
result-o_model = z2ui5_cl_ajson=>create_empty( ).
DATA(lo_model) = lo_ajson->slice( `/EDIT` ).
result-o_model->set( iv_path = `/EDIT` iv_val = lo_model ).
lo_ajson->delete( `/EDIT` ).
data(lv_model_edit_name) = `/` && z2ui5_if_core_types=>cs_ui5-two_way_model.
lo_ajson = lo_ajson->slice( `/S_FRONTEND`).
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->to_abap(
EXPORTING
iv_corresponding = abap_true
IMPORTING
ev_container = result-s_frontend ).
ev_container = result-s_front ).
result-s_control-check_launchpad = xsdbool( result-s_frontend-search CS `scenario=LAUNCHPAD` ).
IF result-s_frontend-id IS NOT INITIAL.
result-s_control-check_launchpad = xsdbool( result-s_front-search CS `scenario=LAUNCHPAD` ).
IF result-s_front-id IS NOT INITIAL.
RETURN.
ENDIF.
result-s_control-app_start = z2ui5_cl_util=>c_trim_upper( result-s_frontend-app_start ).
result-s_control-app_start = z2ui5_cl_util=>c_trim_upper( result-s_front-app_start ).
IF result-s_control-app_start IS NOT INITIAL.
RETURN.
ENDIF.
result-s_control-app_start = z2ui5_cl_util=>c_trim_upper(
z2ui5_cl_util=>url_param_get( val = `app_start` url = result-s_frontend-search ) ).
z2ui5_cl_util=>url_param_get( val = `app_start` url = result-s_front-search ) ).
CATCH cx_root INTO DATA(x).
RAISE EXCEPTION TYPE z2ui5_cx_util_error
@ -167,12 +169,12 @@ CLASS z2ui5_cl_core_json_srv IMPLEMENTATION.
DATA(ajson_result) = CAST z2ui5_if_ajson( z2ui5_cl_ajson=>create_empty(
ii_custom_mapping = z2ui5_cl_ajson_mapping=>create_upper_case( ) ) ).
ajson_result->set( iv_path = `/` iv_val = val-s_frontend ).
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( ).
result = `{` &&
|"S_FRONTEND":{ lv_frontend },| &&
|"S_FRONT":{ lv_frontend },| &&
|"MODEL":{ val-model }| &&
`}`.

View File

@ -1,4 +1,4 @@
CLASS ltcl_test_json_mapper DEFINITION FINAL FOR TESTING
CLASS ltcl_test DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
@ -9,17 +9,17 @@ CLASS ltcl_test_json_mapper DEFINITION FINAL FOR TESTING
ENDCLASS.
CLASS ltcl_test_json_mapper IMPLEMENTATION.
CLASS ltcl_test IMPLEMENTATION.
METHOD request_json_to_abap.
* DATA(lv_payload) = `{"EDIT":{"NAME":"test"},"ARGUMENTS":[],"S_FRONTEND":{"ID":"ID_NR","EDIT":{"NAME":"test"},"ORIGIN":"ORIGIN","PATHNAME":"PATHNAME","SEARCH":"SEARCH"` &&
* `,"VIEWNAME":"MAIN","EVENT":"BUTTON_POST","T_EVENT_ARG":[]}}`.
* `,"VIEW":"MAIN","EVENT":"BUTTON_POST","T_EVENT_ARG":[]}}`.
*
* DATA(lo_mapper) = NEW z2ui5_cl_fw_hlp_json_mapper( ).
* DATA(lo_mapper) = NEW z2ui5_cl_core_json_srv( ).
* DATA(ls_result) = lo_mapper->request_json_to_abap( lv_payload ).
*
* DATA(ls_exp) = VALUE z2ui5_if_fw_types=>ty_s_http_request_post(
* DATA(ls_exp) = VALUE z2ui5_if_core_types=>ty_s_http_request_post(
* s_frontend = VALUE #(
* id = `ID_NR`
* view = `MAIN`
@ -48,7 +48,7 @@ CLASS ltcl_test_json_mapper IMPLEMENTATION.
METHOD model_front_to_back.
* NEW z2ui5_cl_fw_http_mapper( )->model_front_to_back(
* NEW z2ui5_cl_core_json_srv( )->model_front_to_back(
* viewname = `MAIN`
* app = lo_ap
* t_attri = lt_attri

View File

@ -13,63 +13,109 @@ CLASS z2ui5_cl_core_model_srv DEFINITION
attri TYPE REF TO z2ui5_if_core_types=>ty_t_attri
app TYPE REF TO object.
METHODS main.
METHODS set_attri_ready.
METHODS dissolve.
METHODS attri_refs_update.
METHODS attri_before_save.
METHODS attri_after_load.
PROTECTED SECTION.
METHODS attri_get_val_ref
IMPORTING
ir_bind TYPE REF TO z2ui5_if_core_types=>ty_s_attri
iv_path TYPE clike
RETURNING
VALUE(result) TYPE REF TO data.
METHODS get_t_attri_by_dref
METHODS diss_struc
IMPORTING
val TYPE clike
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS get_t_attri_by_struc
METHODS diss_dref
IMPORTING
val TYPE clike
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS get_t_attri_by_include
METHODS diss_oref
IMPORTING
type TYPE REF TO cl_abap_datadescr
attri TYPE clike
ir_attri TYPE REF TO z2ui5_if_core_types=>ty_s_attri
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS get_t_attri_by_oref
IMPORTING
val TYPE clike OPTIONAL
PREFERRED PARAMETER val
RETURNING
VALUE(result) TYPE z2ui5_if_core_types=>ty_t_attri.
METHODS dissolve_main.
METHODS dissolve_struc.
METHODS dissolve_dref.
METHODS dissolve_oref.
METHODS dissolve_init.
PRIVATE SECTION.
ENDCLASS.
CLASS Z2UI5_CL_CORE_MODEL_SRV IMPLEMENTATION.
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 attri_get_val_ref.
FIELD-SYMBOLS <attri> TYPE any.
DATA(lv_name) = `MO_APP->` && ir_bind->name.
ASSIGN (lv_name) TO <attri>.
ASSIGN mo_app->(iv_path) TO <attri>.
IF sy-subrc <> 0.
ASSERT 1 = 0.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `DEREF_FAILED_TARGET_INITIAL`.
ENDIF.
GET REFERENCE OF <attri> INTO result.
@ -80,6 +126,17 @@ CLASS Z2UI5_CL_CORE_MODEL_SRV IMPLEMENTATION.
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.
me->mt_attri = attri.
@ -88,225 +145,152 @@ CLASS Z2UI5_CL_CORE_MODEL_SRV IMPLEMENTATION.
ENDMETHOD.
METHOD dissolve_dref.
METHOD dissolve.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_bind)
WHERE type_kind = cl_abap_classdescr=>typekind_dref
AND check_dissolved = abap_false.
IF mt_attri->* IS INITIAL.
dissolve_init( ).
RETURN.
ENDIF.
DATA(lt_attri) = get_t_attri_by_dref( lr_bind->name ).
IF lt_attri IS INITIAL.
CONTINUE.
ENDIF.
lr_bind->check_dissolved = abap_true.
INSERT LINES OF lt_attri INTO TABLE mt_attri->*.
ENDLOOP.
dissolve_main( ).
ENDMETHOD.
METHOD dissolve_oref.
METHOD dissolve_main.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_bind)
WHERE type_kind = cl_abap_classdescr=>typekind_oref
AND check_dissolved = abap_false
AND depth < 5.
DATA(lt_attri) = get_t_attri_by_oref( lr_bind->name ).
IF lt_attri IS INITIAL.
CONTINUE.
ENDIF.
lr_bind->check_dissolved = abap_true.
LOOP AT lt_attri REFERENCE INTO DATA(lr_attri).
lr_attri->depth = lr_bind->depth + 1.
ENDLOOP.
INSERT LINES OF lt_attri INTO TABLE mt_attri->*.
ENDLOOP.
ENDMETHOD.
METHOD dissolve_struc.
DATA(lt_attri_new) = VALUE z2ui5_if_core_types=>ty_t_attri( ).
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE ( type_kind = cl_abap_classdescr=>typekind_struct1
OR type_kind = cl_abap_classdescr=>typekind_struct2 )
AND check_dissolved = abap_false.
WHERE check_dissolved = abap_false.
lr_attri->check_dissolved = abap_true.
lr_attri->check_ready = abap_true.
DATA(lt_attri) = get_t_attri_by_struc( lr_attri->name ).
INSERT LINES OF lt_attri INTO TABLE mt_attri->*.
ENDLOOP.
ENDMETHOD.
METHOD get_t_attri_by_dref.
DATA(lv_name) = `MO_APP->` && val && `->*`.
FIELD-SYMBOLS <data> TYPE any.
ASSIGN (lv_name) TO <data>.
IF <data> IS NOT ASSIGNED.
RETURN.
ENDIF.
DATA(lo_descr) = cl_abap_datadescr=>describe_by_data( <data> ).
DATA(ls_new_bind) = VALUE z2ui5_if_core_types=>ty_s_attri(
name = val && `->*`
type_kind = lo_descr->type_kind
type = lo_descr->get_relative_name( )
check_ready = abap_true
check_temp = abap_true ).
INSERT ls_new_bind INTO TABLE result.
ENDMETHOD.
METHOD get_t_attri_by_include.
DATA(sdescr) = CAST cl_abap_structdescr( cl_abap_typedescr=>describe_by_name( type->absolute_name ) ).
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 ).
INSERT ls_attri INTO TABLE result.
ENDLOOP.
ENDMETHOD.
METHOD get_t_attri_by_oref.
DATA(lv_name) = COND #( WHEN val IS NOT INITIAL THEN `MO_APP` && `->` && val ELSE `MO_APP` ).
FIELD-SYMBOLS <obj> TYPE any.
ASSIGN (lv_name) TO <obj>.
IF sy-subrc <> 0 OR <obj> IS NOT BOUND.
RETURN.
ENDIF.
DATA(lt_attri2) = z2ui5_cl_util=>rtti_get_t_attri_by_object( <obj> ).
LOOP AT lt_attri2 INTO DATA(ls_attri2)
WHERE visibility = cl_abap_classdescr=>public
AND is_interface = abap_false.
DATA(ls_attri) = CORRESPONDING z2ui5_if_core_types=>ty_s_attri( ls_attri2 ).
IF val IS NOT INITIAL.
ls_attri-name = val && `->` && ls_attri-name.
ls_attri-check_temp = abap_true.
ENDIF.
INSERT ls_attri INTO TABLE result.
ENDLOOP.
ENDMETHOD.
METHOD get_t_attri_by_struc.
DATA(lv_name) = `MO_APP->` && val.
FIELD-SYMBOLS <attribute> TYPE any.
ASSIGN (lv_name) TO <attribute>.
ASSERT sy-subrc = 0.
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_comp_by_data( <attribute> ).
DATA(lv_attri) = z2ui5_cl_util=>c_replace_assign_struc( val ).
LOOP AT lt_comp REFERENCE INTO DATA(lr_comp).
DATA(lv_element) = lv_attri && lr_comp->name.
IF lr_comp->as_include = abap_true
OR lr_comp->type->type_kind = cl_abap_classdescr=>typekind_struct2
OR lr_comp->type->type_kind = cl_abap_classdescr=>typekind_struct1.
IF lr_comp->name IS INITIAL.
DATA(lt_attri) = me->get_t_attri_by_include( type = lr_comp->type
attri = lv_attri ).
ELSE.
lt_attri = get_t_attri_by_struc( lv_element ).
ENDIF.
INSERT LINES OF lt_attri INTO TABLE result.
ELSE.
DATA(lv_type_name) = substring_after( val = lr_comp->type->absolute_name sub = '\TYPE=').
IF z2ui5_cl_util=>boolean_check_by_name( lv_type_name ).
DATA(ls_attri) = VALUE z2ui5_if_core_types=>ty_s_attri(
name = lv_element
type = 'ABAP_BOOL'
type_kind = lr_comp->type->type_kind ).
ELSE.
ls_attri = VALUE z2ui5_if_core_types=>ty_s_attri(
name = lv_element
type_kind = lr_comp->type->type_kind ).
ENDIF.
INSERT ls_attri INTO TABLE result.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD main.
"step 0 / MO_APP->MV_VAL
IF mt_attri->* IS INITIAL.
DATA(lt_attri) = get_t_attri_by_oref( ).
INSERT LINES OF lt_attri INTO TABLE mt_attri->*.
ENDIF.
"step 1 / MO_APP->MS_STRUC-COMP
dissolve_struc( ).
"step 2 / MO_APP->MR_DATA->*
dissolve_dref( ).
"step 3 / MO_APP->MR_STRUC->COMP
dissolve_struc( ).
"step 4 / MO_APP->MO_OBJ->MV_VAL
dissolve_oref( ).
"step 5 / MO_APP->MO_OBJ->MR_STRUC-COMP
dissolve_struc( ).
"step 6 / MO_APP->MO_OBJ->MR_VAL->*
dissolve_dref( ).
"step 7 / MO_APP->MO_OBJ->MR_STRUC->COMP
dissolve_struc( ).
set_attri_ready( ).
ENDMETHOD.
METHOD set_attri_ready.
LOOP AT mt_attri->* REFERENCE INTO DATA(lr_attri)
WHERE r_ref IS NOT BOUND AND
bind_type <> z2ui5_if_core_types=>cs_bind_type-one_time.
CASE lr_attri->type_kind.
WHEN cl_abap_classdescr=>typekind_iref
OR cl_abap_classdescr=>typekind_intf.
DELETE mt_attri->*.
WHEN cl_abap_classdescr=>typekind_oref
OR cl_abap_classdescr=>typekind_dref
OR cl_abap_classdescr=>typekind_struct2
OR cl_abap_classdescr=>typekind_struct1.
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.
lr_attri->r_ref = attri_get_val_ref( lr_attri ).
ENDCASE.
ENDLOOP.
INSERT LINES OF lt_attri_new INTO TABLE mt_attri->*.
ENDMETHOD.
METHOD diss_dref.
FIELD-SYMBOLS <deref> TYPE any.
ASSIGN ir_attri->r_ref->* TO <deref>.
IF <deref> 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( <deref> ).
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(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_oref(
z2ui5_cl_util=>unassign_object( ir_attri->r_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(lv_name) = COND #( WHEN ir_attri->name IS NOT INITIAL THEN ir_attri->name && `->` ).
lv_name = lv_name && lr_attri->name.
DATA(ls_attri2) = VALUE z2ui5_if_core_types=>ty_s_attri( ).
ls_attri2-name = lv_name.
ls_attri2-r_ref = attri_get_val_ref( ls_attri2-name ).
ls_attri2-o_typedescr = cl_abap_datadescr=>describe_by_data_ref( ls_attri2-r_ref ).
ls_attri2-type_kind = z2ui5_cl_util=>rtti_get_type_kind_by_descr( ls_attri2-o_typedescr ).
INSERT ls_attri2 INTO TABLE result.
CATCH cx_root.
ENDTRY.
ENDLOOP.
ENDMETHOD.
METHOD diss_struc.
FIELD-SYMBOLS <any> TYPE any.
CASE ir_attri->type_kind.
WHEN cl_abap_typedescr=>typekind_struct1
OR cl_abap_typedescr=>typekind_struct2.
DATA(lv_name) = ir_attri->name && `-`.
ASSIGN ir_attri->r_ref TO <any>.
WHEN cl_abap_typedescr=>typekind_dref.
lv_name = ir_attri->name && `->`.
ASSIGN ir_attri->r_ref->* TO <any>.
ENDCASE.
DATA(lt_attri) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( <any> ).
LOOP AT lt_attri INTO DATA(ls_attri).
DATA(ls_attri2) = VALUE z2ui5_if_core_types=>ty_s_attri( ).
ls_attri2-name = lv_name && ls_attri-name.
ls_attri2-r_ref = attri_get_val_ref( lv_name && ls_attri-name ).
ls_attri2-o_typedescr = cl_abap_datadescr=>describe_by_data_ref( ls_attri2-r_ref ).
ls_attri2-type_kind = z2ui5_cl_util=>rtti_get_type_kind_by_descr( ls_attri2-o_typedescr ).
INSERT ls_attri2 INTO TABLE result.
ENDLOOP.
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.
ENDCLASS.

View File

@ -1,702 +1,132 @@
*
*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.
*
*ENDCLASS.
*
*CLASS ltcl_test_dissolve IMPLEMENTATION.
*
* METHOD test_dissolve_init.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA(lo_bind) = NEW z2ui5_cl_core_model_srv( ).
* lo_bind->mo_app = lo_app.
*
* lo_bind->dissolve_init( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_dref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* CREATE DATA lo_app->mr_struc.
* CREATE DATA lo_app->mr_value TYPE string.
*
* lo_bind->dissolve_init( ).
* lo_bind->dissolve_dref( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC->*` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE->*` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_oref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* CREATE DATA lo_app->mo_app->mr_struc.
* CREATE DATA lo_app->mo_app->mr_value TYPE string.
*
* lo_bind->dissolve_init( ).
* lo_bind->dissolve_oref( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MV_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_struc.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* lo_bind->dissolve_init( ).
* lo_bind->dissolve_struc( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_bind DEFINITION DEFERRED.
*CLASS z2ui5_cl_fw_binding DEFINITION LOCAL FRIENDS ltcl_test_bind.
*
*CLASS ltcl_test_bind DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* 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.
* DATA mv_value TYPE string.
* DATA mr_value TYPE REF TO data.
* DATA mr_struc TYPE REF TO s_01.
* DATA mo_app TYPE REF TO ltcl_test_bind.
*
* PRIVATE SECTION.
* METHODS test_value FOR TESTING RAISING cx_static_check.
* METHODS test_struc FOR TESTING RAISING cx_static_check.
* METHODS test_dref_val FOR TESTING RAISING cx_static_check.
* METHODS test_dref_struc FOR TESTING RAISING cx_static_check.
* METHODS test_oref_val FOR TESTING RAISING cx_static_check.
* METHODS test_oref_struc FOR TESTING RAISING cx_static_check.
* METHODS test_oref_dref_val FOR TESTING RAISING cx_static_check.
* METHODS test_local FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_bind IMPLEMENTATION.
*
* METHOD test_value.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( lo_app->mv_value ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MV_VALUE` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MV_VALUE` ).
*
* ENDMETHOD.
*
*
* METHOD test_struc.
*
** DATA(lo_app) = NEW ltcl_test_bind( ).
** DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
**
** lo_bind->mo_app = lo_app.
** lo_bind->mr_data = REF #( lo_app->ms_struc-s_02-s_03-s_04-input ).
** lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
**
** DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MS_STRUC-S_02-S_03-S_04-INPUT` ).
** DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
**
** cl_abap_unit_assert=>assert_equals(
** act = lv_result
** exp = `/MS_STRUC/S_02-S_03-S_04-INPUT` ).
*
* ENDMETHOD.
*
*
* METHOD test_dref_val.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* FIELD-SYMBOLS <any> TYPE any.
* CREATE DATA lo_app->mr_value TYPE string.
* ASSIGN lo_app->mr_value->* TO <any>.
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( <any> ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_VALUE->*` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MR_VALUE/*` ).
*
* ENDMETHOD.
*
* METHOD test_dref_struc.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* FIELD-SYMBOLS <any> TYPE any.
* CREATE DATA lo_app->mr_struc.
* ASSIGN lo_app->mr_struc->input TO <any>.
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( <any> ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_STRUC->INPUT` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MR_STRUC/INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_oref_val.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( lo_app->mo_app->mv_value ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MV_VALUE` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_APP/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_oref_struc.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( lo_app->mo_app->ms_struc-input ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MS_STRUC-INPUT` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_APP/MS_STRUC-INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_oref_dref_val.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* FIELD-SYMBOLS <any> TYPE any.
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* CREATE DATA lo_app->mo_app->mr_value TYPE string.
* ASSIGN lo_app->mo_app->mr_value->* TO <any>.
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( <any> ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MR_VALUE->*` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_APP/MR_VALUE->*` ).
*
* ENDMETHOD.
*
* METHOD test_local.
*
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* DATA(lv_value) = `test`.
* lo_bind->mr_data = REF #( lv_value ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_time.
*
* DATA(lv_result) = lo_bind->bind_local( ).
*
* IF lv_result IS INITIAL.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_value DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* DATA mv_value TYPE string.
*
* PROTECTED SECTION.
* PRIVATE SECTION.
*
* METHODS test_one_way FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_t_attri FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_multiple FOR TESTING RAISING cx_static_check.
* METHODS test_two_way FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_two_way_error FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_value IMPLEMENTATION.
*
* METHOD test_one_way.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_two_way.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/EDIT/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_t_attri.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mv_value ).
*
* lo_bind->main( ).
*
* DATA(ls_attri) = lo_bind->mt_attri[ name = `MV_VALUE` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way ] ##NEEDED.
*
* ENDMETHOD.
*
* METHOD test_one_way_multiple.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* DATA(lv_result2) = lo_bind2->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = lv_result2 ).
*
* ENDMETHOD.
*
* METHOD test_one_way_two_way_error.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mv_value ).
*
* lo_bind->main( ).
*
* DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lo_bind->mt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* TRY.
*
* lo_bind2->main( ).
* cl_abap_unit_assert=>fail( ).
*
* CATCH cx_root.
* ENDTRY.
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_structure DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* 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.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_lev1 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev2 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev3 FOR TESTING RAISING cx_static_check.
*
* METHODS test_one_way_lev4_long_name FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_structure IMPLEMENTATION.
*
* METHOD test_one_way_lev1.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev2.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-s_02-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-s_02-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/S_02-INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev3.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-s_02-s_03-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-s_02-s_03-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/S_02-S_03-INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev4_long_name.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-s_02-s_03-s_04-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-s_02-s_03-s_04-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/S_02-S_03-S_04-INPUT` ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_data_ref DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
*
*
* DATA mr_value TYPE REF TO data ##NEEDED.
* DATA mr_struc TYPE REF TO data ##NEEDED.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_value FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_data_ref IMPLEMENTATION.
*
* METHOD test_one_way_value.
*
*
*
* ENDMETHOD.
*
* METHOD test_one_way_struc.
*
*
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* TYPES:
* BEGIN OF ty_s_01,
* input TYPE string,
* input_02 TYPE string,
* input_03 TYPE string,
* END OF ty_s_01.
*
* DATA mv_value TYPE string.
* DATA ms_struc TYPE ty_s_01.
*
* DATA mo_obj TYPE REF TO ltcl_test_main_object.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_value FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object IMPLEMENTATION.
*
* METHOD test_one_way_value.
*
* DATA(lo_app) = NEW ltcl_test_main_object( ).
* lo_app->mo_obj = NEW #( ).
* lo_app->mo_obj->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mo_obj->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_OBJ/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_struc.
*
* DATA(lo_app) = NEW ltcl_test_main_object( ).
* lo_app->mo_obj = NEW #( ).
* lo_app->mo_obj->ms_struc-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mo_obj->ms_struc-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_OBJ/MS_STRUC-INPUT` ).
*
* ENDMETHOD.
*
*ENDCLASS.
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.
ENDCLASS.
CLASS ltcl_test_dissolve IMPLEMENTATION.
METHOD test_dissolve_init.
DATA(lo_app) = NEW ltcl_test_dissolve( ).
DATA lt_attri TYPE z2ui5_if_core_types=>ty_t_attri.
DATA(lo_bind) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->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_bind) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->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_bind) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app2 ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->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_bind) = NEW z2ui5_cl_core_model_srv(
attri = REF #( lt_attri )
app = lo_app ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->dissolve( ).
lo_bind->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.

View File

@ -61,18 +61,18 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION.
METHOD factory_by_frontend.
result = NEW #( mo_http_post ).
result->mo_app = z2ui5_cl_core_app=>db_load( mo_http_post->ms_request-s_frontend-id ).
result->mo_app = z2ui5_cl_core_app=>db_load( mo_http_post->ms_request-s_front-id ).
result->mo_app->ms_draft-id = z2ui5_cl_util=>uuid_get_c32( ).
result->mo_app->ms_draft-id_prev = mo_http_post->ms_request-s_frontend-id.
result->ms_actual-view = mo_http_post->ms_request-s_frontend-view.
result->mo_app->ms_draft-id_prev = mo_http_post->ms_request-s_front-id.
result->ms_actual-view = mo_http_post->ms_request-s_front-view.
result->mo_app->model_json_parse(
view = mo_http_post->ms_request-s_frontend-view
view = mo_http_post->ms_request-s_front-view
io_json_model = mo_http_post->ms_request-o_model ).
result->ms_actual-event = mo_http_post->ms_request-s_frontend-event.
result->ms_actual-t_event_arg = mo_http_post->ms_request-s_frontend-t_event_arg.
result->ms_actual-event = mo_http_post->ms_request-s_front-event.
result->ms_actual-t_event_arg = mo_http_post->ms_request-s_front-t_event_arg.
result->ms_actual-check_on_navigated = abap_false.
ENDMETHOD.
@ -91,17 +91,19 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION.
result->ms_actual-check_on_navigated = abap_true.
CATCH cx_root into data(x).
CATCH cx_root INTO DATA(x).
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `App with name ` && mo_http_post->ms_request-s_control-app_start && ` not found...`
val = `App with name ` && mo_http_post->ms_request-s_control-app_start && ` not found...`
previous = x.
ENDTRY.
ENDMETHOD.
METHOD factory_stack_call.
mo_app->db_save( ).
ms_next-o_app_call->id_draft = COND string(
WHEN ms_next-o_app_call->id_draft IS INITIAL THEN z2ui5_cl_util=>uuid_get_c32( )
@ -117,43 +119,48 @@ CLASS z2ui5_cl_core_action IMPLEMENTATION.
TRY.
DATA(lo_app) = z2ui5_cl_core_app=>db_load( ms_next-o_app_call->id_draft ).
result->mo_app->mo_app = lo_app->mo_app.
result->mo_app->mt_attri = lo_app->mt_attri.
result->mo_app = lo_app.
result->mo_app->mo_app = ms_next-o_app_leave.
CATCH cx_root.
ENDTRY.
result->mo_app->ms_draft-id_prev_app_stack = mo_app->ms_draft-id.
mo_app->db_save( ).
ENDMETHOD.
METHOD factory_stack_leave.
mo_app->db_save( ).
ms_next-o_app_leave->id_draft = COND string(
WHEN ms_next-o_app_leave->id_draft IS INITIAL THEN z2ui5_cl_util=>uuid_get_c32( )
ELSE ms_next-o_app_leave->id_draft ).
result = NEW #( mo_http_post ).
result->mo_app->mo_app = ms_next-o_app_leave.
result->mo_app->mo_app = ms_next-o_app_leave.
TRY.
DATA(lo_app) = z2ui5_cl_core_app=>db_load( ms_next-o_app_leave->id_draft ).
result->mo_app = lo_app.
result->mo_app->mo_app = ms_next-o_app_leave.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( result->mo_app->mt_attri )
app = result->mo_app->mo_app ).
lo_model->attri_refs_update( ).
CATCH cx_root.
ENDTRY.
result->mo_app->ms_draft-id = ms_next-o_app_leave->id_draft.
result->mo_app->ms_draft-id_prev = mo_app->ms_draft-id.
result->mo_app->ms_draft-id_prev_app = mo_app->ms_draft-id.
result->ms_actual-check_on_navigated = abap_true.
result->ms_next-s_set = ms_next-s_set.
TRY.
DATA(lo_db) = NEW z2ui5_cl_core_draft_srv( ).
DATA(ls_draft) = lo_db->read_info( result->mo_app->ms_draft-id ).
result->mo_app->ms_draft-id_prev_app_stack = ls_draft-id_prev_app_stack.
CATCH cx_root.
result->mo_app->ms_draft-id_prev_app_stack = mo_app->ms_draft-id_prev_app_stack.
ENDTRY.
mo_app->db_save( ).
ENDMETHOD.

View File

@ -1,71 +1,20 @@
*CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING
* DURATION LONG
* RISK LEVEL HARMLESS.
*
* PRIVATE SECTION.
* METHODS test_req_begin_fw_start FOR TESTING RAISING cx_static_check.
* METHODS test_req_begin_app_start FOR TESTING RAISING cx_static_check.
* METHODS test_req_end FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS z2ui5_cl_fw_controller DEFINITION LOCAL FRIENDS ltcl_unit_test.
*
*CLASS ltcl_unit_test IMPLEMENTATION.
*
* METHOD test_req_begin_fw_start.
*
* DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https:/url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100","VERSION":"com.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
*
* DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
*
* cl_abap_unit_assert=>assert_bound( lo_handler->ms_db-app ).
*
* DATA(lo_app_fw) = CAST z2ui5_cl_fw_app_startup( lo_handler->ms_db-app ) ##NEEDED.
*
* ENDMETHOD.
*
* METHOD test_req_begin_app_start.
*
* DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_app_hello_world","VERSION":"c` &&
* `om.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
*
* DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
*
* cl_abap_unit_assert=>assert_bound( lo_handler->ms_db-app ).
*
* DATA(lo_app_fw) = CAST z2ui5_cl_app_hello_world( lo_handler->ms_db-app ) ##NEEDED.
*
* ENDMETHOD.
*
*
* METHOD test_req_end.
*
* DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_app_hello_world","VERSION":"c` &&
* `om.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
*
* DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
*
* CAST z2ui5_if_app( lo_handler->ms_db-app )->main( NEW z2ui5_cl_fw_client( lo_handler ) ).
*
* DATA(lv_resp) = lo_handler->request_end( ).
*
* IF lv_resp NS `NAME`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* IF lv_resp NS `EDIT`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* IF lv_resp NS `ID`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* IF lv_resp NS `mvc:View`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* ENDMETHOD.
*
*ENDCLASS.
CLASS ltcl_test DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
first_test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_test IMPLEMENTATION.
METHOD first_test.
DATA(lo_http) = NEW z2ui5_cl_core_http_post( `` ).
DATA(lo_action) = NEW z2ui5_cl_core_action( lo_http ) ##NEEDED.
ENDMETHOD.
ENDCLASS.

View File

@ -13,7 +13,7 @@ CLASS z2ui5_cl_core_app DEFINITION
METHODS attri_get_by_data
IMPORTING
!val TYPE ref to data
!val TYPE REF TO data
RETURNING
VALUE(result) TYPE REF TO z2ui5_if_core_types=>ty_s_attri .
@ -61,26 +61,11 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
IMPORTING
any = result ).
LOOP AT result->mt_attri REFERENCE INTO DATA(lr_attri)
WHERE data_rtti IS NOT INITIAL
AND type_kind = cl_abap_classdescr=>typekind_dref.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( result->mt_attri )
app = result->mo_app ).
DATA(lv_assign) = 'RESULT->MO_APP->' && lr_attri->name.
ASSIGN (lv_assign) TO FIELD-SYMBOL(<val>).
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `LOAD_DRAFT_FROM_DATABASE_FAILED / ATTRI_NOT_FOUND ` && lr_attri->name.
ENDIF.
z2ui5_cl_util=>xml_srtti_parse(
EXPORTING
rtti_data = lr_attri->data_rtti
IMPORTING
e_data = <val> ).
CLEAR lr_attri->data_rtti.
ENDLOOP.
lo_model->attri_after_load( ).
ENDMETHOD.
@ -89,38 +74,10 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
TRY.
LOOP AT mt_attri REFERENCE INTO DATA(lr_attri).
CLEAR lr_attri->r_ref.
IF lr_attri->bind_type = z2ui5_if_core_types=>cs_bind_type-one_time.
DELETE mt_attri.
ENDIF.
ENDLOOP.
result = z2ui5_cl_util=>xml_stringify( me ).
RETURN.
CATCH cx_xslt_serialization_error INTO DATA(x).
ENDTRY.
TRY.
LOOP AT mt_attri REFERENCE INTO lr_attri
WHERE type_kind = cl_abap_classdescr=>typekind_dref.
DATA(lv_name) = `MO_APP->` && lr_attri->name && `->*`.
DATA(lv_name2) = `MO_APP->` && lr_attri->name.
ASSIGN (lv_name) TO FIELD-SYMBOL(<val>).
ASSIGN (lv_name2) TO FIELD-SYMBOL(<val_ref>).
lr_attri->data_rtti = z2ui5_cl_util=>xml_srtti_stringify( <val> ).
CLEAR <val>.
CLEAR <val_ref>.
ENDLOOP.
LOOP AT mt_attri REFERENCE INTO lr_attri.
CLEAR lr_attri->r_ref.
ENDLOOP.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( mt_attri )
app = me->mo_app ).
lo_model->attri_before_save( ).
result = z2ui5_cl_util=>xml_stringify( me ).
@ -128,7 +85,7 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
EXPORTING
val = `<p>` && x->previous->get_text( ) && `<p>` && x2->get_text( ) && `<p> Please check if all generic data references are public attributes of your class`.
val = `<p>` && x2->get_text( ) && `<p> Please check if all generic data references are public attributes of your class`.
ENDTRY.
@ -137,7 +94,19 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
METHOD attri_get_by_data.
DO 3 TIMES.
TRY.
result = REF #( mt_attri[ r_ref = val ] ).
RETURN.
CATCH cx_root.
ENDTRY.
DATA(lo_model) = NEW z2ui5_cl_core_model_srv(
attri = REF #( mt_attri )
app = mo_app ).
DO 5 TIMES.
lo_model->dissolve( ).
TRY.
result = REF #( mt_attri[ r_ref = val ] ).
@ -145,11 +114,6 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
CATCH cx_root.
ENDTRY.
DATA(lo_dissolver) = NEW z2ui5_cl_core_model_srv(
attri = REF #( mt_attri )
app = mo_app ).
lo_dissolver->main( ).
ENDDO.
RAISE EXCEPTION TYPE z2ui5_cx_util_error
@ -185,11 +149,6 @@ CLASS z2ui5_cl_core_app IMPLEMENTATION.
METHOD model_json_parse.
DATA(lo_dissolver) = NEW z2ui5_cl_core_model_srv(
attri = REF #( mt_attri )
app = mo_app ).
lo_dissolver->set_attri_ready( ).
DATA(lo_json_mapper) = NEW z2ui5_cl_core_json_srv( ).
lo_json_mapper->model_client_to_server(
view = view

View File

@ -1,760 +0,0 @@
*
*CLASS ltcl_test_dissolve DEFINITION DEFERRED.
*CLASS z2ui5_cl_fw_binding 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.
*
*ENDCLASS.
*
*CLASS ltcl_test_dissolve IMPLEMENTATION.
*
* METHOD test_dissolve_init.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* lo_bind->dissolve_init( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_dref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* CREATE DATA lo_app->mr_struc.
* CREATE DATA lo_app->mr_value TYPE string.
*
* lo_bind->dissolve_init( ).
* lo_bind->dissolve_dref( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC->*` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE->*` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_oref.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* CREATE DATA lo_app->mo_app->mr_struc.
* CREATE DATA lo_app->mo_app->mr_value TYPE string.
*
* lo_bind->dissolve_init( ).
* lo_bind->dissolve_oref( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MV_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP->MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
* METHOD test_dissolve_struc.
*
* DATA(lo_app) = NEW ltcl_test_dissolve( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* lo_bind->mo_app = lo_app.
*
* lo_bind->dissolve_init( ).
* lo_bind->dissolve_struc( ).
* DATA(lt_dissolve) = lo_bind->mt_attri.
*
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MO_APP` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC-S_02-S_03-S_04-INPUT` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MR_VALUE` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MS_STRUC` ] OPTIONAL ) ).
* cl_abap_unit_assert=>assert_not_initial( VALUE #( lt_dissolve[ name = `MV_VALUE` ] OPTIONAL ) ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_bind DEFINITION DEFERRED.
*CLASS z2ui5_cl_fw_binding DEFINITION LOCAL FRIENDS ltcl_test_bind.
*
*CLASS ltcl_test_bind DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* 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.
* DATA mv_value TYPE string.
* DATA mr_value TYPE REF TO data.
* DATA mr_struc TYPE REF TO s_01.
* DATA mo_app TYPE REF TO ltcl_test_bind.
*
* PRIVATE SECTION.
* METHODS test_value FOR TESTING RAISING cx_static_check.
* METHODS test_struc FOR TESTING RAISING cx_static_check.
* METHODS test_dref_val FOR TESTING RAISING cx_static_check.
* METHODS test_dref_struc FOR TESTING RAISING cx_static_check.
* METHODS test_oref_val FOR TESTING RAISING cx_static_check.
* METHODS test_oref_struc FOR TESTING RAISING cx_static_check.
* METHODS test_oref_dref_val FOR TESTING RAISING cx_static_check.
* METHODS test_local FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_bind IMPLEMENTATION.
*
* METHOD test_value.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( lo_app->mv_value ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MV_VALUE` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MV_VALUE` ).
*
* ENDMETHOD.
*
*
* METHOD test_struc.
*
** DATA(lo_app) = NEW ltcl_test_bind( ).
** DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
**
** lo_bind->mo_app = lo_app.
** lo_bind->mr_data = REF #( lo_app->ms_struc-s_02-s_03-s_04-input ).
** lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
**
** DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MS_STRUC-S_02-S_03-S_04-INPUT` ).
** DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
**
** cl_abap_unit_assert=>assert_equals(
** act = lv_result
** exp = `/MS_STRUC/S_02-S_03-S_04-INPUT` ).
*
* ENDMETHOD.
*
*
* METHOD test_dref_val.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* FIELD-SYMBOLS <any> TYPE any.
* CREATE DATA lo_app->mr_value TYPE string.
* ASSIGN lo_app->mr_value->* TO <any>.
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( <any> ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_VALUE->*` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MR_VALUE/*` ).
*
* ENDMETHOD.
*
* METHOD test_dref_struc.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* FIELD-SYMBOLS <any> TYPE any.
* CREATE DATA lo_app->mr_struc.
* ASSIGN lo_app->mr_struc->input TO <any>.
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( <any> ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MR_STRUC->INPUT` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MR_STRUC/INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_oref_val.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( lo_app->mo_app->mv_value ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MV_VALUE` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_APP/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_oref_struc.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( lo_app->mo_app->ms_struc-input ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MS_STRUC-INPUT` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_APP/MS_STRUC-INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_oref_dref_val.
*
* DATA(lo_app) = NEW ltcl_test_bind( ).
* FIELD-SYMBOLS <any> TYPE any.
* lo_app->mo_app = NEW #( ).
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
*
* CREATE DATA lo_app->mo_app->mr_value TYPE string.
* ASSIGN lo_app->mo_app->mr_value->* TO <any>.
*
* lo_bind->mo_app = lo_app.
* lo_bind->mr_data = REF #( <any> ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way.
*
* DATA(ls_attri) = VALUE z2ui5_cl_fw_binding=>ty_s_attri( name = `MO_APP->MR_VALUE->*` ).
* DATA(lv_result) = lo_bind->bind( REF #( ls_attri ) ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_APP/MR_VALUE->*` ).
*
* ENDMETHOD.
*
* METHOD test_local.
*
* DATA(lo_bind) = NEW z2ui5_cl_fw_binding( ).
* DATA(lv_value) = `test`.
* lo_bind->mr_data = REF #( lv_value ).
* lo_bind->mv_type = z2ui5_cl_fw_binding=>cs_bind_type-one_time.
*
* DATA(lv_result) = lo_bind->bind_local( ).
*
* IF lv_result IS INITIAL.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_value DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* DATA mv_value TYPE string.
*
* PROTECTED SECTION.
* PRIVATE SECTION.
*
* METHODS test_one_way FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_t_attri FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_multiple FOR TESTING RAISING cx_static_check.
* METHODS test_two_way FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_two_way_error FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_value IMPLEMENTATION.
*
* METHOD test_one_way.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_two_way.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/EDIT/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_t_attri.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mv_value ).
*
* lo_bind->main( ).
*
* DATA(ls_attri) = lo_bind->mt_attri[ name = `MV_VALUE` bind_type = z2ui5_cl_fw_binding=>cs_bind_type-one_way ] ##NEEDED.
*
* ENDMETHOD.
*
* METHOD test_one_way_multiple.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* DATA(lv_result2) = lo_bind2->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = lv_result2 ).
*
* ENDMETHOD.
*
* METHOD test_one_way_two_way_error.
*
* DATA(lo_app) = NEW ltcl_test_main_value( ).
* lo_app->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mv_value ).
*
* lo_bind->main( ).
*
* DATA(lo_bind2) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lo_bind->mt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-two_way
* data = lo_app->mv_value ).
*
* TRY.
*
* lo_bind2->main( ).
* cl_abap_unit_assert=>fail( ).
*
* CATCH cx_root.
* ENDTRY.
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_structure DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* 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.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_lev1 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev2 FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_lev3 FOR TESTING RAISING cx_static_check.
*
* METHODS test_one_way_lev4_long_name FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_structure IMPLEMENTATION.
*
* METHOD test_one_way_lev1.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev2.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-s_02-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-s_02-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/S_02-INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev3.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-s_02-s_03-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-s_02-s_03-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/S_02-S_03-INPUT` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_lev4_long_name.
*
* DATA(lo_app) = NEW ltcl_test_main_structure( ).
* lo_app->ms_struc-s_02-s_03-s_04-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->ms_struc-s_02-s_03-s_04-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MS_STRUC/S_02-S_03-S_04-INPUT` ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_data_ref DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
*
*
* DATA mr_value TYPE REF TO data ##NEEDED.
* DATA mr_struc TYPE REF TO data ##NEEDED.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_value FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_data_ref IMPLEMENTATION.
*
* METHOD test_one_way_value.
*
*
*
* ENDMETHOD.
*
* METHOD test_one_way_struc.
*
*
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* TYPES:
* BEGIN OF ty_s_01,
* input TYPE string,
* input_02 TYPE string,
* input_03 TYPE string,
* END OF ty_s_01.
*
* DATA mv_value TYPE string.
* DATA ms_struc TYPE ty_s_01.
*
* DATA mo_obj TYPE REF TO ltcl_test_main_object.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_value FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check.
*
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object IMPLEMENTATION.
*
* METHOD test_one_way_value.
*
* DATA(lo_app) = NEW ltcl_test_main_object( ).
* lo_app->mo_obj = NEW #( ).
* lo_app->mo_obj->mv_value = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mo_obj->mv_value ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_OBJ/MV_VALUE` ).
*
* ENDMETHOD.
*
* METHOD test_one_way_struc.
*
* DATA(lo_app) = NEW ltcl_test_main_object( ).
* lo_app->mo_obj = NEW #( ).
* lo_app->mo_obj->ms_struc-input = `my value`.
*
* DATA(lt_attri) = VALUE z2ui5_cl_fw_binding=>ty_t_attri( ).
*
* DATA(lo_bind) = z2ui5_cl_fw_binding=>factory(
* app = lo_app
* attri = lt_attri
* type = z2ui5_cl_fw_binding=>cs_bind_type-one_way
* data = lo_app->mo_obj->ms_struc-input ).
*
* DATA(lv_result) = lo_bind->main( ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lv_result
* exp = `/MO_OBJ/MS_STRUC-INPUT` ).
*
* ENDMETHOD.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object_ref_app DEFINITION.
*
* PUBLIC SECTION.
*
* TYPES:
* BEGIN OF ty_s_01,
* input TYPE string,
* input_02 TYPE string,
* input_03 TYPE string,
* END OF ty_s_01.
* TYPES ty_t_01 TYPE STANDARD TABLE OF ty_s_01 WITH EMPTY KEY ##NEEDED.
*
* DATA mr_value TYPE REF TO data ##NEEDED.
* DATA mr_struc TYPE REF TO data ##NEEDED.
* DATA mr_tab TYPE REF TO data ##NEEDED.
*
* PRIVATE SECTION.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object_ref DEFINITION FINAL FOR TESTING
* DURATION MEDIUM
* RISK LEVEL HARMLESS.
*
* PUBLIC SECTION.
*
* DATA mo_obj TYPE REF TO ltcl_test_main_object_ref_app ##NEEDED.
*
* PRIVATE SECTION.
*
* METHODS test_one_way_value FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_struc FOR TESTING RAISING cx_static_check.
* METHODS test_one_way_tab FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS ltcl_test_main_object_ref IMPLEMENTATION.
*
* METHOD test_one_way_value.
*
*
*
* ENDMETHOD.
*
* METHOD test_one_way_struc.
*
*
*
* ENDMETHOD.
*
* METHOD test_one_way_tab.
*
*
*
* ENDMETHOD.
*
*ENDCLASS.

View File

@ -10,7 +10,6 @@
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
</VSEOCLASS>
</asx:values>
</asx:abap>

View File

@ -47,7 +47,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_frontend )
s_config = CORRESPONDING #( mo_action->mo_http_post->ms_request-s_front )
).
ENDMETHOD.
@ -225,7 +225,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
path_only = path
custom_filter = custom_filter
custom_mapper = custom_mapper
tab = tab
tab = z2ui5_cl_util=>conv_get_as_data_ref( tab )
tab_index = tab_index ) ).
ENDMETHOD.
@ -251,7 +251,7 @@ CLASS z2ui5_cl_core_client IMPLEMENTATION.
custom_filter_back = custom_filter_back
custom_mapper = custom_mapper
custom_mapper_back = custom_mapper_back
tab = tab
tab = z2ui5_cl_util=>conv_get_as_data_ref( tab )
tab_index = tab_index ) ).
ENDMETHOD.

View File

@ -1,6 +1,6 @@
CLASS ltcl_test_client DEFINITION FINAL FOR TESTING
DURATION LONG
RISK LEVEL DANGEROUS.
RISK LEVEL harmless.
PRIVATE SECTION.
METHODS first_test FOR TESTING RAISING cx_static_check.
@ -12,9 +12,9 @@ CLASS ltcl_test_client IMPLEMENTATION.
METHOD first_test.
* DATA(lo_http) = NEW z2ui5_cl_fw_http_post( `` ).
* DATA(lo_app) = NEW z2ui5_cl_fw_controller( lo_http ).
* DATA(lo_client) = NEW z2ui5_cl_fw_client( lo_app ) ##NEEDED.
DATA(lo_http) = NEW z2ui5_cl_core_http_post( `` ).
DATA(lo_action) = NEW z2ui5_cl_core_action( lo_http ).
DATA(lo_client) = NEW z2ui5_cl_core_client( lo_action ) ##NEEDED.
ENDMETHOD.

View File

@ -220,7 +220,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` }` && |\n| &&
` sap.z2ui5.oView.destroy();` && |\n| &&
` },` && |\n| &&
` onEventFrontend(...args) {` && |\n| &&
` eF(...args) {` && |\n| &&
` sap.z2ui5.onBeforeEventFrontend.forEach(item => {` && |\n| &&
` if (item !== undefined) {` && |\n| &&
` item(args);` && |\n| &&
@ -228,7 +228,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` }` && |\n| &&
` )` && |\n| &&
` let oCrossAppNavigator;` && |\n| &&
` switch (args[0].EVENT) {` && |\n| &&
` switch (args[0]) {` && |\n| &&
` case 'CROSS_APP_NAV_TO_PREV_APP':` && |\n| &&
` oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");` && |\n| &&
` oCrossAppNavigator.backToPreviousApp();` && |\n| &&
@ -284,7 +284,7 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` break;` && |\n| &&
` }` && |\n| &&
` },` && |\n| &&
` onEvent(...args) {` && |\n| &&
` eB(...args) {` && |\n| &&
` if (sap.z2ui5.isBusy) {` && |\n| &&
` if (sap.z2ui5.isBusy == true) {` && |\n| &&
` sap.z2ui5.busyDialog = new sap.m.BusyDialog();` && |\n| &&
@ -301,30 +301,30 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` BusyIndicator.show();` && |\n| &&
` sap.z2ui5.oBody = {};` && |\n| &&
` if ( sap.z2ui5.oController == this ) {` && |\n| &&
` sap.z2ui5.oBody.EDIT = sap.z2ui5.oView.getModel().getData().EDIT;` && |\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.EDIT = sap.z2ui5.oViewPopup.getModel().getData().EDIT;` && |\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.EDIT = sap.z2ui5.oViewPopover.getModel().getData().EDIT;` && |\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.EDIT = sap.z2ui5.oViewNest.getModel().getData().EDIT;` && |\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.EDIT = sap.z2ui5.oViewNest2.getModel().getData().EDIT;` && |\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].CHECK_VIEW_DESTROY) {` && |\n| &&
` if (args[0][1]) {` && |\n| &&
` sap.z2ui5.oController.ViewDestroy();` && |\n| &&
` }` && |\n| &&
` sap.z2ui5.oBody.ID = sap.z2ui5.oResponse.ID;` && |\n| &&
@ -405,8 +405,8 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` } else {` && |\n| &&
` const responseData = await response.json();` && |\n| &&
` sap.z2ui5.oController.responseSuccess({` && |\n| &&
` ID : responseData.S_FRONTEND.ID,` && |\n| &&
` PARAMS : responseData.S_FRONTEND.PARAMS,` && |\n| &&
` ID : responseData.S_FRONT.ID,` && |\n| &&
` PARAMS : responseData.S_FRONT.PARAMS,` && |\n| &&
` OVIEWMODEL : responseData.MODEL,` && |\n| &&
` });` && |\n| &&
` }` && |\n| &&
@ -415,11 +415,11 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` sap.z2ui5.checkTimerActive = false;` && |\n| &&
` sap.z2ui5.checkNestAfter = false;` && |\n| &&
` sap.z2ui5.checkNestAfter2 = false;` && |\n| &&
` let event = (args) => { if ( args != undefined ) { return args[ 0 ].EVENT; } };` && |\n| &&
` sap.z2ui5.oBody.S_FRONTEND = {` && |\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| &&
` EDIT: sap.z2ui5?.oBody?.EDIT,` && |\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| &&
@ -428,12 +428,17 @@ CLASS z2ui5_cl_core_http_get IMPLEMENTATION.
` 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_FRONTEND.T_EVENT_ARG = sap.z2ui5.oBody?.ARGUMENTS;` && |\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_FRONTEND.EDIT;` && |\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| &&

View File

@ -65,7 +65,7 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION.
DATA(lo_json_mapper) = NEW z2ui5_cl_core_json_srv( ).
ms_request = lo_json_mapper->request_json_to_abap( mv_request_json ).
IF ms_request-s_frontend-id IS NOT INITIAL.
IF ms_request-s_front-id IS NOT INITIAL.
mo_action = mo_action->factory_by_frontend( ).
ELSEIF ms_request-s_control-app_start IS NOT INITIAL.
@ -84,10 +84,10 @@ CLASS z2ui5_cl_core_http_post IMPLEMENTATION.
METHOD main_end.
ms_response = VALUE #(
s_frontend-params = mo_action->ms_next-s_set
s_frontend-id = mo_action->mo_app->ms_draft-id
s_frontend-app = z2ui5_cl_util=>rtti_get_classname_by_ref( mo_action->mo_app->mo_app )
s_frontend-app_start = ms_request-s_control-app_start
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( ) ).
DATA(lo_json_mapper) = NEW z2ui5_cl_core_json_srv( ).

View File

@ -14,22 +14,94 @@ CLASS ltcl_test_handler_post IMPLEMENTATION.
METHOD load_startup_app.
* DATA(lv_payload) = `{"S_FRONTEND":{"ORIGIN":"ORIGIN","PATHNAME":"PATHNAME","SEARCH":""}}`.
* DATA(lo_post) = NEW z2ui5_cl_fw_http_post( lv_payload ).
* lo_post->main_begin( ).
*
* cl_abap_unit_assert=>assert_bound( lo_post->cntrl ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lo_post->ms_request-s_frontend-origin
* exp = `ORIGIN` ).
*
* cl_abap_unit_assert=>assert_equals(
* act = lo_post->ms_request-s_frontend-pathname
* exp = `PATHNAME` ).
*
* DATA(lo_startup) = CAST z2ui5_cl_fw_app_startup( lo_post->cntrl->ms_draft-app ) ##NEEDED.
DATA(lv_payload) = `{"S_FRONT":{"ORIGIN":"ORIGIN","PATHNAME":"PATHNAME","SEARCH":""}}`.
DATA(lo_post) = NEW z2ui5_cl_core_http_post( lv_payload ).
lo_post->main_begin( ).
cl_abap_unit_assert=>assert_bound( lo_post->mo_action ).
cl_abap_unit_assert=>assert_equals(
act = lo_post->ms_request-s_front-origin
exp = `ORIGIN` ).
cl_abap_unit_assert=>assert_equals(
act = lo_post->ms_request-s_front-pathname
exp = `PATHNAME` ).
DATA(lo_startup) = CAST z2ui5_cl_core_app_startup( lo_post->mo_action->mo_app->mo_app ) ##NEEDED.
ENDMETHOD.
ENDCLASS.
*CLASS ltcl_unit_test DEFINITION FINAL FOR TESTING
* DURATION LONG
* RISK LEVEL HARMLESS.
*
* PRIVATE SECTION.
* METHODS test_req_begin_fw_start FOR TESTING RAISING cx_static_check.
* METHODS test_req_begin_app_start FOR TESTING RAISING cx_static_check.
* METHODS test_req_end FOR TESTING RAISING cx_static_check.
*
*ENDCLASS.
*
*CLASS z2ui5_cl_fw_controller DEFINITION LOCAL FRIENDS ltcl_unit_test.
*
*CLASS ltcl_unit_test IMPLEMENTATION.
*
* METHOD test_req_begin_fw_start.
*
* DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https:/url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100","VERSION":"com.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
*
* DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
*
* cl_abap_unit_assert=>assert_bound( lo_handler->ms_db-app ).
*
* DATA(lo_app_fw) = CAST z2ui5_cl_fw_app_startup( lo_handler->ms_db-app ) ##NEEDED.
*
* ENDMETHOD.
*
* METHOD test_req_begin_app_start.
*
* DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_app_hello_world","VERSION":"c` &&
* `om.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
*
* DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
*
* cl_abap_unit_assert=>assert_bound( lo_handler->ms_db-app ).
*
* DATA(lo_app_fw) = CAST z2ui5_cl_app_hello_world( lo_handler->ms_db-app ) ##NEEDED.
*
* ENDMETHOD.
*
*
* METHOD test_req_end.
*
* DATA(lv_body) = `{"OLOCATION":{"ORIGIN":"https://url.abap-web.us10.hana.ondemand.com","PATHNAME":"/sap/bc/http/sap/z_http_service_for_ui","SEARCH":"?sap-client=100&app_start=z2ui5_cl_app_hello_world","VERSION":"c` &&
* `om.sap.ui5.dist:sapui5-sdk-dist:1.115.0:war"}}`.
*
* DATA(lo_handler) = z2ui5_cl_fw_controller=>request_begin( lv_body ).
*
* CAST z2ui5_if_app( lo_handler->ms_db-app )->main( NEW z2ui5_cl_fw_client( lo_handler ) ).
*
* DATA(lv_resp) = lo_handler->request_end( ).
*
* IF lv_resp NS `NAME`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* IF lv_resp NS `EDIT`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* IF lv_resp NS `ID`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* IF lv_resp NS `mvc:View`.
* cl_abap_unit_assert=>fail( ).
* ENDIF.
*
* ENDMETHOD.
*
*ENDCLASS.

View File

@ -1,6 +1,13 @@
INTERFACE z2ui5_if_core_types
PUBLIC.
CONSTANTS:
BEGIN OF cs_ui5,
event_backend_function TYPE string VALUE `eB`,
event_frontend_function TYPE string VALUE `eF`,
two_way_model TYPE string VALUE `XX`,
END OF cs_ui5.
CONSTANTS:
BEGIN OF cs_bind_type,
one_way TYPE string VALUE `ONE_WAY`,
@ -40,6 +47,8 @@ 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,
s_rtti_descr type abap_componentdescr,
END OF ty_s_attri.
TYPES ty_t_attri TYPE SORTED TABLE OF ty_s_attri WITH UNIQUE KEY name.
@ -97,19 +106,19 @@ INTERFACE z2ui5_if_core_types
TYPES:
BEGIN OF ty_s_http_response_post,
BEGIN OF s_frontend,
BEGIN OF s_front,
params TYPE ty_s_next_frontend,
id TYPE string,
app_start TYPE string,
app TYPE string,
END OF s_frontend,
END OF s_front,
model TYPE string,
END OF ty_s_http_response_post.
TYPES:
BEGIN OF ty_s_http_request_post,
o_model TYPE REF TO z2ui5_if_ajson,
BEGIN OF s_frontend,
BEGIN OF s_front,
id TYPE string,
view TYPE string,
t_event_arg TYPE string_table,
@ -119,7 +128,7 @@ INTERFACE z2ui5_if_core_types
search TYPE string,
event TYPE string,
t_startup_params TYPE z2ui5_if_types=>ty_t_name_value,
END OF s_frontend,
END OF s_front,
BEGIN OF s_control,
check_launchpad TYPE abap_bool,
app_start TYPE string,

View File

@ -5,7 +5,7 @@
<VSEOINTERF>
<CLSNAME>Z2UI5_IF_CORE_TYPES</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>abap2UI5 - fw types</DESCRIPT>
<DESCRIPT>abap2UI5 - core types</DESCRIPT>
<EXPOSURE>2</EXPOSURE>
<STATE>1</STATE>
<UNICODE>X</UNICODE>

View File

@ -35,7 +35,7 @@ ENDCLASS.
CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
CLASS z2ui5_cl_core_app_startup IMPLEMENTATION.
METHOD factory.
@ -110,7 +110,6 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
singlecontainerfullsize = abap_false
)->content( `form` ).
simple_form2->toolbar( )->title( `Quickstart` ).
simple_form2->label( `Step 1`
)->text( `Create a new class in your ABAP system`
@ -127,7 +126,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'`
editable = z2ui5_cl_util=>boolean_abap_2_json( 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,27 +137,16 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
ENDIF.
simple_form2->label( ).
simple_form2->button( press = client->_event( ms_home-btn_event_id )
text = ms_home-btn_text
icon = ms_home-btn_icon
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%` ).
simple_form2->label( `Step 5`
)->link( text = `Link to the Application`
target = `_blank`
href = lv_url
enabled = z2ui5_cl_util=>boolean_abap_2_json( xsdbool( ms_home-class_editable = abap_false ) ) ).
enabled = `{= $` && client->_bind( val = ms_home-class_editable ) && ` === false }` ).
*
* simple_form2->toolbar( )->title( `System Information` ).
** simple_form2->label( `abap2UI5 Version` ).
* simple_form2->label( `abap2UI5 Version ` ).
* simple_form2->text( z2ui5_if_app=>version ).
* simple_form2->label( `UI5 Version`).
* simple_form2->text( client->_bind( mv_ui5_version ) ).
* simple_form2->label( `ABAP for Cloud` ).
* simple_form2->checkbox( enabled = abap_false selected = z2ui5_cl_util=>rtti_check_lang_version_cloud( ) ).
* simple_form2->label( `Launchpad active` ).
* simple_form2->checkbox( enabled = abap_false selected = client->get( )-check_launchpad_active ).
DATA(lv_url_samples2) = z2ui5_cl_util=>app_get_url(
client = client
@ -166,26 +154,21 @@ 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`).
simple_form2->label( `Start Developing` ).
simple_form2->button(
text = `Check out the samples`
press = client->_event_client( val = client->cs_event-open_new_tab
t_arg = VALUE #( ( lv_url_samples2 ) ) )
width = `70%` ).
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
t_arg = VALUE #( ( lv_url_samples2 ) ) )
width = `70%` ).
else.
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` ).
endif.
simple_form2->link( text = `And explore more than 100 demo apps...`
target = `_blank`
href = `https://github.com/abap2UI5/abap2UI5-samples` ).
ENDIF.
* simple_form2->toolbar( )->title( `Contribution` ).
simple_form2->label( `` ).
simple_form2->text( `` ).
simple_form2->label( `Open an issue` ).
@ -198,7 +181,7 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
target = `_blank`
href = `https://github.com/abap2UI5/abap2UI5/pulls` ).
simple_form2->label( `` ).
simple_form2->label( `` ).
simple_form2->text( `` ).
* simple_form2->toolbar( )->title( `Links & More` ).
@ -221,7 +204,6 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
METHOD z2ui5_if_app~main.
FIELD-SYMBOLS <class> TYPE string.
me->client = client.
@ -238,7 +220,7 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
DATA(ls_result) = lo_f4->result( ).
IF ls_result-check_confirmed = abap_true.
ASSIGN ls_result-row->* TO <class>.
ASSIGN ls_result-row->* TO FIELD-SYMBOL(<class>).
ms_home-classname = <class>.
view_display_start( ).
RETURN.
@ -248,7 +230,6 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
ENDIF.
z2ui5_on_event( ).
view_display_start( ).
ENDMETHOD.
@ -257,15 +238,16 @@ CLASS Z2UI5_CL_CORE_APP_STARTUP IMPLEMENTATION.
CASE client->get( )-event.
WHEN `BUTTON_CHANGE`.
ms_home-btn_text = `check`.
ms_home-btn_event_id = `BUTTON_CHECK`.
ms_home-btn_icon = `sap-icon://validate`.
ms_home-class_editable = abap_true.
client->view_model_update( ).
WHEN `BUTTON_CHECK`.
on_event_check( ).
IF ms_home-class_editable = abap_false.
ms_home-btn_text = `check`.
ms_home-btn_event_id = `BUTTON_CHECK`.
ms_home-btn_icon = `sap-icon://validate`.
ms_home-class_editable = abap_true.
ELSE.
on_event_check( ).
ENDIF.
client->view_model_update( ).
WHEN 'VALUE_HELP'.
mt_classes = z2ui5_cl_util=>rtti_get_classes_impl_intf( `Z2UI5_IF_APP` ).

View File

@ -7612,10 +7612,7 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
lt_prop = VALUE #(
* ( n = `xmlns` v = `sap.m` )
( n = `xmlns:z2ui5` v = `z2ui5` )
* ( n = `xmlns:core` v = `sap.ui.core` )
* ( n = `xmlns:mvc` v = `sap.ui.core.mvc` )
( n = `xmlns:layout` v = `sap.ui.layout` )
* ( n = `core:require` v = `{ MessageToast: 'sap/m/MessageToast' }` )
* ( n = `core:require` v = `{ URLHelper: 'sap/m/library/URLHelper' }` )
@ -7675,9 +7672,9 @@ CLASS Z2UI5_CL_XML_VIEW IMPLEMENTATION.
val = COND string( WHEN row-v = abap_true
THEN `true`
ELSE row-v )
format = cl_abap_format=>e_xml_attr ) }" \n | ).
format = cl_abap_format=>e_xml_attr ) }"| ).
result = |{ result } <{ lv_tmp2 }{ mv_name } \n { lv_tmp3 }|.
result = |{ result } <{ lv_tmp2 }{ mv_name }{ lv_tmp3 }|.
IF mt_child IS INITIAL.
result = |{ result }/>|.

View File

@ -43,7 +43,5 @@ CLASS z2ui5_cl_app_hello_world IMPLEMENTATION.
client->message_toast_display( |Your name is { name }| ).
ENDCASE.
name = `My test`.
ENDMETHOD.
ENDCLASS.

View File

@ -207,8 +207,8 @@ CLASS z2ui5_cl_app_search_apps IMPLEMENTATION.
id = lr_app->name
class = 'sapUiTinyMarginBegin sapUiTinyMarginTop tileLayout'
press = client->_event( val = `ON_PRESS` t_arg = VALUE #( ( `${$source>/header}` ) ( `${$source>/id}` ) ) )
header = client->_bind( val = lr_app->name tab = ref #( mt_apps ) tab_index = lv_tabix )
visible = client->_bind( val = lr_app->visible tab = ref #( mt_apps ) tab_index = lv_tabix ) ).
header = client->_bind( val = lr_app->name tab = mt_apps tab_index = lv_tabix )
visible = client->_bind( val = lr_app->visible tab = mt_apps tab_index = lv_tabix ) ).
ENDLOOP.

View File

@ -59,7 +59,7 @@ CLASS Z2UI5_CL_POPUP_LAYOUT IMPLEMENTATION.
DATA(tab) = popup->table(
items = client->_bind_edit( ms_result-t_layout ) ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_comp_by_data( ms_result-t_layout ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( ms_result-t_layout ).
DATA(list) = tab->column_list_item( valign = `Top` ).
DATA(cells) = list->cells( ).
@ -97,7 +97,7 @@ CLASS Z2UI5_CL_POPUP_LAYOUT IMPLEMENTATION.
IF t_layout IS INITIAL.
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_comp_by_data( i_tab ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( i_tab ).
LOOP AT lt_comp REFERENCE INTO DATA(lr_comp).
INSERT VALUE #( name = lr_comp->name visible = abap_true mergeduplicates = abap_false )
INTO TABLE r_result->ms_result-t_layout.

View File

@ -61,7 +61,7 @@ CLASS z2ui5_cl_popup_table IMPLEMENTATION.
* )->button( text = `Display Popup` press = client->_event( `BUTTON_START` ) type = `Emphasized`
* )->get_parent( )->get_parent( ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_comp_by_data( <tab_out> ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( <tab_out> ).
DATA(list) = tab->column_list_item( valign = `Top` ).
DATA(cells) = list->cells( ).

View File

@ -84,7 +84,7 @@ CLASS z2ui5_cl_popup_to_select IMPLEMENTATION.
title = title
).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_comp_by_data( <tab_out> ).
DATA(lt_comp) = z2ui5_cl_util=>rtti_get_t_attri_by_struc( <tab_out> ).
DELETE lt_comp WHERE name = 'ZZSELKZ'.
DATA(list) = tab->column_list_item( valign = `Top`

View File

@ -125,7 +125,7 @@ INTERFACE z2ui5_if_client
path TYPE abap_bool DEFAULT abap_false
custom_mapper TYPE REF TO z2ui5_if_ajson_mapping OPTIONAL
custom_filter TYPE REF TO z2ui5_if_ajson_filter OPTIONAL
tab TYPE REF TO data OPTIONAL
tab TYPE data OPTIONAL
tab_index TYPE i OPTIONAL
RETURNING
VALUE(result) TYPE string.
@ -139,8 +139,8 @@ INTERFACE z2ui5_if_client
custom_mapper_back TYPE REF TO z2ui5_if_ajson_mapping OPTIONAL
custom_filter TYPE REF TO z2ui5_if_ajson_filter OPTIONAL
custom_filter_back TYPE REF TO z2ui5_if_ajson_filter OPTIONAL
tab TYPE REF TO data OPTIONAL
tab_index TYPE i OPTIONAL
tab TYPE data OPTIONAL
tab_index TYPE i OPTIONAL
RETURNING
VALUE(result) TYPE string.