forked from SAP-samples/fiori-elements-feature-showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcapabilities.cds
More file actions
125 lines (115 loc) · 4.22 KB
/
capabilities.cds
File metadata and controls
125 lines (115 loc) · 4.22 KB
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
117
118
119
120
121
122
123
124
125
using LROPODataService as srv from '../../srv/list-report-srv';
annotate srv.RootEntities with @odata.draft.enabled; //Search-Term: #Draft
annotate srv.RootEntities with @(
//Disables the delete option dependent of the fields value
Capabilities.DeleteRestrictions : {
Deletable : deletePossible, //Search-Term: #DynamicCRUD
},
/* Capabilities.UpdateRestrictions : {
Updatable : updatePossible, //UpdateRestrictions are ignored in determining if the edit button is visible or not, but it still affects wheather the fields are editable or not
}, */
UI.UpdateHidden : updateHidden,//Search-Term: #DynamicCRUD
UI.CreateHidden: { $edmJson: { $Path: '/Singleton/createHidden' } }, //Search-Term: #DynamicCRUD
Capabilities.FilterRestrictions : {
FilterExpressionRestrictions : [
{
//Search-Term: #SemanticDateFilter
Property : 'validFrom',
AllowedExpressions : 'SingleRange' //Other option: SingleValue
},
],
// RequiredProperties : [
// stringProperty //Search-Term: #RequiredFilter
// ]
},
) {
validTo @UI.DateTimeStyle : 'short'
};
annotate LROPODataService with @(
Capabilities.FilterFunctions : [
'tolower' //Search-Term: #CaseInsensitiveFiltering
],
);
annotate srv.ChartDataEntities with @(
//Search-Term: #ChartSection
Aggregation.ApplySupported : {
GroupableProperties : [
dimensions,
criticality_code
],
AggregatableProperties : [
{Property : integerValue},
],
}
);
annotate srv.ChartDataEntities with {
//Search-Term: #ChartSection
criticality @(
UI.ValueCriticality : [
{
Value : 0,
Criticality : #Neutral
},
{
Value : 1,
Criticality : #Negative
},
{
Value : 2,
Criticality : #Critical
},
{
Value : 3,
Criticality : #Positive
}
]
);
integerValue @(
Measures.ISOCurrency : uom_code,
Core.Immutable : true,
);
};
// Search-Term: #TreeTable
annotate srv.OrganizationalUnits @(
Aggregation.RecursiveHierarchy #OrgUnitsHierarchy : {
ParentNavigationProperty : superOrdinateOrgUnit, // navigates to a node's parent
NodeProperty : ID, // identifies a node, usually the key
},
Hierarchy.RecursiveHierarchyActions #OrgUnitsHierarchy : {
ChangeSiblingForRootsSupported: true, // Disables move up/down of root nodes. Does not disable promotion of child nodes!
ChangeNextSiblingAction : 'LROPODataService.moveOrgUnit',
CopyAction : 'LROPODataService.copyOrgUnit',
},
// To disable cut, paste & drag & drop & move up & down. Copy & Paste still allowed
// Be aware this currently does only affect the UI but not enforce the restriction on API level!
// Capabilities: {UpdateRestrictions: {NonUpdatableNavigationProperties: [superOrdinateOrgUnit]}}
);
// Fiori expects the following to be defined explicitly, even though they're always the same
extend srv.OrganizationalUnits with @(
// The columns expected by Fiori to be present in hierarchy entities
Hierarchy.RecursiveHierarchy #OrgUnitsHierarchy : {
LimitedDescendantCount : LimitedDescendantCount,
DistanceFromRoot : DistanceFromRoot,
DrillState : DrillState,
LimitedRank : LimitedRank
},
// Disallow filtering on these properties from Fiori UIs
Capabilities.FilterRestrictions.NonFilterableProperties: [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'LimitedRank'
],
// Disallow sorting on these properties from Fiori UIs
Capabilities.SortRestrictions.NonSortableProperties : [
'LimitedDescendantCount',
'DistanceFromRoot',
'DrillState',
'LimitedRank'
],
) columns { // Ensure we can query these fields from database
null as LimitedDescendantCount : Int16,
null as DistanceFromRoot : Int16,
null as DrillState : String,
null as LimitedRank : Int16,
};