hexsha
stringlengths 40
40
| size
int64 16
758k
| ext
stringclasses 1
value | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 6
146
| max_stars_repo_name
stringlengths 8
73
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
sequencelengths 1
2
| max_stars_count
int64 1
17.3k
⌀ | max_stars_repo_stars_event_min_datetime
stringclasses 530
values | max_stars_repo_stars_event_max_datetime
stringclasses 529
values | max_issues_repo_path
stringlengths 6
146
| max_issues_repo_name
stringlengths 8
73
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
sequencelengths 1
2
| max_issues_count
int64 1
3.24k
⌀ | max_issues_repo_issues_event_min_datetime
stringclasses 350
values | max_issues_repo_issues_event_max_datetime
stringclasses 350
values | max_forks_repo_path
stringlengths 6
146
| max_forks_repo_name
stringlengths 8
73
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
sequencelengths 1
2
| max_forks_count
int64 1
4.6k
⌀ | max_forks_repo_forks_event_min_datetime
stringclasses 388
values | max_forks_repo_forks_event_max_datetime
stringclasses 388
values | content
stringlengths 16
758k
| avg_line_length
float64 4.13
40.4k
| max_line_length
int64 9
40.4k
| alphanum_fraction
float64 0.04
0.97
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
73e149efc367e7901d0ebbd1731de7363d8160b8 | 9,753 | abap | ABAP | lbn-gtt-template-tso/ABAP/zsrc/zgtt_sof.fugr.lzgtt_soff03.abap | DanHaer/logistics-business-network-gtt-samples | 739978ac389da6f3530b26cd6402a3892f4b605a | [
"Apache-2.0"
] | 12 | 2020-09-25T07:54:40.000Z | 2021-09-27T12:29:34.000Z | lbn-gtt-template-tso/ABAP/zsrc/zgtt_sof.fugr.lzgtt_soff03.abap | DanHaer/logistics-business-network-gtt-samples | 739978ac389da6f3530b26cd6402a3892f4b605a | [
"Apache-2.0"
] | 2 | 2020-10-15T05:20:41.000Z | 2022-02-14T09:28:02.000Z | lbn-gtt-template-tso/ABAP/zsrc/zgtt_sof.fugr.lzgtt_soff03.abap | DanHaer/logistics-business-network-gtt-samples | 739978ac389da6f3530b26cd6402a3892f4b605a | [
"Apache-2.0"
] | 50 | 2020-09-29T03:06:01.000Z | 2022-03-28T16:04:45.000Z | *----------------------------------------------------------------------*
***INCLUDE LZGTT_SOFF03.
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form read_appl_tables_status
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> LT_XVBUK
*& --> LT_YVBUK
*& --> I_ALL_APPL_TABLES
*&---------------------------------------------------------------------*
FORM read_appl_tables_status
TABLES ct_xvbuk STRUCTURE vbukvb
ct_yvbuk STRUCTURE vbukvb
USING i_all_appl_tables TYPE trxas_tabcontainer.
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa.
FIELD-SYMBOLS:
* Sales Document: Header Status and Admin Data New
<lt_xvbuk> TYPE STANDARD TABLE,
* Sales Document: Header Status and Admin Data Old
<lt_yvbuk> TYPE STANDARD TABLE.
* <1-1> Sales Document: Header Status and Admin Data New
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'DELIVERY_HDR_STATUS_NEW'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_xvbuk>.
ct_xvbuk[] = <lt_xvbuk>[].
SORT ct_xvbuk BY vbeln.
ENDIF.
* <1-2> Sales Document: Header Status and Admin Data Old
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'DELIVERY_HDR_STATUS_OLD'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_yvbuk>.
ct_yvbuk[] = <lt_yvbuk>[].
SORT ct_yvbuk BY vbeln.
ENDIF.
ENDFORM. " read_appl_tables_status
*&---------------------------------------------------------------------*
*& Form read_appl_tables_delivery_item
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> LT_XVBUK
*& --> LT_YVBUK
*& --> I_ALL_APPL_TABLES
*&---------------------------------------------------------------------*
FORM read_appl_tables_delivery_item
TABLES ct_xvlips STRUCTURE lipsvb
ct_yvlips STRUCTURE lipsvb
USING i_all_appl_tables TYPE trxas_tabcontainer.
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa.
FIELD-SYMBOLS:
* Sales Document: Header Status and Admin Data New
<lt_xvlips> TYPE STANDARD TABLE,
* Sales Document: Header Status and Admin Data Old
<lt_yvlips> TYPE STANDARD TABLE.
* <1-1> Sales Document: Delivery Item Data New
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'DELIVERY_ITEM_NEW'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_xvlips>.
ct_xvlips[] = <lt_xvlips>[].
SORT ct_xvlips BY vbeln posnr.
ENDIF.
* <1-2> Sales Document: Delivery Item Data Old
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'DELIVERY_ITEM_OLD'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_yvlips>.
ct_yvlips[] = <lt_yvlips>[].
SORT ct_yvlips BY vbeln posnr.
ENDIF.
ENDFORM. " read_appl_tables_status
*&---------------------------------------------------------------------*
*& Form read_appl_tables_packing_item
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> LT_XVBUK
*& --> LT_YVBUK
*& --> I_ALL_APPL_TABLES
*&---------------------------------------------------------------------*
FORM read_appl_tables_packing_item
TABLES ct_xvepo STRUCTURE vepovb
ct_yvepo STRUCTURE vepovb
USING i_all_appl_tables TYPE trxas_tabcontainer.
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa.
FIELD-SYMBOLS:
* Sales Document: Header Status and Admin Data New
<lt_xvepo> TYPE STANDARD TABLE,
* Sales Document: Header Status and Admin Data Old
<lt_yvepo> TYPE STANDARD TABLE.
* <1-1> Sales Document: Delivery Item Data New
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'HU_ITEM_NEW'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_xvepo>.
ct_xvepo[] = <lt_xvepo>[].
SORT ct_xvepo BY vbeln posnr.
ENDIF.
* <1-2> Sales Document: Delivery Item Data Old
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'HU_ITEM_OLD'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_yvepo>.
ct_yvepo[] = <lt_yvepo>[].
SORT ct_yvepo BY vbeln posnr.
ENDIF.
ENDFORM. " read_appl_tables_status
*&---------------------------------------------------------------------*
*& Form read_appl_tables_packing_item
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> LT_XVBUK
*& --> LT_YVBUK
*& --> I_ALL_APPL_TABLES
*&---------------------------------------------------------------------*
FORM read_appl_tables_pod_items
TABLES ct_xvbup STRUCTURE vbupvb
ct_yvbup STRUCTURE vbupvb
USING i_all_appl_tables TYPE trxas_tabcontainer.
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa.
FIELD-SYMBOLS:
* Sales Document: Header Status and Admin Data New
<lt_xvbup> TYPE STANDARD TABLE,
* Sales Document: Header Status and Admin Data Old
<lt_yvbup> TYPE STANDARD TABLE.
* <1-1> Sales Document: Delivery Item Data New
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'DELIVERY_ITEM_STATUS_NEW'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_xvbup>.
ct_xvbup[] = <lt_xvbup>[].
SORT ct_xvbup BY vbeln posnr.
ENDIF.
* <1-2> Sales Document: Delivery Item Data Old
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'DELIVERY_ITEM_STATUS_OLD'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_yvbup>.
ct_yvbup[] = <lt_yvbup>[].
SORT ct_yvbup BY vbeln posnr.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form read_appl_tables_shipment_header
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> LT_XVBUK
*& --> LT_YVBUK
*& --> I_ALL_APPL_TABLES
*&---------------------------------------------------------------------*
FORM read_appl_tables_shipmt_header
TABLES ct_xvttk STRUCTURE vttkvb
ct_yvttk STRUCTURE vttkvb
USING i_all_appl_tables TYPE trxas_tabcontainer.
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa.
FIELD-SYMBOLS:
<lt_xvttk> TYPE STANDARD TABLE,
<lt_yvttk> TYPE STANDARD TABLE.
* <1-1> Sales Document: Shipment Header Data New
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'SHIPMENT_HEADER_NEW'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_xvttk>.
ct_xvttk[] = <lt_xvttk>[].
SORT ct_xvttk BY tknum.
ENDIF.
* <1-2> Sales Document: Shipment Header Data Old
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'SHIPMENT_HEADER_OLD'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_yvttk>.
ct_yvttk[] = <lt_yvttk>[].
SORT ct_yvttk BY tknum.
ENDIF.
ENDFORM. " read_appl_tables_status
*&---------------------------------------------------------------------*
*& Form read_appl_tables_shipment_header
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> LT_XVBUK
*& --> LT_YVBUK
*& --> I_ALL_APPL_TABLES
*&---------------------------------------------------------------------*
FORM read_appl_tables_shipment_leg
TABLES ct_xvtts STRUCTURE vttsvb
ct_yvtts STRUCTURE vttsvb
USING i_all_appl_tables TYPE trxas_tabcontainer.
DATA:
* Container with references
ls_one_app_tables TYPE trxas_tabcontainer_wa.
FIELD-SYMBOLS:
<lt_xvtts> TYPE STANDARD TABLE,
<lt_yvtts> TYPE STANDARD TABLE.
* <1-1> Sales Document: Shipment Header Data New
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'SHIPMENT_LEG_NEW'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_xvtts>.
ct_xvtts[] = <lt_xvtts>[].
SORT ct_xvtts BY tknum tsnum.
ENDIF.
* <1-2> Sales Document: Shipment Header Data Old
READ TABLE i_all_appl_tables INTO ls_one_app_tables
WITH KEY tabledef = 'SHIPMENT_LEG_OLD'
BINARY SEARCH.
IF NOT sy-subrc IS INITIAL.
RAISE idata_determination_error.
ELSE.
ASSIGN ls_one_app_tables-tableref->* TO <lt_yvtts>.
ct_yvtts[] = <lt_yvtts>[].
SORT ct_yvtts BY tknum tsnum.
ENDIF.
ENDFORM. " read_appl_tables_status
| 32.294702 | 72 | 0.58382 |
73e2b70370451fea3809da53aaebeb0122c32bf2 | 2,231 | abap | ABAP | src/zadf/zcl_adf_service_default_config.clas.abap | CyberFlameGO/ABAP-SDK-for-Azure | 5a3c0f20439fc8a325e2abb64ff2e74c22436b86 | [
"MIT"
] | 74 | 2019-05-15T07:57:27.000Z | 2022-03-28T01:11:44.000Z | src/zadf/zcl_adf_service_default_config.clas.abap | Seanpm2001-languages/ABAP-SDK-for-Azure | 5a3c0f20439fc8a325e2abb64ff2e74c22436b86 | [
"MIT"
] | 55 | 2019-08-22T03:31:26.000Z | 2022-03-22T03:20:31.000Z | src/zadf/zcl_adf_service_default_config.clas.abap | Seanpm2001-languages/ABAP-SDK-for-Azure | 5a3c0f20439fc8a325e2abb64ff2e74c22436b86 | [
"MIT"
] | 55 | 2019-10-21T18:15:22.000Z | 2022-03-28T01:15:16.000Z | CLASS zcl_adf_service_default_config DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES zif_adf_azure_defconfig.
METHODS constructor.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF sty_impl_cache,
service_id TYPE zazure_dest,
classname TYPE seoclsname,
END OF sty_impl_cache.
TYPES tty_impl_cache TYPE STANDARD TABLE OF sty_impl_cache.
DATA m_impl_cache TYPE tty_impl_cache.
ENDCLASS.
CLASS zcl_adf_service_default_config IMPLEMENTATION.
METHOD constructor.
FIELD-SYMBOLS : <fs> like LINE OF m_impl_cache.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_aad.
<fs>-classname = 'ZCL_ADF_SERVICE_AAD'.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_blob .
<fs>-classname = 'ZCL_ADF_SERVICE_BLOB'.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_docdb.
<fs>-classname = 'ZCL_ADF_SERVICE_DOCUMENTDB'.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_eventhub.
<fs>-classname = 'ZCL_ADF_SERVICE_EVENTHUB'.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_keyvault.
<fs>-classname = 'ZCL_ADF_SERVICE_KEYVAULT'.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_servicebus.
<fs>-classname = 'ZCL_ADF_SERVICE_SERVICEBUS'.
APPEND INITIAL LINE TO m_impl_cache ASSIGNING <fs>.
<fs>-service_id = zif_adf_azure_defconfig~gc_service_cosmosdb.
<fs>-classname = 'ZCL_ADF_SERVICE_COSMOSDB'.
ENDMETHOD.
METHOD zif_adf_azure_defconfig~get_classname.
DATA : lw_impl TYPE sty_impl_cache.
CLEAR lw_impl.
READ TABLE m_impl_cache INTO lw_impl WITH KEY service_id = i_interface_type.
IF SY-SUBRC IS INITIAL.
r_classname = lw_impl-classname.
ELSE.
RAISE EXCEPTION TYPE zcx_adf_service
EXPORTING
textid = zcx_adf_service=>interface_type_not_maintained.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 28.974026 | 78 | 0.749888 |
73e5faa59c825adfc0931472619dd606ea45cb92 | 7,684 | abap | ABAP | clean_code_main/clean_code_checks/y_check_cyclomatic_complexity.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | clean_code_main/clean_code_checks/y_check_cyclomatic_complexity.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | clean_code_main/clean_code_checks/y_check_cyclomatic_complexity.clas.testclasses.abap | leeroberts67/code-pal-for-abap | 26b4d7efd22f5863b825c638ae6128e9331cb924 | [
"Apache-2.0"
] | null | null | null | CLASS ltd_clean_code_manager_error DEFINITION FOR TESTING.
PUBLIC SECTION.
INTERFACES: y_if_clean_code_manager.
ENDCLASS.
CLASS ltd_clean_code_manager_error IMPLEMENTATION.
METHOD y_if_clean_code_manager~read_check_customizing.
result = VALUE #( ( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'E' threshold = 3 )
( apply_on_testcode = abap_true apply_on_productive_code = abap_true prio = 'W' threshold = 2 ) ).
ENDMETHOD.
METHOD y_if_clean_code_manager~calculate_obj_creation_date.
result = '19000101'.
ENDMETHOD.
ENDCLASS.
CLASS ltd_clean_code_manager_warning DEFINITION FOR TESTING.
PUBLIC SECTION.
INTERFACES: y_if_clean_code_manager.
ENDCLASS.
CLASS ltd_clean_code_manager_warning IMPLEMENTATION.
METHOD y_if_clean_code_manager~read_check_customizing.
result = VALUE #( ( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'E' threshold = 15 )
( apply_on_testcode = abap_false apply_on_productive_code = abap_true prio = 'W' threshold = 3 ) ).
ENDMETHOD.
METHOD y_if_clean_code_manager~calculate_obj_creation_date.
result = '19000101'.
ENDMETHOD.
ENDCLASS.
CLASS ltd_ref_scan_manager DEFINITION FOR TESTING INHERITING FROM y_scan_manager_double.
PUBLIC SECTION.
METHODS set_data_for_ok.
METHODS set_data_for_error.
METHODS set_pseudo_comment_ok.
ENDCLASS.
CLASS ltd_ref_scan_manager IMPLEMENTATION.
METHOD set_data_for_ok.
inject_code( VALUE #(
( 'REPORT y_example. ' )
( 'CLASS y_check_base DEFINITION. ' )
( ' PUBLIC SECTION. ' )
( ' PROTECTED SECTION. ' )
( ' PRIVATE SECTION. ' )
( ' METHODS name. ' )
( 'ENDCLASS. ' )
( 'CLASS y_check_base IMPLEMENTATION. ' )
( ' METHOD name. ' )
( ' DATA(value_a) = 1. ' )
( ' DATA(value_b) = 2. ' )
( ' IF value_a = 1. ' )
( ' value_b = 2. ' )
( ' ENDIF. ' )
( ' ENDMETHOD. ' )
( 'ENDCLASS.' )
( 'START-OF-SELECTION.' )
( ' DATA(value_a) = 1. ' )
( ' DATA(value_b) = 2. ' )
( ' IF value_a = 1. ' )
( ' value_b = 2. ' )
( ' ENDIF. ' )
) ).
ENDMETHOD.
METHOD set_data_for_error.
inject_code( VALUE #(
( 'REPORT y_example. ' )
( 'CLASS y_check_base DEFINITION. ' )
( ' PUBLIC SECTION. ' )
( ' PROTECTED SECTION. ' )
( ' PRIVATE SECTION. ' )
( ' METHODS name. ' )
( 'ENDCLASS. ' )
( 'CLASS y_check_base IMPLEMENTATION. ' )
( ' METHOD name. ' )
( ' DATA(value_a) = 1. ' )
( ' DATA(value_b) = 2. ' )
( ' IF value_a = 1. ' )
( ' value_b = 2. ' )
( ' DO value_b TIMES. ' )
( ' DATA(value_c) = 3. ' )
( ' CASE value_c. ' )
( ' WHEN 3. ' )
( ' ENDCASE. ' )
( ' ENDDO. ' )
( ' ENDIF. ' )
( ' ENDMETHOD. ' )
( 'ENDCLASS. ' )
( 'START-OF-SELECTION.' )
( ' DATA(value_a) = 1. ' )
( ' DATA(value_b) = 2. ' )
( ' IF value_a = 1. ' )
( ' value_b = 2. ' )
( ' DO value_b TIMES. ' )
( ' DATA(value_c) = 3. ' )
( ' CASE value_c. ' )
( ' WHEN 3. ' )
( ' ENDCASE. ' )
( ' ENDDO. ' )
( ' ENDIF. ' )
) ).
ENDMETHOD.
METHOD set_pseudo_comment_ok.
inject_code( VALUE #(
( 'REPORT y_example. ' )
( 'CLASS y_check_base DEFINITION. ' )
( ' PUBLIC SECTION. ' )
( ' PROTECTED SECTION. ' )
( ' PRIVATE SECTION. ' )
( ' METHODS name. ' )
( 'ENDCLASS. ' )
( 'CLASS y_check_base IMPLEMENTATION. ' )
( ' METHOD name. ' )
( ' DATA(value_a) = 1. ' )
( ' DATA(value_b) = 2. ' )
( ' IF value_a = 1. ' )
( ' value_b = 2. ' )
( ' DO value_b TIMES. ' )
( ' DATA(value_c) = 3. ' )
( ' CASE value_c. ' )
( ' WHEN 3. ' )
( ' ENDCASE. ' )
( ' ENDDO. ' )
( ' ENDIF. ' )
( ' ENDMETHOD. "#EC CI_CYCLO ' )
( 'ENDCLASS. ' )
( 'START-OF-SELECTION.' )
( ' DATA(value_a) = 1. ' )
( ' DATA(value_b) = 2. ' )
( ' IF value_a = 1. ' )
( ' value_b = 2. ' )
( ' DO value_b TIMES. ' )
( ' DATA(value_c) = 3. ' )
( ' CASE value_c. ' )
( ' WHEN 3. ' )
( ' ENDCASE. ' )
( ' ENDDO. ' )
( ' ENDIF. "#EC CI_CYCLO ' )
) ).
ENDMETHOD.
ENDCLASS.
CLASS ltd_clean_code_exemption_no DEFINITION FOR TESTING INHERITING FROM y_exemption_handler.
PUBLIC SECTION.
METHODS: is_object_exempted REDEFINITION.
ENDCLASS.
CLASS ltd_clean_code_exemption_no IMPLEMENTATION.
METHOD is_object_exempted.
RETURN.
ENDMETHOD.
ENDCLASS.
CLASS ltc_cyclo_complexity DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT.
PRIVATE SECTION.
DATA cut TYPE REF TO y_check_cyclomatic_complexity.
DATA ref_scan_manager_double TYPE REF TO ltd_ref_scan_manager.
METHODS setup.
METHODS assert_errors IMPORTING err_cnt TYPE i.
METHODS assert_warnings IMPORTING warn_cnt TYPE i.
METHODS assert_pseudo_comments IMPORTING pc_cnt TYPE i.
METHODS is_bound FOR TESTING.
METHODS cyclomatic_complexity_ok FOR TESTING.
METHODS cyclomatic_complexity_error FOR TESTING.
METHODS cyclomatic_complexity_warning FOR TESTING.
METHODS pseudo_comment_ok FOR TESTING.
ENDCLASS.
CLASS y_check_cyclomatic_complexity DEFINITION LOCAL FRIENDS ltc_cyclo_complexity.
CLASS ltc_cyclo_complexity IMPLEMENTATION.
METHOD setup.
cut = NEW y_check_cyclomatic_complexity( ).
ref_scan_manager_double = NEW ltd_ref_scan_manager( ).
cut->ref_scan_manager ?= ref_scan_manager_double.
cut->clean_code_exemption_handler = NEW ltd_clean_code_exemption_no( ).
cut->attributes_maintained = abap_true.
ENDMETHOD.
METHOD is_bound.
cl_abap_unit_assert=>assert_bound( cut ).
ENDMETHOD.
METHOD cyclomatic_complexity_ok.
cut->clean_code_manager = NEW ltd_clean_code_manager_error( ).
ref_scan_manager_double->set_data_for_ok( ).
cut->run( ).
assert_errors( 0 ).
assert_warnings( 0 ).
assert_pseudo_comments( 0 ).
ENDMETHOD.
METHOD cyclomatic_complexity_error.
cut->clean_code_manager = NEW ltd_clean_code_manager_error( ).
ref_scan_manager_double->set_data_for_error( ).
cut->run( ).
assert_errors( 2 ).
assert_warnings( 0 ).
assert_pseudo_comments( 0 ).
ENDMETHOD.
METHOD cyclomatic_complexity_warning.
cut->clean_code_manager = NEW ltd_clean_code_manager_warning( ).
ref_scan_manager_double->set_data_for_error( ).
cut->run( ).
assert_errors( 0 ).
assert_warnings( 2 ).
assert_pseudo_comments( 0 ).
ENDMETHOD.
METHOD pseudo_comment_ok.
cut->clean_code_manager = NEW ltd_clean_code_manager_error( ).
ref_scan_manager_double->set_pseudo_comment_ok( ).
cut->run( ).
assert_errors( 0 ).
assert_warnings( 0 ).
assert_pseudo_comments( 2 ).
ENDMETHOD.
METHOD assert_errors.
cl_abap_unit_assert=>assert_equals( act = cut->statistics->get_number_errors( )
exp = err_cnt ).
ENDMETHOD.
METHOD assert_warnings.
cl_abap_unit_assert=>assert_equals( act = cut->statistics->get_number_warnings( )
exp = warn_cnt ).
ENDMETHOD.
METHOD assert_pseudo_comments.
cl_abap_unit_assert=>assert_equals( act = cut->statistics->get_number_pseudo_comments( )
exp = pc_cnt ).
ENDMETHOD.
ENDCLASS.
| 30.983871 | 121 | 0.603071 |
73ead793ed0e4ece1e46d1bada6c4f7e420b909d | 5,674 | abap | ABAP | src/ycl_addict_cds_view.clas.abap | keremkoseoglu/addict | f33dc426aee267eb70c02ce8f4c3030ca99500e4 | [
"Apache-2.0"
] | 8 | 2020-10-30T13:19:02.000Z | 2022-01-04T19:28:37.000Z | src/ycl_addict_cds_view.clas.abap | aufaraditya/addict | 4f2e19ea1d2ffbf228bfd5cc0231cd17b792b372 | [
"Apache-2.0"
] | 22 | 2020-10-19T13:35:53.000Z | 2022-02-10T12:55:54.000Z | src/ycl_addict_cds_view.clas.abap | aufaraditya/addict | 4f2e19ea1d2ffbf228bfd5cc0231cd17b792b372 | [
"Apache-2.0"
] | 6 | 2020-11-03T21:39:50.000Z | 2022-03-10T02:21:41.000Z | CLASS ycl_addict_cds_view DEFINITION
PUBLIC
FINAL
CREATE PRIVATE .
PUBLIC SECTION.
TYPES ddlname_list TYPE STANDARD TABLE OF ddlname WITH KEY table_line.
DATA def TYPE ddddlsrc READ-ONLY.
CLASS-METHODS get_instance
IMPORTING !ddlname TYPE ddddlsrc-ddlname
RETURNING VALUE(result) TYPE REF TO ycl_addict_cds_view
RAISING ycx_addict_table_content.
METHODS get_child_views RETURNING VALUE(result) TYPE ddlname_list.
METHODS get_parent_views RETURNING VALUE(result) TYPE ddlname_list.
METHODS get_view_family RETURNING VALUE(result) TYPE ddlname_list.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF multiton_dict,
ddlname TYPE ddddlsrc-ddlname,
obj TYPE REF TO ycl_addict_cds_view,
END OF multiton_dict,
multiton_set TYPE HASHED TABLE OF multiton_dict WITH UNIQUE KEY primary_key COMPONENTS ddlname.
TYPES objectname_list TYPE STANDARD TABLE OF ddldependency-objectname WITH KEY table_line.
CONSTANTS: BEGIN OF table,
def TYPE tabname VALUE 'DDDDLSRC',
END OF table.
CONSTANTS: BEGIN OF objecttype,
view TYPE ddldependency-objecttype VALUE 'VIEW',
END OF objecttype.
DATA: child_views TYPE ddlname_list,
child_views_built TYPE abap_bool,
parent_views TYPE ddlname_list,
parent_views_built TYPE abap_bool,
view_family TYPE ddlname_list,
view_family_built TYPE abap_bool,
child_tables TYPE tr_tabnames,
child_tables_built TYPE abap_bool.
CLASS-DATA multitons TYPE multiton_set.
METHODS constructor
IMPORTING !ddlname TYPE ddddlsrc-ddlname
RAISING ycx_addict_table_content.
ENDCLASS.
CLASS ycl_addict_cds_view IMPLEMENTATION.
METHOD get_instance.
DATA(mts) = REF #( ycl_addict_cds_view=>multitons ).
ASSIGN mts->*[ KEY primary_key COMPONENTS
ddlname = ddlname
] TO FIELD-SYMBOL(<mt>).
IF sy-subrc <> 0.
INSERT VALUE #( ddlname = ddlname
obj = NEW #( ddlname ) )
INTO TABLE mts->* ASSIGNING <mt>.
ENDIF.
result = <mt>-obj.
ENDMETHOD.
METHOD get_child_views.
DATA objectnames TYPE objectname_list.
IF me->child_views_built = abap_false.
SELECT DISTINCT objectname FROM ddldependency
WHERE ddlname = @me->def-ddlname AND
objecttype = @me->objecttype-view
INTO TABLE @DATA(views).
LOOP AT views ASSIGNING FIELD-SYMBOL(<view>).
TRY.
DATA(view) = ycl_addict_view=>get_instance( CONV #( <view> ) ).
CATCH cx_root.
CONTINUE.
ENDTRY.
DATA(view_children) = view->get_child_views( ).
objectnames = view_children.
CHECK objectnames IS NOT INITIAL.
SELECT DISTINCT ddlname FROM ddldependency
FOR ALL ENTRIES IN @objectnames
WHERE objectname = @objectnames-table_line AND
objecttype = @me->objecttype-view
INTO TABLE @DATA(ddlnames).
DELETE ddlnames WHERE table_line = me->def-ddlname.
SORT ddlnames BY table_line.
DELETE ADJACENT DUPLICATES FROM ddlnames COMPARING table_line.
APPEND LINES OF ddlnames TO me->child_views.
ENDLOOP.
me->child_views_built = abap_true.
ENDIF.
result = me->child_views.
ENDMETHOD.
METHOD get_parent_views.
DATA objectnames TYPE objectname_list.
IF me->parent_views_built = abap_false.
SELECT DISTINCT objectname FROM ddldependency
WHERE ddlname = @me->def-ddlname AND
objecttype = @me->objecttype-view
INTO TABLE @DATA(views).
LOOP AT views ASSIGNING FIELD-SYMBOL(<view>).
TRY.
DATA(view) = ycl_addict_view=>get_instance( CONV #( <view> ) ).
CATCH cx_root.
CONTINUE.
ENDTRY.
DATA(view_parents) = view->get_parent_views( ).
objectnames = view_parents.
CHECK objectnames IS NOT INITIAL.
SELECT DISTINCT ddlname FROM ddldependency
FOR ALL ENTRIES IN @objectnames
WHERE objectname = @objectnames-table_line AND
objecttype = @me->objecttype-view
INTO TABLE @DATA(ddlnames).
DELETE ddlnames WHERE table_line = me->def-ddlname.
SORT ddlnames BY table_line.
DELETE ADJACENT DUPLICATES FROM ddlnames COMPARING table_line.
APPEND LINES OF ddlnames TO me->parent_views.
ENDLOOP.
me->parent_views_built = abap_true.
ENDIF.
result = me->parent_views.
ENDMETHOD.
METHOD get_view_family.
IF me->view_family_built = abap_false.
DATA(children) = get_child_views( ).
DATA(parents) = get_parent_views( ).
APPEND LINES OF: children TO me->view_family,
parents TO me->view_family.
SORT view_family BY table_line.
DELETE ADJACENT DUPLICATES FROM view_family COMPARING table_line.
me->view_family_built = abap_true.
ENDIF.
result = me->view_family.
ENDMETHOD.
METHOD constructor.
SELECT SINGLE * FROM ddddlsrc
WHERE ddlname = @ddlname
INTO CORRESPONDING FIELDS OF @me->def.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE ycx_addict_table_content
EXPORTING
textid = ycx_addict_table_content=>no_entry_for_objectid
objectid = CONV #( ddlname )
tabname = me->table-def.
ENDIF.
ENDMETHOD.
ENDCLASS.
| 30.342246 | 106 | 0.638527 |
73eb3e19fa77e8e55fc5d71398f52b9ca02d8583 | 2,433 | abap | ABAP | src/legacy/#dmo#cl_flight_data_generat_09.clas.abap | SAP-Cloud-Platform/flight09 | ddf2acaa35f581b40dd2580a6fd225b4de87a40f | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#cl_flight_data_generat_09.clas.abap | SAP-Cloud-Platform/flight09 | ddf2acaa35f581b40dd2580a6fd225b4de87a40f | [
"BSD-Source-Code"
] | null | null | null | src/legacy/#dmo#cl_flight_data_generat_09.clas.abap | SAP-Cloud-Platform/flight09 | ddf2acaa35f581b40dd2580a6fd225b4de87a40f | [
"BSD-Source-Code"
] | null | null | null | CLASS /dmo/cl_flight_data_generat_09 DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES: if_oo_adt_classrun.
PROTECTED SECTION.
PRIVATE SECTION.
CLASS-METHODS:
"! Calculation of Price <br/>
"! <br/>
"! Propagation to /dmo/cl_flight_legacy09=>calculate_flight_price.<br/>
"! @parameter iv_seats_occupied_percent | occupied seats
"! @parameter iv_flight_distance | flight distance in kilometer
"! @parameter rv_price | calculated flight price
calculate_flight_price
IMPORTING
iv_seats_occupied_percent TYPE /dmo/plane_seats_occupied09
iv_flight_distance TYPE i
RETURNING
VALUE(rv_price) TYPE /dmo/flight_price09.
ENDCLASS.
CLASS /dmo/cl_flight_data_generat_09 IMPLEMENTATION.
METHOD if_oo_adt_classrun~main.
out->write( 'Starting Data Generation' ).
out->write( 'Generate Data: Airport /DMO/AIRPORT09' ).
lcl_airport_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Carrier /DMO/CARRIER09' ).
lcl_carrier_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Connection /DMO/CONNECTI_09' ).
lcl_connection_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Flight /DMO/FLIGHT09' ).
lcl_flight_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Agency /DMO/AGENCY09' ).
lcl_agency_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Customer /DMO/CUSTOMER09' ).
lcl_customer_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Supplement /DMO/SUPPLEME_09' ).
lcl_supplement_data_generator=>lif_data_generator~create( out ).
out->write( 'Generate Data: Travel /DMO/TRAVEL09' ).
out->write( 'Generate Data: Booking /DMO/BOOKING09' ).
out->write( 'Generate Data: Booking Supplement /DMO/BOOK_SUP_09' ).
lcl_travel_data_generator=>lif_data_generator~create( out ).
out->write( 'Finished Data Generation' ).
ENDMETHOD.
METHOD calculate_flight_price.
rv_price = /dmo/cl_flight_legacy09=>calculate_flight_price(
iv_seats_occupied_percent = iv_seats_occupied_percent
iv_flight_distance = iv_flight_distance
).
ENDMETHOD.
ENDCLASS.
| 35.779412 | 77 | 0.693383 |
73ee2dc42b0d2ec1d4c1db64b1d9457e17ebdfcf | 9,332 | abap | ABAP | src/ui/zcl_abapgit_gui_page_boverview.clas.abap | sb-sap/abapGit | 8d1f1c312f5cf70b97fb6f00530be53a5e968a5b | [
"MIT"
] | null | null | null | src/ui/zcl_abapgit_gui_page_boverview.clas.abap | sb-sap/abapGit | 8d1f1c312f5cf70b97fb6f00530be53a5e968a5b | [
"MIT"
] | null | null | null | src/ui/zcl_abapgit_gui_page_boverview.clas.abap | sb-sap/abapGit | 8d1f1c312f5cf70b97fb6f00530be53a5e968a5b | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_gui_page_boverview DEFINITION
PUBLIC
FINAL
CREATE PUBLIC INHERITING FROM zcl_abapgit_gui_page.
PUBLIC SECTION.
METHODS:
constructor
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo_online
RAISING zcx_abapgit_exception,
zif_abapgit_gui_page~on_event REDEFINITION.
PROTECTED SECTION.
METHODS render_content REDEFINITION.
PRIVATE SECTION.
DATA: mo_repo TYPE REF TO zcl_abapgit_repo_online,
mv_compress TYPE abap_bool VALUE abap_false,
mt_commits TYPE zif_abapgit_definitions=>ty_commit_tt,
mo_branch_overview TYPE REF TO zcl_abapgit_branch_overview.
CONSTANTS: BEGIN OF c_actions,
uncompress TYPE string VALUE 'uncompress' ##NO_TEXT,
compress TYPE string VALUE 'compress' ##NO_TEXT,
refresh TYPE string VALUE 'refresh' ##NO_TEXT,
merge TYPE string VALUE 'merge' ##NO_TEXT,
END OF c_actions.
TYPES: BEGIN OF ty_merge,
source TYPE string,
target TYPE string,
END OF ty_merge.
METHODS:
refresh
RAISING zcx_abapgit_exception,
body
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html
RAISING zcx_abapgit_exception,
form_select
IMPORTING iv_name TYPE string
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html,
render_merge
RETURNING VALUE(ro_html) TYPE REF TO zcl_abapgit_html
RAISING zcx_abapgit_exception,
decode_merge
IMPORTING it_postdata TYPE cnht_post_data_tab
RETURNING VALUE(rs_merge) TYPE ty_merge
RAISING zcx_abapgit_exception,
build_menu
RETURNING VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar,
escape_branch
IMPORTING iv_string TYPE string
RETURNING VALUE(rv_string) TYPE string,
escape_message
IMPORTING iv_string TYPE string
RETURNING VALUE(rv_string) TYPE string.
ENDCLASS.
CLASS zcl_abapgit_gui_page_boverview IMPLEMENTATION.
METHOD body.
DATA: lv_tag TYPE string.
FIELD-SYMBOLS: <ls_commit> LIKE LINE OF mt_commits,
<ls_create> LIKE LINE OF <ls_commit>-create.
CREATE OBJECT ro_html.
ro_html->add( zcl_abapgit_gui_chunk_lib=>render_repo_top(
io_repo = mo_repo
iv_show_package = abap_false
iv_show_branch = abap_false ) ).
ro_html->add( '<br>' ).
ro_html->add( '<br>' ).
ro_html->add( render_merge( ) ).
ro_html->add( '<br>' ).
ro_html->add( build_menu( )->render( ) ).
* see http://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element
ro_html->add( '<canvas id="gitGraph"></canvas>' ).
ro_html->add( '<script type="text/javascript" src="https://cdnjs.' &&
'cloudflare.com/ajax/libs/gitgraph.js/1.2.3/gitgraph.min.js">' &&
'</script>' ) ##NO_TEXT.
ro_html->add( '<script type="text/javascript">' ).
ro_html->add( 'var myTemplateConfig = {' ).
ro_html->add( 'colors: [ "#979797", "#008fb5", "#f1c109", "'
&& '#095256", "#087F8C", "#5AAA95", "#86A873", "#BB9F06" ],' ) ##NO_TEXT.
ro_html->add( 'branch: {' ).
ro_html->add( ' lineWidth: 8,' ).
ro_html->add( ' spacingX: 50' ).
ro_html->add( '},' ).
ro_html->add( 'commit: {' ).
ro_html->add( ' spacingY: -40,' ).
ro_html->add( ' dot: { size: 12 },' ).
ro_html->add( ' message: { font: "normal 14pt Arial" }' ).
ro_html->add( '}' ).
ro_html->add( '};' ).
ro_html->add( 'var gitgraph = new GitGraph({' ).
ro_html->add( ' template: myTemplateConfig,' ).
ro_html->add( ' orientation: "vertical-reverse"' ).
ro_html->add( '});' ).
LOOP AT mt_commits ASSIGNING <ls_commit>.
IF sy-tabix = 1.
* assumption: all branches are created from master, todo
ro_html->add( |var {
escape_branch( <ls_commit>-branch ) } = gitgraph.branch("{
<ls_commit>-branch }");| ).
ENDIF.
IF <ls_commit>-compressed = abap_true.
ro_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{
escape_message( <ls_commit>-message )
}", dotColor: "black", dotSize: 15, messageHashDisplay: false, messageAuthorDisplay: false\});| ).
ELSEIF <ls_commit>-merge IS INITIAL.
" gitgraph doesn't support multiple tags per commit yet.
" Therefore we concatenate them.
" https://github.com/nicoespeon/gitgraph.js/issues/143
lv_tag = concat_lines_of( table = <ls_commit>-tags
sep = ` | ` ).
ro_html->add( |{ escape_branch( <ls_commit>-branch ) }.commit(\{message: "{
escape_message( <ls_commit>-message ) }", author: "{
<ls_commit>-author }", sha1: "{
<ls_commit>-sha1(7) }", tag: "{ lv_tag }"\});| ).
ELSE.
ro_html->add( |{ escape_branch( <ls_commit>-merge ) }.merge({
escape_branch( <ls_commit>-branch ) }, \{message: "{
escape_message( <ls_commit>-message ) }", author: "{
<ls_commit>-author }", sha1: "{
<ls_commit>-sha1(7) }"\});| ).
ENDIF.
LOOP AT <ls_commit>-create ASSIGNING <ls_create>.
ro_html->add( |var { escape_branch( <ls_create>-name ) } = {
escape_branch( <ls_create>-parent ) }.branch("{
<ls_create>-name }");| ).
ENDLOOP.
ENDLOOP.
ro_html->add( '</script>' ).
ENDMETHOD.
METHOD build_menu.
CREATE OBJECT ro_menu.
IF mv_compress = abap_true.
ro_menu->add(
iv_txt = 'Uncompress Graph'
iv_act = c_actions-uncompress ) ##NO_TEXT.
ELSE.
ro_menu->add(
iv_txt = 'Compress Graph'
iv_act = c_actions-compress ) ##NO_TEXT.
ENDIF.
ro_menu->add( iv_txt = 'Refresh' iv_act = c_actions-refresh ) ##NO_TEXT.
ENDMETHOD.
METHOD constructor.
super->constructor( ).
ms_control-page_title = 'BRANCH_OVERVIEW'.
mo_repo = io_repo.
refresh( ).
ENDMETHOD.
METHOD decode_merge.
DATA: lv_string TYPE string,
lt_fields TYPE tihttpnvp.
FIELD-SYMBOLS: <ls_field> LIKE LINE OF lt_fields.
CONCATENATE LINES OF it_postdata INTO lv_string.
lt_fields = zcl_abapgit_html_action_utils=>parse_fields( lv_string ).
READ TABLE lt_fields ASSIGNING <ls_field> WITH KEY name = 'source' ##NO_TEXT.
ASSERT sy-subrc = 0.
rs_merge-source = <ls_field>-value.
READ TABLE lt_fields ASSIGNING <ls_field> WITH KEY name = 'target' ##NO_TEXT.
ASSERT sy-subrc = 0.
rs_merge-target = <ls_field>-value.
ENDMETHOD.
METHOD escape_branch.
rv_string = iv_string.
TRANSLATE rv_string USING '-_._'.
rv_string = |branch_{ rv_string }|.
ENDMETHOD.
METHOD escape_message.
rv_string = iv_string.
REPLACE ALL OCCURRENCES OF '"' IN rv_string WITH '\"'.
ENDMETHOD.
METHOD form_select.
DATA: lv_name TYPE string,
lt_branches TYPE zif_abapgit_definitions=>ty_git_branch_list_tt.
FIELD-SYMBOLS: <ls_branch> LIKE LINE OF lt_branches.
CREATE OBJECT ro_html.
lt_branches = mo_branch_overview->get_branches( ).
ro_html->add( |<select name="{ iv_name }">| ).
LOOP AT lt_branches ASSIGNING <ls_branch>.
lv_name = <ls_branch>-name+11.
ro_html->add( |<option value="{ lv_name }">{ lv_name }</option>| ).
ENDLOOP.
ro_html->add( '</select>' ).
ENDMETHOD.
METHOD refresh.
mo_branch_overview = zcl_abapgit_branch_overview=>run( mo_repo ).
mt_commits = mo_branch_overview->get_commits( ).
IF mv_compress = abap_true.
mt_commits = mo_branch_overview->compress( mt_commits ).
ENDIF.
ENDMETHOD.
METHOD render_content.
CREATE OBJECT ro_html.
ro_html->add( '<div id="toc">' ).
ro_html->add( body( ) ).
ro_html->add( '</div>' ).
ENDMETHOD. "render_content
METHOD render_merge.
CREATE OBJECT ro_html.
ro_html->add( '<form id="commit_form" method="post" action="sapevent:merge">' ).
ro_html->add( 'Merge' ) ##NO_TEXT.
ro_html->add( form_select( 'source' ) ) ##NO_TEXT.
ro_html->add( 'into' ) ##NO_TEXT.
ro_html->add( form_select( 'target' ) ) ##NO_TEXT.
ro_html->add( '<input type="submit" value="Submit">' ).
ro_html->add( '</form>' ).
ENDMETHOD.
METHOD zif_abapgit_gui_page~on_event.
DATA: ls_merge TYPE ty_merge,
lo_merge TYPE REF TO zcl_abapgit_gui_page_merge.
CASE iv_action.
WHEN c_actions-refresh.
refresh( ).
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
WHEN c_actions-uncompress.
mv_compress = abap_false.
refresh( ).
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
WHEN c_actions-compress.
mv_compress = abap_true.
refresh( ).
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
WHEN c_actions-merge.
ls_merge = decode_merge( it_postdata ).
CREATE OBJECT lo_merge
EXPORTING
io_repo = mo_repo
iv_source = ls_merge-source
iv_target = ls_merge-target.
ei_page = lo_merge.
ev_state = zif_abapgit_definitions=>gc_event_state-new_page.
ENDCASE.
ENDMETHOD.
ENDCLASS.
| 29.253918 | 108 | 0.625589 |
73f1cdef841235c0559f1192d9a96049a7f0cccd | 3,682 | abap | ABAP | zbugtracker_core/zbugtracker_core_entity/zcl_bug_section.clas.abap | rayatus/sapbugtracker | c94439c3bb21908f7945fc5bf3bd88868903e8e8 | [
"MIT"
] | 3 | 2019-02-10T22:03:43.000Z | 2021-05-26T06:49:55.000Z | zbugtracker_core/zbugtracker_core_entity/zcl_bug_section.clas.abap | rayatus/sapbugtracker | c94439c3bb21908f7945fc5bf3bd88868903e8e8 | [
"MIT"
] | 2 | 2020-05-06T14:25:17.000Z | 2022-01-13T10:06:40.000Z | zbugtracker_core/zbugtracker_core_entity/zcl_bug_section.clas.abap | rayatus/sapbugtracker | c94439c3bb21908f7945fc5bf3bd88868903e8e8 | [
"MIT"
] | 1 | 2021-05-26T06:49:56.000Z | 2021-05-26T06:49:56.000Z | "! <p class="shorttext synchronized" lang="en">BugSection Entity</p>
CLASS zcl_bug_section DEFINITION
PUBLIC
INHERITING FROM zcl_entity
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
*"* public components of class ZCL_BUG_SECTION
*"* do not include other source files here!!!
"! <p class="shorttext synchronized" lang="en">CONSTRUCTOR</p>
"!
"! @parameter id | <p class="shorttext synchronized" lang="en">Sección</p>
"! @parameter bug | <p class="shorttext synchronized" lang="en">Bug Entity</p>
"! @parameter comment | <p class="shorttext synchronized" lang="en">Comment Entity</p>
METHODS constructor
IMPORTING
!id TYPE zbt_bugseccion-seccion
!bug TYPE REF TO zcl_bug
!comment TYPE REF TO zcl_comment OPTIONAL .
"! <p class="shorttext synchronized" lang="en">GetBug</p>
"!
"! @parameter return | <p class="shorttext synchronized" lang="en">Bug Entity</p>
METHODS get_bug
RETURNING
VALUE(return) TYPE REF TO zcl_bug .
"! <p class="shorttext synchronized" lang="en">GetId</p>
"!
"! @parameter return | <p class="shorttext synchronized" lang="en">Sección</p>
METHODS get_id
RETURNING
VALUE(return) TYPE zbt_bugseccion-seccion .
"! <p class="shorttext synchronized" lang="en">GetComment</p>
"!
"! @parameter return | <p class="shorttext synchronized" lang="en">Comment Entity</p>
METHODS get_comment
RETURNING
VALUE(return) TYPE REF TO zcl_comment .
"! <p class="shorttext synchronized" lang="en">SetComment</p>
"!
"! @parameter comment | <p class="shorttext synchronized" lang="en">Comment Entity</p>
METHODS set_comment
IMPORTING
!comment TYPE REF TO zcl_comment .
PROTECTED SECTION.
*"* protected components of class ZCL_BUG_SECTION
*"* do not include other source files here!!!
METHODS prepare_hash_structure
REDEFINITION .
PRIVATE SECTION.
*"* private components of class ZCL_BUG_SECTION
*"* do not include other source files here!!!
"! <p class="shorttext synchronized" lang="en">Bug Entity</p>
DATA bug TYPE REF TO zcl_bug .
"! <p class="shorttext synchronized" lang="en">Sección</p>
DATA id TYPE zbt_bugseccion-seccion .
"! <p class="shorttext synchronized" lang="en">Comment Entity</p>
DATA comment TYPE REF TO zcl_comment .
ENDCLASS.
CLASS zcl_bug_section IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
me->id = id.
me->bug = bug.
me->comment = comment.
ENDMETHOD.
METHOD get_bug.
return = me->bug.
ENDMETHOD.
METHOD get_comment.
return = comment.
ENDMETHOD.
METHOD get_id.
return = id.
ENDMETHOD.
METHOD prepare_hash_structure.
DATA: str TYPE zbt_bugseccion,
hash TYPE hash160,
o_comment TYPE REF TO zcl_comment,
value TYPE LINE OF zbt_objectvalue_hash_calcul,
i TYPE i.
FIELD-SYMBOLS: <field> TYPE any.
CALL METHOD zcl_bugsection_controller=>entity_to_structure
EXPORTING
entity = me
RECEIVING
structure = str.
DO.
ADD 1 TO i.
ASSIGN COMPONENT i OF STRUCTURE str TO <field>.
IF sy-subrc IS INITIAL.
value = <field>.
SHIFT value LEFT DELETING LEADING space.
INSERT value INTO TABLE values[].
ELSE.
EXIT.
ENDIF.
ENDDO.
o_comment = get_comment( ).
hash = o_comment->get_hash( ).
value = hash.
SHIFT value LEFT DELETING LEADING space.
INSERT value INTO TABLE values[].
ENDMETHOD.
METHOD set_comment.
me->comment = comment.
ENDMETHOD.
ENDCLASS.
| 27.684211 | 90 | 0.648289 |
73f796b1f9eab20a03528c9afa6e5f6372c5f1a0 | 8,514 | abap | ABAP | src/zcl_abapgit_code_inspector.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | 1 | 2019-05-27T18:50:14.000Z | 2019-05-27T18:50:14.000Z | src/zcl_abapgit_code_inspector.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | null | null | null | src/zcl_abapgit_code_inspector.clas.abap | joymike/abapGit | e06f22bb22a3c0a3c66eec4da698124c1ec98d65 | [
"MIT"
] | 1 | 2019-12-31T11:44:14.000Z | 2019-12-31T11:44:14.000Z | CLASS zcl_abapgit_code_inspector DEFINITION
PUBLIC
CREATE PROTECTED
GLOBAL FRIENDS zcl_abapgit_factory .
PUBLIC SECTION.
INTERFACES zif_abapgit_code_inspector .
METHODS constructor
IMPORTING
!iv_package TYPE devclass
RAISING
zcx_abapgit_exception .
CLASS-METHODS validate_check_variant
IMPORTING
!iv_check_variant_name TYPE sci_chkv
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
TYPES:
ty_tdevc_tt TYPE STANDARD TABLE OF tdevc WITH DEFAULT KEY .
DATA mv_package TYPE devclass .
METHODS create_variant
IMPORTING
!iv_variant TYPE sci_chkv
RETURNING
VALUE(ro_variant) TYPE REF TO cl_ci_checkvariant
RAISING
zcx_abapgit_exception .
METHODS cleanup
IMPORTING
!io_set TYPE REF TO cl_ci_objectset
RAISING
zcx_abapgit_exception .
PRIVATE SECTION.
DATA mv_success TYPE abap_bool .
CONSTANTS:
BEGIN OF co_run_mode,
run_with_popup TYPE sychar01 VALUE 'P',
run_after_popup TYPE sychar01 VALUE 'A',
run_via_rfc TYPE sychar01 VALUE 'R',
run_in_batch TYPE sychar01 VALUE 'B',
run_loc_parallel TYPE sychar01 VALUE 'L',
run_direct TYPE sychar01 VALUE 'L',
END OF co_run_mode .
DATA mo_inspection TYPE REF TO cl_ci_inspection .
DATA mv_name TYPE sci_objs .
DATA mv_run_mode TYPE sychar01 .
METHODS find_all_subpackages
IMPORTING
!iv_package TYPE devclass
RETURNING
VALUE(rt_packages) TYPE ty_tdevc_tt .
METHODS create_objectset
RETURNING
VALUE(ro_set) TYPE REF TO cl_ci_objectset .
METHODS run_inspection
IMPORTING
!io_inspection TYPE REF TO cl_ci_inspection
RETURNING
VALUE(rt_list) TYPE scit_alvlist
RAISING
zcx_abapgit_exception .
METHODS create_inspection
IMPORTING
!io_set TYPE REF TO cl_ci_objectset
!io_variant TYPE REF TO cl_ci_checkvariant
RETURNING
VALUE(ro_inspection) TYPE REF TO cl_ci_inspection
RAISING
zcx_abapgit_exception .
ENDCLASS.
CLASS ZCL_ABAPGIT_CODE_INSPECTOR IMPLEMENTATION.
METHOD cleanup.
IF mo_inspection IS BOUND.
mo_inspection->delete(
EXCEPTIONS
locked = 1
error_in_enqueue = 2
not_authorized = 3
exceptn_appl_exists = 4
OTHERS = 5 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Couldn't delete inspection. Subrc = { sy-subrc }| ).
ENDIF.
ENDIF.
io_set->delete(
EXCEPTIONS
exists_in_insp = 1
locked = 2
error_in_enqueue = 3
not_authorized = 4
exists_in_objs = 5
OTHERS = 6 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Couldn't delete objectset. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD constructor.
IF iv_package IS INITIAL.
zcx_abapgit_exception=>raise( |Please supply package| ).
ENDIF.
mv_package = iv_package.
" We create the inspection and objectset with dummy names.
" Because we want to persist them so we can run it in parallel.
" Both are deleted afterwards.
mv_name = |{ sy-uname }_{ sy-datum }_{ sy-uzeit }|.
" We have to disable parallelization in batch because of lock errors.
IF sy-batch = abap_true.
mv_run_mode = co_run_mode-run_via_rfc.
ELSE.
mv_run_mode = co_run_mode-run_loc_parallel.
ENDIF.
ENDMETHOD.
METHOD create_inspection.
cl_ci_inspection=>create(
EXPORTING
p_user = sy-uname
p_name = mv_name
RECEIVING
p_ref = ro_inspection
EXCEPTIONS
locked = 1
error_in_enqueue = 2
not_authorized = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Failed to create inspection. Subrc = { sy-subrc }| ).
ENDIF.
ro_inspection->set(
p_chkv = io_variant
p_objs = io_set ).
ro_inspection->save(
EXCEPTIONS
missing_information = 1
insp_no_name = 2
not_enqueued = 3
OTHERS = 4 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Failed to save inspection. Subrc = { sy-subrc }| ).
ENDIF.
ENDMETHOD.
METHOD create_objectset.
DATA: lt_objs TYPE scit_objs,
lt_packages TYPE ty_tdevc_tt.
lt_packages = find_all_subpackages( mv_package ).
IF lines( lt_packages ) = 0.
RETURN.
ENDIF.
SELECT object AS objtype obj_name AS objname
FROM tadir
INTO CORRESPONDING FIELDS OF TABLE lt_objs
FOR ALL ENTRIES IN lt_packages
WHERE devclass = lt_packages-devclass
AND delflag = abap_false
AND pgmid = 'R3TR'. "#EC CI_GENBUFF
ro_set = cl_ci_objectset=>save_from_list(
p_name = mv_name
p_objects = lt_objs ).
ENDMETHOD.
METHOD create_variant.
IF iv_variant IS INITIAL.
zcx_abapgit_exception=>raise( |No check variant supplied.| ).
ENDIF.
cl_ci_checkvariant=>get_ref(
EXPORTING
p_user = ''
p_name = iv_variant
RECEIVING
p_ref = ro_variant
EXCEPTIONS
chkv_not_exists = 1
missing_parameter = 2
OTHERS = 3 ).
CASE sy-subrc.
WHEN 1.
zcx_abapgit_exception=>raise( |Check variant { iv_variant } doesn't exist| ).
WHEN 2.
zcx_abapgit_exception=>raise( |Parameter missing for check variant { iv_variant }| ).
ENDCASE.
ENDMETHOD.
METHOD find_all_subpackages.
* TODO, in the future, move this method to the ABAPGIT global package class
DATA: ls_package LIKE LINE OF rt_packages,
lt_found LIKE rt_packages,
lt_sub LIKE rt_packages.
SELECT SINGLE * FROM tdevc INTO ls_package WHERE devclass = iv_package.
ASSERT sy-subrc = 0.
APPEND ls_package TO rt_packages.
SELECT * FROM tdevc APPENDING TABLE lt_sub
WHERE parentcl = ls_package-devclass.
LOOP AT lt_sub INTO ls_package.
lt_found = find_all_subpackages( ls_package-devclass ).
APPEND LINES OF lt_found TO rt_packages.
ENDLOOP.
ENDMETHOD.
METHOD run_inspection.
io_inspection->run(
EXPORTING
p_howtorun = mv_run_mode
EXCEPTIONS
invalid_check_version = 1
OTHERS = 2 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |Code inspector run failed. Subrc = { sy-subrc }| ).
ENDIF.
io_inspection->plain_list(
IMPORTING
p_list = rt_list ).
ENDMETHOD.
METHOD validate_check_variant.
cl_ci_checkvariant=>get_ref(
EXPORTING
p_user = ''
p_name = iv_check_variant_name
EXCEPTIONS
chkv_not_exists = 1
missing_parameter = 2
OTHERS = 3 ).
IF sy-subrc <> 0.
zcx_abapgit_exception=>raise( |No valid check variant { iv_check_variant_name }| ).
ENDIF.
ENDMETHOD.
METHOD zif_abapgit_code_inspector~is_successful.
rv_success = mv_success.
ENDMETHOD.
METHOD zif_abapgit_code_inspector~run.
DATA: lo_set TYPE REF TO cl_ci_objectset,
lo_variant TYPE REF TO cl_ci_checkvariant,
lx_error TYPE REF TO zcx_abapgit_exception.
TRY.
lo_set = create_objectset( ).
IF lines( lo_set->iobjlst-objects ) = 0.
" no objects, nothing to check
RETURN.
ENDIF.
lo_variant = create_variant( iv_variant ).
mo_inspection = create_inspection(
io_set = lo_set
io_variant = lo_variant ).
rt_list = run_inspection( mo_inspection ).
cleanup( lo_set ).
IF iv_save = abap_true.
READ TABLE rt_list TRANSPORTING NO FIELDS WITH KEY kind = 'E'.
mv_success = boolc( sy-subrc <> 0 ).
ENDIF.
CATCH zcx_abapgit_exception INTO lx_error.
" ensure cleanup
cleanup( lo_set ).
zcx_abapgit_exception=>raise( iv_text = lx_error->get_text( )
ix_previous = lx_error ).
ENDTRY.
ENDMETHOD.
ENDCLASS.
| 24.967742 | 93 | 0.610289 |
73fbc1877280c8824f21f5d5eae981188e0c09ed | 3,064 | abap | ABAP | src/zcl_aoc_check_cloud_01.clas.testclasses.abap | abapOpenChecks/abapOpenChecks-Steampunk | 76452ec5f8c46e1755ba5e73391fc1edd02b9aae | [
"Apache-2.0"
] | 2 | 2021-06-25T07:34:53.000Z | 2021-07-04T08:38:01.000Z | src/zcl_aoc_check_cloud_01.clas.testclasses.abap | abapOpenChecks/Steampunk | 76452ec5f8c46e1755ba5e73391fc1edd02b9aae | [
"Apache-2.0"
] | 1 | 2021-09-30T12:57:51.000Z | 2022-01-03T10:46:43.000Z | src/zcl_aoc_check_cloud_01.clas.testclasses.abap | abapOpenChecks/abapOpenChecks-Steampunk | 76452ec5f8c46e1755ba5e73391fc1edd02b9aae | [
"Apache-2.0"
] | 1 | 2021-07-05T13:15:27.000Z | 2021-07-05T13:15:27.000Z | CLASS ltcl_tests DEFINITION FINAL FOR TESTING
DURATION SHORT
RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_tests IMPLEMENTATION.
METHOD test.
DATA l_expected_findings TYPE if_ci_atc_unit_asserter=>ty_expected_findings.
DATA(l_test_object) = VALUE if_ci_atc_check=>ty_object(
type = 'CLAS'
name = 'ZCL_AOC_CHECK_CLOUD_TEST_01' ).
DO 24 TIMES.
DATA(l_idx) = sy-index.
IF l_idx < 10.
DATA(l_method) = |TEST001_0{ l_idx }|.
ELSE.
l_method = |TEST001_{ l_idx }|.
ENDIF.
DATA(l_method_object) = cl_ci_atc_unit_driver=>get_method_object( VALUE #(
class = l_test_object-name
method = l_method ) ).
CASE l_idx.
WHEN 1.
DATA(l_expected_finding) = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 4 column = 4 ) ).
WHEN 7.
l_expected_finding = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 5 column = 6 ) ).
WHEN 13.
l_expected_finding = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 3 column = 4 ) ).
WHEN 14.
l_expected_finding = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 3 column = 4 ) ).
WHEN 15.
l_expected_finding = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 3 column = 4 ) ).
WHEN 16.
l_expected_finding = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 3 column = 4 ) ).
WHEN 18.
l_expected_finding = VALUE if_ci_atc_unit_asserter=>ty_expected_finding(
code = zcl_aoc_check_cloud_01=>finding_codes-if_in_if location-object = l_method_object
location-position = VALUE #( line = 4 column = 4 ) ).
WHEN OTHERS.
CONTINUE.
ENDCASE.
APPEND l_expected_finding TO l_expected_findings.
ENDDO.
cl_ci_atc_unit_driver=>create_asserter( )->check_and_assert(
check = NEW zcl_aoc_check_cloud_01( )
object = l_test_object
expected_findings = VALUE #(
( LINES OF l_expected_findings ) )
asserter_config = VALUE #( quickfixes = abap_false ) ).
ENDMETHOD.
ENDCLASS.
| 43.771429 | 99 | 0.675261 |
73fc983a5fc2bca36d4c8b42f43dbac3eab3cb7f | 10,790 | abap | ABAP | src/zcl_ioc_container.clas.abap | alezhu/ABAP-IoC-Container | 188edc8937c2f1807e5e1e217104edc2f1d2ca0a | [
"MIT"
] | null | null | null | src/zcl_ioc_container.clas.abap | alezhu/ABAP-IoC-Container | 188edc8937c2f1807e5e1e217104edc2f1d2ca0a | [
"MIT"
] | null | null | null | src/zcl_ioc_container.clas.abap | alezhu/ABAP-IoC-Container | 188edc8937c2f1807e5e1e217104edc2f1d2ca0a | [
"MIT"
] | null | null | null | CLASS zcl_ioc_container DEFINITION
PUBLIC
CREATE PRIVATE.
PUBLIC SECTION.
CLASS-METHODS:
get_instance
RETURNING
VALUE(instance) TYPE REF TO zcl_ioc_container.
METHODS:
register
IMPORTING
!interface_name TYPE string
!class_name TYPE string
RAISING
zcx_ioc_container,
deregister
IMPORTING
!interface_name TYPE string OPTIONAL,
register_instance
IMPORTING
!interface_name TYPE string
!instance TYPE REF TO object,
deregister_instance
IMPORTING
!interface_name TYPE string OPTIONAL,
resolve
IMPORTING
!interface_name TYPE string
RETURNING
VALUE(new_object) TYPE REF TO object.
PRIVATE SECTION.
TYPES:
BEGIN OF ts_mapping_table.
TYPES interface_name TYPE string.
TYPES class_name TYPE string.
TYPES END OF ts_mapping_table.
TYPES:
tt_mapping_table TYPE HASHED TABLE OF ts_mapping_table
WITH UNIQUE KEY interface_name.
TYPES:
BEGIN OF ts_instance_mapping_table.
TYPES interface_name TYPE string.
TYPES object_reference TYPE REF TO object.
TYPES END OF ts_instance_mapping_table.
TYPES:
tt_instance_mapping_table TYPE HASHED TABLE OF ts_instance_mapping_table
WITH UNIQUE KEY interface_name.
CONSTANTS:
constructor_name TYPE string VALUE `CONSTRUCTOR`,
ioc_container_name TYPE string VALUE `ZCL_IOC_CONTAINER`.
CLASS-DATA:
container TYPE REF TO zcl_ioc_container.
DATA:
mapping_table TYPE tt_mapping_table,
instance_mapping_table TYPE tt_instance_mapping_table.
METHODS:
assert_creation_possible
IMPORTING
!class_name TYPE string
RETURNING
VALUE(object_descriptor) TYPE REF TO cl_abap_objectdescr
RAISING
zcx_ioc_container,
assert_obj_creation_possible
IMPORTING
!type_descriptor TYPE REF TO cl_abap_typedescr
RETURNING
VALUE(object_descriptor) TYPE REF TO cl_abap_objectdescr
RAISING
zcx_ioc_container,
check_create_private
IMPORTING
!type_descriptor TYPE REF TO cl_abap_typedescr
RAISING
zcx_ioc_container,
check_not_instantiatable
IMPORTING
!object_descriptor TYPE REF TO cl_abap_objectdescr
RAISING
zcx_ioc_container,
get_parameter_descriptor
IMPORTING
!object_descriptor TYPE REF TO cl_abap_objectdescr
!parameter_name TYPE abap_parmname
RETURNING
VALUE(parameter_descriptor) TYPE REF TO cl_abap_datadescr,
get_parameter_type_name
IMPORTING
!parameter_descriptor TYPE REF TO cl_abap_datadescr
RETURNING
VALUE(parameter_type_name) TYPE string,
get_registered_mapping
IMPORTING
!interface_name TYPE string
RETURNING
VALUE(class_name) TYPE string,
get_registered_object
IMPORTING
!interface_name TYPE string
RETURNING
VALUE(registered_object) TYPE REF TO object,
get_type_descriptor
IMPORTING
!class_name TYPE string
RETURNING
VALUE(type_descriptor) TYPE REF TO cl_abap_typedescr.
ENDCLASS.
CLASS ZCL_IOC_CONTAINER IMPLEMENTATION.
METHOD assert_creation_possible.
DATA(type_descriptor) = get_type_descriptor( class_name ).
IF type_descriptor IS NOT BOUND.
RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>error_in_type_determination ).
ENDIF.
object_descriptor = assert_obj_creation_possible( type_descriptor ).
ENDMETHOD.
METHOD assert_obj_creation_possible.
check_create_private( type_descriptor ).
object_descriptor = CAST cl_abap_objectdescr( type_descriptor ).
check_not_instantiatable( object_descriptor ).
ENDMETHOD.
METHOD check_create_private.
DATA(class_descriptor) = CAST cl_abap_classdescr( type_descriptor ).
IF class_descriptor->create_visibility NE cl_abap_objectdescr=>public.
DATA(friends) = class_descriptor->get_friend_types( ).
LOOP AT friends ASSIGNING FIELD-SYMBOL(<friend>).
IF <friend>->get_relative_name( ) EQ ioc_container_name.
RETURN.
ENDIF.
ENDLOOP.
RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>class_is_create_private ).
ENDIF.
ENDMETHOD.
METHOD check_not_instantiatable.
IF object_descriptor->is_instantiatable( ) NE abap_true.
RAISE EXCEPTION NEW zcx_ioc_container( zcx_ioc_container=>object_is_not_instantiatable ).
ENDIF.
ENDMETHOD.
METHOD deregister.
IF interface_name IS SUPPLIED.
DELETE TABLE mapping_table
WITH TABLE KEY interface_name = to_upper( interface_name ).
ELSE.
CLEAR mapping_table[].
ENDIF.
ENDMETHOD.
METHOD deregister_instance.
IF interface_name IS SUPPLIED.
DELETE TABLE instance_mapping_table
WITH TABLE KEY interface_name = to_upper( interface_name ).
ELSE.
CLEAR instance_mapping_table[].
ENDIF.
ENDMETHOD.
METHOD get_instance.
IF container IS NOT BOUND.
container = NEW #( ).
ENDIF.
instance = container.
ENDMETHOD.
METHOD get_parameter_descriptor.
object_descriptor->get_method_parameter_type(
EXPORTING
p_method_name = constructor_name
p_parameter_name = parameter_name
RECEIVING
p_descr_ref = parameter_descriptor
EXCEPTIONS
OTHERS = 1
).
IF sy-subrc IS NOT INITIAL.
" This should not happen as the method and parameter names
" are returned from the object descriptor
CLEAR parameter_descriptor.
ENDIF.
ENDMETHOD.
METHOD get_parameter_type_name.
IF parameter_descriptor->kind EQ cl_abap_typedescr=>kind_ref.
DATA(reference_descriptor) = CAST cl_abap_refdescr( parameter_descriptor ).
DATA(referenced_type) = reference_descriptor->get_referenced_type( ).
IF referenced_type->kind EQ cl_abap_typedescr=>kind_class.
DATA(parameter_obj_descriptor) = CAST cl_abap_objectdescr( referenced_type ).
parameter_type_name = parameter_obj_descriptor->get_relative_name( ).
ELSEIF referenced_type->kind EQ cl_abap_typedescr=>kind_intf.
DATA(interface_descriptor) = CAST cl_abap_intfdescr( referenced_type ).
parameter_type_name = interface_descriptor->get_relative_name( ).
ENDIF.
ELSE.
parameter_type_name = parameter_descriptor->get_relative_name( ).
ENDIF.
ENDMETHOD.
METHOD get_registered_mapping.
class_name = VALUE #(
mapping_table[
interface_name = to_upper( interface_name )
]-class_name DEFAULT to_upper( interface_name ) ).
ENDMETHOD.
METHOD get_registered_object.
registered_object = VALUE #( instance_mapping_table[
interface_name = to_upper( interface_name )
]-object_reference OPTIONAL ).
ENDMETHOD.
METHOD get_type_descriptor.
cl_abap_classdescr=>describe_by_name(
EXPORTING
p_name = to_upper( class_name )
RECEIVING
p_descr_ref = type_descriptor
EXCEPTIONS
OTHERS = 1
).
IF sy-subrc IS NOT INITIAL.
CLEAR type_descriptor.
ENDIF.
ENDMETHOD.
METHOD register.
assert_creation_possible( to_upper( class_name ) ).
ASSIGN mapping_table[ interface_name = to_upper( interface_name ) ]
TO FIELD-SYMBOL(<mapping>).
IF <mapping> IS ASSIGNED.
<mapping>-class_name = to_upper( class_name ).
ELSE.
INSERT VALUE #(
interface_name = to_upper( interface_name )
class_name = to_upper( class_name )
) INTO TABLE mapping_table.
ENDIF.
ENDMETHOD.
METHOD register_instance.
ASSIGN instance_mapping_table[ interface_name = to_upper( interface_name ) ]
TO FIELD-SYMBOL(<instance_mapping>).
IF <instance_mapping> IS ASSIGNED.
<instance_mapping>-object_reference = instance.
ELSE.
INSERT VALUE #(
interface_name = to_upper( interface_name )
object_reference = instance
) INTO TABLE instance_mapping_table.
ENDIF.
ENDMETHOD.
METHOD resolve.
CHECK interface_name IS NOT INITIAL.
new_object = get_registered_object( interface_name ).
IF new_object IS BOUND.
RETURN.
ENDIF.
DATA(class_name) = get_registered_mapping( interface_name ).
DATA(type_descriptor) = get_type_descriptor( class_name ).
IF type_descriptor IS NOT BOUND
OR type_descriptor->kind NE cl_abap_typedescr=>kind_class.
RETURN.
ENDIF.
TRY.
DATA(object_descriptor) = assert_obj_creation_possible( type_descriptor ).
CATCH zcx_ioc_container.
RETURN.
ENDTRY.
DATA(constructor) = VALUE #( object_descriptor->methods[
name = constructor_name
] OPTIONAL ).
IF lines( constructor-parameters ) GT 0.
DATA: ref TYPE REF TO data.
FIELD-SYMBOLS: <fs> TYPE any.
LOOP AT constructor-parameters INTO DATA(constructor_parameter).
UNASSIGN <fs>.
DATA(parameter_descriptor) = get_parameter_descriptor(
object_descriptor = object_descriptor
parameter_name = constructor_parameter-name
).
IF parameter_descriptor IS NOT BOUND.
" This should not happen as the method and parameter names
" are returned from the object descriptor
CONTINUE.
ENDIF.
DATA(parameter_type_name) = get_parameter_type_name( parameter_descriptor ).
IF constructor_parameter-type_kind EQ cl_abap_typedescr=>typekind_oref.
CREATE DATA ref TYPE REF TO (parameter_type_name).
ASSIGN ref->* TO <fs>.
<fs> ?= resolve( parameter_type_name ).
ELSE.
CREATE DATA ref TYPE (parameter_type_name).
ASSIGN ref->* TO <fs>.
ENDIF.
IF constructor_parameter-is_optional EQ abap_true
AND ( <fs> IS NOT ASSIGNED OR <fs> IS INITIAL ).
" Optional parameters that are "null" can be skipped
CONTINUE.
ENDIF.
DATA(parameter_tab) = VALUE abap_parmbind_tab( (
name = constructor_parameter-name
kind = cl_abap_objectdescr=>exporting
value = REF #( <fs> )
) ).
ENDLOOP.
CREATE OBJECT new_object
TYPE (class_name)
PARAMETER-TABLE parameter_tab.
ELSE.
CREATE OBJECT new_object
TYPE (class_name).
ENDIF.
ENDMETHOD.
ENDCLASS.
| 25.75179 | 95 | 0.670158 |
73fe1cf6efce31c4325b1ffec50d1ab9244a8bba | 4,150 | abap | ABAP | src/objects/ecatt/zcl_abapgit_ecatt_helper.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | 1 | 2020-03-28T06:23:11.000Z | 2020-03-28T06:23:11.000Z | src/objects/ecatt/zcl_abapgit_ecatt_helper.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | null | null | null | src/objects/ecatt/zcl_abapgit_ecatt_helper.clas.abap | jeevanrajv1901/ABAPGIT | 6d2deece76a481da75a04e4bbafae2d286b64834 | [
"MIT"
] | null | null | null | CLASS zcl_abapgit_ecatt_helper DEFINITION
PUBLIC
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-METHODS:
build_xml_of_object
IMPORTING
iv_object_name TYPE etobj_name
iv_object_version TYPE etobj_ver
iv_object_type TYPE etobj_type
io_download TYPE REF TO cl_apl_ecatt_download
RETURNING
VALUE(rv_xml_stream) TYPE xstring
RAISING
zcx_abapgit_exception,
download_data
IMPORTING
ii_template_over_all TYPE REF TO if_ixml_document
RETURNING
VALUE(rv_xml_stream) TYPE xstring,
upload_data_from_stream
IMPORTING
iv_xml_stream TYPE xstring
RETURNING
VALUE(ri_template_over_all) TYPE REF TO if_ixml_document
RAISING
cx_ecatt_apl_xml.
PROTECTED SECTION.
PRIVATE SECTION.
CONSTANTS:
co_xml TYPE int4 VALUE 1. " downport of if_apl_ecatt_xml=>co_xml
ENDCLASS.
CLASS zcl_abapgit_ecatt_helper IMPLEMENTATION.
METHOD build_xml_of_object.
" downport of CL_APL_ECATT_DOWNLOAD=>BUILD_XML_OF_OBJECT
DATA: lo_load_help_dummy TYPE REF TO cl_apl_ecatt_load_help,
lx_ecatt TYPE REF TO cx_ecatt_apl,
lv_text TYPE string,
li_download TYPE REF TO zif_abapgit_ecatt_download.
"download method will create the xml stream
"note: it's the redefined download( ) of each object type specific download, which is called
TRY.
CREATE OBJECT lo_load_help_dummy
EXPORTING
im_maintain_function = ''.
io_download->download( im_object_name = iv_object_name
im_object_version = iv_object_version
im_object_type = iv_object_type
im_load_help = lo_load_help_dummy ).
CATCH cx_ecatt_apl INTO lx_ecatt.
lv_text = lx_ecatt->get_text( ).
zcx_abapgit_exception=>raise( lv_text ).
" note, exception cx_ecatt_ui_attachment doesn't exist in 702
CATCH cx_ecatt.
"will never be raised from download, when called with mv_generate_xml_no_download = 'X'.
ENDTRY.
li_download ?= io_download.
rv_xml_stream = li_download->get_xml_stream( ).
ENDMETHOD.
METHOD download_data.
DATA:
lo_xml TYPE REF TO cl_apl_ecatt_xml.
TRY.
CALL METHOD cl_apl_ecatt_xml=>('CREATE') " doesn't exist in 702
EXPORTING
im_type = co_xml
RECEIVING
re_xml = lo_xml.
lo_xml->set_attributes( im_dom = ii_template_over_all ).
lo_xml->get_attributes( IMPORTING ex_xml = rv_xml_stream ).
CATCH cx_ecatt_apl_xml.
RETURN.
ENDTRY.
ENDMETHOD.
METHOD upload_data_from_stream.
DATA:
lo_xml TYPE REF TO cl_apl_ecatt_xml,
lv_xstr TYPE xstring,
li_nc_xmlref_typ TYPE REF TO if_ixml_node_collection,
li_n_xmlref_typ TYPE REF TO if_ixml_node,
lv_index TYPE i VALUE 0,
lv_count TYPE i.
lv_xstr = iv_xml_stream.
CALL METHOD cl_apl_ecatt_xml=>('CREATE') " doesn't exist in 702
EXPORTING
im_type = co_xml
RECEIVING
re_xml = lo_xml.
* whitespace stripping needs a namespace
* remove white spaces only at the time of upload
lo_xml->stream_to_dom( im_xstream = lv_xstr
im_ignore_white_space = 'X'
im_uri = cl_apl_xml_const=>schema_uri ).
lo_xml->get_attributes( IMPORTING ex_dom = ri_template_over_all ).
* MD: Workaround, because nodes starting with "XML" are not allowed
li_nc_xmlref_typ ?= ri_template_over_all->get_elements_by_tag_name_ns( 'XMLREF_TYP' ). "#EC NOTEXT
CALL METHOD li_nc_xmlref_typ->('GET_LENGTH') " downport
RECEIVING
rval = lv_count.
WHILE lv_index < lv_count.
li_n_xmlref_typ = li_nc_xmlref_typ->get_item( lv_index ).
li_n_xmlref_typ->set_name( 'X-MLREF_TYP' ).
lv_index = lv_index + 1.
ENDWHILE.
ENDMETHOD.
ENDCLASS.
| 29.020979 | 102 | 0.641687 |
73ff9d21f91927d3fb912163ac19fcd8eb615eb5 | 1,190 | abap | ABAP | src/zaps_tasks/zcx_aps_task_unknown_exec_type.clas.abap | BiberM/ABAPParallelizationService | d0fca92dfe05456e73fadafd8763b7953e49eb57 | [
"MIT"
] | 7 | 2021-09-13T20:09:13.000Z | 2022-02-11T18:22:07.000Z | src/zaps_tasks/zcx_aps_task_unknown_exec_type.clas.abap | BiberM/ABAPParallelizationService | d0fca92dfe05456e73fadafd8763b7953e49eb57 | [
"MIT"
] | 8 | 2021-10-03T16:40:59.000Z | 2022-01-23T21:06:37.000Z | src/zaps_tasks/zcx_aps_task_unknown_exec_type.clas.abap | BiberM/ABAPParallelizationService | d0fca92dfe05456e73fadafd8763b7953e49eb57 | [
"MIT"
] | 1 | 2021-12-22T16:56:37.000Z | 2021-12-22T16:56:37.000Z | class zcx_aps_task_unknown_exec_type definition
public
inheriting from cx_static_check
final
create public.
public section.
interfaces:
if_t100_dyn_msg,
if_t100_message.
constants:
begin of zcx_aps_task_unknown_exec_type,
msgid type symsgid value 'ZAPS_TASK',
msgno type symsgno value '003',
attr1 type scx_attrname value 'EXECUTABLETYPE',
attr2 type scx_attrname value '',
attr3 type scx_attrname value '',
attr4 type scx_attrname value '',
end of zcx_aps_task_unknown_exec_type.
methods:
constructor
importing
i_textid type scx_t100key default zcx_aps_task_unknown_exec_type
i_previous type ref to cx_root optional
i_executableType type zaps_executable_type.
protected section.
private section.
data:
executableType type zaps_executable_type.
endclass.
class zcx_aps_task_unknown_exec_type implementation.
method constructor ##ADT_SUPPRESS_GENERATION.
super->constructor( previous = i_previous ).
clear textid.
if_t100_message~t100key = i_textid.
executableType = i_executableType.
endmethod.
endclass.
| 24.285714 | 76 | 0.718487 |