mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Persistence to global (#1130)
* refactor persistence get_instance * more persistence to global * more * more * fix indentation
This commit is contained in:
parent
bdf62461ac
commit
436a03936a
164
src/persist/zcl_abapgit_persist_background.clas.abap
Normal file
164
src/persist/zcl_abapgit_persist_background.clas.abap
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
CLASS zcl_abapgit_persist_background DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
CONSTANTS: BEGIN OF c_method,
|
||||||
|
nothing TYPE string VALUE 'nothing' ##NO_TEXT,
|
||||||
|
pull TYPE string VALUE 'pull' ##NO_TEXT,
|
||||||
|
push TYPE string VALUE 'push' ##NO_TEXT,
|
||||||
|
END OF c_method.
|
||||||
|
|
||||||
|
CONSTANTS: BEGIN OF c_amethod,
|
||||||
|
fixed TYPE string VALUE 'fixed' ##NO_TEXT,
|
||||||
|
auto TYPE string VALUE 'auto' ##NO_TEXT,
|
||||||
|
END OF c_amethod.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF ty_xml,
|
||||||
|
method TYPE string,
|
||||||
|
username TYPE string,
|
||||||
|
password TYPE string,
|
||||||
|
amethod TYPE string,
|
||||||
|
aname TYPE string,
|
||||||
|
amail TYPE string,
|
||||||
|
END OF ty_xml.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF ty_background,
|
||||||
|
key TYPE zcl_abapgit_persistence_db=>ty_value.
|
||||||
|
INCLUDE TYPE ty_xml.
|
||||||
|
TYPES: END OF ty_background.
|
||||||
|
TYPES: tt_background TYPE STANDARD TABLE OF ty_background WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
METHODS constructor.
|
||||||
|
|
||||||
|
METHODS list
|
||||||
|
RETURNING VALUE(rt_list) TYPE tt_background
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS modify
|
||||||
|
IMPORTING is_data TYPE ty_background
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS delete
|
||||||
|
IMPORTING iv_key TYPE ty_background-key
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS exists
|
||||||
|
IMPORTING iv_key TYPE ty_background-key
|
||||||
|
RETURNING VALUE(rv_yes) TYPE abap_bool
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
DATA: mo_db TYPE REF TO zcl_abapgit_persistence_db,
|
||||||
|
mt_jobs TYPE tt_background.
|
||||||
|
|
||||||
|
METHODS from_xml
|
||||||
|
IMPORTING iv_string TYPE string
|
||||||
|
RETURNING VALUE(rs_xml) TYPE ty_xml
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS to_xml
|
||||||
|
IMPORTING is_background TYPE ty_background
|
||||||
|
RETURNING VALUE(rv_string) TYPE string.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_ABAPGIT_PERSIST_BACKGROUND IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mo_db = zcl_abapgit_persistence_db=>get_instance( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD delete.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
mo_db->read( iv_type = zcl_abapgit_persistence_db=>c_type_background
|
||||||
|
iv_value = iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
RETURN.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
mo_db->delete( iv_type = zcl_abapgit_persistence_db=>c_type_background
|
||||||
|
iv_value = iv_key ).
|
||||||
|
|
||||||
|
DELETE mt_jobs WHERE key = iv_key.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD exists.
|
||||||
|
|
||||||
|
list( ). " Ensure mt_jobs is populated
|
||||||
|
READ TABLE mt_jobs WITH KEY key = iv_key TRANSPORTING NO FIELDS.
|
||||||
|
rv_yes = boolc( sy-subrc = 0 ).
|
||||||
|
|
||||||
|
ENDMETHOD. "exists
|
||||||
|
|
||||||
|
|
||||||
|
METHOD from_xml.
|
||||||
|
CALL TRANSFORMATION id
|
||||||
|
OPTIONS value_handling = 'accept_data_loss'
|
||||||
|
SOURCE XML iv_string
|
||||||
|
RESULT data = rs_xml ##NO_TEXT.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD list.
|
||||||
|
|
||||||
|
DATA: lt_list TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_xml TYPE ty_xml.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_list> LIKE LINE OF lt_list,
|
||||||
|
<ls_output> LIKE LINE OF rt_list.
|
||||||
|
|
||||||
|
IF lines( mt_jobs ) > 0.
|
||||||
|
rt_list = mt_jobs.
|
||||||
|
RETURN.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
|
||||||
|
lt_list = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_background ).
|
||||||
|
|
||||||
|
LOOP AT lt_list ASSIGNING <ls_list>.
|
||||||
|
ls_xml = from_xml( <ls_list>-data_str ).
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO rt_list ASSIGNING <ls_output>.
|
||||||
|
MOVE-CORRESPONDING ls_xml TO <ls_output>.
|
||||||
|
<ls_output>-key = <ls_list>-value.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
mt_jobs = rt_list.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD modify.
|
||||||
|
|
||||||
|
ASSERT NOT is_data-key IS INITIAL.
|
||||||
|
|
||||||
|
mo_db->modify(
|
||||||
|
iv_type = zcl_abapgit_persistence_db=>c_type_background
|
||||||
|
iv_value = is_data-key
|
||||||
|
iv_data = to_xml( is_data ) ).
|
||||||
|
|
||||||
|
DELETE mt_jobs WHERE key = is_data-key.
|
||||||
|
APPEND is_data TO mt_jobs.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD to_xml.
|
||||||
|
DATA: ls_xml TYPE ty_xml.
|
||||||
|
|
||||||
|
MOVE-CORRESPONDING is_background TO ls_xml.
|
||||||
|
|
||||||
|
CALL TRANSFORMATION id
|
||||||
|
SOURCE data = ls_xml
|
||||||
|
RESULT XML rv_string.
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
18
src/persist/zcl_abapgit_persist_background.clas.xml
Normal file
18
src/persist/zcl_abapgit_persist_background.clas.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSIST_BACKGROUND</CLSNAME>
|
||||||
|
<VERSION>1</VERSION>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Persist background</DESCRIPT>
|
||||||
|
<EXPOSURE>2</EXPOSURE>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
414
src/persist/zcl_abapgit_persist_migrate.clas.abap
Normal file
414
src/persist/zcl_abapgit_persist_migrate.clas.abap
Normal file
|
@ -0,0 +1,414 @@
|
||||||
|
CLASS zcl_abapgit_persist_migrate DEFINITION PUBLIC CREATE PUBLIC.
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
CLASS-METHODS: run RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
CONSTANTS:
|
||||||
|
c_text TYPE string VALUE 'Generated by abapGit' ##NO_TEXT.
|
||||||
|
|
||||||
|
CLASS-METHODS:
|
||||||
|
migrate_settings
|
||||||
|
RAISING zcx_abapgit_exception,
|
||||||
|
table_create
|
||||||
|
RAISING zcx_abapgit_exception,
|
||||||
|
table_exists
|
||||||
|
RETURNING VALUE(rv_exists) TYPE abap_bool,
|
||||||
|
lock_create
|
||||||
|
RAISING zcx_abapgit_exception,
|
||||||
|
lock_exists
|
||||||
|
RETURNING VALUE(rv_exists) TYPE abap_bool,
|
||||||
|
settings_exists
|
||||||
|
RETURNING VALUE(rv_exists) TYPE abap_bool.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_ABAPGIT_PERSIST_MIGRATE IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD lock_create.
|
||||||
|
|
||||||
|
DATA: lv_obj_name TYPE tadir-obj_name,
|
||||||
|
ls_dd25v TYPE dd25v,
|
||||||
|
lt_dd26e TYPE STANDARD TABLE OF dd26e WITH DEFAULT KEY,
|
||||||
|
lt_dd27p TYPE STANDARD TABLE OF dd27p WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_dd26e> LIKE LINE OF lt_dd26e,
|
||||||
|
<ls_dd27p> LIKE LINE OF lt_dd27p.
|
||||||
|
|
||||||
|
|
||||||
|
ls_dd25v-viewname = zcl_abapgit_persistence_db=>c_lock.
|
||||||
|
ls_dd25v-aggtype = 'E'.
|
||||||
|
ls_dd25v-roottab = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
ls_dd25v-ddlanguage = zif_abapgit_definitions=>gc_english.
|
||||||
|
ls_dd25v-ddtext = c_text.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_dd26e ASSIGNING <ls_dd26e>.
|
||||||
|
<ls_dd26e>-viewname = zcl_abapgit_persistence_db=>c_lock.
|
||||||
|
<ls_dd26e>-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd26e>-tabpos = '0001'.
|
||||||
|
<ls_dd26e>-fortabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd26e>-enqmode = 'E'.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_dd27p ASSIGNING <ls_dd27p>.
|
||||||
|
<ls_dd27p>-viewname = zcl_abapgit_persistence_db=>c_lock.
|
||||||
|
<ls_dd27p>-objpos = '0001'.
|
||||||
|
<ls_dd27p>-viewfield = 'TYPE'.
|
||||||
|
<ls_dd27p>-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd27p>-fieldname = 'TYPE'.
|
||||||
|
<ls_dd27p>-keyflag = abap_true.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_dd27p ASSIGNING <ls_dd27p>.
|
||||||
|
<ls_dd27p>-viewname = zcl_abapgit_persistence_db=>c_lock.
|
||||||
|
<ls_dd27p>-objpos = '0002'.
|
||||||
|
<ls_dd27p>-viewfield = 'VALUE'.
|
||||||
|
<ls_dd27p>-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd27p>-fieldname = 'VALUE'.
|
||||||
|
<ls_dd27p>-keyflag = abap_true.
|
||||||
|
|
||||||
|
CALL FUNCTION 'DDIF_ENQU_PUT'
|
||||||
|
EXPORTING
|
||||||
|
name = zcl_abapgit_persistence_db=>c_lock
|
||||||
|
dd25v_wa = ls_dd25v
|
||||||
|
TABLES
|
||||||
|
dd26e_tab = lt_dd26e
|
||||||
|
dd27p_tab = lt_dd27p
|
||||||
|
EXCEPTIONS
|
||||||
|
enqu_not_found = 1
|
||||||
|
name_inconsistent = 2
|
||||||
|
enqu_inconsistent = 3
|
||||||
|
put_failure = 4
|
||||||
|
put_refused = 5
|
||||||
|
OTHERS = 6.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'migrate, error from DDIF_ENQU_PUT' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
lv_obj_name = zcl_abapgit_persistence_db=>c_lock.
|
||||||
|
CALL FUNCTION 'TR_TADIR_INTERFACE'
|
||||||
|
EXPORTING
|
||||||
|
wi_tadir_pgmid = 'R3TR'
|
||||||
|
wi_tadir_object = 'ENQU'
|
||||||
|
wi_tadir_obj_name = lv_obj_name
|
||||||
|
wi_set_genflag = abap_true
|
||||||
|
wi_test_modus = abap_false
|
||||||
|
wi_tadir_devclass = '$TMP'
|
||||||
|
EXCEPTIONS
|
||||||
|
OTHERS = 1.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'migrate, error from TR_TADIR_INTERFACE' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
CALL FUNCTION 'DDIF_ENQU_ACTIVATE'
|
||||||
|
EXPORTING
|
||||||
|
name = zcl_abapgit_persistence_db=>c_lock
|
||||||
|
EXCEPTIONS
|
||||||
|
not_found = 1
|
||||||
|
put_failure = 2
|
||||||
|
OTHERS = 3.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'migrate, error from DDIF_ENQU_ACTIVATE' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD lock_exists.
|
||||||
|
|
||||||
|
DATA: lv_viewname TYPE dd25l-viewname.
|
||||||
|
|
||||||
|
|
||||||
|
SELECT SINGLE viewname FROM dd25l INTO lv_viewname
|
||||||
|
WHERE viewname = zcl_abapgit_persistence_db=>c_lock.
|
||||||
|
rv_exists = boolc( sy-subrc = 0 ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD migrate_settings.
|
||||||
|
|
||||||
|
DATA: lr_settings TYPE REF TO zcl_abapgit_settings.
|
||||||
|
DATA: lr_persist_settings TYPE REF TO zcl_abapgit_persist_settings.
|
||||||
|
DATA: lv_critical_tests_as_string TYPE string.
|
||||||
|
DATA: lv_critical_tests_as_boolean TYPE abap_bool.
|
||||||
|
DATA: lv_max_lines_as_string TYPE string.
|
||||||
|
DATA: lv_flag TYPE abap_bool.
|
||||||
|
DATA: lv_max_lines_as_integer TYPE i.
|
||||||
|
DATA: lv_s_param_value TYPE string.
|
||||||
|
DATA: lv_i_param_value TYPE i.
|
||||||
|
DATA: lv_adt_jump_enabled_as_string TYPE string.
|
||||||
|
DATA: lv_adt_jump_enabled_as_boolean TYPE abap_bool.
|
||||||
|
|
||||||
|
|
||||||
|
lr_persist_settings = zcl_abapgit_persist_settings=>get_instance( ).
|
||||||
|
|
||||||
|
CREATE OBJECT lr_settings.
|
||||||
|
lr_settings->set_defaults( ).
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lr_settings->set_proxy_url(
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'PROXY_URL' ) ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lr_settings->set_proxy_port(
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'PROXY_PORT' ) ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_flag = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'PROXY_AUTH' ).
|
||||||
|
lr_settings->set_proxy_authentication( lv_flag ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_critical_tests_as_string = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'CRIT_TESTS' ).
|
||||||
|
lv_critical_tests_as_boolean = lv_critical_tests_as_string.
|
||||||
|
lr_settings->set_run_critical_tests( lv_critical_tests_as_boolean ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_max_lines_as_string = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'MAX_LINES' ).
|
||||||
|
lv_max_lines_as_integer = lv_max_lines_as_string.
|
||||||
|
lr_settings->set_max_lines( lv_max_lines_as_integer ).
|
||||||
|
CATCH zcx_abapgit_not_found cx_sy_conversion_no_number.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_adt_jump_enabled_as_string = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'ADT_JUMP' ).
|
||||||
|
lv_adt_jump_enabled_as_boolean = lv_adt_jump_enabled_as_string.
|
||||||
|
lr_settings->set_adt_jump_enanbled( lv_adt_jump_enabled_as_boolean ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_s_param_value = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'COMMENT_LEN' ).
|
||||||
|
lv_i_param_value = lv_s_param_value.
|
||||||
|
lr_settings->set_commitmsg_comment_length( lv_i_param_value ).
|
||||||
|
CATCH zcx_abapgit_not_found cx_sy_conversion_no_number.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_s_param_value = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'BODY_SIZE' ).
|
||||||
|
lv_i_param_value = lv_s_param_value.
|
||||||
|
lr_settings->set_commitmsg_body_size( lv_i_param_value ).
|
||||||
|
CATCH zcx_abapgit_not_found cx_sy_conversion_no_number.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
lr_persist_settings->modify( io_settings = lr_settings ).
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'PROXY_URL' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'PROXY_PORT' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'PROXY_AUTH' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'CRIT_TESTS' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'MAX_LINES' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'ADT_JUMP' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'COMMENT_LEN' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = 'BODY_SIZE' ).
|
||||||
|
CATCH zcx_abapgit_exception.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD run.
|
||||||
|
|
||||||
|
IF table_exists( ) = abap_false.
|
||||||
|
table_create( ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF lock_exists( ) = abap_false.
|
||||||
|
lock_create( ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
IF settings_exists( ) = abap_false.
|
||||||
|
migrate_settings( ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD settings_exists.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = 'SETTINGS'
|
||||||
|
iv_value = '' ).
|
||||||
|
rv_exists = abap_true.
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
rv_exists = abap_false.
|
||||||
|
ENDTRY.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD table_create.
|
||||||
|
|
||||||
|
DATA: lv_rc LIKE sy-subrc,
|
||||||
|
lv_obj_name TYPE tadir-obj_name,
|
||||||
|
ls_dd02v TYPE dd02v,
|
||||||
|
ls_dd09l TYPE dd09l,
|
||||||
|
lt_dd03p TYPE STANDARD TABLE OF dd03p WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_dd03p> LIKE LINE OF lt_dd03p.
|
||||||
|
|
||||||
|
ls_dd02v-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
ls_dd02v-ddlanguage = zif_abapgit_definitions=>gc_english.
|
||||||
|
ls_dd02v-tabclass = 'TRANSP'.
|
||||||
|
ls_dd02v-ddtext = c_text.
|
||||||
|
ls_dd02v-contflag = 'A'.
|
||||||
|
ls_dd02v-exclass = '1'.
|
||||||
|
|
||||||
|
ls_dd09l-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
ls_dd09l-as4local = 'A'.
|
||||||
|
ls_dd09l-tabkat = '1'.
|
||||||
|
ls_dd09l-tabart = 'APPL1'.
|
||||||
|
ls_dd09l-bufallow = 'N'.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_dd03p ASSIGNING <ls_dd03p>.
|
||||||
|
<ls_dd03p>-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd03p>-fieldname = 'TYPE'.
|
||||||
|
<ls_dd03p>-position = '0001'.
|
||||||
|
<ls_dd03p>-keyflag = 'X'.
|
||||||
|
<ls_dd03p>-datatype = 'CHAR'.
|
||||||
|
<ls_dd03p>-leng = '000012'.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_dd03p ASSIGNING <ls_dd03p>.
|
||||||
|
<ls_dd03p>-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd03p>-fieldname = 'VALUE'.
|
||||||
|
<ls_dd03p>-position = '0002'.
|
||||||
|
<ls_dd03p>-keyflag = 'X'.
|
||||||
|
<ls_dd03p>-datatype = 'CHAR'.
|
||||||
|
<ls_dd03p>-leng = '000012'.
|
||||||
|
|
||||||
|
APPEND INITIAL LINE TO lt_dd03p ASSIGNING <ls_dd03p>.
|
||||||
|
<ls_dd03p>-tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
<ls_dd03p>-fieldname = 'DATA_STR'.
|
||||||
|
<ls_dd03p>-position = '0003'.
|
||||||
|
<ls_dd03p>-datatype = 'STRG'.
|
||||||
|
|
||||||
|
CALL FUNCTION 'DDIF_TABL_PUT'
|
||||||
|
EXPORTING
|
||||||
|
name = zcl_abapgit_persistence_db=>c_tabname
|
||||||
|
dd02v_wa = ls_dd02v
|
||||||
|
dd09l_wa = ls_dd09l
|
||||||
|
TABLES
|
||||||
|
dd03p_tab = lt_dd03p
|
||||||
|
EXCEPTIONS
|
||||||
|
tabl_not_found = 1
|
||||||
|
name_inconsistent = 2
|
||||||
|
tabl_inconsistent = 3
|
||||||
|
put_failure = 4
|
||||||
|
put_refused = 5
|
||||||
|
OTHERS = 6.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'migrate, error from DDIF_TABL_PUT' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
lv_obj_name = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
CALL FUNCTION 'TR_TADIR_INTERFACE'
|
||||||
|
EXPORTING
|
||||||
|
wi_tadir_pgmid = 'R3TR'
|
||||||
|
wi_tadir_object = 'TABL'
|
||||||
|
wi_tadir_obj_name = lv_obj_name
|
||||||
|
wi_set_genflag = abap_true
|
||||||
|
wi_test_modus = abap_false
|
||||||
|
wi_tadir_devclass = '$TMP'
|
||||||
|
EXCEPTIONS
|
||||||
|
OTHERS = 1.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'migrate, error from TR_TADIR_INTERFACE' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
CALL FUNCTION 'DDIF_TABL_ACTIVATE'
|
||||||
|
EXPORTING
|
||||||
|
name = zcl_abapgit_persistence_db=>c_tabname
|
||||||
|
auth_chk = abap_false
|
||||||
|
IMPORTING
|
||||||
|
rc = lv_rc
|
||||||
|
EXCEPTIONS
|
||||||
|
not_found = 1
|
||||||
|
put_failure = 2
|
||||||
|
OTHERS = 3.
|
||||||
|
IF sy-subrc <> 0 OR lv_rc <> 0.
|
||||||
|
zcx_abapgit_exception=>raise( 'migrate, error from DDIF_TABL_ACTIVATE' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD table_exists.
|
||||||
|
|
||||||
|
DATA: lv_tabname TYPE dd02l-tabname.
|
||||||
|
|
||||||
|
SELECT SINGLE tabname FROM dd02l INTO lv_tabname
|
||||||
|
WHERE tabname = zcl_abapgit_persistence_db=>c_tabname.
|
||||||
|
rv_exists = boolc( sy-subrc = 0 ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
18
src/persist/zcl_abapgit_persist_migrate.clas.xml
Normal file
18
src/persist/zcl_abapgit_persist_migrate.clas.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSIST_MIGRATE</CLSNAME>
|
||||||
|
<VERSION>1</VERSION>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Migration</DESCRIPT>
|
||||||
|
<EXPOSURE>2</EXPOSURE>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
84
src/persist/zcl_abapgit_persist_settings.clas.abap
Normal file
84
src/persist/zcl_abapgit_persist_settings.clas.abap
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
CLASS zcl_abapgit_persist_settings DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
CREATE PRIVATE .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
METHODS modify
|
||||||
|
IMPORTING
|
||||||
|
!io_settings TYPE REF TO zcl_abapgit_settings
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS read
|
||||||
|
RETURNING
|
||||||
|
VALUE(ro_settings) TYPE REF TO zcl_abapgit_settings .
|
||||||
|
CLASS-METHODS get_instance
|
||||||
|
RETURNING
|
||||||
|
VALUE(ro_settings) TYPE REF TO zcl_abapgit_persist_settings .
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
DATA mo_settings TYPE REF TO zcl_abapgit_settings .
|
||||||
|
CLASS-DATA go_persist TYPE REF TO zcl_abapgit_persist_settings .
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_ABAPGIT_PERSIST_SETTINGS IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_instance.
|
||||||
|
|
||||||
|
IF go_persist IS NOT BOUND.
|
||||||
|
CREATE OBJECT go_persist.
|
||||||
|
ENDIF.
|
||||||
|
ro_settings = go_persist.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD modify.
|
||||||
|
|
||||||
|
DATA: settings TYPE string.
|
||||||
|
settings = io_settings->get_settings_xml( ).
|
||||||
|
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->modify(
|
||||||
|
iv_type = zcl_abapgit_persistence_db=>c_type_settings
|
||||||
|
iv_value = ''
|
||||||
|
iv_data = settings ).
|
||||||
|
|
||||||
|
" Settings have been modified: Update Buffered Settings
|
||||||
|
IF mo_settings IS BOUND.
|
||||||
|
mo_settings->set_xml_settings( settings ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD read.
|
||||||
|
|
||||||
|
IF mo_settings IS BOUND.
|
||||||
|
" Return Buffered Settings
|
||||||
|
ro_settings = mo_settings.
|
||||||
|
RETURN.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
" Settings have changed or have not yet been loaded
|
||||||
|
CREATE OBJECT ro_settings.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
|
||||||
|
ro_settings->set_xml_settings(
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = zcl_abapgit_persistence_db=>c_type_settings
|
||||||
|
iv_value = '' ) ).
|
||||||
|
|
||||||
|
CATCH zcx_abapgit_not_found zcx_abapgit_exception.
|
||||||
|
|
||||||
|
ro_settings->set_defaults( ).
|
||||||
|
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
mo_settings = ro_settings.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
25
src/persist/zcl_abapgit_persist_settings.clas.xml
Normal file
25
src/persist/zcl_abapgit_persist_settings.clas.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSIST_SETTINGS</CLSNAME>
|
||||||
|
<VERSION>1</VERSION>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Settings</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
<DESCRIPTIONS>
|
||||||
|
<SEOCOMPOTX>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSIST_SETTINGS</CLSNAME>
|
||||||
|
<CMPNAME>GO_PERSIST</CMPNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Settings</DESCRIPT>
|
||||||
|
</SEOCOMPOTX>
|
||||||
|
</DESCRIPTIONS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
|
@ -1,70 +1,93 @@
|
||||||
CLASS zcl_abapgit_persistence_db DEFINITION
|
CLASS zcl_abapgit_persistence_db DEFINITION
|
||||||
PUBLIC
|
PUBLIC
|
||||||
CREATE PUBLIC .
|
CREATE PRIVATE .
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
CONSTANTS:
|
|
||||||
c_tabname TYPE tabname VALUE 'ZABAPGIT',
|
|
||||||
c_lock TYPE viewname VALUE 'EZABAPGIT'.
|
|
||||||
|
|
||||||
TYPES: ty_type TYPE c LENGTH 12.
|
TYPES:
|
||||||
TYPES: ty_value TYPE c LENGTH 12.
|
ty_type TYPE c LENGTH 12 .
|
||||||
|
TYPES:
|
||||||
|
ty_value TYPE c LENGTH 12 .
|
||||||
|
TYPES:
|
||||||
|
BEGIN OF ty_content,
|
||||||
|
type TYPE ty_type,
|
||||||
|
value TYPE ty_value,
|
||||||
|
data_str TYPE string,
|
||||||
|
END OF ty_content .
|
||||||
|
TYPES:
|
||||||
|
tt_content TYPE SORTED TABLE OF ty_content WITH UNIQUE KEY type value .
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_content,
|
CONSTANTS c_tabname TYPE tabname VALUE 'ZABAPGIT' ##NO_TEXT.
|
||||||
type TYPE ty_type,
|
CONSTANTS c_lock TYPE viewname VALUE 'EZABAPGIT' ##NO_TEXT.
|
||||||
value TYPE ty_value,
|
CONSTANTS c_type_settings TYPE ty_type VALUE 'SETTINGS' ##NO_TEXT.
|
||||||
data_str TYPE string,
|
CONSTANTS c_type_repo TYPE ty_type VALUE 'REPO' ##NO_TEXT.
|
||||||
END OF ty_content,
|
CONSTANTS c_type_background TYPE ty_type VALUE 'BACKGROUND' ##NO_TEXT.
|
||||||
tt_content TYPE SORTED TABLE OF ty_content WITH UNIQUE KEY type value.
|
CONSTANTS c_type_user TYPE ty_type VALUE 'USER' ##NO_TEXT.
|
||||||
|
|
||||||
CONSTANTS:
|
|
||||||
c_type_settings TYPE ty_type VALUE 'SETTINGS',
|
|
||||||
c_type_repo TYPE ty_type VALUE 'REPO',
|
|
||||||
c_type_background TYPE ty_type VALUE 'BACKGROUND',
|
|
||||||
c_type_user TYPE ty_type VALUE 'USER'.
|
|
||||||
|
|
||||||
METHODS:
|
|
||||||
list_by_type
|
|
||||||
IMPORTING iv_type TYPE ty_type
|
|
||||||
RETURNING VALUE(rt_content) TYPE tt_content,
|
|
||||||
list
|
|
||||||
RETURNING VALUE(rt_content) TYPE tt_content,
|
|
||||||
add
|
|
||||||
IMPORTING iv_type TYPE ty_type
|
|
||||||
iv_value TYPE ty_content-value
|
|
||||||
iv_data TYPE ty_content-data_str
|
|
||||||
RAISING zcx_abapgit_exception,
|
|
||||||
delete
|
|
||||||
IMPORTING iv_type TYPE ty_type
|
|
||||||
iv_value TYPE ty_content-value
|
|
||||||
RAISING zcx_abapgit_exception,
|
|
||||||
update
|
|
||||||
IMPORTING iv_type TYPE ty_type
|
|
||||||
iv_value TYPE ty_content-value
|
|
||||||
iv_data TYPE ty_content-data_str
|
|
||||||
RAISING zcx_abapgit_exception,
|
|
||||||
modify
|
|
||||||
IMPORTING iv_type TYPE ty_type
|
|
||||||
iv_value TYPE ty_content-value
|
|
||||||
iv_data TYPE ty_content-data_str
|
|
||||||
RAISING zcx_abapgit_exception,
|
|
||||||
read
|
|
||||||
IMPORTING iv_type TYPE ty_type
|
|
||||||
iv_value TYPE ty_content-value
|
|
||||||
RETURNING VALUE(rv_data) TYPE ty_content-data_str
|
|
||||||
RAISING zcx_abapgit_not_found,
|
|
||||||
lock
|
|
||||||
IMPORTING iv_mode TYPE enqmode DEFAULT 'E'
|
|
||||||
iv_type TYPE ty_type
|
|
||||||
iv_value TYPE ty_content-value
|
|
||||||
RAISING zcx_abapgit_exception.
|
|
||||||
|
|
||||||
|
CLASS-METHODS get_instance
|
||||||
|
RETURNING
|
||||||
|
VALUE(ro_db) TYPE REF TO zcl_abapgit_persistence_db .
|
||||||
|
METHODS add
|
||||||
|
IMPORTING
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
!iv_value TYPE ty_content-value
|
||||||
|
!iv_data TYPE ty_content-data_str
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS delete
|
||||||
|
IMPORTING
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
!iv_value TYPE ty_content-value
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS list
|
||||||
|
RETURNING
|
||||||
|
VALUE(rt_content) TYPE tt_content .
|
||||||
|
METHODS list_by_type
|
||||||
|
IMPORTING
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
RETURNING
|
||||||
|
VALUE(rt_content) TYPE tt_content .
|
||||||
|
METHODS lock
|
||||||
|
IMPORTING
|
||||||
|
!iv_mode TYPE enqmode DEFAULT 'E'
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
!iv_value TYPE ty_content-value
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS modify
|
||||||
|
IMPORTING
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
!iv_value TYPE ty_content-value
|
||||||
|
!iv_data TYPE ty_content-data_str
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS read
|
||||||
|
IMPORTING
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
!iv_value TYPE ty_content-value
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_data) TYPE ty_content-data_str
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_not_found .
|
||||||
|
METHODS update
|
||||||
|
IMPORTING
|
||||||
|
!iv_type TYPE ty_type
|
||||||
|
!iv_value TYPE ty_content-value
|
||||||
|
!iv_data TYPE ty_content-data_str
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
METHODS: validate_and_unprettify_xml
|
|
||||||
IMPORTING iv_xml TYPE string
|
|
||||||
RETURNING VALUE(rv_xml) TYPE string
|
|
||||||
RAISING zcx_abapgit_exception.
|
|
||||||
|
|
||||||
|
CLASS-DATA mo_db TYPE REF TO zcl_abapgit_persistence_db .
|
||||||
|
|
||||||
|
METHODS validate_and_unprettify_xml
|
||||||
|
IMPORTING
|
||||||
|
!iv_xml TYPE string
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_xml) TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,8 +97,6 @@ CLASS ZCL_ABAPGIT_PERSISTENCE_DB IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD add.
|
METHOD add.
|
||||||
|
|
||||||
* todo, change instantiation back to private? make sure this class is a singleton?
|
|
||||||
|
|
||||||
DATA ls_table TYPE ty_content.
|
DATA ls_table TYPE ty_content.
|
||||||
|
|
||||||
ls_table-type = iv_type.
|
ls_table-type = iv_type.
|
||||||
|
@ -103,6 +124,16 @@ CLASS ZCL_ABAPGIT_PERSISTENCE_DB IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_instance.
|
||||||
|
|
||||||
|
IF mo_db IS NOT BOUND.
|
||||||
|
CREATE OBJECT mo_db.
|
||||||
|
ENDIF.
|
||||||
|
ro_db = mo_db.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD list.
|
METHOD list.
|
||||||
SELECT * FROM (c_tabname)
|
SELECT * FROM (c_tabname)
|
||||||
INTO TABLE rt_content. "#EC CI_SUBRC
|
INTO TABLE rt_content. "#EC CI_SUBRC
|
||||||
|
|
|
@ -7,12 +7,19 @@
|
||||||
<VERSION>1</VERSION>
|
<VERSION>1</VERSION>
|
||||||
<LANGU>E</LANGU>
|
<LANGU>E</LANGU>
|
||||||
<DESCRIPT>Database persistence</DESCRIPT>
|
<DESCRIPT>Database persistence</DESCRIPT>
|
||||||
<EXPOSURE>2</EXPOSURE>
|
|
||||||
<STATE>1</STATE>
|
<STATE>1</STATE>
|
||||||
<CLSCCINCL>X</CLSCCINCL>
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
<FIXPT>X</FIXPT>
|
<FIXPT>X</FIXPT>
|
||||||
<UNICODE>X</UNICODE>
|
<UNICODE>X</UNICODE>
|
||||||
</VSEOCLASS>
|
</VSEOCLASS>
|
||||||
|
<DESCRIPTIONS>
|
||||||
|
<SEOCOMPOTX>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSISTENCE_DB</CLSNAME>
|
||||||
|
<CMPNAME>MO_DB</CMPNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Database persistence</DESCRIPT>
|
||||||
|
</SEOCOMPOTX>
|
||||||
|
</DESCRIPTIONS>
|
||||||
</asx:values>
|
</asx:values>
|
||||||
</asx:abap>
|
</asx:abap>
|
||||||
</abapGit>
|
</abapGit>
|
||||||
|
|
444
src/persist/zcl_abapgit_persistence_repo.clas.abap
Normal file
444
src/persist/zcl_abapgit_persistence_repo.clas.abap
Normal file
|
@ -0,0 +1,444 @@
|
||||||
|
CLASS zcl_abapgit_persistence_repo DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
CREATE PUBLIC .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
TYPES: BEGIN OF ty_local_checksum,
|
||||||
|
item TYPE zif_abapgit_definitions=>ty_item,
|
||||||
|
files TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
||||||
|
END OF ty_local_checksum.
|
||||||
|
|
||||||
|
TYPES: ty_local_checksum_tt TYPE STANDARD TABLE OF ty_local_checksum WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF ty_repo_xml,
|
||||||
|
url TYPE string,
|
||||||
|
branch_name TYPE string,
|
||||||
|
sha1 TYPE zif_abapgit_definitions=>ty_sha1,
|
||||||
|
package TYPE devclass,
|
||||||
|
offline TYPE sap_bool,
|
||||||
|
local_checksums TYPE ty_local_checksum_tt,
|
||||||
|
dot_abapgit TYPE zcl_abapgit_dot_abapgit=>ty_dot_abapgit,
|
||||||
|
head_branch TYPE string, " HEAD symref of the repo, master branch
|
||||||
|
write_protect TYPE sap_bool, " Deny destructive ops: pull, switch branch ...
|
||||||
|
ignore_subpackages TYPE sap_bool,
|
||||||
|
END OF ty_repo_xml.
|
||||||
|
|
||||||
|
TYPES: BEGIN OF ty_repo,
|
||||||
|
key TYPE zcl_abapgit_persistence_db=>ty_value.
|
||||||
|
INCLUDE TYPE ty_repo_xml.
|
||||||
|
TYPES: END OF ty_repo.
|
||||||
|
TYPES: tt_repo TYPE STANDARD TABLE OF ty_repo WITH DEFAULT KEY.
|
||||||
|
TYPES: tt_repo_keys TYPE STANDARD TABLE OF ty_repo-key WITH DEFAULT KEY.
|
||||||
|
|
||||||
|
METHODS constructor.
|
||||||
|
|
||||||
|
METHODS list
|
||||||
|
RETURNING VALUE(rt_repos) TYPE tt_repo
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_sha1
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
iv_branch_sha1 TYPE ty_repo_xml-sha1
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_local_checksums
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
it_checksums TYPE ty_repo_xml-local_checksums
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_url
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
iv_url TYPE ty_repo_xml-url
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_branch_name
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
iv_branch_name TYPE ty_repo_xml-branch_name
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_head_branch
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
iv_head_branch TYPE ty_repo_xml-head_branch
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_offline
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
iv_offline TYPE ty_repo_xml-offline
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS update_dot_abapgit
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
is_dot_abapgit TYPE zcl_abapgit_dot_abapgit=>ty_dot_abapgit
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS add
|
||||||
|
IMPORTING iv_url TYPE string
|
||||||
|
iv_branch_name TYPE string
|
||||||
|
iv_branch TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL
|
||||||
|
iv_package TYPE devclass
|
||||||
|
iv_offline TYPE sap_bool DEFAULT abap_false
|
||||||
|
is_dot_abapgit TYPE zcl_abapgit_dot_abapgit=>ty_dot_abapgit
|
||||||
|
RETURNING VALUE(rv_key) TYPE ty_repo-key
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS delete
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS read
|
||||||
|
IMPORTING iv_key TYPE ty_repo-key
|
||||||
|
RETURNING VALUE(rs_repo) TYPE ty_repo
|
||||||
|
RAISING zcx_abapgit_exception
|
||||||
|
zcx_abapgit_not_found.
|
||||||
|
|
||||||
|
METHODS lock
|
||||||
|
IMPORTING iv_mode TYPE enqmode
|
||||||
|
iv_key TYPE ty_repo-key
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
PRIVATE SECTION.
|
||||||
|
DATA: mo_db TYPE REF TO zcl_abapgit_persistence_db.
|
||||||
|
|
||||||
|
METHODS from_xml
|
||||||
|
IMPORTING iv_repo_xml_string TYPE string
|
||||||
|
RETURNING VALUE(rs_repo) TYPE ty_repo_xml
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
METHODS to_xml
|
||||||
|
IMPORTING is_repo TYPE ty_repo
|
||||||
|
RETURNING VALUE(rv_repo_xml_string) TYPE string.
|
||||||
|
|
||||||
|
METHODS get_next_id
|
||||||
|
RETURNING VALUE(rv_next_repo_id) TYPE zcl_abapgit_persistence_db=>ty_content-value
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_ABAPGIT_PERSISTENCE_REPO IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD add.
|
||||||
|
|
||||||
|
DATA: ls_repo TYPE ty_repo,
|
||||||
|
lv_repo_as_xml TYPE string.
|
||||||
|
|
||||||
|
|
||||||
|
ls_repo-url = iv_url.
|
||||||
|
ls_repo-branch_name = iv_branch_name.
|
||||||
|
ls_repo-sha1 = iv_branch.
|
||||||
|
ls_repo-package = iv_package.
|
||||||
|
ls_repo-offline = iv_offline.
|
||||||
|
ls_repo-dot_abapgit = is_dot_abapgit.
|
||||||
|
|
||||||
|
lv_repo_as_xml = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
rv_key = get_next_id( ).
|
||||||
|
|
||||||
|
mo_db->add( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = rv_key
|
||||||
|
iv_data = lv_repo_as_xml ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mo_db = zcl_abapgit_persistence_db=>get_instance( ).
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD delete.
|
||||||
|
|
||||||
|
DATA: lo_background TYPE REF TO zcl_abapgit_persist_background.
|
||||||
|
|
||||||
|
CREATE OBJECT lo_background.
|
||||||
|
lo_background->delete( iv_key ).
|
||||||
|
|
||||||
|
mo_db->delete( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD from_xml.
|
||||||
|
|
||||||
|
DATA: lv_xml TYPE string.
|
||||||
|
|
||||||
|
lv_xml = iv_repo_xml_string.
|
||||||
|
|
||||||
|
* fix downward compatibility
|
||||||
|
REPLACE ALL OCCURRENCES OF '<_--28C_TYPE_REPO_--29>' IN lv_xml WITH '<REPO>'.
|
||||||
|
REPLACE ALL OCCURRENCES OF '</_--28C_TYPE_REPO_--29>' IN lv_xml WITH '</REPO>'.
|
||||||
|
|
||||||
|
CALL TRANSFORMATION id
|
||||||
|
OPTIONS value_handling = 'accept_data_loss'
|
||||||
|
SOURCE XML lv_xml
|
||||||
|
RESULT repo = rs_repo ##NO_TEXT.
|
||||||
|
|
||||||
|
IF rs_repo IS INITIAL.
|
||||||
|
zcx_abapgit_exception=>raise( 'Inconsistent repo metadata' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD get_next_id.
|
||||||
|
|
||||||
|
* todo: Lock the complete persistence in order to prevent concurrent repo-creation
|
||||||
|
* however the current approach will most likely work in almost all cases
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_content> LIKE LINE OF lt_content.
|
||||||
|
|
||||||
|
|
||||||
|
rv_next_repo_id = 1.
|
||||||
|
|
||||||
|
lt_content = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_repo ).
|
||||||
|
LOOP AT lt_content ASSIGNING <ls_content>.
|
||||||
|
IF <ls_content>-value >= rv_next_repo_id.
|
||||||
|
rv_next_repo_id = <ls_content>-value + 1.
|
||||||
|
ENDIF.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
|
||||||
|
EXPORTING
|
||||||
|
input = rv_next_repo_id
|
||||||
|
IMPORTING
|
||||||
|
output = rv_next_repo_id.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD list.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo LIKE LINE OF rt_repos.
|
||||||
|
|
||||||
|
|
||||||
|
lt_content = mo_db->list_by_type( zcl_abapgit_persistence_db=>c_type_repo ).
|
||||||
|
|
||||||
|
LOOP AT lt_content INTO ls_content.
|
||||||
|
MOVE-CORRESPONDING from_xml( ls_content-data_str ) TO ls_repo.
|
||||||
|
ls_repo-key = ls_content-value.
|
||||||
|
INSERT ls_repo INTO TABLE rt_repos.
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD lock.
|
||||||
|
|
||||||
|
mo_db->lock( iv_mode = iv_mode
|
||||||
|
iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD read.
|
||||||
|
|
||||||
|
DATA lt_repo TYPE tt_repo.
|
||||||
|
|
||||||
|
lt_repo = list( ).
|
||||||
|
|
||||||
|
READ TABLE lt_repo INTO rs_repo WITH KEY key = iv_key.
|
||||||
|
IF sy-subrc <> 0.
|
||||||
|
RAISE EXCEPTION TYPE zcx_abapgit_not_found.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD to_xml.
|
||||||
|
|
||||||
|
DATA: ls_xml TYPE ty_repo_xml.
|
||||||
|
|
||||||
|
|
||||||
|
MOVE-CORRESPONDING is_repo TO ls_xml.
|
||||||
|
|
||||||
|
CALL TRANSFORMATION id
|
||||||
|
SOURCE repo = ls_xml
|
||||||
|
RESULT XML rv_repo_xml_string.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_branch_name.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-branch_name = iv_branch_name.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_dot_abapgit.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-dot_abapgit = is_dot_abapgit.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_head_branch.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-head_branch = iv_head_branch.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD. "update_head_branch
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_local_checksums.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-local_checksums = it_checksums.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_offline.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-offline = iv_offline.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD. "update_offline
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_sha1.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-sha1 = iv_branch_sha1.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_url.
|
||||||
|
|
||||||
|
DATA: lt_content TYPE zcl_abapgit_persistence_db=>tt_content,
|
||||||
|
ls_content LIKE LINE OF lt_content,
|
||||||
|
ls_repo TYPE ty_repo.
|
||||||
|
|
||||||
|
|
||||||
|
IF iv_url IS INITIAL.
|
||||||
|
zcx_abapgit_exception=>raise( 'update, url empty' ).
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
ASSERT NOT iv_key IS INITIAL.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
ls_repo = read( iv_key ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
zcx_abapgit_exception=>raise( 'key not found' ).
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
ls_repo-url = iv_url.
|
||||||
|
ls_content-data_str = to_xml( ls_repo ).
|
||||||
|
|
||||||
|
mo_db->update( iv_type = zcl_abapgit_persistence_db=>c_type_repo
|
||||||
|
iv_value = iv_key
|
||||||
|
iv_data = ls_content-data_str ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
ENDCLASS.
|
18
src/persist/zcl_abapgit_persistence_repo.clas.xml
Normal file
18
src/persist/zcl_abapgit_persistence_repo.clas.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSISTENCE_REPO</CLSNAME>
|
||||||
|
<VERSION>1</VERSION>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>Repo persistence</DESCRIPT>
|
||||||
|
<EXPOSURE>2</EXPOSURE>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
554
src/persist/zcl_abapgit_persistence_user.clas.abap
Normal file
554
src/persist/zcl_abapgit_persistence_user.clas.abap
Normal file
|
@ -0,0 +1,554 @@
|
||||||
|
CLASS zcl_abapgit_persistence_user DEFINITION
|
||||||
|
PUBLIC
|
||||||
|
CREATE PRIVATE .
|
||||||
|
|
||||||
|
PUBLIC SECTION.
|
||||||
|
|
||||||
|
TYPES tt_favorites TYPE zcl_abapgit_persistence_repo=>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 zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_email) TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS get_repo_git_user_name
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_username) TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS get_repo_last_change_seen
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_version) TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS get_repo_login
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_login) TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS get_repo_show
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_key) TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS is_favorite_repo
|
||||||
|
IMPORTING
|
||||||
|
!iv_repo_key TYPE zcl_abapgit_persistence_repo=>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 zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
!iv_email TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS set_repo_git_user_name
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
!iv_username TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS set_repo_last_change_seen
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
!iv_version TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS set_repo_login
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
!iv_login TYPE string
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS set_repo_show
|
||||||
|
IMPORTING
|
||||||
|
!iv_key TYPE zcl_abapgit_persistence_repo=>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 zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS toggle_hide_files
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_hide) TYPE abap_bool
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
PRIVATE SECTION.
|
||||||
|
|
||||||
|
TYPES:
|
||||||
|
BEGIN OF ty_repo_config,
|
||||||
|
url TYPE zcl_abapgit_persistence_repo=>ty_repo-url,
|
||||||
|
login TYPE string,
|
||||||
|
git_user TYPE zif_abapgit_definitions=>ty_git_user,
|
||||||
|
last_change_seen TYPE string,
|
||||||
|
END OF ty_repo_config .
|
||||||
|
TYPES:
|
||||||
|
ty_repo_config_tt TYPE STANDARD TABLE OF ty_repo_config WITH DEFAULT KEY .
|
||||||
|
TYPES:
|
||||||
|
BEGIN OF ty_user,
|
||||||
|
default_git_user TYPE zif_abapgit_definitions=>ty_git_user,
|
||||||
|
repo_show TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
|
hide_files TYPE abap_bool,
|
||||||
|
changes_only TYPE abap_bool,
|
||||||
|
diff_unified TYPE abap_bool,
|
||||||
|
favorites TYPE tt_favorites,
|
||||||
|
repo_config TYPE ty_repo_config_tt,
|
||||||
|
END OF ty_user .
|
||||||
|
|
||||||
|
DATA mv_user TYPE xubname .
|
||||||
|
CLASS-DATA go_current_user TYPE REF TO zcl_abapgit_persistence_user .
|
||||||
|
|
||||||
|
METHODS constructor
|
||||||
|
IMPORTING
|
||||||
|
!iv_user TYPE xubname DEFAULT sy-uname .
|
||||||
|
METHODS from_xml
|
||||||
|
IMPORTING
|
||||||
|
!iv_xml TYPE string
|
||||||
|
RETURNING
|
||||||
|
VALUE(rs_user) TYPE ty_user
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS read
|
||||||
|
RETURNING
|
||||||
|
VALUE(rs_user) TYPE ty_user
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS read_repo_config
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
RETURNING
|
||||||
|
VALUE(rs_repo_config) TYPE ty_repo_config
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS to_xml
|
||||||
|
IMPORTING
|
||||||
|
!is_user TYPE ty_user
|
||||||
|
RETURNING
|
||||||
|
VALUE(rv_xml) TYPE string .
|
||||||
|
METHODS update
|
||||||
|
IMPORTING
|
||||||
|
!is_user TYPE ty_user
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
METHODS update_repo_config
|
||||||
|
IMPORTING
|
||||||
|
!iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
|
!is_repo_config TYPE ty_repo_config
|
||||||
|
RAISING
|
||||||
|
zcx_abapgit_exception .
|
||||||
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CLASS ZCL_ABAPGIT_PERSISTENCE_USER IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
mv_user = iv_user.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD from_xml.
|
||||||
|
|
||||||
|
DATA: lv_xml TYPE string.
|
||||||
|
|
||||||
|
lv_xml = iv_xml.
|
||||||
|
|
||||||
|
* fix downward compatibility
|
||||||
|
REPLACE ALL OCCURRENCES OF '<_--28C_TYPE_USER_--29>' IN lv_xml WITH '<USER>'.
|
||||||
|
REPLACE ALL OCCURRENCES OF '</_--28C_TYPE_USER_--29>' IN lv_xml WITH '</USER>'.
|
||||||
|
|
||||||
|
CALL TRANSFORMATION id
|
||||||
|
OPTIONS value_handling = 'accept_data_loss'
|
||||||
|
SOURCE XML lv_xml
|
||||||
|
RESULT user = rs_user ##NO_TEXT.
|
||||||
|
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.
|
||||||
|
ENDIF.
|
||||||
|
ro_user = go_current_user.
|
||||||
|
ELSE.
|
||||||
|
CREATE OBJECT ro_user
|
||||||
|
EXPORTING
|
||||||
|
iv_user = iv_user.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
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 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.
|
||||||
|
|
||||||
|
TRY.
|
||||||
|
lv_xml = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
|
iv_type = zcl_abapgit_persistence_db=>c_type_user
|
||||||
|
iv_value = mv_user ).
|
||||||
|
CATCH zcx_abapgit_not_found.
|
||||||
|
RETURN.
|
||||||
|
ENDTRY.
|
||||||
|
|
||||||
|
rs_user = from_xml( lv_xml ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD read_repo_config.
|
||||||
|
DATA: lt_repo_config TYPE ty_repo_config_tt,
|
||||||
|
lv_key TYPE string.
|
||||||
|
|
||||||
|
lv_key = to_lower( iv_url ).
|
||||||
|
lt_repo_config = read( )-repo_config.
|
||||||
|
READ TABLE lt_repo_config INTO rs_repo_config WITH KEY url = lv_key.
|
||||||
|
|
||||||
|
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 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 ).
|
||||||
|
|
||||||
|
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
|
||||||
|
RESULT XML rv_xml.
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update.
|
||||||
|
|
||||||
|
DATA: lv_xml TYPE string.
|
||||||
|
|
||||||
|
lv_xml = to_xml( is_user ).
|
||||||
|
|
||||||
|
zcl_abapgit_persistence_db=>get_instance( )->modify(
|
||||||
|
iv_type = zcl_abapgit_persistence_db=>c_type_user
|
||||||
|
iv_value = mv_user
|
||||||
|
iv_data = lv_xml ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
METHOD update_repo_config.
|
||||||
|
DATA: ls_user TYPE ty_user,
|
||||||
|
lv_key TYPE string.
|
||||||
|
FIELD-SYMBOLS <repo_config> TYPE ty_repo_config.
|
||||||
|
|
||||||
|
ls_user = read( ).
|
||||||
|
lv_key = to_lower( iv_url ).
|
||||||
|
|
||||||
|
READ TABLE ls_user-repo_config ASSIGNING <repo_config> WITH KEY url = lv_key.
|
||||||
|
IF sy-subrc IS NOT INITIAL.
|
||||||
|
APPEND INITIAL LINE TO ls_user-repo_config ASSIGNING <repo_config>.
|
||||||
|
ENDIF.
|
||||||
|
<repo_config> = is_repo_config.
|
||||||
|
<repo_config>-url = lv_key.
|
||||||
|
|
||||||
|
update( ls_user ).
|
||||||
|
|
||||||
|
COMMIT WORK AND WAIT.
|
||||||
|
|
||||||
|
ENDMETHOD. "update_repo_config
|
||||||
|
ENDCLASS.
|
25
src/persist/zcl_abapgit_persistence_user.clas.xml
Normal file
25
src/persist/zcl_abapgit_persistence_user.clas.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
|
||||||
|
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||||
|
<asx:values>
|
||||||
|
<VSEOCLASS>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSISTENCE_USER</CLSNAME>
|
||||||
|
<VERSION>1</VERSION>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>User persistence</DESCRIPT>
|
||||||
|
<STATE>1</STATE>
|
||||||
|
<CLSCCINCL>X</CLSCCINCL>
|
||||||
|
<FIXPT>X</FIXPT>
|
||||||
|
<UNICODE>X</UNICODE>
|
||||||
|
</VSEOCLASS>
|
||||||
|
<DESCRIPTIONS>
|
||||||
|
<SEOCOMPOTX>
|
||||||
|
<CLSNAME>ZCL_ABAPGIT_PERSISTENCE_USER</CLSNAME>
|
||||||
|
<CMPNAME>GO_CURRENT_USER</CMPNAME>
|
||||||
|
<LANGU>E</LANGU>
|
||||||
|
<DESCRIPT>User persistence</DESCRIPT>
|
||||||
|
</SEOCOMPOTX>
|
||||||
|
</DESCRIPTIONS>
|
||||||
|
</asx:values>
|
||||||
|
</asx:abap>
|
||||||
|
</abapGit>
|
|
@ -570,7 +570,7 @@ CLASS lcl_2fa_github_auth IMPLEMENTATION.
|
||||||
|
|
||||||
" Try to login to GitHub API with username, password and 2fa token
|
" Try to login to GitHub API with username, password and 2fa token
|
||||||
|
|
||||||
lo_settings = lcl_app=>settings( )->read( ).
|
lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ).
|
||||||
|
|
||||||
cl_http_client=>create_by_url(
|
cl_http_client=>create_by_url(
|
||||||
EXPORTING
|
EXPORTING
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
*&---------------------------------------------------------------------*
|
*&---------------------------------------------------------------------*
|
||||||
|
|
||||||
CLASS lcl_gui DEFINITION DEFERRED.
|
CLASS lcl_gui DEFINITION DEFERRED.
|
||||||
CLASS lcl_persistence_user DEFINITION DEFERRED.
|
|
||||||
CLASS lcl_repo_srv DEFINITION DEFERRED.
|
CLASS lcl_repo_srv DEFINITION DEFERRED.
|
||||||
CLASS lcl_persist_settings DEFINITION DEFERRED.
|
|
||||||
CLASS lcl_proxy_configuration DEFINITION DEFERRED.
|
CLASS lcl_proxy_configuration DEFINITION DEFERRED.
|
||||||
|
|
||||||
*----------------------------------------------------------------------*
|
*----------------------------------------------------------------------*
|
||||||
|
@ -18,29 +16,15 @@ CLASS lcl_app DEFINITION FINAL.
|
||||||
RETURNING VALUE(ro_gui) TYPE REF TO lcl_gui
|
RETURNING VALUE(ro_gui) TYPE REF TO lcl_gui
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
CLASS-METHODS user
|
|
||||||
IMPORTING iv_user TYPE xubname DEFAULT sy-uname
|
|
||||||
RETURNING VALUE(ro_user) TYPE REF TO lcl_persistence_user
|
|
||||||
RAISING zcx_abapgit_exception.
|
|
||||||
|
|
||||||
CLASS-METHODS repo_srv
|
CLASS-METHODS repo_srv
|
||||||
RETURNING VALUE(ro_repo_srv) TYPE REF TO lcl_repo_srv.
|
RETURNING VALUE(ro_repo_srv) TYPE REF TO lcl_repo_srv.
|
||||||
|
|
||||||
CLASS-METHODS db
|
|
||||||
RETURNING VALUE(ro_db) TYPE REF TO zcl_abapgit_persistence_db.
|
|
||||||
|
|
||||||
CLASS-METHODS settings
|
|
||||||
RETURNING VALUE(ro_settings) TYPE REF TO lcl_persist_settings.
|
|
||||||
|
|
||||||
CLASS-METHODS proxy
|
CLASS-METHODS proxy
|
||||||
RETURNING VALUE(ro_proxy) TYPE REF TO lcl_proxy_configuration.
|
RETURNING VALUE(ro_proxy) TYPE REF TO lcl_proxy_configuration.
|
||||||
|
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
CLASS-DATA: go_gui TYPE REF TO lcl_gui,
|
CLASS-DATA: go_gui TYPE REF TO lcl_gui,
|
||||||
go_current_user TYPE REF TO lcl_persistence_user,
|
|
||||||
go_db TYPE REF TO zcl_abapgit_persistence_db,
|
|
||||||
go_repo_srv TYPE REF TO lcl_repo_srv,
|
go_repo_srv TYPE REF TO lcl_repo_srv,
|
||||||
go_settings TYPE REF TO lcl_persist_settings,
|
|
||||||
go_proxy TYPE REF TO lcl_proxy_configuration.
|
go_proxy TYPE REF TO lcl_proxy_configuration.
|
||||||
|
|
||||||
ENDCLASS. "lcl_app
|
ENDCLASS. "lcl_app
|
||||||
|
|
|
@ -16,21 +16,6 @@ CLASS lcl_app IMPLEMENTATION.
|
||||||
|
|
||||||
ENDMETHOD. "gui
|
ENDMETHOD. "gui
|
||||||
|
|
||||||
METHOD user.
|
|
||||||
|
|
||||||
IF iv_user = sy-uname ##USER_OK.
|
|
||||||
IF go_current_user IS NOT BOUND.
|
|
||||||
CREATE OBJECT go_current_user.
|
|
||||||
ENDIF.
|
|
||||||
ro_user = go_current_user.
|
|
||||||
ELSE.
|
|
||||||
CREATE OBJECT ro_user
|
|
||||||
EXPORTING
|
|
||||||
iv_user = iv_user.
|
|
||||||
ENDIF.
|
|
||||||
|
|
||||||
ENDMETHOD. "user
|
|
||||||
|
|
||||||
METHOD repo_srv.
|
METHOD repo_srv.
|
||||||
|
|
||||||
IF go_repo_srv IS NOT BOUND.
|
IF go_repo_srv IS NOT BOUND.
|
||||||
|
@ -40,22 +25,6 @@ CLASS lcl_app IMPLEMENTATION.
|
||||||
|
|
||||||
ENDMETHOD. "repo_srv
|
ENDMETHOD. "repo_srv
|
||||||
|
|
||||||
METHOD db.
|
|
||||||
|
|
||||||
IF go_db IS NOT BOUND.
|
|
||||||
CREATE OBJECT go_db.
|
|
||||||
ENDIF.
|
|
||||||
ro_db = go_db.
|
|
||||||
|
|
||||||
ENDMETHOD. "repo_srv
|
|
||||||
|
|
||||||
METHOD settings.
|
|
||||||
IF go_settings IS NOT BOUND.
|
|
||||||
CREATE OBJECT go_settings.
|
|
||||||
ENDIF.
|
|
||||||
ro_settings = go_settings.
|
|
||||||
ENDMETHOD.
|
|
||||||
|
|
||||||
METHOD proxy.
|
METHOD proxy.
|
||||||
IF go_proxy IS NOT BOUND.
|
IF go_proxy IS NOT BOUND.
|
||||||
CREATE OBJECT go_proxy.
|
CREATE OBJECT go_proxy.
|
||||||
|
|
|
@ -16,11 +16,11 @@ CLASS lcl_background DEFINITION FINAL.
|
||||||
RETURNING VALUE(rv_comment) TYPE string,
|
RETURNING VALUE(rv_comment) TYPE string,
|
||||||
push
|
push
|
||||||
IMPORTING io_repo TYPE REF TO lcl_repo_online
|
IMPORTING io_repo TYPE REF TO lcl_repo_online
|
||||||
is_settings TYPE lcl_persist_background=>ty_background
|
is_settings TYPE zcl_abapgit_persist_background=>ty_background
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
push_fixed
|
push_fixed
|
||||||
IMPORTING io_repo TYPE REF TO lcl_repo_online
|
IMPORTING io_repo TYPE REF TO lcl_repo_online
|
||||||
is_settings TYPE lcl_persist_background=>ty_background
|
is_settings TYPE zcl_abapgit_persist_background=>ty_background
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
push_auto
|
push_auto
|
||||||
IMPORTING io_repo TYPE REF TO lcl_repo_online
|
IMPORTING io_repo TYPE REF TO lcl_repo_online
|
||||||
|
@ -38,10 +38,10 @@ CLASS lcl_background IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
CASE is_settings-amethod.
|
CASE is_settings-amethod.
|
||||||
WHEN lcl_persist_background=>c_amethod-fixed.
|
WHEN zcl_abapgit_persist_background=>c_amethod-fixed.
|
||||||
push_fixed( io_repo = io_repo
|
push_fixed( io_repo = io_repo
|
||||||
is_settings = is_settings ).
|
is_settings = is_settings ).
|
||||||
WHEN lcl_persist_background=>c_amethod-auto.
|
WHEN zcl_abapgit_persist_background=>c_amethod-auto.
|
||||||
push_auto( io_repo ).
|
push_auto( io_repo ).
|
||||||
WHEN OTHERS.
|
WHEN OTHERS.
|
||||||
zcx_abapgit_exception=>raise( 'unknown push method' ).
|
zcx_abapgit_exception=>raise( 'unknown push method' ).
|
||||||
|
@ -189,9 +189,9 @@ CLASS lcl_background IMPLEMENTATION.
|
||||||
|
|
||||||
CONSTANTS: c_enq_type TYPE c LENGTH 12 VALUE 'BACKGROUND'.
|
CONSTANTS: c_enq_type TYPE c LENGTH 12 VALUE 'BACKGROUND'.
|
||||||
|
|
||||||
DATA: lo_per TYPE REF TO lcl_persist_background,
|
DATA: lo_per TYPE REF TO zcl_abapgit_persist_background,
|
||||||
lo_repo TYPE REF TO lcl_repo_online,
|
lo_repo TYPE REF TO lcl_repo_online,
|
||||||
lt_list TYPE lcl_persist_background=>tt_background,
|
lt_list TYPE zcl_abapgit_persist_background=>tt_background,
|
||||||
lv_repo_name TYPE string.
|
lv_repo_name TYPE string.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_list> LIKE LINE OF lt_list.
|
FIELD-SYMBOLS: <ls_list> LIKE LINE OF lt_list.
|
||||||
|
@ -227,9 +227,9 @@ CLASS lcl_background IMPLEMENTATION.
|
||||||
iv_password = <ls_list>-password ).
|
iv_password = <ls_list>-password ).
|
||||||
|
|
||||||
CASE <ls_list>-method.
|
CASE <ls_list>-method.
|
||||||
WHEN lcl_persist_background=>c_method-pull.
|
WHEN zcl_abapgit_persist_background=>c_method-pull.
|
||||||
lo_repo->deserialize( ).
|
lo_repo->deserialize( ).
|
||||||
WHEN lcl_persist_background=>c_method-push.
|
WHEN zcl_abapgit_persist_background=>c_method-push.
|
||||||
push( io_repo = lo_repo
|
push( io_repo = lo_repo
|
||||||
is_settings = <ls_list> ).
|
is_settings = <ls_list> ).
|
||||||
WHEN OTHERS.
|
WHEN OTHERS.
|
||||||
|
|
|
@ -47,7 +47,7 @@ CLASS lcl_gui_router DEFINITION FINAL.
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
METHODS get_page_background
|
METHODS get_page_background
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_page
|
RETURNING VALUE(ri_page) TYPE REF TO zif_abapgit_gui_page
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
||||||
METHOD on_event.
|
METHOD on_event.
|
||||||
|
|
||||||
DATA: lv_url TYPE string,
|
DATA: lv_url TYPE string,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key,
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
ls_db TYPE zcl_abapgit_persistence_db=>ty_content,
|
ls_db TYPE zcl_abapgit_persistence_db=>ty_content,
|
||||||
ls_item TYPE zif_abapgit_definitions=>ty_item.
|
ls_item TYPE zif_abapgit_definitions=>ty_item.
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
||||||
ei_page = get_page_playground( ).
|
ei_page = get_page_playground( ).
|
||||||
ev_state = zif_abapgit_definitions=>gc_event_state-new_page.
|
ev_state = zif_abapgit_definitions=>gc_event_state-new_page.
|
||||||
WHEN zif_abapgit_definitions=>gc_action-go_tutorial. " Go to tutorial
|
WHEN zif_abapgit_definitions=>gc_action-go_tutorial. " Go to tutorial
|
||||||
lcl_app=>user( )->set_repo_show( '' ). " Clear show_id
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( '' ). " Clear show_id
|
||||||
ev_state = zif_abapgit_definitions=>gc_event_state-re_render. " Assume we are on main page
|
ev_state = zif_abapgit_definitions=>gc_event_state-re_render. " Assume we are on main page
|
||||||
|
|
||||||
" SAP GUI actions
|
" SAP GUI actions
|
||||||
|
@ -297,7 +297,7 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
||||||
|
|
||||||
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
||||||
lo_page TYPE REF TO lcl_gui_page_boverview,
|
lo_page TYPE REF TO lcl_gui_page_boverview,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key.
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key.
|
||||||
|
|
||||||
|
|
||||||
lv_key = iv_getdata.
|
lv_key = iv_getdata.
|
||||||
|
@ -317,7 +317,7 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
||||||
DATA: ls_file TYPE zif_abapgit_definitions=>ty_file,
|
DATA: ls_file TYPE zif_abapgit_definitions=>ty_file,
|
||||||
ls_object TYPE zif_abapgit_definitions=>ty_item,
|
ls_object TYPE zif_abapgit_definitions=>ty_item,
|
||||||
lo_page TYPE REF TO lcl_gui_page_diff,
|
lo_page TYPE REF TO lcl_gui_page_diff,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key.
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key.
|
||||||
|
|
||||||
|
|
||||||
lcl_html_action_utils=>file_obj_decode( EXPORTING iv_string = iv_getdata
|
lcl_html_action_utils=>file_obj_decode( EXPORTING iv_string = iv_getdata
|
||||||
|
@ -339,7 +339,7 @@ CLASS lcl_gui_router IMPLEMENTATION.
|
||||||
METHOD get_page_stage.
|
METHOD get_page_stage.
|
||||||
|
|
||||||
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key,
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
lv_seed TYPE string,
|
lv_seed TYPE string,
|
||||||
lo_stage_page TYPE REF TO lcl_gui_page_stage.
|
lo_stage_page TYPE REF TO lcl_gui_page_stage.
|
||||||
|
|
||||||
|
|
|
@ -50,18 +50,18 @@ CLASS lcl_html_action_utils DEFINITION FINAL.
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
CLASS-METHODS file_encode
|
CLASS-METHODS file_encode
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
ig_file TYPE any "assuming ty_file
|
ig_file TYPE any "assuming ty_file
|
||||||
RETURNING VALUE(rv_string) TYPE string.
|
RETURNING VALUE(rv_string) TYPE string.
|
||||||
|
|
||||||
CLASS-METHODS obj_encode
|
CLASS-METHODS obj_encode
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
ig_object TYPE any "assuming ty_item
|
ig_object TYPE any "assuming ty_item
|
||||||
RETURNING VALUE(rv_string) TYPE string.
|
RETURNING VALUE(rv_string) TYPE string.
|
||||||
|
|
||||||
CLASS-METHODS file_obj_decode
|
CLASS-METHODS file_obj_decode
|
||||||
IMPORTING iv_string TYPE clike
|
IMPORTING iv_string TYPE clike
|
||||||
EXPORTING ev_key TYPE lcl_persistence_repo=>ty_repo-key
|
EXPORTING ev_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
eg_file TYPE any "assuming ty_file
|
eg_file TYPE any "assuming ty_file
|
||||||
eg_object TYPE any "assuming ty_item
|
eg_object TYPE any "assuming ty_item
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
@ -84,11 +84,11 @@ CLASS lcl_html_action_utils DEFINITION FINAL.
|
||||||
|
|
||||||
CLASS-METHODS decode_bg_update
|
CLASS-METHODS decode_bg_update
|
||||||
IMPORTING iv_getdata TYPE clike
|
IMPORTING iv_getdata TYPE clike
|
||||||
RETURNING VALUE(rs_fields) TYPE lcl_persist_background=>ty_background.
|
RETURNING VALUE(rs_fields) TYPE zcl_abapgit_persist_background=>ty_background.
|
||||||
|
|
||||||
CLASS-METHODS stage_decode
|
CLASS-METHODS stage_decode
|
||||||
IMPORTING iv_getdata TYPE clike
|
IMPORTING iv_getdata TYPE clike
|
||||||
EXPORTING ev_key TYPE lcl_persistence_repo=>ty_repo-key
|
EXPORTING ev_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
ev_seed TYPE string
|
ev_seed TYPE string
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
|
||||||
METHOD render_repo_top.
|
METHOD render_repo_top.
|
||||||
|
|
||||||
DATA: lo_repo_online TYPE REF TO lcl_repo_online,
|
DATA: lo_repo_online TYPE REF TO lcl_repo_online,
|
||||||
lo_pback TYPE REF TO lcl_persist_background,
|
lo_pback TYPE REF TO zcl_abapgit_persist_background,
|
||||||
lv_hint TYPE string,
|
lv_hint TYPE string,
|
||||||
lv_icon TYPE string.
|
lv_icon TYPE string.
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ CLASS lcl_gui_chunk_lib IMPLEMENTATION.
|
||||||
ro_html->add( '<td class="repo_attr right">' ).
|
ro_html->add( '<td class="repo_attr right">' ).
|
||||||
|
|
||||||
" Fav
|
" Fav
|
||||||
IF abap_true = lcl_app=>user( )->is_favorite_repo( io_repo->get_key( ) ).
|
IF abap_true = zcl_abapgit_persistence_user=>get_instance( )->is_favorite_repo( io_repo->get_key( ) ).
|
||||||
lv_icon = 'star/blue' ##NO_TEXT.
|
lv_icon = 'star/blue' ##NO_TEXT.
|
||||||
ELSE.
|
ELSE.
|
||||||
lv_icon = 'star/grey' ##NO_TEXT.
|
lv_icon = 'star/grey' ##NO_TEXT.
|
||||||
|
|
|
@ -395,7 +395,7 @@ CLASS lcl_http IMPLEMENTATION.
|
||||||
lo_digest TYPE REF TO zcl_abapgit_http_digest.
|
lo_digest TYPE REF TO zcl_abapgit_http_digest.
|
||||||
|
|
||||||
|
|
||||||
lv_default_user = lcl_app=>user( )->get_repo_login( iv_url ).
|
lv_default_user = zcl_abapgit_persistence_user=>get_instance( )->get_repo_login( iv_url ).
|
||||||
lv_user = lv_default_user.
|
lv_user = lv_default_user.
|
||||||
|
|
||||||
lcl_password_dialog=>popup(
|
lcl_password_dialog=>popup(
|
||||||
|
@ -410,8 +410,9 @@ CLASS lcl_http IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF lv_user <> lv_default_user.
|
IF lv_user <> lv_default_user.
|
||||||
lcl_app=>user( )->set_repo_login( iv_url = iv_url
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_login(
|
||||||
iv_login = lv_user ).
|
iv_url = iv_url
|
||||||
|
iv_login = lv_user ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
" Offer two factor authentication if it is available and required
|
" Offer two factor authentication if it is available and required
|
||||||
|
|
|
@ -21,7 +21,7 @@ CLASS lcl_migrations IMPLEMENTATION.
|
||||||
METHOD run.
|
METHOD run.
|
||||||
|
|
||||||
" Migrate STDTEXT to TABLE
|
" Migrate STDTEXT to TABLE
|
||||||
lcl_persist_migrate=>run( ).
|
zcl_abapgit_persist_migrate=>run( ).
|
||||||
|
|
||||||
" Rebuild local file checksums
|
" Rebuild local file checksums
|
||||||
rebuild_local_checksums_161112( ).
|
rebuild_local_checksums_161112( ).
|
||||||
|
|
|
@ -110,7 +110,7 @@ CLASS lcl_news IMPLEMENTATION.
|
||||||
RETURN.
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
lv_last_seen = lcl_app=>user( )->get_repo_last_change_seen( lv_url ).
|
lv_last_seen = zcl_abapgit_persistence_user=>get_instance( )->get_repo_last_change_seen( lv_url ).
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
" Find changelog
|
" Find changelog
|
||||||
|
@ -131,7 +131,7 @@ CLASS lcl_news IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF ro_instance IS BOUND.
|
IF ro_instance IS BOUND.
|
||||||
lcl_app=>user( )->set_repo_last_change_seen(
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_last_change_seen(
|
||||||
iv_url = lv_url
|
iv_url = lv_url
|
||||||
iv_version = ro_instance->latest_version( ) ).
|
iv_version = ro_instance->latest_version( ) ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
|
@ -146,7 +146,7 @@ CLASS lcl_objects IMPLEMENTATION.
|
||||||
lv_class_name = class_name( is_item ).
|
lv_class_name = class_name( is_item ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF lcl_app=>settings( )->read( )->get_experimental_features( ) = abap_true
|
IF zcl_abapgit_persist_settings=>get_instance( )->read( )->get_experimental_features( ) = abap_true
|
||||||
AND is_item-obj_type = 'CLAS'.
|
AND is_item-obj_type = 'CLAS'.
|
||||||
lv_class_name = 'LCL_OBJECT_CLAS_NEW'.
|
lv_class_name = 'LCL_OBJECT_CLAS_NEW'.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
@ -255,7 +255,7 @@ CLASS lcl_objects IMPLEMENTATION.
|
||||||
li_obj = create_object( is_item = is_item
|
li_obj = create_object( is_item = is_item
|
||||||
iv_language = zif_abapgit_definitions=>gc_english ).
|
iv_language = zif_abapgit_definitions=>gc_english ).
|
||||||
|
|
||||||
lv_adt_jump_enabled = lcl_app=>settings( )->read( )->get_adt_jump_enabled( ).
|
lv_adt_jump_enabled = zcl_abapgit_persist_settings=>get_instance( )->read( )->get_adt_jump_enabled( ).
|
||||||
|
|
||||||
IF lv_adt_jump_enabled = abap_true.
|
IF lv_adt_jump_enabled = abap_true.
|
||||||
TRY.
|
TRY.
|
||||||
|
|
|
@ -77,7 +77,7 @@ CLASS lcl_gui_page_bkg DEFINITION FINAL
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
METHODS:
|
METHODS:
|
||||||
constructor IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key,
|
constructor IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
zif_abapgit_gui_page~on_event REDEFINITION.
|
zif_abapgit_gui_page~on_event REDEFINITION.
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
|
@ -85,7 +85,7 @@ CLASS lcl_gui_page_bkg DEFINITION FINAL
|
||||||
|
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
DATA:
|
DATA:
|
||||||
mv_key TYPE lcl_persistence_repo=>ty_repo-key.
|
mv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key.
|
||||||
|
|
||||||
METHODS:
|
METHODS:
|
||||||
build_menu
|
build_menu
|
||||||
|
@ -116,7 +116,7 @@ CLASS lcl_gui_page_bkg IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD zif_abapgit_gui_page~on_event.
|
METHOD zif_abapgit_gui_page~on_event.
|
||||||
|
|
||||||
DATA ls_bg_task TYPE lcl_persist_background=>ty_background.
|
DATA ls_bg_task TYPE zcl_abapgit_persist_background=>ty_background.
|
||||||
|
|
||||||
CASE iv_action.
|
CASE iv_action.
|
||||||
WHEN zif_abapgit_definitions=>gc_action-bg_update.
|
WHEN zif_abapgit_definitions=>gc_action-bg_update.
|
||||||
|
@ -131,8 +131,8 @@ CLASS lcl_gui_page_bkg IMPLEMENTATION.
|
||||||
METHOD render_data.
|
METHOD render_data.
|
||||||
|
|
||||||
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
DATA: lo_repo TYPE REF TO lcl_repo_online,
|
||||||
lo_per TYPE REF TO lcl_persist_background,
|
lo_per TYPE REF TO zcl_abapgit_persist_background,
|
||||||
lt_per TYPE lcl_persist_background=>tt_background,
|
lt_per TYPE zcl_abapgit_persist_background=>tt_background,
|
||||||
ls_per LIKE LINE OF lt_per,
|
ls_per LIKE LINE OF lt_per,
|
||||||
lv_nothing TYPE string,
|
lv_nothing TYPE string,
|
||||||
lv_push TYPE string,
|
lv_push TYPE string,
|
||||||
|
@ -163,16 +163,16 @@ CLASS lcl_gui_page_bkg IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
CASE ls_per-method.
|
CASE ls_per-method.
|
||||||
WHEN lcl_persist_background=>c_method-push.
|
WHEN zcl_abapgit_persist_background=>c_method-push.
|
||||||
lv_push = ' checked' ##NO_TEXT.
|
lv_push = ' checked' ##NO_TEXT.
|
||||||
WHEN lcl_persist_background=>c_method-pull.
|
WHEN zcl_abapgit_persist_background=>c_method-pull.
|
||||||
lv_pull = ' checked' ##NO_TEXT.
|
lv_pull = ' checked' ##NO_TEXT.
|
||||||
WHEN OTHERS.
|
WHEN OTHERS.
|
||||||
lv_nothing = ' checked' ##NO_TEXT.
|
lv_nothing = ' checked' ##NO_TEXT.
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
|
|
||||||
CASE ls_per-amethod.
|
CASE ls_per-amethod.
|
||||||
WHEN lcl_persist_background=>c_amethod-auto.
|
WHEN zcl_abapgit_persist_background=>c_amethod-auto.
|
||||||
lv_aauto = ' checked' ##NO_TEXT.
|
lv_aauto = ' checked' ##NO_TEXT.
|
||||||
WHEN OTHERS.
|
WHEN OTHERS.
|
||||||
lv_afixed = ' checked' ##NO_TEXT.
|
lv_afixed = ' checked' ##NO_TEXT.
|
||||||
|
|
|
@ -157,7 +157,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
||||||
|
|
||||||
CONSTANTS: lc_body_col_max TYPE i VALUE 150.
|
CONSTANTS: lc_body_col_max TYPE i VALUE 150.
|
||||||
|
|
||||||
DATA: lo_user TYPE REF TO lcl_persistence_user.
|
DATA: lo_user TYPE REF TO zcl_abapgit_persistence_user.
|
||||||
DATA: lv_user TYPE string.
|
DATA: lv_user TYPE string.
|
||||||
DATA: lv_email TYPE string.
|
DATA: lv_email TYPE string.
|
||||||
DATA: lv_s_param TYPE string.
|
DATA: lv_s_param TYPE string.
|
||||||
|
@ -168,7 +168,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
||||||
* commit messages should be max 50 characters
|
* commit messages should be max 50 characters
|
||||||
* body should wrap at 72 characters
|
* body should wrap at 72 characters
|
||||||
|
|
||||||
lo_user = lcl_app=>user( ).
|
lo_user = zcl_abapgit_persistence_user=>get_instance( ).
|
||||||
|
|
||||||
lv_user = lo_user->get_repo_git_user_name( mo_repo->get_url( ) ).
|
lv_user = lo_user->get_repo_git_user_name( mo_repo->get_url( ) ).
|
||||||
IF lv_user IS INITIAL.
|
IF lv_user IS INITIAL.
|
||||||
|
@ -194,7 +194,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
||||||
iv_label = 'committer e-mail'
|
iv_label = 'committer e-mail'
|
||||||
iv_value = lv_email ) ).
|
iv_value = lv_email ) ).
|
||||||
|
|
||||||
lo_settings = lcl_app=>settings( )->read( ).
|
lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ).
|
||||||
|
|
||||||
lv_s_param = lo_settings->get_commitmsg_comment_length( ).
|
lv_s_param = lo_settings->get_commitmsg_comment_length( ).
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ CLASS lcl_gui_page_db_dis IMPLEMENTATION.
|
||||||
lv_action TYPE string.
|
lv_action TYPE string.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
lv_data = lcl_app=>db( )->read(
|
lv_data = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
iv_type = ms_key-type
|
iv_type = ms_key-type
|
||||||
iv_value = ms_key-value ).
|
iv_value = ms_key-value ).
|
||||||
CATCH zcx_abapgit_not_found ##NO_HANDLER.
|
CATCH zcx_abapgit_not_found ##NO_HANDLER.
|
||||||
|
@ -107,13 +107,13 @@ CLASS lcl_gui_page_db_edit IMPLEMENTATION.
|
||||||
lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar.
|
lo_toolbar TYPE REF TO zcl_abapgit_html_toolbar.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
lv_data = lcl_app=>db( )->read(
|
lv_data = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
iv_type = ms_key-type
|
iv_type = ms_key-type
|
||||||
iv_value = ms_key-value ).
|
iv_value = ms_key-value ).
|
||||||
CATCH zcx_abapgit_not_found ##NO_HANDLER.
|
CATCH zcx_abapgit_not_found ##NO_HANDLER.
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
||||||
lcl_app=>db( )->lock(
|
zcl_abapgit_persistence_db=>get_instance( )->lock(
|
||||||
iv_type = ms_key-type
|
iv_type = ms_key-type
|
||||||
iv_value = ms_key-value ).
|
iv_value = ms_key-value ).
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ CLASS lcl_gui_page_db IMPLEMENTATION.
|
||||||
FIELD-SYMBOLS: <ls_data> LIKE LINE OF lt_data.
|
FIELD-SYMBOLS: <ls_data> LIKE LINE OF lt_data.
|
||||||
|
|
||||||
|
|
||||||
lt_data = lcl_app=>db( )->list( ).
|
lt_data = zcl_abapgit_persistence_db=>get_instance( )->list( ).
|
||||||
|
|
||||||
CREATE OBJECT ro_html.
|
CREATE OBJECT ro_html.
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ CLASS lcl_gui_page_diff DEFINITION FINAL INHERITING FROM lcl_gui_page.
|
||||||
|
|
||||||
METHODS:
|
METHODS:
|
||||||
constructor
|
constructor
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
is_file TYPE zif_abapgit_definitions=>ty_file OPTIONAL
|
is_file TYPE zif_abapgit_definitions=>ty_file OPTIONAL
|
||||||
is_object TYPE zif_abapgit_definitions=>ty_item OPTIONAL
|
is_object TYPE zif_abapgit_definitions=>ty_item OPTIONAL
|
||||||
iv_supress_stage TYPE abap_bool DEFAULT abap_false
|
iv_supress_stage TYPE abap_bool DEFAULT abap_false
|
||||||
|
@ -47,7 +47,7 @@ CLASS lcl_gui_page_diff DEFINITION FINAL INHERITING FROM lcl_gui_page.
|
||||||
DATA: mt_diff_files TYPE tt_file_diff,
|
DATA: mt_diff_files TYPE tt_file_diff,
|
||||||
mt_delayed_lines TYPE zcl_abapgit_diff=>ty_diffs_tt,
|
mt_delayed_lines TYPE zcl_abapgit_diff=>ty_diffs_tt,
|
||||||
mv_unified TYPE abap_bool VALUE abap_true,
|
mv_unified TYPE abap_bool VALUE abap_true,
|
||||||
mv_repo_key TYPE lcl_persistence_repo=>ty_repo-key,
|
mv_repo_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
mv_seed TYPE string. " Unique page id to bind JS sessionStorage
|
mv_seed TYPE string. " Unique page id to bind JS sessionStorage
|
||||||
|
|
||||||
METHODS render_diff
|
METHODS render_diff
|
||||||
|
@ -101,7 +101,7 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
||||||
|
|
||||||
super->constructor( ).
|
super->constructor( ).
|
||||||
ms_control-page_title = 'DIFF'.
|
ms_control-page_title = 'DIFF'.
|
||||||
mv_unified = lcl_app=>user( )->get_diff_unified( ).
|
mv_unified = zcl_abapgit_persistence_user=>get_instance( )->get_diff_unified( ).
|
||||||
mv_repo_key = iv_key.
|
mv_repo_key = iv_key.
|
||||||
|
|
||||||
GET TIME STAMP FIELD lv_ts.
|
GET TIME STAMP FIELD lv_ts.
|
||||||
|
@ -338,7 +338,7 @@ CLASS lcl_gui_page_diff IMPLEMENTATION.
|
||||||
|
|
||||||
CASE iv_action.
|
CASE iv_action.
|
||||||
WHEN c_actions-toggle_unified. " Toggle file diplay
|
WHEN c_actions-toggle_unified. " Toggle file diplay
|
||||||
mv_unified = lcl_app=>user( )->toggle_diff_unified( ).
|
mv_unified = zcl_abapgit_persistence_user=>get_instance( )->toggle_diff_unified( ).
|
||||||
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
||||||
ENDCASE.
|
ENDCASE.
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD zif_abapgit_gui_page~on_event.
|
METHOD zif_abapgit_gui_page~on_event.
|
||||||
|
|
||||||
DATA: lv_key TYPE lcl_persistence_repo=>ty_repo-key.
|
DATA: lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key.
|
||||||
|
|
||||||
|
|
||||||
IF NOT mo_repo_content IS INITIAL.
|
IF NOT mo_repo_content IS INITIAL.
|
||||||
|
@ -74,7 +74,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
||||||
|
|
||||||
CASE iv_action.
|
CASE iv_action.
|
||||||
WHEN c_actions-show. " Change displayed repo
|
WHEN c_actions-show. " Change displayed repo
|
||||||
lcl_app=>user( )->set_repo_show( lv_key ).
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lv_key ).
|
||||||
TRY.
|
TRY.
|
||||||
lcl_app=>repo_srv( )->get( lv_key )->refresh( ).
|
lcl_app=>repo_srv( )->get( lv_key )->refresh( ).
|
||||||
CATCH zcx_abapgit_exception ##NO_HANDLER.
|
CATCH zcx_abapgit_exception ##NO_HANDLER.
|
||||||
|
@ -150,14 +150,14 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
|
|
||||||
lv_show_old = mv_show.
|
lv_show_old = mv_show.
|
||||||
mv_show = lcl_app=>user( )->get_repo_show( ). " Get default repo from user cfg
|
mv_show = zcl_abapgit_persistence_user=>get_instance( )->get_repo_show( ). " Get default repo from user cfg
|
||||||
|
|
||||||
IF mv_show IS NOT INITIAL.
|
IF mv_show IS NOT INITIAL.
|
||||||
TRY. " verify the key exists
|
TRY. " verify the key exists
|
||||||
lcl_app=>repo_srv( )->get( mv_show ).
|
lcl_app=>repo_srv( )->get( mv_show ).
|
||||||
CATCH zcx_abapgit_exception.
|
CATCH zcx_abapgit_exception.
|
||||||
CLEAR mv_show.
|
CLEAR mv_show.
|
||||||
lcl_app=>user( )->set_repo_show( mv_show ).
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( mv_show ).
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -201,14 +201,14 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD render_toc.
|
METHOD render_toc.
|
||||||
|
|
||||||
DATA: lo_pback TYPE REF TO lcl_persist_background,
|
DATA: lo_pback TYPE REF TO zcl_abapgit_persist_background,
|
||||||
lv_current TYPE abap_bool,
|
lv_current TYPE abap_bool,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key,
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
lv_icon TYPE string,
|
lv_icon TYPE string,
|
||||||
lo_repo LIKE LINE OF it_repo_list,
|
lo_repo LIKE LINE OF it_repo_list,
|
||||||
lo_favbar TYPE REF TO zcl_abapgit_html_toolbar,
|
lo_favbar TYPE REF TO zcl_abapgit_html_toolbar,
|
||||||
lo_allbar TYPE REF TO zcl_abapgit_html_toolbar,
|
lo_allbar TYPE REF TO zcl_abapgit_html_toolbar,
|
||||||
lt_favorites TYPE lcl_persistence_user=>tt_favorites,
|
lt_favorites TYPE zcl_abapgit_persistence_user=>tt_favorites,
|
||||||
lv_repo_title TYPE string.
|
lv_repo_title TYPE string.
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
||||||
CREATE OBJECT lo_allbar.
|
CREATE OBJECT lo_allbar.
|
||||||
CREATE OBJECT lo_pback.
|
CREATE OBJECT lo_pback.
|
||||||
|
|
||||||
lt_favorites = lcl_app=>user( )->get_favorites( ).
|
lt_favorites = zcl_abapgit_persistence_user=>get_instance( )->get_favorites( ).
|
||||||
|
|
||||||
LOOP AT it_repo_list INTO lo_repo.
|
LOOP AT it_repo_list INTO lo_repo.
|
||||||
lv_key = lo_repo->get_key( ).
|
lv_key = lo_repo->get_key( ).
|
||||||
|
@ -255,7 +255,7 @@ CLASS lcl_gui_page_main IMPLEMENTATION.
|
||||||
|
|
||||||
" Cleanup orphan favorites (for removed repos)
|
" Cleanup orphan favorites (for removed repos)
|
||||||
LOOP AT lt_favorites INTO lv_key.
|
LOOP AT lt_favorites INTO lv_key.
|
||||||
lcl_app=>user( )->toggle_favorite( lv_key ).
|
zcl_abapgit_persistence_user=>get_instance( )->toggle_favorite( lv_key ).
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
|
||||||
" Render HTML
|
" Render HTML
|
||||||
|
|
|
@ -230,9 +230,9 @@ CLASS lcl_gui_page_settings IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD persist_settings.
|
METHOD persist_settings.
|
||||||
|
|
||||||
DATA lo_settings_persistence TYPE REF TO lcl_persist_settings.
|
DATA lo_settings_persistence TYPE REF TO zcl_abapgit_persist_settings.
|
||||||
|
|
||||||
lo_settings_persistence = lcl_app=>settings( ).
|
lo_settings_persistence = zcl_abapgit_persist_settings=>get_instance( ).
|
||||||
lo_settings_persistence->modify( mo_settings ).
|
lo_settings_persistence->modify( mo_settings ).
|
||||||
MESSAGE 'Settings succesfully saved' TYPE 'S'.
|
MESSAGE 'Settings succesfully saved' TYPE 'S'.
|
||||||
|
|
||||||
|
@ -258,9 +258,9 @@ CLASS lcl_gui_page_settings IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD read_settings.
|
METHOD read_settings.
|
||||||
|
|
||||||
DATA lo_settings_persistence TYPE REF TO lcl_persist_settings.
|
DATA lo_settings_persistence TYPE REF TO zcl_abapgit_persist_settings.
|
||||||
|
|
||||||
lo_settings_persistence = lcl_app=>settings( ).
|
lo_settings_persistence = zcl_abapgit_persist_settings=>get_instance( ).
|
||||||
mo_settings = lo_settings_persistence->read( ).
|
mo_settings = lo_settings_persistence->read( ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,7 +36,7 @@ CLASS lcl_proxy_configuration IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD constructor.
|
METHOD constructor.
|
||||||
|
|
||||||
mo_settings = lcl_app=>settings( )->read( ).
|
mo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ).
|
||||||
|
|
||||||
mi_exit = lcl_exit=>get_instance( ).
|
mi_exit = lcl_exit=>get_instance( ).
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ CLASS lcl_repo DEFINITION ABSTRACT FRIENDS lcl_repo_srv.
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
METHODS:
|
METHODS:
|
||||||
constructor
|
constructor
|
||||||
IMPORTING is_data TYPE lcl_persistence_repo=>ty_repo,
|
IMPORTING is_data TYPE zcl_abapgit_persistence_repo=>ty_repo,
|
||||||
get_key
|
get_key
|
||||||
RETURNING VALUE(rv_key) TYPE zcl_abapgit_persistence_db=>ty_value,
|
RETURNING VALUE(rv_key) TYPE zcl_abapgit_persistence_db=>ty_value,
|
||||||
get_name
|
get_name
|
||||||
|
@ -22,14 +22,14 @@ CLASS lcl_repo DEFINITION ABSTRACT FRIENDS lcl_repo_srv.
|
||||||
RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt
|
RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_item_tt
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
get_local_checksums
|
get_local_checksums
|
||||||
RETURNING VALUE(rt_checksums) TYPE lcl_persistence_repo=>ty_local_checksum_tt,
|
RETURNING VALUE(rt_checksums) TYPE zcl_abapgit_persistence_repo=>ty_local_checksum_tt,
|
||||||
get_local_checksums_per_file
|
get_local_checksums_per_file
|
||||||
RETURNING VALUE(rt_checksums) TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
RETURNING VALUE(rt_checksums) TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
||||||
get_files_remote
|
get_files_remote
|
||||||
RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
|
RETURNING VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
get_package
|
get_package
|
||||||
RETURNING VALUE(rv_package) TYPE lcl_persistence_repo=>ty_repo-package,
|
RETURNING VALUE(rv_package) TYPE zcl_abapgit_persistence_repo=>ty_repo-package,
|
||||||
get_master_language
|
get_master_language
|
||||||
RETURNING VALUE(rv_language) TYPE spras,
|
RETURNING VALUE(rv_language) TYPE spras,
|
||||||
is_write_protected
|
is_write_protected
|
||||||
|
@ -69,17 +69,17 @@ CLASS lcl_repo DEFINITION ABSTRACT FRIENDS lcl_repo_srv.
|
||||||
mt_remote TYPE zif_abapgit_definitions=>ty_files_tt,
|
mt_remote TYPE zif_abapgit_definitions=>ty_files_tt,
|
||||||
mv_do_local_refresh TYPE abap_bool,
|
mv_do_local_refresh TYPE abap_bool,
|
||||||
mv_last_serialization TYPE timestamp,
|
mv_last_serialization TYPE timestamp,
|
||||||
ms_data TYPE lcl_persistence_repo=>ty_repo.
|
ms_data TYPE zcl_abapgit_persistence_repo=>ty_repo.
|
||||||
|
|
||||||
METHODS:
|
METHODS:
|
||||||
set
|
set
|
||||||
IMPORTING iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL
|
IMPORTING iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL
|
||||||
it_checksums TYPE lcl_persistence_repo=>ty_local_checksum_tt OPTIONAL
|
it_checksums TYPE zcl_abapgit_persistence_repo=>ty_local_checksum_tt OPTIONAL
|
||||||
iv_url TYPE lcl_persistence_repo=>ty_repo-url OPTIONAL
|
iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url OPTIONAL
|
||||||
iv_branch_name TYPE lcl_persistence_repo=>ty_repo-branch_name OPTIONAL
|
iv_branch_name TYPE zcl_abapgit_persistence_repo=>ty_repo-branch_name OPTIONAL
|
||||||
iv_head_branch TYPE lcl_persistence_repo=>ty_repo-head_branch OPTIONAL
|
iv_head_branch TYPE zcl_abapgit_persistence_repo=>ty_repo-head_branch OPTIONAL
|
||||||
iv_offline TYPE lcl_persistence_repo=>ty_repo-offline OPTIONAL
|
iv_offline TYPE zcl_abapgit_persistence_repo=>ty_repo-offline OPTIONAL
|
||||||
is_dot_abapgit TYPE lcl_persistence_repo=>ty_repo-dot_abapgit OPTIONAL
|
is_dot_abapgit TYPE zcl_abapgit_persistence_repo=>ty_repo-dot_abapgit OPTIONAL
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
ENDCLASS. "lcl_repo DEFINITION
|
ENDCLASS. "lcl_repo DEFINITION
|
||||||
|
@ -93,31 +93,31 @@ CLASS lcl_repo_online DEFINITION INHERITING FROM lcl_repo FINAL.
|
||||||
METHODS:
|
METHODS:
|
||||||
refresh REDEFINITION,
|
refresh REDEFINITION,
|
||||||
constructor
|
constructor
|
||||||
IMPORTING is_data TYPE lcl_persistence_repo=>ty_repo
|
IMPORTING is_data TYPE zcl_abapgit_persistence_repo=>ty_repo
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
get_url
|
get_url
|
||||||
RETURNING VALUE(rv_url) TYPE lcl_persistence_repo=>ty_repo-url,
|
RETURNING VALUE(rv_url) TYPE zcl_abapgit_persistence_repo=>ty_repo-url,
|
||||||
get_branch_name
|
get_branch_name
|
||||||
RETURNING VALUE(rv_name) TYPE lcl_persistence_repo=>ty_repo-branch_name,
|
RETURNING VALUE(rv_name) TYPE zcl_abapgit_persistence_repo=>ty_repo-branch_name,
|
||||||
get_head_branch_name
|
get_head_branch_name
|
||||||
RETURNING VALUE(rv_name) TYPE lcl_persistence_repo=>ty_repo-head_branch,
|
RETURNING VALUE(rv_name) TYPE zcl_abapgit_persistence_repo=>ty_repo-head_branch,
|
||||||
get_branches
|
get_branches
|
||||||
RETURNING VALUE(ro_branches) TYPE REF TO zcl_abapgit_git_branch_list
|
RETURNING VALUE(ro_branches) TYPE REF TO zcl_abapgit_git_branch_list
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
set_url
|
set_url
|
||||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
IMPORTING iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
set_branch_name
|
set_branch_name
|
||||||
IMPORTING iv_branch_name TYPE lcl_persistence_repo=>ty_repo-branch_name
|
IMPORTING iv_branch_name TYPE zcl_abapgit_persistence_repo=>ty_repo-branch_name
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
set_new_remote
|
set_new_remote
|
||||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
IMPORTING iv_url TYPE zcl_abapgit_persistence_repo=>ty_repo-url
|
||||||
iv_branch_name TYPE lcl_persistence_repo=>ty_repo-branch_name
|
iv_branch_name TYPE zcl_abapgit_persistence_repo=>ty_repo-branch_name
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
get_sha1_local
|
get_sha1_local
|
||||||
RETURNING VALUE(rv_sha1) TYPE lcl_persistence_repo=>ty_repo-sha1,
|
RETURNING VALUE(rv_sha1) TYPE zcl_abapgit_persistence_repo=>ty_repo-sha1,
|
||||||
get_sha1_remote
|
get_sha1_remote
|
||||||
RETURNING VALUE(rv_sha1) TYPE lcl_persistence_repo=>ty_repo-sha1
|
RETURNING VALUE(rv_sha1) TYPE zcl_abapgit_persistence_repo=>ty_repo-sha1
|
||||||
RAISING zcx_abapgit_exception,
|
RAISING zcx_abapgit_exception,
|
||||||
get_files_remote REDEFINITION,
|
get_files_remote REDEFINITION,
|
||||||
get_objects
|
get_objects
|
||||||
|
@ -230,7 +230,7 @@ CLASS lcl_repo_srv DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
|
||||||
METHODS constructor.
|
METHODS constructor.
|
||||||
|
|
||||||
DATA: mv_init TYPE abap_bool VALUE abap_false,
|
DATA: mv_init TYPE abap_bool VALUE abap_false,
|
||||||
mo_persistence TYPE REF TO lcl_persistence_repo,
|
mo_persistence TYPE REF TO zcl_abapgit_persistence_repo,
|
||||||
mt_list TYPE ty_repo_tt.
|
mt_list TYPE ty_repo_tt.
|
||||||
|
|
||||||
METHODS is_sap_object_allowed
|
METHODS is_sap_object_allowed
|
||||||
|
|
|
@ -261,7 +261,7 @@ CLASS lcl_repo_online IMPLEMENTATION.
|
||||||
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
||||||
ls_last_item TYPE zif_abapgit_definitions=>ty_item,
|
ls_last_item TYPE zif_abapgit_definitions=>ty_item,
|
||||||
lv_branch_equal TYPE abap_bool,
|
lv_branch_equal TYPE abap_bool,
|
||||||
lt_checksums TYPE lcl_persistence_repo=>ty_local_checksum_tt.
|
lt_checksums TYPE zcl_abapgit_persistence_repo=>ty_local_checksum_tt.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums,
|
FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums,
|
||||||
<ls_file_sig> LIKE LINE OF <ls_checksum>-files,
|
<ls_file_sig> LIKE LINE OF <ls_checksum>-files,
|
||||||
|
@ -330,7 +330,7 @@ CLASS lcl_repo_online IMPLEMENTATION.
|
||||||
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
||||||
lt_remote TYPE zif_abapgit_definitions=>ty_files_tt,
|
lt_remote TYPE zif_abapgit_definitions=>ty_files_tt,
|
||||||
lt_status TYPE zif_abapgit_definitions=>ty_results_tt,
|
lt_status TYPE zif_abapgit_definitions=>ty_results_tt,
|
||||||
lv_package TYPE lcl_persistence_repo=>ty_repo-package.
|
lv_package TYPE zcl_abapgit_persistence_repo=>ty_repo-package.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <status> TYPE zif_abapgit_definitions=>ty_result,
|
FIELD-SYMBOLS: <status> TYPE zif_abapgit_definitions=>ty_result,
|
||||||
<tadir> TYPE zif_abapgit_definitions=>ty_tadir.
|
<tadir> TYPE zif_abapgit_definitions=>ty_tadir.
|
||||||
|
@ -404,7 +404,7 @@ CLASS lcl_repo IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD set.
|
METHOD set.
|
||||||
|
|
||||||
DATA: lo_persistence TYPE REF TO lcl_persistence_repo.
|
DATA: lo_persistence TYPE REF TO zcl_abapgit_persistence_repo.
|
||||||
|
|
||||||
|
|
||||||
ASSERT iv_sha1 IS SUPPLIED
|
ASSERT iv_sha1 IS SUPPLIED
|
||||||
|
@ -474,7 +474,7 @@ CLASS lcl_repo IMPLEMENTATION.
|
||||||
" Push fills it from local files before pushing, deserialize from remote
|
" Push fills it from local files before pushing, deserialize from remote
|
||||||
" If this is not true that there is an error somewhere but not here
|
" If this is not true that there is an error somewhere but not here
|
||||||
|
|
||||||
DATA: lt_checksums TYPE lcl_persistence_repo=>ty_local_checksum_tt,
|
DATA: lt_checksums TYPE zcl_abapgit_persistence_repo=>ty_local_checksum_tt,
|
||||||
lt_files_idx TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
lt_files_idx TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
||||||
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
||||||
lv_chks_row TYPE i,
|
lv_chks_row TYPE i,
|
||||||
|
@ -707,7 +707,7 @@ CLASS lcl_repo IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD delete.
|
METHOD delete.
|
||||||
|
|
||||||
DATA: lo_persistence TYPE REF TO lcl_persistence_repo.
|
DATA: lo_persistence TYPE REF TO zcl_abapgit_persistence_repo.
|
||||||
|
|
||||||
|
|
||||||
CREATE OBJECT lo_persistence.
|
CREATE OBJECT lo_persistence.
|
||||||
|
@ -775,7 +775,7 @@ CLASS lcl_repo IMPLEMENTATION.
|
||||||
|
|
||||||
DATA: lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
DATA: lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt,
|
||||||
ls_last_item TYPE zif_abapgit_definitions=>ty_item,
|
ls_last_item TYPE zif_abapgit_definitions=>ty_item,
|
||||||
lt_checksums TYPE lcl_persistence_repo=>ty_local_checksum_tt.
|
lt_checksums TYPE zcl_abapgit_persistence_repo=>ty_local_checksum_tt.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums,
|
FIELD-SYMBOLS: <ls_checksum> LIKE LINE OF lt_checksums,
|
||||||
<ls_file_sig> LIKE LINE OF <ls_checksum>-files,
|
<ls_file_sig> LIKE LINE OF <ls_checksum>-files,
|
||||||
|
@ -852,7 +852,7 @@ CLASS lcl_repo_srv IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD refresh.
|
METHOD refresh.
|
||||||
|
|
||||||
DATA: lt_list TYPE lcl_persistence_repo=>tt_repo,
|
DATA: lt_list TYPE zcl_abapgit_persistence_repo=>tt_repo,
|
||||||
lo_online TYPE REF TO lcl_repo_online,
|
lo_online TYPE REF TO lcl_repo_online,
|
||||||
lo_offline TYPE REF TO lcl_repo_offline.
|
lo_offline TYPE REF TO lcl_repo_offline.
|
||||||
|
|
||||||
|
@ -882,8 +882,8 @@ CLASS lcl_repo_srv IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD new_online.
|
METHOD new_online.
|
||||||
|
|
||||||
DATA: ls_repo TYPE lcl_persistence_repo=>ty_repo,
|
DATA: ls_repo TYPE zcl_abapgit_persistence_repo=>ty_repo,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key.
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key.
|
||||||
|
|
||||||
|
|
||||||
validate_package( iv_package ).
|
validate_package( iv_package ).
|
||||||
|
@ -910,8 +910,8 @@ CLASS lcl_repo_srv IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD new_offline.
|
METHOD new_offline.
|
||||||
|
|
||||||
DATA: ls_repo TYPE lcl_persistence_repo=>ty_repo,
|
DATA: ls_repo TYPE zcl_abapgit_persistence_repo=>ty_repo,
|
||||||
lv_key TYPE lcl_persistence_repo=>ty_repo-key.
|
lv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key.
|
||||||
|
|
||||||
|
|
||||||
validate_package( iv_package ).
|
validate_package( iv_package ).
|
||||||
|
@ -958,7 +958,7 @@ CLASS lcl_repo_srv IMPLEMENTATION.
|
||||||
METHOD validate_package.
|
METHOD validate_package.
|
||||||
|
|
||||||
DATA: ls_devclass TYPE tdevc,
|
DATA: ls_devclass TYPE tdevc,
|
||||||
lt_repos TYPE lcl_persistence_repo=>tt_repo.
|
lt_repos TYPE zcl_abapgit_persistence_repo=>tt_repo.
|
||||||
|
|
||||||
IF iv_package IS INITIAL.
|
IF iv_package IS INITIAL.
|
||||||
zcx_abapgit_exception=>raise( 'add, package empty' ).
|
zcx_abapgit_exception=>raise( 'add, package empty' ).
|
||||||
|
|
|
@ -7,7 +7,7 @@ CLASS lcl_services_bkg DEFINITION FINAL.
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
|
|
||||||
CLASS-METHODS update_task
|
CLASS-METHODS update_task
|
||||||
IMPORTING is_bg_task TYPE lcl_persist_background=>ty_background
|
IMPORTING is_bg_task TYPE zcl_abapgit_persist_background=>ty_background
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
ENDCLASS. "lcl_services_background
|
ENDCLASS. "lcl_services_background
|
||||||
|
@ -16,11 +16,11 @@ CLASS lcl_services_bkg IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD update_task.
|
METHOD update_task.
|
||||||
|
|
||||||
DATA lo_persistence TYPE REF TO lcl_persist_background.
|
DATA lo_persistence TYPE REF TO zcl_abapgit_persist_background.
|
||||||
|
|
||||||
CREATE OBJECT lo_persistence.
|
CREATE OBJECT lo_persistence.
|
||||||
|
|
||||||
IF is_bg_task-method = lcl_persist_background=>c_method-nothing.
|
IF is_bg_task-method = zcl_abapgit_persist_background=>c_method-nothing.
|
||||||
lo_persistence->delete( is_bg_task-key ).
|
lo_persistence->delete( is_bg_task-key ).
|
||||||
ELSE.
|
ELSE.
|
||||||
lo_persistence->modify( is_bg_task ).
|
lo_persistence->modify( is_bg_task ).
|
||||||
|
|
|
@ -38,7 +38,7 @@ CLASS lcl_services_db IMPLEMENTATION.
|
||||||
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
|
RAISE EXCEPTION TYPE zcx_abapgit_cancel.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
lcl_app=>db( )->delete(
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
iv_type = is_key-type
|
iv_type = is_key-type
|
||||||
iv_value = is_key-value ).
|
iv_value = is_key-value ).
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ CLASS lcl_services_db IMPLEMENTATION.
|
||||||
|
|
||||||
ASSERT is_content-type IS NOT INITIAL.
|
ASSERT is_content-type IS NOT INITIAL.
|
||||||
|
|
||||||
lcl_app=>db( )->update(
|
zcl_abapgit_persistence_db=>get_instance( )->update(
|
||||||
iv_type = is_content-type
|
iv_type = is_content-type
|
||||||
iv_value = is_content-value
|
iv_value = is_content-value
|
||||||
iv_data = is_content-data_str ).
|
iv_data = is_content-data_str ).
|
||||||
|
|
|
@ -6,7 +6,7 @@ CLASS lcl_services_git DEFINITION FINAL.
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
|
|
||||||
TYPES: BEGIN OF ty_commit_fields,
|
TYPES: BEGIN OF ty_commit_fields,
|
||||||
repo_key TYPE lcl_persistence_repo=>ty_repo-key,
|
repo_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key,
|
||||||
committer_name TYPE string,
|
committer_name TYPE string,
|
||||||
committer_email TYPE string,
|
committer_email TYPE string,
|
||||||
author_name TYPE string,
|
author_name TYPE string,
|
||||||
|
@ -16,35 +16,35 @@ CLASS lcl_services_git DEFINITION FINAL.
|
||||||
END OF ty_commit_fields.
|
END OF ty_commit_fields.
|
||||||
|
|
||||||
CLASS-METHODS pull
|
CLASS-METHODS pull
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS reset
|
CLASS-METHODS reset
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS create_branch
|
CLASS-METHODS create_branch
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS switch_branch
|
CLASS-METHODS switch_branch
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS delete_branch
|
CLASS-METHODS delete_branch
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS create_tag
|
CLASS-METHODS create_tag
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS delete_tag
|
CLASS-METHODS delete_tag
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS tag_overview
|
CLASS-METHODS tag_overview
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS commit
|
CLASS-METHODS commit
|
||||||
|
@ -299,9 +299,9 @@ CLASS lcl_services_git IMPLEMENTATION.
|
||||||
METHOD commit.
|
METHOD commit.
|
||||||
|
|
||||||
DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment,
|
DATA: ls_comment TYPE zif_abapgit_definitions=>ty_comment,
|
||||||
lo_user TYPE REF TO lcl_persistence_user.
|
lo_user TYPE REF TO zcl_abapgit_persistence_user.
|
||||||
|
|
||||||
lo_user = lcl_app=>user( ).
|
lo_user = zcl_abapgit_persistence_user=>get_instance( ).
|
||||||
lo_user->set_repo_git_user_name( iv_url = io_repo->get_url( )
|
lo_user->set_repo_git_user_name( iv_url = io_repo->get_url( )
|
||||||
iv_username = is_commit-committer_name ).
|
iv_username = is_commit-committer_name ).
|
||||||
lo_user->set_repo_git_user_email( iv_url = io_repo->get_url( )
|
lo_user->set_repo_git_user_email( iv_url = io_repo->get_url( )
|
||||||
|
|
|
@ -9,38 +9,38 @@ CLASS lcl_services_repo DEFINITION FINAL.
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS refresh
|
CLASS-METHODS refresh
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
CLASS-METHODS remove
|
CLASS-METHODS remove
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS purge
|
CLASS-METHODS purge
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS new_offline
|
CLASS-METHODS new_offline
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS remote_attach
|
CLASS-METHODS remote_attach
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS remote_detach
|
CLASS-METHODS remote_detach
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS remote_change
|
CLASS-METHODS remote_change
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS refresh_local_checksums
|
CLASS-METHODS refresh_local_checksums
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
RAISING zcx_abapgit_exception zcx_abapgit_cancel.
|
||||||
|
|
||||||
CLASS-METHODS toggle_favorite
|
CLASS-METHODS toggle_favorite
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
CLASS-METHODS open_se80
|
CLASS-METHODS open_se80
|
||||||
|
@ -78,7 +78,7 @@ CLASS lcl_services_repo IMPLEMENTATION.
|
||||||
lo_repo->status( ). " check for errors
|
lo_repo->status( ). " check for errors
|
||||||
lo_repo->deserialize( ).
|
lo_repo->deserialize( ).
|
||||||
|
|
||||||
lcl_app=>user( )->set_repo_show( lo_repo->get_key( ) ). " Set default repo for user
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lo_repo->get_key( ) ). " Set default repo for user
|
||||||
|
|
||||||
COMMIT WORK.
|
COMMIT WORK.
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ CLASS lcl_services_repo IMPLEMENTATION.
|
||||||
iv_url = ls_popup-url
|
iv_url = ls_popup-url
|
||||||
iv_package = ls_popup-package ).
|
iv_package = ls_popup-package ).
|
||||||
|
|
||||||
lcl_app=>user( )->set_repo_show( lo_repo->get_key( ) ). " Set default repo for user
|
zcl_abapgit_persistence_user=>get_instance( )->set_repo_show( lo_repo->get_key( ) ). " Set default repo for user
|
||||||
toggle_favorite( lo_repo->get_key( ) ).
|
toggle_favorite( lo_repo->get_key( ) ).
|
||||||
|
|
||||||
COMMIT WORK.
|
COMMIT WORK.
|
||||||
|
@ -304,7 +304,7 @@ CLASS lcl_services_repo IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD toggle_favorite.
|
METHOD toggle_favorite.
|
||||||
|
|
||||||
lcl_app=>user( )->toggle_favorite( iv_key ).
|
zcl_abapgit_persistence_user=>get_instance( )->toggle_favorite( iv_key ).
|
||||||
|
|
||||||
ENDMETHOD. " toggle_favorite.
|
ENDMETHOD. " toggle_favorite.
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ CLASS lcl_transport IMPLEMENTATION.
|
||||||
DATA: lt_requests TYPE trwbo_requests,
|
DATA: lt_requests TYPE trwbo_requests,
|
||||||
lt_tadir TYPE scts_tadir,
|
lt_tadir TYPE scts_tadir,
|
||||||
lv_package TYPE devclass,
|
lv_package TYPE devclass,
|
||||||
ls_data TYPE lcl_persistence_repo=>ty_repo,
|
ls_data TYPE zcl_abapgit_persistence_repo=>ty_repo,
|
||||||
lo_repo TYPE REF TO lcl_repo_offline,
|
lo_repo TYPE REF TO lcl_repo_offline,
|
||||||
lt_trkorr TYPE trwbo_request_headers.
|
lt_trkorr TYPE trwbo_request_headers.
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,8 @@ CLASS ltcl_critical_tests IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD check_run_permission.
|
METHOD check_run_permission.
|
||||||
DATA: lo_settings TYPE REF TO zcl_abapgit_settings.
|
DATA: lo_settings TYPE REF TO zcl_abapgit_settings.
|
||||||
lo_settings = lcl_app=>settings( )->read( ).
|
|
||||||
|
lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ).
|
||||||
|
|
||||||
"Objects will be created and deleted, do not run in customer system!
|
"Objects will be created and deleted, do not run in customer system!
|
||||||
"These tests may fail if you are locking the entries (e.g. the ZABAPGIT transaction is open)
|
"These tests may fail if you are locking the entries (e.g. the ZABAPGIT transaction is open)
|
||||||
|
@ -1375,7 +1376,7 @@ CLASS ltcl_persistence_settings DEFINITION FINAL FOR TESTING
|
||||||
read_run_critical_tests FOR TESTING RAISING cx_static_check,
|
read_run_critical_tests FOR TESTING RAISING cx_static_check,
|
||||||
read_not_found_critical_tests FOR TESTING RAISING cx_static_check.
|
read_not_found_critical_tests FOR TESTING RAISING cx_static_check.
|
||||||
DATA:
|
DATA:
|
||||||
mo_persistence_settings TYPE REF TO lcl_persist_settings,
|
mo_persistence_settings TYPE REF TO zcl_abapgit_persist_settings,
|
||||||
mo_settings TYPE REF TO zcl_abapgit_settings.
|
mo_settings TYPE REF TO zcl_abapgit_settings.
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
@ -1386,7 +1387,7 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD setup.
|
METHOD setup.
|
||||||
CREATE OBJECT mo_persistence_settings.
|
mo_persistence_settings = zcl_abapgit_persist_settings=>get_instance( ).
|
||||||
CREATE OBJECT mo_settings.
|
CREATE OBJECT mo_settings.
|
||||||
clear_settings_database( ).
|
clear_settings_database( ).
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -1398,7 +1399,7 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
|
|
||||||
mo_persistence_settings->modify( mo_settings ).
|
mo_persistence_settings->modify( mo_settings ).
|
||||||
|
|
||||||
lv_proxy_url = lcl_app=>db( )->read(
|
lv_proxy_url = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'PROXY_URL' ).
|
iv_value = 'PROXY_URL' ).
|
||||||
|
|
||||||
|
@ -1413,7 +1414,7 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
|
|
||||||
mo_persistence_settings->modify( mo_settings ).
|
mo_persistence_settings->modify( mo_settings ).
|
||||||
|
|
||||||
lv_proxy_port = lcl_app=>db( )->read(
|
lv_proxy_port = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'PROXY_PORT' ).
|
iv_value = 'PROXY_PORT' ).
|
||||||
|
|
||||||
|
@ -1423,12 +1424,12 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD read_proxy_settings.
|
METHOD read_proxy_settings.
|
||||||
lcl_app=>db( )->modify(
|
zcl_abapgit_persistence_db=>get_instance( )->modify(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'PROXY_URL'
|
iv_value = 'PROXY_URL'
|
||||||
iv_data = 'A_URL' ).
|
iv_data = 'A_URL' ).
|
||||||
|
|
||||||
lcl_app=>db( )->modify(
|
zcl_abapgit_persistence_db=>get_instance( )->modify(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'PROXY_PORT'
|
iv_value = 'PROXY_PORT'
|
||||||
iv_data = '1000' ).
|
iv_data = '1000' ).
|
||||||
|
@ -1466,7 +1467,7 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
|
|
||||||
mo_persistence_settings->modify( mo_settings ).
|
mo_persistence_settings->modify( mo_settings ).
|
||||||
|
|
||||||
lv_run_critical_tests = lcl_app=>db( )->read(
|
lv_run_critical_tests = zcl_abapgit_persistence_db=>get_instance( )->read(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'CRIT_TESTS' ).
|
iv_value = 'CRIT_TESTS' ).
|
||||||
|
|
||||||
|
@ -1476,7 +1477,7 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
METHOD read_run_critical_tests.
|
METHOD read_run_critical_tests.
|
||||||
lcl_app=>db( )->modify(
|
zcl_abapgit_persistence_db=>get_instance( )->modify(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'CRIT_TESTS'
|
iv_value = 'CRIT_TESTS'
|
||||||
iv_data = 'X' ).
|
iv_data = 'X' ).
|
||||||
|
@ -1498,21 +1499,21 @@ CLASS ltcl_persistence_settings IMPLEMENTATION.
|
||||||
METHOD clear_settings_database.
|
METHOD clear_settings_database.
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
lcl_app=>db( )->delete(
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'PROXY_URL' ).
|
iv_value = 'PROXY_URL' ).
|
||||||
CATCH cx_static_check ##NO_HANDLER.
|
CATCH cx_static_check ##NO_HANDLER.
|
||||||
"If entry didn't exist, that's okay
|
"If entry didn't exist, that's okay
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
TRY.
|
TRY.
|
||||||
lcl_app=>db( )->delete(
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'PROXY_PORT' ).
|
iv_value = 'PROXY_PORT' ).
|
||||||
CATCH cx_static_check ##NO_HANDLER.
|
CATCH cx_static_check ##NO_HANDLER.
|
||||||
"If entry didn't exist, that's okay
|
"If entry didn't exist, that's okay
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
TRY.
|
TRY.
|
||||||
lcl_app=>db( )->delete(
|
zcl_abapgit_persistence_db=>get_instance( )->delete(
|
||||||
iv_type = 'SETTINGS'
|
iv_type = 'SETTINGS'
|
||||||
iv_value = 'CRIT_TESTS' ).
|
iv_value = 'CRIT_TESTS' ).
|
||||||
CATCH cx_static_check ##NO_HANDLER.
|
CATCH cx_static_check ##NO_HANDLER.
|
||||||
|
|
|
@ -18,7 +18,7 @@ CLASS lcl_gui_view_repo DEFINITION FINAL.
|
||||||
END OF c_actions.
|
END OF c_actions.
|
||||||
|
|
||||||
METHODS constructor
|
METHODS constructor
|
||||||
IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key
|
IMPORTING iv_key TYPE zcl_abapgit_persistence_repo=>ty_repo-key
|
||||||
RAISING zcx_abapgit_exception.
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
@ -87,11 +87,11 @@ CLASS lcl_gui_view_repo IMPLEMENTATION.
|
||||||
|
|
||||||
mo_repo = lcl_app=>repo_srv( )->get( iv_key ).
|
mo_repo = lcl_app=>repo_srv( )->get( iv_key ).
|
||||||
mv_cur_dir = '/'. " Root
|
mv_cur_dir = '/'. " Root
|
||||||
mv_hide_files = lcl_app=>user( )->get_hide_files( ).
|
mv_hide_files = zcl_abapgit_persistence_user=>get_instance( )->get_hide_files( ).
|
||||||
mv_changes_only = lcl_app=>user( )->get_changes_only( ).
|
mv_changes_only = zcl_abapgit_persistence_user=>get_instance( )->get_changes_only( ).
|
||||||
|
|
||||||
" Read global settings to get max # of objects to be listed
|
" Read global settings to get max # of objects to be listed
|
||||||
lo_settings = lcl_app=>settings( )->read( ).
|
lo_settings = zcl_abapgit_persist_settings=>get_instance( )->read( ).
|
||||||
mv_max_lines = lo_settings->get_max_lines( ).
|
mv_max_lines = lo_settings->get_max_lines( ).
|
||||||
mv_max_setting = mv_max_lines.
|
mv_max_setting = mv_max_lines.
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ CLASS lcl_gui_view_repo IMPLEMENTATION.
|
||||||
|
|
||||||
CASE iv_action.
|
CASE iv_action.
|
||||||
WHEN c_actions-toggle_hide_files. " Toggle file diplay
|
WHEN c_actions-toggle_hide_files. " Toggle file diplay
|
||||||
mv_hide_files = lcl_app=>user( )->toggle_hide_files( ).
|
mv_hide_files = zcl_abapgit_persistence_user=>get_instance( )->toggle_hide_files( ).
|
||||||
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
||||||
WHEN c_actions-change_dir. " Change dir
|
WHEN c_actions-change_dir. " Change dir
|
||||||
lv_path = lcl_html_action_utils=>dir_decode( iv_getdata ).
|
lv_path = lcl_html_action_utils=>dir_decode( iv_getdata ).
|
||||||
|
@ -114,7 +114,7 @@ CLASS lcl_gui_view_repo IMPLEMENTATION.
|
||||||
mv_cur_dir = '/'. " Root
|
mv_cur_dir = '/'. " Root
|
||||||
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
||||||
WHEN c_actions-toggle_changes. " Toggle changes only view
|
WHEN c_actions-toggle_changes. " Toggle changes only view
|
||||||
mv_changes_only = lcl_app=>user( )->toggle_changes_only( ).
|
mv_changes_only = zcl_abapgit_persistence_user=>get_instance( )->toggle_changes_only( ).
|
||||||
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
ev_state = zif_abapgit_definitions=>gc_event_state-re_render.
|
||||||
WHEN c_actions-display_more. " Increase MAX lines limit
|
WHEN c_actions-display_more. " Increase MAX lines limit
|
||||||
mv_max_lines = mv_max_lines + mv_max_setting.
|
mv_max_lines = mv_max_lines + mv_max_setting.
|
||||||
|
|
|
@ -385,7 +385,7 @@ CLASS lcl_zip IMPLEMENTATION.
|
||||||
METHOD export_package.
|
METHOD export_package.
|
||||||
|
|
||||||
DATA: lo_repo TYPE REF TO lcl_repo_offline,
|
DATA: lo_repo TYPE REF TO lcl_repo_offline,
|
||||||
ls_data TYPE lcl_persistence_repo=>ty_repo.
|
ls_data TYPE zcl_abapgit_persistence_repo=>ty_repo.
|
||||||
|
|
||||||
|
|
||||||
ls_data-key = 'DUMMY'.
|
ls_data-key = 'DUMMY'.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user