Skip to content

Commit

Permalink
feat: Support the new version of the com.sap.vocabularies.Hierarchy (#…
Browse files Browse the repository at this point in the history
…803)

* feat: Support the new version of the com.sap.vocabularies.Hierarchy

The property names in RecursiveHierarchyType have changed. We support
both versions.

* Removed debugger statement

* Create calm-ties-taste.md

---------

Co-authored-by: Nicolas Lunet <nicolas.lunet@sap.com>
  • Loading branch information
vescalier and nlunets committed Mar 19, 2024
1 parent df268f4 commit 270106c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-ties-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sap-ux/fe-mockserver-core": patch
---

feat: Support the new version of the com.sap.vocabularies.Hierarchy
39 changes: 27 additions & 12 deletions packages/fe-mockserver-core/src/mockdata/fileBasedMockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1134,25 +1134,40 @@ export class FileBasedMockData {
sourceReference = this.getSourceReference(aggregationAnnotation!);
return {
distanceFromRootProperty:
getPathOrPropertyPath(hierarchyAnnotation.DistanceFromRootProperty) ?? '$$distanceFromRootProperty',
getPathOrPropertyPath(
hierarchyAnnotation.DistanceFromRoot ?? hierarchyAnnotation.DistanceFromRootProperty
) ?? '$$distanceFromRootProperty',
drillStateProperty:
getPathOrPropertyPath(hierarchyAnnotation.DrillStateProperty) ?? '$$drillStateProperty',
getPathOrPropertyPath(hierarchyAnnotation.DrillState ?? hierarchyAnnotation.DrillStateProperty) ??
'$$drillStateProperty',
limitedDescendantCountProperty:
getPathOrPropertyPath(hierarchyAnnotation.LimitedDescendantCountProperty) ??
'$$limitedDescendantCountProperty',
getPathOrPropertyPath(
hierarchyAnnotation.LimitedDescendantCount ?? hierarchyAnnotation.LimitedDescendantCountProperty
) ?? '$$limitedDescendantCountProperty',
matchedDescendantCountProperty:
getPathOrPropertyPath(hierarchyAnnotation.MatchedDescendantCountProperty) ??
'$$matchedDescendantCountProperty',
matchedProperty: getPathOrPropertyPath(hierarchyAnnotation.MatchedProperty) ?? '$$matchedProperty',
getPathOrPropertyPath(
hierarchyAnnotation.MatchedDescendantCount ?? hierarchyAnnotation.MatchedDescendantCountProperty
) ?? '$$matchedDescendantCountProperty',
matchedProperty:
getPathOrPropertyPath(hierarchyAnnotation.Matched ?? hierarchyAnnotation.MatchedProperty) ??
'$$matchedProperty',
sourceReference
} as HierarchyDefinition;
}
return {
distanceFromRootProperty: getPathOrPropertyPath(hierarchyAnnotation.DistanceFromRootProperty),
drillStateProperty: getPathOrPropertyPath(hierarchyAnnotation.DrillStateProperty),
limitedDescendantCountProperty: getPathOrPropertyPath(hierarchyAnnotation.LimitedDescendantCountProperty),
matchedDescendantCountProperty: getPathOrPropertyPath(hierarchyAnnotation.MatchedDescendantCountProperty),
matchedProperty: getPathOrPropertyPath(hierarchyAnnotation.MatchedProperty)
distanceFromRootProperty: getPathOrPropertyPath(
hierarchyAnnotation.DistanceFromRoot ?? hierarchyAnnotation.DistanceFromRootProperty
),
drillStateProperty: getPathOrPropertyPath(
hierarchyAnnotation.DrillState ?? hierarchyAnnotation.DrillStateProperty
),
limitedDescendantCountProperty: getPathOrPropertyPath(
hierarchyAnnotation.LimitedDescendantCount ?? hierarchyAnnotation.LimitedDescendantCountProperty
),
matchedDescendantCountProperty: getPathOrPropertyPath(
hierarchyAnnotation.MatchedDescendantCount ?? hierarchyAnnotation.MatchedDescendantCountProperty
),
matchedProperty: getPathOrPropertyPath(hierarchyAnnotation.Matched ?? hierarchyAnnotation.MatchedProperty)
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
service v4treedraft {
@Aggregation.RecursiveHierarchy#SalesOrgHierarchy: {
NodeProperty: ID,
ParentNavigationProperty: Superordinate,
DistanceFromRootProperty: DistanceFromRoot
ParentNavigationProperty: Superordinate
}
@Hierarchy.RecursiveHierarchy#SalesOrgHierarchy: {
ExternalKeyProperty: ID,
LimitedDescendantCountProperty: LimitedDescendantCount,
DistanceFromRootProperty: DistanceFromRoot,
DrillStateProperty: DrillState,
MatchedProperty: Matched,
MatchedDescendantCountProperty: MatchedDescendantCount
ExternalKey: ID,
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot: DistanceFromRoot,
DrillState: DrillState,
Matched: Matched,
MatchedDescendantCount: MatchedDescendantCount
}
@Capabilities.FilterRestrictions: {
NonFilterableProperties: [LimitedDescendantCount,DistanceFromRoot,DrillState,Matched,MatchedDescendantCount]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
service v4tree {
@Aggregation.RecursiveHierarchy#SalesOrgHierarchy: {
NodeProperty: ID,
ParentNavigationProperty: Superordinate,
DistanceFromRootProperty: DistanceFromRoot
ParentNavigationProperty: Superordinate
}
@Hierarchy.RecursiveHierarchy#SalesOrgHierarchy: {
ExternalKeyProperty: ID,
LimitedDescendantCountProperty: LimitedDescendantCount,
DistanceFromRootProperty: DistanceFromRoot,
DrillStateProperty: DrillState,
MatchedProperty: Matched,
MatchedDescendantCountProperty: MatchedDescendantCount
ExternalKey: ID,
LimitedDescendantCount: LimitedDescendantCount,
DistanceFromRoot: DistanceFromRoot,
DrillState: DrillState,
Matched: Matched,
MatchedDescendantCount: MatchedDescendantCount
}
@Capabilities.FilterRestrictions: {
NonFilterableProperties: [LimitedDescendantCount,DistanceFromRoot,DrillState,Matched,MatchedDescendantCount]
Expand Down

0 comments on commit 270106c

Please sign in to comment.