All files / output zcl_abapgit_persist_settings.clas.mjs

5.47% Statements 4/73
66.66% Branches 2/3
50% Functions 1/2
5.47% Lines 4/73

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 731x 1x                                                                                                                                           1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_persist_settings.clas.abap
class zcl_abapgit_persist_settings {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_PERSIST_SETTINGS';
  static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_PERSIST_SETTINGS"];
  static ATTRIBUTES = {"MO_SETTINGS": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {};
  #mo_settings;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
    this.#mo_settings = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"});
    this.FRIENDS_ACCESS_INSTANCE["mo_settings"] = this.#mo_settings;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async zif_abapgit_persist_settings$modify(INPUT) {
    let io_settings = INPUT?.io_settings;
    if (io_settings?.getQualifiedName === undefined || io_settings.getQualifiedName() !== "ZCL_ABAPGIT_SETTINGS") { io_settings = undefined; }
    if (io_settings === undefined) { io_settings = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"}).set(INPUT.io_settings); }
    let lv_settings = new abap.types.String({qualifiedName: "STRING"});
    let ls_user_settings = new abap.types.Structure({
    "max_lines": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-MAX_LINES"}),
    "adt_jump_enabled": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "show_default_repo": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "link_hints_enabled": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "link_hint_key": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_persist_user=>ty_s_user_settings-link_hint_key"}),
    "parallel_proc_disabled": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "icon_scaling": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_persist_user=>ty_s_user_settings-icon_scaling"}),
    "ui_theme": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-UI_THEME"}),
    "hide_sapgui_hint": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "activate_wo_popup": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}),
    "label_colors": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-LABEL_COLORS"}),
    "default_git_uname": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-DEFAULT_GIT_UNAME"}),
    "default_git_email": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_PERSIST_USER=>TY_S_USER_SETTINGS-DEFAULT_GIT_EMAIL"})}, "zif_abapgit_persist_user=>ty_s_user_settings", undefined, {}, {});
    lv_settings.set((await io_settings.get().get_settings_xml()));
    await (await abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].get_instance()).get().modify({iv_type: abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].c_type_settings, iv_value: abap.CharacterFactory.get(1, ''), iv_data: lv_settings});
    ls_user_settings.set((await io_settings.get().get_user_settings()));
    await (await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user()).get().zif_abapgit_persist_user$set_settings({is_user_settings: ls_user_settings});
    if (abap.compare.initial(this.#mo_settings) === false) {
      await this.#mo_settings.get().set_xml_settings({iv_settings_xml: lv_settings});
      await this.#mo_settings.get().set_user_settings({is_user_settings: ls_user_settings});
    }
  }
  async zif_abapgit_persist_settings$read() {
    let ro_settings = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"});
    if (abap.compare.initial(this.#mo_settings) === false) {
      ro_settings.set(this.#mo_settings);
      return ro_settings;
    }
    ro_settings.set(await (new abap.Classes['ZCL_ABAPGIT_SETTINGS']()).constructor_());
    try {
      await ro_settings.get().set_xml_settings({iv_settings_xml: (await (await abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].get_instance()).get().read({iv_type: abap.Classes['ZCL_ABAPGIT_PERSISTENCE_DB'].c_type_settings, iv_value: abap.CharacterFactory.get(1, '')}))});
      await ro_settings.get().set_user_settings({is_user_settings: (await (await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_user()).get().zif_abapgit_persist_user$get_settings())});
    } catch (e) {
      if ((abap.Classes['ZCX_ABAPGIT_NOT_FOUND'] && e instanceof abap.Classes['ZCX_ABAPGIT_NOT_FOUND']) || (abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
        await ro_settings.get().set_defaults();
      } else {
        throw e;
      }
    }
    this.#mo_settings.set(ro_settings);
    return ro_settings;
  }
}
abap.Classes['ZCL_ABAPGIT_PERSIST_SETTINGS'] = zcl_abapgit_persist_settings;
export {zcl_abapgit_persist_settings};