-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
534 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
import { AbapObject } from "./AbapObject" | ||
import { AbapObject, AbapComponents } from "./AbapObject" | ||
import { Uri } from "vscode" | ||
import { AdtConnection } from "../adt/AdtConnection" | ||
import { parseNodeStructure } from "../adt/AdtNodeStructParser" | ||
import { pick } from "../functions" | ||
|
||
export class AbapPackage extends AbapObject { | ||
isLeaf() { | ||
return false | ||
} | ||
getUri(base: Uri): Uri { | ||
getChildren(connection: AdtConnection): Promise<AbapComponents> { | ||
const ptype = encodeURIComponent(this.type) | ||
const pname = encodeURIComponent(this.name) | ||
return base.with({ | ||
const query = `parent_name=${pname}&parent_tech_name=${pname}&parent_type=${ptype}&withShortDescriptions=true` | ||
|
||
const uri = Uri.parse("adt://" + connection.name).with({ | ||
path: "/sap/bc/adt/repository/nodestructure", | ||
query: `parent_name=${pname}&parent_tech_name=${pname}&parent_type=${ptype}&withShortDescriptions=true` | ||
query: this.name ? query : "" //hack for root of object tree, modeled as a nameless package | ||
}) | ||
return connection | ||
.request(uri, "POST") | ||
.then(pick("body")) | ||
.then(parseNodeStructure) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
import { AbapObject } from "./AbapObject" | ||
import { Uri } from "vscode" | ||
import { AbapObject, XML_EXTENSION } from "./AbapObject" | ||
|
||
export class AbapSimpleObject extends AbapObject { | ||
getUri(base: Uri): Uri { | ||
return base.with({ path: this.path }) | ||
} | ||
} | ||
export class AbapSimpleObject extends AbapObject {} | ||
export class AbapSimpleObjectXml extends AbapSimpleObject { | ||
getExtension() { | ||
return ".xml" | ||
return XML_EXTENSION | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { getNode, recxml2js, parsetoPromise } from "./AdtParserBase" | ||
|
||
import { | ||
mapWidth, | ||
ArrayToMap, | ||
filterComplex, | ||
defaultVal, | ||
GroupArray, | ||
selectMap | ||
} from "../functions" | ||
import { AbapComponents } from "../abap/AbapObject" | ||
import { fromObjectNode } from "../abap/AbapObjectFactory" | ||
import { convertableToString } from "xml2js" | ||
|
||
export interface ObjectNode { | ||
OBJECT_TYPE: string | ||
OBJECT_NAME: string | ||
TECH_NAME: string | ||
OBJECT_URI: string | ||
OBJECT_VIT_URI: string | ||
EXPANDABLE: string | ||
} | ||
|
||
interface CategoryNode { | ||
CATEGORY: string | ||
CATEGORY_LABEL: string | ||
} | ||
|
||
interface ObjectTypeNode { | ||
OBJECT_TYPE: string | ||
CATEGORY_TAG: string | ||
OBJECT_TYPE_LABEL: string | ||
NODE_ID: string | ||
} | ||
|
||
const treecontentParser = defaultVal( | ||
[], | ||
getNode( | ||
"asx:abap/asx:values/DATA/TREE_CONTENT/SEU_ADT_REPOSITORY_OBJ_NODE", | ||
filterComplex(true), | ||
mapWidth(recxml2js) | ||
) | ||
) as (xml: string) => Array<ObjectNode> | ||
const categoryNodeParser: (a: string) => Map<string, CategoryNode> = defaultVal( | ||
new Map(), | ||
getNode( | ||
"asx:abap/asx:values/DATA/CATEGORIES", | ||
filterComplex(true), | ||
"SEU_ADT_OBJECT_CATEGORY_INFO", | ||
mapWidth(recxml2js), | ||
ArrayToMap("CATEGORY") | ||
) | ||
) | ||
|
||
const ObjectTypeParser: (a: string) => Map<string, ObjectTypeNode> = defaultVal( | ||
new Map(), | ||
getNode( | ||
"asx:abap/asx:values/DATA/OBJECT_TYPES", | ||
filterComplex(true), | ||
"SEU_ADT_OBJECT_TYPE_INFO", | ||
mapWidth(recxml2js), | ||
ArrayToMap("OBJECT_TYPE") | ||
) | ||
) | ||
|
||
export const parseNodeStructure: ( | ||
rawpayload: convertableToString | ||
) => Promise<AbapComponents> = parsetoPromise((payload: any) => { | ||
const nodes = treecontentParser(payload) | ||
const categories = categoryNodeParser(payload) | ||
const objectTypes = ObjectTypeParser(payload) | ||
|
||
const catLabel = selectMap(categories, "CATEGORY_LABEL", "") | ||
const typeLabel = selectMap(objectTypes, "OBJECT_TYPE_LABEL", "") | ||
|
||
const types = GroupArray("OBJECT_TYPE")(nodes) | ||
const catTypes = GroupArray("CATEGORY_TAG")([...objectTypes.values()]) | ||
|
||
const components: AbapComponents = [] | ||
for (const [category, ctypes] of catTypes) { | ||
const cat = { | ||
name: catLabel(category), | ||
types: new Array<any>() | ||
} | ||
components.push(cat) | ||
for (const ctype of ctypes) { | ||
const typerec = types.get(ctype.OBJECT_TYPE) | ||
if (typerec) | ||
cat.types.push({ | ||
name: typeLabel(ctype.OBJECT_TYPE), | ||
objects: typerec.map(fromObjectNode) | ||
}) | ||
} | ||
} | ||
if (catTypes.size === 0) | ||
components.push({ | ||
name: "", | ||
types: [{ name: "", objects: nodes.map(fromObjectNode) }] | ||
}) | ||
|
||
return components | ||
}) |
Oops, something went wrong.