mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
Added enhanced method resolution for background exit (#7059)
Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
This commit is contained in:
parent
b1abcd8764
commit
21c8865209
|
@ -26,11 +26,12 @@ CLASS zcl_abapgit_background DEFINITION
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
CONSTANTS c_enq_type TYPE c LENGTH 12 VALUE 'BACKGROUND'.
|
CONSTANTS c_enq_type TYPE c LENGTH 12 VALUE 'BACKGROUND'.
|
||||||
|
CONSTANTS c_interface TYPE seoclskey VALUE 'ZIF_ABAPGIT_BACKGROUND'.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS zcl_abapgit_background IMPLEMENTATION.
|
CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD dequeue.
|
METHOD dequeue.
|
||||||
|
@ -59,36 +60,69 @@ CLASS zcl_abapgit_background IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD list_methods.
|
METHOD list_methods.
|
||||||
|
|
||||||
DATA: ls_method LIKE LINE OF rt_methods,
|
DATA: ls_method LIKE LINE OF rt_methods,
|
||||||
ls_key TYPE seoclskey,
|
lt_implementing TYPE seor_implementing_keys,
|
||||||
lt_implementing TYPE seor_implementing_keys,
|
ls_implementing LIKE LINE OF lt_implementing,
|
||||||
ls_implementing LIKE LINE OF lt_implementing.
|
lt_interf TYPE abap_intfdescr_tab,
|
||||||
|
lt_local_classes TYPE STANDARD TABLE OF scompo,
|
||||||
|
lv_classname TYPE string,
|
||||||
|
lr_typedescr TYPE REF TO cl_abap_typedescr,
|
||||||
|
lr_typedescr_class TYPE REF TO cl_abap_classdescr.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_method> LIKE LINE OF rt_methods.
|
FIELD-SYMBOLS: <ls_local_class> LIKE LINE OF lt_local_classes,
|
||||||
|
<ls_method> LIKE LINE OF rt_methods.
|
||||||
|
|
||||||
|
IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_true.
|
||||||
|
" Assume the standalone version runs.
|
||||||
|
CALL FUNCTION 'WB_TREE_GET_OBJECTS'
|
||||||
|
EXPORTING
|
||||||
|
include = ' '
|
||||||
|
otype = 'L'
|
||||||
|
program = sy-repid
|
||||||
|
TABLES
|
||||||
|
olist = lt_local_classes.
|
||||||
|
|
||||||
* in order to handle local classes in the compiled report
|
LOOP AT lt_local_classes ASSIGNING <ls_local_class>.
|
||||||
ls_method-class = 'ZCL_ABAPGIT_BACKGROUND_PULL'.
|
lv_classname = |\\PROGRAM={ sy-repid }\\CLASS={ <ls_local_class>-name }|.
|
||||||
INSERT ls_method INTO TABLE rt_methods.
|
cl_abap_typedescr=>describe_by_name(
|
||||||
ls_method-class = 'ZCL_ABAPGIT_BACKGROUND_PUSH_AU'.
|
EXPORTING
|
||||||
INSERT ls_method INTO TABLE rt_methods.
|
p_name = lv_classname
|
||||||
ls_method-class = 'ZCL_ABAPGIT_BACKGROUND_PUSH_FI'.
|
RECEIVING
|
||||||
INSERT ls_method INTO TABLE rt_methods.
|
p_descr_ref = lr_typedescr
|
||||||
|
EXCEPTIONS
|
||||||
|
type_not_found = 1
|
||||||
|
OTHERS = 2 ).
|
||||||
|
|
||||||
ls_key-clsname = 'ZIF_ABAPGIT_BACKGROUND'.
|
IF sy-subrc = 0 AND lr_typedescr IS BOUND.
|
||||||
|
lr_typedescr_class ?= lr_typedescr.
|
||||||
|
IF lr_typedescr_class IS BOUND.
|
||||||
|
lt_interf = lr_typedescr_class->interfaces.
|
||||||
|
READ TABLE lt_interf WITH TABLE KEY name = c_interface TRANSPORTING NO FIELDS.
|
||||||
|
IF sy-subrc = 0.
|
||||||
|
ls_method-class = <ls_local_class>-name.
|
||||||
|
INSERT ls_method INTO TABLE rt_methods.
|
||||||
|
ENDIF.
|
||||||
|
ENDIF.
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
CALL FUNCTION 'SEO_INTERFACE_IMPLEM_GET_ALL'
|
ELSE.
|
||||||
EXPORTING
|
" Assume the developer version runs.
|
||||||
intkey = ls_key
|
CALL FUNCTION 'SEO_INTERFACE_IMPLEM_GET_ALL'
|
||||||
IMPORTING
|
EXPORTING
|
||||||
impkeys = lt_implementing
|
intkey = c_interface
|
||||||
EXCEPTIONS
|
IMPORTING
|
||||||
not_existing = 1
|
impkeys = lt_implementing
|
||||||
OTHERS = 2 ##FM_SUBRC_OK.
|
EXCEPTIONS
|
||||||
LOOP AT lt_implementing INTO ls_implementing.
|
not_existing = 1
|
||||||
ls_method-class = ls_implementing-clsname.
|
OTHERS = 2.
|
||||||
INSERT ls_method INTO TABLE rt_methods.
|
IF sy-subrc = 0.
|
||||||
ENDLOOP.
|
LOOP AT lt_implementing INTO ls_implementing.
|
||||||
|
ls_method-class = ls_implementing-clsname.
|
||||||
|
INSERT ls_method INTO TABLE rt_methods.
|
||||||
|
ENDLOOP.
|
||||||
|
ENDIF.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
LOOP AT rt_methods ASSIGNING <ls_method>.
|
LOOP AT rt_methods ASSIGNING <ls_method>.
|
||||||
CALL METHOD (<ls_method>-class)=>zif_abapgit_background~get_description
|
CALL METHOD (<ls_method>-class)=>zif_abapgit_background~get_description
|
||||||
|
@ -136,12 +170,17 @@ CLASS zcl_abapgit_background IMPLEMENTATION.
|
||||||
iv_username = <ls_list>-username
|
iv_username = <ls_list>-username
|
||||||
iv_password = <ls_list>-password ).
|
iv_password = <ls_list>-password ).
|
||||||
|
|
||||||
CREATE OBJECT li_background TYPE (<ls_list>-method).
|
TRY.
|
||||||
|
CREATE OBJECT li_background TYPE (<ls_list>-method).
|
||||||
|
|
||||||
li_background->run(
|
li_background->run(
|
||||||
io_repo = lo_repo
|
io_repo = lo_repo
|
||||||
ii_log = li_log
|
ii_log = li_log
|
||||||
it_settings = <ls_list>-settings ).
|
it_settings = <ls_list>-settings ).
|
||||||
|
CATCH cx_sy_create_object_error.
|
||||||
|
li_log->add_warning( |{ <ls_list>-method } could not be executed,|
|
||||||
|
& | as it is not accessible (local/global class).| ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
" Decrease memory usage for repository already processed (but keep log)
|
" Decrease memory usage for repository already processed (but keep log)
|
||||||
lo_repo->refresh(
|
lo_repo->refresh(
|
||||||
|
|
|
@ -66,7 +66,7 @@ ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS zcl_abapgit_gui_page_sett_bckg IMPLEMENTATION.
|
CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_BCKG IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD constructor.
|
METHOD constructor.
|
||||||
|
@ -210,9 +210,13 @@ CLASS zcl_abapgit_gui_page_sett_bckg IMPLEMENTATION.
|
||||||
|
|
||||||
" skip invalid values, from old background logic
|
" skip invalid values, from old background logic
|
||||||
IF ls_per-method <> 'push' AND ls_per-method <> 'pull' AND ls_per-method <> 'nothing'.
|
IF ls_per-method <> 'push' AND ls_per-method <> 'pull' AND ls_per-method <> 'nothing'.
|
||||||
CALL METHOD (ls_per-method)=>zif_abapgit_background~get_settings
|
TRY.
|
||||||
CHANGING
|
CALL METHOD (ls_per-method)=>zif_abapgit_background~get_settings
|
||||||
ct_settings = lt_settings.
|
CHANGING
|
||||||
|
ct_settings = lt_settings.
|
||||||
|
CATCH cx_sy_dyn_call_illegal_class.
|
||||||
|
CLEAR lt_settings.
|
||||||
|
ENDTRY.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
LOOP AT lt_settings INTO ls_settings.
|
LOOP AT lt_settings INTO ls_settings.
|
||||||
|
|
|
@ -44,6 +44,11 @@ INCLUDE zabapgit_authorizations_exit IF FOUND.
|
||||||
* place the object in a different package than ZABAPGIT
|
* place the object in a different package than ZABAPGIT
|
||||||
INCLUDE zabapgit_user_exit IF FOUND.
|
INCLUDE zabapgit_user_exit IF FOUND.
|
||||||
|
|
||||||
|
* place all implementations of ZIF_ABAPGIT_BACKGROUND in following include,
|
||||||
|
* if using the development version of abapGit create a global classes instead
|
||||||
|
* place the object in a different package than ZABAPGIT
|
||||||
|
INCLUDE zabapgit_background_user_exit IF FOUND.
|
||||||
|
|
||||||
INCLUDE zabapgit_gui_pages_userexit IF FOUND.
|
INCLUDE zabapgit_gui_pages_userexit IF FOUND.
|
||||||
|
|
||||||
INCLUDE zabapgit_forms.
|
INCLUDE zabapgit_forms.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user