All files / output zcl_abapgit_folder_logic.clas.mjs

89.01% Statements 235/264
64.38% Branches 47/73
40% Functions 12/30
89.01% Lines 235/264

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 2641x 1x 1x 52x 52x 52x 52x 52x     52x 52x     52x 52x 1x 1x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x 52x     52x 52x 52x 52x 52x 52x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 16x 15x 15x 16x 16x 16x 16x 16x 5x 5x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 11x 16x     11x 16x 52x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 61x 35x 35x 61x 10x 61x 16x 16x 11x 11x 11x 5x 5x 3x 3x 11x 3x 3x       3x 3x 3x       3x     11x 11x     11x 6x 6x 11x     11x 11x 11x 11x 11x 11x 16x 26x 26x 61x 52x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x     21x 21x 1x 1x 20x 20x 20x 21x 17x 11x 17x 6x 6x 6x 6x 6x 17x 20x 20x 20x 21x 15x 15x 15x 15x 15x 4x 4x 4x 3x 3x 15x 7x 11x 4x 4x     15x 15x     15x 15x 15x 15x 15x 15x 15x   15x 15x 15x 15x     15x 15x 20x 20x 20x 21x 52x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
await import("./zcl_abapgit_folder_logic.clas.locals.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_folder_logic.clas.abap
class zcl_abapgit_folder_logic {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_FOLDER_LOGIC';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MT_TOP_SUBPACKAGES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
  "namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
  "parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["DEVCLASS"]},"secondary":[]}, "zcl_abapgit_folder_logic=>ty_devclass_info_tt");}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MT_PARENT": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
  "namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
  "parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["DEVCLASS"]},"secondary":[]}, "zcl_abapgit_folder_logic=>ty_devclass_info_tt");}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"GET_PARENT": {"visibility": "O", "parameters": {"RV_PARENT": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}, "IV_TOP": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}, "IV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}}},
  "PACKAGE_TO_PATH": {"visibility": "U", "parameters": {"RV_PATH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_TOP": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}, "IO_DOT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_DOT_ABAPGIT", RTTIName: "\\CLASS=ZCL_ABAPGIT_DOT_ABAPGIT"});}, "is_optional": " "}, "IV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}}},
  "PATH_TO_PACKAGE": {"visibility": "U", "parameters": {"RV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}, "IV_TOP": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}, "IO_DOT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_DOT_ABAPGIT", RTTIName: "\\CLASS=ZCL_ABAPGIT_DOT_ABAPGIT"});}, "is_optional": " "}, "IV_PATH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_CREATE_IF_NOT_EXISTS": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}}},
  "GET_INSTANCE": {"visibility": "U", "parameters": {"RO_INSTANCE": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_FOLDER_LOGIC", RTTIName: "\\CLASS=ZCL_ABAPGIT_FOLDER_LOGIC"});}, "is_optional": " "}}}};
  #mt_top_subpackages;
  #mt_parent;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "get_parent": this.get_parent.bind(this),
      "package_to_path": this.package_to_path.bind(this),
      "path_to_package": this.path_to_package.bind(this),
    };
    this.#mt_top_subpackages = abap.types.TableFactory.construct(new abap.types.Structure({
    "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
    "namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
    "parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["DEVCLASS"]},"secondary":[]}, "zcl_abapgit_folder_logic=>ty_devclass_info_tt");
    this.FRIENDS_ACCESS_INSTANCE["mt_top_subpackages"] = this.#mt_top_subpackages;
    this.#mt_parent = abap.types.TableFactory.construct(new abap.types.Structure({
    "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
    "namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
    "parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["DEVCLASS"]},"secondary":[]}, "zcl_abapgit_folder_logic=>ty_devclass_info_tt");
    this.FRIENDS_ACCESS_INSTANCE["mt_parent"] = this.#mt_parent;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async get_instance() {
    return zcl_abapgit_folder_logic.get_instance();
  }
  static async get_instance() {
    let ro_instance = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_FOLDER_LOGIC", RTTIName: "\\CLASS=ZCL_ABAPGIT_FOLDER_LOGIC"});
    ro_instance.set(await (new abap.Classes['ZCL_ABAPGIT_FOLDER_LOGIC']()).constructor_());
    return ro_instance;
  }
  async get_parent(INPUT) {
    let rv_parent = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});
    let iv_top = INPUT?.iv_top;
    if (iv_top?.getQualifiedName === undefined || iv_top.getQualifiedName() !== "DEVCLASS") { iv_top = undefined; }
    if (iv_top === undefined) { iv_top = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_top); }
    let iv_package = INPUT?.iv_package;
    if (iv_package?.getQualifiedName === undefined || iv_package.getQualifiedName() !== "DEVCLASS") { iv_package = undefined; }
    if (iv_package === undefined) { iv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_package); }
    let ls_parent = new abap.types.Structure({
    "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
    "namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
    "parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {});
    if (abap.compare.initial(this.#mt_top_subpackages)) {
      this.#mt_top_subpackages.set((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: iv_top})).get().zif_abapgit_sap_package$list_subpackages()));
    }
    abap.statements.readTable(this.#mt_top_subpackages,{withKey: (i) => {return abap.compare.eq(i.devclass, iv_package);},
      withKeyValue: [{key: (i) => {return i.devclass}, value: iv_package}],
      usesTableLine: false,
      withKeySimple: {"devclass": iv_package}});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      return rv_parent;
    }
    abap.statements.readTable(this.#mt_parent,{withTableKey: true,
      into: ls_parent,
      withKey: (i) => {return abap.compare.eq(i.devclass, iv_package);},
      withKeyValue: [{key: (i) => {return i.devclass}, value: iv_package}],
      usesTableLine: false,
      withKeySimple: {"devclass": iv_package}});
    if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
      rv_parent.set((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: iv_package})).get().zif_abapgit_sap_package$read_parent()));
      ls_parent.get().devclass.set(iv_package);
      ls_parent.get().parentcl.set(rv_parent);
      abap.statements.insertInternal({data: ls_parent, table: this.#mt_parent});
    } else {
      rv_parent.set(ls_parent.get().parentcl);
    }
    return rv_parent;
  }
  async package_to_path(INPUT) {
    let rv_path = new abap.types.String({qualifiedName: "STRING"});
    let iv_top = INPUT?.iv_top;
    if (iv_top?.getQualifiedName === undefined || iv_top.getQualifiedName() !== "DEVCLASS") { iv_top = undefined; }
    if (iv_top === undefined) { iv_top = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_top); }
    let io_dot = INPUT?.io_dot;
    if (io_dot?.getQualifiedName === undefined || io_dot.getQualifiedName() !== "ZCL_ABAPGIT_DOT_ABAPGIT") { io_dot = undefined; }
    if (io_dot === undefined) { io_dot = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_DOT_ABAPGIT", RTTIName: "\\CLASS=ZCL_ABAPGIT_DOT_ABAPGIT"}).set(INPUT.io_dot); }
    let iv_package = INPUT?.iv_package;
    if (iv_package?.getQualifiedName === undefined || iv_package.getQualifiedName() !== "DEVCLASS") { iv_package = undefined; }
    if (iv_package === undefined) { iv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_package); }
    let lv_len = new abap.types.Integer({qualifiedName: "I"});
    let lv_path = new abap.types.String({qualifiedName: "STRING"});
    let lv_message = new abap.types.String({qualifiedName: "STRING"});
    let lv_parentcl = new abap.types.Character(30, {"description":"PARENTCL"});
    let lv_folder_logic = new abap.types.String({qualifiedName: "STRING"});
    rv_path.set((await abap.Classes['CLAS-ZCL_ABAPGIT_FOLDER_LOGIC-LCL_PACKAGE_TO_PATH'].get({iv_top: iv_top, io_dot: io_dot, iv_package: iv_package})));
    if (abap.compare.initial(rv_path) === false) {
      return rv_path;
    }
    if (abap.compare.eq(iv_top, iv_package)) {
      rv_path.set((await io_dot.get().get_starting_folder()));
    } else {
      lv_parentcl.set((await this.get_parent({iv_top: iv_top, iv_package: iv_package})));
      if (abap.compare.initial(lv_parentcl) === false) {
        lv_folder_logic.set((await io_dot.get().get_folder_logic()));
        let unique337 = lv_folder_logic;
        if (abap.compare.eq(unique337, abap.Classes['ZIF_ABAPGIT_DOT_ABAPGIT'].zif_abapgit_dot_abapgit$c_folder_logic.get().full)) {
          lv_len.set(abap.IntegerFactory.get(0));
          if (abap.compare.eq(iv_package.getOffset({length: 1}), abap.CharacterFactory.get(1, '$'))) {
            lv_len.set(abap.IntegerFactory.get(1));
          }
        } else if (abap.compare.eq(unique337, abap.Classes['ZIF_ABAPGIT_DOT_ABAPGIT'].zif_abapgit_dot_abapgit$c_folder_logic.get().prefix)) {
          lv_len.set(abap.builtin.strlen({val: lv_parentcl}));
          if (abap.compare.ne(iv_package.getOffset({length: lv_len}), lv_parentcl)) {
            lv_message.set(abap.operators.concat(new abap.types.String().set(`PREFIX: Unexpected package naming `),abap.operators.concat(new abap.types.String().set(`(top: ${abap.templateFormatting(iv_top)}, parent: ${abap.templateFormatting(lv_parentcl)}, child: ${abap.templateFormatting(iv_package)}). `),new abap.types.String().set(`Try using the folder logic FULL`))));
            await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lv_message});
          }
        } else if (abap.compare.eq(unique337, abap.Classes['ZIF_ABAPGIT_DOT_ABAPGIT'].zif_abapgit_dot_abapgit$c_folder_logic.get().mixed)) {
          lv_len.set(abap.builtin.strlen({val: iv_top}));
          if (abap.compare.ne(iv_package.getOffset({length: lv_len}), iv_top)) {
            lv_message.set(abap.operators.concat(new abap.types.String().set(`MIXED: Unexpected package naming `),abap.operators.concat(new abap.types.String().set(`(top: ${abap.templateFormatting(iv_top)}, parent: ${abap.templateFormatting(lv_parentcl)}, child: ${abap.templateFormatting(iv_package)}). `),new abap.types.String().set(`Try using the folder logic FULL`))));
            await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: lv_message});
          }
        } else {
          await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Invalid folder logic: ${abap.templateFormatting(lv_folder_logic)}`)});
        }
        lv_path.set(iv_package.getOffset({offset: lv_len}));
        if (abap.compare.eq(abap.builtin.strlen({val: lv_path}), abap.IntegerFactory.get(0))) {
          await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Folder logic: length = 0, parent: ${abap.templateFormatting(lv_parentcl)}, child: ${abap.templateFormatting(iv_package)}`)});
        }
        if (abap.compare.eq(lv_path.getOffset({length: 1}), abap.CharacterFactory.get(1, '_'))) {
          lv_path.set(lv_path.getOffset({offset: 1}));
        }
        if (abap.compare.eq(abap.builtin.strlen({val: lv_path}), abap.IntegerFactory.get(0))) {
          await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Folder logic: length = 0, parent: ${abap.templateFormatting(lv_parentcl)}, child: ${abap.templateFormatting(iv_package)}`)});
        }
        abap.statements.translate(lv_path, '/#');
        abap.statements.translate(lv_path, "LOWER");
        abap.statements.concatenate({source: [lv_path, abap.CharacterFactory.get(1, '/')], target: lv_path});
        rv_path.set((await this.package_to_path({iv_top: iv_top, io_dot: io_dot, iv_package: lv_parentcl})));
        abap.statements.concatenate({source: [rv_path, lv_path], target: rv_path});
      }
    }
    await abap.Classes['CLAS-ZCL_ABAPGIT_FOLDER_LOGIC-LCL_PACKAGE_TO_PATH'].add({iv_top: iv_top, io_dot: io_dot, iv_package: iv_package, iv_path: rv_path});
    return rv_path;
  }
  async path_to_package(INPUT) {
    let rv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});
    let iv_top = INPUT?.iv_top;
    if (iv_top?.getQualifiedName === undefined || iv_top.getQualifiedName() !== "DEVCLASS") { iv_top = undefined; }
    if (iv_top === undefined) { iv_top = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_top); }
    let io_dot = INPUT?.io_dot;
    if (io_dot?.getQualifiedName === undefined || io_dot.getQualifiedName() !== "ZCL_ABAPGIT_DOT_ABAPGIT") { io_dot = undefined; }
    if (io_dot === undefined) { io_dot = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_DOT_ABAPGIT", RTTIName: "\\CLASS=ZCL_ABAPGIT_DOT_ABAPGIT"}).set(INPUT.io_dot); }
    let iv_path = INPUT?.iv_path;
    if (iv_path?.getQualifiedName === undefined || iv_path.getQualifiedName() !== "STRING") { iv_path = undefined; }
    if (iv_path === undefined) { iv_path = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_path); }
    let iv_create_if_not_exists = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});
    if (INPUT && INPUT.iv_create_if_not_exists) {iv_create_if_not_exists.set(INPUT.iv_create_if_not_exists);}
    if (INPUT === undefined || INPUT.iv_create_if_not_exists === undefined) {iv_create_if_not_exists = abap.builtin.abap_true;}
    let lv_length = new abap.types.Integer({qualifiedName: "I"});
    let lv_parent = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});
    let ls_package = new abap.types.Structure({
    "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
    "dlvunit": new abap.types.Character(30, {"description":"DLVUNIT"}),
    "component": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_sap_package=>ty_create-component"}),
    "ctext": new abap.types.Character(60, {"qualifiedName":"zif_abapgit_sap_package=>ty_create-ctext"}),
    "parentcl": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
    "pdevclass": new abap.types.Character(4, {"qualifiedName":"zif_abapgit_sap_package=>ty_create-pdevclass"}),
    "as4user": new abap.types.Character(12, {"qualifiedName":"USNAM","ddicName":"USNAM","description":"USNAM"})}, "zif_abapgit_sap_package=>ty_create", undefined, {}, {});
    let lv_new = new abap.types.String({qualifiedName: "STRING"});
    let lv_path = new abap.types.String({qualifiedName: "STRING"});
    let lv_absolute_name = new abap.types.String({qualifiedName: "STRING"});
    let lv_folder_logic = new abap.types.String({qualifiedName: "STRING"});
    let lt_unique_package_names = abap.types.TableFactory.construct(new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"HASHED","isUnique":true,"keyFields":["TABLE_LINE"]},"secondary":[]}, "");
    lv_length.set((abap.builtin.strlen({val: (await io_dot.get().get_starting_folder())})));
    if (abap.compare.gt(lv_length, abap.builtin.strlen({val: iv_path}))) {
      return rv_package;
    }
    rv_package.set((await abap.Classes['CLAS-ZCL_ABAPGIT_FOLDER_LOGIC-LCL_PATH_TO_PACKAGE'].get({iv_top: iv_top, io_dot: io_dot, iv_path: iv_path})));
    if (abap.compare.initial(rv_package) === false && abap.compare.eq(iv_create_if_not_exists, abap.builtin.abap_false)) {
      return rv_package;
    }
    lv_path.set(iv_path.getOffset({offset: lv_length}));
    lv_parent.set(iv_top);
    rv_package.set(iv_top);
    if (abap.compare.eq(iv_create_if_not_exists, abap.builtin.abap_true)) {
      if (abap.compare.eq(iv_top.getOffset({length: 1}), abap.CharacterFactory.get(1, '$'))) {
        await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: iv_top})).get().zif_abapgit_sap_package$create_local();
      } else {
        ls_package.get().devclass.set(iv_top);
        ls_package.get().ctext.set(iv_top);
        ls_package.get().as4user.set(abap.builtin.sy.get().uname);
        await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: iv_top})).get().zif_abapgit_sap_package$create({is_package: ls_package});
      }
    }
    abap.statements.insertInternal({data: iv_top, table: lt_unique_package_names});
    const indexBackup1 = abap.builtin.sy.get().index.get();
    let unique338 = 1;
    while (abap.compare.ca(lv_path, abap.CharacterFactory.get(1, '/'))) {
      abap.builtin.sy.get().index.set(unique338++);
      abap.statements.split({source: lv_path, at: abap.CharacterFactory.get(1, '/'), targets: [lv_new,lv_path]});
      lv_folder_logic.set((await io_dot.get().get_folder_logic()));
      let unique339 = lv_folder_logic;
      if (abap.compare.eq(unique339, abap.Classes['ZIF_ABAPGIT_DOT_ABAPGIT'].zif_abapgit_dot_abapgit$c_folder_logic.get().full)) {
        lv_absolute_name.set(lv_new);
        abap.statements.translate(lv_absolute_name, '#/');
        if (abap.compare.eq(iv_top.getOffset({length: 1}), abap.CharacterFactory.get(1, '$'))) {
          abap.statements.concatenate({source: [abap.CharacterFactory.get(1, '$'), lv_absolute_name], target: lv_absolute_name});
        }
      } else if (abap.compare.eq(unique339, abap.Classes['ZIF_ABAPGIT_DOT_ABAPGIT'].zif_abapgit_dot_abapgit$c_folder_logic.get().prefix)) {
        abap.statements.concatenate({source: [rv_package, abap.CharacterFactory.get(1, '_'), lv_new], target: lv_absolute_name});
      } else if (abap.compare.eq(unique339, abap.Classes['ZIF_ABAPGIT_DOT_ABAPGIT'].zif_abapgit_dot_abapgit$c_folder_logic.get().mixed)) {
        abap.statements.concatenate({source: [iv_top, abap.CharacterFactory.get(1, '_'), lv_new], target: lv_absolute_name});
      } else {
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Invalid folder logic: ${abap.templateFormatting(lv_folder_logic)}`)});
      }
      abap.statements.translate(lv_absolute_name, "UPPER");
      if (abap.compare.gt(abap.builtin.strlen({val: lv_absolute_name}), abap.IntegerFactory.get(30))) {
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Package ${abap.templateFormatting(lv_absolute_name)} exceeds ABAP 30-characters name limit`)});
      }
      rv_package.set(lv_absolute_name);
      abap.statements.readTable(lt_unique_package_names,{withTableKey: true,
        withKey: (i) => {return abap.compare.eq(i.table_line, rv_package);},
        withKeyValue: [{key: (i) => {return i.table_line}, value: rv_package}],
        usesTableLine: true,
        withKeySimple: {"table_line": rv_package}});
      if (abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) {
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Package ${abap.templateFormatting(rv_package)} has a subpackage with the same name`)});
      } else {
        abap.statements.insertInternal({data: rv_package, table: lt_unique_package_names});
      }
      if (abap.compare.eq((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: rv_package})).get().zif_abapgit_sap_package$exists()), abap.builtin.abap_false) && abap.compare.eq(iv_create_if_not_exists, abap.builtin.abap_true)) {
        await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: lv_parent})).get().zif_abapgit_sap_package$create_child({iv_child: rv_package});
      }
      lv_parent.set(rv_package);
    }
    abap.builtin.sy.get().index.set(indexBackup1);
    await abap.Classes['CLAS-ZCL_ABAPGIT_FOLDER_LOGIC-LCL_PATH_TO_PACKAGE'].add({iv_top: iv_top, io_dot: io_dot, iv_path: iv_path, iv_package: rv_package});
    return rv_package;
  }
}
abap.Classes['ZCL_ABAPGIT_FOLDER_LOGIC'] = zcl_abapgit_folder_logic;
zcl_abapgit_folder_logic.ty_devclass_info = new abap.types.Structure({
"devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
"namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
"parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {});
zcl_abapgit_folder_logic.ty_devclass_info_tt = abap.types.TableFactory.construct(new abap.types.Structure({
"devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}),
"namespace": new abap.types.Character(10, {"qualifiedName":"NAMESPACE","ddicName":"NAMESPACE","description":"NAMESPACE"}),
"parentcl": new abap.types.Character(30, {"qualifiedName":"PARENTCL","ddicName":"PARENTCL","description":"PARENTCL"})}, "zcl_abapgit_folder_logic=>ty_devclass_info", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"SORTED","isUnique":true,"keyFields":["DEVCLASS"]},"secondary":[]}, "zcl_abapgit_folder_logic=>ty_devclass_info_tt");
export {zcl_abapgit_folder_logic};