mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Merge pull request #801 from bigld/master
#736 refactor lcl_persistence_settings
This commit is contained in:
commit
baae6d619c
|
@ -2,6 +2,8 @@
|
|||
*& Include ZABAPGIT_PERSISTENCE
|
||||
*&---------------------------------------------------------------------*
|
||||
|
||||
CLASS lcl_settings DEFINITION DEFERRED.
|
||||
|
||||
CLASS lcl_persist_migrate DEFINITION FINAL.
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
@ -12,6 +14,8 @@ CLASS lcl_persist_migrate DEFINITION FINAL.
|
|||
c_text TYPE string VALUE 'Generated by abapGit' ##NO_TEXT.
|
||||
|
||||
CLASS-METHODS:
|
||||
migrate_settings
|
||||
RAISING lcx_exception,
|
||||
migrate_repo
|
||||
RAISING lcx_exception,
|
||||
migrate_user
|
||||
|
@ -23,6 +27,8 @@ CLASS lcl_persist_migrate DEFINITION FINAL.
|
|||
lock_create
|
||||
RAISING lcx_exception,
|
||||
lock_exists
|
||||
RETURNING VALUE(rv_exists) TYPE abap_bool,
|
||||
settings_exists
|
||||
RETURNING VALUE(rv_exists) TYPE abap_bool.
|
||||
|
||||
ENDCLASS.
|
||||
|
@ -113,7 +119,7 @@ CLASS lcl_persistence_repo DEFINITION FINAL.
|
|||
|
||||
TYPES: BEGIN OF ty_repo,
|
||||
key TYPE lcl_persistence_db=>ty_value.
|
||||
INCLUDE TYPE ty_repo_xml.
|
||||
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.
|
||||
|
@ -230,7 +236,7 @@ CLASS lcl_persist_background DEFINITION FINAL.
|
|||
|
||||
TYPES: BEGIN OF ty_background,
|
||||
key TYPE lcl_persistence_db=>ty_value.
|
||||
INCLUDE TYPE ty_xml.
|
||||
INCLUDE TYPE ty_xml.
|
||||
TYPES: END OF ty_background.
|
||||
TYPES: tt_background TYPE STANDARD TABLE OF ty_background WITH DEFAULT KEY.
|
||||
|
||||
|
@ -270,6 +276,99 @@ CLASS lcl_persist_background DEFINITION FINAL.
|
|||
|
||||
ENDCLASS. "lcl_persistence_background DEFINITION
|
||||
|
||||
|
||||
CLASS lcl_settings DEFINITION FINAL.
|
||||
|
||||
PUBLIC SECTION.
|
||||
CONSTANTS: c_commitmsg_comment_length_dft TYPE i VALUE 50.
|
||||
CONSTANTS: c_commitmsg_body_size_dft TYPE i VALUE 72.
|
||||
CONSTANTS: c_dbtype_settings TYPE lcl_persistence_db=>ty_type VALUE 'SETTINGS' ##NO_TEXT.
|
||||
|
||||
METHODS set_proxy_url
|
||||
IMPORTING
|
||||
iv_url TYPE string.
|
||||
METHODS set_proxy_port
|
||||
IMPORTING
|
||||
iv_port TYPE string.
|
||||
METHODS set_proxy_authentication
|
||||
IMPORTING
|
||||
iv_auth TYPE abap_bool.
|
||||
METHODS get_proxy_url
|
||||
RETURNING
|
||||
VALUE(rv_proxy_url) TYPE string.
|
||||
METHODS get_proxy_port
|
||||
RETURNING
|
||||
VALUE(rv_port) TYPE string.
|
||||
METHODS get_proxy_authentication
|
||||
RETURNING
|
||||
VALUE(rv_auth) TYPE abap_bool.
|
||||
METHODS set_run_critical_tests
|
||||
IMPORTING
|
||||
iv_run TYPE abap_bool.
|
||||
METHODS
|
||||
get_run_critical_tests
|
||||
RETURNING VALUE(rv_run) TYPE abap_bool.
|
||||
METHODS set_max_lines
|
||||
IMPORTING iv_lines TYPE i.
|
||||
METHODS get_max_lines
|
||||
RETURNING
|
||||
VALUE(rv_lines) TYPE i.
|
||||
METHODS set_adt_jump_enanbled
|
||||
IMPORTING iv_adt_jump_enabled TYPE abap_bool.
|
||||
METHODS get_adt_jump_enabled
|
||||
RETURNING
|
||||
VALUE(rv_adt_jump_enabled) TYPE abap_bool.
|
||||
METHODS set_commitmsg_comment_length
|
||||
IMPORTING iv_length TYPE i.
|
||||
METHODS get_commitmsg_comment_length
|
||||
RETURNING
|
||||
VALUE(rv_length) TYPE i.
|
||||
METHODS set_commitmsg_body_size
|
||||
IMPORTING iv_length TYPE i.
|
||||
METHODS get_commitmsg_body_size
|
||||
RETURNING
|
||||
VALUE(rv_length) TYPE i.
|
||||
METHODS get_settings_xml
|
||||
RETURNING VALUE(ev_settings_xml) TYPE string
|
||||
RAISING lcx_exception.
|
||||
METHODS set_xml_settings
|
||||
IMPORTING iv_settings_xml TYPE string
|
||||
RAISING lcx_exception.
|
||||
METHODS set_defaults.
|
||||
|
||||
|
||||
|
||||
PRIVATE SECTION.
|
||||
TYPES: BEGIN OF ty_s_settings,
|
||||
proxy_url TYPE string,
|
||||
proxy_port TYPE string,
|
||||
proxy_auth TYPE string,
|
||||
run_critical_tests TYPE abap_bool,
|
||||
max_lines TYPE i,
|
||||
adt_jump_enabled TYPE abap_bool,
|
||||
commitmsg_comment_length TYPE i,
|
||||
commitmsg_body_size TYPE i,
|
||||
END OF ty_s_settings.
|
||||
DATA: ms_settings TYPE ty_s_settings.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_persist_settings DEFINITION FINAL.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS modify
|
||||
IMPORTING
|
||||
io_settings TYPE REF TO lcl_settings
|
||||
RAISING
|
||||
lcx_exception.
|
||||
METHODS read
|
||||
RETURNING
|
||||
VALUE(ro_settings) TYPE REF TO lcl_settings.
|
||||
PRIVATE SECTION.
|
||||
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_persist_background IMPLEMENTATION.
|
||||
|
||||
METHOD constructor.
|
||||
|
@ -1286,6 +1385,170 @@ CLASS lcl_persist_migrate IMPLEMENTATION.
|
|||
migrate_user( ).
|
||||
ENDIF.
|
||||
|
||||
IF settings_exists( ) = abap_false.
|
||||
migrate_settings( ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD settings_exists.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = '' ).
|
||||
rv_exists = abap_true.
|
||||
CATCH lcx_not_found.
|
||||
rv_exists = abap_false.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD migrate_settings.
|
||||
|
||||
DATA: lr_settings TYPE REF TO lcl_settings.
|
||||
DATA: lr_persist_settings TYPE REF TO lcl_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.
|
||||
|
||||
|
||||
CREATE OBJECT lr_persist_settings.
|
||||
CREATE OBJECT lr_settings.
|
||||
lr_settings->set_defaults( ).
|
||||
|
||||
TRY.
|
||||
lr_settings->set_proxy_url(
|
||||
lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_URL' ) ).
|
||||
CATCH lcx_not_found.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lr_settings->set_proxy_port(
|
||||
lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_PORT' ) ).
|
||||
CATCH lcx_not_found.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_flag = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_AUTH' ).
|
||||
lr_settings->set_proxy_authentication( lv_flag ).
|
||||
CATCH lcx_not_found.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_critical_tests_as_string = lcl_app=>db( )->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 lcx_not_found.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_max_lines_as_string = lcl_app=>db( )->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 lcx_not_found cx_sy_conversion_no_number.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_adt_jump_enabled_as_string = lcl_app=>db( )->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 lcx_not_found.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_s_param_value = lcl_app=>db( )->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 lcx_not_found cx_sy_conversion_no_number.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_s_param_value = lcl_app=>db( )->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 lcx_not_found cx_sy_conversion_no_number.
|
||||
ENDTRY.
|
||||
|
||||
lr_persist_settings->modify( io_settings = lr_settings ).
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_URL' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_PORT' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_AUTH' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'CRIT_TESTS' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'MAX_LINES' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'ADT_JUMP' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'COMMENT_LEN' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lcl_app=>db( )->delete(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'BODY_SIZE' ).
|
||||
CATCH lcx_exception.
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD migrate_repo.
|
||||
|
@ -1531,148 +1794,115 @@ CLASS lcl_persist_migrate IMPLEMENTATION.
|
|||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_settings DEFINITION FINAL.
|
||||
|
||||
PUBLIC SECTION.
|
||||
CONSTANTS: c_commitmsg_comment_length_dft TYPE i VALUE 50.
|
||||
CONSTANTS: c_commitmsg_body_size_dft TYPE i VALUE 72.
|
||||
|
||||
METHODS set_proxy_url
|
||||
IMPORTING
|
||||
iv_url TYPE string.
|
||||
METHODS set_proxy_port
|
||||
IMPORTING
|
||||
iv_port TYPE string.
|
||||
METHODS set_proxy_authentication
|
||||
IMPORTING
|
||||
iv_auth TYPE abap_bool.
|
||||
METHODS get_proxy_url
|
||||
RETURNING
|
||||
VALUE(rv_proxy_url) TYPE string.
|
||||
METHODS get_proxy_port
|
||||
RETURNING
|
||||
VALUE(rv_port) TYPE string.
|
||||
METHODS get_proxy_authentication
|
||||
RETURNING
|
||||
VALUE(rv_auth) TYPE abap_bool.
|
||||
METHODS set_run_critical_tests
|
||||
IMPORTING
|
||||
iv_run TYPE abap_bool.
|
||||
METHODS
|
||||
get_run_critical_tests
|
||||
RETURNING VALUE(rv_run) TYPE abap_bool.
|
||||
METHODS set_max_lines
|
||||
IMPORTING iv_lines TYPE i.
|
||||
METHODS get_max_lines
|
||||
RETURNING
|
||||
VALUE(rv_lines) TYPE i.
|
||||
METHODS set_adt_jump_enanbled
|
||||
IMPORTING iv_adt_jump_enabled TYPE abap_bool.
|
||||
METHODS get_adt_jump_enabled
|
||||
RETURNING
|
||||
VALUE(rv_adt_jump_enabled) TYPE abap_bool.
|
||||
METHODS set_commitmsg_comment_length
|
||||
IMPORTING iv_length TYPE i.
|
||||
METHODS get_commitmsg_comment_length
|
||||
RETURNING
|
||||
VALUE(rv_length) TYPE i.
|
||||
METHODS set_commitmsg_body_size
|
||||
IMPORTING iv_length TYPE i.
|
||||
METHODS get_commitmsg_body_size
|
||||
RETURNING
|
||||
VALUE(rv_length) TYPE i.
|
||||
|
||||
PRIVATE SECTION.
|
||||
DATA: mv_proxy_url TYPE string,
|
||||
mv_proxy_port TYPE string,
|
||||
mv_proxy_auth TYPE string,
|
||||
mv_run_critical_tests TYPE abap_bool,
|
||||
mv_lines TYPE i,
|
||||
mv_adt_jump_enabled TYPE abap_bool,
|
||||
mv_commitmsg_comment_length TYPE i,
|
||||
mv_commitmsg_body_size TYPE i.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_settings IMPLEMENTATION.
|
||||
|
||||
METHOD set_proxy_authentication.
|
||||
mv_proxy_auth = iv_auth.
|
||||
ms_settings-proxy_auth = iv_auth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_proxy_authentication.
|
||||
rv_auth = mv_proxy_auth.
|
||||
rv_auth = ms_settings-proxy_auth.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_proxy_url.
|
||||
mv_proxy_url = iv_url.
|
||||
ms_settings-proxy_url = iv_url.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_proxy_url.
|
||||
rv_proxy_url = mv_proxy_url.
|
||||
rv_proxy_url = ms_settings-proxy_url.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_proxy_port.
|
||||
mv_proxy_port = iv_port.
|
||||
ms_settings-proxy_port = iv_port.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_proxy_port.
|
||||
rv_port = mv_proxy_port.
|
||||
rv_port = ms_settings-proxy_port.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_run_critical_tests.
|
||||
mv_run_critical_tests = iv_run.
|
||||
ms_settings-run_critical_tests = iv_run.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_run_critical_tests.
|
||||
rv_run = mv_run_critical_tests.
|
||||
rv_run = ms_settings-run_critical_tests.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_max_lines.
|
||||
rv_lines = mv_lines.
|
||||
rv_lines = ms_settings-max_lines.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_max_lines.
|
||||
mv_lines = iv_lines.
|
||||
ms_settings-max_lines = iv_lines.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_adt_jump_enabled.
|
||||
rv_adt_jump_enabled = mv_adt_jump_enabled.
|
||||
rv_adt_jump_enabled = ms_settings-adt_jump_enabled.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_adt_jump_enanbled.
|
||||
mv_adt_jump_enabled = iv_adt_jump_enabled.
|
||||
ms_settings-adt_jump_enabled = iv_adt_jump_enabled.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_commitmsg_comment_length.
|
||||
rv_length = mv_commitmsg_comment_length.
|
||||
rv_length = ms_settings-commitmsg_comment_length.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_commitmsg_comment_length.
|
||||
mv_commitmsg_comment_length = iv_length.
|
||||
ms_settings-commitmsg_comment_length = iv_length.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_commitmsg_body_size.
|
||||
rv_length = mv_commitmsg_body_size.
|
||||
rv_length = ms_settings-commitmsg_body_size.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_commitmsg_body_size.
|
||||
mv_commitmsg_body_size = iv_length.
|
||||
ms_settings-commitmsg_body_size = iv_length.
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
METHOD get_settings_xml.
|
||||
|
||||
CLASS lcl_persist_settings DEFINITION FINAL.
|
||||
DATA: lr_output TYPE REF TO lcl_xml_output.
|
||||
|
||||
PUBLIC SECTION.
|
||||
METHODS modify
|
||||
IMPORTING
|
||||
io_settings TYPE REF TO lcl_settings
|
||||
RAISING
|
||||
lcx_exception.
|
||||
METHODS read
|
||||
RETURNING
|
||||
VALUE(ro_settings) TYPE REF TO lcl_settings.
|
||||
CREATE OBJECT lr_output.
|
||||
|
||||
lr_output->add( iv_name = lcl_settings=>c_dbtype_settings
|
||||
ig_data = ms_settings ).
|
||||
|
||||
ev_settings_xml = lr_output->render( ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_xml_settings.
|
||||
|
||||
DATA: lr_input TYPE REF TO lcl_xml_input.
|
||||
|
||||
CREATE OBJECT lr_input EXPORTING iv_xml = iv_settings_xml.
|
||||
|
||||
CLEAR ms_settings.
|
||||
|
||||
lr_input->read( EXPORTING iv_name = lcl_settings=>c_dbtype_settings
|
||||
CHANGING cg_data = ms_settings ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_defaults.
|
||||
|
||||
CLEAR ms_settings.
|
||||
|
||||
set_proxy_authentication( abap_false ).
|
||||
|
||||
set_run_critical_tests( abap_false ).
|
||||
|
||||
set_max_lines( 500 ).
|
||||
|
||||
set_adt_jump_enanbled( abap_false ).
|
||||
|
||||
set_commitmsg_comment_length( lcl_settings=>c_commitmsg_comment_length_dft ).
|
||||
|
||||
set_commitmsg_body_size( lcl_settings=>c_commitmsg_body_size_dft ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
@ -1680,140 +1910,27 @@ CLASS lcl_persist_settings IMPLEMENTATION.
|
|||
|
||||
METHOD modify.
|
||||
|
||||
* todo, refactor this class to use XML and only 1 row in the database?
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_URL'
|
||||
iv_data = io_settings->get_proxy_url( ) ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_PORT'
|
||||
iv_data = io_settings->get_proxy_port( ) ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_AUTH'
|
||||
iv_data = io_settings->get_proxy_authentication( ) ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'CRIT_TESTS'
|
||||
iv_data = io_settings->get_run_critical_tests( ) ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'MAX_LINES'
|
||||
iv_data = |{ io_settings->get_max_lines( ) }| ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'ADT_JUMP'
|
||||
iv_data = io_settings->get_adt_jump_enabled( ) ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'COMMENT_LEN'
|
||||
iv_data = |{ io_settings->get_commitmsg_comment_length( ) }| ).
|
||||
|
||||
lcl_app=>db( )->modify(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'BODY_SIZE'
|
||||
iv_data = |{ io_settings->get_commitmsg_body_size( ) }| ).
|
||||
iv_type = lcl_settings=>c_dbtype_settings
|
||||
iv_value = ''
|
||||
iv_data = io_settings->get_settings_xml( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD read.
|
||||
|
||||
DATA: lv_critical_tests_as_string TYPE string,
|
||||
lv_critical_tests_as_boolean TYPE abap_bool,
|
||||
lv_max_lines_as_string TYPE string,
|
||||
lv_flag TYPE abap_bool,
|
||||
lv_max_lines_as_integer TYPE i,
|
||||
lv_s_param_value TYPE string,
|
||||
lv_i_param_value TYPE i,
|
||||
lv_adt_jump_enabled_as_string TYPE string,
|
||||
lv_adt_jump_enabled_as_boolean TYPE abap_bool.
|
||||
|
||||
|
||||
CREATE OBJECT ro_settings.
|
||||
|
||||
TRY.
|
||||
ro_settings->set_proxy_url(
|
||||
lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_URL' ) ).
|
||||
CATCH lcx_not_found.
|
||||
ro_settings->set_proxy_url( '' ).
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
ro_settings->set_proxy_port(
|
||||
lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_PORT' ) ).
|
||||
CATCH lcx_not_found.
|
||||
ro_settings->set_proxy_port( '' ).
|
||||
ENDTRY.
|
||||
ro_settings->set_xml_settings(
|
||||
lcl_app=>db( )->read( iv_type = lcl_settings=>c_dbtype_settings
|
||||
iv_value = '' ) ).
|
||||
|
||||
TRY.
|
||||
lv_flag = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'PROXY_AUTH' ).
|
||||
ro_settings->set_proxy_authentication( lv_flag ).
|
||||
CATCH lcx_not_found.
|
||||
ro_settings->set_proxy_authentication( abap_false ).
|
||||
ENDTRY.
|
||||
CATCH lcx_not_found lcx_exception.
|
||||
|
||||
TRY.
|
||||
lv_critical_tests_as_string = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'CRIT_TESTS' ).
|
||||
lv_critical_tests_as_boolean = lv_critical_tests_as_string.
|
||||
ro_settings->set_run_critical_tests( lv_critical_tests_as_boolean ).
|
||||
CATCH lcx_not_found.
|
||||
ro_settings->set_run_critical_tests( abap_false ).
|
||||
ENDTRY.
|
||||
ro_settings->set_defaults( ).
|
||||
|
||||
TRY.
|
||||
lv_max_lines_as_string = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'MAX_LINES' ).
|
||||
lv_max_lines_as_integer = lv_max_lines_as_string.
|
||||
ro_settings->set_max_lines( lv_max_lines_as_integer ).
|
||||
CATCH lcx_not_found cx_sy_conversion_no_number.
|
||||
ro_settings->set_max_lines( 500 ). " default
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_adt_jump_enabled_as_string = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'ADT_JUMP' ).
|
||||
lv_adt_jump_enabled_as_boolean = lv_adt_jump_enabled_as_string.
|
||||
ro_settings->set_adt_jump_enanbled( lv_adt_jump_enabled_as_boolean ).
|
||||
CATCH lcx_not_found.
|
||||
ro_settings->set_adt_jump_enanbled( abap_false ).
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_s_param_value = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'COMMENT_LEN' ).
|
||||
lv_i_param_value = lv_s_param_value.
|
||||
ro_settings->set_commitmsg_comment_length( lv_i_param_value ).
|
||||
CATCH lcx_not_found cx_sy_conversion_no_number.
|
||||
ro_settings->set_commitmsg_comment_length( lcl_settings=>c_commitmsg_comment_length_dft ). " default
|
||||
ENDTRY.
|
||||
|
||||
TRY.
|
||||
lv_s_param_value = lcl_app=>db( )->read(
|
||||
iv_type = 'SETTINGS'
|
||||
iv_value = 'BODY_SIZE' ).
|
||||
lv_i_param_value = lv_s_param_value.
|
||||
ro_settings->set_commitmsg_body_size( lv_i_param_value ).
|
||||
CATCH lcx_not_found cx_sy_conversion_no_number.
|
||||
ro_settings->set_commitmsg_body_size( lcl_settings=>c_commitmsg_body_size_dft ). " default
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
Loading…
Reference in New Issue
Block a user