All files / src zcl_abapgit_factory.clas.abap

97.66% Statements 251/257
50% Branches 3/6
100% Functions 0/0
97.66% Lines 251/257

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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 2581x 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 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 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 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_factory DEFINITION
  PUBLIC
  CREATE PRIVATE
  GLOBAL FRIENDS zcl_abapgit_injector .
 
  PUBLIC SECTION.
 
    CLASS-METHODS get_tadir
      RETURNING
        VALUE(ri_tadir) TYPE REF TO zif_abapgit_tadir .
    CLASS-METHODS get_sap_package
      IMPORTING
        !iv_package           TYPE devclass
      RETURNING
        VALUE(ri_sap_package) TYPE REF TO zif_abapgit_sap_package .
    CLASS-METHODS get_code_inspector
      IMPORTING
        !iv_package              TYPE devclass
      RETURNING
        VALUE(ri_code_inspector) TYPE REF TO zif_abapgit_code_inspector
      RAISING
        zcx_abapgit_exception .
    CLASS-METHODS get_stage_logic
      RETURNING
        VALUE(ri_logic) TYPE REF TO zif_abapgit_stage_logic .
    CLASS-METHODS get_cts_api
      RETURNING
        VALUE(ri_cts_api) TYPE REF TO zif_abapgit_cts_api .
    CLASS-METHODS get_default_transport
      RETURNING
        VALUE(ri_default_transport) TYPE REF TO zif_abapgit_default_transport
      RAISING
        zcx_abapgit_exception.
    CLASS-METHODS get_environment
      RETURNING
        VALUE(ri_environment) TYPE REF TO zif_abapgit_environment .
    CLASS-METHODS get_longtexts
      RETURNING
        VALUE(ri_longtexts) TYPE REF TO zif_abapgit_longtexts .
    CLASS-METHODS get_http_agent
      RETURNING
        VALUE(ri_http_agent) TYPE REF TO zif_abapgit_http_agent .
    CLASS-METHODS get_lxe_texts
      RETURNING
        VALUE(ri_lxe_texts) TYPE REF TO zif_abapgit_lxe_texts .
    CLASS-METHODS get_sap_namespace
      RETURNING
        VALUE(ri_namespace) TYPE REF TO zif_abapgit_sap_namespace .
    CLASS-METHODS get_sap_report
      RETURNING
        VALUE(ri_report) TYPE REF TO zif_abapgit_sap_report.
    CLASS-METHODS get_function_module
      RETURNING
        VALUE(ri_function_module) TYPE REF TO zif_abapgit_function_module.
  PROTECTED SECTION.
  PRIVATE SECTION.
 
    TYPES:
      BEGIN OF ty_sap_package,
        package  TYPE devclass,
        instance TYPE REF TO zif_abapgit_sap_package,
      END OF ty_sap_package .
    TYPES:
      ty_sap_packages TYPE HASHED TABLE OF ty_sap_package
                                    WITH UNIQUE KEY package .
    TYPES:
      BEGIN OF ty_code_inspector_pack,
        package  TYPE devclass,
        instance TYPE REF TO zif_abapgit_code_inspector,
      END OF ty_code_inspector_pack .
    TYPES:
      ty_code_inspector_packs TYPE HASHED TABLE OF ty_code_inspector_pack
                                       WITH UNIQUE KEY package .
 
    CLASS-DATA gi_tadir TYPE REF TO zif_abapgit_tadir .
    CLASS-DATA gt_sap_package TYPE ty_sap_packages .
    CLASS-DATA gt_code_inspector TYPE ty_code_inspector_packs .
    CLASS-DATA gi_stage_logic TYPE REF TO zif_abapgit_stage_logic .
    CLASS-DATA gi_cts_api TYPE REF TO zif_abapgit_cts_api .
    CLASS-DATA gi_environment TYPE REF TO zif_abapgit_environment .
    CLASS-DATA gi_longtext TYPE REF TO zif_abapgit_longtexts .
    CLASS-DATA gi_http_agent TYPE REF TO zif_abapgit_http_agent .
    CLASS-DATA gi_lxe_texts TYPE REF TO zif_abapgit_lxe_texts .
    CLASS-DATA gi_sap_namespace TYPE REF TO zif_abapgit_sap_namespace .
    CLASS-DATA gi_sap_report TYPE REF TO zif_abapgit_sap_report.
    CLASS-DATA gi_function_module TYPE REF TO zif_abapgit_function_module.
    CLASS-DATA gi_default_transport TYPE REF TO zif_abapgit_default_transport .
ENDCLASS.
 
 
 
CLASS ZCL_ABAPGIT_FACTORY IMPLEMENTATION.
 
 
  METHOD get_code_inspector.
 
    DATA: ls_code_inspector LIKE LINE OF gt_code_inspector.
    FIELD-SYMBOLS: <ls_code_inspector> TYPE ty_code_inspector_pack.
 
    READ TABLE gt_code_inspector ASSIGNING <ls_code_inspector>
      WITH TABLE KEY package = iv_package.
    IF sy-subrc <> 0.
      ls_code_inspector-package = iv_package.
 
      CREATE OBJECT ls_code_inspector-instance TYPE zcl_abapgit_code_inspector
        EXPORTING
          iv_package = iv_package.
 
      INSERT ls_code_inspector
             INTO TABLE gt_code_inspector
             ASSIGNING <ls_code_inspector>.
 
    ENDIF.
 
    ri_code_inspector = <ls_code_inspector>-instance.
 
  ENDMETHOD.
 
 
  METHOD get_cts_api.
    IF gi_cts_api IS NOT BOUND.
      CREATE OBJECT gi_cts_api TYPE zcl_abapgit_cts_api.
    ENDIF.
 
    ri_cts_api = gi_cts_api.
  ENDMETHOD.
 
 
  METHOD get_default_transport.
 
    IF gi_default_transport IS NOT BOUND.
      CREATE OBJECT gi_default_transport TYPE zcl_abapgit_default_transport.
    ENDIF.
 
    ri_default_transport = gi_default_transport.
 
  ENDMETHOD.
 
 
  METHOD get_environment.
    IF gi_environment IS NOT BOUND.
      CREATE OBJECT gi_environment TYPE zcl_abapgit_environment.
    ENDIF.
    ri_environment = gi_environment.
  ENDMETHOD.
 
 
  METHOD get_function_module.
 
    IF gi_function_module IS INITIAL.
      CREATE OBJECT gi_function_module TYPE zcl_abapgit_function_module.
    ENDIF.
 
    ri_function_module = gi_function_module.
 
  ENDMETHOD.
 
 
  METHOD get_http_agent.
 
    IF gi_http_agent IS INITIAL.
      gi_http_agent = zcl_abapgit_http_agent=>create( ).
    ENDIF.
 
    ri_http_agent = gi_http_agent.
 
  ENDMETHOD.
 
 
  METHOD get_longtexts.
 
    IF gi_longtext IS NOT BOUND.
      CREATE OBJECT gi_longtext TYPE zcl_abapgit_longtexts.
    ENDIF.
    ri_longtexts = gi_longtext.
 
  ENDMETHOD.
 
 
  METHOD get_lxe_texts.
 
    IF gi_lxe_texts IS NOT BOUND.
      CREATE OBJECT gi_lxe_texts TYPE zcl_abapgit_lxe_texts.
    ENDIF.
    ri_lxe_texts = gi_lxe_texts.
 
  ENDMETHOD.
 
 
  METHOD get_sap_namespace.
 
    IF gi_sap_namespace IS NOT BOUND.
      CREATE OBJECT gi_sap_namespace TYPE zcl_abapgit_sap_namespace.
    ENDIF.
 
    ri_namespace = gi_sap_namespace.
 
  ENDMETHOD.
 
 
  METHOD get_sap_package.
 
    DATA: ls_sap_package TYPE ty_sap_package.
    FIELD-SYMBOLS: <ls_sap_package> TYPE ty_sap_package.
 
    READ TABLE gt_sap_package ASSIGNING <ls_sap_package>
                              WITH TABLE KEY package = iv_package.
    IF sy-subrc <> 0.
 
      ls_sap_package-package = iv_package.
      CREATE OBJECT ls_sap_package-instance TYPE zcl_abapgit_sap_package
        EXPORTING
          iv_package = iv_package.
 
      INSERT ls_sap_package
             INTO TABLE gt_sap_package
             ASSIGNING <ls_sap_package>.
 
    ENDIF.
 
    ri_sap_package = <ls_sap_package>-instance.
 
  ENDMETHOD.
 
 
  METHOD get_sap_report.
 
    IF gi_sap_report IS NOT BOUND.
      CREATE OBJECT gi_sap_report TYPE zcl_abapgit_sap_report.
    ENDIF.
 
    ri_report = gi_sap_report.
 
  ENDMETHOD.
 
 
  METHOD get_stage_logic.
 
    IF gi_stage_logic IS INITIAL.
      CREATE OBJECT gi_stage_logic TYPE zcl_abapgit_stage_logic.
    ENDIF.
 
    ri_logic = gi_stage_logic.
 
  ENDMETHOD.
 
 
  METHOD get_tadir.
 
    IF gi_tadir IS INITIAL.
      CREATE OBJECT gi_tadir TYPE zcl_abapgit_tadir.
    ENDIF.
 
    ri_tadir = gi_tadir.
 
  ENDMETHOD.
ENDCLASS.