All files / src/objects/aff zcl_abapgit_aff_registry.clas.abap

100% Statements 103/103
100% Branches 7/7
100% Functions 0/0
100% Lines 103/103

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 1041x 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 10x 1x 1x 1x 79x 79x 1x 1x  
CLASS zcl_abapgit_aff_registry DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
 
  PUBLIC SECTION.
    INTERFACES:
      zif_abapgit_aff_registry.
 
    CONSTANTS c_aff_feature TYPE string VALUE 'AFF'.
 
    METHODS constructor.
 
  PROTECTED SECTION.
  PRIVATE SECTION.
 
    TYPES:
      BEGIN OF ty_registry_entry,
        obj_type     TYPE tadir-object,
        experimental TYPE abap_bool,
      END OF ty_registry_entry.
 
    CLASS-DATA:
      gt_registry TYPE HASHED TABLE OF ty_registry_entry WITH UNIQUE KEY obj_type.
 
    DATA mv_aff_enabled TYPE abap_bool.
 
    CLASS-METHODS initialize_registry_table.
 
    CLASS-METHODS:
      register
        IMPORTING
          iv_obj_type     TYPE tadir-object
          iv_experimental TYPE abap_bool DEFAULT abap_false.
 
ENDCLASS.
 
 
 
CLASS ZCL_ABAPGIT_AFF_REGISTRY IMPLEMENTATION.
 
 
  METHOD constructor.
    mv_aff_enabled = zcl_abapgit_feature=>is_enabled( c_aff_feature ).
  ENDMETHOD.
 
 
  METHOD initialize_registry_table.
    register( 'APLO' ).
    register( 'BGQC' ).
    register( 'CDBO' ).
    register( 'CHKC' ).
    register( 'CHKO' ).
    register( 'CHKV' ).
    register( 'DRTY' ).
    register( 'DTEB' ).
    register( 'DSFI' ).
    register( 'DRAS' ).
    register( 'DSFD' ).
    register( 'EVTB' ).
    register( 'EEEC' ).
    register( 'GSMP' ).
    register( iv_obj_type     = 'INTF'
              iv_experimental = abap_true ).
    register( 'SAJT' ).
    register( 'SAJC' ).
    register( 'SMBC' ).
    register( 'SWCR' ).
    register( 'NONT' ).
    register( 'RONT' ).
    register( 'UIAD' ).
    register( 'UIPG' ).
    register( 'UIST' ).
  ENDMETHOD.
 
 
  METHOD register.
    DATA ls_registry_entry TYPE ty_registry_entry.
 
    ls_registry_entry-obj_type = iv_obj_type.
    ls_registry_entry-experimental = iv_experimental.
    INSERT ls_registry_entry INTO TABLE gt_registry.
  ENDMETHOD.
 
 
  METHOD zif_abapgit_aff_registry~is_supported_object_type.
 
    DATA ls_registry_entry TYPE ty_registry_entry.
 
    IF gt_registry IS INITIAL.
      initialize_registry_table( ).
    ENDIF.
 
    READ TABLE gt_registry WITH TABLE KEY obj_type = iv_obj_type INTO ls_registry_entry.
    IF sy-subrc = 0 AND ls_registry_entry-experimental = abap_false.
      rv_result = abap_true.
    ELSEIF sy-subrc = 0 AND mv_aff_enabled = abap_true.
      rv_result = abap_true.
    ELSE.
      rv_result = abap_false.
    ENDIF.
  ENDMETHOD.
ENDCLASS.