CLASS zcl_abapgit_objects_activation DEFINITION PUBLIC CREATE PUBLIC.

  PUBLIC SECTION.
    CLASS-METHODS add
      IMPORTING iv_type   TYPE trobjtype
                iv_name   TYPE clike
                iv_delete TYPE abap_bool DEFAULT abap_false
      RAISING   zcx_abapgit_exception.

    CLASS-METHODS add_item
      IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item
      RAISING   zcx_abapgit_exception.

    CLASS-METHODS activate
      IMPORTING iv_ddic TYPE abap_bool DEFAULT abap_false
      RAISING   zcx_abapgit_exception.

    CLASS-METHODS clear.

  PRIVATE SECTION.

    CLASS-DATA:
      gt_classes TYPE STANDARD TABLE OF seoclsname WITH DEFAULT KEY,
      gt_objects TYPE TABLE OF dwinactiv.

    CLASS-METHODS update_where_used .
    CLASS-METHODS fix_class_methods
      IMPORTING
        !iv_obj_name TYPE trobj_name
      CHANGING
        !ct_objects  TYPE dwinactiv_tab .
    CLASS-METHODS use_new_activation_logic
      RETURNING
        VALUE(rv_use_new_activation_logic) TYPE abap_bool .
    CLASS-METHODS activate_new
      IMPORTING
        !iv_ddic TYPE abap_bool DEFAULT abap_false
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS activate_old
      IMPORTING
        !iv_ddic TYPE abap_bool DEFAULT abap_false
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS activate_ddic
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS show_activation_errors
      IMPORTING
        !iv_logname TYPE ddmass-logname
      RAISING
        zcx_abapgit_exception .
ENDCLASS.

CLASS ZCL_ABAPGIT_OBJECTS_ACTIVATION IMPLEMENTATION.

  METHOD activate.

    IF use_new_activation_logic( ) = abap_true.
      activate_new( iv_ddic ).
    ELSE.
      activate_old( iv_ddic ).
    ENDIF.

    update_where_used( ).

  ENDMETHOD.                    "activate

  METHOD activate_ddic.

    DATA: lt_gentab     TYPE STANDARD TABLE OF dcgentb,
          ls_gentab     LIKE LINE OF lt_gentab,
          lv_rc         TYPE sy-subrc,
          lt_deltab     TYPE STANDARD TABLE OF dcdeltb,
          lt_action_tab TYPE STANDARD TABLE OF dctablres,
          lv_logname    TYPE ddmass-logname.

    FIELD-SYMBOLS: <ls_object> LIKE LINE OF gt_objects.

    LOOP AT gt_objects ASSIGNING <ls_object>.

      ls_gentab-name = <ls_object>-obj_name.
      ls_gentab-type = <ls_object>-object.
      INSERT ls_gentab INTO TABLE lt_gentab.

    ENDLOOP.

    IF lt_gentab IS NOT INITIAL.

      lv_logname = |ABAPGIT_{ sy-datum }_{ sy-uzeit }|.

      CALL FUNCTION 'DD_MASS_ACT_C3'
        EXPORTING
          ddmode         = 'C'
          medium         = 'T'
          device         = 'T'
          logname        = lv_logname
          write_log      = abap_true
          log_head_tail  = abap_true
          t_on           = space
          prid           = 1
        IMPORTING
          act_rc         = lv_rc
        TABLES
          gentab         = lt_gentab
          deltab         = lt_deltab
          cnvtab         = lt_action_tab
        EXCEPTIONS
          access_failure = 1
          no_objects     = 2
          locked         = 3
          internal_error = 4
          OTHERS         = 5.

      IF sy-subrc <> 0.
        zcx_abapgit_exception=>raise( 'error from DD_MASS_ACT_C3' ).
      ENDIF.

      IF lv_rc > 0.

        show_activation_errors( lv_logname ).

      ENDIF.

    ENDIF.

  ENDMETHOD.

  METHOD activate_new.

    DATA: lo_progress TYPE REF TO zcl_abapgit_progress.

    IF gt_objects IS INITIAL.
      RETURN.
    ENDIF.

    CREATE OBJECT lo_progress
      EXPORTING
        iv_total = 100.

    IF iv_ddic = abap_true.

      lo_progress->show( iv_current = 98
                         iv_text    = 'Activating DDIC' ).

      activate_ddic( ).

    ELSE.

      lo_progress->show( iv_current = 98
                         iv_text    = 'Activating non DDIC' ).

      activate_old( ).

    ENDIF.

  ENDMETHOD.

  METHOD activate_old.

    IF gt_objects IS NOT INITIAL.

      CALL FUNCTION 'RS_WORKING_OBJECTS_ACTIVATE'
        EXPORTING
          activate_ddic_objects  = iv_ddic
          with_popup             = abap_true
        TABLES
          objects                = gt_objects
        EXCEPTIONS
          excecution_error       = 1
          cancelled              = 2
          insert_into_corr_error = 3
          OTHERS                 = 4.
      IF sy-subrc <> 0.
        zcx_abapgit_exception=>raise( 'error from RS_WORKING_OBJECTS_ACTIVATE' ).
      ENDIF.

    ENDIF.

  ENDMETHOD.

  METHOD add.

* function group SEWORKINGAREA
* function module RS_INSERT_INTO_WORKING_AREA
* class CL_WB_ACTIVATION_WORK_AREA

    DATA: lt_objects  TYPE dwinactiv_tab,
          lv_obj_name TYPE dwinactiv-obj_name.

    FIELD-SYMBOLS: <ls_object> LIKE LINE OF lt_objects.

    lv_obj_name = iv_name.

    CASE iv_type.
      WHEN 'CLAS'.
        APPEND iv_name TO gt_classes.
      WHEN 'WDYN'.
* todo, move this to the object type include instead
        CALL FUNCTION 'RS_INACTIVE_OBJECTS_IN_OBJECT'
          EXPORTING
            obj_name         = lv_obj_name
            object           = iv_type
          TABLES
            inactive_objects = lt_objects
          EXCEPTIONS
            object_not_found = 1
            OTHERS           = 2.
        IF sy-subrc <> 0.
          zcx_abapgit_exception=>raise( 'Error from RS_INACTIVE_OBJECTS_IN_OBJECT' ).
        ENDIF.

*        IF iv_type = 'CLAS'.
*          fix_class_methods( EXPORTING iv_obj_name = lv_obj_name
*                             CHANGING ct_objects = lt_objects ).
*        ENDIF.

        LOOP AT lt_objects ASSIGNING <ls_object>.
          <ls_object>-delet_flag = iv_delete.
        ENDLOOP.

        APPEND LINES OF lt_objects TO gt_objects.
      WHEN OTHERS.
        APPEND INITIAL LINE TO gt_objects ASSIGNING <ls_object>.
        <ls_object>-object     = iv_type.
        <ls_object>-obj_name   = lv_obj_name.
        <ls_object>-delet_flag = iv_delete.
    ENDCASE.

  ENDMETHOD.                    "activate

  METHOD add_item.
    add( iv_type = is_item-obj_type
         iv_name = is_item-obj_name ).
  ENDMETHOD.                    "add_item

  METHOD clear.
    CLEAR gt_objects.
    CLEAR gt_classes.
  ENDMETHOD.                    "clear

  METHOD fix_class_methods.
* function module RS_WORKING_OBJECTS_ACTIVATE assumes that
* METH lines contains spaces between class and method name
* however, classes named with 30 characters
* eg. ZCL_CLAS_TESTTESTTESTTESTTESTT
* this will not be true, so find all the method includes instead

* TODO, this class is obsolete with new CLAS deserialization logic

    DATA: lt_methods TYPE seop_methods_w_include,
          lv_class   TYPE seoclsname.

    FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods,
                   <ls_object> LIKE LINE OF ct_objects.

    lv_class = iv_obj_name.

    cl_oo_classname_service=>get_all_method_includes(
      EXPORTING
        clsname            = lv_class
      RECEIVING
        result             = lt_methods
      EXCEPTIONS
        class_not_existing = 1
        OTHERS             = 2 ).
    ASSERT sy-subrc = 0.
    DELETE ct_objects WHERE object = 'METH'.
    LOOP AT lt_methods ASSIGNING <ls_method>.
      APPEND INITIAL LINE TO ct_objects ASSIGNING <ls_object>.
      <ls_object>-object = 'METH'.
      <ls_object>-obj_name = <ls_method>-incname.
    ENDLOOP.

  ENDMETHOD.

  METHOD show_activation_errors.

    DATA: lt_lines      TYPE STANDARD TABLE OF trlog,
          lv_logname_db TYPE ddprh-protname,
          lo_log        TYPE REF TO zcl_abapgit_log.

    FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_lines.

    lv_logname_db = iv_logname.

    CALL FUNCTION 'TR_READ_LOG'
      EXPORTING
        iv_log_type   = 'DB'
        iv_logname_db = lv_logname_db
      TABLES
        et_lines      = lt_lines
      EXCEPTIONS
        invalid_input = 1
        access_error  = 2
        OTHERS        = 3.

    IF sy-subrc <> 0.
      zcx_abapgit_exception=>raise( 'error from TR_READ_LOG' ).
    ENDIF.

    DELETE lt_lines WHERE severity <> 'E'.

    CREATE OBJECT lo_log.

    LOOP AT lt_lines ASSIGNING <ls_line>.
      lo_log->add( <ls_line>-line ).
    ENDLOOP.

    lo_log->show( ).

  ENDMETHOD.

  METHOD update_where_used.

    DATA: lv_class   LIKE LINE OF gt_classes,
          lo_cross   TYPE REF TO cl_wb_crossreference,
          lv_include TYPE programm.

    LOOP AT gt_classes INTO lv_class.
      lv_include = cl_oo_classname_service=>get_classpool_name( lv_class ).

      CREATE OBJECT lo_cross
        EXPORTING
          p_name    = lv_include
          p_include = lv_include.

      lo_cross->index_actualize( ).
    ENDLOOP.

  ENDMETHOD.

  METHOD use_new_activation_logic.

    IF zcl_abapgit_persist_settings=>get_instance( )->read( )->get_experimental_features( ) = abap_true.

      CALL FUNCTION 'FUNCTION_EXISTS'
        EXPORTING
          funcname           = 'DD_MASS_ACT_C3'    " Name of Function Module
        EXCEPTIONS
          function_not_exist = 1
          OTHERS             = 2.

      IF sy-subrc = 0.
        rv_use_new_activation_logic = abap_true.
      ENDIF.

    ENDIF.

  ENDMETHOD.
ENDCLASS.

CLASS zcl_abapgit_objects_activation DEFINITION PUBLIC CREATE PUBLIC.

  PUBLIC SECTION.
    CLASS-METHODS add
      IMPORTING iv_type   TYPE trobjtype
                iv_name   TYPE clike
                iv_delete TYPE abap_bool DEFAULT abap_false
      RAISING   zcx_abapgit_exception.

    CLASS-METHODS add_item
      IMPORTING is_item TYPE zif_abapgit_definitions=>ty_item
      RAISING   zcx_abapgit_exception.

    CLASS-METHODS activate
      IMPORTING iv_ddic TYPE abap_bool DEFAULT abap_false
      RAISING   zcx_abapgit_exception.

    CLASS-METHODS clear.

  PRIVATE SECTION.

    CLASS-DATA:
      gt_classes TYPE STANDARD TABLE OF seoclsname WITH DEFAULT KEY,
      gt_objects TYPE TABLE OF dwinactiv.

    CLASS-METHODS update_where_used .
    CLASS-METHODS fix_class_methods
      IMPORTING
        !iv_obj_name TYPE trobj_name
      CHANGING
        !ct_objects  TYPE dwinactiv_tab .
    CLASS-METHODS use_new_activation_logic
      RETURNING
        VALUE(rv_use_new_activation_logic) TYPE abap_bool .
    CLASS-METHODS activate_new
      IMPORTING
        !iv_ddic TYPE abap_bool DEFAULT abap_false
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS activate_old
      IMPORTING
        !iv_ddic TYPE abap_bool DEFAULT abap_false
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS activate_ddic
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS show_activation_errors
      IMPORTING
        !iv_logname TYPE ddmass-logname
      RAISING
        zcx_abapgit_exception .
ENDCLASS.

CLASS ZCL_ABAPGIT_OBJECTS_ACTIVATION IMPLEMENTATION.

  METHOD activate.

    IF use_new_activation_logic( ) = abap_true.
      activate_new( iv_ddic ).
    ELSE.
      activate_old( iv_ddic ).
    ENDIF.

    update_where_used( ).

  ENDMETHOD.                    "activate

  METHOD activate_ddic.

    DATA: lt_gentab     TYPE STANDARD TABLE OF dcgentb,
          ls_gentab     LIKE LINE OF lt_gentab,
          lv_rc         TYPE sy-subrc,
          lt_deltab     TYPE STANDARD TABLE OF dcdeltb,
          lt_action_tab TYPE STANDARD TABLE OF dctablres,
          lv_logname    TYPE ddmass-logname.

    FIELD-SYMBOLS: <ls_object> LIKE LINE OF gt_objects.

    LOOP AT gt_objects ASSIGNING <ls_object>.

      ls_gentab-name = <ls_object>-obj_name.
      ls_gentab-type = <ls_object>-object.
      INSERT ls_gentab INTO TABLE lt_gentab.

    ENDLOOP.

    IF lt_gentab IS NOT INITIAL.

      lv_logname = |ABAPGIT_{ sy-datum }_{ sy-uzeit }|.

      CALL FUNCTION 'DD_MASS_ACT_C3'
        EXPORTING
          ddmode         = 'C'
          medium         = 'T'
          device         = 'T'
          logname        = lv_logname
          write_log      = abap_true
          log_head_tail  = abap_true
          t_on           = space
          prid           = 1
        IMPORTING
          act_rc         = lv_rc
        TABLES
          gentab         = lt_gentab
          deltab         = lt_deltab
          cnvtab         = lt_action_tab
        EXCEPTIONS
          access_failure = 1
          no_objects     = 2
          locked         = 3
          internal_error = 4
          OTHERS         = 5.

      IF sy-subrc <> 0.
        zcx_abapgit_exception=>raise( 'error from DD_MASS_ACT_C3' ).
      ENDIF.

      IF lv_rc > 0.

        show_activation_errors( lv_logname ).

      ENDIF.

    ENDIF.

  ENDMETHOD.

  METHOD activate_new.

    DATA: lo_progress TYPE REF TO zcl_abapgit_progress.

    IF gt_objects IS INITIAL.
      RETURN.
    ENDIF.

    CREATE OBJECT lo_progress
      EXPORTING
        iv_total = 100.

    IF iv_ddic = abap_true.

      lo_progress->show( iv_current = 98
                         iv_text    = 'Activating DDIC' ).

      activate_ddic( ).

    ELSE.

      lo_progress->show( iv_current = 98
                         iv_text    = 'Activating non DDIC' ).

      activate_old( ).

    ENDIF.

  ENDMETHOD.

  METHOD activate_old.

    IF gt_objects IS NOT INITIAL.

      CALL FUNCTION 'RS_WORKING_OBJECTS_ACTIVATE'
        EXPORTING
          activate_ddic_objects  = iv_ddic
          with_popup             = abap_true
        TABLES
          objects                = gt_objects
        EXCEPTIONS
          excecution_error       = 1
          cancelled              = 2
          insert_into_corr_error = 3
          OTHERS                 = 4.
      IF sy-subrc <> 0.
        zcx_abapgit_exception=>raise( 'error from RS_WORKING_OBJECTS_ACTIVATE' ).
      ENDIF.

    ENDIF.

  ENDMETHOD.

  METHOD add.

* function group SEWORKINGAREA
* function module RS_INSERT_INTO_WORKING_AREA
* class CL_WB_ACTIVATION_WORK_AREA

    DATA: lt_objects  TYPE dwinactiv_tab,
          lv_obj_name TYPE dwinactiv-obj_name.

    FIELD-SYMBOLS: <ls_object> LIKE LINE OF lt_objects.

    lv_obj_name = iv_name.

    CASE iv_type.
      WHEN 'CLAS'.
        APPEND iv_name TO gt_classes.
      WHEN 'WDYN'.
* todo, move this to the object type include instead
        CALL FUNCTION 'RS_INACTIVE_OBJECTS_IN_OBJECT'
          EXPORTING
            obj_name         = lv_obj_name
            object           = iv_type
          TABLES
            inactive_objects = lt_objects
          EXCEPTIONS
            object_not_found = 1
            OTHERS           = 2.
        IF sy-subrc <> 0.
          zcx_abapgit_exception=>raise( 'Error from RS_INACTIVE_OBJECTS_IN_OBJECT' ).
        ENDIF.

*        IF iv_type = 'CLAS'.
*          fix_class_methods( EXPORTING iv_obj_name = lv_obj_name
*                             CHANGING ct_objects = lt_objects ).
*        ENDIF.

        LOOP AT lt_objects ASSIGNING <ls_object>.
          <ls_object>-delet_flag = iv_delete.
        ENDLOOP.

        APPEND LINES OF lt_objects TO gt_objects.
      WHEN OTHERS.
        APPEND INITIAL LINE TO gt_objects ASSIGNING <ls_object>.
        <ls_object>-object     = iv_type.
        <ls_object>-obj_name   = lv_obj_name.
        <ls_object>-delet_flag = iv_delete.
    ENDCASE.

  ENDMETHOD.                    "activate

  METHOD add_item.
    add( iv_type = is_item-obj_type
         iv_name = is_item-obj_name ).
  ENDMETHOD.                    "add_item

  METHOD clear.
    CLEAR gt_objects.
    CLEAR gt_classes.
  ENDMETHOD.                    "clear

  METHOD fix_class_methods.
* function module RS_WORKING_OBJECTS_ACTIVATE assumes that
* METH lines contains spaces between class and method name
* however, classes named with 30 characters
* eg. ZCL_CLAS_TESTTESTTESTTESTTESTT
* this will not be true, so find all the method includes instead

* TODO, this class is obsolete with new CLAS deserialization logic

    DATA: lt_methods TYPE seop_methods_w_include,
          lv_class   TYPE seoclsname.

    FIELD-SYMBOLS: <ls_method> LIKE LINE OF lt_methods,
                   <ls_object> LIKE LINE OF ct_objects.

    lv_class = iv_obj_name.

    cl_oo_classname_service=>get_all_method_includes(
      EXPORTING
        clsname            = lv_class
      RECEIVING
        result             = lt_methods
      EXCEPTIONS
        class_not_existing = 1
        OTHERS             = 2 ).
    ASSERT sy-subrc = 0.
    DELETE ct_objects WHERE object = 'METH'.
    LOOP AT lt_methods ASSIGNING <ls_method>.
      APPEND INITIAL LINE TO ct_objects ASSIGNING <ls_object>.
      <ls_object>-object = 'METH'.
      <ls_object>-obj_name = <ls_method>-incname.
    ENDLOOP.

  ENDMETHOD.

  METHOD show_activation_errors.

    DATA: lt_lines      TYPE STANDARD TABLE OF trlog,
          lv_logname_db TYPE ddprh-protname,
          lo_log        TYPE REF TO zcl_abapgit_log.

    FIELD-SYMBOLS: <ls_line> LIKE LINE OF lt_lines.

    lv_logname_db = iv_logname.

    CALL FUNCTION 'TR_READ_LOG'
      EXPORTING
        iv_log_type   = 'DB'
        iv_logname_db = lv_logname_db
      TABLES
        et_lines      = lt_lines
      EXCEPTIONS
        invalid_input = 1
        access_error  = 2
        OTHERS        = 3.

    IF sy-subrc <> 0.
      zcx_abapgit_exception=>raise( 'error from TR_READ_LOG' ).
    ENDIF.

    DELETE lt_lines WHERE severity <> 'E'.

    CREATE OBJECT lo_log.

    LOOP AT lt_lines ASSIGNING <ls_line>.
      lo_log->add( <ls_line>-line ).
    ENDLOOP.

    lo_log->show( ).

  ENDMETHOD.

  METHOD update_where_used.

    DATA: lv_class    LIKE LINE OF gt_classes,
          lo_cross    TYPE REF TO cl_wb_crossreference,
          lv_include  TYPE programm,
          lo_progress TYPE REF TO zcl_abapgit_progress.

    CREATE OBJECT lo_progress
      EXPORTING
        iv_total = lines( gt_classes ).

    LOOP AT gt_classes INTO lv_class.
      IF sy-tabix MOD 20 = 0.
        lo_progress->show(
          iv_current = sy-tabix
          iv_text    = 'Updating where-used lists' ).
      ENDIF.

      lv_include = cl_oo_classname_service=>get_classpool_name( lv_class ).

      CREATE OBJECT lo_cross
        EXPORTING
          p_name    = lv_include
          p_include = lv_include.

      lo_cross->index_actualize( ).
    ENDLOOP.

  ENDMETHOD.

  METHOD use_new_activation_logic.

    IF zcl_abapgit_persist_settings=>get_instance( )->read( )->get_experimental_features( ) = abap_true.

      CALL FUNCTION 'FUNCTION_EXISTS'
        EXPORTING
          funcname           = 'DD_MASS_ACT_C3'    " Name of Function Module
        EXCEPTIONS
          function_not_exist = 1
          OTHERS             = 2.

      IF sy-subrc = 0.
        rv_use_new_activation_logic = abap_true.
      ENDIF.

    ENDIF.

  ENDMETHOD.
ENDCLASS.

add progress bar, #1190

add progress bar, #1190


CLASS zcl_ags_repo DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    TYPES:
      ty_branches_tt TYPE STANDARD TABLE OF REF TO zcl_ags_branch WITH DEFAULT KEY .

    CLASS-METHODS create
      IMPORTING
        !iv_name        TYPE zags_repos-name
        !iv_description TYPE zags_repos-description
      RETURNING
        VALUE(ro_repo)  TYPE REF TO zcl_ags_repo
      RAISING
        zcx_ags_error .
    CLASS-METHODS get_instance
      IMPORTING
        !iv_name       TYPE zags_repos-name
      RETURNING
        VALUE(ro_repo) TYPE REF TO zcl_ags_repo
      RAISING
        zcx_ags_error .
    CLASS-METHODS list
      RETURNING
        VALUE(rt_list) TYPE zags_repos_tt .
    METHODS constructor
      IMPORTING
        !iv_name TYPE zags_repos-name
      RAISING
        zcx_ags_error .
    METHODS create_branch
      IMPORTING
        !iv_name         TYPE zags_branches-name
        !iv_commit       TYPE zags_sha1
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error .
    METHODS delete
      RAISING
        zcx_ags_error .
    METHODS get_branch
      IMPORTING
        !iv_branch_name  TYPE zags_branch_name
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error .
    METHODS get_data
      RETURNING
        VALUE(rs_data) TYPE zags_repos .
    METHODS get_default_branch
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error .
    METHODS list_branches
      RETURNING
        VALUE(rt_list) TYPE ty_branches_tt
      RAISING
        zcx_ags_error .
    METHODS set_description
      IMPORTING
        !iv_description TYPE zags_repos-description
      RAISING
        zcx_ags_error .
  PROTECTED SECTION.
  PRIVATE SECTION.

    DATA ms_data TYPE zags_repos .

    CLASS-METHODS initial_commit
      IMPORTING
        !iv_repo         TYPE zags_repos-repo
        !iv_name         TYPE clike
      RETURNING
        VALUE(rv_commit) TYPE zags_sha1
      RAISING
        zcx_ags_error .
ENDCLASS.

CLASS ZCL_AGS_REPO IMPLEMENTATION.

  METHOD constructor.

    ms_data = zcl_ags_db=>get_repos( )->single( iv_name ).

  ENDMETHOD.

  METHOD create.

    DATA: ls_repo TYPE zags_repos.

    ASSERT NOT iv_name CA '/\'.
    ASSERT NOT iv_name IS INITIAL.

    TRY.
        zcl_ags_db=>get_repos( )->single( iv_name ).
        RAISE EXCEPTION TYPE zcx_ags_error
          EXPORTING
            textid = zcx_ags_error=>m001.
      CATCH zcx_ags_error ##NO_HANDLER.
    ENDTRY.

    ls_repo-repo        = zcl_ags_util=>uuid( ).
    ls_repo-name        = iv_name.
    ls_repo-description = iv_description.
    ls_repo-head        = 'refs/heads/master' ##no_text.

    zcl_ags_db=>get_repos( )->insert( ls_repo ).

    ro_repo = get_instance( iv_name ).

    ro_repo->create_branch(
      iv_name   = ls_repo-head
      iv_commit = initial_commit(
        iv_repo = ls_repo-repo
        iv_name = iv_name ) ).

  ENDMETHOD.

  METHOD create_branch.

    DATA: ls_branch TYPE zags_branches.

* validate that iv_commit exists?
    zcl_ags_obj_commit=>load(
      iv_repo = ms_data-repo
      iv_sha1 = iv_commit ).

    ls_branch-repo   = ms_data-repo.
    ls_branch-branch = zcl_ags_util=>uuid( ).
    ls_branch-name   = iv_name.
    ls_branch-sha1   = iv_commit.

    zcl_ags_db=>get_branches( )->insert( ls_branch ).

    ro_branch = get_branch( iv_name ).

  ENDMETHOD.

  METHOD delete.

    DATA: lt_branches TYPE ty_branches_tt.

    FIELD-SYMBOLS: <lo_branch> LIKE LINE OF lt_branches.

    lt_branches = list_branches( ).
    LOOP AT lt_branches ASSIGNING <lo_branch>.
      <lo_branch>->delete( ).
    ENDLOOP.

    zcl_ags_db=>get_repos( )->delete( ms_data-name ).

  ENDMETHOD.

  METHOD get_branch.

    DATA: lt_branches TYPE ty_branches_tt.

    lt_branches = list_branches( ).
    LOOP AT lt_branches INTO ro_branch.
      IF ro_branch->get_data( )-name = iv_branch_name
          OR ro_branch->get_data( )-name = 'refs/heads/' && iv_branch_name.
        RETURN.
      ENDIF.
    ENDLOOP.

    ASSERT 0 = 1.

  ENDMETHOD.

  METHOD get_data.

    rs_data = ms_data.

  ENDMETHOD.

  METHOD get_default_branch.

    ro_branch = get_branch( ms_data-head ).

  ENDMETHOD.

  METHOD get_instance.

    CREATE OBJECT ro_repo
      EXPORTING
        iv_name = iv_name.

  ENDMETHOD.

  METHOD initial_commit.

    DATA: lo_blob   TYPE REF TO zcl_ags_obj_blob,
          lo_commit TYPE REF TO zcl_ags_obj_commit,
          lo_tree   TYPE REF TO zcl_ags_obj_tree,
          lv_str    TYPE string,
          lv_user   TYPE string.

    lo_blob = zcl_ags_obj_blob=>new( iv_repo ).
    lv_str = iv_name.
    lo_blob->set_data( zcl_ags_util=>string_to_xstring_utf8( lv_str ) ).
    lo_blob->save( ).

    lo_tree = zcl_ags_obj_tree=>new( iv_repo ).
    lo_tree->add_file( iv_chmod = zcl_ags_obj_tree=>c_chmod-file
                       iv_name  = 'README.md'
                       iv_sha1  = lo_blob->get_sha1( ) ) ##no_text.
    lo_tree->save( ).

    lv_user = |initial <foo@bar.com> { zcl_ags_util=>get_time( ) }|.

    lo_commit = zcl_ags_obj_commit=>new( iv_repo ).
    lo_commit->set_tree( lo_tree->get_sha1( ) ).
    lo_commit->set_author( lv_user ).
    lo_commit->set_committer( lv_user ).
    lo_commit->set_body( 'initial' ) ##no_text.
    lo_commit->save( ).

    rv_commit = lo_commit->get_sha1( ).

  ENDMETHOD.

  METHOD list.

    rt_list = zcl_ags_db=>get_repos( )->list( ).

  ENDMETHOD.

  METHOD list_branches.

    DATA: lt_list   TYPE zags_branches_tt,
          lo_branch TYPE REF TO zcl_ags_branch.

    FIELD-SYMBOLS: <ls_list> LIKE LINE OF lt_list.

    lt_list = zcl_ags_db=>get_branches( )->list( ms_data-repo ).

    LOOP AT lt_list ASSIGNING <ls_list>.
      CREATE OBJECT lo_branch
        EXPORTING
          io_repo = me
          iv_name = <ls_list>-name.

      APPEND lo_branch TO rt_list.
    ENDLOOP.

  ENDMETHOD.

  METHOD set_description.

    zcl_ags_db=>get_repos( )->update_description(
      iv_repo        = ms_data-repo
      iv_description = iv_description ).

    ms_data-description = iv_description.

  ENDMETHOD.
ENDCLASS.

CLASS zcl_ags_repo DEFINITION
  PUBLIC
  CREATE PUBLIC .

  PUBLIC SECTION.

    TYPES:
      ty_branches_tt TYPE STANDARD TABLE OF REF TO zcl_ags_branch WITH DEFAULT KEY .

    CLASS-METHODS create
      IMPORTING
        !iv_name        TYPE zags_repos-name
        !iv_description TYPE zags_repos-description
      RETURNING
        VALUE(ro_repo)  TYPE REF TO zcl_ags_repo
      RAISING
        zcx_ags_error .
    CLASS-METHODS get_instance
      IMPORTING
        !iv_name       TYPE zags_repos-name
      RETURNING
        VALUE(ro_repo) TYPE REF TO zcl_ags_repo
      RAISING
        zcx_ags_error .
    CLASS-METHODS list
      RETURNING
        VALUE(rt_list) TYPE zags_repos_tt .
    METHODS constructor
      IMPORTING
        !iv_name TYPE zags_repos-name
      RAISING
        zcx_ags_error .
    METHODS create_branch
      IMPORTING
        !iv_name         TYPE zags_branches-name
        !iv_commit       TYPE zags_sha1
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error .
    METHODS delete
      RAISING
        zcx_ags_error .
    METHODS get_branch
      IMPORTING
        !iv_branch_name  TYPE zags_branch_name
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error .
    METHODS get_data
      RETURNING
        VALUE(rs_data) TYPE zags_repos .
    METHODS get_default_branch
      RETURNING
        VALUE(ro_branch) TYPE REF TO zcl_ags_branch
      RAISING
        zcx_ags_error .
    METHODS list_branches
      RETURNING
        VALUE(rt_list) TYPE ty_branches_tt
      RAISING
        zcx_ags_error .
    METHODS set_description
      IMPORTING
        !iv_description TYPE zags_repos-description
      RAISING
        zcx_ags_error .
  PROTECTED SECTION.
  PRIVATE SECTION.

    DATA ms_data TYPE zags_repos .

    CLASS-METHODS initial_commit
      IMPORTING
        !iv_repo         TYPE zags_repos-repo
        !iv_name         TYPE clike
      RETURNING
        VALUE(rv_commit) TYPE zags_sha1
      RAISING
        zcx_ags_error .
ENDCLASS.

CLASS ZCL_AGS_REPO IMPLEMENTATION.

  METHOD constructor.

    ms_data = zcl_ags_db=>get_repos( )->single( iv_name ).

  ENDMETHOD.

  METHOD create.

    DATA: ls_repo TYPE zags_repos.

    ASSERT NOT iv_name CA '/\ '.
    ASSERT NOT iv_name IS INITIAL.

    TRY.
        zcl_ags_db=>get_repos( )->single( iv_name ).
        RAISE EXCEPTION TYPE zcx_ags_error
          EXPORTING
            textid = zcx_ags_error=>m001.
      CATCH zcx_ags_error ##NO_HANDLER.
    ENDTRY.

    ls_repo-repo        = zcl_ags_util=>uuid( ).
    ls_repo-name        = iv_name.
    ls_repo-description = iv_description.
    ls_repo-head        = 'refs/heads/master' ##no_text.

    zcl_ags_db=>get_repos( )->insert( ls_repo ).

    ro_repo = get_instance( iv_name ).

    ro_repo->create_branch(
      iv_name   = ls_repo-head
      iv_commit = initial_commit(
        iv_repo = ls_repo-repo
        iv_name = iv_name ) ).

  ENDMETHOD.

  METHOD create_branch.

    DATA: ls_branch TYPE zags_branches.

* validate that iv_commit exists?
    zcl_ags_obj_commit=>load(
      iv_repo = ms_data-repo
      iv_sha1 = iv_commit ).

    ls_branch-repo   = ms_data-repo.
    ls_branch-branch = zcl_ags_util=>uuid( ).
    ls_branch-name   = iv_name.
    ls_branch-sha1   = iv_commit.

    zcl_ags_db=>get_branches( )->insert( ls_branch ).

    ro_branch = get_branch( iv_name ).

  ENDMETHOD.

  METHOD delete.

    DATA: lt_branches TYPE ty_branches_tt.

    FIELD-SYMBOLS: <lo_branch> LIKE LINE OF lt_branches.

    lt_branches = list_branches( ).
    LOOP AT lt_branches ASSIGNING <lo_branch>.
      <lo_branch>->delete( ).
    ENDLOOP.

    zcl_ags_db=>get_repos( )->delete( ms_data-name ).

  ENDMETHOD.

  METHOD get_branch.

    DATA: lt_branches TYPE ty_branches_tt.

    lt_branches = list_branches( ).
    LOOP AT lt_branches INTO ro_branch.
      IF ro_branch->get_data( )-name = iv_branch_name
          OR ro_branch->get_data( )-name = 'refs/heads/' && iv_branch_name.
        RETURN.
      ENDIF.
    ENDLOOP.

    ASSERT 0 = 1.

  ENDMETHOD.

  METHOD get_data.

    rs_data = ms_data.

  ENDMETHOD.

  METHOD get_default_branch.

    ro_branch = get_branch( ms_data-head ).

  ENDMETHOD.

  METHOD get_instance.

    CREATE OBJECT ro_repo
      EXPORTING
        iv_name = iv_name.

  ENDMETHOD.

  METHOD initial_commit.

    DATA: lo_blob   TYPE REF TO zcl_ags_obj_blob,
          lo_commit TYPE REF TO zcl_ags_obj_commit,
          lo_tree   TYPE REF TO zcl_ags_obj_tree,
          lv_str    TYPE string,
          lv_user   TYPE string.

    lo_blob = zcl_ags_obj_blob=>new( iv_repo ).
    lv_str = iv_name.
    lo_blob->set_data( zcl_ags_util=>string_to_xstring_utf8( lv_str ) ).
    lo_blob->save( ).

    lo_tree = zcl_ags_obj_tree=>new( iv_repo ).
    lo_tree->add_file( iv_chmod = zcl_ags_obj_tree=>c_chmod-file
                       iv_name  = 'README.md'
                       iv_sha1  = lo_blob->get_sha1( ) ) ##no_text.
    lo_tree->save( ).

    lv_user = |initial <foo@bar.com> { zcl_ags_util=>get_time( ) }|.

    lo_commit = zcl_ags_obj_commit=>new( iv_repo ).
    lo_commit->set_tree( lo_tree->get_sha1( ) ).
    lo_commit->set_author( lv_user ).
    lo_commit->set_committer( lv_user ).
    lo_commit->set_body( 'initial' ) ##no_text.
    lo_commit->save( ).

    rv_commit = lo_commit->get_sha1( ).

  ENDMETHOD.

  METHOD list.

    rt_list = zcl_ags_db=>get_repos( )->list( ).

  ENDMETHOD.

  METHOD list_branches.

    DATA: lt_list   TYPE zags_branches_tt,
          lo_branch TYPE REF TO zcl_ags_branch.

    FIELD-SYMBOLS: <ls_list> LIKE LINE OF lt_list.

    lt_list = zcl_ags_db=>get_branches( )->list( ms_data-repo ).

    LOOP AT lt_list ASSIGNING <ls_list>.
      CREATE OBJECT lo_branch
        EXPORTING
          io_repo = me
          iv_name = <ls_list>-name.

      APPEND lo_branch TO rt_list.
    ENDLOOP.

  ENDMETHOD.

  METHOD set_description.

    zcl_ags_db=>get_repos( )->update_description(
      iv_repo        = ms_data-repo
      iv_description = iv_description ).

    ms_data-description = iv_description.

  ENDMETHOD.
ENDCLASS.

Fix issue #143 (#144)

Fix issue #143 (#144)

Though in a rather crude way, this prevents the creation of a repo with a blank space in the name. Prevents later trouble in browsing (see issue #87)


CLASS zcl_ags_branch DEFINITION
  PUBLIC
  CREATE PUBLIC.

  PUBLIC SECTION.

    METHODS delete.
    METHODS get_data
      RETURNING
        VALUE(rs_data) TYPE zags_branches.
    CLASS-METHODS create
      IMPORTING
        !io_repo   TYPE REF TO zcl_ags_repo
        !iv_name   TYPE zags_branches-name
        !iv_commit TYPE zags_sha1
      RAISING
        zcx_ags_error.
    METHODS constructor
      IMPORTING
        !io_repo TYPE REF TO zcl_ags_repo
        !iv_name TYPE zags_branches-name
      RAISING
        zcx_ags_error.
    METHODS update_sha1
      IMPORTING
        !iv_sha1 TYPE zags_sha1.
PROTECTED SECTION.
  PRIVATE SECTION.

    DATA ms_data TYPE zags_branches.
ENDCLASS.

CLASS ZCL_AGS_BRANCH IMPLEMENTATION.

  METHOD constructor.

    DATA: lv_repo TYPE zags_repos.

    lv_repo = io_repo->get_data( )-repo.

    SELECT SINGLE * FROM zags_branches INTO ms_data
      WHERE name = iv_name
      AND repo = lv_repo.
    IF sy-subrc <> 0.
      RAISE EXCEPTION TYPE zcx_ags_error
        EXPORTING
          textid = zcx_ags_error=>m002.
    ENDIF.

  ENDMETHOD.

  METHOD create.

    DATA: ls_branch TYPE zags_branches.

* todo, validate that iv_commit exists?

    ls_branch-repo   = io_repo->get_data( )-repo.
    ls_branch-branch = zcl_ags_util=>uuid( ).
    ls_branch-name   = iv_name.
    ls_branch-sha1   = iv_commit.

    INSERT zags_branches FROM ls_branch.
    ASSERT sy-subrc = 0.

  ENDMETHOD.

  METHOD delete.

    DELETE FROM zags_branches
      WHERE repo = ms_data-repo
      AND name = ms_data-name.
    ASSERT sy-subrc = 0.

* todo, delete unreferenced objects?

  ENDMETHOD.

  METHOD get_data.

    rs_data = ms_data.

  ENDMETHOD.

  METHOD update_sha1.

    ASSERT NOT iv_sha1 IS INITIAL.

    UPDATE zags_branches SET sha1 = iv_sha1
      WHERE repo = ms_data-repo
      AND branch = ms_data-branch.
    ASSERT sy-subrc = 0.

  ENDMETHOD.
ENDCLASS.

fix lint error

fix lint error


"! Message logger base class
"!

"! Inherit from this class and implement entry_internal and ideally overwrite
"! entry_msg_internal for the logging logic.
"!

class ZCL_ALOG_MSG_LOGGER_BASE definition
  public
  inheriting from ZCL_ALOG_LOGGER_BASE
  abstract
  create public .

public section.

  interfaces ZIF_ALOG_BAPIRET_LOGGER .
  interfaces ZIF_ALOG_MSG_LOGGER .

  aliases DEBUG_MSG
    for ZIF_ALOG_MSG_LOGGER~DEBUG_MSG .
  aliases ENTRY_BAPIRET
    for ZIF_ALOG_BAPIRET_LOGGER~ENTRY_BAPIRET .
  aliases ENTRY_BAPIRET_TABLE
    for ZIF_ALOG_BAPIRET_LOGGER~ENTRY_BAPIRET_TABLE .
  aliases ENTRY_MSG
    for ZIF_ALOG_MSG_LOGGER~ENTRY_MSG .
  aliases ERROR_MSG
    for ZIF_ALOG_MSG_LOGGER~ERROR_MSG .
  aliases INFO_MSG
    for ZIF_ALOG_MSG_LOGGER~INFO_MSG .
  aliases WARNING_MSG
    for ZIF_ALOG_MSG_LOGGER~WARNING_MSG .
  PROTECTED SECTION.
    METHODS:
      inform_attached_loggers REDEFINITION,
      "! Inform attached loggers using a message class message
      "! @parameter iv_msgid | Message id
      "! @parameter iv_msgno | Message number
      "! @parameter iv_msgty | Message type
      "! @parameter iv_msgv1 | Message variable 1
      "! @parameter iv_msgv2 | Message variable 2
      "! @parameter iv_msgv3 | Message variable 3
      "! @parameter iv_msgv4 | Message variable 4
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Message type unsupported
      inform_attached_loggers_msg IMPORTING VALUE(iv_msgid) TYPE syst_msgid DEFAULT sy-msgid
                                            VALUE(iv_msgno) TYPE syst_msgno DEFAULT sy-msgno
                                            VALUE(iv_msgty) TYPE syst_msgty DEFAULT sy-msgty
                                            VALUE(iv_msgv1) TYPE syst_msgv DEFAULT sy-msgv1
                                            VALUE(iv_msgv2) TYPE syst_msgv DEFAULT sy-msgv2
                                            VALUE(iv_msgv3) TYPE syst_msgv DEFAULT sy-msgv3
                                            VALUE(iv_msgv4) TYPE syst_msgv DEFAULT sy-msgv4
                                  RAISING   zcx_alog_logging_failed
                                            zcx_alog_unsupported_msgty,
      "! Internal implementation of zif_alog_msg_logger-&gtentry_msg( ) to do the logging
      "!

      "! Default implementation redirects the message to entry( ), overwrite in subclasses
      "! to provide message class specific logic.
      "!

      "! @parameter iv_msgid | Message id
      "! @parameter iv_msgno | Message number
      "! @parameter iv_msgty | Message type
      "! @parameter iv_msgv1 | Message variable 1
      "! @parameter iv_msgv2 | Message variable 2
      "! @parameter iv_msgv3 | Message variable 3
      "! @parameter iv_msgv4 | Message variable 4
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Message type unsupported
      entry_msg_internal IMPORTING VALUE(iv_msgid) TYPE syst_msgid DEFAULT sy-msgid
                                   VALUE(iv_msgno) TYPE syst_msgno DEFAULT sy-msgno
                                   VALUE(iv_msgty) TYPE syst_msgty DEFAULT sy-msgty
                                   VALUE(iv_msgv1) TYPE syst_msgv DEFAULT sy-msgv1
                                   VALUE(iv_msgv2) TYPE syst_msgv DEFAULT sy-msgv2
                                   VALUE(iv_msgv3) TYPE syst_msgv DEFAULT sy-msgv3
                                   VALUE(iv_msgv4) TYPE syst_msgv DEFAULT sy-msgv4
                         RAISING   zcx_alog_logging_failed
                                   zcx_alog_unsupported_msgty.
private section.

  data MV_BLOCK_ENTRY_INFORM type ABAP_BOOL .
ENDCLASS.

CLASS ZCL_ALOG_MSG_LOGGER_BASE IMPLEMENTATION.

  METHOD entry_msg_internal.
    " Default implementation just redirects to entry( )
    MESSAGE ID iv_msgid TYPE iv_msgty NUMBER iv_msgno
            WITH iv_msgv1 iv_msgv2 iv_msgv3 iv_msgv4
            INTO DATA(lv_msg_text).

    " Attached loggers are already informed
    mv_block_entry_inform = abap_true.
    entry( iv_text = lv_msg_text io_type = zcl_alog_entry_type=>from_msgty( iv_msgty ) ).
    mv_block_entry_inform = abap_false.
  ENDMETHOD.

  METHOD inform_attached_loggers.
    " Inform attached loggers only if they were not already already informed by entry_msg( )
    IF mv_block_entry_inform = abap_false.
      super->inform_attached_loggers( iv_text = iv_text io_type = io_type ).
    ENDIF.
  ENDMETHOD.

  METHOD inform_attached_loggers_msg.
    DATA: li_msg_logger TYPE REF TO zif_alog_msg_logger.

    LOOP AT mt_attached_loggers ASSIGNING FIELD-SYMBOL(<li_logger>).
      " Is it a message logger?
      IF CAST cl_abap_objectdescr(
           CAST cl_abap_refdescr( cl_abap_typedescr=>describe_by_data( li_msg_logger )
           )->get_referenced_type( )
         )->applies_to( <li_logger> ) = abap_true.

        " If it is inform it using entry_msg( )
        li_msg_logger ?= <li_logger>.
        li_msg_logger->entry_msg( iv_msgid = iv_msgid
                                  iv_msgno = iv_msgno
                                  iv_msgty = iv_msgty
                                  iv_msgv1 = iv_msgv1
                                  iv_msgv2 = iv_msgv2
                                  iv_msgv3 = iv_msgv3
                                  iv_msgv4 = iv_msgv4 ).
        FREE li_msg_logger.
      ELSE. " If it is not fall back to entry( )
        MESSAGE ID iv_msgid TYPE iv_msgty NUMBER iv_msgno
                WITH iv_msgv1 iv_msgv2 iv_msgv3 iv_msgv4
                INTO DATA(lv_msg_text).

        <li_logger>->entry( iv_text = lv_msg_text
                            io_type = zcl_alog_entry_type=>from_msgty( iv_msgty ) ).
      ENDIF.
    ENDLOOP.
  ENDMETHOD.

  METHOD zif_alog_bapiret_logger~entry_bapiret.
    entry_msg( iv_msgid = is_return-id
               iv_msgno = is_return-number
               iv_msgty = is_return-type
               iv_msgv1 = is_return-message_v1
               iv_msgv2 = is_return-message_v2
               iv_msgv3 = is_return-message_v3
               iv_msgv4 = is_return-message_v4 ).
  ENDMETHOD.

  METHOD zif_alog_bapiret_logger~entry_bapiret_table.
    LOOP AT it_return ASSIGNING FIELD-SYMBOL(<ls_return>).
      entry_bapiret( <ls_return> ).
    ENDLOOP.
  ENDMETHOD.

  METHOD zif_alog_msg_logger~debug_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'I'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.

  METHOD zif_alog_msg_logger~entry_msg.
    inform_attached_loggers_msg( iv_msgid = iv_msgid
                                 iv_msgno = iv_msgno
                                 iv_msgty = iv_msgty
                                 iv_msgv1 = iv_msgv1
                                 iv_msgv2 = iv_msgv2
                                 iv_msgv3 = iv_msgv3
                                 iv_msgv4 = iv_msgv4 ).

    IF get_minimal_log_level( )->compare_priority_to(
         zcl_alog_entry_type=>from_msgty( iv_msgty )
       ) <= 0.

      entry_msg_internal( iv_msgid = iv_msgid
                          iv_msgno = iv_msgno
                          iv_msgty = iv_msgty
                          iv_msgv1 = iv_msgv1
                          iv_msgv2 = iv_msgv2
                          iv_msgv3 = iv_msgv3
                          iv_msgv4 = iv_msgv4 ).
    ENDIF.
  ENDMETHOD.

  METHOD zif_alog_msg_logger~error_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'E'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.

  METHOD zif_alog_msg_logger~info_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'I'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.

  METHOD zif_alog_msg_logger~warning_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'W'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.
ENDCLASS.

"! Message logger base class
"!

"! Inherit from this class and implement entry_internal and ideally overwrite
"! entry_msg_internal for the logging logic.
"!

CLASS zcl_alog_msg_logger_base DEFINITION
  PUBLIC
  INHERITING FROM zcl_alog_logger_base
  ABSTRACT
  CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES:
      zif_alog_bapiret_logger,
      zif_alog_msg_logger.
    ALIASES:
     debug_msg FOR zif_alog_msg_logger~debug_msg,
     entry_bapiret FOR zif_alog_bapiret_logger~entry_bapiret,
     entry_bapiret_table FOR zif_alog_bapiret_logger~entry_bapiret_table,
     entry_msg FOR zif_alog_msg_logger~entry_msg,
     error_msg FOR zif_alog_msg_logger~error_msg,
     info_msg FOR zif_alog_msg_logger~info_msg,
     warning_msg FOR zif_alog_msg_logger~warning_msg.
  PROTECTED SECTION.
    METHODS:
      inform_attached_loggers REDEFINITION,
      "! Inform attached loggers using a message class message
      "! @parameter iv_msgid | Message id
      "! @parameter iv_msgno | Message number
      "! @parameter iv_msgty | Message type
      "! @parameter iv_msgv1 | Message variable 1
      "! @parameter iv_msgv2 | Message variable 2
      "! @parameter iv_msgv3 | Message variable 3
      "! @parameter iv_msgv4 | Message variable 4
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Message type unsupported
      inform_attached_loggers_msg IMPORTING VALUE(iv_msgid) TYPE syst_msgid DEFAULT sy-msgid
                                            VALUE(iv_msgno) TYPE syst_msgno DEFAULT sy-msgno
                                            VALUE(iv_msgty) TYPE syst_msgty DEFAULT sy-msgty
                                            VALUE(iv_msgv1) TYPE syst_msgv DEFAULT sy-msgv1
                                            VALUE(iv_msgv2) TYPE syst_msgv DEFAULT sy-msgv2
                                            VALUE(iv_msgv3) TYPE syst_msgv DEFAULT sy-msgv3
                                            VALUE(iv_msgv4) TYPE syst_msgv DEFAULT sy-msgv4
                                  RAISING   zcx_alog_logging_failed
                                            zcx_alog_unsupported_msgty,
      "! Internal implementation of zif_alog_msg_logger-&gtentry_msg( ) to do the logging
      "!

      "! Default implementation redirects the message to entry( ), overwrite in subclasses
      "! to provide message class specific logic.
      "!

      "! @parameter iv_msgid | Message id
      "! @parameter iv_msgno | Message number
      "! @parameter iv_msgty | Message type
      "! @parameter iv_msgv1 | Message variable 1
      "! @parameter iv_msgv2 | Message variable 2
      "! @parameter iv_msgv3 | Message variable 3
      "! @parameter iv_msgv4 | Message variable 4
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Message type unsupported
      entry_msg_internal IMPORTING VALUE(iv_msgid) TYPE syst_msgid DEFAULT sy-msgid
                                   VALUE(iv_msgno) TYPE syst_msgno DEFAULT sy-msgno
                                   VALUE(iv_msgty) TYPE syst_msgty DEFAULT sy-msgty
                                   VALUE(iv_msgv1) TYPE syst_msgv DEFAULT sy-msgv1
                                   VALUE(iv_msgv2) TYPE syst_msgv DEFAULT sy-msgv2
                                   VALUE(iv_msgv3) TYPE syst_msgv DEFAULT sy-msgv3
                                   VALUE(iv_msgv4) TYPE syst_msgv DEFAULT sy-msgv4
                         RAISING   zcx_alog_logging_failed
                                   zcx_alog_unsupported_msgty.
  PRIVATE SECTION.
    DATA:
      mv_block_entry_inform TYPE abap_bool .
ENDCLASS.

CLASS zcl_alog_msg_logger_base IMPLEMENTATION.
  METHOD entry_msg_internal.
    " Default implementation just redirects to entry( )
    MESSAGE ID iv_msgid TYPE iv_msgty NUMBER iv_msgno
            WITH iv_msgv1 iv_msgv2 iv_msgv3 iv_msgv4
            INTO DATA(lv_msg_text).

    " Attached loggers are already informed
    mv_block_entry_inform = abap_true.
    entry( iv_text = lv_msg_text io_type = zcl_alog_entry_type=>from_msgty( iv_msgty ) ).
    mv_block_entry_inform = abap_false.
  ENDMETHOD.

  METHOD inform_attached_loggers.
    " Inform attached loggers only if they were not already already informed by entry_msg( )
    IF mv_block_entry_inform = abap_false.
      super->inform_attached_loggers( iv_text = iv_text io_type = io_type ).
    ENDIF.
  ENDMETHOD.

  METHOD inform_attached_loggers_msg.
    DATA: li_msg_logger TYPE REF TO zif_alog_msg_logger.

    LOOP AT mt_attached_loggers ASSIGNING FIELD-SYMBOL(<li_logger>).
      " Is it a message logger?
      IF CAST cl_abap_objectdescr(
           CAST cl_abap_refdescr( cl_abap_typedescr=>describe_by_data( li_msg_logger )
           )->get_referenced_type( )
         )->applies_to( <li_logger> ) = abap_true.

        " If it is inform it using entry_msg( )
        li_msg_logger ?= <li_logger>.
        li_msg_logger->entry_msg( iv_msgid = iv_msgid
                                  iv_msgno = iv_msgno
                                  iv_msgty = iv_msgty
                                  iv_msgv1 = iv_msgv1
                                  iv_msgv2 = iv_msgv2
                                  iv_msgv3 = iv_msgv3
                                  iv_msgv4 = iv_msgv4 ).
        FREE li_msg_logger.
      ELSE. " If it is not fall back to entry( )
        MESSAGE ID iv_msgid TYPE iv_msgty NUMBER iv_msgno
                WITH iv_msgv1 iv_msgv2 iv_msgv3 iv_msgv4
                INTO DATA(lv_msg_text).

        <li_logger>->entry( iv_text = lv_msg_text
                            io_type = zcl_alog_entry_type=>from_msgty( iv_msgty ) ).
      ENDIF.
    ENDLOOP.
  ENDMETHOD.

  METHOD zif_alog_bapiret_logger~entry_bapiret.
    entry_msg( iv_msgid = is_return-id
               iv_msgno = is_return-number
               iv_msgty = is_return-type
               iv_msgv1 = is_return-message_v1
               iv_msgv2 = is_return-message_v2
               iv_msgv3 = is_return-message_v3
               iv_msgv4 = is_return-message_v4 ).
  ENDMETHOD.

  METHOD zif_alog_bapiret_logger~entry_bapiret_table.
    LOOP AT it_return ASSIGNING FIELD-SYMBOL(<ls_return>).
      entry_bapiret( <ls_return> ).
    ENDLOOP.
  ENDMETHOD.

  METHOD zif_alog_msg_logger~debug_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'I'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.

  METHOD zif_alog_msg_logger~entry_msg.
    inform_attached_loggers_msg( iv_msgid = iv_msgid
                                 iv_msgno = iv_msgno
                                 iv_msgty = iv_msgty
                                 iv_msgv1 = iv_msgv1
                                 iv_msgv2 = iv_msgv2
                                 iv_msgv3 = iv_msgv3
                                 iv_msgv4 = iv_msgv4 ).

    IF get_minimal_log_level( )->compare_priority_to(
         zcl_alog_entry_type=>from_msgty( iv_msgty )
       ) <= 0.

      entry_msg_internal( iv_msgid = iv_msgid
                          iv_msgno = iv_msgno
                          iv_msgty = iv_msgty
                          iv_msgv1 = iv_msgv1
                          iv_msgv2 = iv_msgv2
                          iv_msgv3 = iv_msgv3
                          iv_msgv4 = iv_msgv4 ).
    ENDIF.
  ENDMETHOD.

  METHOD zif_alog_msg_logger~error_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'E'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.

  METHOD zif_alog_msg_logger~info_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'I'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.

  METHOD zif_alog_msg_logger~warning_msg.
    entry_msg( iv_msgid = iv_msgid
               iv_msgno = iv_msgno
               iv_msgty = 'W'
               iv_msgv1 = iv_msgv1
               iv_msgv2 = iv_msgv2
               iv_msgv3 = iv_msgv3
               iv_msgv4 = iv_msgv4 ).
  ENDMETHOD.
ENDCLASS.

Fix indentation

Fix indentation


CLASS zcl_abapgit_object_enho_wdyc DEFINITION PUBLIC.

  PUBLIC SECTION.
    METHODS: constructor
      IMPORTING
        is_item  TYPE zif_abapgit_definitions=>ty_item
        io_files TYPE REF TO zcl_abapgit_objects_files.
    INTERFACES: zif_abapgit_object_enho.

  PRIVATE SECTION.
    DATA: ms_item  TYPE zif_abapgit_definitions=>ty_item.

ENDCLASS.

CLASS zcl_abapgit_object_enho_wdyc IMPLEMENTATION.

  METHOD constructor.
    ms_item = is_item.
  ENDMETHOD.

  METHOD zif_abapgit_object_enho~deserialize.

    DATA: lv_enhname TYPE enhname,
          lo_wdyconf TYPE REF TO cl_wdr_cfg_enhancement,
          li_tool    TYPE REF TO if_enh_tool,
          ls_obj     TYPE wdy_config_key,
          lv_package TYPE devclass.

    ii_xml->read( EXPORTING iv_name = 'ORIGINAL_OBJECT'
                  CHANGING cg_data  = ls_obj ).

    lv_enhname = ms_item-obj_name.
    lv_package = iv_package.
    TRY.
        cl_enh_factory=>create_enhancement(
          EXPORTING
            enhname     = lv_enhname
            enhtype     = ''
            enhtooltype = cl_wdr_cfg_enhancement=>tooltype
          IMPORTING
            enhancement = li_tool
          CHANGING
            devclass    = lv_package ).
        lo_wdyconf ?= li_tool.

* todo
* io_xml->read_xml()
* CL_WDR_CFG_PERSISTENCE_UTILS=>COMP_XML_TO_TABLES( )
* lo_wdyconf->set_enhancement_data( )
        ASSERT 0 = 1.

        lo_wdyconf->if_enh_object~save( run_dark = abap_true ).
        lo_wdyconf->if_enh_object~unlock( ).
      CATCH cx_enh_root.
        zcx_abapgit_exception=>raise( 'error deserializing ENHO wdyconf' ).
    ENDTRY.

  ENDMETHOD.

  METHOD zif_abapgit_object_enho~serialize.

    DATA: lo_wdyconf  TYPE REF TO cl_wdr_cfg_enhancement,
          lt_data     TYPE wdy_cfg_expl_data_tab,
          ls_outline  TYPE wdy_cfg_outline_data,
          ls_obj      TYPE wdy_config_key,
          li_document TYPE REF TO if_ixml_document,
          li_element  TYPE REF TO if_ixml_element.

    lo_wdyconf ?= ii_enh_tool.

    ls_obj = lo_wdyconf->get_original_object( ).
    ii_xml->add( iv_name = 'TOOL'
                 ig_data = ii_enh_tool->get_tool( ) ).
    ii_xml->add( iv_name = 'ORIGINAL_OBJECT'
                 ig_data = ls_obj ).

* only works on new ABAP versions, parameters differ between versions
    CALL METHOD lo_wdyconf->('GET_ENHANCEMENT_DATA')
      EXPORTING
        p_scope    = 1
      IMPORTING
        p_enh_data = lt_data.

    CALL METHOD cl_wdr_cfg_persistence_utils=>('COMP_TABLES_TO_XML')
      EXPORTING
        outline_data  = ls_outline
        expl_data_tab = lt_data
      IMPORTING
        element       = li_element
      CHANGING
        document      = li_document.

    ii_xml->add_xml( iv_name = 'ENHANCEMENT_DATA'
                     ii_xml = li_element ).

  ENDMETHOD.

ENDCLASS.

CLASS zcl_abapgit_object_enho_wdyc DEFINITION PUBLIC.

  PUBLIC SECTION.
    METHODS: constructor
      IMPORTING
        is_item  TYPE zif_abapgit_definitions=>ty_item
        io_files TYPE REF TO zcl_abapgit_objects_files.
    INTERFACES: zif_abapgit_object_enho.

  PRIVATE SECTION.
    DATA: ms_item  TYPE zif_abapgit_definitions=>ty_item.

ENDCLASS.

CLASS zcl_abapgit_object_enho_wdyc IMPLEMENTATION.

  METHOD constructor.
    ms_item = is_item.
  ENDMETHOD.

  METHOD zif_abapgit_object_enho~deserialize.

    DATA: lv_enhname TYPE enhname,
          lo_wdyconf TYPE REF TO cl_wdr_cfg_enhancement,
          li_tool    TYPE REF TO if_enh_tool,
          ls_obj     TYPE wdy_config_key,
          lv_xml     TYPE string,
          lt_data    TYPE wdy_cfg_expl_data_tab,
          lv_package TYPE devclass.

    ii_xml->read( EXPORTING iv_name = 'ORIGINAL_OBJECT'
                  CHANGING  cg_data = ls_obj ).

    ii_xml->read( EXPORTING iv_name = 'ENHANCEMENT_DATA'
                  CHANGING  cg_data = lv_xml ).

    lv_enhname = ms_item-obj_name.
    lv_package = iv_package.
    TRY.
        cl_enh_factory=>create_enhancement(
          EXPORTING
            enhname     = lv_enhname
            enhtype     = ''
            enhtooltype = cl_wdr_cfg_enhancement=>tooltype
          IMPORTING
            enhancement = li_tool
          CHANGING
            devclass    = lv_package ).

        lo_wdyconf ?= li_tool.

        CALL METHOD cl_wdr_cfg_persistence_utils=>('COMP_XML_TO_TABLES')
          EXPORTING
            xml_content   = lv_xml
          IMPORTING
            expl_data_tab = lt_data.

* only works on new ABAP versions, parameters differ between versions
        CALL METHOD lo_wdyconf->('SET_ENHANCEMENT_DATA')
          EXPORTING
            p_enh_data = lt_data.

        lo_wdyconf->if_enh_object~save( run_dark = abap_true ).
        lo_wdyconf->if_enh_object~unlock( ).
      CATCH cx_enh_root cx_static_check.
        zcx_abapgit_exception=>raise( 'error deserializing ENHO wdyconf' ).
    ENDTRY.
  ENDMETHOD.

  METHOD zif_abapgit_object_enho~serialize.

    DATA: lo_wdyconf  TYPE REF TO cl_wdr_cfg_enhancement,
          lt_data     TYPE wdy_cfg_expl_data_tab,
          ls_outline  TYPE wdy_cfg_outline_data,
          ls_obj      TYPE wdy_config_key,
          li_document TYPE REF TO if_ixml_document,
          li_element  TYPE REF TO if_ixml_element.

    lo_wdyconf ?= ii_enh_tool.

    ls_obj = lo_wdyconf->get_original_object( ).
    ii_xml->add( iv_name = 'TOOL'
                 ig_data = ii_enh_tool->get_tool( ) ).
    ii_xml->add( iv_name = 'ORIGINAL_OBJECT'
                 ig_data = ls_obj ).

* only works on new ABAP versions, parameters differ between versions
    CALL METHOD lo_wdyconf->('GET_ENHANCEMENT_DATA')
      EXPORTING
        p_scope    = 1
      IMPORTING
        p_enh_data = lt_data.

    CALL METHOD cl_wdr_cfg_persistence_utils=>('COMP_TABLES_TO_XML')
      EXPORTING
        outline_data  = ls_outline
        expl_data_tab = lt_data
      IMPORTING
        element       = li_element
      CHANGING
        document      = li_document.

    ii_xml->add_xml( iv_name = 'ENHANCEMENT_DATA'
                     ii_xml = li_element ).

  ENDMETHOD.

ENDCLASS.

ENHO: Implement missing deserialize for WDYC (#4332)

* ENHO: Implement missing deserialize for WDYC

Related to #3586

* Downport

* Update src/objects/enh/zcl_abapgit_object_enho_wdyc.clas.abap

Co-authored-by: abaplint[bot] <589dee37d0e82f3cabf9dea701e9ec2fd481eb1e@users.noreply.github.com>

Co-authored-by: abaplint[bot] <589dee37d0e82f3cabf9dea701e9ec2fd481eb1e@users.noreply.github.com>
Co-authored-by: Lars Hvam <721d1b171982cd84b755f6b25130d2b88cd1f696@hotmail.com>


"! Logger base class
"!

"! Inherit from this class and implement entry_internal for the logging logic.
"!

CLASS zcl_alog_logger_base DEFINITION
  PUBLIC
  ABSTRACT
  CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES:
      zif_alog_logger FINAL METHODS entry,
      zif_alog_attachable.
    ALIASES:
      debug FOR zif_alog_logger~debug,
      entry FOR zif_alog_logger~entry,
      error FOR zif_alog_logger~error,
      exception FOR zif_alog_logger~exception,
      info FOR zif_alog_logger~info,
      warning FOR zif_alog_logger~warning,
      attach FOR zif_alog_attachable~attach,
      detach FOR zif_alog_attachable~detach.
    METHODS:
      constructor,
      set_minimal_log_level IMPORTING io_type TYPE REF TO zcl_alog_entry_type
                            RAISING   zcx_alog_argument_null,
      get_minimal_log_level RETURNING VALUE(ro_type) TYPE REF TO zcl_alog_entry_type.
  PROTECTED SECTION.
    METHODS:
      "! Internal implementation of zif_alog_logger-&gtentry_msg( ) to do the logging
      "!

      "! Implement in non abstract subclasses.
      "!

      "! @parameter iv_text | Message text
      "! @parameter io_type | Type of the message
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Message type unsupported
      entry_internal ABSTRACT IMPORTING iv_text TYPE csequence
                                        io_type TYPE REF TO zcl_alog_entry_type
                              RAISING   zcx_alog_logging_failed
                                        zcx_alog_unsupported_msgty,
      "! Inform attached loggers
      "! @parameter iv_text | Message text
      "! @parameter io_type | Message type
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Unsupported message type
      "! @raising zcx_alog_argument_null | io_type cannot be null
      inform_attached_loggers IMPORTING iv_text TYPE csequence
                                        io_type TYPE REF TO zcl_alog_entry_type
                              RAISING   zcx_alog_logging_failed
                                        zcx_alog_unsupported_msgty
                                        zcx_alog_argument_null.
    DATA:
      mt_attached_loggers TYPE HASHED TABLE OF REF TO zif_alog_logger WITH UNIQUE KEY table_line.
  PRIVATE SECTION.
    DATA:
      mo_minimal_log_level TYPE REF TO zcl_alog_entry_type.
ENDCLASS.

CLASS zcl_alog_logger_base IMPLEMENTATION.
  METHOD constructor.
    mo_minimal_log_level = zcl_alog_entry_type=>go_debug.
  ENDMETHOD.

  METHOD zif_alog_logger~entry.
    IF io_type IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'IO_TYPE'.
    ENDIF.

    inform_attached_loggers( iv_text = iv_text io_type = io_type ).

    IF mo_minimal_log_level->compare_priority_to( io_type ) <= 0.
      entry_internal( iv_text = iv_text io_type = io_type ).
    ENDIF.
  ENDMETHOD.

  METHOD zif_alog_logger~debug.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_debug ).
  ENDMETHOD.

  METHOD zif_alog_logger~error.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_error ).
  ENDMETHOD.

  METHOD zif_alog_logger~exception.
    entry( iv_text = ix_ex->get_text( ) io_type = zcl_alog_entry_type=>go_error ).
  ENDMETHOD.

  METHOD zif_alog_logger~info.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_info ).
  ENDMETHOD.

  METHOD zif_alog_logger~warning.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_warning ).
  ENDMETHOD.

  METHOD zif_alog_attachable~attach.
    IF ii_logger IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'II_LOGGER'.
    ENDIF.

    TRY.
        INSERT ii_logger INTO TABLE mt_attached_loggers.
        ASSERT sy-subrc = 0.
      CATCH cx_sy_itab_duplicate_key INTO DATA(lx_ex).
        RAISE EXCEPTION TYPE zcx_alog_already_attached
          EXPORTING
            ix_previous = lx_ex.
    ENDTRY.
  ENDMETHOD.

  METHOD zif_alog_attachable~detach.
    IF ii_logger IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'II_LOGGER'.
    ENDIF.

    DELETE TABLE mt_attached_loggers WITH TABLE KEY table_line = ii_logger.
    IF sy-subrc <> 0.
      RAISE EXCEPTION TYPE zcx_alog_not_attached.
    ENDIF.
  ENDMETHOD.

  METHOD inform_attached_loggers.
    LOOP AT mt_attached_loggers ASSIGNING FIELD-SYMBOL(<li_logger>).
      <li_logger>->entry( iv_text = iv_text io_type = io_type ).
    ENDLOOP.
  ENDMETHOD.

  METHOD get_minimal_log_level.
    ro_type = mo_minimal_log_level.
  ENDMETHOD.

  METHOD set_minimal_log_level.
    IF io_type IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'IO_TYPE'.
    ENDIF.

    mo_minimal_log_level = io_type.
  ENDMETHOD.
ENDCLASS.

"! Logger base class
"!

"! Inherit from this class and implement entry_internal for the logging logic.
"!

CLASS zcl_alog_logger_base DEFINITION
  PUBLIC
  ABSTRACT
  CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES:
      zif_alog_logger FINAL METHODS entry,
      zif_alog_attachable.
    ALIASES:
      debug FOR zif_alog_logger~debug,
      entry FOR zif_alog_logger~entry,
      error FOR zif_alog_logger~error,
      exception FOR zif_alog_logger~exception,
      info FOR zif_alog_logger~info,
      warning FOR zif_alog_logger~warning,
      attach FOR zif_alog_attachable~attach,
      detach FOR zif_alog_attachable~detach.
    METHODS:
      constructor,
      "! Sets the minimal log level
      "!

      "! If a new log entry's entry type does not have at least the priority of the entry type set
      "! by this method the new entry will not be logged by this logger. It will however be
      "! propagated to all attached loggers that will evaluate the relevance of the new log entry
      "! based on their configured minimal log level.
      "!

      "! @parameter io_type | Entry type with the new minimal priority
      "! @raising zcx_alog_argument_null |
      set_minimal_log_level IMPORTING io_type TYPE REF TO zcl_alog_entry_type
                            RAISING   zcx_alog_argument_null,
      "! Gets the minimal log level
      "! @parameter ro_type | Entry type with the current minimal priority
      get_minimal_log_level RETURNING VALUE(ro_type) TYPE REF TO zcl_alog_entry_type.
  PROTECTED SECTION.
    METHODS:
      "! Internal implementation of zif_alog_logger-&gtentry_msg( ) to do the logging
      "!

      "! Implement in non abstract subclasses.
      "!

      "! @parameter iv_text | Message text
      "! @parameter io_type | Type of the message
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Message type unsupported
      entry_internal ABSTRACT IMPORTING iv_text TYPE csequence
                                        io_type TYPE REF TO zcl_alog_entry_type
                              RAISING   zcx_alog_logging_failed
                                        zcx_alog_unsupported_msgty,
      "! Inform attached loggers
      "! @parameter iv_text | Message text
      "! @parameter io_type | Message type
      "! @raising zcx_alog_logging_failed | Logging failed
      "! @raising zcx_alog_unsupported_msgty | Unsupported message type
      "! @raising zcx_alog_argument_null | io_type cannot be null
      inform_attached_loggers IMPORTING iv_text TYPE csequence
                                        io_type TYPE REF TO zcl_alog_entry_type
                              RAISING   zcx_alog_logging_failed
                                        zcx_alog_unsupported_msgty
                                        zcx_alog_argument_null.
    DATA:
      mt_attached_loggers TYPE HASHED TABLE OF REF TO zif_alog_logger WITH UNIQUE KEY table_line.
  PRIVATE SECTION.
    DATA:
      mo_minimal_log_level TYPE REF TO zcl_alog_entry_type.
ENDCLASS.

CLASS zcl_alog_logger_base IMPLEMENTATION.
  METHOD constructor.
    mo_minimal_log_level = zcl_alog_entry_type=>go_debug.
  ENDMETHOD.

  METHOD zif_alog_logger~entry.
    IF io_type IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'IO_TYPE'.
    ENDIF.

    inform_attached_loggers( iv_text = iv_text io_type = io_type ).

    IF mo_minimal_log_level->compare_priority_to( io_type ) <= 0.
      entry_internal( iv_text = iv_text io_type = io_type ).
    ENDIF.
  ENDMETHOD.

  METHOD zif_alog_logger~debug.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_debug ).
  ENDMETHOD.

  METHOD zif_alog_logger~error.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_error ).
  ENDMETHOD.

  METHOD zif_alog_logger~exception.
    entry( iv_text = ix_ex->get_text( ) io_type = zcl_alog_entry_type=>go_error ).
  ENDMETHOD.

  METHOD zif_alog_logger~info.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_info ).
  ENDMETHOD.

  METHOD zif_alog_logger~warning.
    entry( iv_text = iv_text io_type = zcl_alog_entry_type=>go_warning ).
  ENDMETHOD.

  METHOD zif_alog_attachable~attach.
    IF ii_logger IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'II_LOGGER'.
    ENDIF.

    TRY.
        INSERT ii_logger INTO TABLE mt_attached_loggers.
        ASSERT sy-subrc = 0.
      CATCH cx_sy_itab_duplicate_key INTO DATA(lx_ex).
        RAISE EXCEPTION TYPE zcx_alog_already_attached
          EXPORTING
            ix_previous = lx_ex.
    ENDTRY.
  ENDMETHOD.

  METHOD zif_alog_attachable~detach.
    IF ii_logger IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'II_LOGGER'.
    ENDIF.

    DELETE TABLE mt_attached_loggers WITH TABLE KEY table_line = ii_logger.
    IF sy-subrc <> 0.
      RAISE EXCEPTION TYPE zcx_alog_not_attached.
    ENDIF.
  ENDMETHOD.

  METHOD inform_attached_loggers.
    LOOP AT mt_attached_loggers ASSIGNING FIELD-SYMBOL(<li_logger>).
      <li_logger>->entry( iv_text = iv_text io_type = io_type ).
    ENDLOOP.
  ENDMETHOD.

  METHOD get_minimal_log_level.
    ro_type = mo_minimal_log_level.
  ENDMETHOD.

  METHOD set_minimal_log_level.
    IF io_type IS NOT BOUND.
      RAISE EXCEPTION TYPE zcx_alog_argument_null
        EXPORTING
          iv_variable_name = 'IO_TYPE'.
    ENDIF.

    mo_minimal_log_level = io_type.
  ENDMETHOD.
ENDCLASS.

Add missing documentation

Add missing documentation


*&---------------------------------------------------------------------*
*&  Include           ZABAPGIT_AUTHORIZATIONS
*&---------------------------------------------------------------------*

TYPES: ty_activity TYPE string.

CONSTANTS: BEGIN OF gc_activities,
             uninstall TYPE ty_activity VALUE 'UNINSTALL',
           END OF gc_activities.

INTERFACE lif_auth.
  METHODS:
    is_allowed
      IMPORTING iv_activity       TYPE ty_activity
      RETURNING VALUE(rv_allowed) TYPE abap_bool.
ENDINTERFACE.

* implement class LCL_AUTH_EXIT implementing LIF_AUTH in following include,
* place the include in a different package than ZABAPGIT
INCLUDE zabapgit_authorizations_exit IF FOUND.

*******************

CLASS lcl_auth DEFINITION FINAL.

  PUBLIC SECTION.
    CLASS-METHODS:
      is_allowed
        IMPORTING iv_activity       TYPE ty_activity
        RETURNING VALUE(rv_allowed) TYPE abap_bool.

ENDCLASS.

CLASS lcl_auth IMPLEMENTATION.

  METHOD is_allowed.

    DATA: li_auth TYPE REF TO lif_auth.

    TRY.
        CREATE OBJECT li_auth TYPE ('LCL_AUTH_EXIT').
        rv_allowed = li_auth->is_allowed( iv_activity ).
      CATCH cx_sy_create_object_error.
        rv_allowed = abap_true.
    ENDTRY.

  ENDMETHOD.

ENDCLASS.

*&---------------------------------------------------------------------*
*&  Include           ZABAPGIT_AUTHORIZATIONS
*&---------------------------------------------------------------------*

TYPES: ty_activity TYPE string.

CONSTANTS: BEGIN OF gc_activities,
             uninstall TYPE ty_activity VALUE 'UNINSTALL',
           END OF gc_activities.

INTERFACE lif_auth.
  METHODS:
    is_allowed
      IMPORTING iv_activity       TYPE ty_activity
                iv_param          TYPE string OPTIONAL
      RETURNING VALUE(rv_allowed) TYPE abap_bool.
ENDINTERFACE.

* implement class LCL_AUTH_EXIT implementing LIF_AUTH in following include,
* place the include in a different package than ZABAPGIT
INCLUDE zabapgit_authorizations_exit IF FOUND.

*******************

CLASS lcl_auth DEFINITION FINAL.

  PUBLIC SECTION.
    CLASS-METHODS:
      is_allowed
        IMPORTING iv_activity       TYPE ty_activity
                  iv_param          TYPE string OPTIONAL
        RETURNING VALUE(rv_allowed) TYPE abap_bool.

ENDCLASS.

CLASS lcl_auth IMPLEMENTATION.

  METHOD is_allowed.

    DATA: li_auth TYPE REF TO lif_auth.

    TRY.
        CREATE OBJECT li_auth TYPE ('LCL_AUTH_EXIT').
        rv_allowed = li_auth->is_allowed( iv_activity = iv_activity
                                          iv_param    = iv_param ).
      CATCH cx_sy_create_object_error.
        rv_allowed = abap_true.
    ENDTRY.

  ENDMETHOD.

ENDCLASS.

add param

add param


CLASS zcl_abapgit_object_intf DEFINITION PUBLIC FINAL INHERITING FROM zcl_abapgit_objects_program.
  PUBLIC SECTION.
    INTERFACES zif_abapgit_object.
    ALIASES mo_files FOR zif_abapgit_object~mo_files.
    METHODS constructor
      IMPORTING
        is_item     TYPE zif_abapgit_definitions=>ty_item
        iv_language TYPE spras.
  PROTECTED SECTION.
    METHODS deserialize_abap
      IMPORTING io_xml     TYPE REF TO zcl_abapgit_xml_input
                iv_package TYPE devclass
      RAISING   zcx_abapgit_exception.

    METHODS deserialize_docu
      IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_input
      RAISING   zcx_abapgit_exception.

  PRIVATE SECTION.
    DATA mo_object_oriented_object_fct TYPE REF TO zif_abapgit_oo_object_fnc.

    METHODS serialize_xml
      IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_output
      RAISING   zcx_abapgit_exception.

ENDCLASS.

CLASS zcl_abapgit_object_intf IMPLEMENTATION.
  METHOD constructor.
    super->constructor(
      is_item     = is_item
      iv_language = iv_language ).
    mo_object_oriented_object_fct = zcl_abapgit_oo_factory=>make( iv_object_type = ms_item-obj_type ).
  ENDMETHOD.

  METHOD zif_abapgit_object~deserialize.
    deserialize_abap( io_xml     = io_xml
                      iv_package = iv_package ).

    deserialize_docu( io_xml ).
  ENDMETHOD.

  METHOD deserialize_abap.
    DATA: ls_vseointerf   TYPE vseointerf,
          lt_source       TYPE seop_source_string,
          lt_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
          ls_clskey       TYPE seoclskey.

    ls_clskey-clsname = ms_item-obj_name.
    lt_source = mo_files->read_abap( ).
    io_xml->read( EXPORTING iv_name = 'VSEOINTERF'
                  CHANGING cg_data = ls_vseointerf ).

    mo_object_oriented_object_fct->create(
      EXPORTING
        iv_package    = iv_package
      CHANGING
        is_properties = ls_vseointerf ).

    mo_object_oriented_object_fct->deserialize_source(
      is_key               = ls_clskey
      it_source            = lt_source ).

    io_xml->read( EXPORTING iv_name = 'DESCRIPTIONS'
                  CHANGING cg_data = lt_descriptions ).

    mo_object_oriented_object_fct->update_descriptions(
      is_key          = ls_clskey
      it_descriptions = lt_descriptions ).

    mo_object_oriented_object_fct->add_to_activation_list( is_item = ms_item ).
  ENDMETHOD.

  METHOD deserialize_docu.

    DATA: lt_lines  TYPE tlinetab,
          lv_object TYPE dokhl-object.

    io_xml->read( EXPORTING iv_name = 'LINES'
                  CHANGING cg_data = lt_lines ).

    IF lt_lines[] IS INITIAL.
      RETURN.
    ENDIF.

    lv_object = ms_item-obj_name.

    mo_object_oriented_object_fct->create_documentation(
      it_lines       = lt_lines
      iv_object_name = lv_object
      iv_language    = mv_language ).
  ENDMETHOD.

  METHOD zif_abapgit_object~has_changed_since.
    DATA:
      lv_program  TYPE program,
      lt_includes TYPE seoincl_t.

    lt_includes = mo_object_oriented_object_fct->get_includes( ms_item-obj_name ).
    READ TABLE lt_includes INDEX 1 INTO lv_program.
    "lv_program = cl_oo_classname_service=>get_interfacepool_name( lv_clsname ).
    rv_changed = check_prog_changed_since(
      iv_program   = lv_program
      iv_timestamp = iv_timestamp
      iv_skip_gui  = abap_true ).
  ENDMETHOD.

  METHOD zif_abapgit_object~serialize.

    DATA: lt_source        TYPE seop_source_string,
          ls_interface_key TYPE seoclskey.

    ls_interface_key-clsname = ms_item-obj_name.

    IF zif_abapgit_object~exists( ) = abap_false.
      RETURN.
    ENDIF.

    CALL FUNCTION 'SEO_BUFFER_REFRESH'
      EXPORTING
        version = seoc_version_active
        force   = seox_true.
    CALL FUNCTION 'SEO_BUFFER_REFRESH'
      EXPORTING
        version = seoc_version_inactive
        force   = seox_true.

    lt_source = mo_object_oriented_object_fct->serialize_abap( ls_interface_key ).

    mo_files->add_abap( lt_source ).

    serialize_xml( io_xml ).
  ENDMETHOD.

  METHOD serialize_xml.
    DATA:
      lt_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
      ls_vseointerf   TYPE vseointerf,
      ls_clskey       TYPE seoclskey,
      lt_lines        TYPE tlinetab.

    ls_clskey-clsname = ms_item-obj_name.

    ls_vseointerf = mo_object_oriented_object_fct->get_interface_properties( is_interface_key = ls_clskey ).

    CLEAR: ls_vseointerf-uuid,
           ls_vseointerf-author,
           ls_vseointerf-createdon,
           ls_vseointerf-changedby,
           ls_vseointerf-changedon,
           ls_vseointerf-r3release.

    io_xml->add( iv_name = 'VSEOINTERF'
                 ig_data = ls_vseointerf ).

    lt_lines = mo_object_oriented_object_fct->read_documentation(
      iv_class_name = ls_clskey-clsname
      iv_language   = mv_language ).
    IF lines( lt_lines ) > 0.
      io_xml->add( iv_name = 'LINES'
                   ig_data = lt_lines ).
    ENDIF.

    lt_descriptions = mo_object_oriented_object_fct->read_descriptions( ls_clskey-clsname ).
    IF lines( lt_descriptions ) > 0.
      io_xml->add( iv_name = 'DESCRIPTIONS'
                   ig_data = lt_descriptions ).
    ENDIF.
  ENDMETHOD.

  METHOD zif_abapgit_object~changed_by.
    TYPES: BEGIN OF ty_includes,
             programm TYPE programm,
           END OF ty_includes.

    TYPES: BEGIN OF ty_reposrc,
             unam  TYPE reposrc-unam,
             udat  TYPE reposrc-udat,
             utime TYPE reposrc-utime,
           END OF ty_reposrc.

    DATA: lt_reposrc  TYPE STANDARD TABLE OF ty_reposrc,
          ls_reposrc  LIKE LINE OF lt_reposrc,
          lt_includes TYPE STANDARD TABLE OF ty_includes.

    lt_includes = mo_object_oriented_object_fct->get_includes( ms_item-obj_name ).
    ASSERT lines( lt_includes ) > 0.

    SELECT unam udat utime FROM reposrc
      INTO TABLE lt_reposrc
      FOR ALL ENTRIES IN lt_includes
      WHERE progname = lt_includes-programm
      AND   r3state = 'A'.
    IF sy-subrc <> 0.
      rv_user = c_user_unknown.
    ELSE.
      SORT lt_reposrc BY udat DESCENDING utime DESCENDING.
      READ TABLE lt_reposrc INDEX 1 INTO ls_reposrc.
      ASSERT sy-subrc = 0.
      rv_user = ls_reposrc-unam.
    ENDIF.
  ENDMETHOD.

  METHOD zif_abapgit_object~compare_to_remote_version.
    CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
  ENDMETHOD.

  METHOD zif_abapgit_object~delete.
    DATA: ls_clskey TYPE seoclskey.
    ls_clskey-clsname = ms_item-obj_name.

    mo_object_oriented_object_fct->delete( ls_clskey ).
  ENDMETHOD.

  METHOD zif_abapgit_object~exists.

    DATA: ls_class_key TYPE seoclskey,
          lv_category  TYPE seoclassdf-category.

    ls_class_key-clsname = ms_item-obj_name.

    rv_bool = mo_object_oriented_object_fct->exists( iv_object_name = ls_class_key ).

    IF rv_bool = abap_true.
      SELECT SINGLE category FROM seoclassdf INTO lv_category
        WHERE clsname = ls_class_key-clsname
        AND ( version = '1'
        OR version = '0' ) ##warn_ok.                   "#EC CI_GENBUFF
      IF sy-subrc = 0 AND lv_category = seoc_category_webdynpro_class.
        rv_bool = abap_false.
      ENDIF.
    ENDIF.

  ENDMETHOD.

  METHOD zif_abapgit_object~get_metadata.
    rs_metadata = get_metadata( ).
  ENDMETHOD.

  METHOD zif_abapgit_object~jump.
    CALL FUNCTION 'RS_TOOL_ACCESS'
      EXPORTING
        operation     = 'SHOW'
        object_name   = ms_item-obj_name
        object_type   = 'INTF'
        in_new_window = abap_true.
  ENDMETHOD.

ENDCLASS.

CLASS zcl_abapgit_object_intf DEFINITION PUBLIC FINAL INHERITING FROM zcl_abapgit_objects_program.
  PUBLIC SECTION.
    INTERFACES zif_abapgit_object.
    ALIASES mo_files FOR zif_abapgit_object~mo_files.
    METHODS constructor
      IMPORTING
        is_item     TYPE zif_abapgit_definitions=>ty_item
        iv_language TYPE spras.
  PROTECTED SECTION.
    METHODS deserialize_abap
      IMPORTING io_xml     TYPE REF TO zcl_abapgit_xml_input
                iv_package TYPE devclass
      RAISING   zcx_abapgit_exception.

    METHODS deserialize_docu
      IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_input
      RAISING   zcx_abapgit_exception.

  PRIVATE SECTION.
    DATA mo_object_oriented_object_fct TYPE REF TO zif_abapgit_oo_object_fnc.

    METHODS serialize_xml
      IMPORTING io_xml TYPE REF TO zcl_abapgit_xml_output
      RAISING   zcx_abapgit_exception.

ENDCLASS.

CLASS ZCL_ABAPGIT_OBJECT_INTF IMPLEMENTATION.

  METHOD constructor.
    super->constructor(
      is_item     = is_item
      iv_language = iv_language ).
    mo_object_oriented_object_fct = zcl_abapgit_oo_factory=>make( iv_object_type = ms_item-obj_type ).
  ENDMETHOD.

  METHOD deserialize_abap.
    DATA: ls_vseointerf   TYPE vseointerf,
          lt_source       TYPE seop_source_string,
          lt_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
          ls_clskey       TYPE seoclskey.

    ls_clskey-clsname = ms_item-obj_name.
    lt_source = mo_files->read_abap( ).
    io_xml->read( EXPORTING iv_name = 'VSEOINTERF'
                  CHANGING cg_data = ls_vseointerf ).

    mo_object_oriented_object_fct->create(
      EXPORTING
        iv_package    = iv_package
      CHANGING
        is_properties = ls_vseointerf ).

    mo_object_oriented_object_fct->deserialize_source(
      is_key               = ls_clskey
      it_source            = lt_source ).

    io_xml->read( EXPORTING iv_name = 'DESCRIPTIONS'
                  CHANGING cg_data = lt_descriptions ).

    mo_object_oriented_object_fct->update_descriptions(
      is_key          = ls_clskey
      it_descriptions = lt_descriptions ).

    mo_object_oriented_object_fct->add_to_activation_list( is_item = ms_item ).
  ENDMETHOD.

  METHOD deserialize_docu.

    DATA: lt_lines  TYPE tlinetab,
          lv_object TYPE dokhl-object.

    io_xml->read( EXPORTING iv_name = 'LINES'
                  CHANGING cg_data = lt_lines ).

    IF lt_lines[] IS INITIAL.
      RETURN.
    ENDIF.

    lv_object = ms_item-obj_name.

    mo_object_oriented_object_fct->create_documentation(
      it_lines       = lt_lines
      iv_object_name = lv_object
      iv_language    = mv_language ).
  ENDMETHOD.

  METHOD serialize_xml.
    DATA:
      lt_descriptions TYPE zif_abapgit_definitions=>ty_seocompotx_tt,
      ls_vseointerf   TYPE vseointerf,
      ls_clskey       TYPE seoclskey,
      lt_lines        TYPE tlinetab.

    ls_clskey-clsname = ms_item-obj_name.

    ls_vseointerf = mo_object_oriented_object_fct->get_interface_properties( ls_clskey ).

    CLEAR: ls_vseointerf-uuid,
           ls_vseointerf-author,
           ls_vseointerf-createdon,
           ls_vseointerf-changedby,
           ls_vseointerf-changedon,
           ls_vseointerf-chgdanyby,
           ls_vseointerf-chgdanyon,
           ls_vseointerf-r3release.

    io_xml->add( iv_name = 'VSEOINTERF'
                 ig_data = ls_vseointerf ).

    lt_lines = mo_object_oriented_object_fct->read_documentation(
      iv_class_name = ls_clskey-clsname
      iv_language   = mv_language ).
    IF lines( lt_lines ) > 0.
      io_xml->add( iv_name = 'LINES'
                   ig_data = lt_lines ).
    ENDIF.

    lt_descriptions = mo_object_oriented_object_fct->read_descriptions( ls_clskey-clsname ).
    IF lines( lt_descriptions ) > 0.
      io_xml->add( iv_name = 'DESCRIPTIONS'
                   ig_data = lt_descriptions ).
    ENDIF.
  ENDMETHOD.

  METHOD zif_abapgit_object~changed_by.
    TYPES: BEGIN OF ty_includes,
             programm TYPE programm,
           END OF ty_includes.

    TYPES: BEGIN OF ty_reposrc,
             unam  TYPE reposrc-unam,
             udat  TYPE reposrc-udat,
             utime TYPE reposrc-utime,
           END OF ty_reposrc.

    DATA: lt_reposrc  TYPE STANDARD TABLE OF ty_reposrc,
          ls_reposrc  LIKE LINE OF lt_reposrc,
          lt_includes TYPE STANDARD TABLE OF ty_includes.

    lt_includes = mo_object_oriented_object_fct->get_includes( ms_item-obj_name ).
    ASSERT lines( lt_includes ) > 0.

    SELECT unam udat utime FROM reposrc
      INTO TABLE lt_reposrc
      FOR ALL ENTRIES IN lt_includes
      WHERE progname = lt_includes-programm
      AND   r3state = 'A'.
    IF sy-subrc <> 0.
      rv_user = c_user_unknown.
    ELSE.
      SORT lt_reposrc BY udat DESCENDING utime DESCENDING.
      READ TABLE lt_reposrc INDEX 1 INTO ls_reposrc.
      ASSERT sy-subrc = 0.
      rv_user = ls_reposrc-unam.
    ENDIF.
  ENDMETHOD.

  METHOD zif_abapgit_object~compare_to_remote_version.
    CREATE OBJECT ro_comparison_result TYPE zcl_abapgit_comparison_null.
  ENDMETHOD.

  METHOD zif_abapgit_object~delete.
    DATA: ls_clskey TYPE seoclskey.
    ls_clskey-clsname = ms_item-obj_name.

    mo_object_oriented_object_fct->delete( ls_clskey ).
  ENDMETHOD.

  METHOD zif_abapgit_object~deserialize.
    deserialize_abap( io_xml     = io_xml
                      iv_package = iv_package ).

    deserialize_docu( io_xml ).
  ENDMETHOD.

  METHOD zif_abapgit_object~exists.

    DATA: ls_class_key TYPE seoclskey,
          lv_category  TYPE seoclassdf-category.

    ls_class_key-clsname = ms_item-obj_name.

    rv_bool = mo_object_oriented_object_fct->exists( iv_object_name = ls_class_key ).

    IF rv_bool = abap_true.
      SELECT SINGLE category FROM seoclassdf INTO lv_category
        WHERE clsname = ls_class_key-clsname
        AND ( version = '1'
        OR version = '0' ) ##warn_ok.                   "#EC CI_GENBUFF
      IF sy-subrc = 0 AND lv_category = seoc_category_webdynpro_class.
        rv_bool = abap_false.
      ENDIF.
    ENDIF.

  ENDMETHOD.

  METHOD zif_abapgit_object~get_metadata.
    rs_metadata = get_metadata( ).
  ENDMETHOD.

  METHOD zif_abapgit_object~has_changed_since.
    DATA:
      lv_program  TYPE program,
      lt_includes TYPE seoincl_t.

    lt_includes = mo_object_oriented_object_fct->get_includes( ms_item-obj_name ).
    READ TABLE lt_includes INDEX 1 INTO lv_program.
    "lv_program = cl_oo_classname_service=>get_interfacepool_name( lv_clsname ).
    rv_changed = check_prog_changed_since(
      iv_program   = lv_program
      iv_timestamp = iv_timestamp
      iv_skip_gui  = abap_true ).
  ENDMETHOD.

  METHOD zif_abapgit_object~jump.
    CALL FUNCTION 'RS_TOOL_ACCESS'
      EXPORTING
        operation     = 'SHOW'
        object_name   = ms_item-obj_name
        object_type   = 'INTF'
        in_new_window = abap_true.
  ENDMETHOD.

  METHOD zif_abapgit_object~serialize.

    DATA: lt_source        TYPE seop_source_string,
          ls_interface_key TYPE seoclskey.

    ls_interface_key-clsname = ms_item-obj_name.

    IF zif_abapgit_object~exists( ) = abap_false.
      RETURN.
    ENDIF.

    CALL FUNCTION 'SEO_BUFFER_REFRESH'
      EXPORTING
        version = seoc_version_active
        force   = seox_true.
    CALL FUNCTION 'SEO_BUFFER_REFRESH'
      EXPORTING
        version = seoc_version_inactive
        force   = seox_true.

    lt_source = mo_object_oriented_object_fct->serialize_abap( ls_interface_key ).

    mo_files->add_abap( lt_source ).

    serialize_xml( io_xml ).
  ENDMETHOD.
ENDCLASS.

clear fields (#1249)

INTF: clear fields (#1249)

not sure if these fields exist on 702, but we will find out