All files / output zcl_abapgit_services_abapgit.clas.mjs

38.46% Statements 45/117
100% Branches 2/2
4.16% Functions 1/24
38.46% Lines 45/117

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 1171x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x                       1x       1x     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_services_abapgit.clas.abap
class zcl_abapgit_services_abapgit {
  static STATIC_SUPER = undefined;
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'ZCL_ABAPGIT_SERVICES_ABAPGIT';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"C_ABAPGIT_REPO": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "U", "is_constant": "X", "is_class": "X"},
  "C_ABAPGIT_HOMEPAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "U", "is_constant": "X", "is_class": "X"},
  "C_ABAPGIT_WIKIPAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "U", "is_constant": "X", "is_class": "X"},
  "C_DOTABAP_HOMEPAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "U", "is_constant": "X", "is_class": "X"},
  "C_CHANGELOG_PATH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "U", "is_constant": "X", "is_class": "X"}};
  static METHODS = {"OPEN_URL_IN_BROWSER": {"visibility": "I", "parameters": {"IV_URL": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "StringType"}}},
  "OPEN_ABAPGIT_HOMEPAGE": {"visibility": "U", "parameters": {"IV_PAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "StringType"}}},
  "OPEN_ABAPGIT_WIKIPAGE": {"visibility": "U", "parameters": {"IV_PAGE": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " ", "parm_kind": "I", "type_name": "StringType"}}},
  "OPEN_DOTABAP_HOMEPAGE": {"visibility": "U", "parameters": {}},
  "OPEN_ABAPGIT_CHANGELOG": {"visibility": "U", "parameters": {}},
  "GET_ABAPGIT_TCODE": {"visibility": "U", "parameters": {"RV_TCODE": {"type": () => {return (() => { throw new Error("Void type: TCODE") })();}, "is_optional": " ", "parm_kind": "R", "type_name": "VoidType"}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
    this.c_abapgit_repo = zcl_abapgit_services_abapgit.c_abapgit_repo;
    this.c_abapgit_homepage = zcl_abapgit_services_abapgit.c_abapgit_homepage;
    this.c_abapgit_wikipage = zcl_abapgit_services_abapgit.c_abapgit_wikipage;
    this.c_dotabap_homepage = zcl_abapgit_services_abapgit.c_dotabap_homepage;
    this.c_changelog_path = zcl_abapgit_services_abapgit.c_changelog_path;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async get_abapgit_tcode() {
    return zcl_abapgit_services_abapgit.get_abapgit_tcode();
  }
  static async get_abapgit_tcode() {
    let rv_tcode = (() => { throw new Error("Void type: TCODE") })();
    let lc_report_tcode_hex = new abap.types.Hex();
    lc_report_tcode_hex.set('80');
    let lt_tcodes = abap.types.TableFactory.construct((() => { throw new Error("Void type: TCODE") })(), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");
    try {
      await abap.statements.select(lt_tcodes, {select: "SELECT \"tcode\" FROM " + abap.buildDbTableName("tstc") + " WHERE \"pgmna\" = '" + abap.builtin.sy.get().cprog.get() + "' AND \"cinfo\" = '" + lc_report_tcode_hex.get() + "' ORDER BY \"tcode\""});
    } catch (e) {
      if ((abap.Classes['CX_SY_DYNAMIC_OSQL_ERROR'] && e instanceof abap.Classes['CX_SY_DYNAMIC_OSQL_ERROR'])) {
        return rv_tcode;
      } else {
        throw e;
      }
    }
    if (abap.compare.gt(abap.builtin.lines({val: lt_tcodes}), abap.IntegerFactory.get(0))) {
      abap.statements.readTable(lt_tcodes,{index: abap.IntegerFactory.get(1),
        into: rv_tcode});
    }
    return rv_tcode;
  }
  async open_abapgit_changelog() {
    return zcl_abapgit_services_abapgit.open_abapgit_changelog();
  }
  static async open_abapgit_changelog() {
    await this.open_url_in_browser({iv_url: new abap.types.String().set(`${abap.templateFormatting(zcl_abapgit_services_abapgit.c_abapgit_repo)}${abap.templateFormatting(zcl_abapgit_services_abapgit.c_changelog_path)}`)});
  }
  async open_abapgit_homepage(INPUT) {
    return zcl_abapgit_services_abapgit.open_abapgit_homepage(INPUT);
  }
  static async open_abapgit_homepage(INPUT) {
    let iv_page = new abap.types.String({qualifiedName: "STRING"});
    if (INPUT && INPUT.iv_page) {iv_page.set(INPUT.iv_page);}
    await this.open_url_in_browser({iv_url: new abap.types.String().set(`${abap.templateFormatting(zcl_abapgit_services_abapgit.c_abapgit_homepage)}/${abap.templateFormatting(iv_page)}`)});
  }
  async open_abapgit_wikipage(INPUT) {
    return zcl_abapgit_services_abapgit.open_abapgit_wikipage(INPUT);
  }
  static async open_abapgit_wikipage(INPUT) {
    let iv_page = new abap.types.String({qualifiedName: "STRING"});
    if (INPUT && INPUT.iv_page) {iv_page.set(INPUT.iv_page);}
    await this.open_url_in_browser({iv_url: new abap.types.String().set(`${abap.templateFormatting(zcl_abapgit_services_abapgit.c_abapgit_wikipage)}/${abap.templateFormatting(iv_page)}`)});
  }
  async open_dotabap_homepage() {
    return zcl_abapgit_services_abapgit.open_dotabap_homepage();
  }
  static async open_dotabap_homepage() {
    await this.open_url_in_browser({iv_url: zcl_abapgit_services_abapgit.c_dotabap_homepage});
  }
  async open_url_in_browser(INPUT) {
    return zcl_abapgit_services_abapgit.open_url_in_browser(INPUT);
  }
  static async open_url_in_browser(INPUT) {
    let iv_url = INPUT?.iv_url;
    if (iv_url?.getQualifiedName === undefined || iv_url.getQualifiedName() !== "STRING") { iv_url = undefined; }
    if (iv_url === undefined) { iv_url = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_url); }
    let lx_error = new abap.types.ABAPObject({qualifiedName: "ZCX_ABAPGIT_EXCEPTION", RTTIName: "\\CLASS=ZCX_ABAPGIT_EXCEPTION"});
    try {
      await (await abap.Classes['ZCL_ABAPGIT_UI_FACTORY'].get_frontend_services()).get().zif_abapgit_frontend_services$execute({iv_document: iv_url});
    } catch (e) {
      if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
        lx_error.set(e);
        await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: abap.CharacterFactory.get(40, 'Opening page in external browser failed.'), ix_previous: lx_error});
      } else {
        throw e;
      }
    }
  }
}
abap.Classes['ZCL_ABAPGIT_SERVICES_ABAPGIT'] = zcl_abapgit_services_abapgit;
zcl_abapgit_services_abapgit.c_abapgit_repo = new abap.types.String({qualifiedName: "STRING"});
zcl_abapgit_services_abapgit.c_abapgit_repo.set('https://github.com/abapGit/abapGit');
zcl_abapgit_services_abapgit.c_abapgit_homepage = new abap.types.String({qualifiedName: "STRING"});
zcl_abapgit_services_abapgit.c_abapgit_homepage.set('https://www.abapgit.org');
zcl_abapgit_services_abapgit.c_abapgit_wikipage = new abap.types.String({qualifiedName: "STRING"});
zcl_abapgit_services_abapgit.c_abapgit_wikipage.set('https://docs.abapgit.org');
zcl_abapgit_services_abapgit.c_dotabap_homepage = new abap.types.String({qualifiedName: "STRING"});
zcl_abapgit_services_abapgit.c_dotabap_homepage.set('https://dotabap.org');
zcl_abapgit_services_abapgit.c_changelog_path = new abap.types.String({qualifiedName: "STRING"});
zcl_abapgit_services_abapgit.c_changelog_path.set('/blob/main/changelog.txt');
export {zcl_abapgit_services_abapgit};