diff --git a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverConsumers.java b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverConsumers.java index 5e5bb14..f75c7bd 100644 --- a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverConsumers.java +++ b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverConsumers.java @@ -75,7 +75,6 @@ import org.slf4j.LoggerFactory; import java.util.function.Consumer; -import java.util.stream.Collectors; import static org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesRestrictions.RESTRICTIONS_AUTHENTICATION_MODE; import static org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesRestrictions.RESTRICTIONS_DATA_SOURCE_DESCRIPTION; @@ -200,7 +199,8 @@ public class DiscoverConsumers { - private static final Logger LOGGER = LoggerFactory.getLogger(DiscoverConsumers.class); + private static final String VALUE = "Value"; + private static final Logger LOGGER = LoggerFactory.getLogger(DiscoverConsumers.class); private static final String NS_URI = "urn:schemas-microsoft-com:xml-analysis"; private DiscoverConsumers() { @@ -675,8 +675,10 @@ static Consumer createDiscoverPropertiesRequestConsumer(DiscoverPro SOAPElement restrictionList = discover.addChildElement(RESTRICTIONS).addChildElement(RESTRICTION_LIST); if (dr.propertyName().size() > 0) { - String joinedStr = dr.propertyName().stream().collect(Collectors.joining("\n", "", "")); - addChildElement(restrictionList, RESTRICTIONS_PROPERTY_NAME, joinedStr); + SOAPElement el = addChildElement(restrictionList, RESTRICTIONS_PROPERTY_NAME); + for (String propName : dr.propertyName()) { + addChildElement(el, VALUE, propName); + } } SOAPElement propertyList = discover.addChildElement(PROPERTIES).addChildElement(PROPERTY_LIST); diff --git a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtil.java b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtil.java index b8775d7..76c6c01 100644 --- a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtil.java +++ b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtil.java @@ -2832,7 +2832,7 @@ static void addChildElement(SOAPElement element, String childElementName, String } } - private static SOAPElement addChildElement(SOAPElement element, String childElementName) { + static SOAPElement addChildElement(SOAPElement element, String childElementName) { try { return element.addChildElement(childElementName); } catch (SOAPException e) { diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Convert.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Convert.java index ad8a40b..c17d74c 100644 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Convert.java +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Convert.java @@ -19,15 +19,12 @@ import java.time.Duration; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; -import jakarta.xml.soap.SOAPHeader; -import org.eclipse.daanse.xmla.api.common.enums.ActionTypeEnum; import org.eclipse.daanse.xmla.api.common.enums.AuthenticationModeEnum; import org.eclipse.daanse.xmla.api.common.enums.ColumnOlapTypeEnum; import org.eclipse.daanse.xmla.api.common.enums.CoordinateTypeEnum; @@ -114,13 +111,12 @@ private Convert() { } public static DiscoverPropertiesRestrictionsR discoverPropertiesRestrictions(SOAPElement restriction) { - Map m = getMapValuesByTag(restriction, RESTRICTION_LIST); - String propertyName = m.get(PROPERTY_NAME); - if (propertyName != null) { - String[] properties = propertyName.split("\\n"); - return new DiscoverPropertiesRestrictionsR(Arrays.stream(properties).map(s -> s.trim()).filter(s -> s.length() > 0).toList()); + NodeList nodeList = restriction.getElementsByTagName(RESTRICTION_LIST); + List pnList = new ArrayList<>(); + if (nodeList != null && nodeList.getLength() > 0 && nodeList.item(0) instanceof SOAPElement sEl) { + pnList = getValuesByTag(sEl, PROPERTY_NAME); } - return new DiscoverPropertiesRestrictionsR(List.of()); + return new DiscoverPropertiesRestrictionsR(pnList); } public static PropertiesR propertiestoProperties(SOAPElement propertiesElement) { @@ -7456,6 +7452,27 @@ private static Map getMapValuesByTag(SOAPElement el, String tagN return Map.of(); } + private static List getValuesByTag(SOAPElement el, String tagName) { + NodeList nodeList = el.getElementsByTagName(tagName); + + if (nodeList != null && nodeList.getLength() > 0) { + return getValues(nodeList.item(0).getChildNodes()); + } + return List.of(); + } + + private static List getValues(NodeList nl) { + List result = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node n = nl.item(i); + String val = n.getTextContent().trim(); + if (val.length() > 0) { + result.add(val); + } + } + return result; + } + private static Map getMapValues(NodeList nl) { Map result = new HashMap<>(); for (int i = 0; i < nl.getLength(); i++) {