@sap/artifact-management 1.25.0 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/projectapi.js +1 -1
  2. package/dist/projectapi.js.LICENSE.txt +139 -0
  3. package/dist/src/cp/CFProjectBuilder.js +20 -6
  4. package/dist/src/cp/CFProjectBuilder.js.map +1 -1
  5. package/dist/src/cp/templates/launchpad-ui5-app-template/package.json +1 -1
  6. package/dist/src/plugins/cap/generators/CapDestinationModuleGenerator.js +1 -0
  7. package/dist/src/plugins/cap/generators/CapDestinationModuleGenerator.js.map +1 -1
  8. package/dist/src/plugins/cap/generators/CapProjectGenerator.js +15 -0
  9. package/dist/src/plugins/cap/generators/CapProjectGenerator.js.map +1 -1
  10. package/dist/src/plugins/cap/readers/CapModuleReader.js +9 -1
  11. package/dist/src/plugins/cap/readers/CapModuleReader.js.map +1 -1
  12. package/dist/src/plugins/cap/readers/calculation-view/CalculationViewItemReader.js +446 -0
  13. package/dist/src/plugins/cap/readers/calculation-view/CalculationViewItemReader.js.map +1 -0
  14. package/dist/src/plugins/cap/readers/calculation-view/model/XmlReader.js +406 -0
  15. package/dist/src/plugins/cap/readers/calculation-view/model/XmlReader.js.map +1 -0
  16. package/dist/src/plugins/cap/readers/calculation-view/model/common.js +101 -0
  17. package/dist/src/plugins/cap/readers/calculation-view/model/common.js.map +1 -0
  18. package/dist/src/plugins/cap/readers/calculation-view/model/model.js +858 -0
  19. package/dist/src/plugins/cap/readers/calculation-view/model/model.js.map +1 -0
  20. package/dist/src/plugins/cap/readers/calculation-view/model/modelbase.js +387 -0
  21. package/dist/src/plugins/cap/readers/calculation-view/model/modelbase.js.map +1 -0
  22. package/dist/src/plugins/cap/readers/calculation-view/model/sharedmodel.js +96 -0
  23. package/dist/src/plugins/cap/readers/calculation-view/model/sharedmodel.js.map +1 -0
  24. package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParser.js +2278 -0
  25. package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParser.js.map +1 -0
  26. package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParserHelper.js +194 -0
  27. package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParserHelper.js.map +1 -0
  28. package/dist/src/project-api/ProjectImpl.js +37 -2
  29. package/dist/src/project-api/ProjectImpl.js.map +1 -1
  30. package/dist/templates/launchpad-ui5-app-template/package.json +1 -1
  31. package/dist/tsconfig.tsbuildinfo +115 -29
  32. package/dist/types/src/cp/CFProjectBuilder.d.ts +1 -1
  33. package/dist/types/src/plugins/cap/readers/calculation-view/CalculationViewItemReader.d.ts +33 -0
  34. package/dist/types/src/plugins/cap/readers/calculation-view/model/XmlReader.d.ts +38 -0
  35. package/dist/types/src/plugins/cap/readers/calculation-view/model/common.d.ts +44 -0
  36. package/dist/types/src/plugins/cap/readers/calculation-view/model/model.d.ts +401 -0
  37. package/dist/types/src/plugins/cap/readers/calculation-view/model/modelbase.d.ts +105 -0
  38. package/dist/types/src/plugins/cap/readers/calculation-view/model/sharedmodel.d.ts +33 -0
  39. package/dist/types/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParser.d.ts +62 -0
  40. package/dist/types/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParserHelper.d.ts +14 -0
  41. package/dist/types/src/project-api/ProjectImpl.d.ts +2 -0
  42. package/package.json +6 -5
@@ -0,0 +1,858 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.ElementRefFilter = exports.ValueRange = exports.SimpleType = exports.Element = exports.Input = exports.Mapping = exports.MappingType = exports.ExceptionAggregationBehavior = exports.AggregationBehavior = exports.TemporalCondition = exports.Join = exports.ViewNode = exports.ViewModel = exports.ColumnView = exports.Order = exports.UDFParameter = exports.Parameter = exports.Entity = exports.SortDirection = exports.ExpressionLanguage = exports.SemanticType = exports.MeasureType = exports.PrimitiveType = exports.ViewNodeType = exports.OutputType = exports.JoinType = exports.HierarchyFunction = exports.EntityType = exports.DataCategory = void 0;
23
+ const modelbase_1 = __importStar(require("./modelbase"));
24
+ const sharedmodel_1 = require("./sharedmodel");
25
+ var DataCategory;
26
+ (function (DataCategory) {
27
+ DataCategory["DEFAULT"] = "DEFAULT";
28
+ DataCategory["DIMENSION"] = "DIMENSION";
29
+ DataCategory["CUBE"] = "CUBE";
30
+ DataCategory["FACT"] = "FACT";
31
+ DataCategory["TEXT"] = "TEXT";
32
+ DataCategory["HIERARCHY"] = "HIERARCHY";
33
+ })(DataCategory = exports.DataCategory || (exports.DataCategory = {}));
34
+ ;
35
+ var EntityType;
36
+ (function (EntityType) {
37
+ // For catalog types value is same as in DataSourceType enumeration in XSD;
38
+ // For DT objects value is same as file suffix
39
+ EntityType["DATABASE_VIEW"] = "DATA_BASE_VIEW";
40
+ EntityType["DATABASE_TABLE"] = "DATA_BASE_TABLE";
41
+ EntityType["ATTRIBUTE_VIEW"] = "ATTRIBUTEVIEW";
42
+ EntityType["ANALYTIC_VIEW"] = "ANALYTICVIEW";
43
+ EntityType["CALCULATION_VIEW"] = "CALCULATIONVIEW";
44
+ EntityType["TABLE_FUNCTION"] = "hdbtablefunction";
45
+ EntityType["SCALAR_FUNCTION"] = "hdbscalarfunction";
46
+ EntityType["PROCEDURE"] = "hdbprocedure";
47
+ EntityType["CATALOG_PROCEDURE"] = "procedure";
48
+ EntityType["GRAPH_WORKSPACE"] = "GRAPH_WORKSPACE";
49
+ })(EntityType = exports.EntityType || (exports.EntityType = {}));
50
+ ;
51
+ var HierarchyFunction;
52
+ (function (HierarchyFunction) {
53
+ HierarchyFunction["HIERARCHY"] = "HIERARCHY";
54
+ HierarchyFunction["HIERARCHY_LEVELED"] = "HIERARCHY_LEVELED";
55
+ HierarchyFunction["HIERARCHY_TEMPORAL"] = "HIERARCHY_TEMPORAL";
56
+ HierarchyFunction["HIERARCHY_SPANTREE"] = "HIERARCHY_SPANTREE";
57
+ HierarchyFunction["HIERARCHY_DESCENDANTS"] = "HIERARCHY_DESCENDANTS";
58
+ HierarchyFunction["HIERARCHY_ANCESTORS"] = "HIERARCHY_ANCESTORS";
59
+ HierarchyFunction["HIERARCHY_SIBLINGS"] = "HIERARCHY_SIBLINGS";
60
+ })(HierarchyFunction = exports.HierarchyFunction || (exports.HierarchyFunction = {}));
61
+ ;
62
+ var JoinType;
63
+ (function (JoinType) {
64
+ JoinType["REFERENTIAL"] = "referential";
65
+ JoinType["INNER"] = "inner";
66
+ JoinType["LEFT_OUTER"] = "leftOuter";
67
+ JoinType["RIGHT_OUTER"] = "rightOuter";
68
+ JoinType["FULL_OUTER"] = "fullOuter";
69
+ JoinType["TEXT_TABLE"] = "textTable";
70
+ })(JoinType = exports.JoinType || (exports.JoinType = {}));
71
+ ;
72
+ var OutputType;
73
+ (function (OutputType) {
74
+ OutputType["Vertices"] = "vertices";
75
+ OutputType["Edges"] = "edges";
76
+ })(OutputType = exports.OutputType || (exports.OutputType = {}));
77
+ var ViewNodeType;
78
+ (function (ViewNodeType) {
79
+ ViewNodeType["JoinNode"] = "JoinNode";
80
+ ViewNodeType["Projection"] = "Projection";
81
+ ViewNodeType["Aggregation"] = "Aggregation";
82
+ ViewNodeType["Rank"] = "Rank";
83
+ ViewNodeType["WindowFunction"] = "WindowFunction";
84
+ ViewNodeType["Union"] = "Union";
85
+ ViewNodeType["Script"] = "Script";
86
+ ViewNodeType["Graph"] = "Graph";
87
+ ViewNodeType["Intersect"] = "Intersect";
88
+ ViewNodeType["Minus"] = "Minus";
89
+ ViewNodeType["TableFunction"] = "TableFunction";
90
+ ViewNodeType["Hierarchy"] = "Hierarchy";
91
+ ViewNodeType["NonEquiJoinNode"] = "NonEquiJoinNode";
92
+ ViewNodeType["Anonymize"] = "Anonymize";
93
+ })(ViewNodeType = exports.ViewNodeType || (exports.ViewNodeType = {}));
94
+ var PrimitiveType;
95
+ (function (PrimitiveType) {
96
+ PrimitiveType["VARCHAR"] = "VARCHAR";
97
+ PrimitiveType["NVARCHAR"] = "NVARCHAR";
98
+ PrimitiveType["TINYINT"] = "TINYINT";
99
+ PrimitiveType["SMALLINT"] = "SMALLINT";
100
+ PrimitiveType["INTEGER"] = "INTEGER";
101
+ PrimitiveType["BIGINT"] = "BIGINT";
102
+ PrimitiveType["DECIMAL"] = "DECIMAL";
103
+ PrimitiveType["REAL"] = "REAL";
104
+ PrimitiveType["FLOAT"] = "FLOAT";
105
+ PrimitiveType["DOUBLE"] = "DOUBLE";
106
+ PrimitiveType["SMALLDECIMAL"] = "SMALLDECIMAL";
107
+ PrimitiveType["NUMERIC"] = "NUMERIC";
108
+ PrimitiveType["BOOLEAN"] = "BOOLEAN";
109
+ PrimitiveType["BLOB"] = "BLOB";
110
+ PrimitiveType["NCLOB"] = "NCLOB";
111
+ PrimitiveType["VARBINARY"] = "VARBINARY";
112
+ PrimitiveType["DATE"] = "DATE";
113
+ PrimitiveType["SECONDDATE"] = "SECONDDATE";
114
+ PrimitiveType["TIME"] = "TIME";
115
+ PrimitiveType["TIMESTAMP"] = "TIMESTAMP";
116
+ })(PrimitiveType = exports.PrimitiveType || (exports.PrimitiveType = {}));
117
+ var MeasureType;
118
+ (function (MeasureType) {
119
+ MeasureType["RESTRICTION"] = "restriction";
120
+ MeasureType["COUNTER"] = "counter";
121
+ MeasureType["CALCULATED_MEASURE"] = "calculatedMeasure";
122
+ })(MeasureType = exports.MeasureType || (exports.MeasureType = {}));
123
+ var SemanticType;
124
+ (function (SemanticType) {
125
+ SemanticType["EMPTY"] = "empty";
126
+ SemanticType["AMOUNT"] = "amount";
127
+ SemanticType["QUANTITY"] = "quantity";
128
+ // CURRENCY_CODE = "Currency",
129
+ SemanticType["CURRENCY_CODE"] = "currencyCode";
130
+ // UNIT_OF_MEASURE = "UnitOfMeasure",
131
+ SemanticType["UNIT_OF_MEASURE"] = "unitOfMeasure";
132
+ SemanticType["TIME"] = "time";
133
+ // DATE = "Date",
134
+ SemanticType["DATE"] = "date";
135
+ /*DATE_BUSINESS_DATE_FROM = "dateBusinessDateFrom",
136
+ DATE_BUSINESS_DATE_TO = "dateBusinessDateTo",
137
+ GEO_LOCATION_LONGITUDE = "geoLocationLongitude",
138
+ GEO_LOCATION_LATITUDE = "geoLocationLatitude",
139
+ GEO_LOCATION_CARTO_ID = "geoLocationCartoId",
140
+ GEO_LOCATION_NORMALIZED_NAME = "geoLocationNormalizedName",*/
141
+ SemanticType["DATE_BUSINESS_DATE_FROM"] = "date.businessDateFrom";
142
+ SemanticType["DATE_BUSINESS_DATE_TO"] = "date.businessDateTo";
143
+ SemanticType["GEO_LOCATION_LONGITUDE"] = "geoLocation.longitude";
144
+ SemanticType["GEO_LOCATION_LATITUDE"] = "geoLocation.latitude";
145
+ SemanticType["GEO_LOCATION_CARTO_ID"] = "geoLocation.cartoId";
146
+ SemanticType["GEO_LOCATION_NORMALIZED_NAME"] = "geoLocation.normalizedName";
147
+ SemanticType["CLIENT"] = "client";
148
+ SemanticType["LANGUAGE"] = "language";
149
+ SemanticType["DESCRIPTION"] = "description";
150
+ SemanticType["HYPERLINK"] = "hyperlink";
151
+ })(SemanticType = exports.SemanticType || (exports.SemanticType = {}));
152
+ ;
153
+ var ExpressionLanguage;
154
+ (function (ExpressionLanguage) {
155
+ ExpressionLanguage["COLUMN_ENGINE"] = "COLUMN_ENGINE";
156
+ ExpressionLanguage["SQL"] = "SQL";
157
+ })(ExpressionLanguage = exports.ExpressionLanguage || (exports.ExpressionLanguage = {}));
158
+ ;
159
+ var SortDirection;
160
+ (function (SortDirection) {
161
+ SortDirection["ASC"] = "ASC";
162
+ SortDirection["DESC"] = "DESC";
163
+ })(SortDirection = exports.SortDirection || (exports.SortDirection = {}));
164
+ ;
165
+ class SortAttribute extends modelbase_1.AbstractModelClass {
166
+ constructor(attributes, skippedNodes) {
167
+ super(attributes, skippedNodes);
168
+ this.$setAttributes(attributes, skippedNodes);
169
+ }
170
+ }
171
+ class Expression extends modelbase_1.AbstractModelClass {
172
+ constructor(attributes, skippedNodes) {
173
+ super(attributes, skippedNodes);
174
+ this.formula = '';
175
+ this.$setAttributes(attributes, skippedNodes);
176
+ }
177
+ }
178
+ class Entity extends modelbase_1.AbstractModelClass {
179
+ constructor(attributes, skippedNodes) {
180
+ super(attributes, skippedNodes);
181
+ this.$$keyAttributeName = 'id';
182
+ this.name = '';
183
+ this.isLoadFromXML = false;
184
+ this.elements = new modelbase_1.ModelCollection(this, 'elements', true);
185
+ this.$setAttributes(attributes, skippedNodes);
186
+ }
187
+ createElement(attributes, skippedNodes, nextElementName) {
188
+ const element = this.elements.get(attributes.name);
189
+ if (element) {
190
+ throw new modelbase_1.ObjectAlreadyExistsException(this, attributes.name, this.name);
191
+ }
192
+ return this.createOrMergeElement(attributes, skippedNodes, nextElementName);
193
+ }
194
+ createOrMergeElement(attributes, skippedNodes, nextElementName) {
195
+ let element = this.elements.get(attributes.name);
196
+ if (element) {
197
+ element.$setAttributes(attributes, skippedNodes);
198
+ }
199
+ else {
200
+ element = new Element(attributes, skippedNodes);
201
+ if (nextElementName) {
202
+ this.elements.addValueNextKey(element, nextElementName);
203
+ }
204
+ else {
205
+ this.elements.addValue(element);
206
+ }
207
+ }
208
+ return element;
209
+ }
210
+ }
211
+ exports.Entity = Entity;
212
+ class Parameter extends modelbase_1.AbstractModelClass {
213
+ constructor(attributes, skippedNodes) {
214
+ super(attributes, skippedNodes);
215
+ this.$$keyAttributeName = 'name';
216
+ this.isVariable = false;
217
+ this._fuzzySimilarity = new modelbase_1.SingleValueContainer(this, '', true);
218
+ this.assignedElements = new modelbase_1.ModelCollection(this, 'assignedElements', false);
219
+ this.$setAttributes(attributes, skippedNodes);
220
+ }
221
+ }
222
+ exports.Parameter = Parameter;
223
+ class UDFParameter extends modelbase_1.AbstractModelClass {
224
+ constructor(attributes, skippedNodes) {
225
+ super(attributes, skippedNodes);
226
+ this._element = new modelbase_1.SingleValueContainer(this, 'element', false);
227
+ this._parameter = new modelbase_1.SingleValueContainer(this, 'parameter', false);
228
+ this.$setAttributes(attributes, skippedNodes);
229
+ }
230
+ get element() {
231
+ return this._element.get();
232
+ }
233
+ set element(value) {
234
+ this._element.set(value);
235
+ }
236
+ get parameter() {
237
+ return this._parameter.get();
238
+ }
239
+ set parameter(value) {
240
+ this._parameter.set(value);
241
+ }
242
+ }
243
+ exports.UDFParameter = UDFParameter;
244
+ class Order extends modelbase_1.AbstractModelClass {
245
+ constructor(attributes, skippedNodes) {
246
+ super(attributes, skippedNodes);
247
+ this._byElement = new modelbase_1.SingleValueContainer(this, 'byElement', false);
248
+ this.$setAttributes(attributes, skippedNodes);
249
+ }
250
+ get byElement() {
251
+ return this._byElement.get();
252
+ }
253
+ set byElement(value) {
254
+ this._byElement.set(value);
255
+ }
256
+ }
257
+ exports.Order = Order;
258
+ class ColumnView extends modelbase_1.AbstractModelClass {
259
+ constructor(attributes, skippedNodes) {
260
+ super(attributes, skippedNodes);
261
+ this.parameters = new modelbase_1.ModelCollection(this, 'parameters', true);
262
+ this.viewNodes = new modelbase_1.ModelCollection(this, 'viewNodes', true);
263
+ this._defaultNodeElementInstancesArray = [];
264
+ this.$setAttributes(attributes, skippedNodes);
265
+ }
266
+ createViewNode(attributes, skippedNodes, isDefaultNode = false) {
267
+ const viewNode = this.viewNodes.get(attributes.name);
268
+ if (viewNode) {
269
+ throw new modelbase_1.ObjectAlreadyExistsException(this, attributes.name, this.id);
270
+ }
271
+ return this.createOrMergeViewNode(attributes, skippedNodes, isDefaultNode);
272
+ }
273
+ createOrMergeViewNode(attributes, skippedNodes, isDefaultNode) {
274
+ let viewNode = this.viewNodes.get(attributes.name);
275
+ if (viewNode) {
276
+ viewNode.$setAttributes(attributes, skippedNodes);
277
+ }
278
+ else {
279
+ viewNode = new ViewNode(attributes, skippedNodes);
280
+ this.viewNodes.addValue(viewNode);
281
+ }
282
+ if (isDefaultNode) {
283
+ this.setDefaultNode(viewNode);
284
+ }
285
+ return viewNode;
286
+ }
287
+ createParameter(attributes, skippedNodes) {
288
+ const parameter = new Parameter(attributes, skippedNodes);
289
+ this.parameters.addValue(parameter);
290
+ return parameter;
291
+ }
292
+ getDefaultNode() {
293
+ return this._defaultNode;
294
+ }
295
+ setDefaultNode(viewNode) {
296
+ if (viewNode) {
297
+ if (this._defaultNode) {
298
+ throw new modelbase_1.ModelException('default node already set');
299
+ }
300
+ {
301
+ viewNode._isDefaultNode = true;
302
+ }
303
+ }
304
+ this._defaultNode = viewNode;
305
+ }
306
+ }
307
+ exports.ColumnView = ColumnView;
308
+ ;
309
+ class ViewModel extends modelbase_1.default.AbstractModel {
310
+ constructor() {
311
+ super();
312
+ this._columnView = new modelbase_1.SingleValueContainer(this, 'columnView', true);
313
+ this._entities = new modelbase_1.ModelCollection(this, '_entities', true);
314
+ this.referenceEntities = new modelbase_1.ModelCollection(this, 'referenceEntities', false);
315
+ }
316
+ get columnView() {
317
+ const value = this._columnView.get();
318
+ return value;
319
+ }
320
+ set columnView(value) {
321
+ this._columnView.set(value);
322
+ }
323
+ createColumnView(attributes, skippedNodes) {
324
+ const columnView = new ColumnView(attributes, skippedNodes);
325
+ this.columnView = columnView;
326
+ return columnView;
327
+ }
328
+ createEntity(attributes, skippedNodes) {
329
+ const entity = new Entity(attributes, skippedNodes);
330
+ const key = entity.$getKeyAttributeValue();
331
+ if (this._entities.get(key)) {
332
+ entity.$rename(this._entities.getUniqueKey(key));
333
+ }
334
+ this._entities.addValue(entity);
335
+ return entity;
336
+ }
337
+ }
338
+ exports.ViewModel = ViewModel;
339
+ ;
340
+ class ViewNode extends modelbase_1.AbstractModelClass {
341
+ constructor(attributes, skippedNodes) {
342
+ super(attributes, skippedNodes);
343
+ this.$$keyAttributeName = 'name';
344
+ this._isDefaultNode = false;
345
+ this.name = '';
346
+ this.useDimensionViewHierarchies = false;
347
+ this._filterExpression = new modelbase_1.SingleValueContainer(this, 'filterExpression', true);
348
+ this.inputs = new modelbase_1.ModelCollection(this, 'inputs', true);
349
+ this.elements = new modelbase_1.ModelCollection(this, 'elements', true);
350
+ this.joins = new modelbase_1.ModelCollection(this, 'joins', true);
351
+ this._rankingFilter = new modelbase_1.SingleValueContainer(this, 'rankingFilter', true);
352
+ this._windowFunction = new modelbase_1.SingleValueContainer(this, 'windowFunction', true);
353
+ this.sortAttributes = new modelbase_1.ModelCollection(this, 'sortAttributes', true);
354
+ this.viewAttributeKeys = {};
355
+ this.$setAttributes(attributes, skippedNodes);
356
+ }
357
+ get filterExpression() {
358
+ return this._filterExpression.get();
359
+ }
360
+ set filterExpression(value) {
361
+ this._filterExpression.set(value);
362
+ }
363
+ get rankingFilter() {
364
+ return this._rankingFilter.get();
365
+ }
366
+ set rankingFilter(value) {
367
+ this._rankingFilter.set(value);
368
+ }
369
+ get windowFunction() {
370
+ return this._windowFunction.get();
371
+ }
372
+ set windowFunction(value) {
373
+ this._windowFunction.set(value);
374
+ }
375
+ $getContainer() {
376
+ return super.$getContainer();
377
+ }
378
+ createInput(attributes, skippedNodes) {
379
+ const input = new Input(attributes, skippedNodes);
380
+ this.inputs.addValue(input);
381
+ return input;
382
+ }
383
+ createElementWithoutAddingIntoElementCollection(attributes, skippedNodes) {
384
+ let element = this.elements.get(attributes.name);
385
+ if (element) {
386
+ throw new modelbase_1.ObjectAlreadyExistsException(this, attributes.name, this.name);
387
+ }
388
+ else {
389
+ element = new Element(attributes, skippedNodes);
390
+ }
391
+ return element;
392
+ }
393
+ createOrMergeElement(attributes, skippedNodes) {
394
+ let element = this.elements.get(attributes.name);
395
+ if (element) {
396
+ element.$setAttributes(attributes, skippedNodes);
397
+ }
398
+ else {
399
+ element = new Element(attributes, skippedNodes);
400
+ this.elements.addValue(element);
401
+ }
402
+ return element;
403
+ }
404
+ createJoin(attributes, skippedNodes) {
405
+ const join = new Join(attributes, skippedNodes);
406
+ this.joins.addValue(join);
407
+ return join;
408
+ }
409
+ createSortAttributes(attributes, skippedNodes) {
410
+ const sortAttribute = new SortAttribute(attributes, skippedNodes);
411
+ this.sortAttributes.addValue(sortAttribute);
412
+ return sortAttribute;
413
+ }
414
+ createFilterExpression(attributes, skippedNodes) {
415
+ this.filterExpression = new Expression(attributes, skippedNodes);
416
+ return this.filterExpression;
417
+ }
418
+ createRankFilter(attributes, skippedNodes) {
419
+ this.rankingFilter = new RankFilter(attributes, skippedNodes);
420
+ return this.rankingFilter;
421
+ }
422
+ createWindowFunction(attributes, skippedNodes) {
423
+ this.windowFunction = new WindowFunction(attributes, skippedNodes);
424
+ return this.windowFunction;
425
+ }
426
+ isDefaultNode() {
427
+ return this._isDefaultNode;
428
+ }
429
+ isScriptNode() {
430
+ return this.type === ViewNodeType.Script;
431
+ }
432
+ isJoinNode() {
433
+ return this.type === ViewNodeType.JoinNode;
434
+ }
435
+ isStarJoin() {
436
+ return this.isJoinNode() && this.isDefaultNode();
437
+ }
438
+ getDefaultInput() {
439
+ if (!this.isDefaultNode()) {
440
+ throw new modelbase_1.ModelException('Default input cannot be determined for {0}, it is not the default node', this);
441
+ }
442
+ let result;
443
+ this.inputs.foreach(function (input) {
444
+ result = input;
445
+ // should be only one input
446
+ return;
447
+ });
448
+ return result;
449
+ }
450
+ getAllMappingsOfViewNode() {
451
+ const allMappings = {};
452
+ if (this.inputs && this.inputs._keys.length > 0) {
453
+ let mapping;
454
+ const inputs = this.inputs;
455
+ for (let i = 0; i < inputs.count(); i++) {
456
+ const input = inputs.getAt(i);
457
+ for (let j = 0; j < input.mappings.count(); j++) {
458
+ mapping = input.mappings.getAt(j);
459
+ if (mapping.type !== MappingType.ConstantElementMapping &&
460
+ mapping.targetElement && mapping.targetElement.name) {
461
+ // allMappings[input.name][mapping.targetElement.name] = mapping;
462
+ allMappings[mapping.targetElement.name] = {
463
+ 'mapping': mapping,
464
+ 'input': input,
465
+ };
466
+ }
467
+ }
468
+ }
469
+ }
470
+ return allMappings;
471
+ }
472
+ }
473
+ exports.ViewNode = ViewNode;
474
+ class RankFilter extends modelbase_1.AbstractModelClass {
475
+ constructor(attributes, skippedNodes) {
476
+ super(attributes, skippedNodes);
477
+ this.rankViewAttributeName = '';
478
+ this.orders = new modelbase_1.ModelCollection(this, 'orders', true);
479
+ this._rankThreshold = new modelbase_1.SingleValueContainer(this, 'rankThreshold', true);
480
+ this.partitionElements = new modelbase_1.ModelCollection(this, 'partitionElements', false);
481
+ this.$setAttributes(attributes, skippedNodes);
482
+ }
483
+ get rankThreshold() {
484
+ return this._rankThreshold.get();
485
+ }
486
+ set rankThreshold(value) {
487
+ this._rankThreshold.set(value);
488
+ }
489
+ createOrMergeRankThreshold(attributes, skippedNodes) {
490
+ let threshold = this.rankThreshold;
491
+ if (threshold) {
492
+ threshold.$setAttributes(attributes, skippedNodes);
493
+ }
494
+ else {
495
+ threshold = new UDFParameter(attributes, skippedNodes);
496
+ this.rankThreshold = threshold;
497
+ }
498
+ return this.rankThreshold;
499
+ }
500
+ createOrder(attributes, skippedNodes) {
501
+ const order = new Order(attributes, skippedNodes);
502
+ this.orders.addValue(order);
503
+ return order;
504
+ }
505
+ }
506
+ class WindowFunction extends modelbase_1.AbstractModelClass {
507
+ constructor(attributes, skippedNodes) {
508
+ super(attributes, skippedNodes);
509
+ this.functionArguments = [];
510
+ this.orderAttributes = new modelbase_1.ModelCollection(this, 'orderAttributes', true);
511
+ this.partitionAttributes = new modelbase_1.ModelCollection(this, 'partitionAttributes', false);
512
+ this._resultElement = new modelbase_1.SingleValueContainer(this, 'resultElement', false);
513
+ this.$setAttributes(attributes, skippedNodes);
514
+ }
515
+ get resultElement() {
516
+ return this._resultElement.get();
517
+ }
518
+ set resultElement(value) {
519
+ this._resultElement.set(value);
520
+ }
521
+ createOrder(attributes, skippedNodes) {
522
+ const orderAttribute = new Order(attributes, skippedNodes);
523
+ this.orderAttributes.addValue(orderAttribute);
524
+ return orderAttribute;
525
+ }
526
+ }
527
+ class Join extends modelbase_1.AbstractModelClass {
528
+ constructor(attributes, skippedNodes) {
529
+ super(attributes, skippedNodes);
530
+ this._temporalJoinProperties = new modelbase_1.SingleValueContainer(this, 'temporalJoinProperties', true);
531
+ this._leftInput = new modelbase_1.SingleValueContainer(this, 'leftInput', false);
532
+ this._rightInput = new modelbase_1.SingleValueContainer(this, 'rightInput', false);
533
+ this.leftElements = new modelbase_1.ModelCollection(this, 'leftElements', false);
534
+ this.rightElements = new modelbase_1.ModelCollection(this, 'rightElements', false);
535
+ this.$setAttributes(attributes, skippedNodes);
536
+ }
537
+ get temporalJoinProperties() {
538
+ return this._temporalJoinProperties.get();
539
+ }
540
+ set temporalJoinProperties(value) {
541
+ this._temporalJoinProperties.set(value);
542
+ }
543
+ get leftInput() {
544
+ return this._leftInput.get();
545
+ }
546
+ set leftInput(value) {
547
+ this._leftInput.set(value);
548
+ }
549
+ get rightInput() {
550
+ return this._rightInput.get();
551
+ }
552
+ set rightInput(value) {
553
+ this._rightInput.set(value);
554
+ }
555
+ createTemporalJoinProperties(attributes, skippedNodes) {
556
+ const temporalJoinProperties = new TemporalJoinProperties(attributes, skippedNodes);
557
+ this.temporalJoinProperties = temporalJoinProperties;
558
+ return this.temporalJoinProperties;
559
+ }
560
+ }
561
+ exports.Join = Join;
562
+ class TemporalJoinProperties extends modelbase_1.AbstractModelClass {
563
+ constructor(attributes, skippedNodes) {
564
+ super(attributes, skippedNodes);
565
+ this._temporalElement = new modelbase_1.SingleValueContainer(this, 'temporalElement', false);
566
+ this._fromElement = new modelbase_1.SingleValueContainer(this, 'fromElement', false);
567
+ this._toElement = new modelbase_1.SingleValueContainer(this, 'toElement', false);
568
+ this.$setAttributes(attributes, skippedNodes);
569
+ }
570
+ get temporalElement() {
571
+ return this._temporalElement.get();
572
+ }
573
+ set temporalElement(value) {
574
+ this._temporalElement.set(value);
575
+ }
576
+ get fromElement() {
577
+ return this._fromElement.get();
578
+ }
579
+ set fromElement(value) {
580
+ this._fromElement.set(value);
581
+ }
582
+ get toElement() {
583
+ return this._toElement.get();
584
+ }
585
+ set toElement(value) {
586
+ this._toElement.set(value);
587
+ }
588
+ }
589
+ ;
590
+ var TemporalCondition;
591
+ (function (TemporalCondition) {
592
+ TemporalCondition["INCLUDE_TO_EXCLUDE_FROM"] = "INCLUDE_TO_EXCLUDE_FROM";
593
+ TemporalCondition["EXCLUDE_TO_INCLUDE_FROM"] = "EXCLUDE_TO_INCLUDE_FROM";
594
+ TemporalCondition["EXCLUDE_BOTH"] = "EXCLUDE_BOTH";
595
+ TemporalCondition["INCLUDE_BOTH"] = "INCLUDE_BOTH";
596
+ })(TemporalCondition = exports.TemporalCondition || (exports.TemporalCondition = {}));
597
+ ;
598
+ var AggregationBehavior;
599
+ (function (AggregationBehavior) {
600
+ // Name same as in AggregationBehavior enumeration in datamodel.type XSD
601
+ // Value same as in AggregationType enumeration in bimodel.cube XSD for easy conversion
602
+ AggregationBehavior["NONE"] = "none";
603
+ AggregationBehavior["SUM"] = "sum";
604
+ AggregationBehavior["MIN"] = "min";
605
+ AggregationBehavior["MAX"] = "max";
606
+ AggregationBehavior["COUNT"] = "count";
607
+ AggregationBehavior["FORMULA"] = "formula";
608
+ })(AggregationBehavior = exports.AggregationBehavior || (exports.AggregationBehavior = {}));
609
+ ;
610
+ var ExceptionAggregationBehavior;
611
+ (function (ExceptionAggregationBehavior) {
612
+ ExceptionAggregationBehavior["COUNT_DISTINCT"] = "countDistinct";
613
+ })(ExceptionAggregationBehavior = exports.ExceptionAggregationBehavior || (exports.ExceptionAggregationBehavior = {}));
614
+ ;
615
+ var MappingType;
616
+ (function (MappingType) {
617
+ MappingType["ElementMapping"] = "ElementMapping";
618
+ MappingType["ConstantElementMapping"] = "ConstantElementMapping";
619
+ MappingType["InputMapping"] = "InputMapping";
620
+ })(MappingType = exports.MappingType || (exports.MappingType = {}));
621
+ ;
622
+ class Mapping extends modelbase_1.AbstractModelClass {
623
+ constructor(attributes, skippedNodes) {
624
+ super({}, skippedNodes);
625
+ this._targetElement = new modelbase_1.SingleValueContainer(this, 'targetElement', false);
626
+ this._sourceElement = new modelbase_1.SingleValueContainer(this, 'sourceElement', false);
627
+ this._sourceInput = new modelbase_1.SingleValueContainer(this, 'sourceInput', false);
628
+ const {
629
+ // these 3 variable should not be put in `attributes`
630
+ targetElement, sourceElement, sourceInput, ...attr } = attributes;
631
+ this.targetElement = targetElement !== null && targetElement !== void 0 ? targetElement : null;
632
+ this.sourceElement = sourceElement !== null && sourceElement !== void 0 ? sourceElement : null;
633
+ this.sourceInput = sourceInput !== null && sourceInput !== void 0 ? sourceInput : null;
634
+ this.$setAttributes(attr, skippedNodes);
635
+ }
636
+ get targetElement() {
637
+ return this._targetElement.get();
638
+ }
639
+ set targetElement(value) {
640
+ this._targetElement.set(value);
641
+ }
642
+ get sourceElement() {
643
+ return this._sourceElement.get();
644
+ }
645
+ set sourceElement(value) {
646
+ this._sourceElement.set(value);
647
+ }
648
+ get sourceInput() {
649
+ return this._sourceInput.get();
650
+ }
651
+ set sourceInput(value) {
652
+ this._sourceInput.set(value);
653
+ }
654
+ }
655
+ exports.Mapping = Mapping;
656
+ class Input extends modelbase_1.AbstractModelClass {
657
+ constructor(attributes, skippedNodes) {
658
+ super(attributes, skippedNodes);
659
+ this.alias = '';
660
+ this.repositoryInputNodeId = '';
661
+ this.selectAll = false;
662
+ this.mappings = new modelbase_1.ModelCollection(this, 'mappings', true);
663
+ this._source = null;
664
+ this.$setAttributes(attributes, skippedNodes);
665
+ }
666
+ getSource() {
667
+ return this._source;
668
+ }
669
+ setSource(source) {
670
+ this._source = source;
671
+ return this._source;
672
+ }
673
+ createMapping(attributes, skippedNodes) {
674
+ const mapping = new Mapping(attributes, skippedNodes);
675
+ this.mappings.addValue(mapping);
676
+ return mapping;
677
+ }
678
+ }
679
+ exports.Input = Input;
680
+ class Element extends modelbase_1.AbstractModelClass {
681
+ constructor(attributes, skippedNodes) {
682
+ super(attributes, skippedNodes);
683
+ this.$$keyAttributeName = 'name';
684
+ this.name = '';
685
+ this.generatedColumn = false;
686
+ this.restrictions = new modelbase_1.ModelCollection(this, 'restrictions', true);
687
+ this._restrictionExpression = new modelbase_1.SingleValueContainer(this, 'restrictionExpression', true);
688
+ this.$setAttributes(attributes, skippedNodes);
689
+ }
690
+ get restrictionExpression() {
691
+ return this._restrictionExpression.get();
692
+ }
693
+ set restrictionExpression(value) {
694
+ this._restrictionExpression.set(value);
695
+ }
696
+ createOrMergeSimpleType(attributes, skippedNodes) {
697
+ let simpleType = this.inlineType;
698
+ if (simpleType) {
699
+ simpleType.$setAttributes(attributes, skippedNodes);
700
+ }
701
+ else {
702
+ simpleType = new SimpleType(attributes, skippedNodes);
703
+ this.inlineType = simpleType;
704
+ }
705
+ return simpleType;
706
+ }
707
+ getMapping() {
708
+ let mapping;
709
+ const targetName = this.name;
710
+ let mappingFound = false;
711
+ const inputs = this.$getContainer().inputs;
712
+ for (let i = 0; i < inputs.count(); i++) {
713
+ const input = inputs.getAt(i);
714
+ for (let j = 0; j < input.mappings.count(); j++) {
715
+ mapping = input.mappings.getAt(j);
716
+ if (mapping.targetElement && mapping.targetElement.name === targetName) {
717
+ mappingFound = true;
718
+ break;
719
+ }
720
+ }
721
+ }
722
+ if (mappingFound) {
723
+ return mapping;
724
+ }
725
+ }
726
+ createDefaultMapping(attributes, skippedNodes) {
727
+ if (this.$getContainer() && !this.$getContainer().isDefaultNode()) {
728
+ throw new modelbase_1.ModelException('Default mapping cannot be created for {0}, its parent {1} is not the default node', [this, this.$getContainer()]);
729
+ }
730
+ // remember skipped nodes
731
+ this.$setAttributes(null, skippedNodes);
732
+ let mapping = null;
733
+ if (this.$getContainer() && !this.$getContainer().isScriptNode()) {
734
+ const input = this.$getContainer().getDefaultInput();
735
+ // mapping = input.createMapping(attributes);
736
+ // : passing skippedNodes to be used by renderer
737
+ mapping = input.createMapping(attributes, skippedNodes);
738
+ }
739
+ return mapping;
740
+ }
741
+ createCalculationDefinition(attributes) {
742
+ this.calculationDefinition = new Expression(attributes);
743
+ return this.calculationDefinition;
744
+ }
745
+ createRestriction(attributes, skippedNodes) {
746
+ const restriction = new ElementRefFilter(attributes, skippedNodes);
747
+ this.restrictions.addValue(restriction);
748
+ return restriction;
749
+ }
750
+ createRestrictionExpression(attributes) {
751
+ this.restrictionExpression = new Expression(attributes);
752
+ return this.restrictionExpression;
753
+ }
754
+ isCalculatedColumn() {
755
+ if (this.calculationDefinition) {
756
+ return true;
757
+ }
758
+ else {
759
+ return false;
760
+ }
761
+ }
762
+ isRestrictedColumn() {
763
+ if (this.measureType === MeasureType.RESTRICTION) {
764
+ return true;
765
+ }
766
+ else {
767
+ return false;
768
+ }
769
+ }
770
+ isHierarchyGererated() {
771
+ const viewNode = this.$getContainer();
772
+ if (viewNode.type !== ViewNodeType.Hierarchy) {
773
+ throw new modelbase_1.UnsupportedOperationException(this);
774
+ }
775
+ if (viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY ||
776
+ viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_LEVELED ||
777
+ viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_SPANTREE ||
778
+ viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_TEMPORAL) {
779
+ if (this.name === 'HIERARCHY_RANK' ||
780
+ this.name === 'HIERARCHY_TREE_SIZE' ||
781
+ this.name === 'HIERARCHY_PARENT_RANK' ||
782
+ this.name === 'HIERARCHY_LEVEL' ||
783
+ this.name === 'HIERARCHY_IS_CYCLE' ||
784
+ this.name === 'HIERARCHY_IS_ORPHAN') {
785
+ return true;
786
+ }
787
+ if (viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_LEVELED) {
788
+ if (this.name === 'HIERARCHY_LEVEL_NAME' ||
789
+ this.name === 'PARENT_ID' ||
790
+ this.name === 'NODE_ID') {
791
+ return true;
792
+ }
793
+ }
794
+ }
795
+ if (viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_ANCESTORS ||
796
+ viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_DESCENDANTS) {
797
+ if (this.name === 'HIERARCHY_DISTANCE') {
798
+ return true;
799
+ }
800
+ }
801
+ if (viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_ANCESTORS ||
802
+ viewNode.hierarchyFunction === HierarchyFunction.HIERARCHY_DESCENDANTS) {
803
+ if (this.name === 'HIERARCHY_SIBLING_DISTANCE') {
804
+ return true;
805
+ }
806
+ }
807
+ }
808
+ }
809
+ exports.Element = Element;
810
+ class SimpleType extends modelbase_1.AbstractModelClass {
811
+ constructor(attributes, skippedNodes) {
812
+ super(attributes, skippedNodes);
813
+ this.length = undefined; //short int
814
+ this.precision = undefined; //short int
815
+ this.scale = undefined; //short int
816
+ this.semanticType = undefined;
817
+ this.isDerived = false;
818
+ this.presentationScale = undefined; //short int
819
+ this.valueRanges = new modelbase_1.ModelCollection(this, 'valueRange', true);
820
+ this.$setAttributes(attributes, skippedNodes);
821
+ }
822
+ }
823
+ exports.SimpleType = SimpleType;
824
+ class ValueRange extends modelbase_1.AbstractModelClass {
825
+ constructor(attributes, skippedNodes) {
826
+ super(attributes, skippedNodes);
827
+ this.$$keyAttributeName = 'value';
828
+ this.value = '';
829
+ this.$setAttributes(attributes, skippedNodes);
830
+ }
831
+ }
832
+ exports.ValueRange = ValueRange;
833
+ /**
834
+ * @class ElementRefFilter - Similar to ElementFilter; but this one contains object based reference to Element
835
+ * @property {Element} element - Element reference
836
+ * @property {ModelCollection} valueFilters - Collection of objects of type sharedmodel.ValueFilter
837
+ */
838
+ class ElementRefFilter extends modelbase_1.AbstractModelClass {
839
+ constructor() {
840
+ super(...arguments);
841
+ this.type = 'AttributeFilter';
842
+ this.valueFilters = new modelbase_1.ModelCollection(this, 'valueFilters', true);
843
+ this._element = new modelbase_1.SingleValueContainer(this, 'element', false);
844
+ }
845
+ get element() {
846
+ return this._element.get();
847
+ }
848
+ set element(value) {
849
+ this._element.set(value);
850
+ }
851
+ createValueFilter(attributes, skippedNodes) {
852
+ const valueFilter = new sharedmodel_1.ValueFilter(attributes, skippedNodes);
853
+ this.valueFilters.addValue(valueFilter);
854
+ return valueFilter;
855
+ }
856
+ }
857
+ exports.ElementRefFilter = ElementRefFilter;
858
+ //# sourceMappingURL=model.js.map