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 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 17x 1x 2x 10x 2x 2x 6x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 12x 1x 2x 2x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 8x 8x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 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_abap_language_vers DEFINITION PUBLIC FINAL CREATE PUBLIC. PUBLIC SECTION. CONSTANTS: c_any_abap_language_version TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version VALUE '*', c_no_abap_language_version TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version VALUE '-', c_feature_flag TYPE string VALUE 'ALAV'. METHODS constructor IMPORTING !io_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit. METHODS get_abap_language_vers_by_objt IMPORTING !iv_object_type TYPE trobjtype !iv_package TYPE devclass RETURNING VALUE(rv_allowed_abap_langu_version) TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version. METHODS get_repo_abap_language_version RETURNING VALUE(rv_abap_language_version) TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version. METHODS is_import_allowed IMPORTING !iv_package TYPE devclass RETURNING VALUE(rv_allowed) TYPE abap_bool. CLASS-METHODS check_abap_language_version IMPORTING !iv_abap_language_version TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version !is_item TYPE zif_abapgit_definitions=>ty_item RAISING zcx_abapgit_exception. PROTECTED SECTION. PRIVATE SECTION. DATA mo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit. " Depends on experimental feature flag and repo setting DATA mv_has_abap_language_vers TYPE abap_bool. METHODS get_default_abap_language_vers IMPORTING !iv_object_type TYPE trobjtype RETURNING VALUE(rv_abap_language_version) TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version. METHODS get_abap_language_vers_by_devc IMPORTING !iv_package TYPE devclass RETURNING VALUE(rv_abap_language_version) TYPE string. METHODS get_abap_language_vers_by_repo RETURNING VALUE(rv_abap_language_version) TYPE string. CLASS-METHODS get_description IMPORTING !iv_abap_language_version TYPE zif_abapgit_aff_types_v1=>ty_abap_language_version RETURNING VALUE(rv_description) TYPE string. ENDCLASS. CLASS zcl_abapgit_abap_language_vers IMPLEMENTATION. METHOD check_abap_language_version. " Check if ABAP language version matches repository setting IF is_item-abap_language_version IS NOT INITIAL AND iv_abap_language_version <> is_item-abap_language_version. zcx_abapgit_exception=>raise( |Object { is_item-obj_type } { is_item-obj_name } has { get_description( iv_abap_language_version ) }| && | but repository is set to { get_description( is_item-abap_language_version ) }| ). ENDIF. ENDMETHOD. METHOD constructor. mo_dot_abapgit = io_dot_abapgit. IF zcl_abapgit_feature=>is_enabled( c_feature_flag ) = abap_false. mv_has_abap_language_vers = abap_undefined. ELSEIF get_abap_language_vers_by_repo( ) = zif_abapgit_dot_abapgit=>c_abap_language_version-undefined. mv_has_abap_language_vers = abap_undefined. ELSEIF get_abap_language_vers_by_repo( ) = zif_abapgit_dot_abapgit=>c_abap_language_version-ignore. mv_has_abap_language_vers = abap_false. ELSE. mv_has_abap_language_vers = abap_true. ENDIF. ENDMETHOD. METHOD get_abap_language_vers_by_devc. DATA lv_class TYPE string. DATA lv_abap_lang_version_devc TYPE string. DATA lo_abap_language_version_cfg TYPE REF TO object. lv_class = 'CL_ABAP_LANGUAGE_VERSION_CFG'. TRY. CALL METHOD (lv_class)=>('GET_INSTANCE') RECEIVING ro_instance = lo_abap_language_version_cfg. " For non-existing packages, GET_PACKAGE_DEFAULT_VERSION returns "standard" " but we want to return "undefined" in this case to allow any new packages IF zcl_abapgit_factory=>get_sap_package( iv_package )->exists( ) = abap_true. CALL METHOD lo_abap_language_version_cfg->('IF_ABAP_LANGUAGE_VERSION_CFG~GET_PACKAGE_DEFAULT_VERSION') EXPORTING iv_package_name = iv_package RECEIVING rv_default_language_version = lv_abap_lang_version_devc. ELSE. lv_abap_lang_version_devc = '-'. ENDIF. CASE lv_abap_lang_version_devc. WHEN zif_abapgit_aff_types_v1=>co_abap_language_version-standard. rv_abap_language_version = zif_abapgit_dot_abapgit=>c_abap_language_version-standard. WHEN zif_abapgit_aff_types_v1=>co_abap_language_version-key_user. rv_abap_language_version = zif_abapgit_dot_abapgit=>c_abap_language_version-key_user. WHEN zif_abapgit_aff_types_v1=>co_abap_language_version-cloud_development. rv_abap_language_version = zif_abapgit_dot_abapgit=>c_abap_language_version-cloud_development. WHEN OTHERS. rv_abap_language_version = zif_abapgit_dot_abapgit=>c_abap_language_version-undefined. ENDCASE. CATCH cx_root. rv_abap_language_version = zif_abapgit_dot_abapgit=>c_abap_language_version-undefined. ENDTRY. ENDMETHOD. METHOD get_abap_language_vers_by_objt. DATA lv_class TYPE string. DATA lo_abap_language_version TYPE REF TO object. IF mv_has_abap_language_vers = abap_undefined. rv_allowed_abap_langu_version = c_any_abap_language_version. ELSEIF mv_has_abap_language_vers = abap_false. rv_allowed_abap_langu_version = c_no_abap_language_version. ELSE. " abap_true lv_class = 'CL_ABAP_LANGUAGE_VERSION'. TRY. CALL METHOD (lv_class)=>('GET_INSTANCE') RECEIVING ro_version_handler = lo_abap_language_version. CALL METHOD lo_abap_language_version->('IF_ABAP_LANGUAGE_VERSION~GET_DEFAULT_VERSION') EXPORTING iv_object_type = iv_object_type iv_package = iv_package RECEIVING rv_default_version = rv_allowed_abap_langu_version. CATCH cx_root. rv_allowed_abap_langu_version = get_default_abap_language_vers( iv_object_type ). ENDTRY. ENDIF. ENDMETHOD. METHOD get_abap_language_vers_by_repo. rv_abap_language_version = mo_dot_abapgit->get_abap_language_version( ). IF rv_abap_language_version IS INITIAL. rv_abap_language_version = zif_abapgit_dot_abapgit=>c_abap_language_version-undefined. ENDIF. ENDMETHOD. METHOD get_default_abap_language_vers. IF zcl_abapgit_factory=>get_environment( )->is_sap_cloud_platform( ) = abap_true. " On BTP, default to ABAP for Cloud Development rv_abap_language_version = zif_abapgit_aff_types_v1=>co_abap_language_version_cloud-cloud_development. ELSE. " Differentiate between source code object and non-source code objects CASE iv_object_type. WHEN 'BDEF' OR 'CLAS' OR 'FUGR' OR 'FUGS' OR 'INTF' OR 'PROG' OR 'TYPE'. rv_abap_language_version = zif_abapgit_aff_types_v1=>co_abap_language_version_src-standard. WHEN OTHERS. rv_abap_language_version = zif_abapgit_aff_types_v1=>co_abap_language_version-standard. ENDCASE. ENDIF. ENDMETHOD. METHOD get_description. CASE iv_abap_language_version. WHEN zif_abapgit_aff_types_v1=>co_abap_language_version-standard OR zif_abapgit_aff_types_v1=>co_abap_language_version_src-standard. rv_description = 'Standard ABAP'. WHEN zif_abapgit_aff_types_v1=>co_abap_language_version-key_user OR zif_abapgit_aff_types_v1=>co_abap_language_version_src-key_user. rv_description = 'ABAP for Key Users'. WHEN zif_abapgit_aff_types_v1=>co_abap_language_version-cloud_development OR zif_abapgit_aff_types_v1=>co_abap_language_version_src-cloud_development. rv_description = 'ABAP for Cloud Development'. WHEN OTHERS. rv_description = 'Undefined'. ENDCASE. rv_description = |ABAP language version "{ rv_description }"|. ENDMETHOD. METHOD get_repo_abap_language_version. DATA lv_abap_language_version TYPE string. IF mv_has_abap_language_vers <> abap_undefined. " abap_true or abap_false lv_abap_language_version = mo_dot_abapgit->get_abap_language_version( ). ENDIF. CASE lv_abap_language_version. WHEN zif_abapgit_dot_abapgit=>c_abap_language_version-standard. rv_abap_language_version = zif_abapgit_aff_types_v1=>co_abap_language_version_src-standard. WHEN zif_abapgit_dot_abapgit=>c_abap_language_version-key_user. rv_abap_language_version = zif_abapgit_aff_types_v1=>co_abap_language_version_src-key_user. WHEN zif_abapgit_dot_abapgit=>c_abap_language_version-cloud_development. rv_abap_language_version = zif_abapgit_aff_types_v1=>co_abap_language_version_src-cloud_development. WHEN zif_abapgit_dot_abapgit=>c_abap_language_version-ignore. rv_abap_language_version = c_no_abap_language_version. WHEN OTHERS. " undefined or feature off rv_abap_language_version = c_any_abap_language_version. ENDCASE. ENDMETHOD. METHOD is_import_allowed. DATA lv_package_version TYPE string. lv_package_version = get_abap_language_vers_by_devc( iv_package ). CASE get_abap_language_vers_by_repo( ). WHEN zif_abapgit_dot_abapgit=>c_abap_language_version-undefined OR zif_abapgit_dot_abapgit=>c_abap_language_version-ignore. rv_allowed = abap_true. WHEN OTHERS. IF get_abap_language_vers_by_repo( ) = lv_package_version. " allow packages that match repo setting rv_allowed = abap_true. ELSEIF lv_package_version = zif_abapgit_dot_abapgit=>c_abap_language_version-undefined. " always allow new packages rv_allowed = abap_true. ELSE. rv_allowed = abap_false. ENDIF. ENDCASE. ENDMETHOD. ENDCLASS. |