Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private static PropertiesR propertyListToProperties(SOAPElement propertyList) {
}

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


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

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

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

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

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

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

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

public static MdSchemaMeasuresRestrictionsR discoverMdSchemaMeasuresRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new MdSchemaMeasuresRestrictionsR(
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
Expand All @@ -310,7 +310,7 @@ public static MdSchemaMeasuresRestrictionsR discoverMdSchemaMeasuresRestrictions
public static MdSchemaMeasureGroupDimensionsRestrictionsR discoverMdSchemaMeasureGroupDimensionsRestrictions(
SOAPElement restriction
) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new MdSchemaMeasureGroupDimensionsRestrictionsR(
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)),
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME)),
Expand All @@ -322,7 +322,7 @@ public static MdSchemaMeasureGroupDimensionsRestrictionsR discoverMdSchemaMeasur
}

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

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


public static DbSchemaTablesInfoRestrictionsR discoverDbSchemaTablesInfo(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DbSchemaTablesInfoRestrictionsR(
Optional.ofNullable(m.get(TABLE_CATALOG)),
Optional.ofNullable(m.get(TABLE_SCHEMA)),
Expand All @@ -366,7 +366,7 @@ public static DbSchemaTablesInfoRestrictionsR discoverDbSchemaTablesInfo(SOAPEle
}

public static DbSchemaSourceTablesRestrictionsR discoverDbSchemaSourceTablesRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DbSchemaSourceTablesRestrictionsR(
Optional.ofNullable(m.get(TABLE_CATALOG)),
Optional.ofNullable(m.get(TABLE_SCHEMA)),
Expand All @@ -376,7 +376,7 @@ public static DbSchemaSourceTablesRestrictionsR discoverDbSchemaSourceTablesRest
}

public static DbSchemaSchemataRestrictionsR discoverDbSchemaSchemataRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DbSchemaSchemataRestrictionsR(
m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME),
m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME),
Expand All @@ -385,15 +385,15 @@ public static DbSchemaSchemataRestrictionsR discoverDbSchemaSchemataRestrictions
}

public static DbSchemaProviderTypesRestrictionsR discoverDbSchemaProviderTypesRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DbSchemaProviderTypesRestrictionsR(
Optional.ofNullable(LevelDbTypeEnum.fromValue(m.get(DATA_TYPE))),
Optional.ofNullable(Boolean.valueOf(m.get(BEST_MATCH)))
);
}

public static DbSchemaColumnsRestrictionsR discoverDbSchemaColumnsRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DbSchemaColumnsRestrictionsR(
Optional.ofNullable(m.get(TABLE_CATALOG)),
Optional.ofNullable(m.get(TABLE_SCHEMA)),
Expand All @@ -404,7 +404,7 @@ public static DbSchemaColumnsRestrictionsR discoverDbSchemaColumnsRestrictions(S
}

public static DiscoverXmlMetaDataRestrictionsR discoverDiscoverXmlMetaDataRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DiscoverXmlMetaDataRestrictionsR(
Optional.ofNullable(m.get(OBJECT_TYPE)),
Optional.ofNullable(m.get(DATABASE_ID)),
Expand Down Expand Up @@ -433,7 +433,7 @@ public static DiscoverXmlMetaDataRestrictionsR discoverDiscoverXmlMetaDataRestri
}

public static DiscoverDataSourcesRestrictionsR discoverDiscoverDataSourcesRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DiscoverDataSourcesRestrictionsR(
m.get(DATA_SOURCE_NAME),
Optional.ofNullable(m.get(DATA_SOURCE_DESCRIPTION)),
Expand All @@ -446,42 +446,42 @@ public static DiscoverDataSourcesRestrictionsR discoverDiscoverDataSourcesRestri
}

public static DbSchemaCatalogsRestrictionsR discoverDbSchemaCatalogsRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DbSchemaCatalogsRestrictionsR(
Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME))
);
}

public static DiscoverSchemaRowsetsRestrictionsR discoverSchemaRowsetsRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DiscoverSchemaRowsetsRestrictionsR(
Optional.ofNullable(m.get(SCHEMA_NAME_LOW))
);
}

public static DiscoverEnumeratorsRestrictionsR discoverDiscoverEnumerators(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DiscoverEnumeratorsRestrictionsR(
Optional.ofNullable(m.get(ENUM_NAME))
);
}

public static DiscoverKeywordsRestrictionsR discoverKeywordsRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DiscoverKeywordsRestrictionsR(
Optional.ofNullable(m.get(KEYWORD))
);
}

public static DiscoverLiteralsRestrictionsR discoverLiteralsRestrictions(SOAPElement restriction) {
Map<String, String> m = getMapValuesByTag(restriction, RESTRICTION_LIST);
Map<String, String> m = getRestrictionMap(restriction);
return new DiscoverLiteralsRestrictionsR(
Optional.ofNullable(m.get(LITERAL_NAME))
);
}

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


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

private static Map<String, String> getMapValuesByTag(SOAPElement el, String tagName) {
NodeList nodeList = el.getElementsByTagName(tagName);
if (nodeList != null && nodeList.getLength() > 0) {
return getMapValues(nodeList.item(0).getChildNodes());
private static Map<String, String> getRestrictionMap(SOAPElement el) {
Iterator<Node> nodeIterator = el.getChildElements();
while (nodeIterator.hasNext()) {
Node node = nodeIterator.next();
if (node instanceof SOAPElement restrictions
&& Constants.MSXMLA.QN_RESTRICTION_LIST.equals(restrictions.getElementQName())) {
return restrictionValues(restrictions);
}

}
return Map.of();
}

private static Map<String, String> restrictionValues(SOAPElement restrictionList) {
Map<String, String> result = new HashMap<>();
Iterator<Node> nodeIteratorRestrictionList = restrictionList.getChildElements();
while (nodeIteratorRestrictionList.hasNext()) {
Node n = nodeIteratorRestrictionList.next();
if (n instanceof SOAPElement restrictionListElement) {
String name = restrictionListElement.getLocalName();
result.put(name, restrictionListElement.getTextContent());
}
}
return result;
}

private static List<String> getValuesByTag(SOAPElement el, String tagName) {
NodeList nodeList = el.getElementsByTagName(tagName);

Expand Down
Loading