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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 13x 13x 1x 1x 6x 6x 1x 1x 3x 3x 1x 1x 17x 17x 1x 1x 1x 1x 13x 13x 13x 13x 13x 13x 4x 7x 7x 7x 7x 7x 7x 7x 7x 7x 4x 13x 13x 13x 13x 13x 13x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 13x 13x 1x 1x | import {xmlToArray} from "../../xml_utils"; export enum FunctionModuleParameterDirection { importing = "importing", exporting = "exporting", changing = "changing", tables = "tables", } export interface IFunctionModuleParameter { name: string; direction: FunctionModuleParameterDirection; type: string | undefined; optional: boolean; defaultValue: string | undefined; } export class FunctionModuleDefinition { private name: string; private description: string | undefined; private parameters: IFunctionModuleParameter[]; public constructor(data: any) { this.parse(data); } public getParameters(): readonly IFunctionModuleParameter[] { return this.parameters; } public getDescription(): string | undefined { return this.description; } public getName(): string { return this.name; } /////////////// private parse(data: any) { if (data.FUNCNAME === undefined) { throw new Error("Function module name undefined"); } this.name = data.FUNCNAME; this.description = data.SHORT_TEXT; this.parameters = []; if (data.IMPORT) { for (const param of xmlToArray(data.IMPORT.RSIMP)) { if (param.PARAMETER === undefined) { throw new Error("Function module name parameter undefined, importing"); } this.parameters.push({ name: param.PARAMETER, direction: FunctionModuleParameterDirection.importing, type: param.TYP || param.DBFIELD, optional: param.OPTIONAL === "X", defaultValue: param.DEFAULT, }); } } if (data.CHANGING) { for (const param of xmlToArray(data.CHANGING.RSCHA)) { if (param.PARAMETER === undefined) { throw new Error("Function module name parameter undefined, changing"); } this.parameters.push({ name: param.PARAMETER, direction: FunctionModuleParameterDirection.changing, type: param.TYP || param.DBFIELD, optional: param.OPTIONAL === "X", defaultValue: param.DEFAULT, }); } } if (data.EXPORT) { for (const param of xmlToArray(data.EXPORT.RSEXP)) { if (param.PARAMETER === undefined) { throw new Error("Function module name parameter undefined, exporting"); } this.parameters.push({ name: param.PARAMETER, direction: FunctionModuleParameterDirection.exporting, type: param.TYP || param.DBFIELD, optional: true, defaultValue: undefined, }); } } if (data.TABLES) { for (const param of xmlToArray(data.TABLES.RSTBL)) { if (param.PARAMETER === undefined) { throw new Error("Function module name parameter undefined, tables"); } this.parameters.push({ name: param.PARAMETER, direction: FunctionModuleParameterDirection.tables, // table types are stored in TYP type: param.DBSTRUCT || param.TYP, optional: param.OPTIONAL === "X", defaultValue: undefined, }); } } } } |