From 6044d3e7b2cc3a6071bfb6ac32cd8a10032cfb77 Mon Sep 17 00:00:00 2001 From: larshp Date: Sun, 12 Aug 2018 10:00:11 +0000 Subject: [PATCH] move PERSIST_USER behind interface move PERSIST_USER behind interface will be moved to instantiate via factory in follow up PR --- .../zcl_abapgit_persist_migrate.clas.abap | 51 +- .../zcl_abapgit_persistence_user.clas.abap | 673 +++++++----------- .../zcl_abapgit_persistence_user.clas.xml | 8 - .../zif_abapgit_persist_user.intf.abap | 147 ++++ src/persist/zif_abapgit_persist_user.intf.xml | 16 + src/ui/zcl_abapgit_gui_page_commit.clas.abap | 12 +- .../zcl_abapgit_gui_page_repo_over.clas.abap | 5 +- src/ui/zcl_abapgit_gui_page_tag.clas.abap | 16 +- src/ui/zcl_abapgit_services_git.clas.abap | 10 +- 9 files changed, 478 insertions(+), 460 deletions(-) create mode 100644 src/persist/zif_abapgit_persist_user.intf.abap create mode 100644 src/persist/zif_abapgit_persist_user.intf.xml diff --git a/src/persist/zcl_abapgit_persist_migrate.clas.abap b/src/persist/zcl_abapgit_persist_migrate.clas.abap index d0a5e26db..e2b7bfb03 100644 --- a/src/persist/zcl_abapgit_persist_migrate.clas.abap +++ b/src/persist/zcl_abapgit_persist_migrate.clas.abap @@ -59,7 +59,7 @@ ENDCLASS. -CLASS zcl_abapgit_persist_migrate IMPLEMENTATION. +CLASS ZCL_ABAPGIT_PERSIST_MIGRATE IMPLEMENTATION. METHOD distribute_settings_to_users. @@ -67,7 +67,7 @@ CLASS zcl_abapgit_persist_migrate IMPLEMENTATION. DATA: lt_abapgit_users TYPE STANDARD TABLE OF char12 WITH NON-UNIQUE DEFAULT KEY, ls_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings, - lo_user_persistence TYPE REF TO zcl_abapgit_persistence_user. + li_user_persistence TYPE REF TO zif_abapgit_persist_user. FIELD-SYMBOLS: LIKE LINE OF lt_abapgit_users, TYPE zcl_abapgit_persist_migrate=>ty_settings_to_migrate, @@ -80,9 +80,9 @@ CLASS zcl_abapgit_persist_migrate IMPLEMENTATION. LOOP AT lt_abapgit_users ASSIGNING . - lo_user_persistence = zcl_abapgit_persistence_user=>get_instance( ). + li_user_persistence = zcl_abapgit_persistence_user=>get_instance( ). - ls_user_settings = lo_user_persistence->get_settings( ). + ls_user_settings = li_user_persistence->get_settings( ). LOOP AT it_settings_to_migrate ASSIGNING . @@ -95,13 +95,24 @@ CLASS zcl_abapgit_persist_migrate IMPLEMENTATION. ENDLOOP. - lo_user_persistence->set_settings( ls_user_settings ). + li_user_persistence->set_settings( ls_user_settings ). ENDLOOP. ENDMETHOD. + METHOD get_global_settings_document. + + DATA: lv_global_settings_xml TYPE string. + + lv_global_settings_xml = read_global_settings_xml( ). + + ri_global_settings_dom = cl_ixml_80_20=>parse_to_document( stream_string = lv_global_settings_xml ). + + ENDMETHOD. + + METHOD lock_create. DATA: lv_obj_name TYPE tadir-obj_name, @@ -264,6 +275,15 @@ CLASS zcl_abapgit_persist_migrate IMPLEMENTATION. ENDMETHOD. + METHOD read_global_settings_xml. + + rv_global_settings_xml = zcl_abapgit_persistence_db=>get_instance( )->read( + iv_type = zcl_abapgit_persistence_db=>c_type_settings + iv_value = '' ). + + ENDMETHOD. + + METHOD run. IF table_exists( ) = abap_false. @@ -409,25 +429,4 @@ CLASS zcl_abapgit_persist_migrate IMPLEMENTATION. iv_data = lv_settings_xml ). ENDMETHOD. - - - METHOD read_global_settings_xml. - - rv_global_settings_xml = zcl_abapgit_persistence_db=>get_instance( )->read( - iv_type = zcl_abapgit_persistence_db=>c_type_settings - iv_value = '' ). - - ENDMETHOD. - - - METHOD get_global_settings_document. - - DATA: lv_global_settings_xml TYPE string. - - lv_global_settings_xml = read_global_settings_xml( ). - - ri_global_settings_dom = cl_ixml_80_20=>parse_to_document( stream_string = lv_global_settings_xml ). - - ENDMETHOD. - ENDCLASS. diff --git a/src/persist/zcl_abapgit_persistence_user.clas.abap b/src/persist/zcl_abapgit_persistence_user.clas.abap index 14641972b..e8b7b3a2e 100644 --- a/src/persist/zcl_abapgit_persistence_user.clas.abap +++ b/src/persist/zcl_abapgit_persistence_user.clas.abap @@ -4,153 +4,17 @@ CLASS zcl_abapgit_persistence_user DEFINITION PUBLIC SECTION. + INTERFACES zif_abapgit_persist_user . + TYPES tt_favorites TYPE zif_abapgit_persistence=>tt_repo_keys . CLASS-METHODS get_instance IMPORTING !iv_user TYPE xubname DEFAULT sy-uname RETURNING - VALUE(ro_user) TYPE REF TO zcl_abapgit_persistence_user . - METHODS get_changes_only - RETURNING - VALUE(rv_changes_only) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS get_default_git_user_email - RETURNING - VALUE(rv_email) TYPE string - RAISING - zcx_abapgit_exception . - METHODS get_default_git_user_name - RETURNING - VALUE(rv_username) TYPE string - RAISING - zcx_abapgit_exception . - METHODS get_diff_unified - RETURNING - VALUE(rv_diff_unified) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS get_favorites - RETURNING - VALUE(rt_favorites) TYPE tt_favorites - RAISING - zcx_abapgit_exception . - METHODS get_hide_files - RETURNING - VALUE(rv_hide) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS get_repo_git_user_email - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - RETURNING - VALUE(rv_email) TYPE string - RAISING - zcx_abapgit_exception . - METHODS get_repo_git_user_name - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - RETURNING - VALUE(rv_username) TYPE string - RAISING - zcx_abapgit_exception . - METHODS get_repo_last_change_seen - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - RETURNING - VALUE(rv_version) TYPE string - RAISING - zcx_abapgit_exception . - METHODS get_repo_login - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - RETURNING - VALUE(rv_login) TYPE string - RAISING - zcx_abapgit_exception . - METHODS get_repo_show - RETURNING - VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_repo-key - RAISING - zcx_abapgit_exception . - METHODS is_favorite_repo - IMPORTING - !iv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key - RETURNING - VALUE(rv_yes) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS set_default_git_user_email - IMPORTING - !iv_email TYPE string - RAISING - zcx_abapgit_exception . - METHODS set_default_git_user_name - IMPORTING - !iv_username TYPE string - RAISING - zcx_abapgit_exception . - METHODS set_repo_git_user_email - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - !iv_email TYPE string - RAISING - zcx_abapgit_exception . - METHODS set_repo_git_user_name - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - !iv_username TYPE string - RAISING - zcx_abapgit_exception . - METHODS set_repo_last_change_seen - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - !iv_version TYPE string - RAISING - zcx_abapgit_exception . - METHODS set_repo_login - IMPORTING - !iv_url TYPE zif_abapgit_persistence=>ty_repo-url - !iv_login TYPE string - RAISING - zcx_abapgit_exception . - METHODS set_repo_show - IMPORTING - !iv_key TYPE zif_abapgit_persistence=>ty_repo-key - RAISING - zcx_abapgit_exception . - METHODS toggle_changes_only - RETURNING - VALUE(rv_changes_only) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS toggle_diff_unified - RETURNING - VALUE(rv_diff_unified) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS toggle_favorite - IMPORTING - !iv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key - RAISING - zcx_abapgit_exception . - METHODS toggle_hide_files - RETURNING - VALUE(rv_hide) TYPE abap_bool - RAISING - zcx_abapgit_exception . - METHODS get_settings - RETURNING - VALUE(rs_user_settings) TYPE zif_abapgit_definitions=>ty_s_user_settings - RAISING - zcx_abapgit_exception. - METHODS set_settings - IMPORTING - is_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings - RAISING - zcx_abapgit_exception. + VALUE(ri_user) TYPE REF TO zif_abapgit_persist_user . PRIVATE SECTION. + TYPES: BEGIN OF ty_repo_config, url TYPE zif_abapgit_persistence=>ty_repo-url, @@ -173,7 +37,7 @@ CLASS zcl_abapgit_persistence_user DEFINITION END OF ty_user . DATA mv_user TYPE xubname . - CLASS-DATA go_current_user TYPE REF TO zcl_abapgit_persistence_user . + CLASS-DATA gi_current_user TYPE REF TO zif_abapgit_persist_user . METHODS constructor IMPORTING @@ -213,12 +77,11 @@ CLASS zcl_abapgit_persistence_user DEFINITION !is_repo_config TYPE ty_repo_config RAISING zcx_abapgit_exception . - ENDCLASS. -CLASS zcl_abapgit_persistence_user IMPLEMENTATION. +CLASS ZCL_ABAPGIT_PERSISTENCE_USER IMPLEMENTATION. METHOD constructor. @@ -243,57 +106,15 @@ CLASS zcl_abapgit_persistence_user IMPLEMENTATION. ENDMETHOD. - METHOD get_changes_only. - - rv_changes_only = read( )-changes_only. - - ENDMETHOD. "get_changes_only - - - METHOD get_default_git_user_email. - - rv_email = read( )-default_git_user-email. - - ENDMETHOD. - - - METHOD get_default_git_user_name. - - rv_username = read( )-default_git_user-name. - - ENDMETHOD. - - - METHOD get_diff_unified. - - rv_diff_unified = read( )-diff_unified. - - ENDMETHOD. "get_diff_unified - - - METHOD get_favorites. - - rt_favorites = read( )-favorites. - - ENDMETHOD. "get_favorites - - - METHOD get_hide_files. - - rv_hide = read( )-hide_files. - - ENDMETHOD. "get_hide_files - - METHOD get_instance. IF iv_user = sy-uname ##USER_OK. - IF go_current_user IS NOT BOUND. - CREATE OBJECT go_current_user. + IF gi_current_user IS NOT BOUND. + CREATE OBJECT gi_current_user TYPE zcl_abapgit_persistence_user. ENDIF. - ro_user = go_current_user. + ri_user = gi_current_user. ELSE. - CREATE OBJECT ro_user + CREATE OBJECT ri_user TYPE zcl_abapgit_persistence_user EXPORTING iv_user = iv_user. ENDIF. @@ -301,66 +122,6 @@ CLASS zcl_abapgit_persistence_user IMPLEMENTATION. ENDMETHOD. - METHOD get_repo_git_user_email. - - rv_email = read_repo_config( iv_url )-git_user-email. - - ENDMETHOD. "get_repo_email - - - METHOD get_repo_git_user_name. - - rv_username = read_repo_config( iv_url )-git_user-name. - - ENDMETHOD. "get_repo_username - - - METHOD get_repo_last_change_seen. - - rv_version = read_repo_config( iv_url )-last_change_seen. - - ENDMETHOD. "get_last_change_seen - - - METHOD get_repo_login. - - rv_login = read_repo_config( iv_url )-login. - - ENDMETHOD. "get_repo_login - - - METHOD get_repo_show. - - rv_key = read( )-repo_show. - - ENDMETHOD. - - - METHOD get_settings. - - DATA: ls_user TYPE ty_user. - - ls_user = read( ). - - rs_user_settings = ls_user-settings. - - ENDMETHOD. - - - METHOD is_favorite_repo. - - DATA: lt_favorites TYPE tt_favorites. - - lt_favorites = get_favorites( ). - - READ TABLE lt_favorites TRANSPORTING NO FIELDS - WITH KEY table_line = iv_repo_key. - - rv_yes = boolc( sy-subrc = 0 ). - - ENDMETHOD. " is_favorite_repo. - - METHOD read. DATA: lv_xml TYPE string. @@ -389,162 +150,6 @@ CLASS zcl_abapgit_persistence_user IMPLEMENTATION. ENDMETHOD. "read_repo_config - METHOD set_default_git_user_email. - - DATA: ls_user TYPE ty_user. - - - ls_user = read( ). - ls_user-default_git_user-email = iv_email. - update( ls_user ). - - ENDMETHOD. - - - METHOD set_default_git_user_name. - - DATA: ls_user TYPE ty_user. - - - ls_user = read( ). - - ls_user-default_git_user-name = iv_username. - - update( ls_user ). - - ENDMETHOD. - - - METHOD set_repo_git_user_email. - - DATA: ls_repo_config TYPE ty_repo_config. - - ls_repo_config = read_repo_config( iv_url ). - ls_repo_config-git_user-email = iv_email. - update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). - - ENDMETHOD. "set_repo_email - - - METHOD set_repo_git_user_name. - - DATA: ls_repo_config TYPE ty_repo_config. - - ls_repo_config = read_repo_config( iv_url ). - ls_repo_config-git_user-name = iv_username. - update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). - - ENDMETHOD. "set_repo_username - - - METHOD set_repo_last_change_seen. - - DATA: ls_repo_config TYPE ty_repo_config. - - ls_repo_config = read_repo_config( iv_url ). - ls_repo_config-last_change_seen = iv_version. - update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). - - ENDMETHOD. "set_last_change_seen - - - METHOD set_repo_login. - - DATA: ls_repo_config TYPE ty_repo_config. - - ls_repo_config = read_repo_config( iv_url ). - ls_repo_config-login = iv_login. - update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). - - ENDMETHOD. "set_repo_login - - - METHOD set_repo_show. - - DATA: ls_user TYPE ty_user. - - - ls_user = read( ). - ls_user-repo_show = iv_key. - update( ls_user ). - - COMMIT WORK AND WAIT. - - ENDMETHOD. - - - METHOD set_settings. - - DATA: ls_user TYPE ty_user. - - ls_user = read( ). - ls_user-settings = is_user_settings. - update( ls_user ). - - ENDMETHOD. - - - METHOD toggle_changes_only. - - DATA ls_user TYPE ty_user. - - ls_user = read( ). - ls_user-changes_only = boolc( ls_user-changes_only = abap_false ). - update( ls_user ). - - rv_changes_only = ls_user-changes_only. - - ENDMETHOD. "toggle_changes_only - - - METHOD toggle_diff_unified. - - DATA ls_user TYPE ty_user. - - ls_user = read( ). - ls_user-diff_unified = boolc( ls_user-diff_unified = abap_false ). - update( ls_user ). - - rv_diff_unified = ls_user-diff_unified. - - ENDMETHOD. "toggle_diff_unified - - - METHOD toggle_favorite. - - DATA: ls_user TYPE ty_user. - - ls_user = read( ). - - READ TABLE ls_user-favorites TRANSPORTING NO FIELDS - WITH KEY table_line = iv_repo_key. - - IF sy-subrc = 0. - DELETE ls_user-favorites INDEX sy-tabix. - ELSE. - APPEND iv_repo_key TO ls_user-favorites. - ENDIF. - - update( ls_user ). - - COMMIT WORK AND WAIT. - - ENDMETHOD. " toggle_favorite. - - - METHOD toggle_hide_files. - - DATA ls_user TYPE ty_user. - - ls_user = read( ). - ls_user-hide_files = boolc( ls_user-hide_files = abap_false ). - update( ls_user ). - - rv_hide = ls_user-hide_files. - - ENDMETHOD. "toggle_hide_files - - METHOD to_xml. CALL TRANSFORMATION id SOURCE user = is_user @@ -589,4 +194,262 @@ CLASS zcl_abapgit_persistence_user IMPLEMENTATION. COMMIT WORK AND WAIT. ENDMETHOD. "update_repo_config + + + METHOD zif_abapgit_persist_user~get_changes_only. + + rv_changes_only = read( )-changes_only. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_default_git_user_email. + + rv_email = read( )-default_git_user-email. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_default_git_user_name. + + rv_username = read( )-default_git_user-name. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_diff_unified. + + rv_diff_unified = read( )-diff_unified. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_favorites. + + rt_favorites = read( )-favorites. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_hide_files. + + rv_hide = read( )-hide_files. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_repo_git_user_email. + + rv_email = read_repo_config( iv_url )-git_user-email. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_repo_git_user_name. + + rv_username = read_repo_config( iv_url )-git_user-name. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_repo_last_change_seen. + + rv_version = read_repo_config( iv_url )-last_change_seen. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_repo_login. + + rv_login = read_repo_config( iv_url )-login. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_repo_show. + + rv_key = read( )-repo_show. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~get_settings. + + DATA: ls_user TYPE ty_user. + + ls_user = read( ). + + rs_user_settings = ls_user-settings. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~is_favorite_repo. + + DATA: lt_favorites TYPE tt_favorites. + + lt_favorites = zif_abapgit_persist_user~get_favorites( ). + + READ TABLE lt_favorites TRANSPORTING NO FIELDS + WITH KEY table_line = iv_repo_key. + + rv_yes = boolc( sy-subrc = 0 ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_default_git_user_email. + + DATA: ls_user TYPE ty_user. + + + ls_user = read( ). + ls_user-default_git_user-email = iv_email. + update( ls_user ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_default_git_user_name. + + DATA: ls_user TYPE ty_user. + + + ls_user = read( ). + + ls_user-default_git_user-name = iv_username. + + update( ls_user ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_repo_git_user_email. + + DATA: ls_repo_config TYPE ty_repo_config. + + ls_repo_config = read_repo_config( iv_url ). + ls_repo_config-git_user-email = iv_email. + update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_repo_git_user_name. + + DATA: ls_repo_config TYPE ty_repo_config. + + ls_repo_config = read_repo_config( iv_url ). + ls_repo_config-git_user-name = iv_username. + update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_repo_last_change_seen. + + DATA: ls_repo_config TYPE ty_repo_config. + + ls_repo_config = read_repo_config( iv_url ). + ls_repo_config-last_change_seen = iv_version. + update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_repo_login. + + DATA: ls_repo_config TYPE ty_repo_config. + + ls_repo_config = read_repo_config( iv_url ). + ls_repo_config-login = iv_login. + update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_repo_show. + + DATA: ls_user TYPE ty_user. + + + ls_user = read( ). + ls_user-repo_show = iv_key. + update( ls_user ). + + COMMIT WORK AND WAIT. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~set_settings. + + DATA: ls_user TYPE ty_user. + + ls_user = read( ). + ls_user-settings = is_user_settings. + update( ls_user ). + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~toggle_changes_only. + + DATA ls_user TYPE ty_user. + + ls_user = read( ). + ls_user-changes_only = boolc( ls_user-changes_only = abap_false ). + update( ls_user ). + + rv_changes_only = ls_user-changes_only. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~toggle_diff_unified. + + DATA ls_user TYPE ty_user. + + ls_user = read( ). + ls_user-diff_unified = boolc( ls_user-diff_unified = abap_false ). + update( ls_user ). + + rv_diff_unified = ls_user-diff_unified. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~toggle_favorite. + + DATA: ls_user TYPE ty_user. + + ls_user = read( ). + + READ TABLE ls_user-favorites TRANSPORTING NO FIELDS + WITH KEY table_line = iv_repo_key. + + IF sy-subrc = 0. + DELETE ls_user-favorites INDEX sy-tabix. + ELSE. + APPEND iv_repo_key TO ls_user-favorites. + ENDIF. + + update( ls_user ). + + COMMIT WORK AND WAIT. + + ENDMETHOD. + + + METHOD zif_abapgit_persist_user~toggle_hide_files. + + DATA ls_user TYPE ty_user. + + ls_user = read( ). + ls_user-hide_files = boolc( ls_user-hide_files = abap_false ). + update( ls_user ). + + rv_hide = ls_user-hide_files. + + ENDMETHOD. ENDCLASS. diff --git a/src/persist/zcl_abapgit_persistence_user.clas.xml b/src/persist/zcl_abapgit_persistence_user.clas.xml index 6e6a2029d..cb7fc0b8a 100644 --- a/src/persist/zcl_abapgit_persistence_user.clas.xml +++ b/src/persist/zcl_abapgit_persistence_user.clas.xml @@ -12,14 +12,6 @@ X X - - - ZCL_ABAPGIT_PERSISTENCE_USER - GO_CURRENT_USER - E - User persistence - - diff --git a/src/persist/zif_abapgit_persist_user.intf.abap b/src/persist/zif_abapgit_persist_user.intf.abap new file mode 100644 index 000000000..745a65f3a --- /dev/null +++ b/src/persist/zif_abapgit_persist_user.intf.abap @@ -0,0 +1,147 @@ +INTERFACE zif_abapgit_persist_user + PUBLIC . + + TYPES tt_favorites TYPE zif_abapgit_persistence=>tt_repo_keys . + + METHODS get_changes_only + RETURNING + VALUE(rv_changes_only) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS get_default_git_user_email + RETURNING + VALUE(rv_email) TYPE string + RAISING + zcx_abapgit_exception . + METHODS get_default_git_user_name + RETURNING + VALUE(rv_username) TYPE string + RAISING + zcx_abapgit_exception . + METHODS get_diff_unified + RETURNING + VALUE(rv_diff_unified) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS get_favorites + RETURNING + VALUE(rt_favorites) TYPE tt_favorites + RAISING + zcx_abapgit_exception . + METHODS get_hide_files + RETURNING + VALUE(rv_hide) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS get_repo_git_user_email + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + RETURNING + VALUE(rv_email) TYPE string + RAISING + zcx_abapgit_exception . + METHODS get_repo_git_user_name + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + RETURNING + VALUE(rv_username) TYPE string + RAISING + zcx_abapgit_exception . + METHODS get_repo_last_change_seen + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + RETURNING + VALUE(rv_version) TYPE string + RAISING + zcx_abapgit_exception . + METHODS get_repo_login + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + RETURNING + VALUE(rv_login) TYPE string + RAISING + zcx_abapgit_exception . + METHODS get_repo_show + RETURNING + VALUE(rv_key) TYPE zif_abapgit_persistence=>ty_repo-key + RAISING + zcx_abapgit_exception . + METHODS is_favorite_repo + IMPORTING + !iv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key + RETURNING + VALUE(rv_yes) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS set_default_git_user_email + IMPORTING + !iv_email TYPE string + RAISING + zcx_abapgit_exception . + METHODS set_default_git_user_name + IMPORTING + !iv_username TYPE string + RAISING + zcx_abapgit_exception . + METHODS set_repo_git_user_email + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + !iv_email TYPE string + RAISING + zcx_abapgit_exception . + METHODS set_repo_git_user_name + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + !iv_username TYPE string + RAISING + zcx_abapgit_exception . + METHODS set_repo_last_change_seen + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + !iv_version TYPE string + RAISING + zcx_abapgit_exception . + METHODS set_repo_login + IMPORTING + !iv_url TYPE zif_abapgit_persistence=>ty_repo-url + !iv_login TYPE string + RAISING + zcx_abapgit_exception . + METHODS set_repo_show + IMPORTING + !iv_key TYPE zif_abapgit_persistence=>ty_repo-key + RAISING + zcx_abapgit_exception . + METHODS toggle_changes_only + RETURNING + VALUE(rv_changes_only) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS toggle_diff_unified + RETURNING + VALUE(rv_diff_unified) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS toggle_favorite + IMPORTING + !iv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key + RAISING + zcx_abapgit_exception . + METHODS toggle_hide_files + RETURNING + VALUE(rv_hide) TYPE abap_bool + RAISING + zcx_abapgit_exception . + METHODS get_settings + RETURNING + VALUE(rs_user_settings) TYPE zif_abapgit_definitions=>ty_s_user_settings + RAISING + zcx_abapgit_exception. + METHODS set_settings + IMPORTING + is_user_settings TYPE zif_abapgit_definitions=>ty_s_user_settings + RAISING + zcx_abapgit_exception. + + +ENDINTERFACE. diff --git a/src/persist/zif_abapgit_persist_user.intf.xml b/src/persist/zif_abapgit_persist_user.intf.xml new file mode 100644 index 000000000..712c683b0 --- /dev/null +++ b/src/persist/zif_abapgit_persist_user.intf.xml @@ -0,0 +1,16 @@ + + + + + + ZIF_ABAPGIT_PERSIST_USER + 1 + E + User persistence + 2 + 1 + X + + + + diff --git a/src/ui/zcl_abapgit_gui_page_commit.clas.abap b/src/ui/zcl_abapgit_gui_page_commit.clas.abap index acce5ad08..bc3e9378e 100644 --- a/src/ui/zcl_abapgit_gui_page_commit.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_commit.clas.abap @@ -152,7 +152,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_COMMIT IMPLEMENTATION. CONSTANTS: lc_body_col_max TYPE i VALUE 150. - DATA: lo_user TYPE REF TO zcl_abapgit_persistence_user. + DATA: li_user TYPE REF TO zif_abapgit_persist_user. DATA: lv_user TYPE string. DATA: lv_email TYPE string. DATA: lv_s_param TYPE string. @@ -163,20 +163,20 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_COMMIT IMPLEMENTATION. * commit messages should be max 50 characters * body should wrap at 72 characters - lo_user = zcl_abapgit_persistence_user=>get_instance( ). + li_user = zcl_abapgit_persistence_user=>get_instance( ). - lv_user = lo_user->get_repo_git_user_name( mo_repo->get_url( ) ). + lv_user = li_user->get_repo_git_user_name( mo_repo->get_url( ) ). IF lv_user IS INITIAL. - lv_user = lo_user->get_default_git_user_name( ). + lv_user = li_user->get_default_git_user_name( ). ENDIF. IF lv_user IS INITIAL. " get default from user master record lv_user = zcl_abapgit_user_master_record=>get_instance( sy-uname )->get_name( ). ENDIF. - lv_email = lo_user->get_repo_git_user_email( mo_repo->get_url( ) ). + lv_email = li_user->get_repo_git_user_email( mo_repo->get_url( ) ). IF lv_email IS INITIAL. - lv_email = lo_user->get_default_git_user_email( ). + lv_email = li_user->get_default_git_user_email( ). ENDIF. IF lv_email IS INITIAL. " get default from user master record diff --git a/src/ui/zcl_abapgit_gui_page_repo_over.clas.abap b/src/ui/zcl_abapgit_gui_page_repo_over.clas.abap index 68730187f..e7d1b859f 100644 --- a/src/ui/zcl_abapgit_gui_page_repo_over.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_repo_over.clas.abap @@ -215,20 +215,19 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_REPO_OVER IMPLEMENTATION. DATA: ls_overview LIKE LINE OF rt_overview, lo_repo_srv TYPE REF TO zcl_abapgit_repo, - lo_user TYPE REF TO zcl_abapgit_persistence_user, lv_date TYPE d, lv_time TYPE t. FIELD-SYMBOLS: LIKE LINE OF it_repo_list. - lo_user = zcl_abapgit_persistence_user=>get_instance( ). LOOP AT it_repo_list ASSIGNING . CLEAR: ls_overview. lo_repo_srv = zcl_abapgit_repo_srv=>get_instance( )->get( -key ). - ls_overview-favorite = lo_user->is_favorite_repo( -key ). + ls_overview-favorite = zcl_abapgit_persistence_user=>get_instance( + )->is_favorite_repo( -key ). ls_overview-type = -offline. ls_overview-key = -key. ls_overview-name = lo_repo_srv->get_name( ). diff --git a/src/ui/zcl_abapgit_gui_page_tag.clas.abap b/src/ui/zcl_abapgit_gui_page_tag.clas.abap index b161f462a..447b65edc 100644 --- a/src/ui/zcl_abapgit_gui_page_tag.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_tag.clas.abap @@ -60,7 +60,7 @@ ENDCLASS. -CLASS zcl_abapgit_gui_page_tag IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_PAGE_TAG IMPLEMENTATION. METHOD constructor. @@ -201,7 +201,7 @@ CLASS zcl_abapgit_gui_page_tag IMPLEMENTATION. CONSTANTS: lc_body_col_max TYPE i VALUE 150. - DATA: lo_user TYPE REF TO zcl_abapgit_persistence_user, + DATA: li_user TYPE REF TO zif_abapgit_persist_user, lv_user TYPE string, lv_email TYPE string, lv_s_param TYPE string, @@ -209,22 +209,24 @@ CLASS zcl_abapgit_gui_page_tag IMPLEMENTATION. lv_body_size TYPE i, lt_type TYPE stringtab, lv_selected TYPE string. + FIELD-SYMBOLS: LIKE LINE OF lt_type. - lo_user = zcl_abapgit_persistence_user=>get_instance( ). - lv_user = lo_user->get_repo_git_user_name( mo_repo_online->get_url( ) ). + li_user = zcl_abapgit_persistence_user=>get_instance( ). + + lv_user = li_user->get_repo_git_user_name( mo_repo_online->get_url( ) ). IF lv_user IS INITIAL. - lv_user = lo_user->get_default_git_user_name( ). + lv_user = li_user->get_default_git_user_name( ). ENDIF. IF lv_user IS INITIAL. " get default from user master record lv_user = zcl_abapgit_user_master_record=>get_instance( sy-uname )->get_name( ). ENDIF. - lv_email = lo_user->get_repo_git_user_email( mo_repo_online->get_url( ) ). + lv_email = li_user->get_repo_git_user_email( mo_repo_online->get_url( ) ). IF lv_email IS INITIAL. - lv_email = lo_user->get_default_git_user_email( ). + lv_email = li_user->get_default_git_user_email( ). ENDIF. IF lv_email IS INITIAL. " get default from user master record diff --git a/src/ui/zcl_abapgit_services_git.clas.abap b/src/ui/zcl_abapgit_services_git.clas.abap index dcd7fd63c..71277da81 100644 --- a/src/ui/zcl_abapgit_services_git.clas.abap +++ b/src/ui/zcl_abapgit_services_git.clas.abap @@ -86,12 +86,12 @@ CLASS ZCL_ABAPGIT_SERVICES_GIT IMPLEMENTATION. METHOD commit. DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment, - lo_user TYPE REF TO zcl_abapgit_persistence_user. + li_user TYPE REF TO zif_abapgit_persist_user. - lo_user = zcl_abapgit_persistence_user=>get_instance( ). - lo_user->set_repo_git_user_name( iv_url = io_repo->get_url( ) + li_user = zcl_abapgit_persistence_user=>get_instance( ). + li_user->set_repo_git_user_name( iv_url = io_repo->get_url( ) iv_username = is_commit-committer_name ). - lo_user->set_repo_git_user_email( iv_url = io_repo->get_url( ) + li_user->set_repo_git_user_email( iv_url = io_repo->get_url( ) iv_email = is_commit-committer_email ). IF is_commit-committer_name IS INITIAL. @@ -120,7 +120,7 @@ CLASS ZCL_ABAPGIT_SERVICES_GIT IMPLEMENTATION. COMMIT WORK. - ENDMETHOD. "commit + ENDMETHOD. METHOD create_branch.