Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | CLASS zcl_abapgit_persist_background DEFINITION PUBLIC CREATE PRIVATE GLOBAL FRIENDS zcl_abapgit_persist_factory. PUBLIC SECTION. INTERFACES zif_abapgit_persist_background. METHODS constructor. PROTECTED SECTION. PRIVATE SECTION. DATA mo_db TYPE REF TO zcl_abapgit_persistence_db . METHODS from_xml IMPORTING !iv_string TYPE string RETURNING VALUE(rs_xml) TYPE zif_abapgit_persist_background=>ty_xml RAISING zcx_abapgit_exception . METHODS to_xml IMPORTING !is_background TYPE zif_abapgit_persist_background=>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 from_xml. CALL TRANSFORMATION id OPTIONS value_handling = 'accept_data_loss' SOURCE XML iv_string RESULT data = rs_xml. ENDMETHOD. METHOD to_xml. DATA ls_xml TYPE zif_abapgit_persist_background=>ty_xml. MOVE-CORRESPONDING is_background TO ls_xml. CALL TRANSFORMATION id SOURCE data = ls_xml RESULT XML rv_string. ENDMETHOD. METHOD zif_abapgit_persist_background~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 ). ENDMETHOD. METHOD zif_abapgit_persist_background~exists. TRY. mo_db->read( iv_type = zcl_abapgit_persistence_db=>c_type_background iv_value = iv_key ). rv_yes = abap_true. CATCH zcx_abapgit_not_found. rv_yes = abap_false. ENDTRY. ENDMETHOD. METHOD zif_abapgit_persist_background~get_by_key. DATA: lt_list TYPE zif_abapgit_persist_background=>ty_background_keys. lt_list = zif_abapgit_persist_background~list( ). READ TABLE lt_list WITH KEY key = iv_key INTO rs_data. IF sy-subrc <> 0. RAISE EXCEPTION TYPE zcx_abapgit_not_found. ENDIF. ENDMETHOD. METHOD zif_abapgit_persist_background~list. DATA: lt_list TYPE zif_abapgit_persistence=>ty_contents, ls_xml TYPE zif_abapgit_persist_background=>ty_xml. FIELD-SYMBOLS: <ls_list> LIKE LINE OF lt_list, <ls_output> LIKE LINE OF rt_list. 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. ENDMETHOD. METHOD zif_abapgit_persist_background~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 ) ). ENDMETHOD. ENDCLASS. |