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 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_persistence_db.clas.abap class zcl_abapgit_persistence_db { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_PERSISTENCE_DB'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {"GO_DB": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_PERSISTENCE_DB", RTTIName: "\\CLASS=ZCL_ABAPGIT_PERSISTENCE_DB"});}, "visibility": "I", "is_constant": " ", "is_class": "X"}, "MV_UPDATE_FUNCTION": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"FUNCNAME","ddicName":"FUNCNAME","description":"Function Module Name"});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "C_TABNAME": {"type": () => {return new abap.types.Character(30, {});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_LOCK": {"type": () => {return new abap.types.Character(30, {});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_TYPE_SETTINGS": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_TYPE_REPO": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_TYPE_REPO_CSUM": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_TYPE_BACKGROUND": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_TYPE_PACKAGES": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}, "C_TYPE_USER": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}}; static METHODS = {"GET_UPDATE_FUNCTION": {"visibility": "I", "parameters": {"RV_FUNCNAME": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"FUNCNAME","ddicName":"FUNCNAME","description":"Function Module Name"});}, "is_optional": " "}}}, "VALIDATE_AND_UNPRETTIFY_XML": {"visibility": "I", "parameters": {"RV_XML": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_XML": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}}, "GET_INSTANCE": {"visibility": "U", "parameters": {"RO_DB": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_PERSISTENCE_DB", RTTIName: "\\CLASS=ZCL_ABAPGIT_PERSISTENCE_DB"});}, "is_optional": " "}}}, "ADD": {"visibility": "U", "parameters": {"IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}, "IV_VALUE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});}, "is_optional": " "}, "IV_DATA": {"type": () => {return new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"});}, "is_optional": " "}}}, "DELETE": {"visibility": "U", "parameters": {"IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}, "IV_VALUE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});}, "is_optional": " "}}}, "LIST": {"visibility": "U", "parameters": {"RT_CONTENT": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["TYPE","VALUE"]},"secondary":[]}, "zif_abapgit_persistence=>ty_contents");}, "is_optional": " "}}}, "LIST_BY_TYPE": {"visibility": "U", "parameters": {"RT_CONTENT": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["TYPE","VALUE"]},"secondary":[]}, "zif_abapgit_persistence=>ty_contents");}, "is_optional": " "}, "IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}}}, "LIST_BY_KEYS": {"visibility": "U", "parameters": {"RT_CONTENTS": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["TYPE","VALUE"]},"secondary":[]}, "zif_abapgit_persistence=>ty_contents");}, "is_optional": " "}, "IT_KEYS": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_persistence=>ty_repo_keys");}, "is_optional": " "}, "IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}}}, "LOCK": {"visibility": "U", "parameters": {"IV_MODE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ENQMODE","ddicName":"ENQMODE","description":"ENQMODE"});}, "is_optional": " "}, "IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}, "IV_VALUE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});}, "is_optional": " "}}}, "MODIFY": {"visibility": "U", "parameters": {"IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}, "IV_VALUE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});}, "is_optional": " "}, "IV_DATA": {"type": () => {return new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"});}, "is_optional": " "}}}, "READ": {"visibility": "U", "parameters": {"RV_DATA": {"type": () => {return new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"});}, "is_optional": " "}, "IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}, "IV_VALUE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});}, "is_optional": " "}}}, "UPDATE": {"visibility": "U", "parameters": {"IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}, "IV_VALUE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"});}, "is_optional": " "}, "IV_DATA": {"type": () => {return new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"});}, "is_optional": " "}}}, "VALIDATE_ENTRY_TYPE": {"visibility": "U", "parameters": {"IV_TYPE": {"type": () => {return new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"});}, "is_optional": " "}}}}; #go_db; #mv_update_function; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "get_update_function": this.#get_update_function.bind(this), "validate_and_unprettify_xml": this.#validate_and_unprettify_xml.bind(this), "add": this.add.bind(this), "delete": this.delete.bind(this), "list": this.list.bind(this), "list_by_type": this.list_by_type.bind(this), "list_by_keys": this.list_by_keys.bind(this), "lock": this.lock.bind(this), "modify": this.modify.bind(this), "read": this.read.bind(this), "update": this.update.bind(this), }; this.go_db = zcl_abapgit_persistence_db.go_db; this.#mv_update_function = new abap.types.Character(30, {"qualifiedName":"FUNCNAME","ddicName":"FUNCNAME","description":"Function Module Name"}); this.FRIENDS_ACCESS_INSTANCE["mv_update_function"] = this.#mv_update_function; this.c_tabname = zcl_abapgit_persistence_db.c_tabname; this.c_lock = zcl_abapgit_persistence_db.c_lock; this.c_type_settings = zcl_abapgit_persistence_db.c_type_settings; this.c_type_repo = zcl_abapgit_persistence_db.c_type_repo; this.c_type_repo_csum = zcl_abapgit_persistence_db.c_type_repo_csum; this.c_type_background = zcl_abapgit_persistence_db.c_type_background; this.c_type_packages = zcl_abapgit_persistence_db.c_type_packages; this.c_type_user = zcl_abapgit_persistence_db.c_type_user; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async add(INPUT) { let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let iv_value = INPUT?.iv_value; if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_VALUE") { iv_value = undefined; } if (iv_value === undefined) { iv_value = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}).set(INPUT.iv_value); } let iv_data = INPUT?.iv_data; if (iv_data?.getQualifiedName === undefined || iv_data.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR") { iv_data = undefined; } if (iv_data === undefined) { iv_data = new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"}).set(INPUT.iv_data); } let ls_table = new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}); await this.validate_entry_type({iv_type: iv_type}); ls_table.get().type.set(iv_type); ls_table.get().value.set(iv_value); ls_table.get().data_str.set(iv_data); await abap.statements.insertDatabase(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase(), {"values": ls_table}); abap.statements.assert(abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))); } async delete(INPUT) { let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let iv_value = INPUT?.iv_value; if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_VALUE") { iv_value = undefined; } if (iv_value === undefined) { iv_value = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}).set(INPUT.iv_value); } await this.lock({iv_type: iv_type, iv_value: iv_value}); await abap.statements.deleteDatabase(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase(), {"where": "\"type\" = '" + iv_type.get() + "' AND \"value\" = '" + iv_value.get() + "'"}); } async get_instance() { return zcl_abapgit_persistence_db.get_instance(); } static async get_instance() { let ro_db = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_PERSISTENCE_DB", RTTIName: "\\CLASS=ZCL_ABAPGIT_PERSISTENCE_DB"}); if (abap.compare.initial(zcl_abapgit_persistence_db.go_db)) { zcl_abapgit_persistence_db.go_db.set(await (new abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB']()).constructor_()); } ro_db.set(zcl_abapgit_persistence_db.go_db); return ro_db; } async #get_update_function() { let rv_funcname = new abap.types.Character(30, {"qualifiedName":"FUNCNAME","ddicName":"FUNCNAME","description":"Function Module Name"}); if (abap.compare.initial(this.#mv_update_function)) { this.#mv_update_function.set(abap.CharacterFactory.get(12, 'CALL_V1_PING')); if (abap.compare.eq((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_function_module()).get().zif_abapgit_function_module$function_exists({iv_function_module_name: this.#mv_update_function})), abap.builtin.abap_false)) { this.#mv_update_function.set(abap.CharacterFactory.get(28, 'BANK_OBJ_WORKL_RELEASE_LOCKS')); } } rv_funcname.set(this.#mv_update_function); return rv_funcname; } async list() { let rt_content = abap.types.TableFactory.construct(new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["TYPE","VALUE"]},"secondary":[]}, "zif_abapgit_persistence=>ty_contents"); await abap.statements.select(rt_content, {select: "SELECT * FROM " + abap.buildDbTableName(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase()) + ""}); return rt_content; } async list_by_keys(INPUT) { let rt_contents = abap.types.TableFactory.construct(new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["TYPE","VALUE"]},"secondary":[]}, "zif_abapgit_persistence=>ty_contents"); let it_keys = INPUT?.it_keys; if (it_keys?.getQualifiedName === undefined || it_keys.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_REPO_KEYS") { it_keys = undefined; } if (it_keys === undefined) { it_keys = abap.types.TableFactory.construct(new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_persistence=>ty_repo_keys").set(INPUT.it_keys); } let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let fs_ls_key_ = new abap.types.FieldSymbol(new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"})); for await (const unique536 of abap.statements.loop(it_keys)) { fs_ls_key_.assign(unique536); await abap.statements.select(rt_contents, {select: "SELECT * FROM " + abap.buildDbTableName(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase()) + " WHERE \"value\" = '" + fs_ls_key_.get() + "' AND \"type\" = '" + iv_type.get() + "'"}, {appending: true}); } return rt_contents; } async list_by_type(INPUT) { let rt_content = abap.types.TableFactory.construct(new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["TYPE","VALUE"]},"secondary":[]}, "zif_abapgit_persistence=>ty_contents"); let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } await abap.statements.select(rt_content, {select: "SELECT * FROM " + abap.buildDbTableName(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase()) + " WHERE \"type\" = '" + iv_type.get() + "' ORDER BY PRIMARY KEY"}); return rt_content; } async lock(INPUT) { let iv_mode = new abap.types.Character(1, {"qualifiedName":"ENQMODE","ddicName":"ENQMODE","description":"ENQMODE"}); if (INPUT && INPUT.iv_mode) {iv_mode.set(INPUT.iv_mode);} if (INPUT === undefined || INPUT.iv_mode === undefined) {iv_mode = abap.CharacterFactory.get(1, 'E');} let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let iv_value = INPUT?.iv_value; if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_VALUE") { iv_value = undefined; } if (iv_value === undefined) { iv_value = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}).set(INPUT.iv_value); } let lv_dummy_update_function = new abap.types.Character(30, {"qualifiedName":"FUNCNAME","ddicName":"FUNCNAME","description":"Function Module Name"}); try { if (abap.FunctionModules['ENQUEUE_EZABAPGIT'] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} } await abap.FunctionModules['ENQUEUE_EZABAPGIT']({exporting: {mode_zabapgit: iv_mode, type: iv_type, value: iv_value}}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "FOREIGN_LOCK": abap.builtin.sy.get().subrc.set(1); break; case "SYSTEM_FAILURE": abap.builtin.sy.get().subrc.set(2); break; default: abap.builtin.sy.get().subrc.set(3); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_t100(); } lv_dummy_update_function.set((await this.#get_update_function())); if (abap.FunctionModules[lv_dummy_update_function.get().trimEnd()] === undefined) { if (abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()] === undefined) { throw "CX_SY_DYN_CALL_ILLEGAL_FUNC not found"; } else { throw new abap.Classes['CX_SY_DYN_CALL_ILLEGAL_FUNC'.trimEnd()]();} } await abap.FunctionModules[lv_dummy_update_function.get().trimEnd()](); } async modify(INPUT) { let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let iv_value = INPUT?.iv_value; if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_VALUE") { iv_value = undefined; } if (iv_value === undefined) { iv_value = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}).set(INPUT.iv_value); } let iv_data = INPUT?.iv_data; if (iv_data?.getQualifiedName === undefined || iv_data.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR") { iv_data = undefined; } if (iv_data === undefined) { iv_data = new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"}).set(INPUT.iv_data); } let ls_content = new abap.types.Structure({ "type": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}), "value": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}), "data_str": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"})}, "zif_abapgit_persistence=>ty_content", undefined, {}, {}); await this.lock({iv_type: iv_type, iv_value: iv_value}); ls_content.get().type.set(iv_type); ls_content.get().value.set(iv_value); ls_content.get().data_str.set(iv_data); await abap.statements.modifyDatabase(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase(), {"values": ls_content}); if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(16, 'DB modify failed')}); } } async read(INPUT) { let rv_data = new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"}); let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let iv_value = INPUT?.iv_value; if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_VALUE") { iv_value = undefined; } if (iv_value === undefined) { iv_value = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}).set(INPUT.iv_value); } await abap.statements.select(rv_data, {select: "SELECT data_str FROM " + abap.buildDbTableName(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase()) + " WHERE \"type\" = '" + iv_type.get() + "' AND \"value\" = '" + iv_value.get() + "' UP TO 1 ROWS"}); if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { const unique537 = await (new abap.Classes['ZCX_ABAPGIT_NOT_FOUND']()).constructor_(); unique537.EXTRA_CX = {"INTERNAL_FILENAME": "zcl_abapgit_persistence_db.clas.abap","INTERNAL_LINE": 228}; throw unique537; } return rv_data; } async update(INPUT) { let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } let iv_value = INPUT?.iv_value; if (iv_value?.getQualifiedName === undefined || iv_value.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_VALUE") { iv_value = undefined; } if (iv_value === undefined) { iv_value = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_value"}).set(INPUT.iv_value); } let iv_data = INPUT?.iv_data; if (iv_data?.getQualifiedName === undefined || iv_data.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR") { iv_data = undefined; } if (iv_data === undefined) { iv_data = new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"}).set(INPUT.iv_data); } let lv_data = new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSISTENCE=>TY_CONTENT-DATA_STR"}); if (abap.compare.cs(iv_data, abap.CharacterFactory.get(5, '<?xml'))) { lv_data.set((await this.#validate_and_unprettify_xml({iv_xml: iv_data}))); } else { lv_data.set(iv_data); } await this.lock({iv_type: iv_type, iv_value: iv_value}); await abap.statements.updateDatabase(zcl_abapgit_persistence_db.c_tabname.get().trimEnd().toLowerCase(), {"where": "\"type\" = '" + iv_type.get() + "' AND \"value\" = '" + iv_value.get() + "'", "set": ["\"data_str\" = '" + lv_data.get() + "'"]}); if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(16, 'DB update failed')}); } } async #validate_and_unprettify_xml(INPUT) { let rv_xml = new abap.types.String({qualifiedName: "STRING"}); let iv_xml = INPUT?.iv_xml; if (iv_xml?.getQualifiedName === undefined || iv_xml.getQualifiedName() !== "STRING") { iv_xml = undefined; } if (iv_xml === undefined) { iv_xml = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_xml); } rv_xml.set((await abap.Classes['ZCL_ABAPGIT_XML_PRETTY'].print({iv_xml: iv_xml, iv_unpretty: abap.builtin.abap_true, iv_ignore_errors: abap.builtin.abap_false}))); return rv_xml; } async validate_entry_type(INPUT) { return zcl_abapgit_persistence_db.validate_entry_type(INPUT); } static async validate_entry_type(INPUT) { let iv_type = INPUT?.iv_type; if (iv_type?.getQualifiedName === undefined || iv_type.getQualifiedName() !== "ZIF_ABAPGIT_PERSISTENCE=>TY_TYPE") { iv_type = undefined; } if (iv_type === undefined) { iv_type = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}).set(INPUT.iv_type); } if (!(abap.compare.eq(iv_type, zcl_abapgit_persistence_db.c_type_repo) || abap.compare.eq(iv_type, zcl_abapgit_persistence_db.c_type_repo_csum) || abap.compare.eq(iv_type, zcl_abapgit_persistence_db.c_type_user) || abap.compare.eq(iv_type, zcl_abapgit_persistence_db.c_type_settings) || abap.compare.eq(iv_type, zcl_abapgit_persistence_db.c_type_background) || abap.compare.eq(iv_type, zcl_abapgit_persistence_db.c_type_packages))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Invalid DB entry type [${abap.templateFormatting(iv_type)}]`)}); } } } abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'] = zcl_abapgit_persistence_db; zcl_abapgit_persistence_db.go_db = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_PERSISTENCE_DB", RTTIName: "\\CLASS=ZCL_ABAPGIT_PERSISTENCE_DB"}); zcl_abapgit_persistence_db.c_tabname = new abap.types.Character(30, {}); zcl_abapgit_persistence_db.c_tabname.set('ZABAPGIT'); zcl_abapgit_persistence_db.c_lock = new abap.types.Character(30, {}); zcl_abapgit_persistence_db.c_lock.set('EZABAPGIT'); zcl_abapgit_persistence_db.c_type_settings = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}); zcl_abapgit_persistence_db.c_type_settings.set('SETTINGS'); zcl_abapgit_persistence_db.c_type_repo = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}); zcl_abapgit_persistence_db.c_type_repo.set('REPO'); zcl_abapgit_persistence_db.c_type_repo_csum = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}); zcl_abapgit_persistence_db.c_type_repo_csum.set('REPO_CS'); zcl_abapgit_persistence_db.c_type_background = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}); zcl_abapgit_persistence_db.c_type_background.set('BACKGROUND'); zcl_abapgit_persistence_db.c_type_packages = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}); zcl_abapgit_persistence_db.c_type_packages.set('PACKAGES'); zcl_abapgit_persistence_db.c_type_user = new abap.types.Character(12, {"qualifiedName":"zif_abapgit_persistence=>ty_type"}); zcl_abapgit_persistence_db.c_type_user.set('USER'); export {zcl_abapgit_persistence_db}; |