Skip to content

Commit c00e706

Browse files
dbulahovstbischof
authored andcommitted
fix name spaces in Restriction
Signed-off-by: dbulahov <bulahovdenis@gmail.com>
1 parent 523337b commit c00e706

File tree

1 file changed

+48
-30
lines changed
  • server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage

1 file changed

+48
-30
lines changed

server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Convert.java

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private static PropertiesR propertyListToProperties(SOAPElement propertyList) {
189189
}
190190

191191
public static MdSchemaFunctionsRestrictionsR discoverMdSchemaFunctionsRestrictions(SOAPElement restriction) {
192-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
192+
Map<String, String> m = getRestrictionMap(restriction);
193193
return new MdSchemaFunctionsRestrictionsR(
194194
Optional.ofNullable(m.get(FUNCTION_NAME)),
195195
Optional.ofNullable(OriginEnum.fromValue(m.get(ORIGIN))),
@@ -200,7 +200,7 @@ public static MdSchemaFunctionsRestrictionsR discoverMdSchemaFunctionsRestrictio
200200

201201

202202
public static MdSchemaDimensionsRestrictionsR discoverMdSchemaDimensionsRestrictions(SOAPElement restriction) {
203-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
203+
Map<String, String> m = getRestrictionMap(restriction);
204204
return new MdSchemaDimensionsRestrictionsR(
205205
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
206206
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -213,7 +213,7 @@ public static MdSchemaDimensionsRestrictionsR discoverMdSchemaDimensionsRestrict
213213
}
214214

215215
public static MdSchemaCubesRestrictionsR discoverMdSchemaCubesRestrictions(SOAPElement restriction) {
216-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
216+
Map<String, String> m = getRestrictionMap(restriction);
217217
return new MdSchemaCubesRestrictionsR(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME),
218218
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
219219
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)),
@@ -223,7 +223,7 @@ public static MdSchemaCubesRestrictionsR discoverMdSchemaCubesRestrictions(SOAPE
223223
}
224224

225225
public static MdSchemaMeasureGroupsRestrictionsR discoverMdSchemaMeasureGroups(SOAPElement restriction) {
226-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
226+
Map<String, String> m = getRestrictionMap(restriction);
227227
return new MdSchemaMeasureGroupsRestrictionsR(Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
228228
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
229229
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)),
@@ -232,7 +232,7 @@ public static MdSchemaMeasureGroupsRestrictionsR discoverMdSchemaMeasureGroups(S
232232
}
233233

234234
public static MdSchemaKpisRestrictionsR discoverMdSchemaKpisRestrictions(SOAPElement restriction) {
235-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
235+
Map<String, String> m = getRestrictionMap(restriction);
236236
return new MdSchemaKpisRestrictionsR(Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
237237
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
238238
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)),
@@ -242,7 +242,7 @@ public static MdSchemaKpisRestrictionsR discoverMdSchemaKpisRestrictions(SOAPEle
242242
}
243243

244244
public static MdSchemaSetsRestrictionsR discoverMdSchemaSetsRestrictions(SOAPElement restriction) {
245-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
245+
Map<String, String> m = getRestrictionMap(restriction);
246246
return new MdSchemaSetsRestrictionsR(
247247
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
248248
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -256,7 +256,7 @@ public static MdSchemaSetsRestrictionsR discoverMdSchemaSetsRestrictions(SOAPEle
256256
}
257257

258258
public static MdSchemaPropertiesRestrictionsR discoverMdSchemaPropertiesRestrictions(SOAPElement restriction) {
259-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
259+
Map<String, String> m = getRestrictionMap(restriction);
260260
return new MdSchemaPropertiesRestrictionsR(
261261
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
262262
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -275,7 +275,7 @@ public static MdSchemaPropertiesRestrictionsR discoverMdSchemaPropertiesRestrict
275275
}
276276

277277
public static MdSchemaMembersRestrictionsR discoverMdSchemaMembersRestrictions(SOAPElement restriction) {
278-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
278+
Map<String, String> m = getRestrictionMap(restriction);
279279
return new MdSchemaMembersRestrictionsR(
280280
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
281281
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -294,7 +294,7 @@ public static MdSchemaMembersRestrictionsR discoverMdSchemaMembersRestrictions(S
294294
}
295295

296296
public static MdSchemaMeasuresRestrictionsR discoverMdSchemaMeasuresRestrictions(SOAPElement restriction) {
297-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
297+
Map<String, String> m = getRestrictionMap(restriction);
298298
return new MdSchemaMeasuresRestrictionsR(
299299
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
300300
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -310,7 +310,7 @@ public static MdSchemaMeasuresRestrictionsR discoverMdSchemaMeasuresRestrictions
310310
public static MdSchemaMeasureGroupDimensionsRestrictionsR discoverMdSchemaMeasureGroupDimensionsRestrictions(
311311
SOAPElement restriction
312312
) {
313-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
313+
Map<String, String> m = getRestrictionMap(restriction);
314314
return new MdSchemaMeasureGroupDimensionsRestrictionsR(
315315
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
316316
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -322,7 +322,7 @@ public static MdSchemaMeasureGroupDimensionsRestrictionsR discoverMdSchemaMeasur
322322
}
323323

324324
public static MdSchemaLevelsRestrictionsR discoverMdSchemaLevelsRestrictions(SOAPElement restriction) {
325-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
325+
Map<String, String> m = getRestrictionMap(restriction);
326326
return new MdSchemaLevelsRestrictionsR(
327327
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
328328
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -340,7 +340,7 @@ public static MdSchemaLevelsRestrictionsR discoverMdSchemaLevelsRestrictions(SOA
340340
}
341341

342342
public static MdSchemaHierarchiesRestrictionsR discoverMdSchemaHierarchiesRestrictions(SOAPElement restriction) {
343-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
343+
Map<String, String> m = getRestrictionMap(restriction);
344344
return new MdSchemaHierarchiesRestrictionsR(
345345
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
346346
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -356,7 +356,7 @@ public static MdSchemaHierarchiesRestrictionsR discoverMdSchemaHierarchiesRestri
356356

357357

358358
public static DbSchemaTablesInfoRestrictionsR discoverDbSchemaTablesInfo(SOAPElement restriction) {
359-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
359+
Map<String, String> m = getRestrictionMap(restriction);
360360
return new DbSchemaTablesInfoRestrictionsR(
361361
Optional.ofNullable(m.get(TABLE_CATALOG)),
362362
Optional.ofNullable(m.get(TABLE_SCHEMA)),
@@ -366,7 +366,7 @@ public static DbSchemaTablesInfoRestrictionsR discoverDbSchemaTablesInfo(SOAPEle
366366
}
367367

368368
public static DbSchemaSourceTablesRestrictionsR discoverDbSchemaSourceTablesRestrictions(SOAPElement restriction) {
369-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
369+
Map<String, String> m = getRestrictionMap(restriction);
370370
return new DbSchemaSourceTablesRestrictionsR(
371371
Optional.ofNullable(m.get(TABLE_CATALOG)),
372372
Optional.ofNullable(m.get(TABLE_SCHEMA)),
@@ -376,7 +376,7 @@ public static DbSchemaSourceTablesRestrictionsR discoverDbSchemaSourceTablesRest
376376
}
377377

378378
public static DbSchemaSchemataRestrictionsR discoverDbSchemaSchemataRestrictions(SOAPElement restriction) {
379-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
379+
Map<String, String> m = getRestrictionMap(restriction);
380380
return new DbSchemaSchemataRestrictionsR(
381381
m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME),
382382
m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME),
@@ -385,15 +385,15 @@ public static DbSchemaSchemataRestrictionsR discoverDbSchemaSchemataRestrictions
385385
}
386386

387387
public static DbSchemaProviderTypesRestrictionsR discoverDbSchemaProviderTypesRestrictions(SOAPElement restriction) {
388-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
388+
Map<String, String> m = getRestrictionMap(restriction);
389389
return new DbSchemaProviderTypesRestrictionsR(
390390
Optional.ofNullable(LevelDbTypeEnum.fromValue(m.get(DATA_TYPE))),
391391
Optional.ofNullable(Boolean.valueOf(m.get(BEST_MATCH)))
392392
);
393393
}
394394

395395
public static DbSchemaColumnsRestrictionsR discoverDbSchemaColumnsRestrictions(SOAPElement restriction) {
396-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
396+
Map<String, String> m = getRestrictionMap(restriction);
397397
return new DbSchemaColumnsRestrictionsR(
398398
Optional.ofNullable(m.get(TABLE_CATALOG)),
399399
Optional.ofNullable(m.get(TABLE_SCHEMA)),
@@ -404,7 +404,7 @@ public static DbSchemaColumnsRestrictionsR discoverDbSchemaColumnsRestrictions(S
404404
}
405405

406406
public static DiscoverXmlMetaDataRestrictionsR discoverDiscoverXmlMetaDataRestrictions(SOAPElement restriction) {
407-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
407+
Map<String, String> m = getRestrictionMap(restriction);
408408
return new DiscoverXmlMetaDataRestrictionsR(
409409
Optional.ofNullable(m.get(OBJECT_TYPE)),
410410
Optional.ofNullable(m.get(DATABASE_ID)),
@@ -433,7 +433,7 @@ public static DiscoverXmlMetaDataRestrictionsR discoverDiscoverXmlMetaDataRestri
433433
}
434434

435435
public static DiscoverDataSourcesRestrictionsR discoverDiscoverDataSourcesRestrictions(SOAPElement restriction) {
436-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
436+
Map<String, String> m = getRestrictionMap(restriction);
437437
return new DiscoverDataSourcesRestrictionsR(
438438
m.get(DATA_SOURCE_NAME),
439439
Optional.ofNullable(m.get(DATA_SOURCE_DESCRIPTION)),
@@ -446,42 +446,42 @@ public static DiscoverDataSourcesRestrictionsR discoverDiscoverDataSourcesRestri
446446
}
447447

448448
public static DbSchemaCatalogsRestrictionsR discoverDbSchemaCatalogsRestrictions(SOAPElement restriction) {
449-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
449+
Map<String, String> m = getRestrictionMap(restriction);
450450
return new DbSchemaCatalogsRestrictionsR(
451451
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME))
452452
);
453453
}
454454

455455
public static DiscoverSchemaRowsetsRestrictionsR discoverSchemaRowsetsRestrictions(SOAPElement restriction) {
456-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
456+
Map<String, String> m = getRestrictionMap(restriction);
457457
return new DiscoverSchemaRowsetsRestrictionsR(
458458
Optional.ofNullable(m.get(SCHEMA_NAME_LOW))
459459
);
460460
}
461461

462462
public static DiscoverEnumeratorsRestrictionsR discoverDiscoverEnumerators(SOAPElement restriction) {
463-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
463+
Map<String, String> m = getRestrictionMap(restriction);
464464
return new DiscoverEnumeratorsRestrictionsR(
465465
Optional.ofNullable(m.get(ENUM_NAME))
466466
);
467467
}
468468

469469
public static DiscoverKeywordsRestrictionsR discoverKeywordsRestrictions(SOAPElement restriction) {
470-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
470+
Map<String, String> m = getRestrictionMap(restriction);
471471
return new DiscoverKeywordsRestrictionsR(
472472
Optional.ofNullable(m.get(KEYWORD))
473473
);
474474
}
475475

476476
public static DiscoverLiteralsRestrictionsR discoverLiteralsRestrictions(SOAPElement restriction) {
477-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
477+
Map<String, String> m = getRestrictionMap(restriction);
478478
return new DiscoverLiteralsRestrictionsR(
479479
Optional.ofNullable(m.get(LITERAL_NAME))
480480
);
481481
}
482482

483483
public static DbSchemaTablesRestrictionsR discoverDbSchemaTablesRestrictions(SOAPElement restriction) {
484-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
484+
Map<String, String> m = getRestrictionMap(restriction);
485485
return new DbSchemaTablesRestrictionsR(
486486
Optional.ofNullable(m.get(TABLE_CATALOG)),
487487
Optional.ofNullable(m.get(TABLE_SCHEMA)),
@@ -492,7 +492,7 @@ public static DbSchemaTablesRestrictionsR discoverDbSchemaTablesRestrictions(SOA
492492

493493

494494
public static MdSchemaActionsRestrictionsR discoverMdSchemaActionsRestrictions(SOAPElement restriction) {
495-
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
495+
Map<String, String> m = getRestrictionMap(restriction);
496496
return new MdSchemaActionsRestrictionsR(
497497
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
498498
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
@@ -7478,14 +7478,32 @@ private static AggregationDesignAttribute getAggregationDesignAttribute(NodeList
74787478
return new AggregationDesignAttributeR(attributeID, Optional.ofNullable(estimatedCount));
74797479
}
74807480

7481-
private static Map<String, String> getMapValuesByTag(SOAPElement el, String tagName) {
7482-
NodeList nodeList = el.getElementsByTagName(tagName);
7483-
if (nodeList != null && nodeList.getLength() > 0) {
7484-
return getMapValues(nodeList.item(0).getChildNodes());
7481+
private static Map<String, String> getRestrictionMap(SOAPElement el) {
7482+
Iterator<Node> nodeIterator = el.getChildElements();
7483+
while (nodeIterator.hasNext()) {
7484+
Node node = nodeIterator.next();
7485+
if (node instanceof SOAPElement restrictions
7486+
&& Constants.MSXMLA.QN_RESTRICTION_LIST.equals(restrictions.getElementQName())) {
7487+
return restrictionValues(restrictions);
7488+
}
7489+
74857490
}
74867491
return Map.of();
74877492
}
74887493

7494+
private static Map<String, String> restrictionValues(SOAPElement restrictionList) {
7495+
Map<String, String> result = new HashMap<>();
7496+
Iterator<Node> nodeIteratorRestrictionList = restrictionList.getChildElements();
7497+
while (nodeIteratorRestrictionList.hasNext()) {
7498+
Node n = nodeIteratorRestrictionList.next();
7499+
if (n instanceof SOAPElement restrictionListElement) {
7500+
String name = restrictionListElement.getLocalName();
7501+
result.put(name, restrictionListElement.getTextContent());
7502+
}
7503+
}
7504+
return result;
7505+
}
7506+
74897507
private static List<String> getValuesByTag(SOAPElement el, String tagName) {
74907508
NodeList nodeList = el.getElementsByTagName(tagName);
74917509

0 commit comments

Comments
 (0)