@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.
- package/dist/projectapi.js +1 -1
- package/dist/projectapi.js.LICENSE.txt +139 -0
- package/dist/src/cp/CFProjectBuilder.js +20 -6
- package/dist/src/cp/CFProjectBuilder.js.map +1 -1
- package/dist/src/cp/templates/launchpad-ui5-app-template/package.json +1 -1
- package/dist/src/plugins/cap/generators/CapDestinationModuleGenerator.js +1 -0
- package/dist/src/plugins/cap/generators/CapDestinationModuleGenerator.js.map +1 -1
- package/dist/src/plugins/cap/generators/CapProjectGenerator.js +15 -0
- package/dist/src/plugins/cap/generators/CapProjectGenerator.js.map +1 -1
- package/dist/src/plugins/cap/readers/CapModuleReader.js +9 -1
- package/dist/src/plugins/cap/readers/CapModuleReader.js.map +1 -1
- package/dist/src/plugins/cap/readers/calculation-view/CalculationViewItemReader.js +446 -0
- package/dist/src/plugins/cap/readers/calculation-view/CalculationViewItemReader.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/XmlReader.js +406 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/XmlReader.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/common.js +101 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/common.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/model.js +858 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/model.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/modelbase.js +387 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/modelbase.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/sharedmodel.js +96 -0
- package/dist/src/plugins/cap/readers/calculation-view/model/sharedmodel.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParser.js +2278 -0
- package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParser.js.map +1 -0
- package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParserHelper.js +194 -0
- package/dist/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParserHelper.js.map +1 -0
- package/dist/src/project-api/ProjectImpl.js +37 -2
- package/dist/src/project-api/ProjectImpl.js.map +1 -1
- package/dist/templates/launchpad-ui5-app-template/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +115 -29
- package/dist/types/src/cp/CFProjectBuilder.d.ts +1 -1
- package/dist/types/src/plugins/cap/readers/calculation-view/CalculationViewItemReader.d.ts +33 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/model/XmlReader.d.ts +38 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/model/common.d.ts +44 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/model/model.d.ts +401 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/model/modelbase.d.ts +105 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/model/sharedmodel.d.ts +33 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParser.d.ts +62 -0
- package/dist/types/src/plugins/cap/readers/calculation-view/viewmodel/CalculationViewXmlParserHelper.d.ts +14 -0
- package/dist/types/src/project-api/ProjectImpl.d.ts +2 -0
- package/package.json +6 -5
|
@@ -0,0 +1,2278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.processUDFParameter = exports.getParameterFromColumnView = exports.getElementFromsharedEntity = exports.getEntity = exports.getElementFromColumnView = void 0;
|
|
7
|
+
const common_1 = __importDefault(require("../model/common"));
|
|
8
|
+
const model_1 = require("../model/model");
|
|
9
|
+
const XmlReader_1 = __importDefault(require("../model/XmlReader"));
|
|
10
|
+
const sharedmodel_1 = __importDefault(require("../model/sharedmodel"));
|
|
11
|
+
const CalculationViewXmlParserHelper_1 = __importDefault(require("./CalculationViewXmlParserHelper"));
|
|
12
|
+
const modelbase_1 = require("../model/modelbase");
|
|
13
|
+
const artifact_management_base_1 = require("@sap/artifact-management-base");
|
|
14
|
+
class CalculationViewXmlParser {
|
|
15
|
+
static propagateDataTypeToDefaultNode(columnView) {
|
|
16
|
+
for (let i = 0; i < columnView.viewNodes.count(); i++) {
|
|
17
|
+
const viewNode = columnView.viewNodes.getAt(i);
|
|
18
|
+
this._propagateDataTypeToViewNode(viewNode);
|
|
19
|
+
const restrictedElements = [];
|
|
20
|
+
viewNode.elements.foreach((element) => {
|
|
21
|
+
if (element && element.measureType === model_1.MeasureType.RESTRICTION) {
|
|
22
|
+
restrictedElements.push(element);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (restrictedElements.length > 0) {
|
|
26
|
+
for (let k = 0; k < restrictedElements.length; k++) {
|
|
27
|
+
const restrictedElement = restrictedElements[k];
|
|
28
|
+
let baseMeasureElementInlineType = null;
|
|
29
|
+
if (restrictedElement && restrictedElement.calculationDefinition) {
|
|
30
|
+
const baseMeasureName = restrictedElement.calculationDefinition.formula;
|
|
31
|
+
const baseMeasureElement = viewNode.elements.get(baseMeasureName);
|
|
32
|
+
if (baseMeasureElement) {
|
|
33
|
+
baseMeasureElementInlineType = baseMeasureElement.inlineType;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (baseMeasureElementInlineType) {
|
|
37
|
+
const simpleTypeAttributes = {
|
|
38
|
+
primitiveType: baseMeasureElementInlineType.primitiveType,
|
|
39
|
+
length: baseMeasureElementInlineType.length,
|
|
40
|
+
scale: baseMeasureElementInlineType.scale,
|
|
41
|
+
};
|
|
42
|
+
restrictedElement.createOrMergeSimpleType(simpleTypeAttributes);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
static _propagateDataTypeToViewNode(viewNode) {
|
|
49
|
+
if (viewNode.type === model_1.ViewNodeType.Graph /*&& viewNode.action == vModel.GraphAlgoritm.GET_SHORTEST_PATHS_ONE_TO_ALL*/) {
|
|
50
|
+
// viewNode.elements.foreach( function( element ) {
|
|
51
|
+
// var inlineType = that._getInlineTypeFromSource( element, vModel.OutputType.Vertices );
|
|
52
|
+
// if( inlineType ) {
|
|
53
|
+
// var simpleTypeAttributes = {
|
|
54
|
+
// primitiveType: inlineType.primitiveType,
|
|
55
|
+
// length: inlineType.length || undefined,
|
|
56
|
+
// precision: inlineType.precision || undefined,
|
|
57
|
+
// scale: inlineType.scale || undefined
|
|
58
|
+
// };
|
|
59
|
+
// element.createOrMergeSimpleType( simpleTypeAttributes );
|
|
60
|
+
// }
|
|
61
|
+
// });
|
|
62
|
+
// viewNode.outputElements2.foreach( function( element ) {
|
|
63
|
+
// var inlineType = that._getInlineTypeFromSource( element, vModel.OutputType.Edges );
|
|
64
|
+
// if( inlineType ) {
|
|
65
|
+
// var simpleTypeAttributes = {
|
|
66
|
+
// primitiveType: inlineType.primitiveType,
|
|
67
|
+
// length: inlineType.length || undefined,
|
|
68
|
+
// precision: inlineType.precision || undefined,
|
|
69
|
+
// scale: inlineType.scale || undefined
|
|
70
|
+
// };
|
|
71
|
+
// element.createOrMergeSimpleType( simpleTypeAttributes );
|
|
72
|
+
// }
|
|
73
|
+
// });
|
|
74
|
+
}
|
|
75
|
+
else if (viewNode.type === model_1.ViewNodeType.Hierarchy) {
|
|
76
|
+
viewNode.elements.foreach(element => {
|
|
77
|
+
if (element.name !== 'START_RANK') {
|
|
78
|
+
const inlineType = this._getInlineTypeFromSource(element);
|
|
79
|
+
if (inlineType) {
|
|
80
|
+
const simpleTypeAttributes = {
|
|
81
|
+
primitiveType: inlineType.primitiveType,
|
|
82
|
+
length: inlineType.length,
|
|
83
|
+
precision: inlineType.precision,
|
|
84
|
+
scale: inlineType.scale,
|
|
85
|
+
};
|
|
86
|
+
element.createOrMergeSimpleType(simpleTypeAttributes);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
viewNode.elements.foreach(element => {
|
|
93
|
+
//If element is calculated column or counter or restricted column
|
|
94
|
+
// then we should not update data type from source columns
|
|
95
|
+
if (element.isCalculatedColumn() || element.isRestrictedColumn() ||
|
|
96
|
+
element.generatedColumn) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const inlineType = this._getInlineTypeFromSource(element);
|
|
100
|
+
if (inlineType) {
|
|
101
|
+
const simpleTypeAttributes = {
|
|
102
|
+
primitiveType: inlineType.primitiveType,
|
|
103
|
+
length: inlineType.length,
|
|
104
|
+
precision: inlineType.precision,
|
|
105
|
+
scale: inlineType.scale,
|
|
106
|
+
};
|
|
107
|
+
element.createOrMergeSimpleType(simpleTypeAttributes);
|
|
108
|
+
}
|
|
109
|
+
// const encryptionDet = that._getEncryptionInfoFromSource( element );
|
|
110
|
+
// if ( encryptionDet ) {
|
|
111
|
+
// const encryptionAttributes = {
|
|
112
|
+
// encryptionStatus: encryptionDet.encryptionStatus,
|
|
113
|
+
// encryptionKey: encryptionDet.encryptionKey,
|
|
114
|
+
// encryptionMode: encryptionDet.encryptionMode,
|
|
115
|
+
// };
|
|
116
|
+
// element.createorMergeEncryptionInfo( encryptionAttributes );
|
|
117
|
+
// }
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
static _getInlineTypeFromSource(element, outputName) {
|
|
122
|
+
// For Proxy element we can not get datatype
|
|
123
|
+
if (!(element.isProxy) && element.$getContainer() !== null &&
|
|
124
|
+
element.$getContainer() instanceof model_1.Entity) {
|
|
125
|
+
artifact_management_base_1.getLogger().trace(`eneity element: ${element.name} ${outputName}`);
|
|
126
|
+
return element.inlineType;
|
|
127
|
+
}
|
|
128
|
+
else if (element.$getContainer() !== null && element.$getContainer() instanceof model_1.ViewNode) {
|
|
129
|
+
artifact_management_base_1.getLogger().trace(`node element: ${element.name}`);
|
|
130
|
+
const viewNode = element.$getContainer();
|
|
131
|
+
let elementInput = null;
|
|
132
|
+
let mapping = null, sourceElement = null;
|
|
133
|
+
// Below two variables are to handle constant Element In UnionNode used in
|
|
134
|
+
// constantMapping
|
|
135
|
+
let isUnionNode = false;
|
|
136
|
+
let constantElementInUnionNode = null;
|
|
137
|
+
// Special handling for Graph Node Elements
|
|
138
|
+
// if ( viewNode.isGraphNode() ) {
|
|
139
|
+
// // Based on algo it has to
|
|
140
|
+
// switch ( viewNode.action ) {
|
|
141
|
+
// case vModel.GraphAlgoritm.GET_NEIGHBORHOOD: // Get Key Only and depth is dummy
|
|
142
|
+
// if ( element.name == 'DEPTH' ) {
|
|
143
|
+
// return {
|
|
144
|
+
// primitiveType: 'INTEGER',
|
|
145
|
+
// length: undefined,
|
|
146
|
+
// scale: undefined,
|
|
147
|
+
// };
|
|
148
|
+
// }
|
|
149
|
+
// sourceElement = viewNode.workspace.vertexEntity.elements.get( element.name );
|
|
150
|
+
// break;
|
|
151
|
+
// case vModel.GraphAlgoritm.GET_SHORTEST_PATHS_ONE_TO_ALL:
|
|
152
|
+
// if ( outputName == 'edges' ) {
|
|
153
|
+
// sourceElement = viewNode.workspace.edgeEntity.elements.get( element.name );
|
|
154
|
+
// } else {
|
|
155
|
+
// if ( element.name == 'WEIGHT' ) {
|
|
156
|
+
// if ( element.inlineType && element.inlineType.primitiveType ) {
|
|
157
|
+
// return {
|
|
158
|
+
// primitiveType: element.inlineType.primitiveType,
|
|
159
|
+
// length: element.inlineType.length,
|
|
160
|
+
// scale: element.inlineType.scale,
|
|
161
|
+
// };
|
|
162
|
+
// } else {
|
|
163
|
+
// return {
|
|
164
|
+
// primitiveType: 'INTEGER',
|
|
165
|
+
// length: undefined,
|
|
166
|
+
// scale: undefined,
|
|
167
|
+
// };
|
|
168
|
+
// }
|
|
169
|
+
// }
|
|
170
|
+
// sourceElement = viewNode.workspace.vertexEntity.elements.get( element.name );
|
|
171
|
+
// }
|
|
172
|
+
// break;
|
|
173
|
+
// case vModel.GraphAlgoritm.GET_SHORTEST_PATH_ONE_TO_ONE:
|
|
174
|
+
// if ( element.name == 'WEIGHT' ) {
|
|
175
|
+
// if ( element.inlineType && element.inlineType.primitiveType ) {
|
|
176
|
+
// return {
|
|
177
|
+
// primitiveType: element.inlineType.primitiveType,
|
|
178
|
+
// length: element.inlineType.length,
|
|
179
|
+
// scale: element.inlineType.scale,
|
|
180
|
+
// };
|
|
181
|
+
// }
|
|
182
|
+
// }
|
|
183
|
+
// return element.inlineType;
|
|
184
|
+
// case vModel.GraphAlgoritm.GET_STRONGLY_CONNECTED_COMPONENTS:
|
|
185
|
+
// if ( element.name == 'COMPONENT' ) {
|
|
186
|
+
// return {
|
|
187
|
+
// primitiveType: 'INTEGER',
|
|
188
|
+
// length: undefined,
|
|
189
|
+
// scale: undefined,
|
|
190
|
+
// };
|
|
191
|
+
// }
|
|
192
|
+
// sourceElement = viewNode.workspace.vertexEntity.elements.get( element.name );
|
|
193
|
+
// break;
|
|
194
|
+
// case vModel.GraphAlgoritm.PATTERN_MATCHING:
|
|
195
|
+
// sourceElement = {};
|
|
196
|
+
// sourceElement.inlineType = undefined; // TODO: figure the graph pattern
|
|
197
|
+
// // matching algo
|
|
198
|
+
// break;
|
|
199
|
+
// case vModel.GraphAlgoritm.SCRIPT_PATTERN_MATCHING:
|
|
200
|
+
// sourceElement = {};
|
|
201
|
+
// sourceElement.inlineType = undefined; // TODO: figure the graph pattern
|
|
202
|
+
// // matching algo
|
|
203
|
+
// break;
|
|
204
|
+
// default:
|
|
205
|
+
// break;
|
|
206
|
+
// }
|
|
207
|
+
// return sourceElement.inlineType;
|
|
208
|
+
// }
|
|
209
|
+
if (viewNode.type === model_1.ViewNodeType.TableFunction) {
|
|
210
|
+
if (element.inlineType && element.inlineType.primitiveType) {
|
|
211
|
+
return element.inlineType;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const allMappingsOfViewNode = viewNode.getAllMappingsOfViewNode();
|
|
215
|
+
let input = null;
|
|
216
|
+
for (let i = 0; i < viewNode.inputs.count(); i++) {
|
|
217
|
+
input = viewNode.inputs.getAt(i);
|
|
218
|
+
mapping = allMappingsOfViewNode[element.name] ?
|
|
219
|
+
allMappingsOfViewNode[element.name].mapping : element.getMapping();
|
|
220
|
+
if (allMappingsOfViewNode[element.name] !== undefined && mapping !== undefined &&
|
|
221
|
+
mapping.sourceElement !== undefined) {
|
|
222
|
+
const ip = allMappingsOfViewNode[element.name].input;
|
|
223
|
+
if (ip && (ip.repositoryInputNodeId === input.repositoryInputNodeId)) {
|
|
224
|
+
elementInput = input;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else if (mapping !== undefined &&
|
|
229
|
+
mapping.sourceElement === null && mapping.targetElement !== null) {
|
|
230
|
+
// It will only happen for constant Element In UnionNode used in
|
|
231
|
+
// constantMapping;
|
|
232
|
+
// in this case its inlineType is not derived from any source element rather it
|
|
233
|
+
// will have its own inlineType stored with it
|
|
234
|
+
isUnionNode = true;
|
|
235
|
+
constantElementInUnionNode = mapping.targetElement;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (elementInput) {
|
|
239
|
+
const elementInputSource = elementInput.getSource();
|
|
240
|
+
if (elementInputSource) {
|
|
241
|
+
sourceElement = elementInputSource.elements.get(mapping.sourceElement.name);
|
|
242
|
+
// I066990: if it is calculated column, return it directly as this would have
|
|
243
|
+
// its own datatype
|
|
244
|
+
if (sourceElement &&
|
|
245
|
+
(sourceElement.isCalculatedColumn() ||
|
|
246
|
+
sourceElement.isRestrictedColumn() ||
|
|
247
|
+
sourceElement.generatedColumn)) {
|
|
248
|
+
return sourceElement.inlineType;
|
|
249
|
+
}
|
|
250
|
+
if (elementInputSource instanceof model_1.ViewNode &&
|
|
251
|
+
elementInputSource.type === model_1.ViewNodeType.Hierarchy &&
|
|
252
|
+
sourceElement && sourceElement.isHierarchyGererated()) {
|
|
253
|
+
return sourceElement.inlineType;
|
|
254
|
+
}
|
|
255
|
+
if (sourceElement) {
|
|
256
|
+
return this._getInlineTypeFromSource(sourceElement);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
// It will only happen for constant Element In UnionNode which are mapped to
|
|
260
|
+
// some source elemnt
|
|
261
|
+
return mapping.sourceElement.inlineType;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else if (isUnionNode && constantElementInUnionNode) {
|
|
266
|
+
return constantElementInUnionNode.inlineType;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
static parseScenario(xml, model, fixMixedLineEndings, forceLineEndings) {
|
|
271
|
+
const reader = new XmlReader_1.default(xml, fixMixedLineEndings + '', forceLineEndings);
|
|
272
|
+
reader.context.postProcessingRegistry = {
|
|
273
|
+
callback: [],
|
|
274
|
+
};
|
|
275
|
+
reader.context.loadPostProcessingCallBackQueue = {
|
|
276
|
+
callback: [],
|
|
277
|
+
};
|
|
278
|
+
reader.moveDown().moveTo('scenario', sharedmodel_1.default.NameSpace.CALCULATION, undefined);
|
|
279
|
+
const calculationScenarioType = 'TREE_BASED';
|
|
280
|
+
let outputViewType = reader.consumeAttribute('outputViewType', '');
|
|
281
|
+
let outputViewName = outputViewType;
|
|
282
|
+
const isStarJoin = CalculationViewXmlParserHelper_1.default.checkForStarJoinWithDomAPI(reader);
|
|
283
|
+
const mapDefaultClient = function (value) {
|
|
284
|
+
if (!value || value === '' || value === 'cross') {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
return true;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
const schemaVersion = reader.consumeAttribute('schemaVersion', '');
|
|
292
|
+
artifact_management_base_1.getLogger().trace(`schemaVersion: ${schemaVersion}`);
|
|
293
|
+
// note: not process schemaVersion
|
|
294
|
+
const columnViewAttributes = reader.buildAttributes({
|
|
295
|
+
// name: "{id}",
|
|
296
|
+
id: '{id}',
|
|
297
|
+
applyPrivilegeType: '{applyPrivilegeType}',
|
|
298
|
+
defaultClient: '{defaultClient}',
|
|
299
|
+
dataCategory: '{dataCategory}',
|
|
300
|
+
visibility: '{visibility}',
|
|
301
|
+
defaultMember: '{defaultMember}',
|
|
302
|
+
historyEnabled: '{historyEnabled}',
|
|
303
|
+
enforceSqlExecution: '{enforceSqlExecution}',
|
|
304
|
+
cacheInvalidationPeriod: '{cacheInvalidationPeriod}',
|
|
305
|
+
alwaysAggregateResult: '{alwaysAggregateResult}',
|
|
306
|
+
propagateInstantiation: '{propagateInstantiation}',
|
|
307
|
+
runWithInvokerPrivileges: '{runWithInvokerPrivileges}',
|
|
308
|
+
scriptParametersCaseSensitive: '{scriptParametersCaseSensitive}',
|
|
309
|
+
dimensionType: '{dimensionType}',
|
|
310
|
+
hierarchyGeneration: '{hierarchyGeneration}',
|
|
311
|
+
deprecated: '{deprecated}',
|
|
312
|
+
endUserView: '{endUserView}',
|
|
313
|
+
generateMdsMetadata: '{generateMdsMetadata}',
|
|
314
|
+
maskMode: '{maskMode}',
|
|
315
|
+
translationRelevant: '{translationRelevant}',
|
|
316
|
+
pruningTable: '{pruningTable}',
|
|
317
|
+
cacheEnabled: '{cacheEnabled}',
|
|
318
|
+
rowCounterName: '{rowCounterName}',
|
|
319
|
+
hierarchiesSQLEnabled: '{hierarchiesSQLEnabled}',
|
|
320
|
+
evaluateSessionVariablesEarly: '{evaluateSessionVariablesEarly}',
|
|
321
|
+
analyticViewCompatibilityMode: '{analyticViewCompatibilityMode}',
|
|
322
|
+
xscCompatibilityMode: '{xscCompatibilityMode}',
|
|
323
|
+
}, undefined);
|
|
324
|
+
const columnViewSkippedNodes = reader.skippedNodes;
|
|
325
|
+
reader.moveDown();
|
|
326
|
+
const originAttributes = {};
|
|
327
|
+
this.parseOrigin(reader, originAttributes);
|
|
328
|
+
// const originSkippedNodes = reader.skippedNodes;
|
|
329
|
+
sharedmodel_1.default.parseDescriptions(reader, columnViewAttributes);
|
|
330
|
+
if (reader.tryMoveToIntermediate('defaultSchema')) {
|
|
331
|
+
reader.buildAttributes({
|
|
332
|
+
defaultSchema: '{schemaName}',
|
|
333
|
+
}, columnViewAttributes);
|
|
334
|
+
reader.next();
|
|
335
|
+
}
|
|
336
|
+
columnViewAttributes.clientDependent = mapDefaultClient(columnViewAttributes.defaultClient);
|
|
337
|
+
if (columnViewAttributes.clientDependent &&
|
|
338
|
+
columnViewAttributes.defaultClient !== '$$client$$') {
|
|
339
|
+
columnViewAttributes.fixedClient = columnViewAttributes.defaultClient;
|
|
340
|
+
}
|
|
341
|
+
delete columnViewAttributes.defaultClient;
|
|
342
|
+
if (columnViewAttributes.dataCategory === undefined) {
|
|
343
|
+
if (columnViewAttributes.visibility === 'reportingEnabled') {
|
|
344
|
+
columnViewAttributes.dataCategory = model_1.DataCategory.CUBE;
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
columnViewAttributes.dataCategory = model_1.DataCategory.DEFAULT;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (calculationScenarioType === 'TREE_BASED') {
|
|
351
|
+
if (!outputViewType && isStarJoin) {
|
|
352
|
+
outputViewType = model_1.ViewNodeType.JoinNode;
|
|
353
|
+
outputViewName = 'Star Join';
|
|
354
|
+
}
|
|
355
|
+
else if (outputViewType) {
|
|
356
|
+
outputViewName = outputViewType;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
else if (calculationScenarioType === 'SCRIPT_BASED') {
|
|
360
|
+
outputViewType = model_1.ViewNodeType.Script;
|
|
361
|
+
outputViewName = 'Script_View';
|
|
362
|
+
}
|
|
363
|
+
// note: not process analytic privilege
|
|
364
|
+
const columnView = model.createColumnView(columnViewAttributes, columnViewSkippedNodes);
|
|
365
|
+
// todo: setting model should be this: $$setContainingFeature in SingleValueContainer
|
|
366
|
+
// =
|
|
367
|
+
// note: not process EndUserTexts
|
|
368
|
+
// note: not process Execution hint Properties
|
|
369
|
+
columnView._defaultNodeElementInstancesArray = [];
|
|
370
|
+
if (reader.moveToIntermediate('localVariables').tryMoveDown()) {
|
|
371
|
+
while (this.parseVariable(reader, columnView)) {
|
|
372
|
+
reader.next();
|
|
373
|
+
}
|
|
374
|
+
// note: do nothing
|
|
375
|
+
reader.moveUp();
|
|
376
|
+
}
|
|
377
|
+
reader.next();
|
|
378
|
+
if (reader.tryMoveToIntermediate('historyVariable')) {
|
|
379
|
+
// note: do nothing
|
|
380
|
+
reader.next();
|
|
381
|
+
}
|
|
382
|
+
if (reader.tryMoveToIntermediate('variableMappings')) {
|
|
383
|
+
// note: do nothing
|
|
384
|
+
}
|
|
385
|
+
reader.next();
|
|
386
|
+
while (reader.tryMoveTo('executionHints')) {
|
|
387
|
+
// note: do nothing
|
|
388
|
+
reader.next();
|
|
389
|
+
}
|
|
390
|
+
const dataSources = {};
|
|
391
|
+
if (reader.moveToIntermediate('dataSources').tryMoveDown()) {
|
|
392
|
+
while (this.parseDataSource(reader, dataSources)) {
|
|
393
|
+
reader.next();
|
|
394
|
+
}
|
|
395
|
+
reader.moveUp();
|
|
396
|
+
}
|
|
397
|
+
reader.next();
|
|
398
|
+
if (reader.tryMoveToIntermediate('sCubes')) {
|
|
399
|
+
// note: do nothing
|
|
400
|
+
reader.next();
|
|
401
|
+
}
|
|
402
|
+
// note: not process sCube
|
|
403
|
+
if (reader.tryMoveToIntermediate('snapshotProcedures')) {
|
|
404
|
+
// note: do nothing
|
|
405
|
+
reader.next();
|
|
406
|
+
}
|
|
407
|
+
// const staticResultCache = {};
|
|
408
|
+
while (reader.tryMoveTo('staticResultCache')) {
|
|
409
|
+
// note: do nothing
|
|
410
|
+
reader.next();
|
|
411
|
+
}
|
|
412
|
+
reader.next();
|
|
413
|
+
const nodeIDsInCalculationView = [];
|
|
414
|
+
if (reader.moveToIntermediate('calculationViews').tryMoveDown()) {
|
|
415
|
+
while (this.parseCalculationView(reader, columnView, dataSources, nodeIDsInCalculationView)) {
|
|
416
|
+
reader.next();
|
|
417
|
+
}
|
|
418
|
+
reader.moveUp();
|
|
419
|
+
}
|
|
420
|
+
reader.next();
|
|
421
|
+
// const inlineHierarchyRead = false;
|
|
422
|
+
if (reader._current && reader._current.nextSibling &&
|
|
423
|
+
reader._current.nextSibling.nodeName === 'inlineHierarchy') {
|
|
424
|
+
if (columnView && columnView.dataCategory && (columnView.dataCategory === model_1.DataCategory.DIMENSION ||
|
|
425
|
+
columnView.dataCategory === model_1.DataCategory.DEFAULT)) {
|
|
426
|
+
while (reader.tryMoveTo('inlineHierarchy')) {
|
|
427
|
+
// note: do nothing
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
// note: not process multi-join ConvertMultiJoinToBinaryJoin
|
|
432
|
+
this.parseLogicalModel(reader, columnView, outputViewType, outputViewName, dataSources, isStarJoin);
|
|
433
|
+
reader.next();
|
|
434
|
+
// note: not process hanging data sources
|
|
435
|
+
if (reader.tryMoveToIntermediate('layout')) {
|
|
436
|
+
// note: do nothing
|
|
437
|
+
reader.next();
|
|
438
|
+
}
|
|
439
|
+
// note: not process inlineHierarchy
|
|
440
|
+
reader.moveUp();
|
|
441
|
+
this.doLoadPostProcessing(reader, columnView);
|
|
442
|
+
// New Way of Load Post Processing
|
|
443
|
+
this.excecuteLoadPostProcessingCallBackQueue(reader, columnView);
|
|
444
|
+
return reader.documentProperties;
|
|
445
|
+
}
|
|
446
|
+
static _getDefaultNodeElementInstanceByElementName(columnView, elementName, addIfNotPresent) {
|
|
447
|
+
let requiredElementInstance = null;
|
|
448
|
+
let elementInstanceFound = false;
|
|
449
|
+
const defaultNodeElementInstancesArray = columnView._defaultNodeElementInstancesArray;
|
|
450
|
+
if (defaultNodeElementInstancesArray) {
|
|
451
|
+
for (let index = 0; index < defaultNodeElementInstancesArray.length; index++) {
|
|
452
|
+
const elementInstance = defaultNodeElementInstancesArray[index];
|
|
453
|
+
if (elementInstance && elementInstance.name === elementName) {
|
|
454
|
+
elementInstanceFound = true;
|
|
455
|
+
return elementInstance;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
columnView._defaultNodeElementInstancesArray = [];
|
|
461
|
+
}
|
|
462
|
+
if (!elementInstanceFound && addIfNotPresent) {
|
|
463
|
+
requiredElementInstance = this._createDefaultNodeElementInstanceByElementName(defaultNodeElementInstancesArray, elementName);
|
|
464
|
+
return requiredElementInstance;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
static _createDefaultNodeElementInstanceByElementName(defaultNodeElementInstancesArray, elementName) {
|
|
468
|
+
if (elementName && defaultNodeElementInstancesArray) {
|
|
469
|
+
const elementInstance = new model_1.Element({
|
|
470
|
+
name: elementName,
|
|
471
|
+
isProxy: true,
|
|
472
|
+
});
|
|
473
|
+
defaultNodeElementInstancesArray.push(elementInstance);
|
|
474
|
+
return elementInstance;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
static _setSkippedNodes(object, skippedNodes) {
|
|
478
|
+
if (Array.isArray(skippedNodes)) {
|
|
479
|
+
for (let i = 0; i < skippedNodes.length; i++) {
|
|
480
|
+
object.$addSkippedNodes(skippedNodes[i]);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
object.$addSkippedNodes(skippedNodes);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
static _checkProxyElementsInDefaultNode(defaultViewNode) {
|
|
488
|
+
const columnView = defaultViewNode.$getContainer();
|
|
489
|
+
const defaultNodeElementInstancesArray = columnView._defaultNodeElementInstancesArray;
|
|
490
|
+
if (defaultNodeElementInstancesArray) {
|
|
491
|
+
for (let index = 0; index < defaultNodeElementInstancesArray.length; index++) {
|
|
492
|
+
const elementInstance = defaultNodeElementInstancesArray[index];
|
|
493
|
+
if (elementInstance && elementInstance.isProxy === true) {
|
|
494
|
+
return elementInstance;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
static parseOrigin(reader, attributes, moveDown) {
|
|
500
|
+
// note: do nothing
|
|
501
|
+
}
|
|
502
|
+
static processInternalExternalConversion(reader, result) {
|
|
503
|
+
if (reader.tryMoveToIntermediate('internalExternalConversion')) {
|
|
504
|
+
// const fixedAttributes = reader.buildAttributes({
|
|
505
|
+
// convertToExternalFunction: '{convertToExternalFunction}',
|
|
506
|
+
// convertToInternalFunction: '{convertToInternalFunction}',
|
|
507
|
+
// orderPreserving: '{orderPreserving}',
|
|
508
|
+
// });
|
|
509
|
+
// fixedAttributes.orderPreserving = RepositoryXmlParserHelper.getBooleanFromString( fixedAttributes.orderPreserving );
|
|
510
|
+
// result.createInternalExternalConversion( fixedAttributes );
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
static parseMaskingExpression(reader, element) {
|
|
514
|
+
if (reader.tryMoveToIntermediate('maskingExpression')) {
|
|
515
|
+
// const formula = reader.consumeContent();
|
|
516
|
+
// const maskingExpressionAttribute = {};
|
|
517
|
+
// maskingExpressionAttribute.formula = formula;
|
|
518
|
+
// element.createMaskingExpression( maskingExpressionAttribute, reader.skippedNodes );
|
|
519
|
+
reader.next();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
static parseVariable(reader, columnView) {
|
|
523
|
+
// note: do nothing
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
526
|
+
static parseDataSource(reader, dataSources) {
|
|
527
|
+
if (reader.tryMoveTo('DataSource')) {
|
|
528
|
+
const dataSource = {
|
|
529
|
+
id: undefined,
|
|
530
|
+
type: undefined,
|
|
531
|
+
resourceUri: '',
|
|
532
|
+
alias: '',
|
|
533
|
+
};
|
|
534
|
+
const dataSourceAttributes = reader.buildAttributes({
|
|
535
|
+
id: '{id}',
|
|
536
|
+
type: '{type}',
|
|
537
|
+
temporalSource: '{temporalSource}',
|
|
538
|
+
systemTime1: '{systemTime1}',
|
|
539
|
+
systemTime2: '{systemTime2}',
|
|
540
|
+
systemTimeOperator: '{systemTimeOperator}',
|
|
541
|
+
applicationTime1: '{applicationTime1}',
|
|
542
|
+
partitionedExecution: '{partitionedExecution}',
|
|
543
|
+
clientColumn: '{clientColumn}',
|
|
544
|
+
});
|
|
545
|
+
reader.moveDown();
|
|
546
|
+
if (reader.tryMoveToIntermediate('partitionAttributeName')) {
|
|
547
|
+
// dataSource.partitionAttributeName = reader.getContent();
|
|
548
|
+
}
|
|
549
|
+
if (reader.tryMoveToIntermediate('resourceUri')) {
|
|
550
|
+
dataSource.resourceUri = reader.getContent();
|
|
551
|
+
}
|
|
552
|
+
dataSource.id = dataSourceAttributes.id;
|
|
553
|
+
dataSource.type = dataSourceAttributes.type;
|
|
554
|
+
dataSources[dataSourceAttributes.id] = dataSource;
|
|
555
|
+
if (dataSourceAttributes.id !== dataSource.resourceUri) {
|
|
556
|
+
if (dataSourceAttributes.id.indexOf('$') === -1) {
|
|
557
|
+
dataSource.alias = dataSourceAttributes.id;
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
const alias = dataSourceAttributes.id.split('$')[2];
|
|
561
|
+
if (alias && alias !== '') {
|
|
562
|
+
dataSource.alias = alias;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
// Map EntityType for design time objects
|
|
567
|
+
if (CalculationViewXmlParserHelper_1.default.isItDesigntimeRepositoryObject(dataSource.type)) {
|
|
568
|
+
dataSource.type = CalculationViewXmlParserHelper_1.default.mapRepositoryTypeToEntityType(dataSource.type);
|
|
569
|
+
}
|
|
570
|
+
reader.skipChildren().next();
|
|
571
|
+
reader.moveUp();
|
|
572
|
+
return true;
|
|
573
|
+
}
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
static processTypedObjectExternalTypeOfElement(reader, columnView, result, isParameter) {
|
|
577
|
+
if (reader.tryMoveToIntermediate('externalLikeStructureName')) {
|
|
578
|
+
// note: not process
|
|
579
|
+
}
|
|
580
|
+
if (reader.tryMoveToIntermediate('externalLikeElementName')) {
|
|
581
|
+
// note: not process
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
// note: not process
|
|
585
|
+
artifact_management_base_1.getLogger().trace('XML element is not <externalLikeElementName>');
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
static processTypedObjectExternalTypeOfElementParameterMapping(reader, result, columnView) {
|
|
589
|
+
let tempVariableMappings = null;
|
|
590
|
+
const variableMappings = [];
|
|
591
|
+
do {
|
|
592
|
+
tempVariableMappings = this.parseVariableMapping(reader, undefined, columnView);
|
|
593
|
+
if (tempVariableMappings) {
|
|
594
|
+
variableMappings.push(tempVariableMappings);
|
|
595
|
+
reader.next();
|
|
596
|
+
}
|
|
597
|
+
} while (tempVariableMappings);
|
|
598
|
+
// return variableMappings;
|
|
599
|
+
if (variableMappings && variableMappings.length > 0) {
|
|
600
|
+
for (let i = 0; i < variableMappings.length; i++) {
|
|
601
|
+
this.postProcessVariableMappings(reader, variableMappings[i], result);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
static parseCalculationView(reader, columnView, dataSources, nodeIDsInCalculationView) {
|
|
606
|
+
if (reader.tryMoveTo('calculationView')) {
|
|
607
|
+
const mapType = function (value) {
|
|
608
|
+
let type = reader.removePrefix(sharedmodel_1.default.NameSpace.CALCULATION, value);
|
|
609
|
+
type = CalculationViewXmlParserHelper_1.default.mapViewNodeType(type);
|
|
610
|
+
return type;
|
|
611
|
+
};
|
|
612
|
+
const viewNodeAttributes = reader.buildAttributes({
|
|
613
|
+
name: '{id}',
|
|
614
|
+
type: common_1.default.createXsiSelector('type', mapType),
|
|
615
|
+
// Also reading JoinNode related attributes to handle skippnodes remembering
|
|
616
|
+
// attributeNames issue
|
|
617
|
+
joinType: '{joinType}',
|
|
618
|
+
cardinality: '{cardinality}',
|
|
619
|
+
languageColumn: '{languageColumn}',
|
|
620
|
+
dynamic: '{dynamic}',
|
|
621
|
+
optimizeJoinColumns: '{optimizeJoinColumns}',
|
|
622
|
+
greedyJoinPruning: '{greedyJoinPruning}',
|
|
623
|
+
workspace: '{workspace}',
|
|
624
|
+
action: '{action}',
|
|
625
|
+
partitionedExecution: '{partitionedExecution}',
|
|
626
|
+
columnBasedPruningFlag: '{columnBasedPruningFlag}',
|
|
627
|
+
tableFunctionName: '{tableFunctionName}',
|
|
628
|
+
allowFilterPushdown: '{allowFilterPushdown}',
|
|
629
|
+
dynamicPartitionAttributes: '{dynamicPartitionAttributes}',
|
|
630
|
+
dynamicOrderAttributes: '{dynamicOrderAttributes}',
|
|
631
|
+
ignoreMultipleOutputsForFilter: '{ignoreMultipleOutputsForFilter}',
|
|
632
|
+
referentialDirection: '{referentialDirection}',
|
|
633
|
+
hierarchyFunction: '{function}',
|
|
634
|
+
multiJoinCentralTable: '{multiJoinCentralTable}',
|
|
635
|
+
multiJoinNode: '{multiJoinNode}',
|
|
636
|
+
multiJoinOrder: '{multiJoinOrder}',
|
|
637
|
+
method: '{method}',
|
|
638
|
+
});
|
|
639
|
+
const filterExpressionLanguage = reader.consumeAttribute('filterExpressionLanguage');
|
|
640
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.JoinNode ||
|
|
641
|
+
viewNodeAttributes.type === model_1.ViewNodeType.NonEquiJoinNode) {
|
|
642
|
+
const joinAttributes = {};
|
|
643
|
+
CalculationViewXmlParserHelper_1.default.populateJoinAttributesFromViewNodeAttributes(joinAttributes, viewNodeAttributes);
|
|
644
|
+
}
|
|
645
|
+
reader.moveDown();
|
|
646
|
+
sharedmodel_1.default.parseDescriptions(reader, viewNodeAttributes);
|
|
647
|
+
const viewNode = columnView.createOrMergeViewNode(viewNodeAttributes, reader.skippedNodes);
|
|
648
|
+
CalculationViewXmlParserHelper_1.default.createEndUserTextsIfRequired(viewNode, viewNodeAttributes);
|
|
649
|
+
switch (viewNode.type) {
|
|
650
|
+
case model_1.ViewNodeType.Graph:
|
|
651
|
+
// note: do nothing
|
|
652
|
+
break;
|
|
653
|
+
default:
|
|
654
|
+
if (reader.tryMoveToIntermediate('viewAttributes')) {
|
|
655
|
+
if (reader.tryMoveDown()) {
|
|
656
|
+
while (this.parseViewAttribute(reader, viewNode, undefined)) {
|
|
657
|
+
reader.next();
|
|
658
|
+
}
|
|
659
|
+
reader.moveUp();
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
reader.next();
|
|
664
|
+
viewNode.viewAttributeKeys = viewNode.elements._keys
|
|
665
|
+
.reduce((result, item) => {
|
|
666
|
+
if (item) {
|
|
667
|
+
result[item] = true; //a, b, c
|
|
668
|
+
}
|
|
669
|
+
return result;
|
|
670
|
+
}, {});
|
|
671
|
+
// note: not process Graph node
|
|
672
|
+
if (reader.tryMoveToIntermediate('calculatedViewAttributes')) {
|
|
673
|
+
if (reader.tryMoveDown()) {
|
|
674
|
+
while (this.parseCalculatedViewAttribute(reader, viewNode)) {
|
|
675
|
+
reader.next();
|
|
676
|
+
}
|
|
677
|
+
reader.moveUp();
|
|
678
|
+
}
|
|
679
|
+
reader.next();
|
|
680
|
+
}
|
|
681
|
+
if (reader.tryMoveToIntermediate('restrictedViewAttributes')) {
|
|
682
|
+
if (reader.tryMoveDown()) {
|
|
683
|
+
while (this.parseRestrictedViewAttribute(reader, viewNode)) {
|
|
684
|
+
reader.next();
|
|
685
|
+
}
|
|
686
|
+
reader.moveUp();
|
|
687
|
+
}
|
|
688
|
+
reader.next();
|
|
689
|
+
}
|
|
690
|
+
while (reader.tryMoveTo('localVariable')) {
|
|
691
|
+
// note: do nothing
|
|
692
|
+
reader.next();
|
|
693
|
+
}
|
|
694
|
+
if (viewNodeAttributes.tableFunctionName && viewNode.type === 'TableFunction') {
|
|
695
|
+
// note: not process table function
|
|
696
|
+
}
|
|
697
|
+
while (this.parseInput(reader, viewNode, dataSources, nodeIDsInCalculationView)) {
|
|
698
|
+
reader.next();
|
|
699
|
+
}
|
|
700
|
+
while (this.parseVariableMappings(reader, 'variableMapping', columnView, viewNode.type, viewNode.name)) {
|
|
701
|
+
reader.next();
|
|
702
|
+
}
|
|
703
|
+
if (reader.tryMoveToIntermediate('rankingFilter')) {
|
|
704
|
+
this.parseRankingFilter(reader, viewNode, columnView);
|
|
705
|
+
}
|
|
706
|
+
else if (reader.tryMoveToIntermediate('windowFunction')) {
|
|
707
|
+
// this.parseWindowFunction( reader, viewNode, columnView, true );
|
|
708
|
+
}
|
|
709
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.WindowFunction) {
|
|
710
|
+
CalculationViewXmlParserHelper_1.default.processWindowFunction(reader, columnView, viewNode);
|
|
711
|
+
}
|
|
712
|
+
if (reader.tryMoveToIntermediate('filter')) {
|
|
713
|
+
// var filterExpression = reader.consumeContent();
|
|
714
|
+
// viewNode.createFilterExpression({
|
|
715
|
+
// 'formula': filterExpression,
|
|
716
|
+
// 'expressionLanguage': filterExpressionLanguage
|
|
717
|
+
// });
|
|
718
|
+
artifact_management_base_1.getLogger().trace(`filterExpressionLanguage: ${filterExpressionLanguage}`);
|
|
719
|
+
reader.next();
|
|
720
|
+
}
|
|
721
|
+
if (reader.tryMoveToIntermediate('definition')) {
|
|
722
|
+
// viewNode.definition = reader.consumeContent();
|
|
723
|
+
reader.next();
|
|
724
|
+
}
|
|
725
|
+
// todo: process certain node:
|
|
726
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.Union) { }
|
|
727
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.JoinNode) { }
|
|
728
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.NonEquiJoinNode) { }
|
|
729
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.Hierarchy) { }
|
|
730
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.Anonymize) { }
|
|
731
|
+
if (viewNodeAttributes.type === model_1.ViewNodeType.Projection) { }
|
|
732
|
+
reader.moveUp();
|
|
733
|
+
return true;
|
|
734
|
+
}
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
static parseViewAttribute(reader, viewNode, outputType) {
|
|
738
|
+
if (reader.tryMoveTo('viewAttribute')) {
|
|
739
|
+
const elementAttributes = reader.buildAttributes({
|
|
740
|
+
name: '{id}',
|
|
741
|
+
keep: '{keepFlag}',
|
|
742
|
+
aggregationBehavior: '{aggregationType}',
|
|
743
|
+
transparentFilter: '{transparentFilter}',
|
|
744
|
+
primitiveType: '{datatype}',
|
|
745
|
+
length: common_1.default.createIntSelector('length'),
|
|
746
|
+
scale: common_1.default.createIntSelector('scale'),
|
|
747
|
+
semanticType: '{semanticType}',
|
|
748
|
+
// measureType: '{measureType}',
|
|
749
|
+
presentationScale: '{presentationScale}',
|
|
750
|
+
});
|
|
751
|
+
const simpleTypeAttributes = {};
|
|
752
|
+
// In all cases except script view attribute and constant target attribute in Union
|
|
753
|
+
// view, ViewAttribute's Datatype is derived from its source; so defaulting isDerived
|
|
754
|
+
// flag to true
|
|
755
|
+
simpleTypeAttributes.isDerived = true;
|
|
756
|
+
if (elementAttributes.primitiveType && elementAttributes.primitiveType !== undefined) {
|
|
757
|
+
// It means it is a script view attribute or constant target attribute in Union view
|
|
758
|
+
CalculationViewXmlParserHelper_1.default.populateSimpleTypeAttributesFromElementAttributes(elementAttributes, simpleTypeAttributes);
|
|
759
|
+
simpleTypeAttributes.isDerived = false;
|
|
760
|
+
}
|
|
761
|
+
simpleTypeAttributes.semanticType = elementAttributes.semanticType;
|
|
762
|
+
simpleTypeAttributes.presentationScale = elementAttributes.presentationScale;
|
|
763
|
+
// Parse the description which includes the comment , for view attribute in view Node.
|
|
764
|
+
if (reader.tryMoveDown()) {
|
|
765
|
+
sharedmodel_1.default.parseDescriptions(reader, elementAttributes);
|
|
766
|
+
const attributes = {
|
|
767
|
+
elementAttributes: elementAttributes,
|
|
768
|
+
};
|
|
769
|
+
this.parseCurrencyAndUnitConversion(reader, attributes, viewNode.$getContainer(), viewNode.name);
|
|
770
|
+
reader.moveUp();
|
|
771
|
+
}
|
|
772
|
+
// note: not process script node
|
|
773
|
+
// note: not process graph node
|
|
774
|
+
const element = viewNode.createOrMergeElement(elementAttributes, reader.skippedNodes);
|
|
775
|
+
element.createOrMergeSimpleType(simpleTypeAttributes);
|
|
776
|
+
element.keep = common_1.default.parseBool(elementAttributes.keep);
|
|
777
|
+
element.transparentFilter = common_1.default.parseBool(elementAttributes.transparentFilter);
|
|
778
|
+
return true;
|
|
779
|
+
}
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
static parseRestrictedViewAttribute(reader, viewNode) {
|
|
783
|
+
// note: do nothing
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
static parseRankingFilter(reader, viewNode, columnView) {
|
|
787
|
+
const rankingFilter = viewNode.createRankFilter({
|
|
788
|
+
type: reader.getAttribute('type'),
|
|
789
|
+
offset: reader.getAttribute('offset'),
|
|
790
|
+
offsetParameter: reader.getAttribute('offsetParameter'),
|
|
791
|
+
offsetReference: reader.getAttribute('offsetReference'),
|
|
792
|
+
dynamicPartitionElements: CalculationViewXmlParserHelper_1.default.getBooleanFromString(reader.getAttribute('dynamicPartitionAttributes')),
|
|
793
|
+
});
|
|
794
|
+
const windowFunctionPostProcessValues = {};
|
|
795
|
+
windowFunctionPostProcessValues.rankingFilter = rankingFilter;
|
|
796
|
+
if (reader.tryMoveDown()) {
|
|
797
|
+
const partitionViewAttributes = [];
|
|
798
|
+
const orders = [];
|
|
799
|
+
windowFunctionPostProcessValues.partitionViewAttributes = partitionViewAttributes;
|
|
800
|
+
windowFunctionPostProcessValues.orders = orders;
|
|
801
|
+
while (reader.tryMoveTo('partitionViewAttributeName')) {
|
|
802
|
+
partitionViewAttributes[partitionViewAttributes.length] =
|
|
803
|
+
reader.getAttribute('id') || reader.getContent();
|
|
804
|
+
reader.next();
|
|
805
|
+
}
|
|
806
|
+
while (reader.tryMoveTo('order')) {
|
|
807
|
+
orders[orders.length] = reader.buildAttributes({
|
|
808
|
+
byViewAttributeName: '{byViewAttributeName}',
|
|
809
|
+
direction: '{direction}',
|
|
810
|
+
});
|
|
811
|
+
const orderProperties = {
|
|
812
|
+
byElement: viewNode.elements.get(orders[orders.length - 1].byViewAttributeName),
|
|
813
|
+
direction: orders[orders.length - 1].direction,
|
|
814
|
+
};
|
|
815
|
+
rankingFilter.createOrder(orderProperties, reader.skippedNodes);
|
|
816
|
+
reader.next();
|
|
817
|
+
}
|
|
818
|
+
let udf = CalculationViewXmlParserHelper_1.default.parseUDFParameter(reader, 'rankThreshold');
|
|
819
|
+
udf = exports.processUDFParameter(columnView, udf, udf);
|
|
820
|
+
const rankThreholdSkippedNodes = reader.skippedNodes;
|
|
821
|
+
rankingFilter.createOrMergeRankThreshold(udf, rankThreholdSkippedNodes);
|
|
822
|
+
if (reader.tryMoveTo('rankViewAttributeName')) {
|
|
823
|
+
rankingFilter.rankViewAttributeName = reader.getContent();
|
|
824
|
+
const elementAttributes = {};
|
|
825
|
+
elementAttributes.name = reader.consumeContent();
|
|
826
|
+
elementAttributes.aggregationBehavior = 'SUM';
|
|
827
|
+
elementAttributes.generatedColumn = true;
|
|
828
|
+
const element = viewNode.createOrMergeElement(elementAttributes, undefined);
|
|
829
|
+
const typeAttributes = {
|
|
830
|
+
primitiveType: model_1.PrimitiveType.BIGINT,
|
|
831
|
+
};
|
|
832
|
+
element.createOrMergeSimpleType(typeAttributes);
|
|
833
|
+
}
|
|
834
|
+
reader.moveUp();
|
|
835
|
+
for (let i = 0; i < partitionViewAttributes.length; i++) {
|
|
836
|
+
const elemenLocal = viewNode.elements.get(partitionViewAttributes[i]);
|
|
837
|
+
rankingFilter.partitionElements.addValue(elemenLocal);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
static parseCalculatedViewAttribute(reader, viewNode) {
|
|
842
|
+
if (reader.tryMoveTo('calculatedViewAttribute')) {
|
|
843
|
+
const elementAttributes = reader.buildAttributes({
|
|
844
|
+
name: '{id}',
|
|
845
|
+
primitiveType: '{datatype}',
|
|
846
|
+
length: common_1.default.createIntSelector('length'),
|
|
847
|
+
scale: common_1.default.createIntSelector('scale'),
|
|
848
|
+
expressionLanguage: '{expressionLanguage}',
|
|
849
|
+
});
|
|
850
|
+
const simpleTypeAttributes = {};
|
|
851
|
+
// For CalculatedViewAttribute isDerived will always be false
|
|
852
|
+
simpleTypeAttributes.isDerived = false;
|
|
853
|
+
if (elementAttributes.primitiveType && elementAttributes.primitiveType !== undefined) {
|
|
854
|
+
CalculationViewXmlParserHelper_1.default.populateSimpleTypeAttributesFromElementAttributes(elementAttributes, simpleTypeAttributes);
|
|
855
|
+
}
|
|
856
|
+
let formula = null;
|
|
857
|
+
if (reader.tryMoveDown()) {
|
|
858
|
+
/*reader.tryMoveToIntermediate("formula");
|
|
859
|
+
formula = reader.consumeContent();*/
|
|
860
|
+
/*if (reader.tryMoveToIntermediate("filter")) {
|
|
861
|
+
RepositoryXmlParserHelper.processElementFilter(reader, viewNode, elementAttributes.name);
|
|
862
|
+
reader.next();
|
|
863
|
+
}*/
|
|
864
|
+
if (reader.tryMoveToIntermediate('formula')) {
|
|
865
|
+
formula = reader.consumeContent();
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
if (formula !== undefined && formula !== null) {
|
|
869
|
+
elementAttributes.formula = formula;
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
elementAttributes.formula = '';
|
|
873
|
+
}
|
|
874
|
+
reader.skipChildren().next().moveUp();
|
|
875
|
+
const element = viewNode.createOrMergeElement(elementAttributes, reader.skippedNodes);
|
|
876
|
+
element.createOrMergeSimpleType(simpleTypeAttributes);
|
|
877
|
+
if (elementAttributes.formula !== undefined) {
|
|
878
|
+
element.createCalculationDefinition({
|
|
879
|
+
'formula': elementAttributes.formula,
|
|
880
|
+
'expressionLanguage': elementAttributes.expressionLanguage,
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
return true;
|
|
884
|
+
}
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
static parseInput(reader, viewNode, dataSources, nodeIDsInCalculationView) {
|
|
888
|
+
if (reader.tryMoveTo('input')) {
|
|
889
|
+
const nodeID = reader.consumeAttribute('node');
|
|
890
|
+
nodeIDsInCalculationView.push(nodeID);
|
|
891
|
+
const inputAttributes = reader.buildAttributes({
|
|
892
|
+
emptyUnionBehavior: '{emptyUnionBehavior}',
|
|
893
|
+
tableParameterName: '{tableParameterName}',
|
|
894
|
+
type: '{type}',
|
|
895
|
+
});
|
|
896
|
+
const outputName = reader.consumeAttribute('outputName');
|
|
897
|
+
if (outputName) {
|
|
898
|
+
inputAttributes.outputName = outputName;
|
|
899
|
+
}
|
|
900
|
+
// : If View Node is Union then set default emptyUnionBehavior value even if it is not
|
|
901
|
+
// present in legacy model - TODO
|
|
902
|
+
if (viewNode.type === model_1.ViewNodeType.Union &&
|
|
903
|
+
inputAttributes.emptyUnionBehavior === undefined) {
|
|
904
|
+
inputAttributes.emptyUnionBehavior = 'NO_ROW';
|
|
905
|
+
}
|
|
906
|
+
const input = viewNode.createInput(inputAttributes, reader.skippedNodes);
|
|
907
|
+
input.setSource(getSourceForInput(nodeID, dataSources, viewNode));
|
|
908
|
+
input.repositoryInputNodeId = nodeID;
|
|
909
|
+
const columnView = viewNode.$getContainer();
|
|
910
|
+
if (reader.tryMoveDown()) {
|
|
911
|
+
while (this.parseMapping(reader, input, columnView, false)) {
|
|
912
|
+
reader.next();
|
|
913
|
+
}
|
|
914
|
+
reader.moveUp();
|
|
915
|
+
}
|
|
916
|
+
const singleDataSourceNodes = [
|
|
917
|
+
model_1.ViewNodeType.Projection,
|
|
918
|
+
model_1.ViewNodeType.Aggregation,
|
|
919
|
+
model_1.ViewNodeType.Rank,
|
|
920
|
+
model_1.ViewNodeType.WindowFunction,
|
|
921
|
+
model_1.ViewNodeType.Anonymize,
|
|
922
|
+
];
|
|
923
|
+
if (singleDataSourceNodes.indexOf(viewNode.type) !== -1) {
|
|
924
|
+
for (const attrKey in viewNode.viewAttributeKeys) {
|
|
925
|
+
this.parseMapping(reader, input, columnView, true, attrKey);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
return true;
|
|
929
|
+
}
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
static parseMapping(reader, input, columnView, isSimpleMapping, mappingElementName = '') {
|
|
933
|
+
if (reader.tryMoveTo('mapping') || isSimpleMapping) {
|
|
934
|
+
const mapType = function (value) {
|
|
935
|
+
const type = reader.removePrefix(sharedmodel_1.default.NameSpace.CALCULATION, value);
|
|
936
|
+
switch (type) {
|
|
937
|
+
case 'AttributeMapping':
|
|
938
|
+
return model_1.MappingType.ElementMapping;
|
|
939
|
+
case 'ConstantAttributeMapping':
|
|
940
|
+
return model_1.MappingType.ConstantElementMapping;
|
|
941
|
+
default:
|
|
942
|
+
return type;
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
let mappingAttributes = null;
|
|
946
|
+
if (isSimpleMapping) {
|
|
947
|
+
mappingAttributes = {
|
|
948
|
+
type: model_1.MappingType.ElementMapping,
|
|
949
|
+
sourceName: mappingElementName,
|
|
950
|
+
targetName: mappingElementName,
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
else {
|
|
954
|
+
mappingAttributes = reader.buildAttributes({
|
|
955
|
+
type: common_1.default.createXsiSelector('type', mapType),
|
|
956
|
+
sourceName: '{source}',
|
|
957
|
+
targetName: '{target}',
|
|
958
|
+
isNull: '{null}',
|
|
959
|
+
value: '{value}',
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
const viewNode = input.$getContainer();
|
|
963
|
+
// note: table function is not handled yet
|
|
964
|
+
mappingAttributes.targetElement = viewNode.elements.get(mappingAttributes.targetName);
|
|
965
|
+
delete mappingAttributes.targetName;
|
|
966
|
+
if (mappingAttributes.targetElement &&
|
|
967
|
+
mappingAttributes.targetElement.isCalculatedColumn &&
|
|
968
|
+
mappingAttributes.targetElement.isRestrictedColumn &&
|
|
969
|
+
(mappingAttributes.targetElement.isCalculatedColumn() ||
|
|
970
|
+
mappingAttributes.targetElement.isRestrictedColumn())) {
|
|
971
|
+
return true;
|
|
972
|
+
}
|
|
973
|
+
const inputSource = input.getSource();
|
|
974
|
+
if (inputSource instanceof model_1.Entity && mappingAttributes.sourceName !== undefined) {
|
|
975
|
+
addElementToEntityIfNotPresent(inputSource, mappingAttributes.sourceName);
|
|
976
|
+
// } else if (inputSource instanceof ViewNode && mappingAttributes.sourceName !== undefined) {
|
|
977
|
+
// addElementToViewNodeIfNotPresent( inputSource, mappingAttributes.sourceName );
|
|
978
|
+
}
|
|
979
|
+
// note: not handle Graph node
|
|
980
|
+
if (mappingAttributes.sourceName !== undefined) {
|
|
981
|
+
mappingAttributes.sourceElement = inputSource.elements
|
|
982
|
+
.get(mappingAttributes.sourceName);
|
|
983
|
+
delete mappingAttributes.sourceName;
|
|
984
|
+
}
|
|
985
|
+
else if (mappingAttributes.type === model_1.MappingType.ElementMapping) {
|
|
986
|
+
return true;
|
|
987
|
+
}
|
|
988
|
+
if (mappingAttributes.isNull) {
|
|
989
|
+
mappingAttributes.isNull = common_1.default.parseBool(mappingAttributes.isNull);
|
|
990
|
+
}
|
|
991
|
+
// if ( viewNode.multiJoinNode ) {
|
|
992
|
+
// mappingAttributes.sourceInput = input;
|
|
993
|
+
// }
|
|
994
|
+
const mapping = input.createMapping(mappingAttributes, reader.skippedNodes);
|
|
995
|
+
if (mapping.type === model_1.MappingType.ElementMapping &&
|
|
996
|
+
viewNode.viewAttributeKeys[mappingAttributes.targetElement.name]) {
|
|
997
|
+
delete viewNode.viewAttributeKeys[mappingAttributes.targetElement.name];
|
|
998
|
+
}
|
|
999
|
+
if (!isSimpleMapping) {
|
|
1000
|
+
reader.skipChildren();
|
|
1001
|
+
}
|
|
1002
|
+
return true;
|
|
1003
|
+
}
|
|
1004
|
+
return false;
|
|
1005
|
+
}
|
|
1006
|
+
static parseVariableMappings(reader, variableMappingTagName, columnView, nodetype, nodeName) {
|
|
1007
|
+
// note: do nothing
|
|
1008
|
+
return false;
|
|
1009
|
+
}
|
|
1010
|
+
static parseVariableMapping(reader, variableMappingTagName, columnView) {
|
|
1011
|
+
if (!variableMappingTagName) {
|
|
1012
|
+
variableMappingTagName = 'variableMapping';
|
|
1013
|
+
}
|
|
1014
|
+
if (reader.tryMoveTo(variableMappingTagName)) {
|
|
1015
|
+
const parsingMapper = function (value) {
|
|
1016
|
+
return reader.removePrefix(sharedmodel_1.default.NameSpace.ACCESSCONTROL, value);
|
|
1017
|
+
};
|
|
1018
|
+
const variableMappingData = reader.buildAttributes({
|
|
1019
|
+
type: common_1.default.createXsiSelector('type', parsingMapper),
|
|
1020
|
+
value: '{value}',
|
|
1021
|
+
dataSource: '{dataSource}',
|
|
1022
|
+
forStarJoin: '{forStarJoin}',
|
|
1023
|
+
});
|
|
1024
|
+
if (reader.tryMoveDown()) {
|
|
1025
|
+
if (reader.tryMoveTo('targetVariable')) {
|
|
1026
|
+
variableMappingData.parameterNameOtherView = reader.getAttribute('name');
|
|
1027
|
+
variableMappingData.resourceUri = reader.getAttribute('resourceUri');
|
|
1028
|
+
if (reader.tryMoveToIntermediate('localVariable')) {
|
|
1029
|
+
const localVariable = reader.consumeContent();
|
|
1030
|
+
variableMappingData.parameterName = localVariable;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
reader.moveUp();
|
|
1034
|
+
}
|
|
1035
|
+
return variableMappingData;
|
|
1036
|
+
}
|
|
1037
|
+
return undefined;
|
|
1038
|
+
}
|
|
1039
|
+
static postProcessVariableMappings(reader, variableMappingData, parent, columnView) {
|
|
1040
|
+
// note: do nothing
|
|
1041
|
+
}
|
|
1042
|
+
static parseLogicalModel(reader, columnView, outputViewType, outputViewName, dataSources, isStarJoin) {
|
|
1043
|
+
reader.moveTo('logicalModel');
|
|
1044
|
+
const sourceName = reader.consumeAttribute('id');
|
|
1045
|
+
const outputName = reader.consumeAttribute('outputName');
|
|
1046
|
+
const filterExpressionLanguage = reader.consumeAttribute('filterExpressionLanguage');
|
|
1047
|
+
if (!columnView.viewNodes.get(sourceName)) {
|
|
1048
|
+
// could be Multi join node.
|
|
1049
|
+
// if ( ConvertMultiJoinToBinaryJoin._multiJoinKeyValuePair[sourceName] ) {
|
|
1050
|
+
// sourceName = ConvertMultiJoinToBinaryJoin._multiJoinKeyValuePair[sourceName];
|
|
1051
|
+
// }
|
|
1052
|
+
}
|
|
1053
|
+
const viewNodeAttributes = reader.buildAttributes({
|
|
1054
|
+
name: outputViewName,
|
|
1055
|
+
type: outputViewType,
|
|
1056
|
+
ignoreMultipleOutputsForFilter: '{ignoreMultipleOutputsForFilter}',
|
|
1057
|
+
});
|
|
1058
|
+
viewNodeAttributes.ignoreMultipleOutputsForFilter =
|
|
1059
|
+
CalculationViewXmlParserHelper_1.default.getBooleanFromString(viewNodeAttributes.ignoreMultipleOutputsForFilter);
|
|
1060
|
+
const viewNode = columnView.createOrMergeViewNode(viewNodeAttributes, reader.skippedNodes, true);
|
|
1061
|
+
artifact_management_base_1.getLogger().trace(`created default node: ${outputViewName}`);
|
|
1062
|
+
let input = null;
|
|
1063
|
+
// : if no table/view is assigned to Default Node, i.e; if there is no input to default node
|
|
1064
|
+
// then source Name will be null.
|
|
1065
|
+
if (!viewNode.isScriptNode() && sourceName) {
|
|
1066
|
+
input = viewNode.createInput({}, {});
|
|
1067
|
+
input.setSource(getSourceForInput(sourceName, dataSources, viewNode));
|
|
1068
|
+
input.repositoryInputNodeId = sourceName;
|
|
1069
|
+
if (outputName) {
|
|
1070
|
+
// note: not process outputName, outputName is for Graph node
|
|
1071
|
+
// input.outputName = outputName;
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
if (sourceName) {
|
|
1075
|
+
const dataSource = getDataSource(sourceName, dataSources, columnView);
|
|
1076
|
+
artifact_management_base_1.getLogger().trace(`got dataSource: ${dataSource}`);
|
|
1077
|
+
// note: not set input alias
|
|
1078
|
+
}
|
|
1079
|
+
let singleElementAttributes = null; // new object to be used for creating Element seqentially
|
|
1080
|
+
let elementIndex = 0;
|
|
1081
|
+
const allAttributes = [];
|
|
1082
|
+
viewNode.starJoinPrivateElements = [];
|
|
1083
|
+
reader.moveDown();
|
|
1084
|
+
if (reader.moveToIntermediate('attributes').tryMoveDown()) {
|
|
1085
|
+
while (this.parseAttribute(reader, viewNode, allAttributes)) {
|
|
1086
|
+
singleElementAttributes = allAttributes[elementIndex];
|
|
1087
|
+
// Calling createDefaultNodeElement() which creates element based on order in
|
|
1088
|
+
// viewnode's elements list
|
|
1089
|
+
this.createDefaultNodeElement(viewNode, singleElementAttributes, viewNode.isScriptNode(), isStarJoin);
|
|
1090
|
+
elementIndex++;
|
|
1091
|
+
reader.next();
|
|
1092
|
+
}
|
|
1093
|
+
reader.moveUp();
|
|
1094
|
+
}
|
|
1095
|
+
reader.next();
|
|
1096
|
+
if (reader.moveToIntermediate('calculatedAttributes').tryMoveDown()) {
|
|
1097
|
+
while (this.parseCalculatedAttribute(reader, viewNode, allAttributes)) {
|
|
1098
|
+
singleElementAttributes = allAttributes[elementIndex];
|
|
1099
|
+
this.createDefaultNodeElement(viewNode, singleElementAttributes, viewNode.isScriptNode(), isStarJoin);
|
|
1100
|
+
elementIndex++;
|
|
1101
|
+
reader.next();
|
|
1102
|
+
}
|
|
1103
|
+
reader.moveUp();
|
|
1104
|
+
}
|
|
1105
|
+
reader.next();
|
|
1106
|
+
if (reader.moveToIntermediate('baseMeasures').tryMoveDown()) {
|
|
1107
|
+
while (this.parseMeasure(reader, viewNode, allAttributes)) {
|
|
1108
|
+
singleElementAttributes = allAttributes[elementIndex];
|
|
1109
|
+
this.createDefaultNodeElement(viewNode, singleElementAttributes, viewNode.isScriptNode(), isStarJoin);
|
|
1110
|
+
elementIndex++;
|
|
1111
|
+
reader.next();
|
|
1112
|
+
}
|
|
1113
|
+
reader.moveUp();
|
|
1114
|
+
}
|
|
1115
|
+
reader.next();
|
|
1116
|
+
if (reader.moveToIntermediate('calculatedMeasures').tryMoveDown()) {
|
|
1117
|
+
while (this.parseCalculatedMeasure(reader, viewNode, allAttributes)) {
|
|
1118
|
+
singleElementAttributes = allAttributes[elementIndex];
|
|
1119
|
+
this.createDefaultNodeElement(viewNode, singleElementAttributes, viewNode.isScriptNode(), isStarJoin);
|
|
1120
|
+
elementIndex++;
|
|
1121
|
+
reader.next();
|
|
1122
|
+
}
|
|
1123
|
+
reader.moveUp();
|
|
1124
|
+
}
|
|
1125
|
+
reader.next();
|
|
1126
|
+
if (reader.moveToIntermediate('restrictedMeasures').tryMoveDown()) {
|
|
1127
|
+
// throwUnsupportedOperationException("Restricted Column");
|
|
1128
|
+
while (this.parseRestrictedMeasure(reader, viewNode, allAttributes)) {
|
|
1129
|
+
// throwUnsupportedOperationException("Restricted Column");
|
|
1130
|
+
singleElementAttributes = allAttributes[elementIndex];
|
|
1131
|
+
this.createDefaultNodeElement(viewNode, singleElementAttributes, viewNode.isScriptNode(), isStarJoin);
|
|
1132
|
+
elementIndex++;
|
|
1133
|
+
reader.next();
|
|
1134
|
+
}
|
|
1135
|
+
reader.moveUp();
|
|
1136
|
+
}
|
|
1137
|
+
reader.next();
|
|
1138
|
+
if (reader.tryMoveToIntermediate('sortAttributes')) {
|
|
1139
|
+
if (reader.tryMoveDown()) {
|
|
1140
|
+
while (reader.tryMoveTo('sortAttribute')) {
|
|
1141
|
+
const sortAttributeProperties = reader.buildAttributes({
|
|
1142
|
+
id: '{id}',
|
|
1143
|
+
direction: '{direction}',
|
|
1144
|
+
});
|
|
1145
|
+
sortAttributeProperties.name = viewNode.elements.get(sortAttributeProperties.id);
|
|
1146
|
+
if (!sortAttributeProperties.name) {
|
|
1147
|
+
viewNode.inputs.foreach(function (input) {
|
|
1148
|
+
if (input) {
|
|
1149
|
+
input.getSource().elements
|
|
1150
|
+
.foreach(function (element) {
|
|
1151
|
+
if (element.name === sortAttributeProperties.id) {
|
|
1152
|
+
sortAttributeProperties.name = element;
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
if (!sortAttributeProperties.name) {
|
|
1159
|
+
sortAttributeProperties.name = {
|
|
1160
|
+
name: sortAttributeProperties.id,
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
viewNode.createSortAttributes(sortAttributeProperties, reader.skippedNodes);
|
|
1164
|
+
reader.next();
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
reader.moveUp();
|
|
1168
|
+
reader.next();
|
|
1169
|
+
}
|
|
1170
|
+
// : At last add all private join colulmns of star join
|
|
1171
|
+
for (let i = 0; i < viewNode.starJoinPrivateElements.length; i++) {
|
|
1172
|
+
const starJoinPrivateElement = viewNode.starJoinPrivateElements[i];
|
|
1173
|
+
// viewNode.elements.add(starJoinPrivateElement);
|
|
1174
|
+
for (let index = 0; index < columnView._defaultNodeElementInstancesArray.length; index++) {
|
|
1175
|
+
const elementInstance = columnView._defaultNodeElementInstancesArray[index];
|
|
1176
|
+
if (elementInstance && starJoinPrivateElement &&
|
|
1177
|
+
elementInstance.name === starJoinPrivateElement.name) {
|
|
1178
|
+
delete columnView._defaultNodeElementInstancesArray[index];
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
// Check whether any proxy Element exists; if yes throw TransformationException
|
|
1183
|
+
const proxyElementInstanceFound = this._checkProxyElementsInDefaultNode(viewNode);
|
|
1184
|
+
if (proxyElementInstanceFound) {
|
|
1185
|
+
throw new modelbase_1.TransformationException('Element {0} not found', [proxyElementInstanceFound.name]);
|
|
1186
|
+
}
|
|
1187
|
+
if (columnView.dataCategory === model_1.DataCategory.CUBE) {
|
|
1188
|
+
if (reader.tryMoveToIntermediate('localDimensions')) {
|
|
1189
|
+
// note: do nothing
|
|
1190
|
+
reader.next();
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
// Star Join Code - START
|
|
1194
|
+
if (reader.tryMoveToIntermediate('sharedDimensions')) {
|
|
1195
|
+
if (reader.tryMoveDown()) {
|
|
1196
|
+
while (reader.tryMoveTo('logicalJoin')) {
|
|
1197
|
+
const logicalJoinAttributes = reader.buildAttributes({
|
|
1198
|
+
languageAttributeName: '{languageAttributeName}',
|
|
1199
|
+
useDimensionViewHierarchies: '{useDimensionViewHierarchies}',
|
|
1200
|
+
});
|
|
1201
|
+
logicalJoinAttributes.useDimensionViewHierarchies =
|
|
1202
|
+
CalculationViewXmlParserHelper_1.default.getBooleanFromString(logicalJoinAttributes.useDimensionViewHierarchies);
|
|
1203
|
+
const associatedObjectUri = reader.consumeAttribute('associatedObjectUri');
|
|
1204
|
+
const fqName = associatedObjectUri; // FullQualifiedName.createByResourceURI(associatedObjectUri);
|
|
1205
|
+
const sharedEntity = exports.getEntity(columnView, fqName, undefined /*RepositoryXmlParserHelper.mapRepositoryTypeToEntityType(fqName.getSuffix())*/);
|
|
1206
|
+
sharedEntity.isLoadFromXML = true;
|
|
1207
|
+
const sharedInput = viewNode.createInput({}, undefined);
|
|
1208
|
+
sharedInput.setSource(sharedEntity);
|
|
1209
|
+
sharedInput.selectAll = true;
|
|
1210
|
+
let attributeRef = [];
|
|
1211
|
+
let attributeName = null;
|
|
1212
|
+
let join = null;
|
|
1213
|
+
if (reader.tryMoveDown()) {
|
|
1214
|
+
attributeRef = this.parseStarJoinPrivateJoinColumns(reader);
|
|
1215
|
+
attributeName = this.parseStarJoinSharedJoinColumns(reader);
|
|
1216
|
+
if (attributeRef.length !== attributeName.length) {
|
|
1217
|
+
throw new modelbase_1.TransformationException('Join for attribute view {0} is inconsistent', [fqName]);
|
|
1218
|
+
}
|
|
1219
|
+
const joinAttributes = this.parseStarJoinJoinProperties(reader);
|
|
1220
|
+
// Create join
|
|
1221
|
+
const starJoinNode = columnView.getDefaultNode();
|
|
1222
|
+
starJoinNode.useDimensionViewHierarchies = logicalJoinAttributes.useDimensionViewHierarchies;
|
|
1223
|
+
if (logicalJoinAttributes.languageAttributeName) {
|
|
1224
|
+
// joinAttributes.textJoinLanguageElementName =
|
|
1225
|
+
// logicalJoinAttributes.languageAttributeName;
|
|
1226
|
+
joinAttributes.languageColumn = logicalJoinAttributes.languageAttributeName;
|
|
1227
|
+
}
|
|
1228
|
+
if (joinAttributes) {
|
|
1229
|
+
join = starJoinNode.createJoin(joinAttributes, undefined);
|
|
1230
|
+
join.leftInput = input;
|
|
1231
|
+
/*var sharedInput = viewNode.createInput();
|
|
1232
|
+
sharedInput.setSource(sharedEntity);*/
|
|
1233
|
+
join.rightInput = sharedInput;
|
|
1234
|
+
join.rightInput.selectAll = true;
|
|
1235
|
+
this.processTemporalJoinProperties(reader, columnView.getDefaultNode(), sharedInput, join);
|
|
1236
|
+
if (logicalJoinAttributes.languageAttributeName &&
|
|
1237
|
+
logicalJoinAttributes.languageAttributeName !== 'undefined') {
|
|
1238
|
+
exports.getElementFromsharedEntity(sharedEntity, logicalJoinAttributes.languageAttributeName);
|
|
1239
|
+
}
|
|
1240
|
+
this.processStarJoinAliasedSharedJoinColumns(reader, columnView, fqName, sharedInput);
|
|
1241
|
+
this.parseAssociatedHierarchyFeature(reader, columnView, fqName, sharedEntity);
|
|
1242
|
+
this.processStarJoinSemanticAttributeMappings(reader, starJoinNode, sharedEntity, sharedInput);
|
|
1243
|
+
}
|
|
1244
|
+
reader.next();
|
|
1245
|
+
// : ThrowUnsupportedOperationException for Calc Integration of Hierarchies
|
|
1246
|
+
if (reader._current && reader._current.nextSibling &&
|
|
1247
|
+
reader._current.nextSibling.nodeName === 'associatedHierarchyFeature') {
|
|
1248
|
+
throw new modelbase_1.UnsupportedOperationException('Calc Integration of Hierarchies');
|
|
1249
|
+
}
|
|
1250
|
+
reader.moveUp();
|
|
1251
|
+
}
|
|
1252
|
+
// TODO: no need of listOfLocalJoinedAttributes : delete it later
|
|
1253
|
+
const listOfLocalJoinedAttributes = [];
|
|
1254
|
+
attributeRef = this.remove$localFromStarJoinPrivateJoinColumns(attributeRef, columnView);
|
|
1255
|
+
if (attributeRef && attributeName) {
|
|
1256
|
+
for (let i = 0; i < attributeRef.length; i++) {
|
|
1257
|
+
const leftJoinElementName = attributeRef[i];
|
|
1258
|
+
const inputSource = this.getStarJoinViewNodeInputSource(viewNode);
|
|
1259
|
+
const leftJoinElement = inputSource.elements.get(leftJoinElementName);
|
|
1260
|
+
// join.leftElements.add(leftJoinElement);
|
|
1261
|
+
if (listOfLocalJoinedAttributes.indexOf(leftJoinElementName) === -1) {
|
|
1262
|
+
listOfLocalJoinedAttributes.push(leftJoinElementName);
|
|
1263
|
+
}
|
|
1264
|
+
const rightJoinElementName = attributeName[i];
|
|
1265
|
+
// var rightJoinElement = getElementFromEntity(columnView, fqName,
|
|
1266
|
+
// rightJoinElementName);
|
|
1267
|
+
// inXSA there is no package and schema concept, the name itself is the
|
|
1268
|
+
// uri
|
|
1269
|
+
const rightSharedEntity = exports.getEntity(columnView, fqName, undefined /*RepositoryXmlParserHelper.mapRepositoryTypeToEntityType(fqName.getSuffix())*/);
|
|
1270
|
+
const rightJoinElement = exports.getElementFromsharedEntity(rightSharedEntity, rightJoinElementName);
|
|
1271
|
+
/*join.leftElements.add(leftJoinElement);
|
|
1272
|
+
join.rightElements.add(rightJoinElement);*/
|
|
1273
|
+
const key = leftJoinElement.name + '$$' + rightJoinElement.name;
|
|
1274
|
+
join.leftElements.add(key, leftJoinElement);
|
|
1275
|
+
join.rightElements.add(key, rightJoinElement);
|
|
1276
|
+
if (join.joinType === model_1.JoinType.LEFT_OUTER) {
|
|
1277
|
+
const mappingAttributes = {};
|
|
1278
|
+
mappingAttributes.type = model_1.MappingType.InputMapping;
|
|
1279
|
+
mappingAttributes.sourceElement = leftJoinElement;
|
|
1280
|
+
mappingAttributes.targetElement = rightJoinElement;
|
|
1281
|
+
mappingAttributes.sourceInput = input;
|
|
1282
|
+
sharedInput.createMapping(mappingAttributes, undefined);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
// Join Attribute and mapping should not be present in logical Join as a private
|
|
1287
|
+
// element
|
|
1288
|
+
// Same local Join Attribute can be joined to more than one CV dimensions; even
|
|
1289
|
+
// in this case, we should remove it only one time from private attribute list,
|
|
1290
|
+
// because no matter how many time a local Join Attribute is joined, there will
|
|
1291
|
+
// be only one corresponding private attribute(with suffix '$local') added in
|
|
1292
|
+
// logical model,
|
|
1293
|
+
// while saving by M2M which should be removed while loading
|
|
1294
|
+
for (let i = 0; i < listOfLocalJoinedAttributes.length; i++) {
|
|
1295
|
+
// var elementName = listOfLocalJoinedAttributes[i];
|
|
1296
|
+
// var elementToRemove = viewNode.elements.get(elementName);
|
|
1297
|
+
/*RepositoryXmlParserHelper.removeAttributeMappingForAttribute(elementToRemove, input);
|
|
1298
|
+
viewNode.elements.remove(listOfLocalJoinedAttributes[i]);*/
|
|
1299
|
+
}
|
|
1300
|
+
reader.next();
|
|
1301
|
+
}
|
|
1302
|
+
reader.moveUp();
|
|
1303
|
+
}
|
|
1304
|
+
reader.next();
|
|
1305
|
+
}
|
|
1306
|
+
// Star Join Code - END
|
|
1307
|
+
// filters
|
|
1308
|
+
if (reader.tryMoveToIntermediate('filter')) {
|
|
1309
|
+
const filterExpression = reader.consumeContent();
|
|
1310
|
+
viewNode.createFilterExpression({
|
|
1311
|
+
formula: filterExpression,
|
|
1312
|
+
expressionLanguage: filterExpressionLanguage,
|
|
1313
|
+
}, undefined);
|
|
1314
|
+
artifact_management_base_1.getLogger().trace(`formula: ${filterExpression}, expressionLanguage: ${filterExpressionLanguage}`);
|
|
1315
|
+
reader.next();
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
static parseStarJoinPrivateJoinColumns(reader) {
|
|
1319
|
+
const attributeRefs = [];
|
|
1320
|
+
if (reader.tryMoveTo('attributes')) {
|
|
1321
|
+
if (reader.tryMoveDown()) {
|
|
1322
|
+
while (reader.tryMoveTo('attributeRef')) {
|
|
1323
|
+
const localJoinAttr = reader.consumeContent();
|
|
1324
|
+
attributeRefs.push(localJoinAttr);
|
|
1325
|
+
reader.next();
|
|
1326
|
+
}
|
|
1327
|
+
reader.moveUp();
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
return attributeRefs;
|
|
1331
|
+
}
|
|
1332
|
+
static parseStarJoinSharedJoinColumns(reader) {
|
|
1333
|
+
const attributeNames = [];
|
|
1334
|
+
if (reader.tryMoveTo('associatedAttributeNames')) {
|
|
1335
|
+
if (reader.tryMoveDown()) {
|
|
1336
|
+
while (reader.tryMoveTo('attributeName')) {
|
|
1337
|
+
const sharedJoinAttrName = reader.consumeContent();
|
|
1338
|
+
attributeNames.push(sharedJoinAttrName);
|
|
1339
|
+
reader.next();
|
|
1340
|
+
}
|
|
1341
|
+
reader.moveUp();
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
return attributeNames;
|
|
1345
|
+
}
|
|
1346
|
+
static parseStarJoinJoinProperties(reader) {
|
|
1347
|
+
let joinAttributes = null;
|
|
1348
|
+
if (reader.tryMoveTo('properties')) {
|
|
1349
|
+
joinAttributes = reader.buildAttributes({
|
|
1350
|
+
joinType: '{joinType}',
|
|
1351
|
+
cardinality: '{cardinality}',
|
|
1352
|
+
joinOperator: '{joinOperator}',
|
|
1353
|
+
optimizeJoinColumns: '{optimizeJoinColumns}',
|
|
1354
|
+
greedyJoinPruning: '{greedyJoinPruning}',
|
|
1355
|
+
dimensionJoin: '{dimensionJoin}',
|
|
1356
|
+
dynamic: '{dynamic}',
|
|
1357
|
+
languageAttributeName: '{languageAttributeName}',
|
|
1358
|
+
referentialDirection: '{referentialDirection}',
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
if (joinAttributes) {
|
|
1362
|
+
joinAttributes.optimizeJoinColumns =
|
|
1363
|
+
CalculationViewXmlParserHelper_1.default.getBooleanFromString(joinAttributes.optimizeJoinColumns);
|
|
1364
|
+
}
|
|
1365
|
+
return joinAttributes;
|
|
1366
|
+
}
|
|
1367
|
+
static processTemporalJoinProperties(reader, viewNode, input, join) {
|
|
1368
|
+
if (reader.tryMoveTo('temporalJoinProperties')) {
|
|
1369
|
+
const temporalCondition = reader.consumeAttribute('temporalCondition');
|
|
1370
|
+
const temporalJoinProperties = join.createTemporalJoinProperties({
|
|
1371
|
+
temporalCondition: temporalCondition,
|
|
1372
|
+
});
|
|
1373
|
+
const temporalElementName = reader.consumeAttribute('temporalElementName');
|
|
1374
|
+
if (temporalElementName) {
|
|
1375
|
+
temporalJoinProperties.temporalElement = viewNode.elements.get(temporalElementName);
|
|
1376
|
+
}
|
|
1377
|
+
const rightSharedEntity = input.getSource();
|
|
1378
|
+
const fromElementName = reader.consumeAttribute('fromElementName');
|
|
1379
|
+
if (fromElementName) {
|
|
1380
|
+
temporalJoinProperties.fromElement = exports.getElementFromsharedEntity(rightSharedEntity, fromElementName);
|
|
1381
|
+
}
|
|
1382
|
+
const toElementName = reader.consumeAttribute('toElementName');
|
|
1383
|
+
if (toElementName) {
|
|
1384
|
+
temporalJoinProperties.toElement = exports.getElementFromsharedEntity(rightSharedEntity, toElementName);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
static processStarJoinAliasedSharedJoinColumns(reader, columnView, fqName, sharedInput) {
|
|
1389
|
+
if (reader.tryMoveTo('associatedAttributeFeatures')) {
|
|
1390
|
+
// note: do nothing
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
static parseAssociatedHierarchyFeature(reader, columnView, fqName, sharedEntity) {
|
|
1394
|
+
while (reader.tryMoveTo('associatedHierarchyFeature')) {
|
|
1395
|
+
// note: do nothing
|
|
1396
|
+
reader.next();
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
static processStarJoinSemanticAttributeMappings(reader, starJoinNode, sharedEntity, sharedInput) {
|
|
1400
|
+
if (reader.tryMoveTo('semanticAttributeMappings')) {
|
|
1401
|
+
// note: do nothing
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
static remove$localFromStarJoinPrivateJoinColumns(attributeRefs, columnView) {
|
|
1405
|
+
const privateJoinColumnNames = [];
|
|
1406
|
+
for (let i = 0; i < attributeRefs.length; i++) {
|
|
1407
|
+
if (attributeRefs[i] && attributeRefs[i].indexOf('$local') > -1) {
|
|
1408
|
+
const elementAttributes_name_parts = attributeRefs[i].split('$local');
|
|
1409
|
+
if (elementAttributes_name_parts && elementAttributes_name_parts.length > 0) {
|
|
1410
|
+
privateJoinColumnNames[i] = elementAttributes_name_parts[0];
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
return privateJoinColumnNames;
|
|
1415
|
+
}
|
|
1416
|
+
static getStarJoinViewNodeInput(viewNode) {
|
|
1417
|
+
let input = null;
|
|
1418
|
+
for (let i = 0; i < viewNode.inputs.count(); i++) {
|
|
1419
|
+
if (viewNode.inputs.getAt(i) &&
|
|
1420
|
+
viewNode.inputs.getAt(i).getSource() instanceof model_1.ViewNode) {
|
|
1421
|
+
input = viewNode.inputs.getAt(i);
|
|
1422
|
+
break;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
return input;
|
|
1426
|
+
}
|
|
1427
|
+
static getStarJoinViewNodeInputSource(viewNode) {
|
|
1428
|
+
const inputSource = this.getStarJoinViewNodeInput(viewNode).getSource();
|
|
1429
|
+
return inputSource;
|
|
1430
|
+
}
|
|
1431
|
+
static parseCurrencyAndUnitConversion(reader, attributes, columnView, viewNodeName) {
|
|
1432
|
+
// note: do nothing
|
|
1433
|
+
}
|
|
1434
|
+
static createDefaultNodeElement(viewNode, attributes, isScriptNode, isStarJoin) {
|
|
1435
|
+
const columnView = viewNode.$getContainer();
|
|
1436
|
+
let element = this._getDefaultNodeElementInstanceByElementName(columnView, attributes.elementAttributes.name, false);
|
|
1437
|
+
if (isScriptNode ||
|
|
1438
|
+
(isStarJoin && attributes.elementAttributes && attributes.elementAttributes.name &&
|
|
1439
|
+
attributes.elementAttributes.name.match(/[$]local$/))) {
|
|
1440
|
+
// For ScriptNode and StarJoin go usual way
|
|
1441
|
+
let elementAttributes_name_parts = null;
|
|
1442
|
+
if (!element && isStarJoin) {
|
|
1443
|
+
if (attributes.elementAttributes && attributes.elementAttributes.name &&
|
|
1444
|
+
attributes.elementAttributes.name.match(/[$]local$/)) {
|
|
1445
|
+
if (attributes.elementAttributes && attributes.elementAttributes.name &&
|
|
1446
|
+
attributes.elementAttributes.name.indexOf('$local') > -1) {
|
|
1447
|
+
elementAttributes_name_parts = attributes.elementAttributes.name.split('$local');
|
|
1448
|
+
if (elementAttributes_name_parts && elementAttributes_name_parts.length > 0) {
|
|
1449
|
+
attributes.elementAttributes.name = elementAttributes_name_parts[0];
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
const starJoinPrivateElement = viewNode.createOrMergeElement(attributes.elementAttributes, attributes.elementSkippedNodes);
|
|
1453
|
+
viewNode.starJoinPrivateElements.push(starJoinPrivateElement);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
else if (element && isStarJoin) {
|
|
1457
|
+
elementAttributes_name_parts = element.name.split('$local');
|
|
1458
|
+
if (elementAttributes_name_parts && elementAttributes_name_parts.length > 0) {
|
|
1459
|
+
/*element.name = elementAttributes_name_parts[0];
|
|
1460
|
+
element.name = RepositoryXmlParserHelper.removeHashTag(element.name);*/
|
|
1461
|
+
const localElement = viewNode.createElementWithoutAddingIntoElementCollection(attributes.elementAttributes);
|
|
1462
|
+
viewNode.starJoinPrivateElements.push(localElement);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
else {
|
|
1467
|
+
// create Element Based On Order Index
|
|
1468
|
+
let index = attributes.order;
|
|
1469
|
+
index = common_1.default.parseInt(index);
|
|
1470
|
+
if (element) {
|
|
1471
|
+
attributes.elementAttributes.isProxy = false;
|
|
1472
|
+
element.$setAttributes(attributes.elementAttributes);
|
|
1473
|
+
this._setSkippedNodes(element, attributes.elementSkippedNodes);
|
|
1474
|
+
}
|
|
1475
|
+
else {
|
|
1476
|
+
element = viewNode.createElementWithoutAddingIntoElementCollection(attributes.elementAttributes, attributes.elementSkippedNodes);
|
|
1477
|
+
}
|
|
1478
|
+
viewNode.elements.setAt(index, element);
|
|
1479
|
+
}
|
|
1480
|
+
// element.keep = Util.parseBool( attributes.elementAttributes.keep );
|
|
1481
|
+
// if ( attributes.elementAttributes.key === 'true' ) {
|
|
1482
|
+
// element.$getContainer().keyElements.add( element );
|
|
1483
|
+
// }
|
|
1484
|
+
element = element;
|
|
1485
|
+
if (attributes.simpleTypeAttributes) {
|
|
1486
|
+
element.createOrMergeSimpleType(attributes.simpleTypeAttributes);
|
|
1487
|
+
}
|
|
1488
|
+
if (attributes.mappingAttributes && !isScriptNode) {
|
|
1489
|
+
let inputSource = null, _input = null;
|
|
1490
|
+
if (viewNode.type === model_1.ViewNodeType.JoinNode) {
|
|
1491
|
+
// for star join, ViewNode can be in any input; it will not be fixed at first input
|
|
1492
|
+
for (let i = 0; i < viewNode.inputs.count(); i++) {
|
|
1493
|
+
if (viewNode.inputs.getAt(i) &&
|
|
1494
|
+
viewNode.inputs.getAt(i).getSource() instanceof model_1.ViewNode) {
|
|
1495
|
+
inputSource = viewNode.inputs.getAt(i).getSource();
|
|
1496
|
+
_input = viewNode.inputs.getAt(i);
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
else {
|
|
1502
|
+
_input = viewNode.inputs.getAt(0);
|
|
1503
|
+
inputSource = _input.getSource();
|
|
1504
|
+
}
|
|
1505
|
+
if (inputSource !== undefined && inputSource instanceof model_1.Entity &&
|
|
1506
|
+
attributes.mappingAttributes.sourceName) {
|
|
1507
|
+
addElementToEntityIfNotPresent(inputSource, attributes.mappingAttributes.sourceName);
|
|
1508
|
+
}
|
|
1509
|
+
// Do not create mapping for star join private join column
|
|
1510
|
+
let needToCreateMapping = true;
|
|
1511
|
+
if (attributes.elementAttributes && attributes.elementAttributes.name &&
|
|
1512
|
+
attributes.elementAttributes.name.match(/[$]local$/)) {
|
|
1513
|
+
needToCreateMapping = false;
|
|
1514
|
+
}
|
|
1515
|
+
if (needToCreateMapping) {
|
|
1516
|
+
const _element = inputSource.elements;
|
|
1517
|
+
// if ( inputSource.tableFunctionName && !_element.get( attributes.mappingAttributes.sourceName ) ) {
|
|
1518
|
+
// attributes.mappingAttributes.sourceElement = inputSource.createElement({
|
|
1519
|
+
// name: attributes.mappingAttributes.sourceName,
|
|
1520
|
+
// });
|
|
1521
|
+
// } else {
|
|
1522
|
+
attributes.mappingAttributes.sourceElement = _element.get(attributes.mappingAttributes.sourceName);
|
|
1523
|
+
// }
|
|
1524
|
+
attributes.mappingAttributes.targetElement = element;
|
|
1525
|
+
//delete attributes.mappingAttributes.sourceName;
|
|
1526
|
+
delete attributes.mappingAttributes.targetName;
|
|
1527
|
+
element.createDefaultMapping(attributes.mappingAttributes, attributes.mappingSkippedNodes);
|
|
1528
|
+
}
|
|
1529
|
+
}
|
|
1530
|
+
if (attributes.elementAttributes.formula !== undefined &&
|
|
1531
|
+
attributes.elementAttributes.formula !== null) {
|
|
1532
|
+
// element.createCalculationDefinition({
|
|
1533
|
+
// 'formula': attributes.elementAttributes.formula,
|
|
1534
|
+
// 'expressionLanguage': attributes.elementAttributes.expressionLanguage,
|
|
1535
|
+
// });
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
static parseUnitCurrencyAttribute(reader, attributes) {
|
|
1539
|
+
if (reader.tryMoveToIntermediate('unitCurrencyAttribute')) {
|
|
1540
|
+
// note: not process
|
|
1541
|
+
// attributes.unitCurrencyAttributeName = reader.consumeAttribute( 'attributeName' );
|
|
1542
|
+
}
|
|
1543
|
+
// if ( attributes.unitCurrencyAttributeName ) {
|
|
1544
|
+
// this.registerForLoadPostProcessing( reader, {
|
|
1545
|
+
// attribute: attributes.elementAttributes.name,
|
|
1546
|
+
// value: attributes.unitCurrencyAttributeName,
|
|
1547
|
+
// }, populateUnitCurrencyElements );
|
|
1548
|
+
// }
|
|
1549
|
+
}
|
|
1550
|
+
static parseAttribute(reader, viewNode, allAttributes) {
|
|
1551
|
+
if (reader.tryMoveTo('attribute')) {
|
|
1552
|
+
const attributes = {
|
|
1553
|
+
order: reader.consumeAttribute('order'),
|
|
1554
|
+
};
|
|
1555
|
+
attributes.elementAttributes = reader.buildAttributes({
|
|
1556
|
+
name: '{id}',
|
|
1557
|
+
hidden: '{hidden}',
|
|
1558
|
+
aggregationBehavior: 'none',
|
|
1559
|
+
attributeHierarchyActive: '{attributeHierarchyActive}',
|
|
1560
|
+
displayAttribute: '{displayAttribute}',
|
|
1561
|
+
displayFolder: '{displayFolder}',
|
|
1562
|
+
infoObjectName: '{infoObject}',
|
|
1563
|
+
attributeHierarchyDefaultMember: '{attributeHierarchyDefaultMember}',
|
|
1564
|
+
keep: '{keepFlag}',
|
|
1565
|
+
key: '{key}',
|
|
1566
|
+
descriptionColumnName: '{descriptionColumnName}',
|
|
1567
|
+
semanticType: '{semanticType}',
|
|
1568
|
+
transparentFilter: '{transparentFilter}',
|
|
1569
|
+
deprecated: '{deprecated}',
|
|
1570
|
+
replaceNull: '{replaceNull}',
|
|
1571
|
+
replaceNullBy: '{replaceNullBy}',
|
|
1572
|
+
});
|
|
1573
|
+
if (attributes.elementAttributes.replaceNull !== undefined && attributes.elementAttributes.replaceNull !== null) {
|
|
1574
|
+
attributes.elementAttributes.replaceNull = common_1.default.parseBool(attributes.elementAttributes.replaceNull);
|
|
1575
|
+
}
|
|
1576
|
+
attributes.elementAttributes.transparentFilter = common_1.default.parseBool(attributes.elementAttributes.transparentFilter);
|
|
1577
|
+
attributes.elementAttributes.deprecated = common_1.default.parseBool(attributes.elementAttributes.deprecated);
|
|
1578
|
+
attributes.elementAttributes.hidden = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.hidden);
|
|
1579
|
+
// Create element instance upfront to be used to set other properties on it, e.g; label
|
|
1580
|
+
// element
|
|
1581
|
+
const columnView = viewNode.$getContainer();
|
|
1582
|
+
const element = this._getDefaultNodeElementInstanceByElementName(columnView, attributes.elementAttributes.name, true);
|
|
1583
|
+
// attributes.elementAttributes.transparentFilter =
|
|
1584
|
+
// Util.parseBool(attributes.elementAttributes.transparentFilter);
|
|
1585
|
+
// : Read semanticType using buildAttributes when reading other attributes to avoid
|
|
1586
|
+
// reset issue
|
|
1587
|
+
attributes.simpleTypeAttributes = {};
|
|
1588
|
+
attributes.simpleTypeAttributes.semanticType = attributes.elementAttributes.semanticType;
|
|
1589
|
+
// For Attribute in logical model isDerived will always be true
|
|
1590
|
+
attributes.simpleTypeAttributes.isDerived = true;
|
|
1591
|
+
attributes.elementSkippedNodes = reader.skippedNodes;
|
|
1592
|
+
allAttributes.push(attributes);
|
|
1593
|
+
reader.moveDown();
|
|
1594
|
+
// parseDescriptions
|
|
1595
|
+
sharedmodel_1.default.parseDescriptions(reader, attributes.elementAttributes);
|
|
1596
|
+
CalculationViewXmlParserHelper_1.default.createEndUserTextsIfRequired(element, attributes.elementAttributes);
|
|
1597
|
+
this.parseMaskingExpression(reader, element);
|
|
1598
|
+
// parse InternalExternalConversion
|
|
1599
|
+
this.processInternalExternalConversion(reader, element);
|
|
1600
|
+
// Attribute can have unitCurrencyAttribute
|
|
1601
|
+
if (attributes.simpleTypeAttributes.semanticType !== undefined &&
|
|
1602
|
+
(attributes.simpleTypeAttributes.semanticType === 'amount' ||
|
|
1603
|
+
attributes.simpleTypeAttributes.semanticType === 'quantity')) {
|
|
1604
|
+
this.parseUnitCurrencyAttribute(reader, attributes);
|
|
1605
|
+
// : Do we need to thow UnsupportedOperationException since in UI
|
|
1606
|
+
// UnitCurrencyAttribute for Attribute is not supported - TODO
|
|
1607
|
+
}
|
|
1608
|
+
this.processTypedObjectExternalTypeOfElement(reader, columnView, element, false);
|
|
1609
|
+
this.processTypedObjectExternalTypeOfElementParameterMapping(reader, element, columnView);
|
|
1610
|
+
// reader.next();
|
|
1611
|
+
if (attributes.elementAttributes.descriptionColumnName !== undefined) {
|
|
1612
|
+
// element.labelElement = this._getDefaultNodeElementInstanceByElementName( columnView, attributes.elementAttributes.descriptionColumnName,
|
|
1613
|
+
// true );
|
|
1614
|
+
}
|
|
1615
|
+
const attributeRelationshipAttributes = [];
|
|
1616
|
+
while (reader.tryMoveTo('attributeRelationship')) {
|
|
1617
|
+
const attributeRelationshipAttribute = reader.buildAttributes({
|
|
1618
|
+
parentAttributeName: '{parentAttribute}',
|
|
1619
|
+
type: '{type}',
|
|
1620
|
+
});
|
|
1621
|
+
attributeRelationshipAttributes.push(attributeRelationshipAttribute);
|
|
1622
|
+
reader.next();
|
|
1623
|
+
}
|
|
1624
|
+
if (attributeRelationshipAttributes.length > 0) {
|
|
1625
|
+
// this.registerForLoadPostProcessing( reader, attributeRelationshipAttributes, function( columnView ) {
|
|
1626
|
+
// for ( let index = 0; index < attributeRelationshipAttributes.length; index++ ) {
|
|
1627
|
+
// if ( attributeRelationshipAttributes[index].parentAttributeName ) {
|
|
1628
|
+
// attributeRelationshipAttributes[index].parentAttribute = getElementFromColumnView( columnView, attributeRelationshipAttributes[
|
|
1629
|
+
// index].parentAttributeName );
|
|
1630
|
+
// delete attributeRelationshipAttributes[index].parentAttributeName;
|
|
1631
|
+
// element.createAttributeRelationship( attributeRelationshipAttributes[index] );
|
|
1632
|
+
// }
|
|
1633
|
+
// }
|
|
1634
|
+
// });
|
|
1635
|
+
}
|
|
1636
|
+
if (reader.tryMoveToIntermediate('localVariable')) {
|
|
1637
|
+
const variableName = reader.consumeContent();
|
|
1638
|
+
const parameter = exports.getParameterFromColumnView(columnView, variableName);
|
|
1639
|
+
if (parameter) {
|
|
1640
|
+
parameter.assignedElements.addValue(element);
|
|
1641
|
+
}
|
|
1642
|
+
reader.next();
|
|
1643
|
+
}
|
|
1644
|
+
if (reader.tryMoveToIntermediate('keyMapping')) {
|
|
1645
|
+
attributes.mappingAttributes = reader.buildAttributes({
|
|
1646
|
+
type: 'ElementMapping',
|
|
1647
|
+
sourceName: '{columnName}',
|
|
1648
|
+
targetName: attributes.elementAttributes.name,
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
else {
|
|
1652
|
+
// note: not process hasNoMapping
|
|
1653
|
+
// attributes.elementAttributes.hasNoMapping = true;
|
|
1654
|
+
}
|
|
1655
|
+
// : Old way of storing descriptionColumn - TODO
|
|
1656
|
+
/*
|
|
1657
|
+
if (reader.tryMoveToIntermediate("descriptionMapping")) {
|
|
1658
|
+
attributes.descriptionMappingAttributes = reader.buildAttributes({
|
|
1659
|
+
descriptionColumnName: "{columnName}"
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
*/
|
|
1663
|
+
// : Search Attributes and Attribute Relationship - TODO
|
|
1664
|
+
// : ExternalLikeElementName - SP10 Task
|
|
1665
|
+
// Reading currently using DOM API
|
|
1666
|
+
// RepositoryXmlParserHelper.parseValueHelpForAttributeWithDomAPI(viewNode, reader);
|
|
1667
|
+
// var mappingSkippedNodes = reader.skippedNodes;
|
|
1668
|
+
//attributes.mappingSkippedNodes = reader.skippedNodes;
|
|
1669
|
+
reader.skipChildren().next().moveUp();
|
|
1670
|
+
return true;
|
|
1671
|
+
}
|
|
1672
|
+
return false;
|
|
1673
|
+
}
|
|
1674
|
+
static parseCalculatedAttribute(reader, viewNode, allAttributes) {
|
|
1675
|
+
if (reader.tryMoveTo('calculatedAttribute')) {
|
|
1676
|
+
const attributes = {
|
|
1677
|
+
order: reader.consumeAttribute('order'),
|
|
1678
|
+
};
|
|
1679
|
+
attributes.simpleTypeAttributes = {
|
|
1680
|
+
semanticType: reader.consumeAttribute('semanticType'),
|
|
1681
|
+
};
|
|
1682
|
+
// var semanticType = reader.consumeAttribute("semanticType");
|
|
1683
|
+
const semanticType = attributes.simpleTypeAttributes.semanticType;
|
|
1684
|
+
// For Calculated Attribute in logical model isDerived will always be false
|
|
1685
|
+
attributes.simpleTypeAttributes.isDerived = false;
|
|
1686
|
+
attributes.elementAttributes = reader.buildAttributes({
|
|
1687
|
+
name: '{id}',
|
|
1688
|
+
hidden: '{hidden}',
|
|
1689
|
+
aggregationBehavior: 'none',
|
|
1690
|
+
descriptionColumnName: '{descriptionColumnName}',
|
|
1691
|
+
key: '{key}',
|
|
1692
|
+
displayFolder: '{displayFolder}',
|
|
1693
|
+
attributeHierarchyActive: '{attributeHierarchyActive}',
|
|
1694
|
+
displayAttribute: '{displayAttribute}',
|
|
1695
|
+
replaceNull: '{replaceNull}',
|
|
1696
|
+
replaceNullBy: '{replaceNullBy}',
|
|
1697
|
+
});
|
|
1698
|
+
attributes.elementAttributes.hidden =
|
|
1699
|
+
CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.hidden);
|
|
1700
|
+
attributes.elementAttributes.replaceNull =
|
|
1701
|
+
CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.replaceNull);
|
|
1702
|
+
// Create element instance upfront to be used to set other properties on it, e.g; label
|
|
1703
|
+
// element
|
|
1704
|
+
const columnView = viewNode.$getContainer();
|
|
1705
|
+
const element = this._getDefaultNodeElementInstanceByElementName(columnView, attributes.elementAttributes.name, true);
|
|
1706
|
+
attributes.elementSkippedNodes = reader.skippedNodes;
|
|
1707
|
+
allAttributes.push(attributes);
|
|
1708
|
+
reader.moveDown();
|
|
1709
|
+
// parseDescriptions
|
|
1710
|
+
sharedmodel_1.default.parseDescriptions(reader, attributes.elementAttributes);
|
|
1711
|
+
CalculationViewXmlParserHelper_1.default.createEndUserTextsIfRequired(element, attributes.elementAttributes);
|
|
1712
|
+
this.parseMaskingExpression(reader, element);
|
|
1713
|
+
// parse InternalExternalConversion
|
|
1714
|
+
this.processInternalExternalConversion(reader, element);
|
|
1715
|
+
// Calculated Attribute can have unitCurrencyAttribute
|
|
1716
|
+
if (semanticType !== undefined &&
|
|
1717
|
+
(semanticType === 'amount' || semanticType === 'quantity')) {
|
|
1718
|
+
this.parseUnitCurrencyAttribute(reader, attributes);
|
|
1719
|
+
}
|
|
1720
|
+
/*if (attributes.elementAttributes.descriptionColumnName !== undefined) {
|
|
1721
|
+
this.registerForLoadPostProcessing(reader, {
|
|
1722
|
+
attribute: attributes.elementAttributes.name,
|
|
1723
|
+
value: attributes.elementAttributes.descriptionColumnName
|
|
1724
|
+
}, populateLabelElements);
|
|
1725
|
+
|
|
1726
|
+
}*/
|
|
1727
|
+
if (attributes.elementAttributes.descriptionColumnName !== undefined) {
|
|
1728
|
+
// const populateLabelElement = function() {
|
|
1729
|
+
// element.labelElement = getElementFromColumnView( columnView, attributes.elementAttributes.descriptionColumnName );
|
|
1730
|
+
// };
|
|
1731
|
+
// this.pushToLoadPostProcessingCallBackQueue( reader, populateLabelElement );
|
|
1732
|
+
}
|
|
1733
|
+
this.processTypedObjectExternalTypeOfElement(reader, columnView, element, false);
|
|
1734
|
+
this.processTypedObjectExternalTypeOfElementParameterMapping(reader, element, columnView);
|
|
1735
|
+
// TODO: Old way of storing descriptionColumn
|
|
1736
|
+
// TODO: ExternalLikeElementName
|
|
1737
|
+
if (reader.tryMoveToIntermediate('localVariable')) {
|
|
1738
|
+
const variableName = reader.consumeContent();
|
|
1739
|
+
const parameter = exports.getParameterFromColumnView(columnView, variableName);
|
|
1740
|
+
if (parameter) {
|
|
1741
|
+
parameter.assignedElements.addValue(element);
|
|
1742
|
+
}
|
|
1743
|
+
reader.next();
|
|
1744
|
+
}
|
|
1745
|
+
// keyCalculation tag will always be there in xml; but it would be good to call
|
|
1746
|
+
// tryMoveToIntermediate()
|
|
1747
|
+
// reader.moveTo("keyCalculation");
|
|
1748
|
+
if (reader.tryMoveToIntermediate('keyCalculation')) {
|
|
1749
|
+
attributes.simpleTypeAttributes = reader.buildAttributes({
|
|
1750
|
+
primitiveType: '{datatype}',
|
|
1751
|
+
length: '{length}',
|
|
1752
|
+
scale: '{scale}',
|
|
1753
|
+
}, attributes.simpleTypeAttributes);
|
|
1754
|
+
attributes.simpleTypeAttributes.length = parseInt(attributes.simpleTypeAttributes.length);
|
|
1755
|
+
attributes.simpleTypeAttributes.scale = parseInt(attributes.simpleTypeAttributes.scale);
|
|
1756
|
+
attributes.elementAttributes.expressionLanguage = reader.getAttribute('expressionLanguage');
|
|
1757
|
+
reader.moveDown();
|
|
1758
|
+
reader.moveToIntermediate('formula');
|
|
1759
|
+
// attributes.elementAttributes.formula = reader.consumeContent();
|
|
1760
|
+
const formula = reader.consumeContent();
|
|
1761
|
+
attributes.elementAttributes.formula = formula || '';
|
|
1762
|
+
reader.skipChildren().next().moveUp().moveUp();
|
|
1763
|
+
}
|
|
1764
|
+
return true;
|
|
1765
|
+
}
|
|
1766
|
+
return false;
|
|
1767
|
+
}
|
|
1768
|
+
static parseMeasure(reader, viewNode, allAttributes) {
|
|
1769
|
+
const mapAggregationType = function (value) {
|
|
1770
|
+
return value;
|
|
1771
|
+
// We will return valaue in small case as defined in enum model.AggregationBehavior; UI
|
|
1772
|
+
// will render it in capital
|
|
1773
|
+
// return value.toUpperCase();
|
|
1774
|
+
};
|
|
1775
|
+
let attributes = null;
|
|
1776
|
+
if (reader.tryMoveTo('measure')) {
|
|
1777
|
+
attributes = {
|
|
1778
|
+
order: reader.consumeAttribute('order'),
|
|
1779
|
+
};
|
|
1780
|
+
// TODO: check semanticType is applicable for measure?
|
|
1781
|
+
const semanticType = reader.consumeAttribute('semanticType');
|
|
1782
|
+
const presentationScale = reader.consumeAttribute('presentationScale');
|
|
1783
|
+
attributes.elementAttributes = reader.buildAttributes({
|
|
1784
|
+
name: '{id}',
|
|
1785
|
+
hidden: '{hidden}',
|
|
1786
|
+
displayFolder: '{displayFolder}',
|
|
1787
|
+
aggregationBehavior: common_1.default.createSelector('aggregationType', mapAggregationType),
|
|
1788
|
+
key: '{key}',
|
|
1789
|
+
engineAggregation: '{engineAggregation}',
|
|
1790
|
+
deprecated: '{deprecated}',
|
|
1791
|
+
replaceNull: '{replaceNull}',
|
|
1792
|
+
replaceNullBy: '{replaceNullBy}',
|
|
1793
|
+
unconverted: '{unconverted}',
|
|
1794
|
+
});
|
|
1795
|
+
/*if(attributes.elementAttributes.displayFolder){
|
|
1796
|
+
throwUnsupportedOperationException("Measure Display Folder");
|
|
1797
|
+
}*/
|
|
1798
|
+
if (attributes.elementAttributes.engineAggregation === undefined) {
|
|
1799
|
+
attributes.elementAttributes.engineAggregation = attributes.elementAttributes.aggregationBehavior;
|
|
1800
|
+
}
|
|
1801
|
+
attributes.elementAttributes.deprecated = common_1.default.parseBool(attributes.elementAttributes.deprecated);
|
|
1802
|
+
attributes.elementAttributes.hidden = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.hidden);
|
|
1803
|
+
attributes.elementAttributes.replaceNull = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.replaceNull);
|
|
1804
|
+
attributes.elementAttributes.unconverted = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.unconverted);
|
|
1805
|
+
// Create element instance upfront to be used to set other properties on it, e.g; label
|
|
1806
|
+
// element
|
|
1807
|
+
const columnView = viewNode.$getContainer();
|
|
1808
|
+
const element = this._getDefaultNodeElementInstanceByElementName(columnView, attributes.elementAttributes.name, true);
|
|
1809
|
+
// - Measure Aggrgation Behaviour Defaulted To sum As Done In Modeler
|
|
1810
|
+
if (!attributes.elementAttributes.hasOwnProperty('aggregationBehavior')) {
|
|
1811
|
+
attributes.elementAttributes.aggregationBehavior = model_1.AggregationBehavior.SUM;
|
|
1812
|
+
}
|
|
1813
|
+
// TODO: Special logic to derive based aggregationBehavior isCalculateBeforeAggregation
|
|
1814
|
+
attributes.simpleTypeAttributes = {};
|
|
1815
|
+
if (semanticType) {
|
|
1816
|
+
attributes.simpleTypeAttributes.semanticType = semanticType;
|
|
1817
|
+
}
|
|
1818
|
+
attributes.simpleTypeAttributes.presentationScale = presentationScale;
|
|
1819
|
+
// For Measure in logical model isDerived will always be true
|
|
1820
|
+
attributes.simpleTypeAttributes.isDerived = true;
|
|
1821
|
+
attributes.elementSkippedNodes = reader.skippedNodes;
|
|
1822
|
+
allAttributes.push(attributes);
|
|
1823
|
+
reader.moveDown();
|
|
1824
|
+
// parseDescriptions
|
|
1825
|
+
sharedmodel_1.default.parseDescriptions(reader, attributes.elementAttributes);
|
|
1826
|
+
CalculationViewXmlParserHelper_1.default.createEndUserTextsIfRequired(element, attributes.elementAttributes);
|
|
1827
|
+
this.parseMaskingExpression(reader, element);
|
|
1828
|
+
this.parseCurrencyAndUnitConversion(reader, attributes, viewNode.$getContainer());
|
|
1829
|
+
// OLD Mapping Code - START
|
|
1830
|
+
/*reader.tryMoveToIntermediate("measureMapping");
|
|
1831
|
+
attributes.mappingAttributes = reader.buildAttributes({
|
|
1832
|
+
type: "ElementMapping",
|
|
1833
|
+
sourceName: "{columnName}",
|
|
1834
|
+
targetName: attributes.elementAttributes.name
|
|
1835
|
+
});
|
|
1836
|
+
attributes.mappingSkippedNodes = reader.skippedNodes;*/
|
|
1837
|
+
// OLD Mapping Code - END
|
|
1838
|
+
// NEW Mapping Code - START
|
|
1839
|
+
if (reader.tryMoveToIntermediate('measureMapping')) {
|
|
1840
|
+
attributes.mappingAttributes = reader.buildAttributes({
|
|
1841
|
+
type: 'ElementMapping',
|
|
1842
|
+
sourceName: '{columnName}',
|
|
1843
|
+
targetName: attributes.elementAttributes.name,
|
|
1844
|
+
});
|
|
1845
|
+
attributes.mappingSkippedNodes = reader.skippedNodes;
|
|
1846
|
+
}
|
|
1847
|
+
else {
|
|
1848
|
+
// note: not process hasNoMapping
|
|
1849
|
+
// attributes.elementAttributes.hasNoMapping = true;
|
|
1850
|
+
}
|
|
1851
|
+
reader.skipChildren().next();
|
|
1852
|
+
// NEW Mapping Code - END
|
|
1853
|
+
this.parseExceptionAggregationMetadata(reader, attributes.elementAttributes.name);
|
|
1854
|
+
reader.moveUp();
|
|
1855
|
+
}
|
|
1856
|
+
return attributes;
|
|
1857
|
+
}
|
|
1858
|
+
static parseCalculatedMeasure(reader, viewNode, allAttributes) {
|
|
1859
|
+
const mapAggregationType = function (value) {
|
|
1860
|
+
return value;
|
|
1861
|
+
// We will return valaue in small case as defined in enum model.AggregationBehavior; UI
|
|
1862
|
+
// will render it in capital
|
|
1863
|
+
// return value.toUpperCase();
|
|
1864
|
+
};
|
|
1865
|
+
let attributes = null;
|
|
1866
|
+
// singleElementAttributes = {};
|
|
1867
|
+
if (reader.tryMoveTo('measure')) {
|
|
1868
|
+
attributes = {
|
|
1869
|
+
order: reader.consumeAttribute('order'),
|
|
1870
|
+
};
|
|
1871
|
+
// TODO: check semanticType is applicable for measure?
|
|
1872
|
+
const semanticType = reader.consumeAttribute('semanticType');
|
|
1873
|
+
// var measureType = reader.consumeAttribute("measureType"); // will be derived from
|
|
1874
|
+
// semantic type
|
|
1875
|
+
const isCounter = reader.consumeAttribute('calculatedMeasureType') === 'counter';
|
|
1876
|
+
attributes.elementAttributes = reader.buildAttributes({
|
|
1877
|
+
name: '{id}',
|
|
1878
|
+
hidden: '{hidden}',
|
|
1879
|
+
displayFolder: '{displayFolder}',
|
|
1880
|
+
aggregationBehavior: common_1.default.createSelector('aggregationType', mapAggregationType),
|
|
1881
|
+
primitiveType: '{datatype}',
|
|
1882
|
+
length: '{length}',
|
|
1883
|
+
scale: '{scale}',
|
|
1884
|
+
presentationScale: '{presentationScale}',
|
|
1885
|
+
key: '{key}',
|
|
1886
|
+
aggregatable: '{aggregatable}',
|
|
1887
|
+
engineAggregation: '{engineAggregation}',
|
|
1888
|
+
expressionLanguage: '{expressionLanguage}',
|
|
1889
|
+
replaceNull: '{replaceNull}',
|
|
1890
|
+
replaceNullBy: '{replaceNullBy}',
|
|
1891
|
+
unconverted: '{unconverted}',
|
|
1892
|
+
});
|
|
1893
|
+
attributes.elementAttributes.aggregatable = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.aggregatable);
|
|
1894
|
+
attributes.elementAttributes.hidden = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.hidden);
|
|
1895
|
+
attributes.elementAttributes.replaceNull = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.replaceNull);
|
|
1896
|
+
attributes.elementAttributes.unconverted = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.unconverted);
|
|
1897
|
+
// Extra logic to conver CalculatedMeasure's aggregationBehavior from sum or count to
|
|
1898
|
+
// Formula
|
|
1899
|
+
if (attributes.elementAttributes.aggregationBehavior) {
|
|
1900
|
+
if (!attributes.elementAttributes.aggregatable) {
|
|
1901
|
+
attributes.elementAttributes.aggregationBehavior = 'formula';
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
if (attributes.elementAttributes.engineAggregation === undefined) {
|
|
1905
|
+
attributes.elementAttributes.engineAggregation =
|
|
1906
|
+
attributes.elementAttributes.aggregationBehavior;
|
|
1907
|
+
}
|
|
1908
|
+
// Create element instance upfront to be used to set other properties on it, e.g; label
|
|
1909
|
+
// element
|
|
1910
|
+
const columnView = viewNode.$getContainer();
|
|
1911
|
+
const element = this._getDefaultNodeElementInstanceByElementName(columnView, attributes.elementAttributes.name, true);
|
|
1912
|
+
attributes.simpleTypeAttributes = {};
|
|
1913
|
+
CalculationViewXmlParserHelper_1.default.populateSimpleTypeAttributesFromElementAttributes(attributes.elementAttributes, attributes.simpleTypeAttributes);
|
|
1914
|
+
// For Calculated Measure in logical model isDerived will always be false
|
|
1915
|
+
attributes.simpleTypeAttributes.isDerived = false;
|
|
1916
|
+
// TODO: Also consider isCalculateBeforeAggregation while deriving aggregationBehavior
|
|
1917
|
+
// to make code more generic
|
|
1918
|
+
if (semanticType) {
|
|
1919
|
+
attributes.simpleTypeAttributes.semanticType = semanticType;
|
|
1920
|
+
}
|
|
1921
|
+
attributes.elementSkippedNodes = reader.skippedNodes;
|
|
1922
|
+
allAttributes.push(attributes);
|
|
1923
|
+
reader.moveDown();
|
|
1924
|
+
// parseDescriptions
|
|
1925
|
+
sharedmodel_1.default.parseDescriptions(reader, attributes.elementAttributes);
|
|
1926
|
+
CalculationViewXmlParserHelper_1.default.createEndUserTextsIfRequired(element, attributes.elementAttributes);
|
|
1927
|
+
this.parseMaskingExpression(reader, element);
|
|
1928
|
+
this.parseCurrencyAndUnitConversion(reader, attributes, viewNode.$getContainer());
|
|
1929
|
+
if (!isCounter && attributes.elementAttributes.aggregationBehavior !== 'none') {
|
|
1930
|
+
attributes.elementAttributes.measureType = model_1.MeasureType.CALCULATED_MEASURE;
|
|
1931
|
+
}
|
|
1932
|
+
if (isCounter) {
|
|
1933
|
+
attributes.elementAttributes.measureType = model_1.MeasureType.COUNTER;
|
|
1934
|
+
const counterData = {};
|
|
1935
|
+
counterData.name = attributes.elementAttributes.name;
|
|
1936
|
+
counterData.attributes = [];
|
|
1937
|
+
if (reader.tryMoveToIntermediate('exceptionAggregation')) {
|
|
1938
|
+
if (reader.tryMoveDown()) {
|
|
1939
|
+
while (reader.tryMoveTo('attribute')) {
|
|
1940
|
+
counterData.attributes.push({
|
|
1941
|
+
attributeName: reader.getAttribute('attributeName'),
|
|
1942
|
+
dimensionUri: reader.getAttribute('dimensionUri'),
|
|
1943
|
+
skippedNodes: reader.skippedNodes,
|
|
1944
|
+
});
|
|
1945
|
+
reader.next();
|
|
1946
|
+
}
|
|
1947
|
+
reader.moveUp();
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
// this.registerForLoadPostProcessing( reader, counterData, function( columnView, data ) {
|
|
1951
|
+
// const attributes = data.attributes;
|
|
1952
|
+
// const counterElement = getElementFromColumnView( columnView, data.name );
|
|
1953
|
+
// if ( counterElement ) {
|
|
1954
|
+
// const exceptionAggregationStep = counterElement.createExceptionAggregationStep();
|
|
1955
|
+
// let element = null;
|
|
1956
|
+
// let fqName = null,
|
|
1957
|
+
// sharedEntity = null,
|
|
1958
|
+
// entity = null,
|
|
1959
|
+
// key = null;
|
|
1960
|
+
// for ( let i = 0; i < attributes.length; i++ ) {
|
|
1961
|
+
// let isStarJoin = false;
|
|
1962
|
+
// if ( attributes[i].dimensionUri ) {
|
|
1963
|
+
// fqName = attributes[i].dimensionUri;
|
|
1964
|
+
// sharedEntity = getEntity( columnView, fqName );
|
|
1965
|
+
// element = getElementFromsharedEntity( sharedEntity, attributes[i].attributeName );
|
|
1966
|
+
// isStarJoin = true;
|
|
1967
|
+
// } else {
|
|
1968
|
+
// element = getElementFromColumnView( columnView, attributes[i].attributeName );
|
|
1969
|
+
// }
|
|
1970
|
+
// exceptionAggregationStep.skippedNodes = attributes[i].skippedNodes;
|
|
1971
|
+
// if ( element && isStarJoin ) {
|
|
1972
|
+
// // exceptionAggregationStep.referenceElements.add(element);
|
|
1973
|
+
// entity = element.$getContainer();
|
|
1974
|
+
// fqName = entity.getFullyQualifiedName();
|
|
1975
|
+
// key = fqName + '.' + element.name;
|
|
1976
|
+
// exceptionAggregationStep.referenceElements.add( key, element );
|
|
1977
|
+
// } else {
|
|
1978
|
+
// exceptionAggregationStep.referenceElements.add( element );
|
|
1979
|
+
// }
|
|
1980
|
+
// }
|
|
1981
|
+
// }
|
|
1982
|
+
// });
|
|
1983
|
+
reader.next();
|
|
1984
|
+
}
|
|
1985
|
+
if (reader.tryMoveToIntermediate('formula')) {
|
|
1986
|
+
const formula = reader.consumeContent();
|
|
1987
|
+
attributes.elementAttributes.formula = formula || (isCounter ? '1' : '');
|
|
1988
|
+
}
|
|
1989
|
+
reader.skipChildren().next();
|
|
1990
|
+
this.parseExceptionAggregationMetadata(reader, attributes.elementAttributes.name);
|
|
1991
|
+
reader.moveUp();
|
|
1992
|
+
}
|
|
1993
|
+
return attributes;
|
|
1994
|
+
}
|
|
1995
|
+
static parseRestrictedMeasure(reader, viewNode, allAttributes) {
|
|
1996
|
+
const mapAggregationType = function (value) {
|
|
1997
|
+
return value;
|
|
1998
|
+
};
|
|
1999
|
+
let attributes = null;
|
|
2000
|
+
if (reader.tryMoveTo('measure')) {
|
|
2001
|
+
attributes = {
|
|
2002
|
+
order: reader.consumeAttribute('order'),
|
|
2003
|
+
};
|
|
2004
|
+
attributes.elementAttributes = reader.buildAttributes({
|
|
2005
|
+
name: '{id}',
|
|
2006
|
+
hidden: '{hidden}',
|
|
2007
|
+
baseMeasure: '{baseMeasure}',
|
|
2008
|
+
displayFolder: '{displayFolder}',
|
|
2009
|
+
expressionLanguage: '{restrictionExpressionLanguage}',
|
|
2010
|
+
aggregationBehavior: common_1.default.createSelector('aggregationType', mapAggregationType),
|
|
2011
|
+
replaceNull: '{replaceNull}',
|
|
2012
|
+
replaceNullBy: '{replaceNullBy}',
|
|
2013
|
+
});
|
|
2014
|
+
attributes.elementAttributes.hidden = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.hidden);
|
|
2015
|
+
attributes.elementAttributes.replaceNull = CalculationViewXmlParserHelper_1.default.getBooleanFromString(attributes.elementAttributes.replaceNull);
|
|
2016
|
+
// Create element instance upfront to be used to set other properties on it, e.g; label
|
|
2017
|
+
// element
|
|
2018
|
+
const columnView = viewNode.$getContainer();
|
|
2019
|
+
const element = this._getDefaultNodeElementInstanceByElementName(columnView, attributes.elementAttributes.name, true);
|
|
2020
|
+
attributes.elementAttributes.measureType = model_1.MeasureType.RESTRICTION;
|
|
2021
|
+
attributes.simpleTypeAttributes = {};
|
|
2022
|
+
// For Restricted Measure in logical model isDerived will always be true since
|
|
2023
|
+
// Restricted Measure derives datatype from its base measure
|
|
2024
|
+
attributes.simpleTypeAttributes.isDerived = true;
|
|
2025
|
+
attributes.elementSkippedNodes = reader.skippedNodes;
|
|
2026
|
+
allAttributes.push(attributes);
|
|
2027
|
+
reader.moveDown();
|
|
2028
|
+
// parseDescriptions
|
|
2029
|
+
sharedmodel_1.default.parseDescriptions(reader, attributes.elementAttributes);
|
|
2030
|
+
CalculationViewXmlParserHelper_1.default.createEndUserTextsIfRequired(element, attributes.elementAttributes);
|
|
2031
|
+
this.parseMaskingExpression(reader, element);
|
|
2032
|
+
this.parseCurrencyAndUnitConversion(reader, attributes, viewNode.$getContainer());
|
|
2033
|
+
const restrictedMeasureData = {};
|
|
2034
|
+
restrictedMeasureData.name = attributes.elementAttributes.name;
|
|
2035
|
+
restrictedMeasureData.restrictions = [];
|
|
2036
|
+
restrictedMeasureData.expressionLanguage = attributes.elementAttributes.expressionLanguage;
|
|
2037
|
+
while (reader.tryMoveTo('restriction')) {
|
|
2038
|
+
const restrictions = [];
|
|
2039
|
+
if (reader.tryMoveDown()) {
|
|
2040
|
+
while (reader.tryMoveTo('filter')) {
|
|
2041
|
+
// var restriction = {};
|
|
2042
|
+
const restriction = {};
|
|
2043
|
+
const parsingMapper = function (value) {
|
|
2044
|
+
return reader.removePrefix(sharedmodel_1.default.NameSpace.PRIVILEGE, value);
|
|
2045
|
+
};
|
|
2046
|
+
const filterAttributes = reader.buildAttributes({
|
|
2047
|
+
type: common_1.default.createXsiSelector('type', parsingMapper),
|
|
2048
|
+
attributeName: '{attributeName}',
|
|
2049
|
+
});
|
|
2050
|
+
if (filterAttributes && filterAttributes.attributeName) {
|
|
2051
|
+
restriction.elementName = filterAttributes.attributeName;
|
|
2052
|
+
}
|
|
2053
|
+
if (reader.tryMoveDown()) {
|
|
2054
|
+
restriction.valueFilters = [];
|
|
2055
|
+
while (reader.tryMoveTo('valueFilter')) {
|
|
2056
|
+
const valueFilter = sharedmodel_1.default.parseValueFilter(reader);
|
|
2057
|
+
restriction.valueFilters.push(valueFilter);
|
|
2058
|
+
reader.next();
|
|
2059
|
+
}
|
|
2060
|
+
reader.moveUp();
|
|
2061
|
+
}
|
|
2062
|
+
reader.next();
|
|
2063
|
+
restrictions.push(restriction);
|
|
2064
|
+
}
|
|
2065
|
+
// if (reader.tryMoveTo("attributeName")) {
|
|
2066
|
+
// restriction.elementName = reader.consumeContent();
|
|
2067
|
+
// var elementName = reader.consumeContent();
|
|
2068
|
+
// }
|
|
2069
|
+
if (reader.tryMoveTo('dimensionUri')) {
|
|
2070
|
+
const dimensionUri = reader.consumeContent();
|
|
2071
|
+
// restriction.elementName = filterAttributes.attributeName;
|
|
2072
|
+
for (let index = 0; index < restrictions.length; index++) {
|
|
2073
|
+
const restrictionLocal = restrictions[index];
|
|
2074
|
+
restrictionLocal.dimensionUri = dimensionUri;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
reader.moveUp();
|
|
2078
|
+
}
|
|
2079
|
+
// restrictedMeasureData.restrictions.push(restriction);
|
|
2080
|
+
for (let index = 0; index < restrictions.length; index++) {
|
|
2081
|
+
const restrictionLocal = restrictions[index];
|
|
2082
|
+
restrictedMeasureData.restrictions.push(restrictionLocal);
|
|
2083
|
+
}
|
|
2084
|
+
reader.next();
|
|
2085
|
+
}
|
|
2086
|
+
if (attributes.elementAttributes.baseMeasure) {
|
|
2087
|
+
restrictedMeasureData.baseMeasure = attributes.elementAttributes.baseMeasure;
|
|
2088
|
+
}
|
|
2089
|
+
if (reader.tryMoveToIntermediate('restrictionExpression')) {
|
|
2090
|
+
restrictedMeasureData.restrictionExpression = reader.getContent();
|
|
2091
|
+
}
|
|
2092
|
+
this.parseExceptionAggregationMetadata(reader, attributes.elementAttributes.name);
|
|
2093
|
+
reader.moveUp();
|
|
2094
|
+
this.registerForLoadPostProcessing(reader, restrictedMeasureData, function (columnView, data) {
|
|
2095
|
+
const restrictions = data.restrictions;
|
|
2096
|
+
const restrictedMeasureElement = exports.getElementFromColumnView(columnView, data.name);
|
|
2097
|
+
if (restrictedMeasureElement) {
|
|
2098
|
+
for (let i = 0; i < restrictions.length; i++) {
|
|
2099
|
+
let element = null;
|
|
2100
|
+
if (restrictions[i].dimensionUri === undefined) {
|
|
2101
|
+
element = exports.getElementFromColumnView(columnView, restrictions[i].elementName);
|
|
2102
|
+
}
|
|
2103
|
+
else {
|
|
2104
|
+
const fqName = restrictions[i].dimensionUri;
|
|
2105
|
+
// element = getElementFromEntity(columnView, fqName,
|
|
2106
|
+
// restrictions[i].elementName,
|
|
2107
|
+
// RepositoryXmlParserHelper.mapRepositoryTypeToEntityType(fqName.getSuffix()));
|
|
2108
|
+
const sharedEntity = exports.getEntity(columnView, fqName);
|
|
2109
|
+
element = exports.getElementFromsharedEntity(sharedEntity, restrictions[i].elementName);
|
|
2110
|
+
}
|
|
2111
|
+
if (restrictedMeasureElement && element) {
|
|
2112
|
+
const restriction = restrictedMeasureElement.createRestriction({
|
|
2113
|
+
type: 'AttributeFilter',
|
|
2114
|
+
}, restrictions[i].skippedNodes);
|
|
2115
|
+
const attributes = {};
|
|
2116
|
+
attributes.formula = restrictions[i].elementName;
|
|
2117
|
+
restrictedMeasureElement.createCalculationDefinition(attributes);
|
|
2118
|
+
restriction.element = element;
|
|
2119
|
+
for (let j = 0; j < restrictions[i].valueFilters.length; j++) {
|
|
2120
|
+
restriction.valueFilters.addValue(restrictions[i].valueFilters[j]);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
restrictedMeasureElement.createCalculationDefinition({}).formula = data.baseMeasure;
|
|
2125
|
+
// restrictedMeasureElement.typeOfElement = getElementFromColumnView( columnView, data.baseMeasure );
|
|
2126
|
+
if (data.restrictionExpression) {
|
|
2127
|
+
restrictedMeasureElement.createRestrictionExpression({
|
|
2128
|
+
formula: data.restrictionExpression,
|
|
2129
|
+
expressionLanguage: data.expressionLanguage,
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
return attributes;
|
|
2136
|
+
}
|
|
2137
|
+
static parseExceptionAggregationMetadata(reader, elementName) {
|
|
2138
|
+
if (reader.tryMoveToIntermediate('exceptionAggregationMetadata')) {
|
|
2139
|
+
// note: do nothing
|
|
2140
|
+
reader.next();
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
static doLoadPostProcessing(reader, columnView) {
|
|
2144
|
+
for (let i = 0; i < reader.context.postProcessingRegistry.callback.length; i++) {
|
|
2145
|
+
reader.context.postProcessingRegistry.callback[i].method(columnView, reader.context.postProcessingRegistry.callback[i].data);
|
|
2146
|
+
}
|
|
2147
|
+
return columnView;
|
|
2148
|
+
}
|
|
2149
|
+
static registerForLoadPostProcessing(reader, callbackData, callbackMethod) {
|
|
2150
|
+
const callback = {};
|
|
2151
|
+
callback.method = callbackMethod;
|
|
2152
|
+
callback.data = callbackData;
|
|
2153
|
+
reader.context.postProcessingRegistry.callback.push(callback);
|
|
2154
|
+
}
|
|
2155
|
+
static excecuteLoadPostProcessingCallBackQueue(reader, columnView) {
|
|
2156
|
+
for (let i = 0; i < reader.context.loadPostProcessingCallBackQueue.callback.length; i++) {
|
|
2157
|
+
reader.context.loadPostProcessingCallBackQueue.callback[i].method(columnView);
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
exports.default = CalculationViewXmlParser;
|
|
2162
|
+
const getSourceForInput = (id, dataSources, viewNode) => {
|
|
2163
|
+
const columnView = viewNode.$getContainer();
|
|
2164
|
+
const dataSource = dataSources[id];
|
|
2165
|
+
if (dataSource !== undefined) {
|
|
2166
|
+
const attributes = {
|
|
2167
|
+
id: dataSource.resourceUri || dataSource.id,
|
|
2168
|
+
isProxy: true,
|
|
2169
|
+
};
|
|
2170
|
+
let entity = viewNode.$getModel()._entities.get(attributes.id);
|
|
2171
|
+
if (entity !== null && entity !== undefined) {
|
|
2172
|
+
return entity;
|
|
2173
|
+
}
|
|
2174
|
+
else {
|
|
2175
|
+
entity = viewNode.$getModel().createEntity(attributes);
|
|
2176
|
+
}
|
|
2177
|
+
// var entity = viewNode.$getModel().createEntity(attributes);
|
|
2178
|
+
// Code to avoid creation of duplicate entitiy for same FQName - End
|
|
2179
|
+
// var entity = viewNode.$getModel().createEntity(attributes, dataSource.skippedNodes);
|
|
2180
|
+
return entity;
|
|
2181
|
+
}
|
|
2182
|
+
else {
|
|
2183
|
+
return columnView.viewNodes.get(id);
|
|
2184
|
+
}
|
|
2185
|
+
};
|
|
2186
|
+
const getElementFromColumnView = (columnView, name) => {
|
|
2187
|
+
let foundElement = null;
|
|
2188
|
+
if (columnView && name) {
|
|
2189
|
+
if (columnView.getDefaultNode() !== null &&
|
|
2190
|
+
columnView.getDefaultNode() !== undefined) {
|
|
2191
|
+
foundElement = columnView.getDefaultNode().elements.get(name);
|
|
2192
|
+
if (foundElement !== null && foundElement !== undefined) {
|
|
2193
|
+
return foundElement;
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
return null;
|
|
2198
|
+
};
|
|
2199
|
+
exports.getElementFromColumnView = getElementFromColumnView;
|
|
2200
|
+
const getEntity = (columnView, id, entityType) => {
|
|
2201
|
+
const viewModel = columnView.$getContainer();
|
|
2202
|
+
const entity = viewModel._entities.get(id);
|
|
2203
|
+
if (entity !== null && entity !== undefined) {
|
|
2204
|
+
return entity;
|
|
2205
|
+
}
|
|
2206
|
+
else {
|
|
2207
|
+
const entityAttributes = {
|
|
2208
|
+
isProxy: true,
|
|
2209
|
+
name: id,
|
|
2210
|
+
id: id,
|
|
2211
|
+
type: entityType,
|
|
2212
|
+
};
|
|
2213
|
+
return viewModel.createEntity(entityAttributes);
|
|
2214
|
+
}
|
|
2215
|
+
};
|
|
2216
|
+
exports.getEntity = getEntity;
|
|
2217
|
+
const createSharedElementNameInAgreedFormat = (entity, elementName) => {
|
|
2218
|
+
/*var fqName = entity.getFullyQualifiedName();
|
|
2219
|
+
var sharedElementName = fqName + "." + elementName;
|
|
2220
|
+
return sharedElementName;*/
|
|
2221
|
+
return elementName;
|
|
2222
|
+
};
|
|
2223
|
+
const getElementFromsharedEntity = (entity, elementName) => {
|
|
2224
|
+
const sharedElementName = createSharedElementNameInAgreedFormat(entity, elementName);
|
|
2225
|
+
const element = entity.elements.get(sharedElementName);
|
|
2226
|
+
if (element) {
|
|
2227
|
+
return element;
|
|
2228
|
+
}
|
|
2229
|
+
else {
|
|
2230
|
+
return entity.createElement({
|
|
2231
|
+
name: sharedElementName,
|
|
2232
|
+
isProxy: true,
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2235
|
+
};
|
|
2236
|
+
exports.getElementFromsharedEntity = getElementFromsharedEntity;
|
|
2237
|
+
const getParameterFromColumnView = (columnView, name) => {
|
|
2238
|
+
if (columnView.parameters !== null && columnView.parameters !== undefined) {
|
|
2239
|
+
const foundParameter = columnView.parameters.get(name);
|
|
2240
|
+
if (foundParameter !== null && foundParameter !== undefined) {
|
|
2241
|
+
return foundParameter;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
return null;
|
|
2245
|
+
};
|
|
2246
|
+
exports.getParameterFromColumnView = getParameterFromColumnView;
|
|
2247
|
+
const addElementToEntityIfNotPresent = (entity, elementName) => {
|
|
2248
|
+
if (entity !== null && entity !== undefined) {
|
|
2249
|
+
const element = entity.elements.get(elementName);
|
|
2250
|
+
if (element !== null && element !== undefined) {
|
|
2251
|
+
return element;
|
|
2252
|
+
}
|
|
2253
|
+
else {
|
|
2254
|
+
return entity.createElement({
|
|
2255
|
+
name: elementName,
|
|
2256
|
+
isProxy: true,
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
};
|
|
2261
|
+
const processUDFParameter = (columnView, udfParameter, values) => {
|
|
2262
|
+
if (udfParameter && values) {
|
|
2263
|
+
if (values.parameter) {
|
|
2264
|
+
udfParameter.parameter = exports.getParameterFromColumnView(columnView, values.parameter);
|
|
2265
|
+
}
|
|
2266
|
+
if (values.constantValue) {
|
|
2267
|
+
udfParameter.constantValue = values.constantValue;
|
|
2268
|
+
}
|
|
2269
|
+
udfParameter.skippedNodes = values.skippedNodes;
|
|
2270
|
+
}
|
|
2271
|
+
return udfParameter;
|
|
2272
|
+
};
|
|
2273
|
+
exports.processUDFParameter = processUDFParameter;
|
|
2274
|
+
const getDataSource = (id, dataSources, columnView) => {
|
|
2275
|
+
const dataSource = dataSources[id];
|
|
2276
|
+
return dataSource;
|
|
2277
|
+
};
|
|
2278
|
+
//# sourceMappingURL=CalculationViewXmlParser.js.map
|