diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/PropertyDefinition.java b/api/src/main/java/org/eclipse/daanse/xmla/api/PropertyDefinition.java index 61da26f..bd2824b 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/PropertyDefinition.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/PropertyDefinition.java @@ -18,7 +18,6 @@ package org.eclipse.daanse.xmla.api; import java.util.EnumSet; -import java.util.Enumeration; import java.util.Set; /** @@ -197,13 +196,13 @@ public enum PropertyDefinition { "DBMSVersion"); final RowsetDefinitionType type; - final Set enumSet; + final Set> enumSet; final XmlaConstants.Access access; final XmlaConstants.Method usage; final String value; final String description; - PropertyDefinition(RowsetDefinitionType type, Set enumSet, XmlaConstants.Access access, + PropertyDefinition(RowsetDefinitionType type, Set> enumSet, XmlaConstants.Access access, String value, XmlaConstants.Method usage, String description) { // Line endings must be UNIX style (LF) not Windows style (LF+CR). // Thus the client will receive the same XML, regardless diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaException.java b/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaException.java index 2bcc598..b655dd2 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaException.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaException.java @@ -21,6 +21,7 @@ * * @author Richard M. Emberson */ +@SuppressWarnings("serial") public class XmlaException extends RuntimeException { public static String formatFaultCode(XmlaException xex) { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaUtil.java b/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaUtil.java index 261cf49..f4822a7 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaUtil.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/XmlaUtil.java @@ -16,6 +16,7 @@ import static org.eclipse.daanse.xmla.api.XmlaConstants.CLIENT_FAULT_FC; import static org.eclipse.daanse.xmla.api.XmlaConstants.USM_DOM_PARSE_CODE; import static org.eclipse.daanse.xmla.api.XmlaConstants.USM_DOM_PARSE_FAULT_FS; + import java.io.StringWriter; import java.util.ArrayList; import java.util.List; @@ -231,21 +232,6 @@ public static String normalizeNumericString(String numericStr) { return numericStr; } - - private static String toString(List list) { - StringBuilder buf = new StringBuilder(); - int k = -1; - for (T t : list) { - if (++k > 0) { - buf.append(", "); - } - buf.append(t); - } - return buf.toString(); - } - - - /** * Result of a metadata query. */ diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AccessEnum.java b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AccessEnum.java index 4ac8930..8905459 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AccessEnum.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AccessEnum.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.common.enums; -import org.eclipse.daanse.xmla.api.annotation.Enumerator; - import java.util.stream.Stream; +import org.eclipse.daanse.xmla.api.annotation.Enumerator; + @Enumerator(name = "Access") public enum AccessEnum { READ("Read"), WRITE("Write"), READ_WRITE("ReadWrite"); diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AuthenticationModeEnum.java b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AuthenticationModeEnum.java index ddb9222..7c7d3a4 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AuthenticationModeEnum.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/AuthenticationModeEnum.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.common.enums; -import org.eclipse.daanse.xmla.api.annotation.Enumerator; - import java.util.stream.Stream; +import org.eclipse.daanse.xmla.api.annotation.Enumerator; + @Enumerator(name = "AuthenticationMode") public enum AuthenticationModeEnum { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/ProviderTypeEnum.java b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/ProviderTypeEnum.java index b675074..f3c51e0 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/ProviderTypeEnum.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/ProviderTypeEnum.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.common.enums; -import org.eclipse.daanse.xmla.api.annotation.Enumerator; - import java.util.stream.Stream; +import org.eclipse.daanse.xmla.api.annotation.Enumerator; + @Enumerator(name = "ProviderType") public enum ProviderTypeEnum { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/TreeOpEnum.java b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/TreeOpEnum.java index dd343c4..3ac4093 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/TreeOpEnum.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/common/enums/TreeOpEnum.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.common.enums; -import org.eclipse.daanse.xmla.api.annotation.Enumerator; - import java.util.stream.Stream; +import org.eclipse.daanse.xmla.api.annotation.Enumerator; + /** * Applies only to a single member: */ diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/common/properties/PropertyListElementDefinition.java b/api/src/main/java/org/eclipse/daanse/xmla/api/common/properties/PropertyListElementDefinition.java index 4d47dff..1f396a5 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/common/properties/PropertyListElementDefinition.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/common/properties/PropertyListElementDefinition.java @@ -31,14 +31,14 @@ public enum PropertyListElementDefinition { LOCALE_IDENTIFIER("LocaleIdentifier", Type.UNSIGNED_INTEGER, null, Access.READ_WRITE, null, true, true); final Type type; - final Set enumSet; + final Set> enumSet; final Access access; final boolean discover; final boolean execute; final String value; final String nameValue; - PropertyListElementDefinition(String nameValue, Type type, Set enumSet, Access access, String value, + PropertyListElementDefinition(String nameValue, Type type, Set> enumSet, Access access, String value, boolean discover, boolean execute) { assert (enumSet != null) == type.isEnum(); diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRequest.java index 0db0654..ee1afb1 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.catalogs; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_CATALOGS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_CATALOGS; - @Operation(name = DBSCHEMA_CATALOGS, guid = "C8B52211-5CF3-11CE-ADE5-00AA0044773D") public interface DbSchemaCatalogsRequest { Properties properties(); diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRestrictions.java index 93f6d15..ee9944b 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/catalogs/DbSchemaCatalogsRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.catalogs; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DbSchemaCatalogsRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/columns/DbSchemaColumnsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/columns/DbSchemaColumnsRequest.java index c91a873..5b85d59 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/columns/DbSchemaColumnsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/columns/DbSchemaColumnsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.columns; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_COLUMNS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_COLUMNS; - @Operation(name = DBSCHEMA_COLUMNS, guid = "C8B52214-5CF3-11CE-ADE5-00AA0044773D") public interface DbSchemaColumnsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/providertypes/DbSchemaProviderTypesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/providertypes/DbSchemaProviderTypesRequest.java index a752247..dc93288 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/providertypes/DbSchemaProviderTypesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/providertypes/DbSchemaProviderTypesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.providertypes; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_PROVIDER_TYPES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_PROVIDER_TYPES; - @Operation(name = DBSCHEMA_PROVIDER_TYPES, guid = "C8B5222C-5CF3-11CE-ADE5-00AA0044773D") public interface DbSchemaProviderTypesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRequest.java index a5c5cef..d634932 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.schemata; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_SCHEMATA; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_SCHEMATA; - @Operation(name = DBSCHEMA_SCHEMATA, guid = "c8b52225-5cf3-11ce-ade5-00aa0044773d") public interface DbSchemaSchemataRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRestrictions.java index c441462..2d27c04 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/schemata/DbSchemaSchemataRestrictions.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.schemata; -import org.eclipse.daanse.xmla.api.annotation.Restriction; - import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; + public interface DbSchemaSchemataRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRequest.java index eb2c2ed..f812ad7 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_SOURCE_TABLES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_SOURCE_TABLES; - @Operation(name = DBSCHEMA_SOURCE_TABLES, guid = "8c3f5858-2742-4976-9d65-eb4d493c693e") public interface DbSchemaSourceTablesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRestrictions.java index 0b0d597..41b50a0 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/sourcetables/DbSchemaSourceTablesRestrictions.java @@ -13,13 +13,13 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.TableTypeEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface DbSchemaSourceTablesRestrictions { String RESTRICTIONS_TABLE_CATALOG = "TABLE_CATALOG"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRequest.java index 3f31075..fdf463b 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.tables; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_TABLES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_TABLES; - @Operation(name = DBSCHEMA_TABLES, guid = "C8B52229-5CF3-11CE-ADE5-00AA0044773D") public interface DbSchemaTablesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRestrictions.java index 098320f..d793193 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tables/DbSchemaTablesRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.tables; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DbSchemaTablesRestrictions { String RESTRICTIONS_TABLE_CATALOG = "TABLE_CATALOG"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRequest.java index 792bdf8..38dd439 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_TABLES_INFO; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DBSCHEMA_TABLES_INFO; - @Operation(name = DBSCHEMA_TABLES_INFO, guid = "c8b522e0-5cf3-11ce-ade5-00aa0044773d") public interface DbSchemaTablesInfoRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRestrictions.java index 2a0c156..5954396 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/dbschema/tablesinfo/DbSchemaTablesInfoRestrictions.java @@ -13,13 +13,13 @@ */ package org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.TableTypeEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface DbSchemaTablesInfoRestrictions { String RESTRICTIONS_TABLE_CATALOG = "TABLE_CATALOG"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/csdlmetadata/DiscoverCsdlMetaDataRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/csdlmetadata/DiscoverCsdlMetaDataRequest.java index 8736a29..9ec3c84 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/csdlmetadata/DiscoverCsdlMetaDataRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/csdlmetadata/DiscoverCsdlMetaDataRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.csdlmetadata; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_CSDL_METADATA; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_CSDL_METADATA; - @Operation(name = DISCOVER_CSDL_METADATA, guid = "87B86062-21C3-460F-B4F8-5BE98394F13B") public interface DiscoverCsdlMetaDataRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRequest.java index a709224..f9cb70a 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.datasources; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_DATASOURCES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_DATASOURCES; - @Operation(name = DISCOVER_DATASOURCES, guid = "06C03D41-F66D-49F3-B1B8-987F7AF4CF18") public interface DiscoverDataSourcesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRestrictions.java index 956f3e5..2a22988 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/datasources/DiscoverDataSourcesRestrictions.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.datasources; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.AuthenticationModeEnum; import org.eclipse.daanse.xmla.api.common.enums.ProviderTypeEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface DiscoverDataSourcesRestrictions { String RESTRICTIONS_DATA_SOURCE_NAME = "DataSourceName"; String RESTRICTIONS_DATA_SOURCE_DESCRIPTION = "DataSourceDescription"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRequest.java index 5941095..00659ea 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.enumerators; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_ENUMERATORS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_ENUMERATORS; - @Operation(name = DISCOVER_ENUMERATORS, guid = "55A9E78B-ACCB-45B4-95A6-94C5065617A7") public interface DiscoverEnumeratorsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRestrictions.java index 1538a0c..1d656a2 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/enumerators/DiscoverEnumeratorsRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.enumerators; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DiscoverEnumeratorsRestrictions { String RESTRICTIONS_ENUM_NAME = "EnumName"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRequest.java index 94e1c9e..adab9b0 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.keywords; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_KEYWORDS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_KEYWORDS; - @Operation(name = DISCOVER_KEYWORDS, guid = "1426C443-4CDD-4A40-8F45-572FAB9BBAA1") public interface DiscoverKeywordsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRestrictions.java index 5de2fc9..77ae389 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/keywords/DiscoverKeywordsRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.keywords; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DiscoverKeywordsRestrictions { String RESTRICTIONS_KEYWORD = "Keyword"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRequest.java index aaf9faf..d0f209e 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.literals; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_LITERALS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_LITERALS; - @Operation(name = DISCOVER_LITERALS, guid = "C3EF5ECB-0A07-4665-A140-B075722DBDC2") public interface DiscoverLiteralsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRestrictions.java index ba99914..3cb65a1 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/literals/DiscoverLiteralsRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.literals; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DiscoverLiteralsRestrictions { String RESTRICTIONS_LITERAL_NAME = "LiteralName"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRequest.java index 44eb239..474f21e 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.properties; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_PROPERTIES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_PROPERTIES; - @Operation(name = DISCOVER_PROPERTIES, guid = "4B40ADFB-8B09-4758-97BB-636E8AE97BCF") public interface DiscoverPropertiesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesResponseRow.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesResponseRow.java index adb9bce..a7b2c71 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesResponseRow.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesResponseRow.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.properties; -import org.eclipse.daanse.xmla.api.common.enums.AccessEnum; - import java.util.Optional; +import org.eclipse.daanse.xmla.api.common.enums.AccessEnum; + /** * This schema rowset returns a list of information and values about the properties that are * supported by the server for the specified data source. diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRestrictions.java index 9c3dc39..f4547ac 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/properties/DiscoverPropertiesRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.properties; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.List; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DiscoverPropertiesRestrictions { String RESTRICTIONS_PROPERTY_NAME = "PropertyName"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRequest.java index a4d0849..cb10456 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.schemarowsets; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_SCHEMA_ROWSETS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_SCHEMA_ROWSETS; - @Operation(name = DISCOVER_SCHEMA_ROWSETS, guid = "EEA0302B-7922-4992-8991-0E605D0E5593") public interface DiscoverSchemaRowsetsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsResponseRow.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsResponseRow.java index ce4a455..7bd5bea 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsResponseRow.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsResponseRow.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.schemarowsets; -import org.eclipse.daanse.xmla.api.xmla.Restriction; - import java.util.List; import java.util.Optional; +import org.eclipse.daanse.xmla.api.xmla.Restriction; + /** * This schema rowset returns the names, restrictions, description, and other information for all * Discover requests. diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRestrictions.java index b245602..de9b9bc 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/schemarowsets/DiscoverSchemaRowsetsRestrictions.java @@ -12,11 +12,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.schemarowsets; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface DiscoverSchemaRowsetsRestrictions { String RESTRICTIONS_SCHEMA_NAME = "SchemaName"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRequest.java index 1a434ad..4202a84 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_XML_METADATA; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.DISCOVER_XML_METADATA; - @Operation(name = DISCOVER_XML_METADATA, guid = "3444B255-171E-4CB9-AD98-19E57888A75F") public interface DiscoverXmlMetaDataRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRestrictions.java index 57da92c..949d1c8 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/discover/xmlmetadata/DiscoverXmlMetaDataRestrictions.java @@ -13,13 +13,13 @@ */ package org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.ObjectExpansionEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface DiscoverXmlMetaDataRestrictions { public static final String RESTRICTIONS_OBJECT_TYPE = "ObjectType"; public static final String RESTRICTIONS_DATABASE_ID = "DatabaseID"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRequest.java index 0122ef4..2065675 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.actions; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_ACTIONS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_ACTIONS; - @Operation(name = MDSCHEMA_ACTIONS, guid = "A07CCD08-8148-11D0-87BB-00C04FC33942") public interface MdSchemaActionsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRestrictions.java index 579f0e7..806ea36 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/actions/MdSchemaActionsRestrictions.java @@ -13,6 +13,9 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.actions; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; @@ -21,9 +24,6 @@ import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.InvocationEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaActionsRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRequest.java index e6e8150..1ea287f 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.cubes; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_CUBES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_CUBES; - @Operation(name = MDSCHEMA_CUBES, guid = "C8B522D8-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaCubesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRestrictions.java index db86b23..949cb83 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/cubes/MdSchemaCubesRestrictions.java @@ -13,15 +13,15 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.cubes; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.CubeTypeEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaCubesRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRequest.java index a367075..1a15740 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.demensions; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_DIMENSIONS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_DIMENSIONS; - @Operation(name = MDSCHEMA_DIMENSIONS, guid = "C8B522D9-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaDimensionsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRestrictions.java index 57942a9..aaf0566 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/demensions/MdSchemaDimensionsRestrictions.java @@ -13,15 +13,14 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.demensions; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaDimensionsRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRequest.java index bd6cae6..8b9565f 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.functions; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_FUNCTIONS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_FUNCTIONS; - @Operation(name = MDSCHEMA_FUNCTIONS, guid = "A07CCD07-8148-11D0-87BB-00C04FC33942") public interface MdSchemaFunctionsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRestrictions.java index bd9dfa4..71bec93 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/functions/MdSchemaFunctionsRestrictions.java @@ -13,15 +13,15 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.functions; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.InterfaceNameEnum; import org.eclipse.daanse.xmla.api.common.enums.OriginEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaFunctionsRestrictions { String RESTRICTIONS_FUNCTION_NAME = "FUNCTION_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRequest.java index 160adcf..510448f 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_HIERARCHIES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_HIERARCHIES; - @Operation(name = MDSCHEMA_HIERARCHIES, guid = "C8B522DA-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaHierarchiesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRestrictions.java index 14964f3..029552a 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/hierarchies/MdSchemaHierarchiesRestrictions.java @@ -13,15 +13,15 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaHierarchiesRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRequest.java index ecfdc93..7a92445 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.kpis; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_KPIS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_KPIS; - @Operation(name = MDSCHEMA_KPIS, guid = "2AE44109-ED3D-4842-B16F-B694D1CB0E3F") public interface MdSchemaKpisRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRestrictions.java index 1fad291..8729757 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/kpis/MdSchemaKpisRestrictions.java @@ -13,13 +13,13 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.kpis; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaKpisRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRequest.java index 37a1c83..a290d1b 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.levels; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_LEVELS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_LEVELS; - @Operation(name = MDSCHEMA_LEVELS, guid = "C8B522DB-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaLevelsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRestrictions.java index b7fdc0a..3355f18 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/levels/MdSchemaLevelsRestrictions.java @@ -13,6 +13,10 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.levels; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_SHORT; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; @@ -20,10 +24,6 @@ import org.eclipse.daanse.xmla.api.common.enums.LevelOriginEnum; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_SHORT; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaLevelsRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRequest.java index 09459a4..37111e0 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEASUREGROUP_DIMENSIONS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEASUREGROUP_DIMENSIONS; - @Operation(name = MDSCHEMA_MEASUREGROUP_DIMENSIONS, guid = "a07ccd33-8148-11d0-87bb-00c04fc33942") public interface MdSchemaMeasureGroupDimensionsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRestrictions.java index 0b71909..d49a8f7 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroupdimensions/MdSchemaMeasureGroupDimensionsRestrictions.java @@ -13,14 +13,13 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaMeasureGroupDimensionsRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRequest.java index cb67b6e..07775b5 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEASUREGROUPS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEASUREGROUPS; - @Operation(name = MDSCHEMA_MEASUREGROUPS, guid = "E1625EBF-FA96-42FD-BEA6-DB90ADAFD96B") public interface MdSchemaMeasureGroupsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRestrictions.java index 17dfb51..40cd37f 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measuregroups/MdSchemaMeasureGroupsRestrictions.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups; -import org.eclipse.daanse.xmla.api.annotation.Restriction; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; import java.util.Optional; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; +import org.eclipse.daanse.xmla.api.annotation.Restriction; public interface MdSchemaMeasureGroupsRestrictions { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRequest.java index 6baa042..cb108a2 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.measures; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEASURES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEASURES; - @Operation(name = MDSCHEMA_MEASURES, guid = "C8B522DC-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaMeasuresRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRestrictions.java index 0fe39c1..1678c2b 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/measures/MdSchemaMeasuresRestrictions.java @@ -13,15 +13,15 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.measures; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaMeasuresRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRequest.java index cd8a533..09013ad 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.members; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEMBERS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_MEMBERS; - @Operation(name = MDSCHEMA_MEMBERS, guid = "C8B522DE-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaMembersRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRestrictions.java index 14402d1..65a168e 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/members/MdSchemaMembersRestrictions.java @@ -13,6 +13,9 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.members; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; @@ -20,9 +23,6 @@ import org.eclipse.daanse.xmla.api.common.enums.MemberTypeEnum; import org.eclipse.daanse.xmla.api.common.enums.TreeOpEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaMembersRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRequest.java index 038441e..f44c5f3 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.properties; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_PROPERTIES; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_PROPERTIES; - @Operation(name = MDSCHEMA_PROPERTIES, guid = "C8B522DD-5CF3-11CE-ADE5-00AA0044773D") public interface MdSchemaPropertiesRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRestrictions.java index 0f257c5..19d49f3 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/properties/MdSchemaPropertiesRestrictions.java @@ -13,6 +13,10 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.properties; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_SHORT; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; @@ -22,10 +26,6 @@ import org.eclipse.daanse.xmla.api.common.enums.PropertyTypeEnum; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_INTEGER; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_SHORT; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaPropertiesRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRequest.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRequest.java index ca8e32e..fb04031 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRequest.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRequest.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.sets; +import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_SETS; + import org.eclipse.daanse.xmla.api.annotation.Operation; import org.eclipse.daanse.xmla.api.discover.Properties; -import static org.eclipse.daanse.xmla.api.common.properties.OperationNames.MDSCHEMA_SETS; - @Operation(name = MDSCHEMA_SETS, guid = "A07CCD0B-8148-11D0-87BB-00C04FC33942") public interface MdSchemaSetsRequest { diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRestrictions.java b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRestrictions.java index adb553b..7887dcc 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRestrictions.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/discover/mdschema/sets/MdSchemaSetsRestrictions.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.api.discover.mdschema.sets; +import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; + import java.util.Optional; import org.eclipse.daanse.xmla.api.annotation.Restriction; import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.ScopeEnum; -import static org.eclipse.daanse.xmla.api.common.properties.XsdType.XSD_STRING; - public interface MdSchemaSetsRestrictions { String RESTRICTIONS_CATALOG_NAME = "CATALOG_NAME"; diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/RowSetRowItem.java b/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/RowSetRowItem.java index 664ed4f..56667ed 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/RowSetRowItem.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/RowSetRowItem.java @@ -13,10 +13,10 @@ */ package org.eclipse.daanse.xmla.api.mddataset; -import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; - import java.util.Optional; +import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; + public interface RowSetRowItem { String tagName(); diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/Value.java b/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/Value.java index ce6d35c..100067f 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/Value.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/mddataset/Value.java @@ -12,10 +12,10 @@ */ package org.eclipse.daanse.xmla.api.mddataset; -import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; - import java.util.List; +import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; + public interface Value { List error(); diff --git a/api/src/main/java/org/eclipse/daanse/xmla/api/xmla/AndOrTypeEnum.java b/api/src/main/java/org/eclipse/daanse/xmla/api/xmla/AndOrTypeEnum.java index 3ebeb63..63f9919 100644 --- a/api/src/main/java/org/eclipse/daanse/xmla/api/xmla/AndOrTypeEnum.java +++ b/api/src/main/java/org/eclipse/daanse/xmla/api/xmla/AndOrTypeEnum.java @@ -13,7 +13,6 @@ package org.eclipse.daanse.xmla.api.xmla; -@SuppressWarnings("java:S115") public enum AndOrTypeEnum { Not, Or, And, Equal, NotEqual, Less, LessOrEqual, Greater, GreaterOrEqual, Like, NotLike; } diff --git a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverServiceImpl.java b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverServiceImpl.java index d6068ca..27686a1 100644 --- a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverServiceImpl.java +++ b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/DiscoverServiceImpl.java @@ -13,11 +13,42 @@ */ package org.eclipse.daanse.xmla.client.soapmessage; -import jakarta.xml.soap.SOAPException; -import jakarta.xml.soap.SOAPMessage; +import static org.eclipse.daanse.xmla.client.soapmessage.Constants.SOAP_ACTION_DISCOVER; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaCatalogsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaColumnsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaProviderTypesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaSchemataResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaSourceTablesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaTablesInfoResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaTablesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverCsdlMetaDataResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverDataSourcesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverEnumeratorsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverKeywordsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverLiteralsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverPropertiesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverSchemaRowsetsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverXmlMetaDataResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaActionsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaCubesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaDimensionsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaFunctionsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaHierarchiesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaKpisResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaLevelsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMeasureGroupDimensionsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMeasureGroupsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMeasuresResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMembersResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaPropertiesResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaSetsResponseRow; +import static org.eclipse.daanse.xmla.client.soapmessage.DiscoverConsumers.createDiscoverDataSourcesRequestConsumer; + +import java.util.List; +import java.util.Optional; +import java.util.function.Consumer; import org.eclipse.daanse.xmla.api.RequestMetaData; -import org.eclipse.daanse.xmla.api.UserRolePrincipal; import org.eclipse.daanse.xmla.api.discover.DiscoverService; import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsRequest; import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsResponseRow; @@ -78,40 +109,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; -import java.util.Optional; -import java.util.function.Consumer; - -import static org.eclipse.daanse.xmla.client.soapmessage.Constants.SOAP_ACTION_DISCOVER; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaCatalogsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaColumnsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaProviderTypesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaSchemataResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaSourceTablesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaTablesInfoResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDbSchemaTablesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverDataSourcesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverEnumeratorsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverKeywordsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverLiteralsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverPropertiesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverSchemaRowsetsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverXmlMetaDataResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToDiscoverCsdlMetaDataResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaActionsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaCubesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaDimensionsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaFunctionsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaHierarchiesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaKpisResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaLevelsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMeasureGroupDimensionsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMeasureGroupsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMeasuresResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaMembersResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaPropertiesResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.Convertor.convertToMdSchemaSetsResponseRow; -import static org.eclipse.daanse.xmla.client.soapmessage.DiscoverConsumers.createDiscoverDataSourcesRequestConsumer; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; public class DiscoverServiceImpl implements DiscoverService { diff --git a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapClientException.java b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapClientException.java index f588473..04f7336 100644 --- a/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapClientException.java +++ b/client/soapmessage/src/main/java/org/eclipse/daanse/xmla/client/soapmessage/SoapClientException.java @@ -15,6 +15,7 @@ import jakarta.xml.soap.SOAPException; +@SuppressWarnings("serial") public class SoapClientException extends RuntimeException { public SoapClientException(String msg, SOAPException e) { diff --git a/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtilTest.java b/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtilTest.java index 7bd6794..c64a9b3 100644 --- a/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtilTest.java +++ b/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/SoapUtilTest.java @@ -13,10 +13,20 @@ */ package org.eclipse.daanse.xmla.client.soapmessage; -import jakarta.xml.soap.MessageFactory; -import jakarta.xml.soap.SOAPElement; -import jakarta.xml.soap.SOAPException; -import jakarta.xml.soap.SOAPMessage; +import static org.eclipse.daanse.xmla.client.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.client.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.client.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.client.soapmessage.Constants.NAME_LC; +import static org.eclipse.daanse.xmla.client.soapmessage.Constants.VALUE2; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.List; +import java.util.Optional; + import org.eclipse.daanse.xmla.api.engine.ImpersonationInfo; import org.eclipse.daanse.xmla.api.engine300.AttributeHierarchyProcessingState; import org.eclipse.daanse.xmla.api.engine300.CalculationPropertiesVisualizationProperties; @@ -29,140 +39,15 @@ import org.eclipse.daanse.xmla.api.engine300_300.Relationships; import org.eclipse.daanse.xmla.api.engine300_300.XEvent; import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; -import org.eclipse.daanse.xmla.api.xmla.AccessEnum; -import org.eclipse.daanse.xmla.api.xmla.Account; -import org.eclipse.daanse.xmla.api.xmla.Action; -import org.eclipse.daanse.xmla.api.xmla.Aggregation; -import org.eclipse.daanse.xmla.api.xmla.AggregationAttribute; -import org.eclipse.daanse.xmla.api.xmla.AggregationDesign; -import org.eclipse.daanse.xmla.api.xmla.AggregationDesignAttribute; -import org.eclipse.daanse.xmla.api.xmla.AggregationDesignDimension; -import org.eclipse.daanse.xmla.api.xmla.AggregationDimension; -import org.eclipse.daanse.xmla.api.xmla.AggregationInstance; -import org.eclipse.daanse.xmla.api.xmla.AggregationInstanceAttribute; -import org.eclipse.daanse.xmla.api.xmla.AggregationInstanceDimension; -import org.eclipse.daanse.xmla.api.xmla.AggregationInstanceMeasure; -import org.eclipse.daanse.xmla.api.xmla.AlgorithmParameter; -import org.eclipse.daanse.xmla.api.xmla.Alter; -import org.eclipse.daanse.xmla.api.xmla.AndOrType; -import org.eclipse.daanse.xmla.api.xmla.AndOrTypeEnum; -import org.eclipse.daanse.xmla.api.xmla.Annotation; -import org.eclipse.daanse.xmla.api.xmla.Assembly; -import org.eclipse.daanse.xmla.api.xmla.AttributePermission; -import org.eclipse.daanse.xmla.api.xmla.AttributeRelationship; -import org.eclipse.daanse.xmla.api.xmla.AttributeTranslation; -import org.eclipse.daanse.xmla.api.xmla.Binding; -import org.eclipse.daanse.xmla.api.xmla.BoolBinop; -import org.eclipse.daanse.xmla.api.xmla.CalculationProperty; -import org.eclipse.daanse.xmla.api.xmla.Cancel; -import org.eclipse.daanse.xmla.api.xmla.CellPermission; -import org.eclipse.daanse.xmla.api.xmla.ClearCache; -import org.eclipse.daanse.xmla.api.xmla.ColumnBinding; -import org.eclipse.daanse.xmla.api.xmla.Command; -import org.eclipse.daanse.xmla.api.xmla.Cube; -import org.eclipse.daanse.xmla.api.xmla.CubeAttribute; -import org.eclipse.daanse.xmla.api.xmla.CubeDimension; -import org.eclipse.daanse.xmla.api.xmla.CubeDimensionPermission; -import org.eclipse.daanse.xmla.api.xmla.CubeHierarchy; -import org.eclipse.daanse.xmla.api.xmla.CubePermission; -import org.eclipse.daanse.xmla.api.xmla.CubeStorageModeEnumType; -import org.eclipse.daanse.xmla.api.xmla.DataItem; -import org.eclipse.daanse.xmla.api.xmla.DataItemFormatEnum; -import org.eclipse.daanse.xmla.api.xmla.DataSource; -import org.eclipse.daanse.xmla.api.xmla.DataSourcePermission; -import org.eclipse.daanse.xmla.api.xmla.DataSourceView; -import org.eclipse.daanse.xmla.api.xmla.DataSourceViewBinding; -import org.eclipse.daanse.xmla.api.xmla.Database; -import org.eclipse.daanse.xmla.api.xmla.DatabasePermission; -import org.eclipse.daanse.xmla.api.xmla.Dimension; -import org.eclipse.daanse.xmla.api.xmla.DimensionAttribute; -import org.eclipse.daanse.xmla.api.xmla.DimensionAttributeTypeEnumType; -import org.eclipse.daanse.xmla.api.xmla.DimensionCurrentStorageModeEnumType; -import org.eclipse.daanse.xmla.api.xmla.DimensionPermission; -import org.eclipse.daanse.xmla.api.xmla.ErrorConfiguration; -import org.eclipse.daanse.xmla.api.xmla.Event; -import org.eclipse.daanse.xmla.api.xmla.EventColumnID; -import org.eclipse.daanse.xmla.api.xmla.EventSession; -import org.eclipse.daanse.xmla.api.xmla.EventType; -import org.eclipse.daanse.xmla.api.xmla.FoldingParameters; -import org.eclipse.daanse.xmla.api.xmla.Hierarchy; -import org.eclipse.daanse.xmla.api.xmla.IncrementalProcessingNotification; -import org.eclipse.daanse.xmla.api.xmla.InvalidXmlCharacterEnum; -import org.eclipse.daanse.xmla.api.xmla.Kpi; -import org.eclipse.daanse.xmla.api.xmla.Level; -import org.eclipse.daanse.xmla.api.xmla.MajorObject; -import org.eclipse.daanse.xmla.api.xmla.ManyToManyMeasureGroupDimension; -import org.eclipse.daanse.xmla.api.xmla.MdxScript; -import org.eclipse.daanse.xmla.api.xmla.Measure; -import org.eclipse.daanse.xmla.api.xmla.MeasureGroup; -import org.eclipse.daanse.xmla.api.xmla.MeasureGroupBinding; -import org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension; -import org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimensionBinding; -import org.eclipse.daanse.xmla.api.xmla.MeasureGroupStorageModeEnumType; -import org.eclipse.daanse.xmla.api.xmla.Member; -import org.eclipse.daanse.xmla.api.xmla.MiningModel; -import org.eclipse.daanse.xmla.api.xmla.MiningModelColumn; -import org.eclipse.daanse.xmla.api.xmla.MiningModelPermission; -import org.eclipse.daanse.xmla.api.xmla.MiningModelingFlag; -import org.eclipse.daanse.xmla.api.xmla.MiningStructure; -import org.eclipse.daanse.xmla.api.xmla.MiningStructureColumn; -import org.eclipse.daanse.xmla.api.xmla.MiningStructurePermission; -import org.eclipse.daanse.xmla.api.xmla.NotType; -import org.eclipse.daanse.xmla.api.xmla.NullProcessingEnum; -import org.eclipse.daanse.xmla.api.xmla.ObjectExpansion; -import org.eclipse.daanse.xmla.api.xmla.ObjectReference; -import org.eclipse.daanse.xmla.api.xmla.Partition; -import org.eclipse.daanse.xmla.api.xmla.PartitionCurrentStorageModeEnumType; -import org.eclipse.daanse.xmla.api.xmla.PartitionModes; -import org.eclipse.daanse.xmla.api.xmla.PartitionStorageModeEnumType; -import org.eclipse.daanse.xmla.api.xmla.Permission; -import org.eclipse.daanse.xmla.api.xmla.PersistenceEnum; -import org.eclipse.daanse.xmla.api.xmla.Perspective; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveAction; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveAttribute; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveCalculation; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveDimension; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveHierarchy; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveKpi; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveMeasure; -import org.eclipse.daanse.xmla.api.xmla.PerspectiveMeasureGroup; -import org.eclipse.daanse.xmla.api.xmla.ProactiveCaching; -import org.eclipse.daanse.xmla.api.xmla.ProactiveCachingBinding; -import org.eclipse.daanse.xmla.api.xmla.ProactiveCachingIncrementalProcessingBinding; -import org.eclipse.daanse.xmla.api.xmla.QueryBinding; -import org.eclipse.daanse.xmla.api.xmla.ReadDefinitionEnum; -import org.eclipse.daanse.xmla.api.xmla.ReadWritePermissionEnum; -import org.eclipse.daanse.xmla.api.xmla.RefreshPolicyEnum; -import org.eclipse.daanse.xmla.api.xmla.RetentionModes; -import org.eclipse.daanse.xmla.api.xmla.Role; -import org.eclipse.daanse.xmla.api.xmla.ScalarMiningStructureColumn; -import org.eclipse.daanse.xmla.api.xmla.Scope; -import org.eclipse.daanse.xmla.api.xmla.Server; -import org.eclipse.daanse.xmla.api.xmla.ServerProperty; -import org.eclipse.daanse.xmla.api.xmla.TabularBinding; -import org.eclipse.daanse.xmla.api.xmla.TargetTypeEnum; -import org.eclipse.daanse.xmla.api.xmla.Trace; -import org.eclipse.daanse.xmla.api.xmla.TraceFilter; -import org.eclipse.daanse.xmla.api.xmla.Translation; -import org.eclipse.daanse.xmla.api.xmla.TypeEnum; -import org.eclipse.daanse.xmla.api.xmla.UnknownMemberEnumType; +import org.eclipse.daanse.xmla.api.xmla.*; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.xmlunit.assertj3.XmlAssert; -import java.math.BigInteger; -import java.time.Duration; -import java.time.Instant; -import java.util.List; -import java.util.Optional; - -import static org.eclipse.daanse.xmla.client.soapmessage.Constants.DESCRIPTION; -import static org.eclipse.daanse.xmla.client.soapmessage.Constants.ID; -import static org.eclipse.daanse.xmla.client.soapmessage.Constants.NAME; -import static org.eclipse.daanse.xmla.client.soapmessage.Constants.NAME_LC; -import static org.eclipse.daanse.xmla.client.soapmessage.Constants.VALUE2; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPMessage; class SoapUtilTest { @@ -1089,10 +974,6 @@ private CalculationPropertiesVisualizationProperties createCalculationProperties return it; } - private Command createCommand() { - return createAlter(); - } - private Alter createAlter() { Alter it = mock(Alter.class); ObjectReference object = createObjectReference(); @@ -2007,7 +1888,7 @@ private NotType createNotType() { private AndOrType createAndOrType() { AndOrType andOrType = mock(AndOrType.class); - List l = List.of(AndOrTypeEnum.And); + List l = List.of(AndOrTypeEnum.And); when(andOrType.notOrOrOrAnd()).thenReturn(l); return andOrType; } @@ -2729,19 +2610,6 @@ private void checkAbstractProperties(XmlAssert xmlAssert, String p) { xmlAssert.valueByXPath(p + "/SortPropertiesPosition").isEqualTo("0"); } - private void checkCommandList(XmlAssert xmlAssert, String path) { - String p = new StringBuilder(path).append("/Commands").toString(); - xmlAssert.nodesByXPath(p).exist(); - checkCommand(xmlAssert, p); - } - - private void checkCommand(XmlAssert xmlAssert, String path) { - String p = new StringBuilder(path).append("/Command").toString(); - xmlAssert.nodesByXPath(p).exist(); - checkAlter(xmlAssert, p); - // maybe need check other commands - } - private void checkAlter(XmlAssert xmlAssert, String path) { String p = new StringBuilder(path).append("/Alter").toString(); xmlAssert.nodesByXPath(p).exist(); diff --git a/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientDiscoverTest.java b/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientDiscoverTest.java index 33204ba..8ba501a 100644 --- a/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientDiscoverTest.java +++ b/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientDiscoverTest.java @@ -13,11 +13,38 @@ */ package org.eclipse.daanse.xmla.client.soapmessage.integration; -import jakarta.xml.soap.SOAPMessage; -import jakarta.xml.ws.Provider; +import static org.assertj.core.api.Assertions.assertThat; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.ACTIONS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.CATALOGS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.CUBES; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.DATA_SOURCES; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.DIMENSIONS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.ENUMERARORS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.FUNCTIONS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.KEYWORDS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.LITERALS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.PROPERTIES; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.PROVIDER_TYPES; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.SCHEMAROWSETS; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.SCHEMATA; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.SOURCE_TABLES; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.TABLES; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.TABLES_INFO; +import static org.eclipse.daanse.xmla.client.soapmessage.Responses.XML_META_DATA; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.time.LocalDateTime; +import java.time.Month; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + //import org.eclipse.daanse.jakarta.xml.ws.api.whiteboard.annotations.RequireSoapWhiteboard; import org.eclipse.daanse.xmla.api.RequestMetaData; -import org.eclipse.daanse.xmla.api.UserRolePrincipal; import org.eclipse.daanse.xmla.api.common.enums.AccessEnum; import org.eclipse.daanse.xmla.api.common.enums.ActionTypeEnum; import org.eclipse.daanse.xmla.api.common.enums.AuthenticationModeEnum; @@ -191,35 +218,8 @@ import org.osgi.test.junit5.cm.ConfigurationExtension; import org.xmlunit.assertj3.XmlAssert; -import java.time.LocalDateTime; -import java.time.Month; -import java.util.List; -import java.util.Optional; -import java.util.concurrent.TimeUnit; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.ACTIONS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.CATALOGS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.CUBES; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.DATA_SOURCES; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.DIMENSIONS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.ENUMERARORS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.FUNCTIONS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.KEYWORDS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.LITERALS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.PROPERTIES; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.PROVIDER_TYPES; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.SCHEMAROWSETS; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.SCHEMATA; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.SOURCE_TABLES; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.TABLES; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.TABLES_INFO; -import static org.eclipse.daanse.xmla.client.soapmessage.Responses.XML_META_DATA; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.ws.Provider; //@RequireSoapWhiteboard @ExtendWith(ConfigurationExtension.class) @@ -587,7 +587,6 @@ void testSchemaRowSets() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testXmlMetaData() throws Exception { Provider provider = registerService(XML_META_DATA); PropertiesR properties = new PropertiesR(); @@ -710,6 +709,7 @@ void testXmlMetaData() throws Exception { .isEqualTo("SchemaData"); } + @SuppressWarnings("deprecation") @Test void testCatalogs() throws Exception { @@ -722,7 +722,6 @@ void testCatalogs() throws Exception { properties.addProperty(PropertyListElementDefinition.CONTENT, "SchemaData"); DbSchemaCatalogsRestrictionsR restrictions = new DbSchemaCatalogsRestrictionsR(Optional.of("CatalogName")); - DbSchemaCatalogsRequest dbSchemaCatalogsRequest = new DbSchemaCatalogsRequestR(properties, restrictions); List rows = client.discover().dbSchemaCatalogs(dbSchemaCatalogsRequest, metaData); @@ -775,7 +774,6 @@ void testCatalogs() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testColumns() throws Exception { Provider provider = registerService(Responses.COLUMNS); PropertiesR properties = new PropertiesR(); @@ -868,7 +866,6 @@ void testColumns() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testProviderTypes() throws Exception { Provider provider = registerService(PROVIDER_TYPES); PropertiesR properties = new PropertiesR(); @@ -1138,7 +1135,6 @@ void testTables() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testTablesInfo() throws Exception { Provider provider = registerService(TABLES_INFO); PropertiesR properties = new PropertiesR(); @@ -1213,7 +1209,6 @@ void testTablesInfo() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testActions() throws Exception { Provider provider = registerService(ACTIONS); PropertiesR properties = new PropertiesR(); @@ -1303,7 +1298,6 @@ void testActions() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testCubes() throws Exception { Provider provider = registerService(CUBES); PropertiesR properties = new PropertiesR(); @@ -1387,7 +1381,6 @@ void testCubes() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testDimensions() throws Exception { Provider provider = registerService(DIMENSIONS); PropertiesR properties = new PropertiesR(); @@ -1476,8 +1469,8 @@ void testDimensions() throws Exception { .isEqualTo("SchemaData"); } + @SuppressWarnings("deprecation") @Test - @SuppressWarnings("java:S5961") void testFunctions() throws Exception { Provider provider = registerService(FUNCTIONS); PropertiesR properties = new PropertiesR(); @@ -1557,7 +1550,6 @@ void testFunctions() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testHierarchies() throws Exception { Provider provider = registerService(Responses.HIERARCHIES); PropertiesR properties = new PropertiesR(); @@ -1663,7 +1655,6 @@ void testHierarchies() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testKpis() throws Exception { Provider provider = registerService(Responses.KPIS); PropertiesR properties = new PropertiesR(); @@ -1746,7 +1737,7 @@ void testKpis() throws Exception { } @Test - @SuppressWarnings("java:S5961") + void testLevels() throws Exception { Provider provider = registerService(Responses.LEVELS); PropertiesR properties = new PropertiesR(); @@ -1850,7 +1841,7 @@ void testLevels() throws Exception { } @Test - @SuppressWarnings("java:S5961") + void testMeasureGroupDimensions() throws Exception { Provider provider = registerService(Responses.MEASURE_GROUP_DIMENSIONS); PropertiesR properties = new PropertiesR(); @@ -1934,7 +1925,7 @@ void testMeasureGroupDimensions() throws Exception { } @Test - @SuppressWarnings("java:S5961") + void testMeasureGroups() throws Exception { Provider provider = registerService(Responses.MEASURE_GROUPS); PropertiesR properties = new PropertiesR(); @@ -2004,7 +1995,7 @@ void testMeasureGroups() throws Exception { } @Test - @SuppressWarnings("java:S5961") + @SuppressWarnings({ "deprecation" }) void testMeasures() throws Exception { Provider provider = registerService(Responses.MEASURES); PropertiesR properties = new PropertiesR(); @@ -2099,7 +2090,7 @@ void testMeasures() throws Exception { } @Test - @SuppressWarnings("java:S5961") + void testMembers() throws Exception { Provider provider = registerService(Responses.MEMBERS); PropertiesR properties = new PropertiesR(); @@ -2212,7 +2203,7 @@ void testMembers() throws Exception { } @Test - @SuppressWarnings("java:S5961") + void testMdProperties() throws Exception { Provider provider = registerService(Responses.MD_PROPERTIES); PropertiesR properties = new PropertiesR(); @@ -2325,7 +2316,7 @@ void testMdProperties() throws Exception { } @Test - @SuppressWarnings("java:S5961") + void testSets() throws Exception { Provider provider = registerService(Responses.SETS); PropertiesR properties = new PropertiesR(); diff --git a/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientExecuteTest.java b/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientExecuteTest.java index ec3db0c..5c26274 100644 --- a/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientExecuteTest.java +++ b/client/soapmessage/src/test/java/org/eclipse/daanse/xmla/client/soapmessage/integration/ClientExecuteTest.java @@ -128,7 +128,6 @@ void beforeEach() { } @Test - @SuppressWarnings("java:S5961") void testCancel() throws Exception { Provider provider = registerService(CANCEL); PropertiesR properties = new PropertiesR(); @@ -178,7 +177,6 @@ void testCancel() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testClearCache() throws Exception { Provider provider = registerService(CLEAR_CACHE); PropertiesR properties = new PropertiesR(); @@ -271,7 +269,6 @@ void testClearCache() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testStatement() throws Exception { Provider provider = registerService(STATEMENT); PropertiesR properties = new PropertiesR(); @@ -294,7 +291,7 @@ void testStatement() throws Exception { assertThat(mddataset.olapInfo()).isNotNull(); assertThat(mddataset.messages()).isNotNull(); checkOlapInfo(mddataset.olapInfo()); - Messages messages = mddataset.messages(); + mddataset.messages(); verify(provider, (times(1))).invoke(requestMessageCaptor.capture()); @@ -320,7 +317,6 @@ void testStatement() throws Exception { } @Test - @SuppressWarnings("java:S5961") void testAlter() throws Exception { Provider provider = registerService(ALTER); PropertiesR properties = new PropertiesR(); diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/AbstractProperties.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/AbstractProperties.java index e8dc3f8..5f7f944 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/AbstractProperties.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/AbstractProperties.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300; +import java.math.BigInteger; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlType; -import java.math.BigInteger; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AbstractProperties", propOrder = { "folderPosition", "contextualNameRule", "alignment", "isFolderDefault", "isRightToLeft", "sortDirection", "units", "width", "defaultDetailsPosition", diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/CalculationPropertiesVisualizationProperties.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/CalculationPropertiesVisualizationProperties.java index 80db21a..dc00095 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/CalculationPropertiesVisualizationProperties.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/CalculationPropertiesVisualizationProperties.java @@ -18,7 +18,6 @@ import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/DimensionAttributeVisualizationProperties.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/DimensionAttributeVisualizationProperties.java index 4c09579..36c5e65 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/DimensionAttributeVisualizationProperties.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300/DimensionAttributeVisualizationProperties.java @@ -19,7 +19,6 @@ import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300_300/RelationshipEndTranslation.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300_300/RelationshipEndTranslation.java index 70e4567..8d99f45 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300_300/RelationshipEndTranslation.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/engine300_300/RelationshipEndTranslation.java @@ -13,15 +13,15 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300_300; +import java.io.Serializable; + +import org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla.AbstractTranslation; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlType; -import java.io.Serializable; - -import org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla.AbstractTranslation; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "RelationshipEndTranslation", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AccessEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AccessEnum.java index beded45..1a13122 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AccessEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AccessEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Access") @XmlEnum public enum AccessEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ActionTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ActionTypeEnum.java index 496bf76..3870a90 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ActionTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ActionTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ActionType") @XmlEnum public enum ActionTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AuthenticationModeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AuthenticationModeEnum.java index 7449f23..8528d92 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AuthenticationModeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/AuthenticationModeEnum.java @@ -12,12 +12,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "AuthenticationMode") @XmlEnum public enum AuthenticationModeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CellTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CellTypeEnum.java index 0cf39d9..4b105c7 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CellTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CellTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "CellTypeEnum") @XmlEnum public enum CellTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ClientCacheRefreshPolicyEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ClientCacheRefreshPolicyEnum.java index 20bb010..e255945 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ClientCacheRefreshPolicyEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ClientCacheRefreshPolicyEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * A hint to the client applications about when their data caches, if any, SHOULD be refreshed * after a Refresh command changes the data on the server. diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnFlagsEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnFlagsEnum.java index 11a1db6..cc23ce2 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnFlagsEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnFlagsEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ColumnFlags") @XmlEnum public enum ColumnFlagsEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnOlapTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnOlapTypeEnum.java index c4d8618..26669fa 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnOlapTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ColumnOlapTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ColumnOlapType") @XmlEnum public enum ColumnOlapTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CoordinateTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CoordinateTypeEnum.java index b9a3dea..201e67a 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CoordinateTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CoordinateTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "CoordinateType") @XmlEnum public enum CoordinateTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeSourceEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeSourceEnum.java index 079e150..abca894 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeSourceEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeSourceEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ACubeSource") @XmlEnum public enum CubeSourceEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeTypeEnum.java index dd8a08e..76cf4fc 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CubeTypeEnum.java @@ -14,12 +14,12 @@ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ACubeType") @XmlEnum public enum CubeTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CustomRollupSettingEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CustomRollupSettingEnum.java index c2bbdcd..236c8b9 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CustomRollupSettingEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/CustomRollupSettingEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "CustomRollupSetting") @XmlEnum public enum CustomRollupSettingEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionCardinalityEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionCardinalityEnum.java index cc92e05..a345f3b 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionCardinalityEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionCardinalityEnum.java @@ -12,12 +12,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The number of instances a dimension member can have for a single instance of a measure group * measure diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionTypeEnum.java index 561dd57..ebb027a 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "DimensionType") @XmlEnum public enum DimensionTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionUniqueSettingEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionUniqueSettingEnum.java index 305c320..1e42bc9 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionUniqueSettingEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DimensionUniqueSettingEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "DimensionUniqueSetting") @XmlEnum public enum DimensionUniqueSettingEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DirectQueryPushableEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DirectQueryPushableEnum.java index f2f0a81..3382dbd 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DirectQueryPushableEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/DirectQueryPushableEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "DirectQueryPushable") @XmlEnum public enum DirectQueryPushableEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/GroupingBehaviorEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/GroupingBehaviorEnum.java index a30ed5b..da7e82a 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/GroupingBehaviorEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/GroupingBehaviorEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "GroupingBehavior") @XmlEnum public enum GroupingBehaviorEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/HierarchyOriginEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/HierarchyOriginEnum.java index 97e4eff..f93ee30 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/HierarchyOriginEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/HierarchyOriginEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "HierarchyOrigin") @XmlEnum public enum HierarchyOriginEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InstanceSelectionEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InstanceSelectionEnum.java index b4bea4f..dbc6778 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InstanceSelectionEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InstanceSelectionEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "InstanceSelectionEnum") @XmlEnum public enum InstanceSelectionEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InterfaceNameEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InterfaceNameEnum.java index a68197a..677180e 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InterfaceNameEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InterfaceNameEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "InterfaceName") @XmlEnum public enum InterfaceNameEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InvocationEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InvocationEnum.java index 5d27c11..f5153a1 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InvocationEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/InvocationEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Invocation") @XmlEnum public enum InvocationEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelDbTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelDbTypeEnum.java index 741541b..e94cab0 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelDbTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelDbTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "LevelDbType") @XmlEnum public enum LevelDbTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelOriginEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelOriginEnum.java index 191f082..c27efa0 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelOriginEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelOriginEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "LevelOrigin") @XmlEnum public enum LevelOriginEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelTypeEnum.java index 7edea27..ef6d0e2 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The type of the level */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelUniqueSettingsEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelUniqueSettingsEnum.java index dc4fa78..e4fc9e9 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelUniqueSettingsEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LevelUniqueSettingsEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "LevelUniqueSettings") @XmlEnum public enum LevelUniqueSettingsEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LiteralNameEnumValueEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LiteralNameEnumValueEnum.java index 815fd42..ed03133 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LiteralNameEnumValueEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/LiteralNameEnumValueEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "LiteralNameEnumValue") @XmlEnum public enum LiteralNameEnumValueEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MeasureAggregatorEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MeasureAggregatorEnum.java index ae08ede..2d0989b 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MeasureAggregatorEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MeasureAggregatorEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * An enumeration that identifies how a measure was derived. This enumeration can be one of the * following values: diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MemberTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MemberTypeEnum.java index b801370..56963ab 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MemberTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/MemberTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The type of the member */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ObjectExpansionEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ObjectExpansionEnum.java index 6d980b4..d8e2afe 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ObjectExpansionEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ObjectExpansionEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ObjectExpansion") @XmlEnum public enum ObjectExpansionEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/OriginEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/OriginEnum.java index 8bff60c..a693f2d 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/OriginEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/OriginEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Origin") @XmlEnum public enum OriginEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PreferredQueryPatternsEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PreferredQueryPatternsEnum.java index 0d91eeb..c0d8842 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PreferredQueryPatternsEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PreferredQueryPatternsEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "PreferredQueryPatterns") @XmlEnum public enum PreferredQueryPatternsEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyCardinalityEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyCardinalityEnum.java index 5cba3e0..d176a19 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyCardinalityEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyCardinalityEnum.java @@ -12,12 +12,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The cardinality of the property. Possible values include the following strings: */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyContentTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyContentTypeEnum.java index 1f328cc..d21ac60 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyContentTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyContentTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The content type of the property. Built-in values are values listed as follows. This enumeration * is extensible and additional values can be added by users. diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyOriginEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyOriginEnum.java index 3c8d094..1cdc8b2 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyOriginEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyOriginEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * A bitmask that specifies the type of hierarchy to which the property applies, as follows: */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyTypeEnum.java index 9384860..2a0072d 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/PropertyTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * A bitmask that specifies the type of the property, as follows: */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ProviderTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ProviderTypeEnum.java index c010265..126760d 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ProviderTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ProviderTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "ProviderTyp") @XmlEnum public enum ProviderTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ScopeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ScopeEnum.java index b4db337..8cd4b46 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ScopeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/ScopeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The scope of the member. The member can be a session-calculated member or a global-calculated * member. The column returns NULL for non- calculated members. This column can have one of the diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SearchableEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SearchableEnum.java index 718341f..96cc713 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SearchableEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SearchableEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Searchable") @XmlEnum public enum SearchableEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SetEvaluationContextEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SetEvaluationContextEnum.java index 722564a..00718be 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SetEvaluationContextEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/SetEvaluationContextEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * The context for the set. The set can be static or dynamic. */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureEnum.java index 28d799f..491a935 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Structure") @XmlEnum public enum StructureEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureTypeEnum.java index 3ffa2c7..7fb6684 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/StructureTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "StructureType") @XmlEnum public enum StructureTypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TableTypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TableTypeEnum.java index 5316d33..e67fdc8 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TableTypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TableTypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * Table type. One of the following or a provider-specific */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TreeOpEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TreeOpEnum.java index 00a9d6f..bcea0af 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TreeOpEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TreeOpEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - /** * Applies only to a single member: */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TypeEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TypeEnum.java index 46afca8..f628f80 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TypeEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/TypeEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Type") @XmlEnum public enum TypeEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/VisibilityEnum.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/VisibilityEnum.java index 68c65ed..d6f2fd7 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/VisibilityEnum.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/enums/VisibilityEnum.java @@ -13,12 +13,12 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums; +import java.util.stream.Stream; + import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; -import java.util.stream.Stream; - @XmlType(name = "Visibility") @XmlEnum public enum VisibilityEnum { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/msxmla/NormTupleSet.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/msxmla/NormTupleSet.java index 1fc51e5..65efc56 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/msxmla/NormTupleSet.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/msxmla/NormTupleSet.java @@ -18,10 +18,10 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla_mddataset.TupleType; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractAggregation.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractAggregation.java index 0d6ef1e..4848656 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractAggregation.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractAggregation.java @@ -13,6 +13,8 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; @@ -20,8 +22,6 @@ import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AbstractAggregation", propOrder = {}) @XmlSeeAlso({ Aggregation.class, AggregationInstance.class }) diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractTranslation.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractTranslation.java index 0913b63..789d357 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractTranslation.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AbstractTranslation.java @@ -12,6 +12,10 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + +import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300_300.RelationshipEndTranslation; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; @@ -20,10 +24,6 @@ import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - -import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300_300.RelationshipEndTranslation; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AbstractTranslation", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Action.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Action.java index b777f81..4258dab 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Action.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Action.java @@ -13,6 +13,8 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; @@ -20,8 +22,6 @@ import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Action", propOrder = { "name", "id", "caption", "captionIsMdx", "translations", "targetType", "target", "condition", "type", "invocation", "application", "description", "annotations" }) diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationAttribute.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationAttribute.java index a95ecd7..fee22b9 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationAttribute.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationAttribute.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AggregationAttribute", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationDesign.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationDesign.java index 0218ed1..eae337b 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationDesign.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/AggregationDesign.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AggregationDesign", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CalculationProperty.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CalculationProperty.java index 72de40f..b625a34 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CalculationProperty.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CalculationProperty.java @@ -18,10 +18,10 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300.CalculationPropertiesVisualizationProperties; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeAttribute.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeAttribute.java index b87bb71..af78df3 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeAttribute.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeAttribute.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CubeAttribute", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeHierarchy.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeHierarchy.java index eae83a0..a500608 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeHierarchy.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/CubeHierarchy.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CubeHierarchy", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataItem.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataItem.java index 4d4191d..6e698ae 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataItem.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataItem.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DataItem", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataSource.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataSource.java index ab13b25..728688f 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataSource.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DataSource.java @@ -20,10 +20,10 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine.ImpersonationInfo; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlType; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Database.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Database.java index dbe95a4..dc29fd6 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Database.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Database.java @@ -20,10 +20,10 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine.ImpersonationInfo; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlSchemaType; import jakarta.xml.bind.annotation.XmlType; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Dimension.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Dimension.java index 18caad2..685a304 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Dimension.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Dimension.java @@ -20,11 +20,11 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300_300.Relationships; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlSchemaType; import jakarta.xml.bind.annotation.XmlType; import jakarta.xml.bind.annotation.XmlValue; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DimensionAttribute.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DimensionAttribute.java index eb2a584..2eec285 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DimensionAttribute.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/DimensionAttribute.java @@ -19,11 +19,11 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300.AttributeHierarchyProcessingStateXmlEnum; import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300.DimensionAttributeVisualizationProperties; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAttribute; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlSchemaType; import jakarta.xml.bind.annotation.XmlType; import jakarta.xml.bind.annotation.XmlValue; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/EventType.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/EventType.java index 139b9ae..5dcadea 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/EventType.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/EventType.java @@ -17,10 +17,10 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300_300.XEvent; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlRootElement; import jakarta.xml.bind.annotation.XmlType; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Hierarchy.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Hierarchy.java index 6b8ca3e..a5d98ba 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Hierarchy.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Hierarchy.java @@ -17,10 +17,10 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.engine300.HierarchyVisualizationProperties; -import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MdxScript.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MdxScript.java index 152e99d..98f7fdd 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MdxScript.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MdxScript.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MdxScript", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MeasureGroupDimension.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MeasureGroupDimension.java index 96c24aa..ca0f7a6 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MeasureGroupDimension.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/MeasureGroupDimension.java @@ -13,6 +13,8 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; @@ -20,8 +22,6 @@ import jakarta.xml.bind.annotation.XmlSeeAlso; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MeasureGroupDimension", propOrder = { "cubeDimensionID", "annotations", "source" }) @XmlSeeAlso({ ManyToManyMeasureGroupDimension.class, RegularMeasureGroupDimension.class, diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveAttribute.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveAttribute.java index e791606..47bc484 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveAttribute.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveAttribute.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PerspectiveAttribute", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveCalculation.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveCalculation.java index 2caa7f9..ceff3b2 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveCalculation.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveCalculation.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PerspectiveCalculation", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveHierarchy.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveHierarchy.java index 8049bd2..d57e048 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveHierarchy.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/PerspectiveHierarchy.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PerspectiveHierarchy", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Role.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Role.java index e2fc87b..e37e5f3 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Role.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Role.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Role", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Server.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Server.java index 61e2ac7..63c91b4 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Server.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla/Server.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla; +import java.util.List; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlElementWrapper; import jakarta.xml.bind.annotation.XmlType; -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Server", propOrder = { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_exception/Exception.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_exception/Exception.java index 6c2c85f..d08282d 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_exception/Exception.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_exception/Exception.java @@ -19,7 +19,6 @@ import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlType; -@SuppressWarnings("java:S2166") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Exception") public class Exception implements Serializable { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/CellType.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/CellType.java index 4567731..c7b7d84 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/CellType.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/CellType.java @@ -13,6 +13,11 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla_mddataset; +import java.util.List; + +import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.CellTypeEnum; +import org.w3c.dom.Element; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAnyElement; @@ -22,11 +27,6 @@ import jakarta.xml.bind.annotation.XmlSchemaType; import jakarta.xml.bind.annotation.XmlType; -import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.CellTypeEnum; -import org.w3c.dom.Element; - -import java.util.List; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "CellType", propOrder = { "value", "any" }) public class CellType { @@ -70,7 +70,6 @@ public static class Value { @XmlElement(name = "Error") protected List error; - @SuppressWarnings("java:S1700") @XmlMixed protected List value; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/OlapInfoCube.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/OlapInfoCube.java index 6d215e5..b86320d 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/OlapInfoCube.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_mddataset/OlapInfoCube.java @@ -15,14 +15,11 @@ import java.time.LocalDateTime; -import javax.xml.datatype.XMLGregorianCalendar; - import org.eclipse.daanse.xmla.model.jakarta.xml.bind.adapters.LocalDateTimeAdapter; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlSchemaType; import jakarta.xml.bind.annotation.XmlType; import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/ParameterInfoXml.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/ParameterInfoXml.java index 3f33a5e..65b6d58 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/ParameterInfoXml.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/ParameterInfoXml.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla_rowset; +import java.io.Serializable; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlTransient; import jakarta.xml.bind.annotation.XmlType; -import java.io.Serializable; - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PARAMETERINFO") public class ParameterInfoXml implements Serializable { diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/StatementRowXml.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/StatementRowXml.java index 43d80e6..df7df5e 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/StatementRowXml.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/StatementRowXml.java @@ -13,13 +13,14 @@ */ package org.eclipse.daanse.xmla.model.jakarta.xml.bind.xmla_rowset; +import java.util.List; + +import org.w3c.dom.Element; + import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlAnyElement; import jakarta.xml.bind.annotation.XmlType; -import org.w3c.dom.Element; - -import java.util.List; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "StatementRowXml") diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/discover/DiscoverLiteralsResponseRowXml.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/discover/DiscoverLiteralsResponseRowXml.java index d12ad41..5b37fdb 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/discover/DiscoverLiteralsResponseRowXml.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/discover/DiscoverLiteralsResponseRowXml.java @@ -27,6 +27,8 @@ @XmlType(name = "DiscoverLiteralsResponseRowXml") public class DiscoverLiteralsResponseRowXml extends Row implements Serializable { + private static final long serialVersionUID = 1L; + /** * The name of the literal. */ diff --git a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/mdschema/MdSchemaPropertiesResponseRowXml.java b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/mdschema/MdSchemaPropertiesResponseRowXml.java index 210202a..b718545 100644 --- a/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/mdschema/MdSchemaPropertiesResponseRowXml.java +++ b/model.jakarta.xml.bind.xmla/src/main/java/org/eclipse/daanse/xmla/model/jakarta/xml/bind/xmla_rowset/mdschema/MdSchemaPropertiesResponseRowXml.java @@ -20,13 +20,13 @@ import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.PropertyContentTypeEnum; import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.PropertyOriginEnum; import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.PropertyTypeEnum; +import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.VisibilityEnum; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; import jakarta.xml.bind.annotation.XmlElement; import jakarta.xml.bind.annotation.XmlTransient; import jakarta.xml.bind.annotation.XmlType; -import org.eclipse.daanse.xmla.model.jakarta.xml.bind.enums.VisibilityEnum; /** * This schema rowset describes the properties of members and cell properties. diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/PropertiesR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/PropertiesR.java index cd0f65e..a7d1543 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/PropertiesR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/PropertiesR.java @@ -282,28 +282,13 @@ public class PropertiesR implements Properties { protected Optional advancedFlag = Optional.of(false); public void addProperty(PropertyListElementDefinition property, String value) { - switch (property) { - case CONTENT: { - content = Optional.of(Content.fromValue(value)); - } - break; - case DATA_SOURCE_INFO: { - dataSourceInfo = Optional.of(value); + case CONTENT -> content = Optional.of(Content.fromValue(value)); + case DATA_SOURCE_INFO -> dataSourceInfo = Optional.of(value); + case FORMAT -> format = Optional.of(Format.fromValue(value)); + case LOCALE_IDENTIFIER -> localeIdentifier = Optional.of(Integer.valueOf(value)); + default -> { } } - break; - case FORMAT: { - format = Optional.of(Format.fromValue(value)); - } - break; - case LOCALE_IDENTIFIER: { - localeIdentifier = Optional.of(Integer.valueOf(value)); - } - break; - default: - break; - } - } public Optional applicationContext() { diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/discover/properties/DiscoverPropertiesRestrictionsR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/discover/properties/DiscoverPropertiesRestrictionsR.java index fe653ce..b79efa8 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/discover/properties/DiscoverPropertiesRestrictionsR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/discover/properties/DiscoverPropertiesRestrictionsR.java @@ -14,7 +14,6 @@ package org.eclipse.daanse.xmla.model.record.discover.discover.properties; import java.util.List; -import java.util.Optional; import org.eclipse.daanse.xmla.api.discover.discover.properties.DiscoverPropertiesRestrictions; diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/mdschema/measures/MdSchemaMeasuresResponseRowR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/mdschema/measures/MdSchemaMeasuresResponseRowR.java index 14bb6d6..ebe391b 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/mdschema/measures/MdSchemaMeasuresResponseRowR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/discover/mdschema/measures/MdSchemaMeasuresResponseRowR.java @@ -13,14 +13,14 @@ */ package org.eclipse.daanse.xmla.model.record.discover.mdschema.measures; +import java.util.Optional; + import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; import org.eclipse.daanse.xmla.api.common.enums.LevelDbTypeEnum; import org.eclipse.daanse.xmla.api.common.enums.MeasureAggregatorEnum; import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; import org.eclipse.daanse.xmla.api.discover.mdschema.measures.MdSchemaMeasuresResponseRow; -import java.util.Optional; - public record MdSchemaMeasuresResponseRowR(Optional catalogName, Optional schemaName, Optional cubeName, Optional measureName, Optional measureUniqueName, Optional measureCaption, Optional measureGuid, diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetR.java index 3e3632c..0acdd4a 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetR.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.model.record.mddataset; +import java.util.List; + import org.eclipse.daanse.xmla.api.mddataset.RowSet; import org.eclipse.daanse.xmla.api.mddataset.RowSetRow; -import java.util.List; - public record RowSetR(List rowSetRows) implements RowSet { } diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowItemR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowItemR.java index 16691b6..58e6482 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowItemR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowItemR.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.model.record.mddataset; +import java.util.Optional; + import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; import org.eclipse.daanse.xmla.api.mddataset.RowSetRowItem; -import java.util.Optional; - public record RowSetRowItemR(String tagName, String fieldName, String value, Optional type) implements RowSetRowItem { public RowSetRowItemR(String tagName, String value, Optional type) { diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowR.java index 661ec2d..93536bf 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/RowSetRowR.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.model.record.mddataset; +import java.util.List; + import org.eclipse.daanse.xmla.api.mddataset.RowSetRow; import org.eclipse.daanse.xmla.api.mddataset.RowSetRowItem; -import java.util.List; - public record RowSetRowR(List rowSetRowItem) implements RowSetRow { } diff --git a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/TupleTypeR.java b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/TupleTypeR.java index 1213845..eccfe01 100644 --- a/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/TupleTypeR.java +++ b/model.record/src/main/java/org/eclipse/daanse/xmla/model/record/mddataset/TupleTypeR.java @@ -13,11 +13,11 @@ */ package org.eclipse.daanse.xmla.model.record.mddataset; +import java.util.List; + import org.eclipse.daanse.xmla.api.mddataset.MemberType; import org.eclipse.daanse.xmla.api.mddataset.TupleType; -import java.util.List; - public record TupleTypeR(List member) implements TupleType { } diff --git a/pom.xml b/pom.xml index 3422c29..090cefa 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ org.eclipse.daanse org.eclipse.daanse.pom.parent - 0.0.5 + 0.0.6 org.eclipse.daanse.xmla ${revision} @@ -158,9 +158,8 @@ org.apache.felix org.apache.felix.http.jetty12 - 1.0.2 + 1.1.6 runtime - light org.osgi @@ -192,14 +191,6 @@ 1.2.4 runtime - - org.apache.aries.spifly - - org.apache.aries.spifly.dynamic.framework.extension - - ${aries.spifly.version} - runtime - biz.aQute biz.aQute.api.scheduler diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Constants.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Constants.java index efddd63..89e36c9 100644 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Constants.java +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Constants.java @@ -14,6 +14,22 @@ import javax.xml.namespace.QName; +/** + * Constants for XMLA SOAP message processing. + * + *

+ * This class contains shared constants used throughout the soapmessage adapter + * module. For package-specific constants, use: + *

    + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants} + * - Discover rowset constants (ROWSET, ROW)
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteConstants} + * - Execute response constants (MDDATASET, ENGINE, ENGINE200, EMPTY)
  • + *
+ * + * @see NamespaceConstants + * @see XmlaElementConstants + */ public class Constants { private Constants() { @@ -22,7 +38,7 @@ private Constants() { // XMLA - static class MSXMLA { + public static class MSXMLA { public static final String PREFIX = "msxmla"; public static final String NS_URN = "urn:schemas-microsoft-com:xml-analysis"; @@ -42,837 +58,12 @@ static class MSXMLA { } - ///// - static class EMPTY { - - public static final String PREFIX = "empty"; - public static final String NS_URN = "urn:schemas-microsoft-com:xml-analysis:empty"; - public static final QName QN_ROOT = new QName(NS_URN, "root", EMPTY.PREFIX); - } - - ///// - static class ROWSET { - - public static final String PREFIX = ""; - public static final String NS_URN = "urn:schemas-microsoft-com:xml-analysis:rowset"; - public static final QName QN_ROOT = new QName(ROWSET.NS_URN, "root", ""); - public static final QName QN_ROW = new QName(ROWSET.NS_URN, "row", ROWSET.PREFIX); - - static class ROW_PROPERTY { - public static final String CATALOG_NAME = "CATALOG_NAME"; - public static final QName QN_CATALOG_NAME = new QName(ROWSET.NS_URN, CATALOG_NAME, ROWSET.PREFIX); - - - public static final String SCHEMA_NAME = "SCHEMA_NAME"; - public static final QName QN_SCHEMA_NAME = new QName(ROWSET.NS_URN, SCHEMA_NAME, ROWSET.PREFIX); - - public static final String SCHEMA_NAME_LC = "SchemaName"; - public static final QName QN_SCHEMA_NAME_LC = new QName(ROWSET.NS_URN, SCHEMA_NAME_LC, ROWSET.PREFIX); - - public static final String CUBE_NAME = "CUBE_NAME"; - public static final QName QN_CUBE_NAME = new QName(ROWSET.NS_URN, CUBE_NAME, ROWSET.PREFIX); - - public static final String ACTION_NAME = "ACTION_NAME"; - public static final QName QN_ACTION_NAME = new QName(ROWSET.NS_URN, ACTION_NAME, ROWSET.PREFIX); - - public static final String ACTION_TYPE = "ACTION_TYPE"; - public static final QName QN_ACTION_TYPE = new QName(ROWSET.NS_URN, ACTION_TYPE, ROWSET.PREFIX); - - public static final String COORDINATE = "COORDINATE"; - public static final QName QN_COORDINATE = new QName(ROWSET.NS_URN, COORDINATE, ROWSET.PREFIX); - - public static final String COORDINATE_TYPE = "COORDINATE_TYPE"; - public static final QName QN_COORDINATE_TYPE = new QName(ROWSET.NS_URN, COORDINATE_TYPE, ROWSET.PREFIX); - - public static final String ACTION_CAPTION = "ACTION_CAPTION"; - public static final QName QN_ACTION_CAPTION = new QName(ROWSET.NS_URN, ACTION_CAPTION, ROWSET.PREFIX); - - public static final String DESCRIPTION = "DESCRIPTION"; - public static final QName QN_DESCRIPTION = new QName(ROWSET.NS_URN, DESCRIPTION, ROWSET.PREFIX); - - public static final String DESCRIPTION_LC = "Description"; - public static final QName QN_DESCRIPTION_LC = new QName(ROWSET.NS_URN, DESCRIPTION_LC, ROWSET.PREFIX); - - public static final String CONTENT = "CONTENT"; - public static final QName QN_CONTENT = new QName(ROWSET.NS_URN, CONTENT, ROWSET.PREFIX); - - public static final String APPLICATION = "APPLICATION"; - public static final QName QN_APPLICATION = new QName(ROWSET.NS_URN, APPLICATION, ROWSET.PREFIX); - - public static final String INVOCATION = "INVOCATION"; - public static final QName QN_INVOCATION = new QName(ROWSET.NS_URN, INVOCATION, ROWSET.PREFIX); - - public static final String ENUM_NAME = "EnumName"; - public static final QName QN_ENUM_NAME = new QName(ROWSET.NS_URN, ENUM_NAME, ROWSET.PREFIX); - - public static final String ENUM_DESCRIPTION = "EnumDescription"; - public static final QName QN_ENUM_DESCRIPTION = new QName(ROWSET.NS_URN, ENUM_DESCRIPTION, ROWSET.PREFIX); - - public static final String ENUM_TYPE = "EnumType"; - public static final QName QN_ENUM_TYPE = new QName(ROWSET.NS_URN, ENUM_TYPE, ROWSET.PREFIX); - - public static final String ELEMENT_NAME = "ElementName"; - public static final QName QN_ELEMENT_NAME = new QName(ROWSET.NS_URN, ELEMENT_NAME, ROWSET.PREFIX); - - public static final String ELEMENT_DESCRIPTION = "ElementDescription"; - public static final QName QN_ELEMENT_DESCRIPTION = new QName(ROWSET.NS_URN, ELEMENT_DESCRIPTION, ROWSET.PREFIX); - - public static final String ELEMENT_VALUE = "ElementValue"; - public static final QName QN_ELEMENT_VALUE = new QName(ROWSET.NS_URN, ELEMENT_VALUE, ROWSET.PREFIX); - - public static final String SCHEMA_GUID = "SchemaGuid"; - public static final QName QN_SCHEMA_GUID = new QName(ROWSET.NS_URN, SCHEMA_GUID, ROWSET.PREFIX); - - public static final String RESTRICTIONS_MASK = "RestrictionsMask"; - public static final QName QN_RESTRICTIONS_MASK = new QName(ROWSET.NS_URN, RESTRICTIONS_MASK, ROWSET.PREFIX); - - public static final String ROLES = "ROLES"; - public static final QName QN_ROLES = new QName(ROWSET.NS_URN, ROLES, ROWSET.PREFIX); - - public static final String DATE_MODIFIED = "DATE_MODIFIED"; - public static final QName QN_DATE_MODIFIED = new QName(ROWSET.NS_URN, DATE_MODIFIED, ROWSET.PREFIX); - - public static final String COMPATIBILITY_LEVEL = "COMPATIBILITY_LEVEL"; - public static final QName QN_COMPATIBILITY_LEVEL = new QName(ROWSET.NS_URN, COMPATIBILITY_LEVEL, ROWSET.PREFIX); - - public static final String TYPE = "TYPE"; - public static final QName QN_TYPE = new QName(ROWSET.NS_URN, TYPE, ROWSET.PREFIX); - - public static final String VERSION = "VERSION"; - public static final QName QN_VERSION = new QName(ROWSET.NS_URN, VERSION, ROWSET.PREFIX); - - public static final String DATABASE_ID = "DATABASE_ID"; - public static final QName QN_DATABASE_ID = new QName(ROWSET.NS_URN, DATABASE_ID, ROWSET.PREFIX); - - public static final String DATE_QUERIED = "DATE_QUERIED"; - public static final QName QN_DATE_QUERIED = new QName(ROWSET.NS_URN, DATE_QUERIED, ROWSET.PREFIX); - - public static final String CURRENTLY_USED = "CURRENTLY_USED"; - public static final QName QN_CURRENTLY_USED = new QName(ROWSET.NS_URN, CURRENTLY_USED, ROWSET.PREFIX); - - public static final String POPULARITY = "POPULARITY"; - public static final QName QN_POPULARITY = new QName(ROWSET.NS_URN, POPULARITY, ROWSET.PREFIX); - - public static final String WEIGHTEDPOPULARITY = "WEIGHTEDPOPULARITY"; - public static final QName QN_WEIGHTEDPOPULARITY = new QName(ROWSET.NS_URN, WEIGHTEDPOPULARITY, ROWSET.PREFIX); - - public static final String CLIENTCACHEREFRESHPOLICY = "CLIENTCACHEREFRESHPOLICY"; - public static final QName QN_CLIENTCACHEREFRESHPOLICY = new QName(ROWSET.NS_URN, CLIENTCACHEREFRESHPOLICY, ROWSET.PREFIX); - - public static final String DATA_SOURCE_NAME = "DataSourceName"; - public static final QName QN_DATA_SOURCE_NAME = new QName(ROWSET.NS_URN, DATA_SOURCE_NAME, ROWSET.PREFIX); - - public static final String DATA_SOURCE_DESCRIPTION = "DataSourceDescription"; - public static final QName QN_DATA_SOURCE_DESCRIPTION = new QName(ROWSET.NS_URN, DATA_SOURCE_DESCRIPTION, ROWSET.PREFIX); - - public static final String URL = "URL"; - public static final QName QN_URL = new QName(ROWSET.NS_URN, URL, ROWSET.PREFIX); - - public static final String DATA_SOURCE_INFO = "DataSourceInfo"; - public static final QName QN_DATA_SOURCE_INFO = new QName(ROWSET.NS_URN, DATA_SOURCE_INFO, ROWSET.PREFIX); - - public static final String PROVIDER_NAME = "ProviderName"; - public static final QName QN_PROVIDER_NAME = new QName(ROWSET.NS_URN, PROVIDER_NAME, ROWSET.PREFIX); - - public static final String PROVIDER_TYPE = "ProviderType"; - public static final QName QN_PROVIDER_TYPE = new QName(ROWSET.NS_URN, PROVIDER_TYPE, ROWSET.PREFIX); - - public static final String AUTHENTICATION_MODE = "AuthenticationMode"; - public static final QName QN_AUTHENTICATION_MODE = new QName(ROWSET.NS_URN, AUTHENTICATION_MODE, ROWSET.PREFIX); - - public static final String META_DATA = "METADATA"; - public static final QName QN_META_DATA = new QName(ROWSET.NS_URN, META_DATA, "xars"); - - public static final String SCHEMA_OWNER = "SCHEMA_OWNER"; - public static final QName QN_SCHEMA_OWNER = new QName(ROWSET.NS_URN, SCHEMA_OWNER, ROWSET.PREFIX); - - public static final String TABLE_CATALOG = "TABLE_CATALOG"; - public static final QName QN_TABLE_CATALOG = new QName(ROWSET.NS_URN, TABLE_CATALOG, ROWSET.PREFIX); - - public static final String TABLE_SCHEMA = "TABLE_SCHEMA"; - public static final QName QN_TABLE_SCHEMA = new QName(ROWSET.NS_URN, TABLE_SCHEMA, ROWSET.PREFIX); - - public static final String TABLE_NAME = "TABLE_NAME"; - public static final QName QN_TABLE_NAME = new QName(ROWSET.NS_URN, TABLE_NAME, ROWSET.PREFIX); - - public static final String TABLE_TYPE = "TABLE_TYPE"; - public static final QName QN_TABLE_TYPE = new QName(ROWSET.NS_URN, TABLE_TYPE, ROWSET.PREFIX); - - public static final String TABLE_GUID = "TABLE_GUID"; - public static final QName QN_TABLE_GUID = new QName(ROWSET.NS_URN, TABLE_GUID, ROWSET.PREFIX); - - public static final String TABLE_PROP_ID = "TABLE_PROP_ID"; - public static final QName QN_TABLE_PROP_ID = new QName(ROWSET.NS_URN, TABLE_PROP_ID, ROWSET.PREFIX); - - public static final String DATE_CREATED = "DATE_CREATED"; - public static final QName QN_DATE_CREATED = new QName(ROWSET.NS_URN, DATE_CREATED, ROWSET.PREFIX); - - public static final String LITERAL_NAME = "LiteralName"; - public static final QName QN_LITERAL_NAME = new QName(ROWSET.NS_URN, LITERAL_NAME, ROWSET.PREFIX); - - public static final String LITERAL_VALUE = "LiteralValue"; - public static final QName QN_LITERAL_VALUE = new QName(ROWSET.NS_URN, LITERAL_VALUE, ROWSET.PREFIX); - - public static final String LITERAL_INVALID_CHARS = "LiteralInvalidChars"; - public static final QName QN_LITERAL_INVALID_CHARS = new QName(ROWSET.NS_URN, LITERAL_INVALID_CHARS, ROWSET.PREFIX); - - public static final String LITERAL_INVALID_STARTING_CHARS = "LiteralInvalidStartingChars"; - public static final QName QN_LITERAL_INVALID_STARTING_CHARS = new QName(ROWSET.NS_URN, LITERAL_INVALID_STARTING_CHARS, ROWSET.PREFIX); - - public static final String LITERAL_MAX_LENGTH = "LiteralMaxLength"; - public static final QName QN_LITERAL_MAX_LENGTH = new QName(ROWSET.NS_URN, LITERAL_MAX_LENGTH, ROWSET.PREFIX); - - public static final String LITERAL_NAME_ENUM_VALUE = "LiteralNameEnumValue"; - public static final QName QN_LITERAL_NAME_ENUM_VALUE = new QName(ROWSET.NS_URN, LITERAL_NAME_ENUM_VALUE, ROWSET.PREFIX); - - public static final String KEYWORD = "Keyword"; - public static final QName QN_KEYWORD = new QName(ROWSET.NS_URN, KEYWORD, ROWSET.PREFIX); - - public static final String COLUMN_NAME = "COLUMN_NAME"; - public static final QName QN_COLUMN_NAME = new QName(ROWSET.NS_URN, COLUMN_NAME, ROWSET.PREFIX); - - public static final String COLUMN_GUID = "COLUMN_GUID"; - public static final QName QN_COLUMN_GUID = new QName(ROWSET.NS_URN, COLUMN_GUID, ROWSET.PREFIX); - - public static final String COLUMN_PROPID = "COLUMN_PROPID"; - public static final QName QN_COLUMN_PROPID = new QName(ROWSET.NS_URN, COLUMN_PROPID, ROWSET.PREFIX); - - public static final String ORDINAL_POSITION = "ORDINAL_POSITION"; - public static final QName QN_ORDINAL_POSITION = new QName(ROWSET.NS_URN, ORDINAL_POSITION, ROWSET.PREFIX); - - public static final String COLUMN_HAS_DEFAULT = "COLUMN_HAS_DEFAULT"; - public static final QName QN_COLUMN_HAS_DEFAULT = new QName(ROWSET.NS_URN, COLUMN_HAS_DEFAULT, ROWSET.PREFIX); - - public static final String COLUMN_DEFAULT = "COLUMN_DEFAULT"; - public static final QName QN_COLUMN_DEFAULT = new QName(ROWSET.NS_URN, COLUMN_DEFAULT, ROWSET.PREFIX); - - public static final String COLUMN_FLAG = "COLUMN_FLAG"; - public static final QName QN_COLUMN_FLAG = new QName(ROWSET.NS_URN, COLUMN_FLAG, ROWSET.PREFIX); - - public static final String IS_NULLABLE = "IS_NULLABLE"; - public static final QName QN_IS_NULLABLE = new QName(ROWSET.NS_URN, IS_NULLABLE, ROWSET.PREFIX); - - public static final String DATA_TYPE = "DATA_TYPE"; - public static final QName QN_DATA_TYPE = new QName(ROWSET.NS_URN, DATA_TYPE, ROWSET.PREFIX); - - public static final String TYPE_GUID = "TYPE_GUID"; - public static final QName QN_TYPE_GUID = new QName(ROWSET.NS_URN, TYPE_GUID, ROWSET.PREFIX); - - public static final String CHARACTER_MAXIMUM_LENGTH = "CHARACTER_MAXIMUM_LENGTH"; - public static final QName QN_CHARACTER_MAXIMUM_LENGTH = new QName(ROWSET.NS_URN, CHARACTER_MAXIMUM_LENGTH, ROWSET.PREFIX); - - public static final String CHARACTER_OCTET_LENGTH = "CHARACTER_OCTET_LENGTH"; - public static final QName QN_CHARACTER_OCTET_LENGTH = new QName(ROWSET.NS_URN, CHARACTER_OCTET_LENGTH, ROWSET.PREFIX); - - public static final String NUMERIC_PRECISION = "NUMERIC_PRECISION"; - public static final QName QN_NUMERIC_PRECISION = new QName(ROWSET.NS_URN, NUMERIC_PRECISION, ROWSET.PREFIX); - - public static final String DATETIME_PRECISION = "DATETIME_PRECISION"; - public static final QName QN_DATETIME_PRECISION = new QName(ROWSET.NS_URN, DATETIME_PRECISION, ROWSET.PREFIX); - - public static final String CHARACTER_SET_CATALOG = "CHARACTER_SET_CATALOG"; - public static final QName QN_CHARACTER_SET_CATALOG = new QName(ROWSET.NS_URN, CHARACTER_SET_CATALOG, ROWSET.PREFIX); - - public static final String CHARACTER_SET_SCHEMA = "CHARACTER_SET_SCHEMA"; - public static final QName QN_CHARACTER_SET_SCHEMA = new QName(ROWSET.NS_URN, CHARACTER_SET_SCHEMA, ROWSET.PREFIX); - - public static final String CHARACTER_SET_NAME = "CHARACTER_SET_NAME"; - public static final QName QN_CHARACTER_SET_NAME = new QName(ROWSET.NS_URN, CHARACTER_SET_NAME, ROWSET.PREFIX); - - public static final String COLLATION_CATALOG = "COLLATION_CATALOG"; - public static final QName QN_COLLATION_CATALOG = new QName(ROWSET.NS_URN, COLLATION_CATALOG, ROWSET.PREFIX); - - public static final String COLLATION_SCHEMA = "COLLATION_SCHEMA"; - public static final QName QN_COLLATION_SCHEMA = new QName(ROWSET.NS_URN, COLLATION_SCHEMA, ROWSET.PREFIX); - - public static final String COLLATION_NAME = "COLLATION_NAME"; - public static final QName QN_COLLATION_NAME = new QName(ROWSET.NS_URN, COLLATION_NAME, ROWSET.PREFIX); - - public static final String DOMAIN_CATALOG = "DOMAIN_CATALOG"; - public static final QName QN_DOMAIN_CATALOG = new QName(ROWSET.NS_URN, DOMAIN_CATALOG, ROWSET.PREFIX); - - public static final String DOMAIN_SCHEMA = "DOMAIN_SCHEMA"; - public static final QName QN_DOMAIN_SCHEMA = new QName(ROWSET.NS_URN, DOMAIN_SCHEMA, ROWSET.PREFIX); - - public static final String DOMAIN_NAME = "DOMAIN_NAME"; - public static final QName QN_DOMAIN_NAME = new QName(ROWSET.NS_URN, DOMAIN_NAME, ROWSET.PREFIX); - - public static final String COLUMN_OLAP_TYPE = "COLUMN_OLAP_TYPE"; - public static final QName QN_COLUMN_OLAP_TYPE = new QName(ROWSET.NS_URN, COLUMN_OLAP_TYPE, ROWSET.PREFIX); - - public static final String BOOKMARKS = "BOOKMARKS"; - public static final QName QN_BOOKMARKS = new QName(ROWSET.NS_URN, BOOKMARKS, ROWSET.PREFIX); - - public static final String BOOKMARK_TYPE = "BOOKMARK_TYPE"; - public static final QName QN_BOOKMARK_TYPE = new QName(ROWSET.NS_URN, BOOKMARK_TYPE, ROWSET.PREFIX); - - public static final String BOOKMARK_DATA_TYPE = "BOOKMARK_DATA_TYPE"; - public static final QName QN_BOOKMARK_DATA_TYPE = new QName(ROWSET.NS_URN, BOOKMARK_DATA_TYPE, ROWSET.PREFIX); - - public static final String BOOKMARK_MAXIMUM_LENGTH = "BOOKMARK_MAXIMUM_LENGTH"; - public static final QName QN_BOOKMARK_MAXIMUM_LENGTH = new QName(ROWSET.NS_URN, BOOKMARK_MAXIMUM_LENGTH, ROWSET.PREFIX); - - public static final String BOOKMARK_INFORMATION = "BOOKMARK_INFORMATION"; - public static final QName QN_BOOKMARK_INFORMATION = new QName(ROWSET.NS_URN, BOOKMARK_INFORMATION, ROWSET.PREFIX); - - public static final String TABLE_VERSION = "TABLE_VERSION"; - public static final QName QN_TABLE_VERSION = new QName(ROWSET.NS_URN, TABLE_VERSION, ROWSET.PREFIX); - - public static final String CARDINALITY = "CARDINALITY"; - public static final QName QN_CARDINALITY = new QName(ROWSET.NS_URN, CARDINALITY, ROWSET.PREFIX); - - public static final String DIMENSION_UNIQUE_NAME = "DIMENSION_UNIQUE_NAME"; - public static final QName QN_DIMENSION_UNIQUE_NAME = new QName(ROWSET.NS_URN, DIMENSION_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String HIERARCHY_NAME = "HIERARCHY_NAME"; - public static final QName QN_HIERARCHY_NAME = new QName(ROWSET.NS_URN, HIERARCHY_NAME, ROWSET.PREFIX); - - public static final String HIERARCHY_UNIQUE_NAME = "HIERARCHY_UNIQUE_NAME"; - public static final QName QN_HIERARCHY_UNIQUE_NAME = new QName(ROWSET.NS_URN, HIERARCHY_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String HIERARCHY_GUID = "HIERARCHY_GUID"; - public static final QName QN_HIERARCHY_GUID = new QName(ROWSET.NS_URN, HIERARCHY_GUID, ROWSET.PREFIX); - - public static final String HIERARCHY_CAPTION = "HIERARCHY_CAPTION"; - public static final QName QN_HIERARCHY_CAPTION = new QName(ROWSET.NS_URN, HIERARCHY_CAPTION, ROWSET.PREFIX); - - public static final String DIMENSION_TYPE = "DIMENSION_TYPE"; - public static final QName QN_DIMENSION_TYPE = new QName(ROWSET.NS_URN, DIMENSION_TYPE, ROWSET.PREFIX); - - public static final String HIERARCHY_CARDINALITY = "HIERARCHY_CARDINALITY"; - public static final QName QN_HIERARCHY_CARDINALITY = new QName(ROWSET.NS_URN, HIERARCHY_CARDINALITY, ROWSET.PREFIX); - - public static final String DEFAULT_MEMBER = "DEFAULT_MEMBER"; - public static final QName QN_DEFAULT_MEMBER = new QName(ROWSET.NS_URN, DEFAULT_MEMBER, ROWSET.PREFIX); - - public static final String ALL_MEMBER = "ALL_MEMBER"; - public static final QName QN_ALL_MEMBER = new QName(ROWSET.NS_URN, ALL_MEMBER, ROWSET.PREFIX); - - public static final String STRUCTURE = "STRUCTURE"; - public static final QName QN_STRUCTURE = new QName(ROWSET.NS_URN, STRUCTURE, ROWSET.PREFIX); - - public static final String IS_VIRTUAL = "IS_VIRTUAL"; - public static final QName QN_IS_VIRTUAL = new QName(ROWSET.NS_URN, IS_VIRTUAL, ROWSET.PREFIX); - - public static final String IS_READWRITE = "IS_READWRITE"; - public static final QName QN_IS_READWRITE = new QName(ROWSET.NS_URN, IS_READWRITE, ROWSET.PREFIX); - - public static final String DIMENSION_UNIQUE_SETTINGS = "DIMENSION_UNIQUE_SETTINGS"; - public static final QName QN_DIMENSION_UNIQUE_SETTINGS = new QName(ROWSET.NS_URN, DIMENSION_UNIQUE_SETTINGS, ROWSET.PREFIX); - - public static final String DIMENSION_MASTER_UNIQUE_NAME = "DIMENSION_MASTER_UNIQUE_NAME"; - public static final QName QN_DIMENSION_MASTER_UNIQUE_NAME = new QName(ROWSET.NS_URN, DIMENSION_MASTER_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String DIMENSION_IS_VISIBLE = "DIMENSION_IS_VISIBLE"; - public static final QName QN_DIMENSION_IS_VISIBLE = new QName(ROWSET.NS_URN, DIMENSION_IS_VISIBLE, ROWSET.PREFIX); - - public static final String HIERARCHY_ORDINAL = "HIERARCHY_ORDINAL"; - public static final QName QN_HIERARCHY_ORDINAL = new QName(ROWSET.NS_URN, HIERARCHY_ORDINAL, ROWSET.PREFIX); - - public static final String DIMENSION_IS_SHARED = "DIMENSION_IS_SHARED"; - public static final QName QN_DIMENSION_IS_SHARED = new QName(ROWSET.NS_URN, DIMENSION_IS_SHARED, ROWSET.PREFIX); - - public static final String HIERARCHY_IS_VISIBLE = "HIERARCHY_IS_VISIBLE"; - public static final QName QN_HIERARCHY_IS_VISIBLE = new QName(ROWSET.NS_URN, HIERARCHY_IS_VISIBLE, ROWSET.PREFIX); - - public static final String HIERARCHY_ORIGIN = "HIERARCHY_ORIGIN"; - public static final QName QN_HIERARCHY_ORIGIN = new QName(ROWSET.NS_URN, HIERARCHY_ORIGIN, ROWSET.PREFIX); - - public static final String HIERARCHY_DISPLAY_FOLDER = "HIERARCHY_DISPLAY_FOLDER"; - public static final QName QN_HIERARCHY_DISPLAY_FOLDER = new QName(ROWSET.NS_URN, HIERARCHY_DISPLAY_FOLDER, ROWSET.PREFIX); - - public static final String INSTANCE_SELECTION = "INSTANCE_SELECTION"; - public static final QName QN_INSTANCE_SELECTION = new QName(ROWSET.NS_URN, INSTANCE_SELECTION, ROWSET.PREFIX); - - public static final String GROUPING_BEHAVIOR = "GROUPING_BEHAVIOR"; - public static final QName QN_GROUPING_BEHAVIOR = new QName(ROWSET.NS_URN, GROUPING_BEHAVIOR, ROWSET.PREFIX); - - public static final String STRUCTURE_TYPE = "STRUCTURE_TYPE"; - public static final QName QN_STRUCTURE_TYPE = new QName(ROWSET.NS_URN, STRUCTURE_TYPE, ROWSET.PREFIX); - - public static final String LEVEL_NAME = "LEVEL_NAME"; - public static final QName QN_LEVEL_NAME = new QName(ROWSET.NS_URN, LEVEL_NAME, ROWSET.PREFIX); - - public static final String LEVEL_UNIQUE_NAME = "LEVEL_UNIQUE_NAME"; - public static final QName QN_LEVEL_UNIQUE_NAME = new QName(ROWSET.NS_URN, LEVEL_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String LEVEL_GUID = "LEVEL_GUID"; - public static final QName QN_LEVEL_GUID = new QName(ROWSET.NS_URN, LEVEL_GUID, ROWSET.PREFIX); - - public static final String LEVEL_CAPTION = "LEVEL_CAPTION"; - public static final QName QN_LEVEL_CAPTION = new QName(ROWSET.NS_URN, LEVEL_CAPTION, ROWSET.PREFIX); - - public static final String LEVEL_NUMBER = "LEVEL_NUMBER"; - public static final QName QN_LEVEL_NUMBER = new QName(ROWSET.NS_URN, LEVEL_NUMBER, ROWSET.PREFIX); - - public static final String LEVEL_CARDINALITY = "LEVEL_CARDINALITY"; - public static final QName QN_LEVEL_CARDINALITY = new QName(ROWSET.NS_URN, LEVEL_CARDINALITY, ROWSET.PREFIX); - - public static final String LEVEL_TYPE = "LEVEL_TYPE"; - public static final QName QN_LEVEL_TYPE = new QName(ROWSET.NS_URN, LEVEL_TYPE, ROWSET.PREFIX); - - public static final String CUSTOM_ROLLUP_SETTINGS = "CUSTOM_ROLLUP_SETTINGS"; - public static final QName QN_CUSTOM_ROLLUP_SETTINGS = new QName(ROWSET.NS_URN, CUSTOM_ROLLUP_SETTINGS, ROWSET.PREFIX); - - public static final String LEVEL_UNIQUE_SETTINGS = "LEVEL_UNIQUE_SETTINGS"; - public static final QName QN_LEVEL_UNIQUE_SETTINGS = new QName(ROWSET.NS_URN, LEVEL_UNIQUE_SETTINGS, ROWSET.PREFIX); - - public static final String LEVEL_IS_VISIBLE = "LEVEL_IS_VISIBLE"; - public static final QName QN_LEVEL_IS_VISIBLE = new QName(ROWSET.NS_URN, LEVEL_IS_VISIBLE, ROWSET.PREFIX); - - public static final String LEVEL_ORIGIN = "LEVEL_ORIGIN"; - public static final QName QN_LEVEL_ORIGIN = new QName(ROWSET.NS_URN, LEVEL_ORIGIN, ROWSET.PREFIX); - - public static final String MEASURE_GROUP_DIMENSION = "MeasureGroupDimension"; - public static final QName QN_MEASURE_GROUP_DIMENSION = new QName(ROWSET.NS_URN, MEASURE_GROUP_DIMENSION, ROWSET.PREFIX); - - public static final String MEASUREGROUP_NAME = "MEASUREGROUP_NAME"; - public static final QName QN_MEASUREGROUP_NAME = new QName(ROWSET.NS_URN, MEASUREGROUP_NAME, ROWSET.PREFIX); - - public static final String MEASUREGROUP_CARDINALITY = "MEASUREGROUP_CARDINALITY"; - public static final QName QN_MEASUREGROUP_CARDINALITY = new QName(ROWSET.NS_URN, MEASUREGROUP_CARDINALITY, ROWSET.PREFIX); - - public static final String DIMENSION_CARDINALITY = "DIMENSION_CARDINALITY"; - public static final QName QN_DIMENSION_CARDINALITY = new QName(ROWSET.NS_URN, DIMENSION_CARDINALITY, ROWSET.PREFIX); - - public static final String DIMENSION_IS_FACT_DIMENSION = "DIMENSION_IS_FACT_DIMENSION"; - public static final QName QN_DIMENSION_IS_FACT_DIMENSION = new QName(ROWSET.NS_URN, DIMENSION_IS_FACT_DIMENSION, ROWSET.PREFIX); - - public static final String DIMENSION_GRANULARITY = "DIMENSION_GRANULARITY"; - public static final QName QN_DIMENSION_GRANULARITY = new QName(ROWSET.NS_URN, DIMENSION_GRANULARITY, ROWSET.PREFIX); - - public static final String IS_WRITE_ENABLED = "IS_WRITE_ENABLED"; - public static final QName QN_IS_WRITE_ENABLED = new QName(ROWSET.NS_URN, IS_WRITE_ENABLED, ROWSET.PREFIX); - - public static final String MEASUREGROUP_CAPTION = "MEASUREGROUP_CAPTION"; - public static final QName QN_MEASUREGROUP_CAPTION = new QName(ROWSET.NS_URN, MEASUREGROUP_CAPTION, ROWSET.PREFIX); - - public static final String MEASURE_NAME = "MEASURE_NAME"; - public static final QName QN_MEASURE_NAME = new QName(ROWSET.NS_URN, MEASURE_NAME, ROWSET.PREFIX); - - public static final String MEASURE_UNIQUE_NAME = "MEASURE_UNIQUE_NAME"; - public static final QName QN_MEASURE_UNIQUE_NAME = new QName(ROWSET.NS_URN, MEASURE_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String MEASURE_CAPTION = "MEASURE_CAPTION"; - public static final QName QN_MEASURE_CAPTION = new QName(ROWSET.NS_URN, MEASURE_CAPTION, ROWSET.PREFIX); - - public static final String MEASURE_GUID = "MEASURE_GUID"; - public static final QName QN_MEASURE_GUID = new QName(ROWSET.NS_URN, MEASURE_GUID, ROWSET.PREFIX); - - public static final String MEASURE_AGGREGATOR = "MEASURE_AGGREGATOR"; - public static final QName QN_MEASURE_AGGREGATOR = new QName(ROWSET.NS_URN, MEASURE_AGGREGATOR, ROWSET.PREFIX); - - public static final String NUMERIC_SCALE = "NUMERIC_SCALE"; - public static final QName QN_NUMERIC_SCALE = new QName(ROWSET.NS_URN, NUMERIC_SCALE, ROWSET.PREFIX); - - public static final String MEASURE_UNITS = "MEASURE_UNITS"; - public static final QName QN_MEASURE_UNITS = new QName(ROWSET.NS_URN, MEASURE_UNITS, ROWSET.PREFIX); - - public static final String MEASURE_IS_VISIBLE = "MEASURE_IS_VISIBLE"; - public static final QName QN_MEASURE_IS_VISIBLE = new QName(ROWSET.NS_URN, MEASURE_IS_VISIBLE, ROWSET.PREFIX); - - public static final String LEVELS_LIST = "LEVELS_LIST"; - public static final QName QN_LEVELS_LIST = new QName(ROWSET.NS_URN, LEVELS_LIST, ROWSET.PREFIX); - - public static final String EXPRESSION = "EXPRESSION"; - public static final QName QN_EXPRESSION = new QName(ROWSET.NS_URN, EXPRESSION, ROWSET.PREFIX); - - public static final String MEASURE_NAME_SQL_COLUMN_NAME = "MEASURE_NAME_SQL_COLUMN_NAME"; - public static final QName QN_MEASURE_NAME_SQL_COLUMN_NAME = new QName(ROWSET.NS_URN, MEASURE_NAME_SQL_COLUMN_NAME, ROWSET.PREFIX); - - public static final String MEASURE_UNQUALIFIED_CAPTION = "MEASURE_UNQUALIFIED_CAPTION"; - public static final QName QN_MEASURE_UNQUALIFIED_CAPTION = new QName(ROWSET.NS_URN, MEASURE_UNQUALIFIED_CAPTION, ROWSET.PREFIX); - - public static final String MEASURE_DISPLAY_FOLDER = "MEASURE_DISPLAY_FOLDER"; - public static final QName QN_MEASURE_DISPLAY_FOLDER = new QName(ROWSET.NS_URN, MEASURE_DISPLAY_FOLDER, ROWSET.PREFIX); - - public static final String DEFAULT_FORMAT_STRING = "DEFAULT_FORMAT_STRING"; - public static final QName QN_DEFAULT_FORMAT_STRING = new QName(ROWSET.NS_URN, DEFAULT_FORMAT_STRING, ROWSET.PREFIX); - - public static final String CUBE_SOURCE = "CUBE_SOURCE"; - public static final QName QN_CUBE_SOURCE = new QName(ROWSET.NS_URN, CUBE_SOURCE, ROWSET.PREFIX); - - public static final String MEASURE_VISIBILITY = "MEASURE_VISIBILITY"; - public static final QName QN_MEASURE_VISIBILITY = new QName(ROWSET.NS_URN, MEASURE_VISIBILITY, ROWSET.PREFIX); - - public static final String MEMBER_ORDINAL = "MEMBER_ORDINAL"; - public static final QName QN_MEMBER_ORDINAL = new QName(ROWSET.NS_URN, MEMBER_ORDINAL, ROWSET.PREFIX); - - public static final String MEMBER_NAME = "MEMBER_NAME"; - public static final QName QN_MEMBER_NAME = new QName(ROWSET.NS_URN, MEMBER_NAME, ROWSET.PREFIX); - - public static final String MEMBER_UNIQUE_NAME = "MEMBER_UNIQUE_NAME"; - public static final QName QN_MEMBER_UNIQUE_NAME = new QName(ROWSET.NS_URN, MEMBER_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String MEMBER_TYPE = "MEMBER_TYPE"; - public static final QName QN_MEMBER_TYPE = new QName(ROWSET.NS_URN, MEMBER_TYPE, ROWSET.PREFIX); - - public static final String MEMBER_GUID = "MEMBER_GUID"; - public static final QName QN_MEMBER_GUID = new QName(ROWSET.NS_URN, MEMBER_GUID, ROWSET.PREFIX); - - public static final String MEMBER_CAPTION = "MEMBER_CAPTION"; - public static final QName QN_MEMBER_CAPTION = new QName(ROWSET.NS_URN, MEMBER_CAPTION, ROWSET.PREFIX); - - public static final String CHILDREN_CARDINALITY = "CHILDREN_CARDINALITY"; - public static final QName QN_CHILDREN_CARDINALITY = new QName(ROWSET.NS_URN, CHILDREN_CARDINALITY, ROWSET.PREFIX); - - public static final String PARENT_LEVEL = "PARENT_LEVEL"; - public static final QName QN_PARENT_LEVEL = new QName(ROWSET.NS_URN, PARENT_LEVEL, ROWSET.PREFIX); - - public static final String PARENT_UNIQUE_NAME = "PARENT_UNIQUE_NAME"; - public static final QName QN_PARENT_UNIQUE_NAME = new QName(ROWSET.NS_URN, PARENT_UNIQUE_NAME, ROWSET.PREFIX); - - public static final String PARENT_COUNT = "PARENT_COUNT"; - public static final QName QN_PARENT_COUNT = new QName(ROWSET.NS_URN, PARENT_COUNT, ROWSET.PREFIX); - - public static final String MEMBER_KEY = "MEMBER_KEY"; - public static final QName QN_MEMBER_KEY = new QName(ROWSET.NS_URN, MEMBER_KEY, ROWSET.PREFIX); - - public static final String IS_PLACEHOLDERMEMBER = "IS_PLACEHOLDERMEMBER"; - public static final QName QN_IS_PLACEHOLDERMEMBER = new QName(ROWSET.NS_URN, IS_PLACEHOLDERMEMBER, ROWSET.PREFIX); - - public static final String IS_DATAMEMBER = "IS_DATAMEMBER"; - public static final QName QN_IS_DATAMEMBER = new QName(ROWSET.NS_URN, IS_DATAMEMBER, ROWSET.PREFIX); - - public static final String SCOPE = "SCOPE"; - public static final QName QN_SCOPE = new QName(ROWSET.NS_URN, SCOPE, ROWSET.PREFIX); - - public static final String PROPERTY_TYPE = "PROPERTY_TYPE"; - public static final QName QN_PROPERTY_TYPE = new QName(ROWSET.NS_URN, PROPERTY_TYPE, ROWSET.PREFIX); - - public static final String PROPERTY_TYPE_LC = "PropertyType"; - public static final QName QN_PROPERTY_TYPE_LC = new QName(ROWSET.NS_URN, PROPERTY_TYPE_LC, ROWSET.PREFIX); - - public static final String PROPERTY_NAME = "PROPERTY_NAME"; - public static final QName QN_PROPERTY_NAME = new QName(ROWSET.NS_URN, PROPERTY_NAME, ROWSET.PREFIX); - - public static final String PROPERTY_NAME_LC = "PropertyName"; - public static final QName QN_PROPERTY_NAME_LC = new QName(ROWSET.NS_URN, PROPERTY_NAME_LC, ROWSET.PREFIX); - - public static final String PROPERTY_CAPTION = "PROPERTY_CAPTION"; - public static final QName QN_PROPERTY_CAPTION = new QName(ROWSET.NS_URN, PROPERTY_CAPTION, ROWSET.PREFIX); - - public static final String PROPERTY_CONTENT_TYPE = "PROPERTY_CONTENT_TYPE"; - public static final QName QN_PROPERTY_CONTENT_TYPE = new QName(ROWSET.NS_URN, PROPERTY_CONTENT_TYPE, ROWSET.PREFIX); - - public static final String SQL_COLUMN_NAME = "SQL_COLUMN_NAME"; - public static final QName QN_SQL_COLUMN_NAME = new QName(ROWSET.NS_URN, SQL_COLUMN_NAME, ROWSET.PREFIX); - - public static final String PROPERTY_ORIGIN = "PROPERTY_ORIGIN"; - public static final QName QN_PROPERTY_ORIGIN = new QName(ROWSET.NS_URN, PROPERTY_ORIGIN, ROWSET.PREFIX); - - public static final String PROPERTY_VISIBILITY = "PROPERTY_VISIBILITY"; - public static final QName QN_PROPERTY_VISIBILITY = new QName(ROWSET.NS_URN, PROPERTY_VISIBILITY, ROWSET.PREFIX); - - public static final String SET_NAME = "SET_NAME"; - public static final QName QN_SET_NAME = new QName(ROWSET.NS_URN, SET_NAME, ROWSET.PREFIX); - - public static final String DIMENSIONS = "DIMENSIONS"; - public static final QName QN_DIMENSIONS = new QName(ROWSET.NS_URN, DIMENSIONS, ROWSET.PREFIX); - - public static final String SET_CAPTION = "SET_CAPTION"; - public static final QName QN_SET_CAPTION = new QName(ROWSET.NS_URN, SET_CAPTION, ROWSET.PREFIX); - - public static final String SET_DISPLAY_FOLDER = "SET_DISPLAY_FOLDER"; - public static final QName QN_SET_DISPLAY_FOLDER = new QName(ROWSET.NS_URN, SET_DISPLAY_FOLDER, ROWSET.PREFIX); - - public static final String MEMBER_DISP_INFO = "MemberDispInfo"; - public static final QName QN_MEMBER_DISP_INFO = new QName(ROWSET.NS_URN, MEMBER_DISP_INFO, ROWSET.PREFIX); - - public static final String PROPERTY_DESCRIPTION = "PropertyDescription"; - public static final QName QN_PROPERTY_DESCRIPTION = new QName(ROWSET.NS_URN, PROPERTY_DESCRIPTION, ROWSET.PREFIX); - - public static final String PROPERTY_ACCESS_TYPE = "PropertyAccessType"; - public static final QName QN_PROPERTY_ACCESS_TYPE = new QName(ROWSET.NS_URN, PROPERTY_ACCESS_TYPE, ROWSET.PREFIX); - - public static final String IS_REQUIRED = "IsRequired"; - public static final QName QN_IS_REQUIRED = new QName(ROWSET.NS_URN, IS_REQUIRED, ROWSET.PREFIX); - - public static final String VALUE = "Value"; - public static final QName QN_VALUE = new QName(ROWSET.NS_URN, VALUE, ROWSET.PREFIX); - - public static final String TYPE_NAME = "TYPE_NAME"; - public static final QName QN_TYPE_NAME = new QName(ROWSET.NS_URN, TYPE_NAME, ROWSET.PREFIX); - - public static final String COLUMN_SIZE = "COLUMN_SIZE"; - public static final QName QN_COLUMN_SIZE = new QName(ROWSET.NS_URN, COLUMN_SIZE, ROWSET.PREFIX); - - public static final String LITERAL_PREFIX = "LITERAL_PREFIX"; - public static final QName QN_LITERAL_PREFIX = new QName(ROWSET.NS_URN, LITERAL_PREFIX, ROWSET.PREFIX); - - public static final String LITERAL_SUFFIX = "LITERAL_SUFFIX"; - public static final QName QN_LITERAL_SUFFIX = new QName(ROWSET.NS_URN, LITERAL_SUFFIX, ROWSET.PREFIX); - - public static final String CREATE_PARAMS = "CREATE_PARAMS"; - public static final QName QN_CREATE_PARAMS = new QName(ROWSET.NS_URN, CREATE_PARAMS, ROWSET.PREFIX); - - public static final String CASE_SENSITIVE = "CASE_SENSITIVE"; - public static final QName QN_CASE_SENSITIVE = new QName(ROWSET.NS_URN, CASE_SENSITIVE, ROWSET.PREFIX); - - public static final String SEARCHABLE = "SEARCHABLE"; - public static final QName QN_SEARCHABLE = new QName(ROWSET.NS_URN, SEARCHABLE, ROWSET.PREFIX); - - public static final String UNSIGNED_ATTRIBUTE = "UNSIGNED_ATTRIBUTE"; - public static final QName QN_UNSIGNED_ATTRIBUTE = new QName(ROWSET.NS_URN, UNSIGNED_ATTRIBUTE, ROWSET.PREFIX); - - public static final String FIXED_PREC_SCALE = "FIXED_PREC_SCALE"; - public static final QName QN_FIXED_PREC_SCALE = new QName(ROWSET.NS_URN, FIXED_PREC_SCALE, ROWSET.PREFIX); - - public static final String AUTO_UNIQUE_VALUE = "AUTO_UNIQUE_VALUE"; - public static final QName QN_AUTO_UNIQUE_VALUE = new QName(ROWSET.NS_URN, AUTO_UNIQUE_VALUE, ROWSET.PREFIX); - - public static final String LOCAL_TYPE_NAME = "LOCAL_TYPE_NAME"; - public static final QName QN_LOCAL_TYPE_NAME = new QName(ROWSET.NS_URN, LOCAL_TYPE_NAME, ROWSET.PREFIX); - - public static final String MINIMUM_SCALE = "MINIMUM_SCALE"; - public static final QName QN_MINIMUM_SCALE = new QName(ROWSET.NS_URN, MINIMUM_SCALE, ROWSET.PREFIX); - - public static final String MAXIMUM_SCALE = "MAXIMUM_SCALE"; - public static final QName QN_MAXIMUM_SCALE = new QName(ROWSET.NS_URN, MAXIMUM_SCALE, ROWSET.PREFIX); - - public static final String GUID = "GUID"; - public static final QName QN_GUID = new QName(ROWSET.NS_URN, GUID, ROWSET.PREFIX); - - public static final String TYPE_LIB = "TYPE_LIB"; - public static final QName QN_TYPE_LIB = new QName(ROWSET.NS_URN, TYPE_LIB, ROWSET.PREFIX); - - public static final String IS_LONG = "IS_LONG"; - public static final QName QN_IS_LONG = new QName(ROWSET.NS_URN, IS_LONG, ROWSET.PREFIX); - - public static final String BEST_MATCH = "BEST_MATCH"; - public static final QName QN_BEST_MATCH = new QName(ROWSET.NS_URN, BEST_MATCH, ROWSET.PREFIX); - - public static final String IS_FIXEDLENGTH = "IS_FIXEDLENGTH"; - public static final QName QN_IS_FIXEDLENGTH = new QName(ROWSET.NS_URN, IS_FIXEDLENGTH, ROWSET.PREFIX); - - public static final String KPI_NAME = "KPI_NAME"; - public static final QName QN_KPI_NAME = new QName(ROWSET.NS_URN, KPI_NAME, ROWSET.PREFIX); - - public static final String KPI_CAPTION = "KPI_CAPTION"; - public static final QName QN_KPI_CAPTION = new QName(ROWSET.NS_URN, KPI_CAPTION, ROWSET.PREFIX); - - public static final String KPI_DESCRIPTION = "KPI_DESCRIPTION"; - public static final QName QN_KPI_DESCRIPTION = new QName(ROWSET.NS_URN, KPI_DESCRIPTION, ROWSET.PREFIX); - - public static final String KPI_DISPLAY_FOLDER = "KPI_DISPLAY_FOLDER"; - public static final QName QN_KPI_DISPLAY_FOLDER = new QName(ROWSET.NS_URN, KPI_DISPLAY_FOLDER, ROWSET.PREFIX); - - public static final String KPI_VALUE = "KPI_VALUE"; - public static final QName QN_KPI_VALUE = new QName(ROWSET.NS_URN, KPI_VALUE, ROWSET.PREFIX); - - public static final String KPI_GOAL = "KPI_GOAL"; - public static final QName QN_KPI_GOAL = new QName(ROWSET.NS_URN, KPI_GOAL, ROWSET.PREFIX); - - public static final String KPI_STATUS = "KPI_STATUS"; - public static final QName QN_KPI_STATUS = new QName(ROWSET.NS_URN, KPI_STATUS, ROWSET.PREFIX); - - public static final String KPI_TREND = "KPI_TREND"; - public static final QName QN_KPI_TREND = new QName(ROWSET.NS_URN, KPI_TREND, ROWSET.PREFIX); - - public static final String KPI_STATUS_GRAPHIC = "KPI_STATUS_GRAPHIC"; - public static final QName QN_KPI_STATUS_GRAPHIC = new QName(ROWSET.NS_URN, KPI_STATUS_GRAPHIC, ROWSET.PREFIX); - - public static final String KPI_TREND_GRAPHIC = "KPI_TREND_GRAPHIC"; - public static final QName QN_KPI_TREND_GRAPHIC = new QName(ROWSET.NS_URN, KPI_TREND_GRAPHIC, ROWSET.PREFIX); - - public static final String KPI_WEIGHT = "KPI_WEIGHT"; - public static final QName QN_KPI_WEIGHT = new QName(ROWSET.NS_URN, KPI_WEIGHT, ROWSET.PREFIX); - - public static final String KPI_CURRENT_TIME_MEMBER = "KPI_CURRENT_TIME_MEMBER"; - public static final QName QN_KPI_CURRENT_TIME_MEMBER = new QName(ROWSET.NS_URN, KPI_CURRENT_TIME_MEMBER, ROWSET.PREFIX); - - public static final String KPI_PARENT_KPI_NAME = "KPI_PARENT_KPI_NAME"; - public static final QName QN_KPI_PARENT_KPI_NAME = new QName(ROWSET.NS_URN, KPI_PARENT_KPI_NAME, ROWSET.PREFIX); - - public static final String ANNOTATIONS = "ANNOTATIONS"; - public static final QName QN_ANNOTATIONS = new QName(ROWSET.NS_URN, ANNOTATIONS, ROWSET.PREFIX); - - public static final String CUBE_TYPE = "CUBE_TYPE"; - public static final QName QN_CUBE_TYPE = new QName(ROWSET.NS_URN, CUBE_TYPE, ROWSET.PREFIX); - - public static final String CUBE_GUID = "CUBE_GUID"; - public static final QName QN_CUBE_GUID = new QName(ROWSET.NS_URN, CUBE_GUID, ROWSET.PREFIX); - - public static final String CREATED_ON = "CREATED_ON"; - public static final QName QN_CREATED_ON = new QName(ROWSET.NS_URN, CREATED_ON, ROWSET.PREFIX); - - public static final String LAST_SCHEMA_UPDATE = "LAST_SCHEMA_UPDATE"; - public static final QName QN_LAST_SCHEMA_UPDATE = new QName(ROWSET.NS_URN, LAST_SCHEMA_UPDATE, ROWSET.PREFIX); - - public static final String SCHEMA_UPDATED_BY = "SCHEMA_UPDATED_BY"; - public static final QName QN_SCHEMA_UPDATED_BY = new QName(ROWSET.NS_URN, SCHEMA_UPDATED_BY, ROWSET.PREFIX); - - public static final String LAST_DATA_UPDATE = "LAST_DATA_UPDATE"; - public static final QName QN_LAST_DATA_UPDATE = new QName(ROWSET.NS_URN, LAST_DATA_UPDATE, ROWSET.PREFIX); - - public static final String DATA_UPDATED_BY = "DATA_UPDATED_BY"; - public static final QName QN_DATA_UPDATED_BY = new QName(ROWSET.NS_URN, DATA_UPDATED_BY, ROWSET.PREFIX); - - public static final String IS_DRILLTHROUGH_ENABLED = "IS_DRILLTHROUGH_ENABLED"; - public static final QName QN_IS_DRILLTHROUGH_ENABLED = new QName(ROWSET.NS_URN, IS_DRILLTHROUGH_ENABLED, ROWSET.PREFIX); - - public static final String IS_LINKABLE = "IS_LINKABLE"; - public static final QName QN_IS_LINKABLE = new QName(ROWSET.NS_URN, IS_LINKABLE, ROWSET.PREFIX); - - public static final String IS_SQL_ENABLED = "IS_SQL_ENABLED"; - public static final QName QN_IS_SQL_ENABLED = new QName(ROWSET.NS_URN, IS_SQL_ENABLED, ROWSET.PREFIX); - - public static final String CUBE_CAPTION = "CUBE_CAPTION"; - public static final QName QN_CUBE_CAPTION = new QName(ROWSET.NS_URN, CUBE_CAPTION, ROWSET.PREFIX); - - public static final String BASE_CUBE_NAME = "BASE_CUBE_NAME"; - public static final QName QN_BASE_CUBE_NAME = new QName(ROWSET.NS_URN, BASE_CUBE_NAME, ROWSET.PREFIX); - - public static final String PREFERRED_QUERY_PATTERNS = "PREFERRED_QUERY_PATTERNS"; - public static final QName QN_PREFERRED_QUERY_PATTERNS = new QName(ROWSET.NS_URN, PREFERRED_QUERY_PATTERNS, ROWSET.PREFIX); - - public static final String DIMENSION_NAME = "DIMENSION_NAME"; - public static final QName QN_DIMENSION_NAME = new QName(ROWSET.NS_URN, DIMENSION_NAME, ROWSET.PREFIX); - - public static final String DIMENSION_GUID = "DIMENSION_GUID"; - public static final QName QN_DIMENSION_GUID = new QName(ROWSET.NS_URN, DIMENSION_GUID, ROWSET.PREFIX); - - public static final String DIMENSION_CAPTION = "DIMENSION_CAPTION"; - public static final QName QN_DIMENSION_CAPTION = new QName(ROWSET.NS_URN, DIMENSION_CAPTION, ROWSET.PREFIX); - - public static final String DIMENSION_ORDINAL = "DIMENSION_ORDINAL"; - public static final QName QN_DIMENSION_ORDINAL = new QName(ROWSET.NS_URN, DIMENSION_ORDINAL, ROWSET.PREFIX); - - public static final String DEFAULT_HIERARCHY = "DEFAULT_HIERARCHY"; - public static final QName QN_DEFAULT_HIERARCHY = new QName(ROWSET.NS_URN, DEFAULT_HIERARCHY, ROWSET.PREFIX); - - public static final String DIMENSION_MASTER_NAME = "DIMENSION_MASTER_NAME"; - public static final QName QN_DIMENSION_MASTER_NAME = new QName(ROWSET.NS_URN, DIMENSION_MASTER_NAME, ROWSET.PREFIX); - - public static final String FUNCTION_NAME = "FUNCTION_NAME"; - public static final QName QN_FUNCTION_NAME = new QName(ROWSET.NS_URN, FUNCTION_NAME, ROWSET.PREFIX); - - public static final String PARAMETER_LIST = "PARAMETER_LIST"; - public static final QName QN_PARAMETER_LIST = new QName(ROWSET.NS_URN, PARAMETER_LIST, ROWSET.PREFIX); - - public static final String RETURN_TYPE = "RETURN_TYPE"; - public static final QName QN_RETURN_TYPE = new QName(ROWSET.NS_URN, RETURN_TYPE, ROWSET.PREFIX); - - public static final String ORIGIN = "ORIGIN"; - public static final QName QN_ORIGIN = new QName(ROWSET.NS_URN, ORIGIN, ROWSET.PREFIX); - - public static final String INTERFACE_NAME = "INTERFACE_NAME"; - public static final QName QN_INTERFACE_NAME = new QName(ROWSET.NS_URN, INTERFACE_NAME, ROWSET.PREFIX); - - public static final String LIBRARY_NAME = "LIBRARY_NAME"; - public static final QName QN_LIBRARY_NAME = new QName(ROWSET.NS_URN, LIBRARY_NAME, ROWSET.PREFIX); - - public static final String DLL_NAME = "DLL_NAME"; - public static final QName QN_DLL_NAME = new QName(ROWSET.NS_URN, DLL_NAME, ROWSET.PREFIX); - - public static final String HELP_FILE = "HELP_FILE"; - public static final QName QN_HELP_FILE = new QName(ROWSET.NS_URN, HELP_FILE, ROWSET.PREFIX); - - public static final String HELP_CONTEXT = "HELP_CONTEXT"; - public static final QName QN_HELP_CONTEXT = new QName(ROWSET.NS_URN, HELP_CONTEXT, ROWSET.PREFIX); - - public static final String OBJECT = "OBJECT"; - public static final QName QN_OBJECT = new QName(ROWSET.NS_URN, OBJECT, ROWSET.PREFIX); - - public static final String CAPTION = "CAPTION"; - public static final QName QN_CAPTION = new QName(ROWSET.NS_URN, CAPTION, ROWSET.PREFIX); - - public static final String DIRECTQUERY_PUSHABLE = "DIRECTQUERY_PUSHABLE"; - public static final QName QN_DIRECTQUERY_PUSHABLE = new QName(ROWSET.NS_URN, DIRECTQUERY_PUSHABLE, ROWSET.PREFIX); - - public static final String NAME = "NAME"; - public static final QName QN_NAME = new QName(ROWSET.NS_URN, NAME, ROWSET.PREFIX); - - public static final String OPTIONAL = "OPTIONAL"; - public static final QName QN_OPTIONAL = new QName(ROWSET.NS_URN, OPTIONAL, ROWSET.PREFIX); - - public static final String REPEATABLE = "REPEATABLE"; - public static final QName QN_REPEATABLE = new QName(ROWSET.NS_URN, REPEATABLE, ROWSET.PREFIX); - - public static final String REPEATGROUP = "REPEATGROUP"; - public static final QName QN_REPEATGROUP = new QName(ROWSET.NS_URN, REPEATGROUP, ROWSET.PREFIX); - - public static final String RESTRICTIONS = "Restrictions"; - public static final QName QN_RESTRICTIONS = new QName(ROWSET.NS_URN, RESTRICTIONS, ROWSET.PREFIX); - - public static final String NAME_LC = "Name"; - public static final QName QN_NAME_LC = new QName(ROWSET.NS_URN, NAME_LC, ROWSET.PREFIX); - - public static final String TYPE_LC = "Type"; - public static final QName QN_TYPE_LC = new QName(ROWSET.NS_URN, TYPE_LC, ROWSET.PREFIX); - - public static final String DIMENSION_PATH = "DIMENSION_PATH"; - public static final QName QN_DIMENSION_PATH = new QName(ROWSET.NS_URN, DIMENSION_PATH, ROWSET.PREFIX); - - public static final String PARAMETERINFO = "PARAMETERINFO"; - public static final QName QN_PARAMETERINFO = new QName(ROWSET.NS_URN, PARAMETERINFO, ROWSET.PREFIX); - - public static final String MEMBERS_LOOKUP = "MembersLookup"; - public static final QName QN_MEMBERS_LOOKUP = new QName(ROWSET.NS_URN, MEMBERS_LOOKUP, ROWSET.PREFIX); - - public static final String NORM_TUPLES = "NormTuples"; - public static final QName QN_NORM_TUPLES = new QName(ROWSET.NS_URN, NORM_TUPLES, ROWSET.PREFIX); - - public static final String NORM_TUPLE = "NormTuple"; - public static final QName QN_NORM_TUPLE = new QName(ROWSET.NS_URN, NORM_TUPLE, ROWSET.PREFIX); - - public static final String MEMBER_REF = "MemberRef"; - public static final QName QN_MEMBER_REF = new QName(ROWSET.NS_URN, MEMBER_REF, ROWSET.PREFIX); - } - - } - ///// - - static class MDDATASET { - public static final String PREFIX = ""; - public static final String NS_URN = "urn:schemas-microsoft-com:xml-analysis:mddataset"; - public static final QName QN_CELL_INFO = new QName(MDDATASET.NS_URN, "CellInfo", MDDATASET.PREFIX); - public static final QName QN_OLAP_INFO = new QName(MDDATASET.NS_URN, "OlapInfo", MDDATASET.PREFIX); - public static final QName QN_ROOT = new QName(MDDATASET.NS_URN, "root", MDDATASET.PREFIX); - public static final QName QN_CUBE_NAME = new QName(MDDATASET.NS_URN, "CubeName", MDDATASET.PREFIX); - public static final QName QN_SIZE = new QName(MDDATASET.NS_URN, "Size", MDDATASET.PREFIX); - public static final QName QN_MESSAGES = new QName(MDDATASET.NS_URN, "Messages", MDDATASET.PREFIX); - public static final QName QN_CELL_DATA = new QName(MDDATASET.NS_URN, "CellData", MDDATASET.PREFIX); - public static final QName QN_CELL = new QName(MDDATASET.NS_URN, "Cell", MDDATASET.PREFIX); - public static final QName QN_VALUE = new QName(MDDATASET.NS_URN, "Value", MDDATASET.PREFIX); - public static final QName QN_ERROR = new QName(MDDATASET.NS_URN, "Error", MDDATASET.PREFIX); - public static final QName QN_AXES = new QName(MDDATASET.NS_URN, "Axes", MDDATASET.PREFIX); - public static final QName QN_AXIS = new QName(MDDATASET.NS_URN, "Axis", MDDATASET.PREFIX); - public static final QName QN_UNION = new QName(MDDATASET.NS_URN, "Union", MDDATASET.PREFIX); - public static final QName QN_NORM_TUPLE_SET = new QName(MDDATASET.NS_URN, "NormTupleSet", MDDATASET.PREFIX); - public static final QName QN_CROSS_PRODUCT = new QName(MDDATASET.NS_URN, "CrossProduct", MDDATASET.PREFIX); - public static final QName QN_TUPLES = new QName(MDDATASET.NS_URN, "Tuples", MDDATASET.PREFIX); - public static final QName QN_MEMBER = new QName(MDDATASET.NS_URN, "Member", MDDATASET.PREFIX); - public static final QName QN_AXES_INFO = new QName(MDDATASET.NS_URN, "AxesInfo", MDDATASET.PREFIX); - public static final QName QN_AXIS_INFO = new QName(MDDATASET.NS_URN, "AxisInfo", MDDATASET.PREFIX); - public static final QName QN_HIERARCHY_INFO = new QName(MDDATASET.NS_URN, "HierarchyInfo", MDDATASET.PREFIX); - public static final QName QN_CUBE_INFO = new QName(MDDATASET.NS_URN, "CubeInfo", MDDATASET.PREFIX); - public static final QName QN_CUBE = new QName(MDDATASET.NS_URN, "Cube", MDDATASET.PREFIX); - public static final QName QN_MEMBERS = new QName(MDDATASET.NS_URN, "Members", MDDATASET.PREFIX); - public static final QName QN_TUPLE = new QName(MDDATASET.NS_URN, "Tuple", MDDATASET.PREFIX); - } - - static class ENGINE { - public static final String PREFIX = "engine"; - public static final String NS_URN = "http://schemas.microsoft.com/analysisservices/2003/engine"; - public static final QName QN_LAST_DATA_UPDATE = new QName(MDDATASET.NS_URN, "LastDataUpdate", MDDATASET.PREFIX); - public static final QName QN_LAST_SCHEMA_UPDATE = new QName(MDDATASET.NS_URN, "LastSchemaUpdate", MDDATASET.PREFIX); - } - - static class ENGINE200 { - public static final String PREFIX = "engine200"; - public static final String NS_URN = "http://schemas.microsoft.com/analysisservices/2010/engine/200"; - public static final QName QN_WARNING_MEASURE = new QName(ENGINE200.NS_URN, "WarningMeasure", ENGINE200.PREFIX); - public static final QName QN_WARNING_COLUMN = new QName(ENGINE200.NS_URN, "WarningColumn", ENGINE200.PREFIX); - } - - static class XSI { + public static class XSI { public static final String PREFIX = "xsi"; public static final String NS_URN = "http://www.w3.org/2001/XMLSchema-instance"; } - /////////////////////////// - static class XSD { + public static class XSD { public static final String PREFIX = "xsd"; public static final String NS_URN = "http://www.w3.org/2001/XMLSchema"; public static final QName QN_SCHEMA = new QName(XSD.NS_URN, "schema", XSD.PREFIX); @@ -886,19 +77,18 @@ static class XSD { public static final QName QN_ATTRIBUTE = new QName(XSD.NS_URN, "attribute", XSD.PREFIX); public static final QName QN_CHOICE = new QName(XSD.NS_URN, "choice", XSD.PREFIX); } - /////////////////////////// - static class SQL { + public static class SQL { public static final String PREFIX = "sql"; public static final String NS_URN = "urn:schemas-microsoft-com:xml-sql"; } - /////////////////////////// - static class EX { + public static class EX { public static final String PREFIX = "EX"; public static final String NS_URN = "urn:schemas-microsoft-com:xml-analysis:exception"; } - /////////////////////////// + + // Shared element name constants public static final String DISPLAY_FOLDER = "DisplayFolder"; public static final String DIMENSIONS = "Dimensions"; 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 deleted file mode 100644 index faf1a43..0000000 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/Convert.java +++ /dev/null @@ -1,7576 +0,0 @@ -/* - * Copyright (c) 2023 Contributors to the Eclipse Foundation. - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * SmartCity Jena - initial - * Stefan Bischof (bipolis.org) - initial - */ -package org.eclipse.daanse.xmla.server.adapter.soapmessage; - -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.*; - -import java.math.BigInteger; -import java.time.Duration; -import java.time.Instant; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -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; -import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; -import org.eclipse.daanse.xmla.api.common.enums.CubeTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.InterfaceNameEnum; -import org.eclipse.daanse.xmla.api.common.enums.InvocationEnum; -import org.eclipse.daanse.xmla.api.common.enums.LevelDbTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.MemberTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.ObjectExpansionEnum; -import org.eclipse.daanse.xmla.api.common.enums.OriginEnum; -import org.eclipse.daanse.xmla.api.common.enums.PropertyContentTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.PropertyOriginEnum; -import org.eclipse.daanse.xmla.api.common.enums.PropertyTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.ProviderTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.ScopeEnum; -import org.eclipse.daanse.xmla.api.common.enums.TableTypeEnum; -import org.eclipse.daanse.xmla.api.common.enums.TreeOpEnum; -import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; -import org.eclipse.daanse.xmla.api.common.properties.PropertyListElementDefinition; -import org.eclipse.daanse.xmla.api.engine.ImpersonationInfo; -import org.eclipse.daanse.xmla.api.engine300.AttributeHierarchyProcessingState; -import org.eclipse.daanse.xmla.api.engine300.CalculationPropertiesVisualizationProperties; -import org.eclipse.daanse.xmla.api.engine300.DimensionAttributeVisualizationProperties; -import org.eclipse.daanse.xmla.api.engine300.HierarchyVisualizationProperties; -import org.eclipse.daanse.xmla.api.engine300.RelationshipEndVisualizationProperties; -import org.eclipse.daanse.xmla.api.engine300_300.Relationship; -import org.eclipse.daanse.xmla.api.engine300_300.RelationshipEnd; -import org.eclipse.daanse.xmla.api.engine300_300.RelationshipEndTranslation; -import org.eclipse.daanse.xmla.api.engine300_300.Relationships; -import org.eclipse.daanse.xmla.api.engine300_300.XEvent; -import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; -import org.eclipse.daanse.xmla.api.xmla.*; -import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.catalogs.DbSchemaCatalogsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.columns.DbSchemaColumnsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.providertypes.DbSchemaProviderTypesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.schemata.DbSchemaSchemataRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.sourcetables.DbSchemaSourceTablesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.tables.DbSchemaTablesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.tablesinfo.DbSchemaTablesInfoRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.datasources.DiscoverDataSourcesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.enumerators.DiscoverEnumeratorsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.keywords.DiscoverKeywordsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.literals.DiscoverLiteralsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.properties.DiscoverPropertiesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.schemarowsets.DiscoverSchemaRowsetsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.xmlmetadata.DiscoverXmlMetaDataRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.actions.MdSchemaActionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.cubes.MdSchemaCubesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.demensions.MdSchemaDimensionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.functions.MdSchemaFunctionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.hierarchies.MdSchemaHierarchiesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.kpis.MdSchemaKpisRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.levels.MdSchemaLevelsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measures.MdSchemaMeasuresRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.members.MdSchemaMembersRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.properties.MdSchemaPropertiesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.sets.MdSchemaSetsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.engine.ImpersonationInfoR; -import org.eclipse.daanse.xmla.model.record.engine200_200.ExpressionBindingR; -import org.eclipse.daanse.xmla.model.record.engine200_200.RowNumberBindingR; -import org.eclipse.daanse.xmla.model.record.engine300.CalculationPropertiesVisualizationPropertiesR; -import org.eclipse.daanse.xmla.model.record.engine300.DimensionAttributeVisualizationPropertiesR; -import org.eclipse.daanse.xmla.model.record.engine300.HierarchyVisualizationPropertiesR; -import org.eclipse.daanse.xmla.model.record.engine300.RelationshipEndVisualizationPropertiesR; -import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipEndR; -import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipEndTranslationR; -import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipR; -import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipsR; -import org.eclipse.daanse.xmla.model.record.engine300_300.XEventR; -import org.eclipse.daanse.xmla.model.record.execute.ExecuteParameterR; -import org.eclipse.daanse.xmla.model.record.xmla.*; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.NodeList; - -import jakarta.xml.soap.Node; -import jakarta.xml.soap.SOAPElement; - -public class Convert { - - private Convert() { - // constructor - } - - public static DiscoverPropertiesRestrictionsR discoverPropertiesRestrictions(SOAPElement restriction) { - 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(pnList); - } - - public static PropertiesR propertiestoProperties(SOAPElement propertiesElement) { - - Iterator nodeIterator = propertiesElement.getChildElements(); - while (nodeIterator.hasNext()) { - Node node = nodeIterator.next(); - if (node instanceof SOAPElement propertyList - && Constants.MSXMLA.QN_PROPERTY_LIST.equals(propertyList.getElementQName())) { - return propertyListToProperties(propertyList); - } - - } - return new PropertiesR(); - - } - - public static List parametersToParameters(SOAPElement parametersElement) { - - List parameters = new ArrayList(); - - Iterator nodeIteratorParameterList = parametersElement.getChildElements(); - while (nodeIteratorParameterList.hasNext()) { - Node n = nodeIteratorParameterList.next(); - - if (n instanceof SOAPElement parameterElement) { - Iterator parameterList = parameterElement.getChildElements(); - String name = null; - String value = null; - while (parameterList.hasNext()) { - Node n1 = parameterList.next(); - if (n1 instanceof SOAPElement pElement) { - if ("name".equalsIgnoreCase(pElement.getLocalName())) { - name = pElement.getTextContent(); - } - if ("value".equalsIgnoreCase(pElement.getLocalName())) { - value = pElement.getTextContent(); - } - } - } - if (name != null && value != null) { - parameters.add(new ExecuteParameterR(name, value)); - } - } - } - return parameters; - - } - - private static PropertiesR propertyListToProperties(SOAPElement propertyList) { - PropertiesR properties = new PropertiesR(); - - Iterator nodeIteratorPropertyList = propertyList.getChildElements(); - while (nodeIteratorPropertyList.hasNext()) { - Node n = nodeIteratorPropertyList.next(); - - if (n instanceof SOAPElement propertyListElement) { - String name = propertyListElement.getLocalName(); - Optional opd = PropertyListElementDefinition.byNameValue(name); - if (opd.isPresent()) { - opd.ifPresent(pd -> properties.addProperty(pd, propertyListElement.getTextContent())); - } else { - properties.setByname(name, propertyListElement.getTextContent()); - } - } - } - return properties; - } - - public static MdSchemaFunctionsRestrictionsR discoverMdSchemaFunctionsRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new MdSchemaFunctionsRestrictionsR( - Optional.ofNullable(m.get(FUNCTION_NAME)), - Optional.ofNullable(OriginEnum.fromValue(m.get(ORIGIN))), - Optional.ofNullable(InterfaceNameEnum.fromValue(m.get(INTERFACE_NAME))), - Optional.ofNullable(m.get(LIBRARY_NAME)) - ); - } - - - public static MdSchemaDimensionsRestrictionsR discoverMdSchemaDimensionsRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(DIMENSION_NAME)), - Optional.ofNullable(m.get(DIMENSION_UNIQUE_NAME)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(VisibilityEnum.fromValue(m.get(DIMENSION_VISIBILITY))) - ); - } - - public static MdSchemaCubesRestrictionsR discoverMdSchemaCubesRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(CubeTypeEnum.fromValue(m.get(CUBE_TYPE))), - Optional.ofNullable(m.get(BASE_CUBE_NAME)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE)))); - } - - public static MdSchemaMeasureGroupsRestrictionsR discoverMdSchemaMeasureGroups(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(MEASUREGROUP_NAME)) - ); - } - - public static MdSchemaKpisRestrictionsR discoverMdSchemaKpisRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(KPI_NAME)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))) - ); - } - - public static MdSchemaSetsRestrictionsR discoverMdSchemaSetsRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(SET_NAME)), - Optional.ofNullable(ScopeEnum.fromValue(m.get(SCOPE))), - Optional.ofNullable(m.get(SET_CAPTION)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(m.get(HIERARCHY_UNIQUE_NAME)) - ); - } - - public static MdSchemaPropertiesRestrictionsR discoverMdSchemaPropertiesRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(DIMENSION_UNIQUE_NAME)), - Optional.ofNullable(m.get(HIERARCHY_UNIQUE_NAME)), - Optional.ofNullable(m.get(LEVEL_UNIQUE_NAME)), - Optional.ofNullable(m.get(MEMBER_UNIQUE_NAME)), - Optional.ofNullable(m.get(PROPERTY_NAME2)), - Optional.ofNullable(PropertyTypeEnum.fromValue(m.get(PROPERTY_TYPE))), - Optional.ofNullable(PropertyContentTypeEnum.fromValue(m.get(PROPERTY_CONTENT_TYPE))), - Optional.ofNullable(PropertyOriginEnum.fromValue(m.get(PROPERTY_ORIGIN))), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(VisibilityEnum.fromValue(m.get(PROPERTY_VISIBILITY))) - ); - } - - public static MdSchemaMembersRestrictionsR discoverMdSchemaMembersRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(DIMENSION_UNIQUE_NAME)), - Optional.ofNullable(m.get(HIERARCHY_UNIQUE_NAME)), - Optional.ofNullable(m.get(LEVEL_UNIQUE_NAME)), - Optional.ofNullable(toInteger(m.get(LEVEL_NUMBER))), - Optional.ofNullable(m.get(MEMBER_NAME)), - Optional.ofNullable(m.get(MEMBER_UNIQUE_NAME)), - Optional.ofNullable(MemberTypeEnum.fromValue(m.get(MEMBER_TYPE))), - Optional.ofNullable(m.get(MEMBER_CAPTION)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(TreeOpEnum.fromValue(m.get(TREE_OP))) - ); - } - - public static MdSchemaMeasuresRestrictionsR discoverMdSchemaMeasuresRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(MEASURE_NAME)), - Optional.ofNullable(m.get(MEASURE_UNIQUE_NAME)), - Optional.ofNullable(m.get(MEASUREGROUP_NAME)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(VisibilityEnum.fromValue(m.get(MEASURE_VISIBILITY))) - ); - } - - public static MdSchemaMeasureGroupDimensionsRestrictionsR discoverMdSchemaMeasureGroupDimensionsRestrictions( - SOAPElement restriction - ) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(DIMENSION_UNIQUE_NAME)), - Optional.ofNullable(m.get(MEASUREGROUP_NAME)), - Optional.ofNullable(VisibilityEnum.fromValue(m.get(DIMENSION_VISIBILITY))) - ); - } - - public static MdSchemaLevelsRestrictionsR discoverMdSchemaLevelsRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(DIMENSION_UNIQUE_NAME)), - Optional.ofNullable(m.get(HIERARCHY_UNIQUE_NAME)), - Optional.ofNullable(m.get(LEVEL_NAME)), - Optional.ofNullable(m.get(LEVEL_UNIQUE_NAME)), - Optional.empty(), - Optional.empty(), - // how to handle cubesource? -// Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(VisibilityEnum.fromValue(m.get(DIMENSION_VISIBILITY))) - ); - } - - public static MdSchemaHierarchiesRestrictionsR discoverMdSchemaHierarchiesRestrictions(SOAPElement restriction) { - Map 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)), - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME)), - Optional.ofNullable(m.get(DIMENSION_UNIQUE_NAME)), - Optional.ofNullable(m.get(HIERARCHY_NAME)), - Optional.ofNullable(m.get(HIERARCHY_UNIQUE_NAME)), - Optional.ofNullable(toInteger(m.get(HIERARCHY_ORIGIN))), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), - Optional.ofNullable(VisibilityEnum.fromValue(m.get(HIERARCHY_VISIBILITY))) - ); - } - - - public static DbSchemaTablesInfoRestrictionsR discoverDbSchemaTablesInfo(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DbSchemaTablesInfoRestrictionsR( - Optional.ofNullable(m.get(TABLE_CATALOG)), - Optional.ofNullable(m.get(TABLE_SCHEMA)), - m.get(TABLE_NAME), - TableTypeEnum.fromValue(m.get(TABLE_TYPE)) - ); - } - - public static DbSchemaSourceTablesRestrictionsR discoverDbSchemaSourceTablesRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DbSchemaSourceTablesRestrictionsR( - Optional.ofNullable(m.get(TABLE_CATALOG)), - Optional.ofNullable(m.get(TABLE_SCHEMA)), - m.get(TABLE_NAME), - TableTypeEnum.fromValue(m.get(TABLE_TYPE)) - ); - } - - public static DbSchemaSchemataRestrictionsR discoverDbSchemaSchemataRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DbSchemaSchemataRestrictionsR( - m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME), - m.get(Constants.ROWSET.ROW_PROPERTY.SCHEMA_NAME), - m.get(SCHEMA_OWNER) - ); - } - - public static DbSchemaProviderTypesRestrictionsR discoverDbSchemaProviderTypesRestrictions(SOAPElement restriction) { - Map 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 m = getRestrictionMap(restriction); - return new DbSchemaColumnsRestrictionsR( - Optional.ofNullable(m.get(TABLE_CATALOG)), - Optional.ofNullable(m.get(TABLE_SCHEMA)), - Optional.ofNullable(m.get(TABLE_NAME)), - Optional.ofNullable(m.get(COLUMN_NAME)), - Optional.ofNullable(ColumnOlapTypeEnum.fromValue(m.get(COLUMN_OLAP_TYPE))) - ); - } - - public static DiscoverXmlMetaDataRestrictionsR discoverDiscoverXmlMetaDataRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverXmlMetaDataRestrictionsR( - Optional.ofNullable(m.get(OBJECT_TYPE)), - Optional.ofNullable(m.get(DATABASE_ID)), - Optional.ofNullable(m.get(DIMENSION_ID)), - Optional.ofNullable(m.get(CUBE_ID)), - Optional.ofNullable(m.get(MEASURE_GROUP_ID)), - Optional.ofNullable(m.get(PARTITION_ID)), - Optional.ofNullable(m.get(PERSPECTIVE_ID)), - Optional.ofNullable(m.get(DIMENSION_PERMISSION_ID)), - Optional.ofNullable(m.get(ROLE_ID)), - Optional.ofNullable(m.get(DATABASE_PERMISSION_ID)), - Optional.ofNullable(m.get(MINING_MODEL_ID)), - Optional.ofNullable(m.get(MINING_MODEL_PERMISSION_ID)), - Optional.ofNullable(m.get(DATA_SOURCE_ID)), - Optional.ofNullable(m.get(MINING_STRUCTURE_ID)), - Optional.ofNullable(m.get(AGGREGATION_DESIGN_ID)), - Optional.ofNullable(m.get(TRACE_ID)), - Optional.ofNullable(m.get(MINING_STRUCTURE_PERMISSION_ID)), - Optional.ofNullable(m.get(CUBE_PERMISSION_ID)), - Optional.ofNullable(m.get(ASSEMBLY_ID)), - Optional.ofNullable(m.get(MDX_SCRIPT_ID)), - Optional.ofNullable(m.get(DATA_SOURCE_VIEW_ID)), - Optional.ofNullable(m.get(DATA_SOURCE_PERMISSION_ID)), - Optional.ofNullable(ObjectExpansionEnum.fromValue(m.get(OBJECT_EXPANSION))) - ); - } - - public static DiscoverCsdlMetaDataRestrictionsR discoverDiscoverCsdlMetaDataRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverCsdlMetaDataRestrictionsR( - Optional.ofNullable(m.get(CATALOG_NAME)), - Optional.ofNullable(m.get(PERSPECTIVE_NAME)), - Optional.ofNullable(m.get(VERSION)) - ); - } - - public static DiscoverDataSourcesRestrictionsR discoverDiscoverDataSourcesRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverDataSourcesRestrictionsR( - m.get(DATA_SOURCE_NAME), - Optional.ofNullable(m.get(DATA_SOURCE_DESCRIPTION)), - Optional.ofNullable(m.get(URL)), - Optional.ofNullable(m.get(DATA_SOURCE_INFO)), - m.get(PROVIDER_NAME), - Optional.ofNullable(ProviderTypeEnum.fromValue(m.get(PROVIDER_TYPE))), - Optional.ofNullable(AuthenticationModeEnum.fromValue(m.get(AUTHENTICATION_MODE))) - ); - } - - public static DbSchemaCatalogsRestrictionsR discoverDbSchemaCatalogsRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DbSchemaCatalogsRestrictionsR( - Optional.ofNullable(m.get(Constants.ROWSET.ROW_PROPERTY.CATALOG_NAME)) - ); - } - - public static DiscoverSchemaRowsetsRestrictionsR discoverSchemaRowsetsRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverSchemaRowsetsRestrictionsR( - Optional.ofNullable(m.get(SCHEMA_NAME_LOW)) - ); - } - - public static DiscoverEnumeratorsRestrictionsR discoverDiscoverEnumerators(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverEnumeratorsRestrictionsR( - Optional.ofNullable(m.get(ENUM_NAME)) - ); - } - - public static DiscoverKeywordsRestrictionsR discoverKeywordsRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverKeywordsRestrictionsR( - Optional.ofNullable(m.get(KEYWORD)) - ); - } - - public static DiscoverLiteralsRestrictionsR discoverLiteralsRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DiscoverLiteralsRestrictionsR( - Optional.ofNullable(m.get(LITERAL_NAME)) - ); - } - - public static DbSchemaTablesRestrictionsR discoverDbSchemaTablesRestrictions(SOAPElement restriction) { - Map m = getRestrictionMap(restriction); - return new DbSchemaTablesRestrictionsR( - Optional.ofNullable(m.get(TABLE_CATALOG)), - Optional.ofNullable(m.get(TABLE_SCHEMA)), - Optional.ofNullable(m.get(TABLE_NAME)), - Optional.ofNullable(m.get(TABLE_TYPE)) - ); - } - - - public static MdSchemaActionsRestrictionsR discoverMdSchemaActionsRestrictions(SOAPElement restriction) { - Map 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)), - m.get(Constants.ROWSET.ROW_PROPERTY.CUBE_NAME), - Optional.ofNullable(m.get(ACTION_NAME)), - //Optional.ofNullable(ActionTypeEnum.fromValue(m.get(ACTION_TYPE))), //wrong value from excel - Optional.empty(), - Optional.ofNullable(m.get(COORDINATE)), - CoordinateTypeEnum.fromValue(m.get(COORDINATE_TYPE)), - m.get(INVOCATION)==null ? null : InvocationEnum.fromValue(m.get(INVOCATION)), - Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))) - ); - } - - public static Command commandtoCommand(SOAPElement element) { - Iterator nodeIterator = element.getChildElements(); - while (nodeIterator.hasNext()) { - Node n= nodeIterator.next(); - if (n instanceof SOAPElement) { - Command command = getCommand(n); - if (command != null) { - return command; - } - } - } - return null; - } - - public static Optional getSession(SOAPElement soapHeader) { - NodeList nl = soapHeader.getElementsByTagNameNS("urn:schemas-microsoft-com:xml-analysis", "Session"); - if (nl != null && nl.getLength() > 0) { - NamedNodeMap nnm = nl.item(0).getAttributes(); - org.w3c.dom.Node n = nnm.getNamedItem("SessionId"); - org.w3c.dom.Node n1 = nnm.getNamedItem("mustUnderstand"); - String sId = null; - Integer mustUnderstand = null; - if (n != null) { - sId = n.getNodeValue(); - } - if (n1 != null) { - mustUnderstand = toInteger(n1.getNodeValue()); - } - return Optional.of(new SessionR(sId, mustUnderstand)); - } - return Optional.empty(); - } - - public static Optional getEndSession(SOAPElement soapHeader) { - NodeList nl = soapHeader.getElementsByTagNameNS("urn:schemas-microsoft-com:xml-analysis", "EndSession"); - if (nl != null && nl.getLength() > 0) { - NamedNodeMap nnm = nl.item(0).getAttributes(); - org.w3c.dom.Node n = nnm.getNamedItem("SessionId"); - org.w3c.dom.Node n1 = nnm.getNamedItem("mustUnderstand"); - String sId = null; - Integer mustUnderstand = null; - if (n != null) { - sId = n.getNodeValue(); - } - if (n1 != null) { - mustUnderstand = toInteger(n1.getNodeValue()); - } - return Optional.of(new EndSessionR(sId, mustUnderstand)); - } - return Optional.empty(); - } - - public static Optional getBeginSession(SOAPElement soapHeader) { - NodeList nl = soapHeader.getElementsByTagNameNS("urn:schemas-microsoft-com:xml-analysis", "BeginSession"); - if (nl != null && nl.getLength() > 0) { - NamedNodeMap nnm = nl.item(0).getAttributes(); - org.w3c.dom.Node n = nnm.getNamedItem("mustUnderstand"); - Integer mustUnderstand = null; - if (n != null) { - mustUnderstand = toInteger(n.getNodeValue()); - } - return Optional.of(new BeginSessionR(mustUnderstand)); - } - return Optional.empty(); - } - - - private static Command getCommand(NodeList nl) { - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node n = nl.item(i); - Command command = getCommand(n); - if (command != null) { - return command; - } - } - throw new IllegalArgumentException("Illegal command"); - } - - private static Command getCommand(org.w3c.dom.Node n) { - String nodeName = n.getNodeName(); - if (STATEMENT.equals(nodeName)) { - return new StatementR(n.getTextContent()); - } - if (ALTER.equals(nodeName)) { - return getAlterCommand(n.getChildNodes()); - } - if (CLEAR_CACHE.equals(nodeName)) { - return getClearCacheCommand(n.getChildNodes()); - } - if (CANCEL.equals(nodeName)) { - return getCancelCommand(n.getChildNodes()); - } - return null; - } - - private static Command getCancelCommand(NodeList nl) { - Map map = getMapValues(nl); - BigInteger connectionID = toBigInteger(map.get(CONNECTION_ID)); - String sessionID = map.get(SESSION_ID); - BigInteger spid = toBigInteger(map.get(SPID)); - Boolean cancelAssociated = toBoolean(map.get(CANCEL_ASSOCIATED)); - - return new CancelR(connectionID, sessionID, spid, cancelAssociated); - } - - private static Command getClearCacheCommand(NodeList nl) { - ObjectReference object = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null && OBJECT2.equals(node.getNodeName())) { - object = getObjectReference(node.getChildNodes()); - break; - } - } - return new ClearCacheR(object); - } - - private static ObjectReference getObjectReference(NodeList nl) { - Map map = getMapValues(nl); - return new ObjectReferenceR( - map.get(SERVER_ID), - map.get(DATABASE_ID), - map.get(ROLE_ID), - map.get(TRACE_ID), - map.get(ASSEMBLY_ID), - map.get(DIMENSION_ID), - map.get(DIMENSION_PERMISSION_ID), - map.get(DATA_SOURCE_ID), - map.get(DATA_SOURCE_PERMISSION_ID), - map.get(DATABASE_PERMISSION_ID), - map.get(DATA_SOURCE_VIEW_ID), - map.get(CUBE_ID), - map.get(MINING_STRUCTURE_ID), - map.get(MEASURE_GROUP_ID), - map.get(PERSPECTIVE_ID), - map.get(CUBE_PERMISSION_ID), - map.get(MDX_SCRIPT_ID), - map.get(PARTITION_ID), - map.get(AGGREGATION_DESIGN_ID), - map.get(MINING_MODEL_ID), - map.get(MINING_MODEL_PERMISSION_ID), - map.get(MINING_STRUCTURE_PERMISSION_ID) - ); - } - - private static Command getAlterCommand(NodeList nl) { - ObjectReference object = null; - MajorObject objectDefinition = null; - Scope scope = null; - Boolean allowCreate = null; - ObjectExpansion objectExpansion = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (OBJECT2.equals(node.getNodeName())) { - object = getObjectReference(node.getChildNodes()); - } - if (OBJECT_DEFINITION.equals(node.getNodeName())) { - objectDefinition = getMajorObject(node.getChildNodes()); - } - if (SCOPE2.equals(node.getNodeName())) { - scope = Scope.fromValue(node.getTextContent()); - } - if (ALLOW_CREATE.equals(node.getNodeName())) { - allowCreate = toBoolean(node.getTextContent()); - } - if (OBJECT_EXPANSION.equals(node.getNodeName())) { - objectExpansion = ObjectExpansion.fromValue(node.getTextContent()); - } - } - - } - return new AlterR(object, - objectDefinition, - scope, - allowCreate, - objectExpansion); - } - - private static MajorObject getMajorObject(NodeList nl) { - AggregationDesign aggregationDesign = null; - Assembly assembly = null; - Cube cube = null; - Database database = null; - DataSource dataSource = null; - DataSourceView dataSourceView = null; - Dimension dimension = null; - MdxScript mdxScript = null; - MeasureGroup measureGroup = null; - MiningModel miningModel = null; - MiningStructure miningStructure = null; - Partition partition = null; - Permission permission = null; - Perspective perspective = null; - Role role = null; - Server server = null; - Trace trace = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("AggregationDesign".equals(node.getNodeName())) { - aggregationDesign = getAggregationDesign(node.getChildNodes()); - } - if (ASSEMBLY2.equals(node.getNodeName())) { - assembly = getAssembly(node.getChildNodes()); - } - if (CUBE2.equals(node.getNodeName())) { - cube = getCube(node.getChildNodes()); - } - if ("Database".equals(node.getNodeName())) { - database = getDatabase(node.getChildNodes()); - } - if ("DataSource".equals(node.getNodeName())) { - dataSource = getDataSource(node.getChildNodes()); - } - if ("DataSourceView".equals(node.getNodeName())) { - dataSourceView = getDataSourceView(node.getChildNodes()); - } - if (DIMENSION.equals(node.getNodeName())) { - dimension = getDimension(node.getChildNodes()); - } - if ("MdxScript".equals(node.getNodeName())) { - mdxScript = getMdxScript(node.getChildNodes()); - } - if (MEASURE_GROUP.equals(node.getNodeName())) { - measureGroup = getMeasureGroup(node.getChildNodes()); - } - if ("MiningModel".equals(node.getNodeName())) { - miningModel = getMiningModel(node.getChildNodes()); - } - if ("MiningStructure".equals(node.getNodeName())) { - miningStructure = getMiningStructure(node.getChildNodes()); - } - if ("Partition".equals(node.getNodeName())) { - partition = getPartition(node.getChildNodes()); - } - if ("Permission".equals(node.getNodeName())) { - permission = getPermission(node.getChildNodes()); - } - if ("Perspective".equals(node.getNodeName())) { - perspective = getPerspective(node.getChildNodes()); - } - if (ROLE2.equals(node.getNodeName())) { - role = getRole(node.getChildNodes()); - } - if ("Server".equals(node.getNodeName())) { - server = getServer(node.getChildNodes()); - } - if ("Trace".equals(node.getNodeName())) { - trace = getTrace(node.getChildNodes()); - } - } - } - return new MajorObjectR( - aggregationDesign, - assembly, - cube, - database, - dataSource, - dataSourceView, - dimension, - mdxScript, - measureGroup, - miningModel, - miningStructure, - partition, - permission, - perspective, - role, - server, - trace - ); - } - - private static Trace getTrace(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String logFileName = null; - Boolean logFileAppend = null; - Long logFileSize = null; - Boolean audit = null; - Boolean logFileRollover = null; - Boolean autoRestart = null; - Instant stopTime = null; - TraceFilter filter = null; - EventType eventType = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("LogFileName".equals(node.getNodeName())) { - logFileName = node.getTextContent(); - } - if ("LogFileAppend".equals(node.getNodeName())) { - logFileAppend = toBoolean(node.getTextContent()); - } - if ("LogFileSize".equals(node.getNodeName())) { - logFileSize = toLong(node.getTextContent()); - } - if ("Audit".equals(node.getNodeName())) { - audit = toBoolean(node.getTextContent()); - } - if ("LogFileRollover".equals(node.getNodeName())) { - logFileRollover = toBoolean(node.getTextContent()); - } - if ("AutoRestart".equals(node.getNodeName())) { - autoRestart = toBoolean(node.getTextContent()); - } - if ("StopTime".equals(node.getNodeName())) { - stopTime = toInstant(node.getTextContent()); - } - if (FILTER.equals(node.getNodeName())) { - filter = getTraceFilter(node.getChildNodes()); - } - if ("EventType".equals(node.getNodeName())) { - eventType = getEventType(node.getChildNodes()); - } - } - } - return new TraceR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - logFileName, - logFileAppend, - logFileSize, - audit, - logFileRollover, - autoRestart, - stopTime, - filter, - eventType - ); - } - - private static EventType getEventType(NodeList nl) { - List events = null; - XEvent xEvent = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Events".equals(node.getNodeName())) { - events = getEventList(node.getChildNodes()); - } - if ("XEvent".equals(node.getNodeName())) { - xEvent = getXEvent(node.getChildNodes()); - } - } - } - return new EventTypeR(events, xEvent); - } - - private static XEvent getXEvent(NodeList nl) { - EventSession eventSession = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("event_session".equals(node.getNodeName()))) { - eventSession = getEventSession(node.getChildNodes()); - } - } - return new XEventR(eventSession); - } - - private static EventSession getEventSession(NodeList nl) { - String templateCategory = null; - String templateName = null; - String templateDescription = null; - List event = new ArrayList<>(); - List target = new ArrayList<>(); - String name = null; - BigInteger maxMemory = null; - RetentionModes eventRetentionMode = null; - Long dispatchLatency = null; - Long maxEventSize = null; - PartitionModes memoryPartitionMode = null; - Boolean trackCausality = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("templateCategory".equals(node.getNodeName())) { - templateCategory = node.getTextContent(); - } - if ("templateName".equals(node.getNodeName())) { - templateName = node.getTextContent(); - } - if ("templateDescription".equals(node.getNodeName())) { - templateDescription = node.getTextContent(); - } - if ("event".equals(node.getNodeName())) { - event.add(node.getTextContent()); - } - if ("target".equals(node.getNodeName())) { - target.add(node.getTextContent()); - } - NamedNodeMap nm = node.getAttributes(); - name = getAttribute(nm, "name"); - maxMemory = toBigInteger(getAttribute(nm, "maxMemory")); - eventRetentionMode = RetentionModes.fromValue(getAttribute(nm, "eventRetentionMode")); - dispatchLatency = toLong(getAttribute(nm, "dispatchLatency")); - maxEventSize = toLong(getAttribute(nm, "maxEventSize")); - memoryPartitionMode = PartitionModes.fromValue(getAttribute(nm, "memoryPartitionMode")); - trackCausality = toBoolean(getAttribute(nm, "trackCausality")); - } - } - return new EventSessionR( - templateCategory, - templateName, - templateDescription, - event, - target, - name, - maxMemory, - eventRetentionMode, - dispatchLatency, - maxEventSize, - memoryPartitionMode, - trackCausality - ); - } - - private static List getEventList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Event".equals(node.getNodeName()))) { - list.add(getEvent(node.getChildNodes())); - } - } - return list; - } - - private static Event getEvent(NodeList nl) { - String eventID = null; - EventColumnID columns = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (EVENT_ID.equals(node.getNodeName())) { - eventID = node.getTextContent(); - } - if (COLUMNS.equals(node.getNodeName())) { - columns = getEventColumnID(node.getChildNodes()); - } - } - } - return new EventR(eventID, columns); - } - - private static EventColumnID getEventColumnID(NodeList nl) { - List columnID = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (EVENT_ID.equals(node.getNodeName()))) { - columnID.add(node.getTextContent()); - } - } - return new EventColumnIDR(columnID); - } - - private static TraceFilter getTraceFilter(NodeList nl) { - NotType not = null; - AndOrType or = null; - AndOrType and = null; - BoolBinop isEqual = null; - BoolBinop notEqual = null; - BoolBinop less = null; - BoolBinop lessOrEqual = null; - BoolBinop greater = null; - BoolBinop greaterOrEqual = null; - BoolBinop like = null; - BoolBinop notLike = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Not".equals(node.getNodeName())) { - not = getNotType(node.getChildNodes()); - } - if ("Or".equals(node.getNodeName())) { - or = getAndOrType(node.getChildNodes()); - } - if ("Or".equals(node.getNodeName())) { - or = getAndOrType(node.getChildNodes()); - } - if ("And".equals(node.getNodeName())) { - and = getAndOrType(node.getChildNodes()); - } - if (EQUAL.equals(node.getNodeName())) { - isEqual = getBoolBinop(node.getChildNodes()); - } - if (NOT_EQUAL.equals(node.getNodeName())) { - notEqual = getBoolBinop(node.getChildNodes()); - } - if ("Less".equals(node.getNodeName())) { - less = getBoolBinop(node.getChildNodes()); - } - if (LESS_OR_EQUAL.equals(node.getNodeName())) { - lessOrEqual = getBoolBinop(node.getChildNodes()); - } - if (GREATER.equals(node.getNodeName())) { - greater = getBoolBinop(node.getChildNodes()); - } - if (GREATER_OR_EQUAL.equals(node.getNodeName())) { - greaterOrEqual = getBoolBinop(node.getChildNodes()); - } - if ("Like".equals(node.getNodeName())) { - like = getBoolBinop(node.getChildNodes()); - } - if (NOT_LIKE.equals(node.getNodeName())) { - notLike = getBoolBinop(node.getChildNodes()); - } - } - } - return new TraceFilterR( - not, - or, - and, - isEqual, - notEqual, - less, - lessOrEqual, - greater, - greaterOrEqual, - like, - notLike - ); - } - - private static BoolBinop getBoolBinop(NodeList nl) { - String columnID = null; - String value = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("ColumnID".equals(node.getNodeName())) { - columnID = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = node.getTextContent(); - } - } - } - return new BoolBinopR(columnID, value); - } - - private static AndOrType getAndOrType(NodeList nl) { - List notOrOrOrAnd = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Not".equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.Not); - } - if ("Or".equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.Or); - } - if ("And".equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.And); - } - if (EQUAL.equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.Equal); - } - if (NOT_EQUAL.equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.NotEqual); - } - if ("Less".equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.Less); - } - if (LESS_OR_EQUAL.equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.LessOrEqual); - } - if (GREATER.equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.Greater); - } - if (GREATER_OR_EQUAL.equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.GreaterOrEqual); - } - if ("Like".equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.Like); - } - if (NOT_LIKE.equals(node.getNodeName())) { - notOrOrOrAnd.add(AndOrTypeEnum.NotLike); - } - } - } - return new AndOrTypeR(notOrOrOrAnd); - } - - private static NotType getNotType(NodeList nl) { - NotType not = null; - AndOrType or = null; - AndOrType and = null; - BoolBinop isEqual = null; - BoolBinop notEqual = null; - BoolBinop less = null; - BoolBinop lessOrEqual = null; - BoolBinop greater = null; - BoolBinop greaterOrEqual = null; - BoolBinop like = null; - BoolBinop notLike = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Not".equals(node.getNodeName())) { - not = getNotType(node.getChildNodes()); - } - if ("Or".equals(node.getNodeName())) { - or = getAndOrType(node.getChildNodes()); - } - if ("And".equals(node.getNodeName())) { - and = getAndOrType(node.getChildNodes()); - } - if (EQUAL.equals(node.getNodeName())) { - isEqual = getBoolBinop(node.getChildNodes()); - } - if (NOT_EQUAL.equals(node.getNodeName())) { - notEqual = getBoolBinop(node.getChildNodes()); - } - if ("Less".equals(node.getNodeName())) { - less = getBoolBinop(node.getChildNodes()); - } - if (LESS_OR_EQUAL.equals(node.getNodeName())) { - lessOrEqual = getBoolBinop(node.getChildNodes()); - } - if (GREATER.equals(node.getNodeName())) { - greater = getBoolBinop(node.getChildNodes()); - } - if (GREATER_OR_EQUAL.equals(node.getNodeName())) { - greaterOrEqual = getBoolBinop(node.getChildNodes()); - } - if ("Like".equals(node.getNodeName())) { - like = getBoolBinop(node.getChildNodes()); - } - if (NOT_LIKE.equals(node.getNodeName())) { - notLike = getBoolBinop(node.getChildNodes()); - } - - } - } - return new NotTypeR( - not, - or, - and, - isEqual, - notEqual, - less, - lessOrEqual, - greater, - greaterOrEqual, - like, - notLike); - } - - private static Instant toInstant(String it) { - return it != null ? Instant.parse(it) : null; - } - - private static Server getServer(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String productName = null; - String edition = null; - Long editionID = null; - String version = null; - String serverMode = null; - String productLevel = null; - Long defaultCompatibilityLevel = null; - String supportedCompatibilityLevels = null; - List databases = null; - List assemblies = null; - List traces = null; - List roles = null; - List serverProperties = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("ProductName".equals(node.getNodeName())) { - productName = node.getTextContent(); - } - if ("Edition".equals(node.getNodeName())) { - edition = node.getTextContent(); - } - if ("EditionID".equals(node.getNodeName())) { - editionID = toLong(node.getTextContent()); - } - if ("Version".equals(node.getNodeName())) { - version = node.getTextContent(); - } - if ("ServerMode".equals(node.getNodeName())) { - serverMode = node.getTextContent(); - } - if ("ProductLevel".equals(node.getNodeName())) { - productLevel = node.getTextContent(); - } - if ("DefaultCompatibilityLevel".equals(node.getNodeName())) { - defaultCompatibilityLevel = toLong(node.getTextContent()); - } - if ("SupportedCompatibilityLevels".equals(node.getNodeName())) { - supportedCompatibilityLevels = node.getTextContent(); - } - if ("Databases".equals(node.getNodeName())) { - databases = getDatabaseList(node.getChildNodes()); - } - if ("Assemblies".equals(node.getNodeName())) { - assemblies = getAssemblyList(node.getChildNodes()); - } - if ("Traces".equals(node.getNodeName())) { - traces = getTraceList(node.getChildNodes()); - } - if ("Roles".equals(node.getNodeName())) { - roles = getRoleList(node.getChildNodes()); - } - if ("ServerProperties".equals(node.getNodeName())) { - serverProperties = getServerPropertyList(node.getChildNodes()); - } - } - } - return new ServerR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - productName, - edition, - editionID, - version, - serverMode, - productLevel, - defaultCompatibilityLevel, - supportedCompatibilityLevels, - databases, - assemblies, - traces, - roles, - serverProperties - ); - } - - private static List getRoleList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ROLE2.equals(node.getNodeName()))) { - list.add(getRole(node.getChildNodes())); - } - } - return list; - } - - private static List getServerPropertyList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("ServerProperty".equals(node.getNodeName()))) { - list.add(getServerProperty(node.getChildNodes())); - } - } - return list; - } - - private static ServerProperty getServerProperty(NodeList nl) { - String name = null; - String value = null; - Boolean requiresRestart = null; - java.lang.Object pendingValue = null; - java.lang.Object defaultValue = null; - Boolean displayFlag = null; - String type = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = node.getTextContent(); - } - if ("RequiresRestart".equals(node.getNodeName())) { - requiresRestart = toBoolean(node.getTextContent()); - } - if ("PendingValue".equals(node.getNodeName())) { - pendingValue = node.getTextContent(); - } - if ("DefaultValue".equals(node.getNodeName())) { - pendingValue = node.getTextContent(); - } - if ("DisplayFlag".equals(node.getNodeName())) { - displayFlag = toBoolean(node.getTextContent()); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - } - } - return new ServerPropertyR( - name, - value, - requiresRestart, - pendingValue, - defaultValue, - displayFlag, - type); - } - - private static List getTraceList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Trace".equals(node.getNodeName()))) { - list.add(getTrace(node.getChildNodes())); - } - } - return list; - } - - private static List getAssemblyList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ASSEMBLY2.equals(node.getNodeName()))) { - list.add(getAssembly(node.getChildNodes())); - } - } - return list; - } - - private static List getDatabaseList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Database".equals(node.getNodeName()))) { - list.add(getDatabase(node.getChildNodes())); - } - } - return list; - } - - private static Role getRole(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - List members = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - - if ("Members".equals(node.getNodeName())) { - members = getMemberList(node.getChildNodes()); - } - } - } - return new RoleR( - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - Optional.ofNullable(members) - ); - } - - private static List getMemberList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Member".equals(node.getNodeName()))) { - list.add(getMember(node.getChildNodes())); - } - } - return list; - } - - private static Member getMember(NodeList nl) { - String name = null; - String sid = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if ("Sid".equals(node.getNodeName())) { - sid = node.getTextContent(); - } - } - } - return new MemberR(Optional.ofNullable(name), - Optional.ofNullable(sid)); - } - - private static Perspective getPerspective(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - List translations = null; - String defaultMeasure = null; - List dimensions = null; - List measureGroups = null; - List calculations = null; - List kpis = null; - List actions = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if ("DefaultMeasure".equals(node.getNodeName())) { - defaultMeasure = node.getTextContent(); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = getPerspectiveDimensionList(node.getChildNodes()); - } - if ("MeasureGroups".equals(node.getNodeName())) { - measureGroups = getPerspectiveMeasureGroupList(node.getChildNodes()); - } - if ("Calculations".equals(node.getNodeName())) { - calculations = getPerspectiveCalculationList(node.getChildNodes()); - } - if ("Kpis".equals(node.getNodeName())) { - kpis = getPerspectiveKpiList(node.getChildNodes()); - } - if ("Actions".equals(node.getNodeName())) { - actions = getPerspectiveActionList(node.getChildNodes()); - } - } - } - return new PerspectiveR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - translations, - defaultMeasure, - dimensions, - measureGroups, - calculations, - kpis, - actions); - } - - private static List getPerspectiveActionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ACTION.equals(node.getNodeName()))) { - list.add(getPerspectiveAction(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveAction getPerspectiveAction(NodeList nl) { - String actionID = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("ActionID".equals(node.getNodeName())) { - actionID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveActionR(actionID, Optional.ofNullable(annotations)); - } - - private static List getPerspectiveKpiList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ACTION.equals(node.getNodeName()))) { - list.add(getPerspectiveKpi(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveKpi getPerspectiveKpi(NodeList nl) { - String kpiID = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("KpiID".equals(node.getNodeName())) { - kpiID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveKpiR(kpiID, Optional.ofNullable(annotations)); - } - - private static List getPerspectiveCalculationList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Calculation".equals(node.getNodeName()))) { - list.add(getPerspectiveCalculation(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveCalculation getPerspectiveCalculation(NodeList nl) { - - String name = null; - String type = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveCalculationR(name, type, Optional.ofNullable(annotations)); - } - - private static List getPerspectiveMeasureGroupList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (MEASURE_GROUP.equals(node.getNodeName()))) { - list.add(getPerspectiveMeasureGroup(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveMeasureGroup getPerspectiveMeasureGroup(NodeList nl) { - String measureGroupID = null; - List measures = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (MEASURE_GROUP_ID.equals(node.getNodeName())) { - measureGroupID = node.getTextContent(); - } - if (MEASURES.equals(node.getNodeName())) { - measures = getPerspectiveMeasureList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveMeasureGroupR( - measureGroupID, - Optional.ofNullable(measures), - Optional.ofNullable(annotations) - ); - } - - private static List getPerspectiveMeasureList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (MEASURE.equals(node.getNodeName()))) { - list.add(getPerspectiveMeasure(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveMeasure getPerspectiveMeasure(NodeList nl) { - String measureID = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (MEASURE_ID.equals(node.getNodeName())) { - measureID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveMeasureR(measureID, - annotations); - } - - private static List getPerspectiveDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (DIMENSION.equals(node.getNodeName()))) { - list.add(getPerspectiveDimension(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveDimension getPerspectiveDimension(NodeList nl) { - String cubeDimensionID = null; - List attributes = null; - List hierarchies = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getPerspectiveAttributeList(node.getChildNodes()); - } - if (HIERARCHIES.equals(node.getNodeName())) { - hierarchies = getPerspectiveHierarchyList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveDimensionR(cubeDimensionID, - Optional.ofNullable(attributes), - Optional.ofNullable(hierarchies), - Optional.ofNullable(annotations)); - } - - private static List getPerspectiveHierarchyList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (HIERARCHY.equals(node.getNodeName()))) { - list.add(getPerspectiveHierarchy(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveHierarchy getPerspectiveHierarchy(NodeList nl) { - String hierarchyID = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("HierarchyID".equals(node.getNodeName())) { - hierarchyID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveHierarchyR(hierarchyID, - Optional.ofNullable(annotations)); - } - - private static List getPerspectiveAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE.equals(node.getNodeName()))) { - list.add(getPerspectiveAttribute(node.getChildNodes())); - } - } - return list; - } - - private static PerspectiveAttribute getPerspectiveAttribute(NodeList nl) { - String attributeID = null; - Boolean attributeHierarchyVisible = null; - String defaultMember = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if (ATTRIBUTE_HIERARCHY_VISIBLE.equals(node.getNodeName())) { - attributeHierarchyVisible = toBoolean(node.getTextContent()); - } - if (DEFAULT_MEMBER.equals(node.getNodeName())) { - defaultMember = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new PerspectiveAttributeR( - attributeID, - Optional.ofNullable(attributeHierarchyVisible), - Optional.ofNullable(defaultMember), - Optional.ofNullable(annotations) - ); - } - - private static List getTranslationList(NodeList nl, String nodeName) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (nodeName.equals(node.getNodeName()))) { - list.add(getTranslation(node.getChildNodes())); - } - } - return list; - } - - private static Translation getTranslation(NodeList nl) { - long language = 0; - String caption = null; - String description = null; - String displayFolder = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (LANGUAGE.equals(node.getNodeName())) { - language = toLong(node.getTextContent()); - } - if (CAPTION.equals(node.getNodeName())) { - caption = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new TranslationR( - language, - caption, - description, - displayFolder, - annotations); - } - - private static Permission getPermission(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - } - } - return new PermissionR( - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write)); - } - - private static Partition getPartition(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - TabularBinding source = null; - BigInteger processingPriority = null; - String aggregationPrefix = null; - Partition.StorageMode storageMode = null; - String processingMode = null; - ErrorConfiguration errorConfiguration = null; - String storageLocation = null; - String remoteDatasourceID = null; - String slice = null; - ProactiveCaching proactiveCaching = null; - String type = null; - Long estimatedSize = null; - Long estimatedRows = null; - Partition.CurrentStorageMode currentStorageMode = null; - String aggregationDesignID = null; - List aggregationInstances = null; - DataSourceViewBinding aggregationInstanceSource = null; - Instant lastProcessed = null; - String state = null; - Integer stringStoresCompatibilityLevel = null; - Integer currentStringStoresCompatibilityLevel = null; - String directQueryUsage = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (SOURCE.equals(node.getNodeName())) { - source = getTabularBinding(node.getChildNodes(), getNodeType(node)); - } - if (PROCESSING_PRIORITY.equals(node.getNodeName())) { - processingPriority = toBigInteger(node.getTextContent()); - } - if (AGGREGATION_PREFIX.equals(node.getNodeName())) { - aggregationPrefix = node.getTextContent(); - } - if (STORAGE_MODE.equals(node.getNodeName())) { - storageMode = getPartitionStorageMode(node.getChildNodes()); - } - if (PROCESSING_MODE.equals(node.getNodeName())) { - processingMode = node.getTextContent(); - } - if (ERROR_CONFIGURATION.equals(node.getNodeName())) { - errorConfiguration = getErrorConfiguration(node.getChildNodes()); - } - if (STORAGE_LOCATION.equals(node.getNodeName())) { - storageLocation = node.getTextContent(); - } - if ("RemoteDatasourceID".equals(node.getNodeName())) { - remoteDatasourceID = node.getTextContent(); - } - if ("Slice".equals(node.getNodeName())) { - slice = node.getTextContent(); - } - if (PROACTIVE_CACHING.equals(node.getNodeName())) { - proactiveCaching = getProactiveCaching(node.getChildNodes()); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - if (ESTIMATED_SIZE.equals(node.getNodeName())) { - estimatedSize = toLong(node.getTextContent()); - } - if (ESTIMATED_ROWS.equals(node.getNodeName())) { - estimatedRows = toLong(node.getTextContent()); - } - if ("CurrentStorageMode".equals(node.getNodeName())) { - currentStorageMode = getPartitionCurrentStorageMode(node.getChildNodes()); - } - if (AGGREGATION_DESIGN_ID.equals(node.getNodeName())) { - aggregationDesignID = node.getTextContent(); - } - if ("AggregationInstances".equals(node.getNodeName())) { - aggregationInstances = getAggregationInstanceList(node.getChildNodes()); - } - if ("AggregationInstanceSource".equals(node.getNodeName())) { - aggregationInstanceSource = getDataSourceViewBinding(node.getChildNodes()); - } - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if ("StringStoresCompatibilityLevel".equals(node.getNodeName())) { - stringStoresCompatibilityLevel = toInteger(node.getTextContent()); - } - if ("CurrentStringStoresCompatibilityLevel".equals(node.getNodeName())) { - currentStringStoresCompatibilityLevel = toInteger(node.getTextContent()); - } - if ("DirectQueryUsage".equals(node.getNodeName())) { - directQueryUsage = node.getTextContent(); - } - } - } - - return new PartitionR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - source, - processingPriority, - aggregationPrefix, - storageMode, - processingMode, - errorConfiguration, - storageLocation, - remoteDatasourceID, - slice, - proactiveCaching, - type, - estimatedSize, - estimatedRows, - currentStorageMode, - aggregationDesignID, - aggregationInstances, - aggregationInstanceSource, - lastProcessed, - state, - stringStoresCompatibilityLevel, - currentStringStoresCompatibilityLevel, - directQueryUsage - ); - } - - private static DataSourceViewBinding getDataSourceViewBinding(NodeList childNodes) { - Map map = getMapValues(childNodes); - return new DataSourceViewBindingR(map.get("DataSourceViewID")); - } - - private static List getAggregationInstanceList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("AggregationInstance".equals(node.getNodeName()))) { - list.add(getAggregationInstance(node.getChildNodes())); - } - } - return list; - } - - private static AggregationInstance getAggregationInstance(NodeList nl) { - String id = null; - String name = null; - String aggregationType = null; - TabularBinding source = null; - List dimensions = null; - List measures = null; - List annotations = null; - String description = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("AggregationType".equals(node.getNodeName())) { - aggregationType = node.getTextContent(); - } - if (SOURCE.equals(node.getNodeName())) { - source = getTabularBinding(node.getChildNodes(), getNodeType(node)); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = getAggregationInstanceDimensionList(node.getChildNodes()); - } - if (MEASURES.equals(node.getNodeName())) { - measures = getAggregationInstanceMeasureList(node.getChildNodes()); - } - } - } - return new AggregationInstanceR( - id, - name, - aggregationType, - source, - dimensions, - measures, - annotations, - description); - } - - private static List getAggregationInstanceMeasureList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (MEASURE.equals(node.getNodeName()))) { - list.add(getAggregationInstanceMeasure(node.getChildNodes())); - } - } - return list; - } - - private static AggregationInstanceMeasure getAggregationInstanceMeasure(NodeList nl) { - String measureID = null; - ColumnBinding source = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (MEASURE_ID.equals(node.getNodeName())) { - measureID = node.getTextContent(); - } - if (MEASURE_ID.equals(node.getNodeName())) { - source = getColumnBinding(node.getChildNodes()); - } - } - } - return new AggregationInstanceMeasureR(measureID, - source); - } - - private static ColumnBinding getColumnBinding(NodeList nl) { - String tableID = null; - String columnID = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (TABLE_ID.equals(node.getNodeName())) { - tableID = node.getTextContent(); - } - if ("ColumnID".equals(node.getNodeName())) { - columnID = node.getTextContent(); - } - } - } - return new ColumnBindingR(tableID, columnID); - } - - private static List getAggregationInstanceDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (DIMENSION.equals(node.getNodeName()))) { - list.add(getAggregationInstanceDimension(node.getChildNodes())); - } - } - return list; - } - - private static AggregationInstanceDimension getAggregationInstanceDimension(NodeList nl) { - String cubeDimensionID = null; - List attributes = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getAggregationInstanceAttributeList(node.getChildNodes()); - } - } - } - return new AggregationInstanceDimensionR(cubeDimensionID, Optional.ofNullable(attributes)); - } - - private static List getAggregationInstanceAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE.equals(node.getNodeName()))) { - list.add(getAggregationInstanceAttribute(node.getChildNodes())); - } - } - return list; - } - - private static AggregationInstanceAttribute getAggregationInstanceAttribute(NodeList nl) { - String attributeID = null; - List keyColumns = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - keyColumns = getDataItemList(node.getChildNodes(), KEY_COLUMN); - } - } - } - return new AggregationInstanceAttributeR(attributeID, - Optional.ofNullable(keyColumns)); - } - - private static List getDataItemList(NodeList nl, String nodeName) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (nodeName.equals(node.getNodeName()))) { - list.add(getDataItem(node.getChildNodes())); - } - } - return list; - } - - private static DataItem getDataItem(NodeList nl) { - String dataType = null; - Integer dataSize = null; - String mimeType = null; - NullProcessingEnum nullProcessing = null; - String trimming = null; - InvalidXmlCharacterEnum invalidXmlCharacters = null; - String collation = null; - DataItemFormatEnum format = null; - Binding source = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("DataType".equals(node.getNodeName())) { - dataType = node.getTextContent(); - } - if ("DataSize".equals(node.getNodeName())) { - dataSize = toInteger(node.getTextContent()); - } - if ("MimeType".equals(node.getNodeName())) { - mimeType = node.getTextContent(); - } - if ("NullProcessing".equals(node.getNodeName())) { - nullProcessing = NullProcessingEnum.fromValue(node.getTextContent()); - } - if ("Trimming".equals(node.getNodeName())) { - trimming = node.getTextContent(); - } - if ("InvalidXmlCharacters".equals(node.getNodeName())) { - invalidXmlCharacters = InvalidXmlCharacterEnum.fromValue(node.getTextContent()); - } - if (COLLATION.equals(node.getNodeName())) { - collation = node.getTextContent(); - } - if ("Format".equals(node.getNodeName())) { - format = DataItemFormatEnum.fromValue(node.getTextContent()); - } - if (SOURCE.equals(node.getNodeName())) { - source = getBinding(node.getChildNodes(), getNodeType(node)); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new DataItemR(dataType, - Optional.ofNullable(dataSize), - Optional.ofNullable(mimeType), - Optional.ofNullable(nullProcessing), - Optional.ofNullable(trimming), - Optional.ofNullable(invalidXmlCharacters), - Optional.ofNullable(collation), - Optional.ofNullable(format), - Optional.ofNullable(source), - Optional.ofNullable(annotations)); - } - - private static Binding getBinding(NodeList nl, String type) { - if ("ColumnBinding".equals(type)) { - return getColumnBinding(nl); - } - if ("RowBinding".equals(type)) { - return getRowBinding(nl); - } - if ("DataSourceViewBinding".equals(type)) { - return getDataSourceViewBinding(nl); - } - if ("AttributeBinding".equals(type)) { - return getAttributeBinding(nl); - } - if ("UserDefinedGroupBinding".equals(type)) { - return getUserDefinedGroupBinding(nl); - } - if ("MeasureBinding".equals(type)) { - return getMeasureBinding(nl); - } - if ("CubeAttributeBinding".equals(type)) { - return getCubeAttributeBinding(nl); - } - if ("DimensionBinding".equals(type)) { - return getDimensionBinding(nl); - } - if ("CubeDimensionBinding".equals(type)) { - return getCubeDimensionBinding(nl); - } - if ("MeasureGroupBinding".equals(type)) { - return getMeasureGroupBinding(nl); - } - if ("MeasureGroupDimensionBinding".equals(type)) { - return getMeasureGroupDimensionBinding(nl); - } - if ("TimeBinding".equals(type)) { - return getTimeBinding(nl); - } - if ("TimeAttributeBinding".equals(type)) { - return getTimeAttributeBinding(); - } - if ("InheritedBinding".equals(type)) { - return getInheritedBinding(); - } - if ("CalculatedMeasureBinding".equals(type)) { - return getCalculatedMeasureBinding(nl); - } - if ("RowNumberBinding".equals(type)) { - return getRowNumberBinding(); - } - if ("ExpressionBinding".equals(type)) { - return getExpressionBinding(nl); - } - return null; - } - - private static Binding getExpressionBinding(NodeList nl) { - String expression = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (EXPRESSION.equals(node.getNodeName()))) { - expression = node.getTextContent(); - } - } - return new ExpressionBindingR(expression); - } - - private static Binding getRowNumberBinding() { - return new RowNumberBindingR(); - } - - private static Binding getCalculatedMeasureBinding(NodeList nl) { - String measureName = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MeasureName".equals(node.getNodeName()))) { - measureName = node.getTextContent(); - } - } - return new CalculatedMeasureBindingR(measureName); - } - - private static Binding getInheritedBinding() { - return new InheritedBindingR(); - } - - private static Binding getTimeAttributeBinding() { - return new TimeAttributeBindingR(); - } - - private static Binding getTimeBinding(NodeList nl) { - Instant calendarStartDate = null; - Instant calendarEndDate = null; - Integer firstDayOfWeek = null; - BigInteger calendarLanguage = null; - Integer fiscalFirstMonth = null; - Integer fiscalFirstDayOfMonth = null; - FiscalYearNameEnum fiscalYearName = null; - Integer reportingFirstMonth = null; - String reportingFirstWeekOfMonth = null; - ReportingWeekToMonthPatternEnum reportingWeekToMonthPattern = null; - Integer manufacturingFirstMonth = null; - Integer manufacturingFirstWeekOfMonth = null; - Integer manufacturingExtraMonthQuarter = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("CalendarStartDate".equals(node.getNodeName())) { - calendarStartDate = toInstant(node.getTextContent()); - } - if ("CalendarEndDate".equals(node.getNodeName())) { - calendarEndDate = toInstant(node.getTextContent()); - } - if ("FirstDayOfWeek".equals(node.getNodeName())) { - firstDayOfWeek = toInteger(node.getTextContent()); - } - if ("CalendarLanguage".equals(node.getNodeName())) { - calendarLanguage = toBigInteger(node.getTextContent()); - } - if ("FiscalFirstMonth".equals(node.getNodeName())) { - fiscalFirstMonth = toInteger(node.getTextContent()); - } - if ("FiscalFirstDayOfMonth".equals(node.getNodeName())) { - fiscalFirstDayOfMonth = toInteger(node.getTextContent()); - } - if ("FiscalYearName".equals(node.getNodeName())) { - fiscalYearName = FiscalYearNameEnum.fromValue(node.getTextContent()); - } - if ("ReportingFirstMonth".equals(node.getNodeName())) { - reportingFirstMonth = toInteger(node.getTextContent()); - } - if ("ReportingFirstWeekOfMonth".equals(node.getNodeName())) { - reportingFirstWeekOfMonth = node.getTextContent(); - } - if ("ReportingWeekToMonthPattern".equals(node.getNodeName())) { - reportingWeekToMonthPattern = ReportingWeekToMonthPatternEnum.fromValue(node.getTextContent()); - } - if ("ManufacturingFirstMonth".equals(node.getNodeName())) { - manufacturingFirstMonth = toInteger(node.getTextContent()); - } - if ("ManufacturingFirstWeekOfMonth".equals(node.getNodeName())) { - manufacturingFirstWeekOfMonth = toInteger(node.getTextContent()); - } - if ("ManufacturingExtraMonthQuarter".equals(node.getNodeName())) { - manufacturingExtraMonthQuarter = toInteger(node.getTextContent()); - } - } - } - return new TimeBindingR( - calendarStartDate, - calendarEndDate, - Optional.ofNullable(firstDayOfWeek), - Optional.ofNullable(calendarLanguage), - Optional.ofNullable(fiscalFirstMonth), - Optional.ofNullable(fiscalFirstDayOfMonth), - Optional.ofNullable(fiscalYearName), - Optional.ofNullable(reportingFirstMonth), - Optional.ofNullable(reportingFirstWeekOfMonth), - Optional.ofNullable(reportingWeekToMonthPattern), - Optional.ofNullable(manufacturingFirstMonth), - Optional.ofNullable(manufacturingFirstWeekOfMonth), - Optional.ofNullable(manufacturingExtraMonthQuarter) - ); - } - - private static Binding getMeasureGroupDimensionBinding(NodeList nl) { - String cubeDimensionID = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (CUBE_DIMENSION_ID.equals(node.getNodeName()))) { - cubeDimensionID = node.getTextContent(); - } - } - return new MeasureGroupDimensionBindingR(cubeDimensionID); - - } - - private static Binding getCubeDimensionBinding(NodeList nl) { - String dataSourceID = null; - String cubeID = null; - String cubeDimensionID = null; - String filter = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (DATA_SOURCE_ID.equals(node.getNodeName())) { - dataSourceID = node.getTextContent(); - } - if (CUBE_ID.equals(node.getNodeName())) { - cubeID = node.getTextContent(); - } - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (FILTER.equals(node.getNodeName())) { - filter = node.getTextContent(); - } - } - } - return new CubeDimensionBindingR( - dataSourceID, - cubeID, - cubeDimensionID, - Optional.ofNullable(filter) - ); - - } - - private static Binding getDimensionBinding(NodeList nl) { - String dataSourceID = null; - String dimensionID = null; - PersistenceEnum persistence = null; - RefreshPolicyEnum refreshPolicy = null; - Duration refreshInterval = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (DATA_SOURCE_ID.equals(node.getNodeName())) { - dataSourceID = node.getTextContent(); - } - if (DIMENSION_ID.equals(node.getNodeName())) { - dimensionID = node.getTextContent(); - } - if ("Persistence".equals(node.getNodeName())) { - persistence = PersistenceEnum.fromValue(node.getTextContent()); - } - if ("RefreshPolicy".equals(node.getNodeName())) { - refreshPolicy = RefreshPolicyEnum.fromValue(node.getTextContent()); - } - if (REFRESH_INTERVAL.equals(node.getNodeName())) { - refreshInterval = toDuration(node.getTextContent()); - } - } - } - return new DimensionBindingR( - dataSourceID, - dimensionID, - Optional.ofNullable(persistence), - Optional.ofNullable(refreshPolicy), - Optional.ofNullable(refreshInterval) - ); - - } - - private static Binding getCubeAttributeBinding(NodeList nl) { - String cubeID = null; - String cubeDimensionID = null; - String attributeID = null; - AttributeBindingTypeEnum type = null; - List ordinal = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_ID.equals(node.getNodeName())) { - cubeID = node.getTextContent(); - } - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = AttributeBindingTypeEnum.fromValue(node.getTextContent()); - } - if (ORDINAL.equals(node.getNodeName())) { - ordinal = getOrdinalList(node.getChildNodes()); - } - } - } - - return new CubeAttributeBindingR( - cubeID, - cubeDimensionID, - attributeID, - type, - Optional.ofNullable(ordinal) - ); - - } - - private static List getOrdinalList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ORDINAL.equals(node.getNodeName()))) { - list.add(toBigInteger(node.getTextContent())); - } - } - return list; - } - - private static Binding getMeasureBinding(NodeList nl) { - String measureID = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (MEASURE_ID.equals(node.getNodeName()))) { - measureID = node.getTextContent(); - } - } - return new MeasureBindingR(measureID); - } - - private static Binding getUserDefinedGroupBinding(NodeList nl) { - String attributeID = null; - List groups = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if ("Groups".equals(node.getNodeName())) { - groups = getGroupList(node.getChildNodes()); - } - } - } - return new UserDefinedGroupBindingR(attributeID, Optional.ofNullable(groups)); - } - - private static List getGroupList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Group".equals(node.getNodeName()))) { - list.add(getGroup(node.getChildNodes())); - } - } - return list; - } - - private static Group getGroup(NodeList nl) { - String name = null; - List members = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if ("Members".equals(node.getNodeName())) { - members = getMemberStringList(node.getChildNodes()); - } - } - } - return new GroupR( - name, - Optional.ofNullable(members) - ); - } - - private static List getMemberStringList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Member".equals(node.getNodeName()))) { - list.add(node.getTextContent()); - } - } - return list; - } - - private static Binding getAttributeBinding(NodeList nl) { - String attributeID = null; - AttributeBindingTypeEnum type = null; - Integer ordinal = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = AttributeBindingTypeEnum.fromValue(node.getTextContent()); - } - if (ORDINAL.equals(node.getNodeName())) { - ordinal = toInteger(node.getTextContent()); - } - } - } - return new AttributeBindingR(attributeID, type, Optional.ofNullable(ordinal)); - } - - private static Binding getRowBinding(NodeList nl) { - String tableID = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (TABLE_ID.equals(node.getNodeName()))) { - tableID = node.getTextContent(); - } - } - return new RowBindingR(tableID); - } - - private static Partition.CurrentStorageMode getPartitionCurrentStorageMode(NodeList nl) { - PartitionCurrentStorageModeEnumType value = null; - String valuens = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - value = PartitionCurrentStorageModeEnumType.fromValue(node.getTextContent()); - valuens = getAttribute(node.getAttributes(), VALUENS); - } - } - return new PartitionR.CurrentStorageMode(value, valuens); - } - - private static ProactiveCaching getProactiveCaching(NodeList nl) { - String onlineMode = null; - String aggregationStorage = null; - ProactiveCachingBinding source = null; - Duration silenceInterval = null; - Duration latency = null; - Duration silenceOverrideInterval = null; - Duration forceRebuildInterval = null; - Boolean enabled = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("OnlineMode".equals(node.getNodeName())) { - onlineMode = node.getTextContent(); - } - if ("AggregationStorage".equals(node.getNodeName())) { - aggregationStorage = node.getTextContent(); - } - if (SOURCE.equals(node.getNodeName())) { - source = getProactiveCachingBinding(node.getChildNodes(), - getNodeType(node)); - } - if ("SilenceInterval".equals(node.getNodeName())) { - silenceInterval = toDuration(node.getTextContent()); - } - if ("Latency".equals(node.getNodeName())) { - latency = toDuration(node.getTextContent()); - } - if ("SilenceOverrideInterval".equals(node.getNodeName())) { - silenceOverrideInterval = toDuration(node.getTextContent()); - } - if ("ForceRebuildInterval".equals(node.getNodeName())) { - forceRebuildInterval = toDuration(node.getTextContent()); - } - if ("Enabled".equals(node.getNodeName())) { - enabled = toBoolean(node.getTextContent()); - } - } - } - return new ProactiveCachingR(Optional.ofNullable(onlineMode), - Optional.ofNullable(aggregationStorage), - Optional.ofNullable(source), - Optional.ofNullable(silenceInterval), - Optional.ofNullable(latency), - Optional.ofNullable(silenceOverrideInterval), - Optional.ofNullable(forceRebuildInterval), - Optional.ofNullable(enabled)); - } - - private static Duration toDuration(String it) { - return it != null ? Duration.parse(it) : null; - } - - private static ProactiveCachingBinding getProactiveCachingBinding(NodeList childNodes, String type) { - if ("ProactiveCachingQueryBinding".equals(type)) { - return getProactiveCachingQueryBinding(); - } - if ("ProactiveCachingIncrementalProcessingBinding".equals(type)) { - return getProactiveCachingIncrementalProcessingBinding(childNodes); - } - return null; - } - - private static ProactiveCachingBinding getProactiveCachingIncrementalProcessingBinding(NodeList nl) { - Duration refreshInterval = null; - List incrementalProcessingNotifications = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (REFRESH_INTERVAL.equals(node.getNodeName())) { - refreshInterval = toDuration(node.getTextContent()); - } - if ("IncrementalProcessingNotifications".equals(node.getNodeName())) { - incrementalProcessingNotifications = getIncrementalProcessingNotificationList(node.getChildNodes()); - } - - } - } - return new ProactiveCachingIncrementalProcessingBindingR(Optional.ofNullable(refreshInterval), - incrementalProcessingNotifications); - } - - private static List getIncrementalProcessingNotificationList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("IncrementalProcessingNotification".equals(node.getNodeName()))) { - list.add(getIncrmentalProcessingNotification(node.getChildNodes())); - } - } - return list; - } - - private static IncrementalProcessingNotification getIncrmentalProcessingNotification(NodeList nl) { - String tableID = null; - String processingQuery = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (TABLE_ID.equals(node.getNodeName())) { - tableID = node.getTextContent(); - } - if ("ProcessingQuery".equals(node.getNodeName())) { - processingQuery = node.getTextContent(); - } - } - } - return new IncrementalProcessingNotificationR(tableID, processingQuery); - } - - private static ProactiveCachingBinding getProactiveCachingQueryBinding() { - return new ProactiveCachingBindingR(); - } - - private static ErrorConfiguration getErrorConfiguration(NodeList nl) { - Long keyErrorLimit = null; - String keyErrorLogFile = null; - String keyErrorAction = null; - String keyErrorLimitAction = null; - String keyNotFound = null; - String keyDuplicate = null; - String nullKeyConvertedToUnknown = null; - String nullKeyNotAllowed = null; - String calculationError = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("KeyErrorLimit".equals(node.getNodeName())) { - keyErrorLimit = toLong(node.getTextContent()); - } - if ("KeyErrorLogFile".equals(node.getNodeName())) { - keyErrorLogFile = node.getTextContent(); - } - if ("KeyErrorAction".equals(node.getNodeName())) { - keyErrorAction = node.getTextContent(); - } - if ("KeyErrorLimitAction".equals(node.getNodeName())) { - keyErrorLimitAction = node.getTextContent(); - } - if ("KeyNotFound".equals(node.getNodeName())) { - keyNotFound = node.getTextContent(); - } - if ("KeyDuplicate".equals(node.getNodeName())) { - keyDuplicate = node.getTextContent(); - } - if ("NullKeyConvertedToUnknown".equals(node.getNodeName())) { - nullKeyConvertedToUnknown = node.getTextContent(); - } - if ("NullKeyNotAllowed".equals(node.getNodeName())) { - nullKeyNotAllowed = node.getTextContent(); - } - if ("CalculationError".equals(node.getNodeName())) { - calculationError = node.getTextContent(); - } - } - } - return new ErrorConfigurationR( - Optional.ofNullable(keyErrorLimit), - Optional.ofNullable(keyErrorLogFile), - Optional.ofNullable(keyErrorAction), - Optional.ofNullable(keyErrorLimitAction), - Optional.ofNullable(keyNotFound), - Optional.ofNullable(keyDuplicate), - Optional.ofNullable(nullKeyConvertedToUnknown), - Optional.ofNullable(nullKeyNotAllowed), - Optional.ofNullable(calculationError)); - } - - private static Partition.StorageMode getPartitionStorageMode(NodeList nl) { - PartitionStorageModeEnumType value = null; - String valuens = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - value = PartitionStorageModeEnumType.fromValue(node.getTextContent()); - valuens = getAttribute(node.getAttributes(), VALUENS); - } - } - return new PartitionR.StorageMode(value, valuens); - } - - private static TabularBinding getTabularBinding(NodeList nl, String type) { - if ("TableBinding".equals(type)) { - return getTableBinding(nl); - } - if ("QueryBinding".equals(type)) { - return getQueryBinding(nl); - } - if ("DSVTableBinding".equals(type)) { - return getDSVTableBinding(nl); - } - return null; - } - - private static TabularBinding getDSVTableBinding(NodeList nl) { - String dataSourceViewID = null; - String tableID = null; - String dataEmbeddingStyle = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (DATA_SOURCE_VIEW_ID.equals(node.getNodeName())) { - dataSourceViewID = node.getTextContent(); - } - if (TABLE_ID.equals(node.getNodeName())) { - tableID = node.getTextContent(); - } - if ("DataEmbeddingStyle".equals(node.getNodeName())) { - dataEmbeddingStyle = node.getTextContent(); - } - } - } - return new DSVTableBindingR( - Optional.ofNullable(dataSourceViewID), - tableID, - Optional.ofNullable(dataEmbeddingStyle) - ); - } - - private static TabularBinding getQueryBinding(NodeList nl) { - String dataSourceID = null; - String queryDefinition = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (DATA_SOURCE_ID.equals(node.getNodeName())) { - dataSourceID = node.getTextContent(); - } - if ("QueryDefinition".equals(node.getNodeName())) { - queryDefinition = node.getTextContent(); - } - } - } - return new QueryBindingR( - Optional.ofNullable(dataSourceID), - queryDefinition - ); - } - - private static TabularBinding getTableBinding(NodeList nl) { - String dataSourceID = null; - String dbTableName = null; - String dbSchemaName = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (DATA_SOURCE_ID.equals(node.getNodeName())) { - dataSourceID = node.getTextContent(); - } - if ("DbTableName".equals(node.getNodeName())) { - dbTableName = node.getTextContent(); - } - if ("DbSchemaName".equals(node.getNodeName())) { - dbSchemaName = node.getTextContent(); - } - } - } - return new TableBindingR( - Optional.ofNullable(dataSourceID), - dbTableName, - Optional.ofNullable(dbSchemaName) - ); - } - - private static MiningStructure getMiningStructure(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - Binding source = null; - Instant lastProcessed = null; - List translations = null; - BigInteger language = null; - String collation = null; - ErrorConfiguration errorConfiguration = null; - String cacheMode = null; - Integer holdoutMaxPercent = null; - Integer holdoutMaxCases = null; - Integer holdoutSeed = null; - Integer holdoutActualSize = null; - List columns = null; - String state = null; - List miningStructurePermissions = null; - List miningModels = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (SOURCE.equals(node.getNodeName())) { - source = getBinding(node.getChildNodes(), getNodeType(node)); - } - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (LANGUAGE.equals(node.getNodeName())) { - language = toBigInteger(node.getTextContent()); - } - if (COLLATION.equals(node.getNodeName())) { - collation = node.getTextContent(); - } - if (ERROR_CONFIGURATION.equals(node.getNodeName())) { - errorConfiguration = getErrorConfiguration(node.getChildNodes()); - } - if ("CacheMode".equals(node.getNodeName())) { - cacheMode = node.getTextContent(); - } - if ("HoldoutMaxPercent".equals(node.getNodeName())) { - holdoutMaxPercent = toInteger(node.getTextContent()); - } - if ("HoldoutMaxCases".equals(node.getNodeName())) { - holdoutMaxCases = toInteger(node.getTextContent()); - } - if ("HoldoutSeed".equals(node.getNodeName())) { - holdoutSeed = toInteger(node.getTextContent()); - } - if ("HoldoutActualSize".equals(node.getNodeName())) { - holdoutSeed = toInteger(node.getTextContent()); - } - if (COLUMNS.equals(node.getNodeName())) { - columns = getMiningStructureColumnList(node.getChildNodes()); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if ("MiningStructurePermissions".equals(node.getNodeName())) { - miningStructurePermissions = getMiningStructurePermissionList(node.getChildNodes()); - } - if ("MiningModels".equals(node.getNodeName())) { - miningModels = getMiningModelList(node.getChildNodes()); - } - } - } - return new MiningStructureR( - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - Optional.ofNullable(source), - Optional.ofNullable(lastProcessed), - Optional.ofNullable(translations), - Optional.ofNullable(language), - Optional.ofNullable(collation), - Optional.ofNullable(errorConfiguration), - Optional.ofNullable(cacheMode), - Optional.ofNullable(holdoutMaxPercent), - Optional.ofNullable(holdoutMaxCases), - Optional.ofNullable(holdoutSeed), - Optional.ofNullable(holdoutActualSize), - columns, - Optional.ofNullable(state), - Optional.ofNullable(miningStructurePermissions), - Optional.ofNullable(miningModels) - ); - } - - private static List getMiningModelList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MiningModel".equals(node.getNodeName()))) { - list.add(getMiningModel(node.getChildNodes())); - } - } - return list; - } - - private static List getMiningStructurePermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MiningStructurePermission".equals(node.getNodeName()))) { - list.add(getMiningStructurePermission(node.getChildNodes())); - } - } - return list; - } - - private static MiningStructurePermission getMiningStructurePermission(NodeList nl) { - Boolean allowDrillThrough = null; - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ALLOW_DRILL_THROUGH.equals(node.getNodeName())) { - allowDrillThrough = toBoolean(node.getTextContent()); - } - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - } - } - return new MiningStructurePermissionR( - Optional.ofNullable(allowDrillThrough), - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write) - ); - } - - private static List getMiningStructureColumnList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MiningStructurePermission".equals(node.getNodeName()))) { - list.add( - getMiningStructureColumn( - node.getChildNodes(), - getNodeType(node) - ) - ); - } - } - return list; - } - - private static MiningStructureColumn getMiningStructureColumn( - NodeList nl, - String type) { - if ("ScalarMiningStructureColumn".equals(type)) { - return getScalarMiningStructureColumn(nl); - } - if ("ScalarMiningStructureColumn".equals(type)) { - return getTableMiningStructureColumn(nl); - } - return null; - } - - private static MiningStructureColumn getTableMiningStructureColumn(NodeList nl) { - List foreignKeyColumns = null; - MeasureGroupBinding sourceMeasureGroup = null; - List columns = null; - List translations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("ForeignKeyColumns".equals(node.getNodeName())) { - foreignKeyColumns = getDataItemList(node.getChildNodes(), "ForeignKeyColumn"); - } - if ("SourceMeasureGroup".equals(node.getNodeName())) { - sourceMeasureGroup = getMeasureGroupBinding(node.getChildNodes()); - } - if (COLUMNS.equals(node.getNodeName())) { - columns = getMiningStructureColumnList(node.getChildNodes()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - } - } - return new TableMiningStructureColumnR( - Optional.ofNullable(foreignKeyColumns), - Optional.ofNullable(sourceMeasureGroup), - Optional.ofNullable(columns), - Optional.ofNullable(translations) - ); - } - - private static MiningStructureColumn getScalarMiningStructureColumn(NodeList nl) { - String name = null; - String id = null; - String description = null; - String type = null; - List annotations = null; - Boolean isKey = null; - Binding source = null; - String distribution = null; - List modelingFlags = null; - String content = null; - List classifiedColumns = null; - String discretizationMethod = null; - BigInteger discretizationBucketCount = null; - List keyColumns = null; - DataItem nameColumn = null; - List translations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("IsKey".equals(node.getNodeName())) { - isKey = toBoolean(node.getTextContent()); - } - if (SOURCE.equals(node.getNodeName())) { - source = getBinding(node.getChildNodes(), getNodeType(node)); - } - if ("Distribution".equals(node.getNodeName())) { - distribution = node.getTextContent(); - } - if ("ModelingFlags".equals(node.getNodeName())) { - modelingFlags = getMiningModelingFlagList(node.getChildNodes()); - } - if ("Content".equals(node.getNodeName())) { - content = node.getTextContent(); - } - if ("ClassifiedColumns".equals(node.getNodeName())) { - classifiedColumns = getClassifiedColumnList(node.getChildNodes()); - } - if ("DiscretizationMethod".equals(node.getNodeName())) { - discretizationMethod = node.getTextContent(); - } - if ("DiscretizationBucketCount".equals(node.getNodeName())) { - discretizationBucketCount = toBigInteger(node.getTextContent()); - } - if (KEY_COLUMNS.equals(node.getNodeName())) { - keyColumns = getDataItemList(node.getChildNodes(), KEY_COLUMN); - } - if ("NameColumn".equals(node.getNodeName())) { - nameColumn = getDataItem(node.getChildNodes()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - } - } - return new ScalarMiningStructureColumnR( - name, - Optional.ofNullable(id), - Optional.ofNullable(description), - Optional.ofNullable(type), - Optional.ofNullable(annotations), - Optional.ofNullable(isKey), - Optional.ofNullable(source), - Optional.ofNullable(distribution), - Optional.ofNullable(modelingFlags), - content, - Optional.ofNullable(classifiedColumns), - Optional.ofNullable(discretizationMethod), - Optional.ofNullable(discretizationBucketCount), - Optional.ofNullable(keyColumns), - Optional.ofNullable(nameColumn), - Optional.ofNullable(translations) - ); - } - - private static List getClassifiedColumnList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("ClassifiedColumn".equals(node.getNodeName()))) { - list.add(node.getTextContent()); - } - } - return list; - } - - private static MiningModel getMiningModel(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String algorithm = null; - Instant lastProcessed = null; - List algorithmParameters = null; - Boolean allowDrillThrough = null; - List translations = null; - List columns = null; - String state = null; - FoldingParameters foldingParameters = null; - String filter = null; - List miningModelPermissions = null; - String language = null; - String collation = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Algorithm".equals(node.getNodeName())) { - algorithm = node.getTextContent(); - } - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - if ("AlgorithmParameters".equals(node.getNodeName())) { - algorithmParameters = getAlgorithmParameterList(node.getChildNodes()); - } - if (ALLOW_DRILL_THROUGH.equals(node.getNodeName())) { - allowDrillThrough = toBoolean(node.getTextContent()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getAttributeTranslationList(node.getChildNodes()); - } - if (COLUMNS.equals(node.getNodeName())) { - columns = getMiningModelColumnList(node.getChildNodes()); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if ("FoldingParameters".equals(node.getNodeName())) { - foldingParameters = getFoldingParameters(node.getChildNodes()); - } - if (FILTER.equals(node.getNodeName())) { - filter = node.getTextContent(); - } - if ("MiningModelPermissions".equals(node.getNodeName())) { - miningModelPermissions = getMiningModelPermissionList(node.getChildNodes()); - } - if (LANGUAGE.equals(node.getNodeName())) { - language = node.getTextContent(); - } - if (COLLATION.equals(node.getNodeName())) { - collation = node.getTextContent(); - } - } - } - return new MiningModelR( - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - algorithm, - Optional.ofNullable(lastProcessed), - Optional.ofNullable(algorithmParameters), - Optional.ofNullable(allowDrillThrough), - Optional.ofNullable(translations), - Optional.ofNullable(columns), - Optional.ofNullable(state), - Optional.ofNullable(foldingParameters), - Optional.ofNullable(filter), - Optional.ofNullable(miningModelPermissions), - Optional.ofNullable(language), - Optional.ofNullable(collation) - ); - } - - private static List getMiningModelPermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MiningModelPermission".equals(node.getNodeName()))) { - list.add(getMiningModelPermission(node.getChildNodes())); - } - } - return list; - } - - private static MiningModelPermission getMiningModelPermission(NodeList nl) { - Boolean allowDrillThrough = null; - Boolean allowBrowsing = null; - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ALLOW_DRILL_THROUGH.equals(node.getNodeName())) { - allowDrillThrough = toBoolean(node.getTextContent()); - } - if ("AllowBrowsing".equals(node.getNodeName())) { - allowBrowsing = toBoolean(node.getTextContent()); - } - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - } - } - return new MiningModelPermissionR( - Optional.ofNullable(allowDrillThrough), - Optional.ofNullable(allowBrowsing), - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write) - ); - } - - private static FoldingParameters getFoldingParameters(NodeList nl) { - Integer foldIndex = null; - Integer foldCount = null; - Long foldMaxCases = null; - String foldTargetAttribute = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("FoldIndex".equals(node.getNodeName())) { - foldIndex = toInteger(node.getTextContent()); - } - if ("FoldIndex".equals(node.getNodeName())) { - foldCount = toInteger(node.getTextContent()); - } - if ("FoldMaxCases".equals(node.getNodeName())) { - foldMaxCases = toLong(node.getTextContent()); - } - if ("FoldTargetAttribute".equals(node.getNodeName())) { - foldTargetAttribute = node.getTextContent(); - } - } - } - return new FoldingParametersR( - foldIndex, - foldCount, - Optional.ofNullable(foldMaxCases), - Optional.ofNullable(foldTargetAttribute) - ); - } - - private static List getMiningModelColumnList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MiningModelPermission".equals(node.getNodeName()))) { - list.add(getMiningModelColumn(node.getChildNodes())); - } - } - return list; - } - - private static MiningModelColumn getMiningModelColumn(NodeList nl) { - String name = null; - String id = null; - String description = null; - String sourceColumnID = null; - String usage = null; - String filter = null; - List translations = null; - List columns = null; - List modelingFlags = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if ("SourceColumnID".equals(node.getNodeName())) { - sourceColumnID = node.getTextContent(); - } - if ("Usage".equals(node.getNodeName())) { - usage = node.getTextContent(); - } - if (FILTER.equals(node.getNodeName())) { - filter = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (COLUMNS.equals(node.getNodeName())) { - columns = getMiningModelColumnList(node.getChildNodes()); - } - if ("ModelingFlags".equals(node.getNodeName())) { - modelingFlags = getMiningModelingFlagList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - - return new MiningModelColumnR( - name, - Optional.ofNullable(id), - Optional.ofNullable(description), - Optional.ofNullable(sourceColumnID), - Optional.ofNullable(usage), - Optional.ofNullable(filter), - Optional.ofNullable(translations), - Optional.ofNullable(columns), - Optional.ofNullable(modelingFlags), - Optional.ofNullable(annotations) - ); - } - - private static List getMiningModelingFlagList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("AlgorithmParameter".equals(node.getNodeName()))) { - list.add(getMiningModelingFlag(node.getChildNodes())); - } - } - return list; - } - - private static MiningModelingFlag getMiningModelingFlag(NodeList nl) { - String modelingFlag = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("ModelingFlag".equals(node.getNodeName()))) { - modelingFlag = node.getTextContent(); - break; - } - } - return new MiningModelingFlagR(Optional.ofNullable(modelingFlag)); - } - - private static List getAttributeTranslationList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (TRANSLATION.equals(node.getNodeName()))) { - list.add(getAttributeTranslation(node.getChildNodes())); - } - } - return list; - } - - private static AttributeTranslation getAttributeTranslation(NodeList nl) { - long language = 0; - String caption = null; - String description = null; - String displayFolder = null; - List annotations = null; - DataItem captionColumn = null; - String membersWithDataCaption = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (LANGUAGE.equals(node.getNodeName())) { - language = toLong(node.getTextContent()); - } - if (CAPTION.equals(node.getNodeName())) { - caption = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("CaptionColumn".equals(node.getNodeName())) { - captionColumn = getDataItem(node.getChildNodes()); - } - if ("MembersWithDataCaption".equals(node.getNodeName())) { - membersWithDataCaption = node.getTextContent(); - } - } - } - return new AttributeTranslationR( - language, - Optional.ofNullable(caption), - Optional.ofNullable(description), - Optional.ofNullable(displayFolder), - Optional.ofNullable(annotations), - Optional.ofNullable(captionColumn), - Optional.ofNullable(membersWithDataCaption) - ); - } - - private static List getAlgorithmParameterList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("AlgorithmParameter".equals(node.getNodeName()))) { - list.add(getAlgorithmParameter(node.getChildNodes())); - } - } - return list; - } - - private static AlgorithmParameter getAlgorithmParameter(NodeList nl) { - String name = null; - java.lang.Object value = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = node.getTextContent(); - } - } - } - return new AlgorithmParameterR( - name, - value - ); - } - - private static MeasureGroup getMeasureGroup(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - Instant lastProcessed = null; - List translations = null; - String type = null; - String state = null; - List measures = null; - String dataAggregation = null; - MeasureGroupBinding source = null; - MeasureGroup.StorageMode storageMode = null; - String storageLocation = null; - Boolean ignoreUnrelatedDimensions = null; - ProactiveCaching proactiveCaching = null; - Long estimatedRows = null; - ErrorConfiguration errorConfiguration = null; - Long estimatedSize = null; - String processingMode = null; - List dimensions = null; - List partitions = null; - String aggregationPrefix = null; - BigInteger processingPriority = null; - List aggregationDesigns = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if (MEASURES.equals(node.getNodeName())) { - measures = getMeasureList(node.getChildNodes()); - } - if ("DataAggregation".equals(node.getNodeName())) { - dataAggregation = node.getTextContent(); - } - if (SOURCE.equals(node.getNodeName())) { - source = getMeasureGroupBinding(node.getChildNodes()); - } - if (STORAGE_MODE.equals(node.getNodeName())) { - storageMode = getMeasureGroupStorageMode(node.getChildNodes()); - } - if (STORAGE_LOCATION.equals(node.getNodeName())) { - storageLocation = node.getTextContent(); - } - if ("IgnoreUnrelatedDimensions".equals(node.getNodeName())) { - ignoreUnrelatedDimensions = toBoolean(node.getTextContent()); - } - if (PROACTIVE_CACHING.equals(node.getNodeName())) { - proactiveCaching = getProactiveCaching(node.getChildNodes()); - } - if (ESTIMATED_ROWS.equals(node.getNodeName())) { - estimatedRows = toLong(node.getTextContent()); - } - if (ERROR_CONFIGURATION.equals(node.getNodeName())) { - errorConfiguration = getErrorConfiguration(node.getChildNodes()); - } - if (ESTIMATED_SIZE.equals(node.getNodeName())) { - estimatedSize = toLong(node.getTextContent()); - } - if (PROCESSING_MODE.equals(node.getNodeName())) { - processingMode = node.getTextContent(); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = getMeasureGroupDimensionList(node.getChildNodes()); - } - if ("Partitions".equals(node.getNodeName())) { - partitions = getPartitionList(node.getChildNodes()); - } - if (AGGREGATION_PREFIX.equals(node.getNodeName())) { - aggregationPrefix = node.getTextContent(); - } - if (PROCESSING_PRIORITY.equals(node.getNodeName())) { - processingPriority = toBigInteger(node.getTextContent()); - } - if ("AggregationDesigns".equals(node.getNodeName())) { - aggregationDesigns = getAggregationDesignList(node.getChildNodes()); - } - - } - } - return new MeasureGroupR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - lastProcessed, - translations, - type, - state, - measures, - dataAggregation, - source, - storageMode, - storageLocation, - ignoreUnrelatedDimensions, - proactiveCaching, - estimatedRows, - errorConfiguration, - estimatedSize, - processingMode, - dimensions, - partitions, - aggregationPrefix, - processingPriority, - aggregationDesigns - ); - } - - private static List getAggregationDesignList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("AggregationDesigns".equals(node.getNodeName()))) { - list.add(getAggregationDesign(node.getChildNodes())); - } - } - return list; - } - - private static List getPartitionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Partition".equals(node.getNodeName()))) { - list.add(getPartition(node.getChildNodes())); - } - } - return list; - } - - private static List getMeasureGroupDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (DIMENSIONS.equals(node.getNodeName()))) { - list.add(getMeasureGroupDimension(node.getChildNodes(), getNodeType(node))); - } - } - return list; - } - - private static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getMeasureGroupDimension(NodeList nl, String type) { - if ("ManyToManyMeasureGroupDimension".equals(type)) { - return getManyToManyMeasureGroupDimension(nl); - } - if ("RegularMeasureGroupDimension".equals(type)) { - return getRegularMeasureGroupDimension(nl); - } - if ("ReferenceMeasureGroupDimension".equals(type)) { - return getReferenceMeasureGroupDimension(nl); - } - if ("DegenerateMeasureGroupDimension".equals(type)) { - return getDegenerateMeasureGroupDimension(nl); - } - if ("DataMiningMeasureGroupDimension".equals(type)) { - return getDataMiningMeasureGroupDimension(nl); - } - return null; - } - - private static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getDataMiningMeasureGroupDimension(NodeList nl) { - String cubeDimensionID = null; - List annotations = null; - MeasureGroupDimensionBinding source = null; - String caseCubeDimensionID = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = (MeasureGroupDimensionBinding)getMeasureGroupDimensionBinding(node.getChildNodes()); - } - if ("CaseCubeDimensionID".equals(node.getNodeName())) { - caseCubeDimensionID = node.getTextContent(); - } - } - } - return new DataMiningMeasureGroupDimensionR( - cubeDimensionID, - annotations, - source, - caseCubeDimensionID - ); - } - - private static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getDegenerateMeasureGroupDimension(NodeList nl) { - String cubeDimensionID = null; - List annotations = null; - MeasureGroupDimensionBinding source = null; - String shareDimensionStorage = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = (MeasureGroupDimensionBinding)getMeasureGroupDimensionBinding(node.getChildNodes()); - } - - if ("ShareDimensionStorage".equals(node.getNodeName())) { - shareDimensionStorage = node.getTextContent(); - } - } - } - return new DegenerateMeasureGroupDimensionR( - cubeDimensionID, - annotations, - source, - shareDimensionStorage - ); - - } - - private static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getReferenceMeasureGroupDimension(NodeList nl) { - String cubeDimensionID = null; - List annotations = null; - MeasureGroupDimensionBinding source = null; - String intermediateCubeDimensionID = null; - String intermediateGranularityAttributeID = null; - String materialization = null; - String processingState = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = (MeasureGroupDimensionBinding)getMeasureGroupDimensionBinding(node.getChildNodes()); - } - - if ("IntermediateCubeDimensionID".equals(node.getNodeName())) { - intermediateCubeDimensionID = node.getTextContent(); - } - if ("IntermediateGranularityAttributeID".equals(node.getNodeName())) { - intermediateGranularityAttributeID = node.getTextContent(); - } - if ("Materialization".equals(node.getNodeName())) { - materialization = node.getTextContent(); - } - if (PROCESSING_STATE.equals(node.getNodeName())) { - processingState = node.getTextContent(); - } - } - } - return new ReferenceMeasureGroupDimensionR( - cubeDimensionID, - annotations, - source, - intermediateCubeDimensionID, - intermediateGranularityAttributeID, - materialization, - processingState - ); - } - - private static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getRegularMeasureGroupDimension(NodeList nl) { - String cubeDimensionID = null; - List annotations = null; - MeasureGroupDimensionBinding source = null; - String cardinality = null; - List attributes = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = (MeasureGroupDimensionBinding)getMeasureGroupDimensionBinding(node.getChildNodes()); - } - if ("Cardinality".equals(node.getNodeName())) { - cardinality = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getMeasureGroupAttributeList(node.getChildNodes()); - } - } - } - return new RegularMeasureGroupDimensionR( - cubeDimensionID, - annotations, - source, - cardinality, - attributes - ); - } - - private static List getMeasureGroupAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE.equals(node.getNodeName()))) { - list.add(getMeasureGroupAttribute(node.getChildNodes())); - } - } - return list; - } - - private static MeasureGroupAttribute getMeasureGroupAttribute(NodeList nl) { - String attributeID = null; - List keyColumns = null; - String type = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if (KEY_COLUMNS.equals(node.getNodeName())) { - keyColumns = getDataItemList(node.getChildNodes(), KEY_COLUMN); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new MeasureGroupAttributeR( - attributeID, - keyColumns, - type, - annotations - ); - } - - private static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getManyToManyMeasureGroupDimension(NodeList nl) { - String cubeDimensionID = null; - List annotations = null; - MeasureGroupDimensionBinding source = null; - String measureGroupID = null; - String directSlice = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = (MeasureGroupDimensionBinding)getMeasureGroupDimensionBinding(node.getChildNodes()); - } - if (MEASURE_GROUP_ID.equals(node.getNodeName())) { - measureGroupID = node.getTextContent(); - } - if ("DirectSlice".equals(node.getNodeName())) { - directSlice = node.getTextContent(); - } - } - } - return new ManyToManyMeasureGroupDimensionR( - cubeDimensionID, - annotations, - source, - measureGroupID, - directSlice - ); - } - - private static MeasureGroup.StorageMode getMeasureGroupStorageMode(NodeList nl) { - MeasureGroupStorageModeEnumType value = null; - String valuens = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - value = MeasureGroupStorageModeEnumType.fromValue(node.getTextContent()); - valuens = getAttribute(node.getAttributes(), VALUENS); - } - } - return new MeasureGroupR.StorageMode(value, valuens); - } - - private static MeasureGroupBinding getMeasureGroupBinding(NodeList nl) { - String dataSourceID = null; - String cubeID = null; - String measureGroupID = null; - PersistenceEnum persistence = null; - RefreshPolicyEnum refreshPolicy = null; - Duration refreshInterval = null; - String filter = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (DATA_SOURCE_ID.equals(node.getNodeName())) { - dataSourceID = node.getTextContent(); - } - if (CUBE_ID.equals(node.getNodeName())) { - cubeID = node.getTextContent(); - } - if (MEASURE_GROUP_ID.equals(node.getNodeName())) { - measureGroupID = node.getTextContent(); - } - if ("Persistence".equals(node.getNodeName())) { - persistence = PersistenceEnum.fromValue(node.getTextContent()); - } - if ("RefreshPolicy".equals(node.getNodeName())) { - refreshPolicy = RefreshPolicyEnum.fromValue(node.getTextContent()); - } - if (REFRESH_INTERVAL.equals(node.getNodeName())) { - refreshInterval = toDuration(node.getTextContent()); - } - if (FILTER.equals(node.getNodeName())) { - filter = node.getTextContent(); - } - } - } - return new MeasureGroupBindingR(dataSourceID, - cubeID, - measureGroupID, - Optional.ofNullable(persistence), - Optional.ofNullable(refreshPolicy), - Optional.ofNullable(refreshInterval), - Optional.ofNullable(filter)); - } - - private static List getMeasureList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (MEASURE.equals(node.getNodeName()))) { - list.add(getMeasure(node.getChildNodes())); - } - } - return list; - } - - private static Measure getMeasure(NodeList nl) { - String name = null; - String id = null; - String description = null; - String aggregateFunction = null; - String dataType = null; - DataItem source = null; - Boolean visible = null; - String measureExpression = null; - String displayFolder = null; - String formatString = null; - String backColor = null; - String foreColor = null; - String fontName = null; - String fontSize = null; - String fontFlags = null; - List translations = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if ("AggregateFunction".equals(node.getNodeName())) { - aggregateFunction = node.getTextContent(); - } - if ("DataType".equals(node.getNodeName())) { - dataType = node.getTextContent(); - } - if (SOURCE.equals(node.getNodeName())) { - source = getDataItem(node.getChildNodes()); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("MeasureExpression".equals(node.getNodeName())) { - measureExpression = node.getTextContent(); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if ("FormatString".equals(node.getNodeName())) { - formatString = node.getTextContent(); - } - if ("BackColor".equals(node.getNodeName())) { - backColor = node.getTextContent(); - } - if ("ForeColor".equals(node.getNodeName())) { - foreColor = node.getTextContent(); - } - if ("FontName".equals(node.getNodeName())) { - fontName = node.getTextContent(); - } - if ("FontSize".equals(node.getNodeName())) { - fontSize = node.getTextContent(); - } - if ("FontFlags".equals(node.getNodeName())) { - fontFlags = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - - return new MeasureR( - name, - id, - description, - aggregateFunction, - dataType, - source, - visible, - measureExpression, - displayFolder, - formatString, - backColor, - foreColor, - fontName, - fontSize, - fontFlags, - translations, - annotations - ); - } - - private static MdxScript getMdxScript(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - List commands = null; - Boolean defaultScript = null; - List calculationProperties = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Commands".equals(node.getNodeName())) { - commands = getCommandList(node.getChildNodes()); - } - if ("DefaultScript".equals(node.getNodeName())) { - defaultScript = toBoolean(node.getTextContent()); - } - if ("CalculationProperties".equals(node.getNodeName())) { - calculationProperties = getCalculationPropertyList(node.getChildNodes()); - } - } - } - return new MdxScriptR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - commands, - defaultScript, - calculationProperties - ); - } - - private static List getCalculationPropertyList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("CalculationProperty".equals(node.getNodeName()))) { - list.add(getCalculationProperty(node.getChildNodes())); - } - } - return list; - } - - private static List getCommandList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (COMMAND.equals(node.getNodeName()))) { - list.add(getCommand(node.getChildNodes())); - } - } - return list; - } - - private static CalculationProperty getCalculationProperty(NodeList nl) { - String calculationReference = null; - String calculationType = null; - List translations = null; - String description = null; - Boolean visible = null; - BigInteger solveOrder = null; - String formatString = null; - String foreColor = null; - String backColor = null; - String fontName = null; - String fontSize = null; - String fontFlags = null; - String nonEmptyBehavior = null; - String associatedMeasureGroupID = null; - String displayFolder = null; - BigInteger language = null; - CalculationPropertiesVisualizationProperties visualizationProperties = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("CalculationReference".equals(node.getNodeName())) { - calculationReference = node.getTextContent(); - } - if ("CalculationType".equals(node.getNodeName())) { - calculationType = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("SolveOrder".equals(node.getNodeName())) { - solveOrder = toBigInteger(node.getTextContent()); - } - if ("FormatString".equals(node.getNodeName())) { - formatString = node.getTextContent(); - } - if ("ForeColor".equals(node.getNodeName())) { - foreColor = node.getTextContent(); - } - if ("BackColor".equals(node.getNodeName())) { - backColor = node.getTextContent(); - } - if ("FontName".equals(node.getNodeName())) { - fontName = node.getTextContent(); - } - if ("FontSize".equals(node.getNodeName())) { - fontSize = node.getTextContent(); - } - if ("NonEmptyBehavior".equals(node.getNodeName())) { - nonEmptyBehavior = node.getTextContent(); - } - if ("AssociatedMeasureGroupID".equals(node.getNodeName())) { - associatedMeasureGroupID = node.getTextContent(); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if (LANGUAGE.equals(node.getNodeName())) { - language = toBigInteger(node.getTextContent()); - } - if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { - visualizationProperties = getCalculationPropertiesVisualizationProperties(node.getChildNodes()); - } - } - } - - return new CalculationPropertyR( - calculationReference, - calculationType, - translations, - description, - visible, - solveOrder, - formatString, - foreColor, - backColor, - fontName, - fontSize, - fontFlags, - nonEmptyBehavior, - associatedMeasureGroupID, - displayFolder, - language, - visualizationProperties - ); - } - - private static CalculationPropertiesVisualizationProperties getCalculationPropertiesVisualizationProperties(NodeList nl) { - BigInteger folderPosition = null; - String contextualNameRule = null; - String alignment = null; - Boolean isFolderDefault = null; - Boolean isRightToLeft = null; - String sortDirection = null; - String units = null; - BigInteger width = null; - Boolean isDefaultMeasure = null; - BigInteger defaultDetailsPosition = null; - BigInteger sortPropertiesPosition = null; - Boolean isSimpleMeasure = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (FOLDER_POSITION.equals(node.getNodeName())) { - folderPosition = toBigInteger(node.getTextContent()); - } - if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { - contextualNameRule = node.getTextContent(); - } - if ("Alignment".equals(node.getNodeName())) { - alignment = node.getTextContent(); - } - if ("IsFolderDefault".equals(node.getNodeName())) { - isFolderDefault = toBoolean(node.getTextContent()); - } - if ("IsRightToLeft".equals(node.getNodeName())) { - isRightToLeft = toBoolean(node.getTextContent()); - } - if ("SortDirection".equals(node.getNodeName())) { - sortDirection = node.getTextContent(); - } - if ("Units".equals(node.getNodeName())) { - units = node.getTextContent(); - } - if ("Width".equals(node.getNodeName())) { - width = toBigInteger(node.getTextContent()); - } - if (DEFAULT_DETAILS_POSITION.equals(node.getNodeName())) { - defaultDetailsPosition = toBigInteger(node.getTextContent()); - } - if (SORT_PROPERTIES_POSITION.equals(node.getNodeName())) { - sortPropertiesPosition = toBigInteger(node.getTextContent()); - } - if ("IsDefaultMeasure".equals(node.getNodeName())) { - isDefaultMeasure = toBoolean(node.getTextContent()); - } - if ("IsSimpleMeasure".equals(node.getNodeName())) { - isSimpleMeasure = toBoolean(node.getTextContent()); - } - } - } - - return new CalculationPropertiesVisualizationPropertiesR( - folderPosition, - contextualNameRule, - alignment, - isFolderDefault, - isRightToLeft, - sortDirection, - units, - width, - isDefaultMeasure, - defaultDetailsPosition, - sortPropertiesPosition, - isSimpleMeasure - ); - } - - private static Dimension getDimension(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - Binding source = null; - String miningModelID = null; - String type = null; - Dimension.UnknownMember unknownMember = null; - String mdxMissingMemberMode = null; - ErrorConfiguration errorConfiguration = null; - String storageMode = null; - Boolean writeEnabled = null; - BigInteger processingPriority = null; - Instant lastProcessed = null; - List dimensionPermissions = null; - String dependsOnDimensionID = null; - BigInteger language = null; - String collation = null; - String unknownMemberName = null; - List unknownMemberTranslations = null; - String state = null; - ProactiveCaching proactiveCaching = null; - String processingMode = null; - String processingGroup = null; - Dimension.CurrentStorageMode currentStorageMode = null; - List translations = null; - List attributes = null; - String attributeAllMemberName = null; - List attributeAllMemberTranslations = null; - List hierarchies = null; - String processingRecommendation = null; - Relationships relationships = null; - Integer stringStoresCompatibilityLevel = null; - Integer currentStringStoresCompatibilityLevel = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = getBinding(node.getChildNodes(), getNodeType(node)); - } - if (MINING_MODEL_ID.equals(node.getNodeName())) { - miningModelID = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = node.getTextContent(); - } - if ("UnknownMember".equals(node.getNodeName())) { - unknownMember = getDimensionUnknownMember(node.getChildNodes()); - } - if ("MdxMissingMemberMode".equals(node.getNodeName())) { - mdxMissingMemberMode = node.getTextContent(); - } - if (ERROR_CONFIGURATION.equals(node.getNodeName())) { - errorConfiguration = getErrorConfiguration(node.getChildNodes()); - } - if (STORAGE_MODE.equals(node.getNodeName())) { - storageMode = node.getTextContent(); - } - if ("WriteEnabled".equals(node.getNodeName())) { - writeEnabled = toBoolean(node.getTextContent()); - } - if (PROCESSING_PRIORITY.equals(node.getNodeName())) { - processingPriority = toBigInteger(node.getTextContent()); - } - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - if ("DimensionPermissions".equals(node.getNodeName())) { - dimensionPermissions = getDimensionPermissionList(node.getChildNodes()); - } - if ("DependsOnDimensionID".equals(node.getNodeName())) { - dependsOnDimensionID = node.getTextContent(); - } - if (LANGUAGE.equals(node.getNodeName())) { - language = toBigInteger(node.getTextContent()); - } - if (COLLATION.equals(node.getNodeName())) { - collation = node.getTextContent(); - } - if ("UnknownMemberName".equals(node.getNodeName())) { - unknownMemberName = node.getTextContent(); - } - if ("UnknownMemberTranslations".equals(node.getNodeName())) { - unknownMemberTranslations = getTranslationList(node.getChildNodes(), "UnknownMemberTranslation"); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if (PROACTIVE_CACHING.equals(node.getNodeName())) { - proactiveCaching = getProactiveCaching(node.getChildNodes()); - } - if (PROCESSING_MODE.equals(node.getNodeName())) { - processingMode = node.getTextContent(); - } - if ("ProcessingGroup".equals(node.getNodeName())) { - processingGroup = node.getTextContent(); - } - if ("CurrentStorageMode".equals(node.getNodeName())) { - processingGroup = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getDimensionAttributeList(node.getChildNodes()); - } - if ("AttributeAllMemberName".equals(node.getNodeName())) { - attributeAllMemberName = node.getTextContent(); - } - if ("AttributeAllMemberTranslations".equals(node.getNodeName())) { - attributeAllMemberTranslations = getTranslationList(node.getChildNodes(), - "AttributeAllMemberTranslation"); - } - if (HIERARCHIES.equals(node.getNodeName())) { - hierarchies = getHierarchyList(node.getChildNodes()); - } - if ("ProcessingRecommendation".equals(node.getNodeName())) { - processingRecommendation = node.getTextContent(); - } - if ("Relationships".equals(node.getNodeName())) { - relationships = getRelationships(node.getChildNodes()); - } - if ("StringStoresCompatibilityLevel".equals(node.getNodeName())) { - stringStoresCompatibilityLevel = toInteger(node.getTextContent()); - } - if ("CurrentStringStoresCompatibilityLevel".equals(node.getNodeName())) { - currentStringStoresCompatibilityLevel = toInteger(node.getTextContent()); - } - } - } - return new DimensionR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - source, - miningModelID, - type, - unknownMember, - mdxMissingMemberMode, - errorConfiguration, - storageMode, - writeEnabled, - processingPriority, - lastProcessed, - dimensionPermissions, - dependsOnDimensionID, - language, - collation, - unknownMemberName, - unknownMemberTranslations, - state, - proactiveCaching, - processingMode, - processingGroup, - currentStorageMode, - translations, - attributes, - attributeAllMemberName, - attributeAllMemberTranslations, - hierarchies, - processingRecommendation, - relationships, - stringStoresCompatibilityLevel, - currentStringStoresCompatibilityLevel); - } - - private static List getDimensionPermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("DimensionPermission".equals(node.getNodeName()))) { - list.add(getDimensionPermission(node.getChildNodes())); - } - } - return list; - } - - private static DimensionPermission getDimensionPermission(NodeList nl) { - List attributePermissions = null; - String allowedRowsExpression = null; - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - - if ("AttributePermissions".equals(node.getNodeName())) { - attributePermissions = getAttributePermissionList(node.getChildNodes()); - } - if ("AllowedRowsExpression".equals(node.getNodeName())) { - allowedRowsExpression = node.getTextContent(); - } - } - } - - return new DimensionPermissionR( - Optional.ofNullable(attributePermissions), - Optional.ofNullable(allowedRowsExpression), - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write) - ); - } - - private static List getAttributePermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("AttributePermission".equals(node.getNodeName()))) { - list.add(getAttributePermission(node.getChildNodes())); - } - } - return list; - } - - private static AttributePermission getAttributePermission(NodeList nl) { - String attributeID = null; - String description = null; - String defaultMember = null; - String visualTotals = null; - String allowedSet = null; - String deniedSet = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (DEFAULT_MEMBER.equals(node.getNodeName())) { - defaultMember = node.getTextContent(); - } - if ("VisualTotals".equals(node.getNodeName())) { - visualTotals = node.getTextContent(); - } - if ("AllowedSet".equals(node.getNodeName())) { - allowedSet = node.getTextContent(); - } - if ("DeniedSet".equals(node.getNodeName())) { - deniedSet = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new AttributePermissionR( - attributeID, - Optional.ofNullable(description), - Optional.ofNullable(defaultMember), - Optional.ofNullable(visualTotals), - Optional.ofNullable(allowedSet), - Optional.ofNullable(deniedSet), - Optional.ofNullable(annotations) - ); - } - - private static Dimension.UnknownMember getDimensionUnknownMember(NodeList nl) { - UnknownMemberEnumType value = null; - String valuens = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - value = UnknownMemberEnumType.fromValue(node.getTextContent()); - valuens = getAttribute(node.getAttributes(), VALUENS); - } - } - return new DimensionR.UnknownMember(value, valuens); - } - - private static List getDimensionAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE.equals(node.getNodeName()))) { - list.add(getDimensionAttribute(node.getChildNodes())); - } - } - return list; - } - - private static DimensionAttribute getDimensionAttribute(NodeList nl) { - String name = null; - String id = null; - String description = null; - DimensionAttribute.Type type = null; - String usage = null; - Binding source = null; - Long estimatedCount = null; - List keyColumns = null; - DataItem nameColumn = null; - DataItem valueColumn = null; - List translations = null; - List attributeRelationships = null; - String discretizationMethod = null; - BigInteger discretizationBucketCount = null; - String rootMemberIf = null; - String orderBy = null; - String defaultMember = null; - String orderByAttributeID = null; - DataItem skippedLevelsColumn = null; - String namingTemplate = null; - String membersWithData = null; - String membersWithDataCaption = null; - List namingTemplateTranslations = null; - DataItem customRollupColumn = null; - DataItem customRollupPropertiesColumn = null; - DataItem unaryOperatorColumn = null; - Boolean attributeHierarchyOrdered = null; - Boolean memberNamesUnique = null; - Boolean isAggregatable = null; - Boolean attributeHierarchyEnabled = null; - String attributeHierarchyOptimizedState = null; - Boolean attributeHierarchyVisible = null; - String attributeHierarchyDisplayFolder = null; - Boolean keyUniquenessGuarantee = null; - String groupingBehavior = null; - String instanceSelection = null; - List annotations = null; - String processingState = null; - AttributeHierarchyProcessingState attributeHierarchyProcessingState = null; - DimensionAttributeVisualizationProperties visualizationProperties = null; - String extendedType = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = getDimensionAttributeType(node.getChildNodes()); - } - if ("Usage".equals(node.getNodeName())) { - usage = node.getTextContent(); - } - if (SOURCE.equals(node.getNodeName())) { - source = getBinding(node.getChildNodes(), getNodeType(node)); - } - if ("EstimatedCount".equals(node.getNodeName())) { - estimatedCount = toLong(node.getTextContent()); - } - if (KEY_COLUMNS.equals(node.getNodeName())) { - keyColumns = getDataItemList(node.getChildNodes(), KEY_COLUMN); - } - if ("NameColumn".equals(node.getNodeName())) { - nameColumn = getDataItem(node.getChildNodes()); - } - if ("ValueColumn".equals(node.getNodeName())) { - valueColumn = getDataItem(node.getChildNodes()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getAttributeTranslationList(node.getChildNodes()); - } - if ("AttributeRelationships".equals(node.getNodeName())) { - translations = getAttributeRelationshipsList(node.getChildNodes()); - } - if ("DiscretizationMethod".equals(node.getNodeName())) { - discretizationMethod = node.getTextContent(); - } - if ("DiscretizationBucketCount".equals(node.getNodeName())) { - discretizationBucketCount = toBigInteger(node.getTextContent()); - } - if ("RootMemberIf".equals(node.getNodeName())) { - rootMemberIf = node.getTextContent(); - } - if ("OrderBy".equals(node.getNodeName())) { - orderBy = node.getTextContent(); - } - if (DEFAULT_MEMBER.equals(node.getNodeName())) { - defaultMember = node.getTextContent(); - } - if ("OrderByAttributeID".equals(node.getNodeName())) { - orderByAttributeID = node.getTextContent(); - } - if ("SkippedLevelsColumn".equals(node.getNodeName())) { - skippedLevelsColumn = getDataItem(node.getChildNodes()); - } - if ("NamingTemplate".equals(node.getNodeName())) { - namingTemplate = node.getTextContent(); - } - if ("MembersWithData".equals(node.getNodeName())) { - membersWithData = node.getTextContent(); - } - if ("MembersWithDataCaption".equals(node.getNodeName())) { - membersWithDataCaption = node.getTextContent(); - } - if ("NamingTemplateTranslations".equals(node.getNodeName())) { - namingTemplateTranslations = getNamingTemplateTranslationList(node.getChildNodes()); - } - if ("CustomRollupColumn".equals(node.getNodeName())) { - customRollupColumn = getDataItem(node.getChildNodes()); - } - if ("CustomRollupPropertiesColumn".equals(node.getNodeName())) { - customRollupPropertiesColumn = getDataItem(node.getChildNodes()); - } - if ("unaryOperatorColumn".equals(node.getNodeName())) { - unaryOperatorColumn = getDataItem(node.getChildNodes()); - } - if ("AttributeHierarchyOrdered".equals(node.getNodeName())) { - attributeHierarchyOrdered = toBoolean(node.getTextContent()); - } - if ("MemberNamesUnique".equals(node.getNodeName())) { - memberNamesUnique = toBoolean(node.getTextContent()); - } - if ("IsAggregatable".equals(node.getNodeName())) { - isAggregatable = toBoolean(node.getTextContent()); - } - if ("AttributeHierarchyEnabled".equals(node.getNodeName())) { - attributeHierarchyEnabled = toBoolean(node.getTextContent()); - } - if ("AttributeHierarchyOptimizedState".equals(node.getNodeName())) { - attributeHierarchyOptimizedState = node.getTextContent(); - } - if (ATTRIBUTE_HIERARCHY_VISIBLE.equals(node.getNodeName())) { - attributeHierarchyVisible = toBoolean(node.getTextContent()); - } - if ("AttributeHierarchyDisplayFolder".equals(node.getNodeName())) { - attributeHierarchyDisplayFolder = node.getTextContent(); - } - if ("KeyUniquenessGuarantee".equals(node.getNodeName())) { - keyUniquenessGuarantee = toBoolean(node.getTextContent()); - } - if ("GroupingBehavior".equals(node.getNodeName())) { - groupingBehavior = node.getTextContent(); - } - if ("InstanceSelection".equals(node.getNodeName())) { - instanceSelection = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (PROCESSING_STATE.equals(node.getNodeName())) { - processingState = node.getTextContent(); - } - if ("AttributeHierarchyProcessingState".equals(node.getNodeName())) { - attributeHierarchyProcessingState = - AttributeHierarchyProcessingState.fromValue(node.getTextContent()); - } - if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { - visualizationProperties = getDimensionAttributeVisualizationProperties(node.getChildNodes()); - } - if ("ExtendedType".equals(node.getNodeName())) { - extendedType = node.getTextContent(); - } - } - } - return new DimensionAttributeR( - name, - id, - description, - type, - usage, - source, - estimatedCount, - keyColumns, - nameColumn, - valueColumn, - translations, - attributeRelationships, - discretizationMethod, - discretizationBucketCount, - rootMemberIf, - orderBy, - defaultMember, - orderByAttributeID, - skippedLevelsColumn, - namingTemplate, - membersWithData, - membersWithDataCaption, - namingTemplateTranslations, - customRollupColumn, - customRollupPropertiesColumn, - unaryOperatorColumn, - attributeHierarchyOrdered, - memberNamesUnique, - isAggregatable, - attributeHierarchyEnabled, - attributeHierarchyOptimizedState, - attributeHierarchyVisible, - attributeHierarchyDisplayFolder, - keyUniquenessGuarantee, - groupingBehavior, - instanceSelection, - annotations, - processingState, - attributeHierarchyProcessingState, - visualizationProperties, - extendedType); - } - - private static DimensionAttributeVisualizationProperties getDimensionAttributeVisualizationProperties(NodeList nl) { - BigInteger folderPosition = null; - String contextualNameRule = null; - String alignment = null; - Boolean isFolderDefault = null; - Boolean isRightToLeft = null; - String sortDirection = null; - String units = null; - BigInteger width = null; - BigInteger defaultDetailsPosition = null; - BigInteger commonIdentifierPosition = null; - BigInteger sortPropertiesPosition = null; - BigInteger displayKeyPosition = null; - Boolean isDefaultImage = null; - String defaultAggregateFunction = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (FOLDER_POSITION.equals(node.getNodeName())) { - folderPosition = toBigInteger(node.getTextContent()); - } - if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { - contextualNameRule = node.getTextContent(); - } - if ("Alignment".equals(node.getNodeName())) { - alignment = node.getTextContent(); - } - if ("IsFolderDefault".equals(node.getNodeName())) { - isFolderDefault = toBoolean(node.getTextContent()); - } - if ("IsRightToLeft".equals(node.getNodeName())) { - isRightToLeft = toBoolean(node.getTextContent()); - } - if ("SortDirection".equals(node.getNodeName())) { - sortDirection = node.getTextContent(); - } - if ("Units".equals(node.getNodeName())) { - units = node.getTextContent(); - } - if ("Width".equals(node.getNodeName())) { - width = toBigInteger(node.getTextContent()); - } - if (DEFAULT_DETAILS_POSITION.equals(node.getNodeName())) { - defaultDetailsPosition = toBigInteger(node.getTextContent()); - } - if (SORT_PROPERTIES_POSITION.equals(node.getNodeName())) { - sortPropertiesPosition = toBigInteger(node.getTextContent()); - } - if ("CommonIdentifierPosition".equals(node.getNodeName())) { - commonIdentifierPosition = toBigInteger(node.getTextContent()); - } - if ("DisplayKeyPosition".equals(node.getNodeName())) { - displayKeyPosition = toBigInteger(node.getTextContent()); - } - if ("IsDefaultImage".equals(node.getNodeName())) { - isDefaultImage = toBoolean(node.getTextContent()); - } - if ("DefaultAggregateFunction".equals(node.getNodeName())) { - defaultAggregateFunction = node.getTextContent(); - } - } - } - return new DimensionAttributeVisualizationPropertiesR( - folderPosition, - contextualNameRule, - alignment, - isFolderDefault, - isRightToLeft, - sortDirection, - units, - width, - defaultDetailsPosition, - commonIdentifierPosition, - sortPropertiesPosition, - displayKeyPosition, - isDefaultImage, - defaultAggregateFunction - ); - } - - private static List getNamingTemplateTranslationList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("NamingTemplateTranslation".equals(node.getNodeName()))) { - list.add(getTranslation(node.getChildNodes())); - } - } - return list; - } - - private static List getAttributeRelationshipsList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("AttributeRelationship".equals(node.getNodeName()))) { - list.add(getAttributeTranslation(node.getChildNodes())); - } - } - return list; - } - - private static DimensionAttribute.Type getDimensionAttributeType(NodeList nl) { - DimensionAttributeTypeEnumType value = null; - String valuens = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - value = DimensionAttributeTypeEnumType.fromValue(node.getTextContent()); - valuens = getAttribute(node.getAttributes(), VALUENS); - break; - } - } - return new DimensionAttributeR.Type(value, - valuens); - } - - private static List getHierarchyList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (HIERARCHY.equals(node.getNodeName()))) { - list.add(getHierarchy(node.getChildNodes())); - } - } - return list; - } - - private static Hierarchy getHierarchy(NodeList nl) { - String name = null; - String id = null; - String description = null; - String processingState = null; - String structureType = null; - String displayFolder = null; - List translations = null; - String allMemberName = null; - List allMemberTranslations = null; - Boolean memberNamesUnique = null; - String memberKeysUnique = null; - Boolean allowDuplicateNames = null; - List levels = null; - List annotations = null; - HierarchyVisualizationProperties visualizationProperties = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (PROCESSING_STATE.equals(node.getNodeName())) { - processingState = node.getTextContent(); - } - if ("StructureType".equals(node.getNodeName())) { - structureType = node.getTextContent(); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if ("AllMemberName".equals(node.getNodeName())) { - allMemberName = node.getTextContent(); - } - if ("AllMemberTranslations".equals(node.getNodeName())) { - allMemberTranslations = getTranslationList(node.getChildNodes(), "AllMemberTranslation"); - } - if ("MemberNamesUnique".equals(node.getNodeName())) { - memberNamesUnique = toBoolean(node.getTextContent()); - } - if ("MemberKeysUnique".equals(node.getNodeName())) { - memberKeysUnique = node.getTextContent(); - } - if ("AllowDuplicateNames".equals(node.getNodeName())) { - allowDuplicateNames = toBoolean(node.getTextContent()); - } - if ("Levels".equals(node.getNodeName())) { - levels = getLevelList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { - visualizationProperties = getHierarchyVisualizationProperties(node.getChildNodes()); - } - } - } - return new HierarchyR( - name, - id, - description, - processingState, - structureType, - displayFolder, - translations, - allMemberName, - allMemberTranslations, - memberNamesUnique, - memberKeysUnique, - allowDuplicateNames, - levels, - annotations, - visualizationProperties - ); - } - - private static HierarchyVisualizationProperties getHierarchyVisualizationProperties(NodeList nl) { - String contextualNameRule = null; - BigInteger folderPosition = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { - contextualNameRule = node.getTextContent(); - } - if (FOLDER_POSITION.equals(node.getNodeName())) { - folderPosition = toBigInteger(node.getTextContent()); - } - } - } - return new HierarchyVisualizationPropertiesR( - contextualNameRule, - folderPosition - ); - } - - private static List getLevelList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Level".equals(node.getNodeName()))) { - list.add(getLevel(node.getChildNodes())); - } - } - return list; - } - - private static Level getLevel(NodeList nl) { - String name = null; - String id = null; - String description = null; - String sourceAttributeID = null; - String hideMemberIf = null; - List translations = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if ("SourceAttributeID".equals(node.getNodeName())) { - sourceAttributeID = node.getTextContent(); - } - if ("HideMemberIf".equals(node.getNodeName())) { - hideMemberIf = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new LevelR( - name, - id, - description, - sourceAttributeID, - hideMemberIf, - translations, - annotations - ); - - } - - private static Relationships getRelationships(NodeList nl) { - List relationship = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Relationship".equals(node.getNodeName()))) { - relationship.add(getRelationship(node.getChildNodes())); - break; - } - } - return new RelationshipsR(relationship); - } - - private static Relationship getRelationship(NodeList nl) { - String id = null; - boolean visible = false; - RelationshipEnd fromRelationshipEnd = null; - RelationshipEnd toRelationshipEnd = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("FromRelationshipEnd".equals(node.getNodeName())) { - fromRelationshipEnd = getRelationshipEnd(node.getChildNodes()); - } - if ("ToRelationshipEnd".equals(node.getNodeName())) { - toRelationshipEnd = getRelationshipEnd(node.getChildNodes()); - } - } - } - return new RelationshipR( - id, - visible, - fromRelationshipEnd, - toRelationshipEnd - ); - } - - private static RelationshipEnd getRelationshipEnd(NodeList nl) { - String role = null; - String multiplicity = null; - String dimensionID = null; - List attributes = null; - List translations = null; - RelationshipEndVisualizationProperties visualizationProperties = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ROLE2.equals(node.getNodeName())) { - role = node.getTextContent(); - } - if ("Multiplicity".equals(node.getNodeName())) { - multiplicity = node.getTextContent(); - } - if (DIMENSION_ID.equals(node.getNodeName())) { - dimensionID = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getRelationshipEndAttributes(node.getChildNodes()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getRelationshipEndTranslations(node.getChildNodes()); - } - if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { - visualizationProperties = getRelationshipEndVisualizationProperties(node.getChildNodes()); - } - - } - } - return new RelationshipEndR(role, - multiplicity, - dimensionID, - attributes, - translations, - visualizationProperties); - } - - private static RelationshipEndVisualizationProperties getRelationshipEndVisualizationProperties(NodeList nl) { - BigInteger folderPosition = null; - String contextualNameRule = null; - BigInteger defaultDetailsPosition = null; - BigInteger displayKeyPosition = null; - BigInteger commonIdentifierPosition = null; - Boolean isDefaultMeasure = null; - Boolean isDefaultImage = null; - BigInteger sortPropertiesPosition = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (FOLDER_POSITION.equals(node.getNodeName())) { - folderPosition = toBigInteger(node.getTextContent()); - } - if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { - contextualNameRule = node.getTextContent(); - } - if (DEFAULT_DETAILS_POSITION.equals(node.getNodeName())) { - defaultDetailsPosition = toBigInteger(node.getTextContent()); - } - if ("DisplayKeyPosition".equals(node.getNodeName())) { - displayKeyPosition = toBigInteger(node.getTextContent()); - } - if ("CommonIdentifierPosition".equals(node.getNodeName())) { - commonIdentifierPosition = toBigInteger(node.getTextContent()); - } - if ("IsDefaultMeasure".equals(node.getNodeName())) { - isDefaultMeasure = toBoolean(node.getTextContent()); - } - if ("IsDefaultImage".equals(node.getNodeName())) { - isDefaultImage = toBoolean(node.getTextContent()); - } - if (SORT_PROPERTIES_POSITION.equals(node.getNodeName())) { - sortPropertiesPosition = toBigInteger(node.getTextContent()); - } - } - } - - return new RelationshipEndVisualizationPropertiesR( - folderPosition, - contextualNameRule, - defaultDetailsPosition, - displayKeyPosition, - commonIdentifierPosition, - isDefaultMeasure, - isDefaultImage, - sortPropertiesPosition - ); - } - - private static List getRelationshipEndTranslations(NodeList nl) { - List translations = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (TRANSLATION.equals(node.getNodeName()))) { - translations.add(getRelationshipEndTranslation(node.getChildNodes())); - } - } - return translations; - } - - private static RelationshipEndTranslation getRelationshipEndTranslation(NodeList nl) { - long language = 0; - String caption = null; - String collectionCaption = null; - String description = null; - String displayFolder = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (LANGUAGE.equals(node.getNodeName())) { - language = toLong(node.getTextContent()); - } - if (CAPTION.equals(node.getNodeName())) { - caption = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("CollectionCaption".equals(node.getNodeName())) { - collectionCaption = node.getTextContent(); - } - } - } - - return new RelationshipEndTranslationR( - language, - caption, - collectionCaption, - description, - displayFolder, - annotations - ); - } - - private static List getRelationshipEndAttributes(NodeList nl) { - List attributes = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE.equals(node.getNodeName()))) { - attributes.add(getAttributeId(node.getChildNodes())); - } - } - return attributes; - } - - private static String getAttributeId(NodeList nl) { - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE_ID.equals(node.getNodeName()))) { - return node.getTextContent(); - } - } - return null; - } - - private static DataSourceView getDataSourceView(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String dataSourceID = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (DATA_SOURCE_ID.equals(node.getNodeName())) { - dataSourceID = node.getTextContent(); - } - } - } - return new DataSourceViewR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - dataSourceID - ); - } - - private static DataSource getDataSource(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String managedProvider = null; - String connectionString = null; - String connectionStringSecurity = null; - ImpersonationInfo impersonationInfo = null; - String isolation = null; - BigInteger maxActiveConnections = null; - Duration timeout = null; - List dataSourcePermissions = null; - ImpersonationInfo queryImpersonationInfo = null; - String queryHints = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("ManagedProvider".equals(node.getNodeName())) { - managedProvider = node.getTextContent(); - } - if ("ConnectionString".equals(node.getNodeName())) { - connectionString = node.getTextContent(); - } - if ("ConnectionStringSecurity".equals(node.getNodeName())) { - connectionStringSecurity = node.getTextContent(); - } - if ("ImpersonationInfo".equals(node.getNodeName())) { - impersonationInfo = getImpersonationInfo(node.getChildNodes()); - } - if ("Isolation".equals(node.getNodeName())) { - isolation = node.getTextContent(); - } - if ("MaxActiveConnections".equals(node.getNodeName())) { - maxActiveConnections = toBigInteger(node.getTextContent()); - } - if ("Timeout".equals(node.getNodeName())) { - timeout = toDuration(node.getTextContent()); - } - if ("DataSourcePermissions".equals(node.getNodeName())) { - dataSourcePermissions = getDataSourcePermissionList(node.getChildNodes()); - } - if ("QueryImpersonationInfo".equals(node.getNodeName())) { - queryImpersonationInfo = getImpersonationInfo(node.getChildNodes()); - } - if ("QueryHints".equals(node.getNodeName())) { - queryHints = node.getTextContent(); - } - } - } - return new DataSourceR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - managedProvider, - connectionString, - connectionStringSecurity, - impersonationInfo, - isolation, - maxActiveConnections, - timeout, - dataSourcePermissions, - queryImpersonationInfo, - queryHints); - } - - private static List getDataSourcePermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("DataSourcePermission".equals(node.getNodeName()))) { - list.add(getDataSourcePermission(node.getChildNodes())); - } - } - return list; - } - - private static DataSourcePermission getDataSourcePermission(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - } - } - return new DataSourcePermissionR( - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write)); - } - - private static ImpersonationInfo getImpersonationInfo(NodeList nl) { - String impersonationMode = null; - String account = null; - String password = null; - String impersonationInfoSecurity = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("ImpersonationMode".equals(node.getNodeName())) { - impersonationMode = node.getTextContent(); - } - if ("Account".equals(node.getNodeName())) { - account = node.getTextContent(); - } - if ("Password".equals(node.getNodeName())) { - password = node.getTextContent(); - } - if ("ImpersonationInfoSecurity".equals(node.getNodeName())) { - impersonationInfoSecurity = node.getTextContent(); - } - } - } - - return new ImpersonationInfoR(impersonationMode, - Optional.ofNullable(account), - Optional.ofNullable(password), - Optional.ofNullable(impersonationInfoSecurity)); - } - - private static Database getDatabase(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - Instant lastUpdate = null; - String state = null; - String readWriteMode = null; - String dbStorageLocation = null; - String aggregationPrefix = null; - BigInteger processingPriority = null; - Long estimatedSize = null; - Instant lastProcessed = null; - BigInteger language = null; - String collation = null; - Boolean visible = null; - String masterDataSourceID = null; - ImpersonationInfo dataSourceImpersonationInfo = null; - List accounts = null; - List dataSources = null; - List dataSourceViews = null; - List dimensions = null; - List cubes = null; - List miningStructures = null; - List roles = null; - List assemblies = null; - List databasePermissions = null; - List translations = null; - String storageEngineUsed = null; - String imagePath = null; - String imageUrl = null; - String imageUniqueID = null; - String imageVersion = null; - String token = null; - BigInteger compatibilityLevel = null; - String directQueryMode = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - - if ("LastUpdate".equals(node.getNodeName())) { - lastUpdate = toInstant(node.getTextContent()); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if ("ReadWriteMode".equals(node.getNodeName())) { - readWriteMode = node.getTextContent(); - } - if ("DbStorageLocation".equals(node.getNodeName())) { - dbStorageLocation = node.getTextContent(); - } - if (AGGREGATION_PREFIX.equals(node.getNodeName())) { - aggregationPrefix = node.getTextContent(); - } - if (PROCESSING_PRIORITY.equals(node.getNodeName())) { - processingPriority = toBigInteger(node.getTextContent()); - } - if (ESTIMATED_SIZE.equals(node.getNodeName())) { - estimatedSize = toLong(node.getTextContent()); - } - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - if (LANGUAGE.equals(node.getNodeName())) { - language = toBigInteger(node.getTextContent()); - } - if (COLLATION.equals(node.getNodeName())) { - collation = node.getTextContent(); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("MasterDataSourceID".equals(node.getNodeName())) { - masterDataSourceID = node.getTextContent(); - } - if ("DataSourceImpersonationInfo".equals(node.getNodeName())) { - dataSourceImpersonationInfo = getImpersonationInfo(node.getChildNodes()); - } - if ("Accounts".equals(node.getNodeName())) { - accounts = getAccountList(node.getChildNodes()); - } - if ("DataSources".equals(node.getNodeName())) { - dataSources = getDataSourceList(node.getChildNodes()); - } - if ("DataSourceViews".equals(node.getNodeName())) { - dataSourceViews = getDataSourceViewList(node.getChildNodes()); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = getDimensionList(node.getChildNodes()); - } - if ("Cubes".equals(node.getNodeName())) { - cubes = getCubeList(node.getChildNodes()); - } - if ("MiningStructures".equals(node.getNodeName())) { - miningStructures = getMiningStructureList(node.getChildNodes()); - } - if ("Roles".equals(node.getNodeName())) { - roles = getRoleList(node.getChildNodes()); - } - if ("Assemblies".equals(node.getNodeName())) { - assemblies = getAssemblyList(node.getChildNodes()); - } - if ("DatabasePermissions".equals(node.getNodeName())) { - databasePermissions = getDatabasePermissionList(node.getChildNodes()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if ("StorageEngineUsed".equals(node.getNodeName())) { - storageEngineUsed = node.getTextContent(); - } - if ("ImagePath".equals(node.getNodeName())) { - imagePath = node.getTextContent(); - } - if ("ImageUrl".equals(node.getNodeName())) { - imageUrl = node.getTextContent(); - } - if ("ImageUniqueID".equals(node.getNodeName())) { - imageUniqueID = node.getTextContent(); - } - if ("ImageVersion".equals(node.getNodeName())) { - imageVersion = node.getTextContent(); - } - if ("Token".equals(node.getNodeName())) { - token = node.getTextContent(); - } - if ("CompatibilityLevel".equals(node.getNodeName())) { - compatibilityLevel = toBigInteger(node.getTextContent()); - } - if ("DirectQueryMode".equals(node.getNodeName())) { - directQueryMode = node.getTextContent(); - } - } - } - return new DatabaseR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - lastUpdate, - state, - readWriteMode, - dbStorageLocation, - aggregationPrefix, - processingPriority, - estimatedSize, - lastProcessed, - language, - collation, - visible, - masterDataSourceID, - dataSourceImpersonationInfo, - accounts, - dataSources, - dataSourceViews, - dimensions, - cubes, - miningStructures, - roles, - assemblies, - databasePermissions, - translations, - storageEngineUsed, - imagePath, - imageUrl, - imageUniqueID, - imageVersion, - token, - compatibilityLevel, - directQueryMode - ); - } - - private static List getDatabasePermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("DatabasePermission".equals(node.getNodeName()))) { - list.add(getDatabasePermission(node.getChildNodes())); - } - } - return list; - - } - - private static List getMiningStructureList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MiningStructure".equals(node.getNodeName()))) { - list.add(getMiningStructure(node.getChildNodes())); - } - } - return list; - } - - private static List getCubeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (CUBE2.equals(node.getNodeName()))) { - list.add(getCube(node.getChildNodes())); - } - } - return list; - } - - private static List getDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (DIMENSION.equals(node.getNodeName()))) { - list.add(getDimension(node.getChildNodes())); - } - } - return list; - } - - private static List getDataSourceViewList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("DataSourceView".equals(node.getNodeName()))) { - list.add(getDataSourceView(node.getChildNodes())); - } - } - return list; - - } - - private static List getDataSourceList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("DataSource".equals(node.getNodeName()))) { - list.add(getDataSource(node.getChildNodes())); - } - } - return list; - - } - - private static List getAccountList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Account".equals(node.getNodeName()))) { - list.add(getAccount(node.getChildNodes())); - } - } - return list; - - } - - private static Account getAccount(NodeList nl) { - String accountType = null; - String aggregationFunction = null; - List aliases = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("AccountType".equals(node.getNodeName())) { - accountType = node.getTextContent(); - } - if ("AggregationFunction".equals(node.getNodeName())) { - aggregationFunction = node.getTextContent(); - } - if ("Aliases".equals(node.getNodeName())) { - aliases = getAliasList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new AccountR(accountType, - aggregationFunction, - aliases, - annotations); - } - - private static List getAliasList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Alias".equals(node.getNodeName()))) { - list.add(node.getTextContent()); - } - } - return list; - } - - private static DatabasePermission getDatabasePermission(NodeList nl) { - Boolean administer = null; - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if ("Administer".equals(node.getNodeName())) { - administer = toBoolean(node.getTextContent()); - } - } - } - return new DatabasePermissionR( - Optional.ofNullable(administer), - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write) - ); - } - - private static Cube getCube(NodeList nl) { - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - BigInteger language = null; - String collation = null; - List translations = null; - List dimensions = null; - List cubePermissions = null; - List mdxScripts = null; - List perspectives = null; - String state = null; - String defaultMeasure = null; - Boolean visible = null; - List measureGroups = null; - DataSourceViewBinding source = null; - String aggregationPrefix = null; - BigInteger processingPriority = null; - Cube.StorageMode storageMode = null; - String processingMode = null; - String scriptCacheProcessingMode = null; - String scriptErrorHandlingMode = null; - String daxOptimizationMode = null; - ProactiveCaching proactiveCaching = null; - List kpis = null; - ErrorConfiguration errorConfiguration = null; - List actions = null; - String storageLocation = null; - Long estimatedRows = null; - Instant lastProcessed = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (LANGUAGE.equals(node.getNodeName())) { - language = toBigInteger(node.getTextContent()); - } - if (COLLATION.equals(node.getNodeName())) { - collation = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = getCubeDimensionList(node.getChildNodes()); - } - if ("CubePermissions".equals(node.getNodeName())) { - cubePermissions = getCubePermissionList(node.getChildNodes()); - } - if ("MdxScripts".equals(node.getNodeName())) { - mdxScripts = getMdxScriptList(node.getChildNodes()); - } - if ("Perspectives".equals(node.getNodeName())) { - perspectives = getPerspectiveList(node.getChildNodes()); - } - if (STATE.equals(node.getNodeName())) { - state = node.getTextContent(); - } - if ("DefaultMeasure".equals(node.getNodeName())) { - defaultMeasure = node.getTextContent(); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("MeasureGroups".equals(node.getNodeName())) { - measureGroups = getMeasureGroupList(node.getChildNodes()); - } - if (SOURCE.equals(node.getNodeName())) { - source = getDataSourceViewBinding(node.getChildNodes()); - } - if (AGGREGATION_PREFIX.equals(node.getNodeName())) { - aggregationPrefix = node.getTextContent(); - } - if (PROCESSING_PRIORITY.equals(node.getNodeName())) { - processingPriority = toBigInteger(node.getTextContent()); - } - if (STORAGE_MODE.equals(node.getNodeName())) { - storageMode = getCubeStorageMode(node.getChildNodes()); - } - if (PROCESSING_MODE.equals(node.getNodeName())) { - processingMode = node.getTextContent(); - } - if ("ScriptCacheProcessingMode".equals(node.getNodeName())) { - scriptCacheProcessingMode = node.getTextContent(); - } - if ("ScriptErrorHandlingMode".equals(node.getNodeName())) { - scriptErrorHandlingMode = node.getTextContent(); - } - if ("DaxOptimizationMode".equals(node.getNodeName())) { - daxOptimizationMode = node.getTextContent(); - } - if (PROACTIVE_CACHING.equals(node.getNodeName())) { - proactiveCaching = getProactiveCaching(node.getChildNodes()); - } - if ("Kpis".equals(node.getNodeName())) { - kpis = getKpiList(node.getChildNodes()); - } - if (ERROR_CONFIGURATION.equals(node.getNodeName())) { - errorConfiguration = getErrorConfiguration(node.getChildNodes()); - } - if ("Actions".equals(node.getNodeName())) { - actions = getActionList(node.getChildNodes()); - } - if (STORAGE_LOCATION.equals(node.getNodeName())) { - storageLocation = node.getTextContent(); - } - if (ESTIMATED_ROWS.equals(node.getNodeName())) { - estimatedRows = toLong(node.getTextContent()); - } - if (LAST_PROCESSED.equals(node.getNodeName())) { - lastProcessed = toInstant(node.getTextContent()); - } - } - } - return new CubeR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - language, - collation, - translations, - dimensions, - cubePermissions, - mdxScripts, - perspectives, - state, - defaultMeasure, - visible, - measureGroups, - source, - aggregationPrefix, - processingPriority, - storageMode, - processingMode, - scriptCacheProcessingMode, - scriptErrorHandlingMode, - daxOptimizationMode, - proactiveCaching, - kpis, - errorConfiguration, - actions, - storageLocation, - estimatedRows, - lastProcessed); - } - - private static List getActionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ACTION.equals(node.getNodeName()))) { - list.add(getAction(node.getChildNodes(), getNodeType(node))); - } - } - return list; - } - - private static List getKpiList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Kpi".equals(node.getNodeName()))) { - list.add(getKpi(node.getChildNodes())); - } - } - return list; - } - - private static List getMeasureGroupList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (MEASURE_GROUP.equals(node.getNodeName()))) { - list.add(getMeasureGroup(node.getChildNodes())); - } - } - return list; - } - - private static List getPerspectiveList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Perspective".equals(node.getNodeName()))) { - list.add(getPerspective(node.getChildNodes())); - } - } - return list; - } - - private static List getMdxScriptList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("MdxScript".equals(node.getNodeName()))) { - list.add(getMdxScript(node.getChildNodes())); - } - } - return list; - } - - private static List getCubePermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("CubePermission".equals(node.getNodeName()))) { - list.add(getCubePermission(node.getChildNodes())); - } - } - return list; - } - - private static List getCubeDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("CubeDimension".equals(node.getNodeName()))) { - list.add(getCubeDimension(node.getChildNodes())); - } - } - return list; - } - - private static Kpi getKpi(NodeList nl) { - String name = null; - String id = null; - String description = null; - List translations = null; - String displayFolder = null; - String associatedMeasureGroupID = null; - String value = null; - String goal = null; - String status = null; - String trend = null; - String weight = null; - String trendGraphic = null; - String statusGraphic = null; - String currentTimeMember = null; - String parentKpiID = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (DISPLAY_FOLDER.equals(node.getNodeName())) { - displayFolder = node.getTextContent(); - } - if ("AssociatedMeasureGroupID".equals(node.getNodeName())) { - associatedMeasureGroupID = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = node.getTextContent(); - } - if ("Goal".equals(node.getNodeName())) { - goal = node.getTextContent(); - } - if ("Status".equals(node.getNodeName())) { - status = node.getTextContent(); - } - if ("Trend".equals(node.getNodeName())) { - trend = node.getTextContent(); - } - if ("Weight".equals(node.getNodeName())) { - weight = node.getTextContent(); - } - if ("TrendGraphic".equals(node.getNodeName())) { - trendGraphic = node.getTextContent(); - } - if ("StatusGraphic".equals(node.getNodeName())) { - statusGraphic = node.getTextContent(); - } - if ("CurrentTimeMember".equals(node.getNodeName())) { - currentTimeMember = node.getTextContent(); - } - if ("ParentKpiID".equals(node.getNodeName())) { - parentKpiID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new KpiR( - name, - id, - description, - translations, - displayFolder, - associatedMeasureGroupID, - value, - goal, - status, - trend, - weight, - trendGraphic, - statusGraphic, - currentTimeMember, - parentKpiID, - annotations); - } - - private static Cube.StorageMode getCubeStorageMode(NodeList nl) { - CubeStorageModeEnumType value = null; - String valuens = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - value = CubeStorageModeEnumType.fromValue(node.getTextContent()); - valuens = getAttribute(node.getAttributes(), VALUENS); - break; - } - } - return new CubeR.StorageMode(value, - valuens); - } - - private static Action getAction(NodeList nl, String type) { - if ("StandardAction".equals(type)) { - return getStandardAction(nl); - } - if ("ReportAction".equals(type)) { - return getReportAction(nl); - } - if ("ReportAction".equals(type)) { - return getDrillThroughAction(nl); - } - return null; - } - - private static Action getDrillThroughAction(NodeList nl) { - String name = null; - String id = null; - String caption = null; - Boolean captionIsMdx = null; - List translations = null; - TargetTypeEnum targetType = null; - String target = null; - String condition = null; - TypeEnum type = null; - String invocation = null; - String application = null; - String description = null; - List annotations = null; - Boolean defaultAction = null; - List columns = null; - Integer maximumRows = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CAPTION.equals(node.getNodeName())) { - caption = node.getTextContent(); - } - if (CAPTION_IS_MDX.equals(node.getNodeName())) { - captionIsMdx = toBoolean(node.getTextContent()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (TARGET_TYPE.equals(node.getNodeName())) { - targetType = TargetTypeEnum.fromValue(node.getTextContent()); - } - if (TARGET.equals(node.getNodeName())) { - target = node.getTextContent(); - } - if (CONDITION.equals(node.getNodeName())) { - condition = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = TypeEnum.fromValue(node.getTextContent()); - } - if (INVOCATION_LOW.equals(node.getNodeName())) { - invocation = node.getTextContent(); - } - if (APPLICATION.equals(node.getNodeName())) { - application = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - - if ("Default".equals(node.getNodeName())) { - defaultAction = toBoolean(node.getTextContent()); - } - if (COLUMNS.equals(node.getNodeName())) { - columns = getBindingList(node.getChildNodes()); - } - if ("MaximumRows".equals(node.getNodeName())) { - maximumRows = toInteger(node.getTextContent()); - } - } - } - return new DrillThroughActionR( - name, - Optional.ofNullable(id), - Optional.ofNullable(caption), - Optional.ofNullable(captionIsMdx), - Optional.ofNullable(translations), - targetType, - Optional.ofNullable(target), - Optional.ofNullable(condition), - type, - Optional.ofNullable(invocation), - Optional.ofNullable(application), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - Optional.ofNullable(defaultAction), - Optional.ofNullable(columns), - Optional.ofNullable(maximumRows) - ); - } - - private static List getBindingList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("CubeDimension".equals(node.getNodeName()))) { - list.add(getBinding(node.getChildNodes(), getNodeType(node))); - } - } - return list; - } - - private static Action getReportAction(NodeList nl) { - String name = null; - String id = null; - String caption = null; - Boolean captionIsMdx = null; - List translations = null; - TargetTypeEnum targetType = null; - String target = null; - String condition = null; - TypeEnum type = null; - String invocation = null; - String application = null; - String description = null; - List annotations = null; - String reportServer = null; - String path = null; - List reportParameters = null; - List reportFormatParameters = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CAPTION.equals(node.getNodeName())) { - caption = node.getTextContent(); - } - if (CAPTION_IS_MDX.equals(node.getNodeName())) { - captionIsMdx = toBoolean(node.getTextContent()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (TARGET_TYPE.equals(node.getNodeName())) { - targetType = TargetTypeEnum.fromValue(node.getTextContent()); - } - if (TARGET.equals(node.getNodeName())) { - target = node.getTextContent(); - } - if (CONDITION.equals(node.getNodeName())) { - condition = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = TypeEnum.fromValue(node.getTextContent()); - } - if (INVOCATION_LOW.equals(node.getNodeName())) { - invocation = node.getTextContent(); - } - if (APPLICATION.equals(node.getNodeName())) { - application = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("ReportServer".equals(node.getNodeName())) { - reportServer = node.getTextContent(); - } - if ("Path".equals(node.getNodeName())) { - path = node.getTextContent(); - } - if ("ReportParameters".equals(node.getNodeName())) { - reportParameters = getReportParameterList(node.getChildNodes()); - } - if ("ReportFormatParameters".equals(node.getNodeName())) { - reportFormatParameters = getReportFormatParametersList(node.getChildNodes()); - } - } - } - return new ReportActionR( - name, - Optional.ofNullable(id), - Optional.ofNullable(caption), - Optional.ofNullable(captionIsMdx), - Optional.ofNullable(translations), - targetType, - Optional.ofNullable(target), - Optional.ofNullable(condition), - type, - Optional.ofNullable(invocation), - Optional.ofNullable(application), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - reportServer, - Optional.ofNullable(path), - Optional.ofNullable(reportParameters), - Optional.ofNullable(reportFormatParameters) - ); - } - - private static List getReportFormatParametersList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("ReportFormatParameter".equals(node.getNodeName()))) { - list.add(getReportFormatParameter(node.getChildNodes())); - } - } - return list; - } - - private static ReportFormatParameter getReportFormatParameter(NodeList nl) { - String name = null; - String value = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = node.getTextContent(); - } - } - } - return new ReportFormatParameterR(name, value); - } - - private static List getReportParameterList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("ReportParameter".equals(node.getNodeName()))) { - list.add(getReportParameter(node.getChildNodes())); - } - } - return list; - } - - private static ReportParameter getReportParameter(NodeList nl) { - String name = null; - String value = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = node.getTextContent(); - } - } - } - return new ReportParameterR(name, value); - } - - private static Action getStandardAction(NodeList nl) { - String name = null; - String id = null; - String caption = null; - Boolean captionIsMdx = null; - List translations = null; - TargetTypeEnum targetType = null; - String target = null; - String condition = null; - TypeEnum type = null; - String invocation = null; - String application = null; - String description = null; - List annotations = null; - String expression = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CAPTION.equals(node.getNodeName())) { - caption = node.getTextContent(); - } - if (CAPTION_IS_MDX.equals(node.getNodeName())) { - captionIsMdx = toBoolean(node.getTextContent()); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (TARGET_TYPE.equals(node.getNodeName())) { - targetType = TargetTypeEnum.fromValue(node.getTextContent()); - } - if (TARGET.equals(node.getNodeName())) { - target = node.getTextContent(); - } - if (CONDITION.equals(node.getNodeName())) { - condition = node.getTextContent(); - } - if ("Type".equals(node.getNodeName())) { - type = TypeEnum.fromValue(node.getTextContent()); - } - if (INVOCATION_LOW.equals(node.getNodeName())) { - invocation = node.getTextContent(); - } - if (APPLICATION.equals(node.getNodeName())) { - application = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if (EXPRESSION.equals(node.getNodeName())) { - expression = node.getTextContent(); - } - } - } - return new StandardActionR( - name, - Optional.ofNullable(id), - Optional.ofNullable(caption), - Optional.ofNullable(captionIsMdx), - Optional.ofNullable(translations), - targetType, - Optional.ofNullable(target), - Optional.ofNullable(condition), - type, - Optional.ofNullable(invocation), - Optional.ofNullable(application), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - expression - ); - } - - private static CubeDimension getCubeDimension(NodeList nl) { - String id = null; - String name = null; - String description = null; - List translations = null; - String dimensionID = null; - Boolean visible = null; - String allMemberAggregationUsage = null; - String hierarchyUniqueNameStyle = null; - String memberUniqueNameStyle = null; - List attributes = null; - List hierarchies = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (TRANSLATIONS.equals(node.getNodeName())) { - translations = getTranslationList(node.getChildNodes(), TRANSLATION); - } - if (DIMENSION_ID.equals(node.getNodeName())) { - dimensionID = node.getTextContent(); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("AllMemberAggregationUsage".equals(node.getNodeName())) { - allMemberAggregationUsage = node.getTextContent(); - } - if ("HierarchyUniqueNameStyle".equals(node.getNodeName())) { - hierarchyUniqueNameStyle = node.getTextContent(); - } - if ("MemberUniqueNameStyle".equals(node.getNodeName())) { - memberUniqueNameStyle = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getCubeAttributeList(node.getChildNodes()); - } - if (HIERARCHIES.equals(node.getNodeName())) { - hierarchies = getCubeHierarchyList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new CubeDimensionR( - id, - name, - description, - translations, - dimensionID, - visible, - allMemberAggregationUsage, - hierarchyUniqueNameStyle, - memberUniqueNameStyle, - attributes, - hierarchies, - annotations); - } - - private static List getCubeHierarchyList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (HIERARCHY.equals(node.getNodeName()))) { - list.add(getCubeHierarchy(node.getChildNodes())); - } - } - return list; - } - - private static List getCubeAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (ATTRIBUTE.equals(node.getNodeName()))) { - list.add(getCubeAttribute(node.getChildNodes())); - } - } - return list; - } - - private static CubeAttribute getCubeAttribute(NodeList nl) { - String attributeID = null; - String aggregationUsage = null; - String attributeHierarchyOptimizedState = null; - Boolean attributeHierarchyEnabled = null; - Boolean attributeHierarchyVisible = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if ("AggregationUsage".equals(node.getNodeName())) { - aggregationUsage = node.getTextContent(); - } - if ("AttributeHierarchyOptimizedState".equals(node.getNodeName())) { - attributeHierarchyOptimizedState = node.getTextContent(); - } - if ("AttributeHierarchyEnabled".equals(node.getNodeName())) { - attributeHierarchyEnabled = toBoolean(node.getTextContent()); - } - if (ATTRIBUTE_HIERARCHY_VISIBLE.equals(node.getNodeName())) { - attributeHierarchyVisible = toBoolean(node.getTextContent()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new CubeAttributeR( - attributeID, - aggregationUsage, - attributeHierarchyOptimizedState, - attributeHierarchyEnabled, - attributeHierarchyVisible, - annotations); - } - - private static CubeHierarchy getCubeHierarchy(NodeList nl) { - String hierarchyID = null; - String optimizedState = null; - Boolean visible = null; - Boolean enabled = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("HierarchyID".equals(node.getNodeName())) { - hierarchyID = node.getTextContent(); - } - if ("OptimizedState".equals(node.getNodeName())) { - optimizedState = node.getTextContent(); - } - if (VISIBLE.equals(node.getNodeName())) { - visible = toBoolean(node.getTextContent()); - } - if ("Enabled".equals(node.getNodeName())) { - enabled = toBoolean(node.getTextContent()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new CubeHierarchyR( - hierarchyID, - optimizedState, - visible, - enabled, - annotations); - } - - private static CubePermission getCubePermission(NodeList nl) { - String readSourceData = null; - List dimensionPermissions = null; - List cellPermissions = null; - String name = null; - String id = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - String roleID = null; - Boolean process = null; - ReadDefinitionEnum readDefinition = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ROLE_ID.equals(node.getNodeName())) { - roleID = node.getTextContent(); - } - if (PROCESS.equals(node.getNodeName())) { - process = toBoolean(node.getTextContent()); - } - if (READ_DEFINITION.equals(node.getNodeName())) { - readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if ("ReadSourceData".equals(node.getNodeName())) { - readSourceData = node.getTextContent(); - } - if ("DimensionPermissions".equals(node.getNodeName())) { - dimensionPermissions = getCubeDimensionPermissionList(node.getChildNodes()); - } - if ("CellPermissions".equals(node.getNodeName())) { - cellPermissions = getCellPermissionList(node.getChildNodes()); - } - } - } - return new CubePermissionR( - Optional.ofNullable(readSourceData), - Optional.ofNullable(dimensionPermissions), - Optional.ofNullable(cellPermissions), - name, - Optional.ofNullable(id), - Optional.ofNullable(createdTimestamp), - Optional.ofNullable(lastSchemaUpdate), - Optional.ofNullable(description), - Optional.ofNullable(annotations), - roleID, - Optional.ofNullable(process), - Optional.ofNullable(readDefinition), - Optional.ofNullable(read), - Optional.ofNullable(write) - ); - } - - private static List getCellPermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("CellPermission".equals(node.getNodeName()))) { - list.add(getCellPermission(node.getChildNodes())); - } - } - return list; - } - - private static CellPermission getCellPermission(NodeList nl) { - AccessEnum access = null; - String description = null; - String expression = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if ("Access".equals(node.getNodeName())) { - access = AccessEnum.fromValue(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (EXPRESSION.equals(node.getNodeName())) { - expression = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - - return new CellPermissionR( - Optional.ofNullable(access), - Optional.ofNullable(description), - Optional.ofNullable(expression), - Optional.ofNullable(annotations) - ); - } - - private static List getCubeDimensionPermissionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("DimensionPermission".equals(node.getNodeName()))) { - list.add(getCubeDimensionPermission(node.getChildNodes())); - } - } - return list; - } - - private static CubeDimensionPermission getCubeDimensionPermission(NodeList nl) { - String cubeDimensionID = null; - String description = null; - ReadWritePermissionEnum read = null; - ReadWritePermissionEnum write = null; - List attributePermissions = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if ("Read".equals(node.getNodeName())) { - read = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if (WRITE.equals(node.getNodeName())) { - write = ReadWritePermissionEnum.fromValue(node.getTextContent()); - } - if ("AttributePermissions".equals(node.getNodeName())) { - attributePermissions = getAttributePermissionList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - - return new CubeDimensionPermissionR( - cubeDimensionID, - Optional.ofNullable(description), - Optional.ofNullable(read), - Optional.ofNullable(write), - Optional.ofNullable(attributePermissions), - Optional.ofNullable(annotations)); - } - - private static Assembly getAssembly(NodeList nl) { - String id = null; - String name = null; - Instant createdTimestamp = null; - Instant lastSchemaUpdate = null; - String description = null; - List annotations = null; - ImpersonationInfo impersonationInfo = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = node.getTextContent(); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = toInstant(node.getTextContent()); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = toInstant(node.getTextContent()); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - if ("ImpersonationInfo".equals(node.getNodeName())) { - impersonationInfo = getImpersonationInfo(node.getChildNodes()); - } - } - } - return new AssemblyR( - id, - name, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - impersonationInfo); - } - - private static AggregationDesign getAggregationDesign(NodeList nl) { - String name = null; - Optional id = Optional.empty(); - Optional createdTimestamp = Optional.empty(); - Optional lastSchemaUpdate = Optional.empty(); - Optional description = Optional.empty(); - Optional> annotations = Optional.empty(); - Optional estimatedRows = Optional.empty(); - Optional> dimensions = Optional.empty(); - Optional> aggregations = Optional.empty(); - Optional estimatedPerformanceGain = Optional.empty(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (ID.equals(node.getNodeName())) { - id = Optional.ofNullable(node.getTextContent()); - } - if (CREATED_TIMESTAMP.equals(node.getNodeName())) { - createdTimestamp = Optional.ofNullable(toInstant(node.getTextContent())); - } - if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { - lastSchemaUpdate = Optional.ofNullable(toInstant(node.getTextContent())); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = Optional.ofNullable(node.getTextContent()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = Optional.ofNullable(getAnnotationList(node.getChildNodes())); - } - if (ESTIMATED_ROWS.equals(node.getNodeName())) { - estimatedRows = Optional.ofNullable(toLong(node.getTextContent())); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = Optional.ofNullable(getAggregationDesignDimensionList(node.getChildNodes())); - } - if ("Aggregations".equals(node.getNodeName())) { - aggregations = Optional.ofNullable(getAggregationList(node.getChildNodes())); - } - if ("EstimatedPerformanceGain".equals(node.getNodeName())) { - estimatedPerformanceGain = Optional.ofNullable(toInteger(node.getTextContent())); - } - } - } - return new AggregationDesignR( - name, - id, - createdTimestamp, - lastSchemaUpdate, - description, - annotations, - estimatedRows, - dimensions, - aggregations, - estimatedPerformanceGain); - } - - private static List getAnnotationList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Aggregation".equals(node.getNodeName()))) { - list.add(getAnnotation(node.getChildNodes())); - } - } - return list; - } - - private static Annotation getAnnotation(NodeList nl) { - String name = null; - Optional visibility = Optional.empty(); - Optional value = Optional.empty(); - - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if ("Visibility".equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (VALUE.equals(node.getNodeName())) { - value = Optional.ofNullable(node.getTextContent()); - } - } - } - - return new AnnotationR( - name, - visibility, - value); - } - - private static List getAggregationList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && ("Aggregation".equals(node.getNodeName()))) { - list.add(getAggregation(node.getChildNodes())); - } - } - return list; - } - - private static Aggregation getAggregation(NodeList nl) { - Optional id = Optional.empty(); - String name = null; - Optional> dimensions = Optional.empty(); - Optional> annotations = Optional.empty(); - Optional description = Optional.empty(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ID.equals(node.getNodeName())) { - id = Optional.ofNullable(node.getTextContent()); - } - if (NAME.equals(node.getNodeName())) { - name = node.getTextContent(); - } - if (DESCRIPTION.equals(node.getNodeName())) { - description = Optional.ofNullable(node.getTextContent()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = Optional.ofNullable(getAnnotationList(node.getChildNodes())); - } - if (DIMENSIONS.equals(node.getNodeName())) { - dimensions = Optional.ofNullable(getAggregationDimensionList(node.getChildNodes())); - } - } - } - return new AggregationR(id, name, dimensions, annotations, description); - } - - private static List getAggregationDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if ((node != null) - && (DIMENSION.equals(node.getNodeName()))) { - list.add(getAggregationDimension(node.getChildNodes())); - } - } - return list; - } - - private static AggregationDimension getAggregationDimension(NodeList nl) { - String cubeDimensionID = null; - Optional> attributes = Optional.empty(); - Optional> annotations = Optional.empty(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = Optional.ofNullable(getAggregationAttributeList(node.getChildNodes())); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = Optional.ofNullable(getAnnotationList(node.getChildNodes())); - } - } - } - return new AggregationDimensionR(cubeDimensionID, attributes, annotations); - } - - private static List getAggregationAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null && ATTRIBUTE.equals(node.getNodeName())) { - list.add(getAggregationAttribute(node.getChildNodes())); - } - } - return list; - } - - private static AggregationAttribute getAggregationAttribute(NodeList nl) { - String attributeID = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new AggregationAttributeR(attributeID, Optional.ofNullable(annotations)); - } - - private static List getAggregationDesignDimensionList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null && DIMENSION.equals(node.getNodeName())) { - list.add(getAggregationDesignDimension(node.getChildNodes())); - } - } - return list; - } - - private static AggregationDesignDimension getAggregationDesignDimension(NodeList nl) { - String cubeDimensionID = null; - List attributes = null; - List annotations = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { - cubeDimensionID = node.getTextContent(); - } - if (ATTRIBUTES.equals(node.getNodeName())) { - attributes = getAggregationDesignAttributeList(node.getChildNodes()); - } - if (ANNOTATIONS.equals(node.getNodeName())) { - annotations = getAnnotationList(node.getChildNodes()); - } - } - } - return new AggregationDesignDimensionR( - cubeDimensionID, - Optional.ofNullable(attributes), - Optional.ofNullable(annotations) - ); - } - - private static List getAggregationDesignAttributeList(NodeList nl) { - List list = new ArrayList<>(); - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null && ATTRIBUTE.equals(node.getNodeName())) { - list.add(getAggregationDesignAttribute(node.getChildNodes())); - } - } - return list; - } - - private static AggregationDesignAttribute getAggregationDesignAttribute(NodeList nl) { - String attributeID = null; - Long estimatedCount = null; - for (int i = 0; i < nl.getLength(); i++) { - org.w3c.dom.Node node = nl.item(i); - if (node != null) { - if (ATTRIBUTE_ID.equals(node.getNodeName())) { - attributeID = node.getTextContent(); - } - if ("EstimatedCount".equals(node.getNodeName())) { - estimatedCount = toLong(node.getTextContent()); - } - } - } - return new AggregationDesignAttributeR(attributeID, Optional.ofNullable(estimatedCount)); - } - - private static Map getRestrictionMap(SOAPElement el) { - Iterator 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 restrictionValues(SOAPElement restrictionList) { - Map result = new HashMap<>(); - Iterator 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 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++) { - org.w3c.dom.Node n = nl.item(i); - result.put(n.getNodeName(), n.getTextContent()); - } - return result; - } - - private static String getAttribute(NamedNodeMap namedNodeMap, String name) { - if (namedNodeMap != null) { - org.w3c.dom.Node nameNode = namedNodeMap.getNamedItem(name); - if (nameNode != null) { - return nameNode.getTextContent(); - } - } - return null; - } - - private static String getNodeType(org.w3c.dom.Node node) { - return getAttribute(node.getAttributes(), XSI_TYPE); - } - - private static Boolean toBoolean(String it) { - return it != null ? Boolean.valueOf(it) : null; - } - - private static Long toLong(String it) { - return it != null ? Long.valueOf(it) : null; - } - - private static Integer toInteger(String it) { - return it != null ? Integer.valueOf(it) : null; - } - - private static BigInteger toBigInteger(String it) { - return it != null ? new BigInteger(it) : null; - } -} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/NamespaceConstants.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/NamespaceConstants.java new file mode 100644 index 0000000..05cd008 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/NamespaceConstants.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +import javax.xml.namespace.QName; + +/** + * XML namespace constants for XMLA SOAP messages. Contains namespace URIs, + * prefixes, and QNames for various XMLA-related schemas. + */ +public interface NamespaceConstants { + + /** + * Microsoft XMLA namespace constants. + */ + interface MSXMLA { + String PREFIX = "msxmla"; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis"; + + QName QN_COMMAND = new QName(NS_URN, "Command", PREFIX); + QName QN_DISCOVER = new QName(NS_URN, "Discover", PREFIX); + QName QN_DISCOVER_RESPONSE = new QName(NS_URN, "DiscoverResponse", ""); + QName QN_EXECUTE = new QName(NS_URN, "Execute", PREFIX); + QName QN_EXECUTE_RESPONSE = new QName(NS_URN, "ExecuteResponse", ""); + QName QN_PROPERTIES = new QName(NS_URN, "Properties", PREFIX); + QName QN_PARAMETERS = new QName(NS_URN, "Parameters", PREFIX); + QName QN_PROPERTY_LIST = new QName(NS_URN, "PropertyList", PREFIX); + QName QN_RESTRICTIONS = new QName(NS_URN, "Restrictions", PREFIX); + QName QN_RESTRICTION_LIST = new QName(NS_URN, "RestrictionList", PREFIX); + QName QN_RETURN = new QName(NS_URN, "return", ""); + QName QN_REQUEST_TYPE = new QName(NS_URN, "RequestType", PREFIX); + } + + /** + * Empty result namespace constants. + */ + interface EMPTY { + String PREFIX = "empty"; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis:empty"; + QName QN_ROOT = new QName(NS_URN, "root", PREFIX); + } + + /** + * MD Dataset namespace constants. + */ + interface MDDATASET { + String PREFIX = ""; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis:mddataset"; + + QName QN_ROOT = new QName(NS_URN, "root", PREFIX); + QName QN_OLAPINFO = new QName(NS_URN, "OlapInfo", PREFIX); + QName QN_CUBE_INFO = new QName(NS_URN, "CubeInfo", PREFIX); + QName QN_CUBE = new QName(NS_URN, "Cube", PREFIX); + QName QN_CUBE_NAME = new QName(NS_URN, "CubeName", PREFIX); + QName QN_AXES_INFO = new QName(NS_URN, "AxesInfo", PREFIX); + QName QN_AXIS_INFO = new QName(NS_URN, "AxisInfo", PREFIX); + QName QN_HIERARCHY_INFO = new QName(NS_URN, "HierarchyInfo", PREFIX); + QName QN_CELL_INFO = new QName(NS_URN, "CellInfo", PREFIX); + QName QN_AXES = new QName(NS_URN, "Axes", PREFIX); + QName QN_AXIS = new QName(NS_URN, "Axis", PREFIX); + QName QN_TUPLES = new QName(NS_URN, "Tuples", PREFIX); + QName QN_TUPLE = new QName(NS_URN, "Tuple", PREFIX); + QName QN_MEMBER = new QName(NS_URN, "Member", PREFIX); + QName QN_MEMBERS = new QName(NS_URN, "Members", PREFIX); + QName QN_CELL_DATA = new QName(NS_URN, "CellData", PREFIX); + QName QN_CELL = new QName(NS_URN, "Cell", PREFIX); + QName QN_UNION = new QName(NS_URN, "Union", PREFIX); + QName QN_CROSS_PRODUCT = new QName(NS_URN, "CrossProduct", PREFIX); + QName QN_NORM_TUPLE_SET = new QName(NS_URN, "NormTupleSet", PREFIX); + } + + /** + * Engine namespace constants. + */ + interface ENGINE { + String PREFIX = ""; + String NS_URN = "http://schemas.microsoft.com/analysisservices/2003/engine"; + } + + /** + * Engine 200 namespace constants. + */ + interface ENGINE200 { + String PREFIX = ""; + String NS_URN = "http://schemas.microsoft.com/analysisservices/2010/engine/200"; + QName QN_WARNING_COLUMN = new QName(NS_URN, "WarningColumn", PREFIX); + QName QN_WARNING_MEASURE = new QName(NS_URN, "WarningMeasure", PREFIX); + } + + /** + * XSI (XML Schema Instance) namespace constants. + */ + interface XSI { + String PREFIX = "xsi"; + String NS_URN = "http://www.w3.org/2001/XMLSchema-instance"; + } + + /** + * XSD (XML Schema Definition) namespace constants. + */ + interface XSD { + String PREFIX = "xsd"; + String NS_URN = "http://www.w3.org/2001/XMLSchema"; + + QName QN_SCHEMA = new QName(NS_URN, "schema", PREFIX); + QName QN_COMPLEX_TYPE = new QName(NS_URN, "complexType", PREFIX); + QName QN_SEQUENCE = new QName(NS_URN, "sequence", PREFIX); + QName QN_ELEMENT = new QName(NS_URN, "element", PREFIX); + QName QN_ANY = new QName(NS_URN, "any", PREFIX); + } + + /** + * SQL namespace constants. + */ + interface SQL { + String PREFIX = "sql"; + String NS_URN = "urn:schemas-microsoft-com:xml-sql"; + } + + /** + * Exception namespace constants. + */ + interface EX { + String PREFIX = "EX"; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis:exception"; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/PropertyConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/PropertyConverter.java new file mode 100644 index 0000000..5bf75d5 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/PropertyConverter.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +import java.util.Iterator; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.common.properties.PropertyListElementDefinition; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; + +import jakarta.xml.soap.Node; +import jakarta.xml.soap.SOAPElement; + +/** + * Shared utility for parsing Properties from SOAP elements. Used by both + * ExecuteDispatcher and DiscoverDispatcher. + */ +public class PropertyConverter { + + private PropertyConverter() { + // utility class + } + + /** + * Parse Properties from a SOAP element. + * + * @param propertiesElement the SOAP element containing properties + * @return parsed PropertiesR object + */ + public static PropertiesR propertiestoProperties(SOAPElement propertiesElement) { + Iterator nodeIterator = propertiesElement.getChildElements(); + while (nodeIterator.hasNext()) { + Node node = nodeIterator.next(); + if (node instanceof SOAPElement propertyList + && Constants.MSXMLA.QN_PROPERTY_LIST.equals(propertyList.getElementQName())) { + return propertyListToProperties(propertyList); + } + } + return new PropertiesR(); + } + + private static PropertiesR propertyListToProperties(SOAPElement propertyList) { + PropertiesR properties = new PropertiesR(); + + Iterator nodeIteratorPropertyList = propertyList.getChildElements(); + while (nodeIteratorPropertyList.hasNext()) { + Node n = nodeIteratorPropertyList.next(); + + if (n instanceof SOAPElement propertyListElement) { + String name = propertyListElement.getLocalName(); + Optional opd = PropertyListElementDefinition.byNameValue(name); + if (opd.isPresent()) { + opd.ifPresent(pd -> properties.addProperty(pd, propertyListElement.getTextContent())); + } else { + properties.setByname(name, propertyListElement.getTextContent()); + } + } + } + return properties; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/RequestMetaDataUtils.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/RequestMetaDataUtils.java index fb4e9a7..56496d9 100644 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/RequestMetaDataUtils.java +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/RequestMetaDataUtils.java @@ -13,19 +13,20 @@ */ package org.eclipse.daanse.xmla.server.adapter.soapmessage; -import org.eclipse.daanse.xmla.api.RequestMetaData; -import org.eclipse.daanse.xmla.api.xmla.Session; -import org.eclipse.daanse.xmla.model.record.RequestMetaDataR; - import java.util.List; import java.util.Map; import java.util.Optional; +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.xmla.Session; +import org.eclipse.daanse.xmla.model.record.RequestMetaDataR; + public class RequestMetaDataUtils { public static final String USER_AGENT = "User-agent"; - public static RequestMetaData getRequestMetaData(Map headers, Optional oSession, String url) { + public static RequestMetaData getRequestMetaData(Map headers, Optional oSession, + String url) { Optional oUserAgent = getUserAgent(headers.get(USER_AGENT)); return new RequestMetaDataR(oUserAgent, oSession.isPresent() ? Optional.of(oSession.get().sessionId()) : Optional.empty(), @@ -33,10 +34,8 @@ public static RequestMetaData getRequestMetaData(Map headers, Op } private static Optional getUserAgent(Object o) { - if (o instanceof List list) { - if (list.isEmpty()) { - return Optional.of((String) list.get(0)); - } + if (o instanceof List list && !list.isEmpty() && list.getFirst() instanceof String s) { + return Optional.of(s); } if (o instanceof String s) { return Optional.of(s); diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/SoapUtil.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/SoapUtil.java index 8611f5b..c6bc7bc 100644 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/SoapUtil.java +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/SoapUtil.java @@ -13,2382 +13,51 @@ */ package org.eclipse.daanse.xmla.server.adapter.soapmessage; -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ENGINE200.QN_WARNING_COLUMN; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ENGINE200.QN_WARNING_MEASURE; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_AXES_INFO; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_AXIS; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_AXIS_INFO; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_CELL; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_CELL_DATA; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_CROSS_PRODUCT; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_CUBE_INFO; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_HIERARCHY_INFO; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_MEMBER; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_MEMBERS; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_NORM_TUPLE_SET; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_TUPLE; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_TUPLES; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDDATASET.QN_UNION; -import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROWSET.ROW_PROPERTY.*; - -import java.io.IOException; -import java.io.StringReader; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; -import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.columns.DbSchemaColumnsResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.providertypes.DbSchemaProviderTypesResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.schemata.DbSchemaSchemataResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables.DbSchemaSourceTablesResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.tables.DbSchemaTablesResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo.DbSchemaTablesInfoResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.csdlmetadata.DiscoverCsdlMetaDataResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.enumerators.DiscoverEnumeratorsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.keywords.DiscoverKeywordsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.literals.DiscoverLiteralsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.properties.DiscoverPropertiesResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.schemarowsets.DiscoverSchemaRowsetsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata.DiscoverXmlMetaDataResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.actions.MdSchemaActionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.cubes.MdSchemaCubesResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.demensions.MdSchemaDimensionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.functions.MdSchemaFunctionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.functions.ParameterInfo; -import org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies.MdSchemaHierarchiesResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.kpis.MdSchemaKpisResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.levels.MdSchemaLevelsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MeasureGroupDimension; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups.MdSchemaMeasureGroupsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.measures.MdSchemaMeasuresResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.members.MdSchemaMembersResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.properties.MdSchemaPropertiesResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.sets.MdSchemaSetsResponseRow; -import org.eclipse.daanse.xmla.api.engine200.WarningColumn; -import org.eclipse.daanse.xmla.api.engine200.WarningLocationObject; -import org.eclipse.daanse.xmla.api.engine200.WarningMeasure; -import org.eclipse.daanse.xmla.api.exception.ErrorType; -import org.eclipse.daanse.xmla.api.exception.Exception; -import org.eclipse.daanse.xmla.api.exception.MessageLocation; -import org.eclipse.daanse.xmla.api.exception.Messages; -import org.eclipse.daanse.xmla.api.exception.StartEnd; -import org.eclipse.daanse.xmla.api.exception.WarningType; -import org.eclipse.daanse.xmla.api.execute.alter.AlterResponse; -import org.eclipse.daanse.xmla.api.execute.cancel.CancelResponse; -import org.eclipse.daanse.xmla.api.execute.clearcache.ClearCacheResponse; -import org.eclipse.daanse.xmla.api.execute.statement.StatementResponse; -import org.eclipse.daanse.xmla.api.mddataset.Axes; -import org.eclipse.daanse.xmla.api.mddataset.AxesInfo; -import org.eclipse.daanse.xmla.api.mddataset.Axis; -import org.eclipse.daanse.xmla.api.mddataset.AxisInfo; -import org.eclipse.daanse.xmla.api.mddataset.CellData; -import org.eclipse.daanse.xmla.api.mddataset.CellInfo; -import org.eclipse.daanse.xmla.api.mddataset.CellInfoItem; -import org.eclipse.daanse.xmla.api.mddataset.CellType; -import org.eclipse.daanse.xmla.api.mddataset.CellTypeError; -import org.eclipse.daanse.xmla.api.mddataset.CubeInfo; -import org.eclipse.daanse.xmla.api.mddataset.HierarchyInfo; -import org.eclipse.daanse.xmla.api.mddataset.Mddataset; -import org.eclipse.daanse.xmla.api.mddataset.MemberType; -import org.eclipse.daanse.xmla.api.mddataset.MembersType; -import org.eclipse.daanse.xmla.api.mddataset.NormTupleSet; -import org.eclipse.daanse.xmla.api.mddataset.OlapInfo; -import org.eclipse.daanse.xmla.api.mddataset.OlapInfoCube; -import org.eclipse.daanse.xmla.api.mddataset.RowSet; -import org.eclipse.daanse.xmla.api.mddataset.RowSetRow; -import org.eclipse.daanse.xmla.api.mddataset.RowSetRowItem; -import org.eclipse.daanse.xmla.api.mddataset.SetListType; -import org.eclipse.daanse.xmla.api.mddataset.TupleType; -import org.eclipse.daanse.xmla.api.mddataset.TuplesType; -import org.eclipse.daanse.xmla.api.mddataset.Type; -import org.eclipse.daanse.xmla.api.mddataset.Union; -import org.eclipse.daanse.xmla.api.mddataset.Value; -import org.eclipse.daanse.xmla.api.msxmla.MemberRef; -import org.eclipse.daanse.xmla.api.msxmla.MembersLookup; -import org.eclipse.daanse.xmla.api.msxmla.NormTuple; -import org.eclipse.daanse.xmla.api.msxmla.NormTuplesType; -import org.eclipse.daanse.xmla.api.xmla.Restriction; -import org.eclipse.daanse.xmla.api.xmla_empty.Emptyresult; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import jakarta.xml.soap.SOAPBody; -import jakarta.xml.soap.SOAPElement; -import jakarta.xml.soap.SOAPException; -import jakarta.xml.soap.SOAPFactory; - -public class SoapUtil { - - //private static final String UUID_VALUE = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"; - private static final String UUID_VALUE = "[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}"; - private static final Logger LOGGER = LoggerFactory.getLogger(SoapUtil.class); - - private SoapUtil() { - // constructor - } - - private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") - .withZone(ZoneId.systemDefault()); - - public static void toMdSchemaFunctions(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addMdSchemaFunctionsRoot(body); - - for (MdSchemaFunctionsResponseRow mdSchemaFunctionsResponseRow : rows) { - addMdSchemaFunctionsResponseRow(root, mdSchemaFunctionsResponseRow); - - } - - } - - public static void toMdSchemaDimensions(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addMdSchemaDimensionsRoot(body); - - for (MdSchemaDimensionsResponseRow mdSchemaDimensionsResponseRow : rows) { - addMdSchemaDimensionsResponseRow(root, mdSchemaDimensionsResponseRow); - - } - - } - - public static void toDiscoverProperties(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDiscoverPropertiesRoot(body); - - for (DiscoverPropertiesResponseRow discoverPropertiesResponseRow : rows) { - - addDiscoverPropertiesResponseRow(root, discoverPropertiesResponseRow); - } - - } - - public static void toMdSchemaCubes(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaCubesRoot(body); - for (MdSchemaCubesResponseRow mdSchemaCubesResponseRow : rows) { - addMdSchemaCubesResponseRow(root, mdSchemaCubesResponseRow); - } - - } - - public static void toMdSchemaMeasureGroups(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addMdSchemaMeasureGroupsRoot(body); - for (MdSchemaMeasureGroupsResponseRow mdSchemaMeasureGroupsResponseRow : rows) { - addMdSchemaMeasureGroupsResponseRow(root, mdSchemaMeasureGroupsResponseRow); - } - - } - - public static void toMdSchemaKpis(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaKpiRoot(body); - - for (MdSchemaKpisResponseRow mdSchemaKpisResponseRow : rows) { - addMdSchemaKpisResponseRow(root, mdSchemaKpisResponseRow); - } - - } - - public static void toMdSchemaSets(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaSetsRoot(body); - - for (MdSchemaSetsResponseRow mdSchemaSetsResponseRow : rows) { - addMdSchemaSetsResponseRow(root, mdSchemaSetsResponseRow); - } - - } - - public static void toMdSchemaProperties(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addMdSchemaPropertiesRoot(body); - for (MdSchemaPropertiesResponseRow mdSchemaPropertiesResponseRow : rows) { - addMdSchemaPropertiesResponseRow(root, mdSchemaPropertiesResponseRow); - } - - } - - public static void toMdSchemaMembers(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaMembersRoot(body); - - for (MdSchemaMembersResponseRow mdSchemaMembersResponseRow : rows) { - addMdSchemaMembersResponseRow(root, mdSchemaMembersResponseRow); - } - - } - - public static void toMdSchemaMeasures(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaMeasuresRoot(body); - - for (MdSchemaMeasuresResponseRow mdSchemaMeasuresResponseRow : rows) { - addMdSchemaMeasuresResponseRow(root, mdSchemaMeasuresResponseRow); - } - - } - - public static void toMdSchemaMeasureGroupDimensions(List rows, - SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaMeasureGroupDimensionsRoot(body); - - for (MdSchemaMeasureGroupDimensionsResponseRow mdSchemaMeasureGroupDimensionsResponseRow : rows) { - addMdSchemaMeasureGroupDimensionsResponseRow(root, mdSchemaMeasureGroupDimensionsResponseRow); - } - - } - - public static void toMdSchemaLevels(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaLevelsRoot(body); - - for (MdSchemaLevelsResponseRow mdSchemaLevelsResponseRow : rows) { - addMdSchemaLevelsResponseRow(root, mdSchemaLevelsResponseRow); - } - - } - - public static void toMdSchemaHierarchies(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addMdSchemaHierarchiesRoot(body); - - for (MdSchemaHierarchiesResponseRow mdSchemaHierarchiesResponseRow : rows) { - addMdSchemaHierarchiesResponseRow(root, mdSchemaHierarchiesResponseRow); - } - - } - - public static void toDbSchemaTablesInfo(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDbSchemaTablesInfoRoot(body); - - for (DbSchemaTablesInfoResponseRow dbSchemaTablesInfoResponseRow : rows) { - addDbSchemaTablesInfoResponseRow(root, dbSchemaTablesInfoResponseRow); - } - - } - - public static void toDbSchemaSourceTables(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDbSchemaSourceTablesRoot(body); - - for (DbSchemaSourceTablesResponseRow dbSchemaSourceTablesResponseRow : rows) { - addDbSchemaSourceTablesResponseRow(root, dbSchemaSourceTablesResponseRow); - } - - } - - public static void toDbSchemaSchemata(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addDbSchemaSchemataRoot(body); - for (DbSchemaSchemataResponseRow dbSchemaSchemataResponseRow : rows) { - addDbSchemaSchemataResponseRow(root, dbSchemaSchemataResponseRow); - } - - } - - public static void toDbSchemaProviderTypes(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDbSchemaProviderTypesRoot(body); - - for (DbSchemaProviderTypesResponseRow dbSchemaProviderTypesResponseRow : rows) { - addDbSchemaProviderTypesResponseRow(root, dbSchemaProviderTypesResponseRow); - } - - } - - public static void toDbSchemaColumns(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addDbSchemaColumnsRoot(body); - - for (DbSchemaColumnsResponseRow dbSchemaColumnsResponseRow : rows) { - addDbSchemaColumnsResponseRow(root, dbSchemaColumnsResponseRow); - } - - } - - public static void toDiscoverXmlMetaData(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDiscoverXmlMetaDataRoot(body); - - for (DiscoverXmlMetaDataResponseRow discoverXmlMetaDataResponseRow : rows) { - addDiscoverXmlMetaDataResponseRow(root, discoverXmlMetaDataResponseRow); - } - - } - - public static void toDiscoverCsdlMetaData(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDiscoverCsdlMetaDataRoot(body); - - for (DiscoverCsdlMetaDataResponseRow discoverCsdlMetaDataResponseRow : rows) { - addDiscoverCsdlMetaDataResponseRow(root, discoverCsdlMetaDataResponseRow); - } - - } - - public static void toDiscoverDataSources(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDiscoverDataSourcesRoot(body); - - for (DiscoverDataSourcesResponseRow discoverDataSourcesResponseRow : rows) { - addDiscoverDataSourcesResponseRow(root, discoverDataSourcesResponseRow); - } - - } - - public static void toDbSchemaCatalogs(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addDbSchemaCatalogsRoot(body); - - for (DbSchemaCatalogsResponseRow dbSchemaCatalogsResponseRow : rows) { - addDbSchemaCatalogsResponseRow(root, dbSchemaCatalogsResponseRow); - } - - } - - public static void toDiscoverSchemaRowsets(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDiscoverRowSetsRoot(body); - - for (DiscoverSchemaRowsetsResponseRow discoverSchemaRowsetsResponseRow : rows) { - addDiscoverSchemaRowsetsResponseRow(root, discoverSchemaRowsetsResponseRow); - } - - } - - public static void toDiscoverEnumerators(List rows, SOAPBody body) - throws SOAPException { - SOAPElement root = addDiscoverEnumeratorsRoot(body); - - for (DiscoverEnumeratorsResponseRow discoverEnumeratorsResponseRow : rows) { - addDiscoverEnumeratorsResponseRow(root, discoverEnumeratorsResponseRow); - } - - } - - public static void toDiscoverKeywords(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addDiscoverKeywordsRoot(body); - - for (DiscoverKeywordsResponseRow discoverKeywordsResponseRow : rows) { - addDiscoverKeywordsResponseRow(root, discoverKeywordsResponseRow); - } - } - - public static void toDiscoverLiterals(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addDiscoverLiteralsRoot(body); - - for (DiscoverLiteralsResponseRow discoverLiteralsResponseRow : rows) { - addDiscoverLiteralsResponseRow(root, discoverLiteralsResponseRow); - } - } - - public static void toDbSchemaTables(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addDbSchemaTablesRoot(body); - - for (DbSchemaTablesResponseRow dbSchemaTablesResponseRow : rows) { - addDbSchemaTablesResponseRow(root, dbSchemaTablesResponseRow); - - } - - } - - public static void toMdSchemaActions(List rows, SOAPBody body) throws SOAPException { - SOAPElement root = addMdSchemaActionsRoot(body); - - for (MdSchemaActionsResponseRow mdSchemaActionsResponseRow : rows) { - addMdSchemaActionsResponseRow(root, mdSchemaActionsResponseRow); - } - } - - public static void toStatementResponse(StatementResponse statementResponse, SOAPBody body) throws SOAPException { - if (statementResponse != null && statementResponse.mdDataSet() != null) { - SOAPElement root = addMddatasetRoot(body); - addMdDataSet(root, statementResponse.mdDataSet()); - } - if (statementResponse.rowSet() != null) { - SOAPElement root = addRowSetRoot(body, statementResponse.rowSet()); - List rowSetRows = statementResponse.rowSet().rowSetRows(); - if (rowSetRows != null) { - - for (RowSetRow rowSetRow : rowSetRows) { - addRowSetRow(root, rowSetRow); - } - } - } - if (statementResponse.mdDataSet() == null && statementResponse.rowSet() == null) { - addEmptyRoot(body); - } - } - - private static void addRowSetRow(SOAPElement e, RowSetRow it) throws SOAPException { - SOAPElement seRow = e.addChildElement(Constants.ROWSET.QN_ROW); - if (it.rowSetRowItem() != null) { - it.rowSetRowItem().forEach(i -> addRowSetRowItem(seRow, i)); - } - } - - private static void addRowSetRowItem(SOAPElement e, RowSetRowItem it) { - if (it != null) { - SOAPElement el = addChildElement(e, it.tagName(), Constants.ROWSET.PREFIX); - el.setTextContent(it.value()); - it.type().ifPresent(v -> setAttribute(el, "type", v.getValue())); - } - } - - public static void toAlterResponse(AlterResponse alterResponse, SOAPBody body) throws SOAPException { - SOAPElement root = addEmptyRoot(body); - if (alterResponse != null) { - addEmptyresult(root, alterResponse.emptyresult()); - } - } - - public static void toClearCacheResponse(ClearCacheResponse clearCacheResponse, SOAPBody body) throws SOAPException { - SOAPElement root = addEmptyRoot(body); - if (clearCacheResponse != null) { - addEmptyresult(root, clearCacheResponse.emptyresult()); - } - } - - public static void toCancelResponse(CancelResponse cancelResponse, SOAPBody body) throws SOAPException { - SOAPElement root = addEmptyRoot(body); - if (cancelResponse != null) { - addEmptyresult(root, cancelResponse.emptyresult()); - } - } - - private static void addEmptyresult(SOAPElement root, Emptyresult emptyresult) { - addException(root, emptyresult.exception()); - addMessages(root, emptyresult.messages()); - } - - private static void addMdSchemaActionsResponseRow(SOAPElement root, MdSchemaActionsResponseRow r) - throws SOAPException { - - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - addChildElement(row, QN_CUBE_NAME, r.cubeName()); - r.actionName().ifPresent(v -> addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_ACTION_NAME, v)); - r.actionType().ifPresent(v -> addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_ACTION_TYPE, String.valueOf(v.getValue()))); - addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_COORDINATE, r.coordinate()); - addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_COORDINATE_TYPE, String.valueOf(r.coordinateType().getValue())); - r.actionCaption().ifPresent(v -> addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_ACTION_CAPTION, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.content().ifPresent(v -> addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_CONTENT, v)); - r.application().ifPresent(v -> addChildElement(row, QN_APPLICATION, v)); - r.invocation().ifPresent(v -> addChildElement(row, QN_INVOCATION, String.valueOf(v.getValue()))); - } - - private static void addDbSchemaTablesResponseRow(SOAPElement root, DbSchemaTablesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.tableCatalog().ifPresent(v -> addChildElement(row, QN_TABLE_CATALOG, v)); - r.tableSchema().ifPresent(v -> addChildElement(row, QN_TABLE_SCHEMA, v)); - r.tableName().ifPresent(v -> addChildElement(row, QN_TABLE_NAME, v)); - r.tableType().ifPresent(v -> addChildElement(row, QN_TABLE_TYPE, v)); - r.tableGuid().ifPresent(v -> addChildElement(row, QN_TABLE_GUID, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.tablePropId().ifPresent(v -> addChildElement(row, QN_TABLE_PROP_ID, String.valueOf(v))); - r.dateCreated().ifPresent(v -> addChildElement(row, QN_DATE_CREATED, v.format(formatter))); - r.dateModified().ifPresent(v -> addChildElement(row, QN_DATE_MODIFIED, v.format(formatter))); - } - - private static void addDiscoverLiteralsResponseRow(SOAPElement root, DiscoverLiteralsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_LITERAL_NAME, r.literalName()); - addChildElement(row, QN_LITERAL_VALUE, r.literalValue()); - addChildElement(row, QN_LITERAL_INVALID_CHARS, r.literalInvalidChars()); - addChildElement(row, QN_LITERAL_INVALID_STARTING_CHARS, r.literalInvalidStartingChars()); - addChildElement(row, QN_LITERAL_MAX_LENGTH, String.valueOf(r.literalMaxLength())); - addChildElement(row, QN_LITERAL_NAME_ENUM_VALUE, String.valueOf(r.literalNameEnumValue().getValue())); - } - - private static void addDiscoverKeywordsResponseRow(SOAPElement root, DiscoverKeywordsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_KEYWORD, r.keyword()); - } - - private static void addDiscoverEnumeratorsResponseRow(SOAPElement root, DiscoverEnumeratorsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_ENUM_NAME, r.enumName()); - r.enumDescription().ifPresent(v -> addChildElement(row, QN_ENUM_DESCRIPTION, v)); - addChildElement(row, QN_ENUM_TYPE, r.enumType()); - addChildElement(row, QN_ELEMENT_NAME, r.elementName()); - r.elementDescription().ifPresent(v -> addChildElement(row, QN_ELEMENT_DESCRIPTION, v)); - r.elementValue().ifPresent(v -> addChildElement(row, QN_ELEMENT_VALUE, v)); - } - - private static void addDiscoverSchemaRowsetsResponseRow(SOAPElement root, DiscoverSchemaRowsetsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_SCHEMA_NAME_LC, r.schemaName()); - r.schemaGuid().ifPresent(v -> addChildElement(row, QN_SCHEMA_GUID, v)); - r.restrictions().ifPresent(v -> addRestrictionList(row, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION_LC, v)); - r.restrictionsMask().ifPresent(v -> addChildElement(row, QN_RESTRICTIONS_MASK, String.valueOf(v))); - } - - private static void addRestrictionList(SOAPElement el, List list) { - if (list != null) { - list.forEach(it -> addRestriction(el, it)); - } - } - - private static void addRestriction(SOAPElement e, Restriction it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_RESTRICTIONS); - SOAPElement name = addChildElement(el, QN_NAME_LC); - name.setTextContent(it.name()); - SOAPElement type = addChildElement(el, QN_TYPE_LC); - type.setTextContent(it.type()); - } - } - - private static void addDbSchemaCatalogsResponseRow(SOAPElement root, DbSchemaCatalogsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.roles().ifPresent(v -> addChildElement(row, QN_ROLES, v)); - r.dateModified().ifPresent(v -> addChildElement(row, QN_DATE_MODIFIED, v.format(formatter))); - r.compatibilityLevel().ifPresent(v -> addChildElement(row, QN_COMPATIBILITY_LEVEL, String.valueOf(v))); - r.type().ifPresent(v -> addChildElement(row, QN_TYPE, String.valueOf(v.getValue()))); - r.version().ifPresent(v -> addChildElement(row, QN_VERSION, String.valueOf(v))); - r.databaseId().ifPresent(v -> addChildElement(row, QN_DATABASE_ID, v)); - r.dateQueried().ifPresent(v -> addChildElement(row, QN_DATE_QUERIED, v.format(formatter))); - r.currentlyUsed().ifPresent(v -> addChildElement(row, QN_CURRENTLY_USED, String.valueOf(v))); - r.popularity().ifPresent(v -> addChildElement(row, QN_POPULARITY, String.valueOf(v))); - r.weightedPopularity().ifPresent(v -> addChildElement(row, QN_WEIGHTEDPOPULARITY, String.valueOf(v))); - r.clientCacheRefreshPolicy() - .ifPresent(v -> addChildElement(row, QN_CLIENTCACHEREFRESHPOLICY, String.valueOf(v.getValue()))); - } - - private static void addDiscoverDataSourcesResponseRow(SOAPElement root, DiscoverDataSourcesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_DATA_SOURCE_NAME, r.dataSourceName()); - r.dataSourceDescription().ifPresent(v -> addChildElement(row, QN_DATA_SOURCE_DESCRIPTION, v)); - r.url().ifPresent(v -> addChildElement(row, QN_URL, v)); - r.dataSourceInfo().ifPresent(v -> addChildElement(row, QN_DATA_SOURCE_INFO, v)); - addChildElement(row, QN_PROVIDER_NAME, r.providerName()); - r.providerType().ifPresent(v -> addChildElement(row, QN_PROVIDER_TYPE, v.name())); - r.authenticationMode().ifPresent(v -> addChildElement(row, QN_AUTHENTICATION_MODE, v.getValue())); - } - - private static void addDiscoverXmlMetaDataResponseRow(SOAPElement root, DiscoverXmlMetaDataResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElementTextNode(row, QN_META_DATA, r.metaData()); - } - - private static void addDiscoverCsdlMetaDataResponseRow(SOAPElement root, DiscoverCsdlMetaDataResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElementTextNode(row, QN_META_DATA, r.metaData()); - } - - private static void addDbSchemaColumnsResponseRow(SOAPElement root, DbSchemaColumnsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.tableCatalog().ifPresent(v -> addChildElement(row, QN_TABLE_CATALOG, v)); - r.tableSchema().ifPresent(v -> addChildElement(row, QN_TABLE_SCHEMA, v)); - r.tableName().ifPresent(v -> addChildElement(row, QN_TABLE_NAME, v)); - r.columnName().ifPresent(v -> addChildElement(row, QN_COLUMN_NAME, v)); - r.columnGuid().ifPresent(v -> addChildElement(row, QN_COLUMN_GUID, String.valueOf(v))); - r.columnPropId().ifPresent(v -> addChildElement(row, QN_COLUMN_PROPID, String.valueOf(v))); - r.ordinalPosition().ifPresent(v -> addChildElement(row, QN_ORDINAL_POSITION, String.valueOf(v))); - r.columnHasDefault().ifPresent(v -> addChildElement(row, QN_COLUMN_HAS_DEFAULT, String.valueOf(v))); - r.columnDefault().ifPresent(v -> addChildElement(row, QN_COLUMN_DEFAULT, v)); - r.columnFlags().ifPresent(v -> addChildElement(row, QN_COLUMN_FLAG, String.valueOf(v.getValue()))); - r.isNullable().ifPresent(v -> addChildElement(row, QN_IS_NULLABLE, String.valueOf(v))); - r.dataType().ifPresent(v -> addChildElement(row, QN_DATA_TYPE, String.valueOf(v))); - r.typeGuid().ifPresent(v -> addChildElement(row, QN_TYPE_GUID, String.valueOf(v))); - r.characterMaximum() - .ifPresent(v -> addChildElement(row, QN_CHARACTER_MAXIMUM_LENGTH, String.valueOf(v))); - r.characterOctetLength() - .ifPresent(v -> addChildElement(row, QN_CHARACTER_OCTET_LENGTH, String.valueOf(v))); - r.numericPrecision().ifPresent(v -> addChildElement(row, QN_NUMERIC_PRECISION, String.valueOf(v))); - r.numericScale().ifPresent(v -> addChildElement(row, QN_NUMERIC_SCALE, String.valueOf(v))); - r.dateTimePrecision().ifPresent(v -> addChildElement(row, QN_DATETIME_PRECISION, String.valueOf(v))); - r.characterSetCatalog().ifPresent(v -> addChildElement(row, QN_CHARACTER_SET_CATALOG, v)); - r.characterSetSchema().ifPresent(v -> addChildElement(row, QN_CHARACTER_SET_SCHEMA, v)); - r.characterSetName().ifPresent(v -> addChildElement(row, QN_CHARACTER_SET_NAME, v)); - r.collationCatalog().ifPresent(v -> addChildElement(row, QN_COLLATION_CATALOG, v)); - r.collationSchema().ifPresent(v -> addChildElement(row, QN_COLLATION_SCHEMA, v)); - r.collationName().ifPresent(v -> addChildElement(row, QN_COLLATION_NAME, v)); - r.domainCatalog().ifPresent(v -> addChildElement(row, QN_DOMAIN_CATALOG, v)); - r.domainSchema().ifPresent(v -> addChildElement(row, QN_DOMAIN_SCHEMA, v)); - r.domainName().ifPresent(v -> addChildElement(row, QN_DOMAIN_NAME, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.columnOlapType().ifPresent(v -> addChildElement(row, QN_COLUMN_OLAP_TYPE, v.name())); - } - - private static void addDbSchemaProviderTypesResponseRow(SOAPElement root, DbSchemaProviderTypesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.typeName().ifPresent(v -> addChildElement(row, QN_TYPE_NAME, v)); - r.dataType().ifPresent(v -> addChildElement(row, QN_DATA_TYPE, String.valueOf(v.getValue()))); - r.columnSize().ifPresent(v -> addChildElement(row, QN_COLUMN_SIZE, String.valueOf(v))); - r.literalPrefix().ifPresent(v -> addChildElement(row, QN_LITERAL_PREFIX, v)); - r.literalSuffix().ifPresent(v -> addChildElement(row, QN_LITERAL_SUFFIX, v)); - r.createParams().ifPresent(v -> addChildElement(row, QN_CREATE_PARAMS, v)); - r.isNullable().ifPresent(v -> addChildElement(row, QN_IS_NULLABLE, String.valueOf(v))); - r.caseSensitive().ifPresent(v -> addChildElement(row, QN_CASE_SENSITIVE, String.valueOf(v))); - r.searchable().ifPresent(v -> addChildElement(row, QN_SEARCHABLE, String.valueOf(v.getValue()))); - r.unsignedAttribute().ifPresent(v -> addChildElement(row, QN_UNSIGNED_ATTRIBUTE, String.valueOf(v))); - r.fixedPrecScale().ifPresent(v -> addChildElement(row, QN_FIXED_PREC_SCALE, String.valueOf(v))); - r.autoUniqueValue().ifPresent(v -> addChildElement(row, QN_AUTO_UNIQUE_VALUE, String.valueOf(v))); - r.localTypeName().ifPresent(v -> addChildElement(row, QN_LOCAL_TYPE_NAME, v)); - r.minimumScale().ifPresent(v -> addChildElement(row, QN_MINIMUM_SCALE, String.valueOf(v))); - r.maximumScale().ifPresent(v -> addChildElement(row, QN_MAXIMUM_SCALE, String.valueOf(v))); - r.guid().ifPresent(v -> addChildElement(row, QN_GUID, String.valueOf(v))); - r.typeLib().ifPresent(v -> addChildElement(row, QN_TYPE_LIB, v)); - r.version().ifPresent(v -> addChildElement(row, QN_VERSION, v)); - r.isLong().ifPresent(v -> addChildElement(row, QN_IS_LONG, String.valueOf(v))); - r.bestMatch().ifPresent(v -> addChildElement(row, QN_BEST_MATCH, String.valueOf(v))); - r.isFixedLength().ifPresent(v -> addChildElement(row, QN_IS_FIXEDLENGTH, String.valueOf(v))); - } - - private static void addDbSchemaSchemataResponseRow(SOAPElement root, DbSchemaSchemataResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_CATALOG_NAME, r.catalogName()); - addChildElement(row, QN_SCHEMA_NAME, r.schemaName()); - addChildElement(row, QN_SCHEMA_OWNER, r.schemaOwner()); - } - - private static void addDbSchemaSourceTablesResponseRow(SOAPElement root, DbSchemaSourceTablesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_TABLE_CATALOG, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_TABLE_SCHEMA, v)); - addChildElement(row, QN_TABLE_NAME, r.tableName()); - addChildElement(row, QN_TABLE_TYPE, r.tableType().getValue()); - } - - private static void addDbSchemaTablesInfoResponseRow(SOAPElement root, DbSchemaTablesInfoResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_TABLE_CATALOG, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_TABLE_SCHEMA, v)); - addChildElement(row, QN_TABLE_NAME, r.tableName()); - addChildElement(row, QN_TABLE_TYPE, r.tableType()); - r.tableGuid().ifPresent(v -> addChildElement(row, QN_TABLE_GUID, String.valueOf(v))); - r.bookmarks().ifPresent(v -> addChildElement(row, QN_BOOKMARKS, String.valueOf(v))); - r.bookmarkType().ifPresent(v -> addChildElement(row, QN_BOOKMARK_TYPE, String.valueOf(v))); - r.bookmarkDataType().ifPresent(v -> addChildElement(row, QN_BOOKMARK_DATA_TYPE, String.valueOf(v))); - r.bookmarkMaximumLength() - .ifPresent(v -> addChildElement(row, QN_BOOKMARK_MAXIMUM_LENGTH, String.valueOf(v))); - r.bookmarkInformation().ifPresent(v -> addChildElement(row, QN_BOOKMARK_INFORMATION, String.valueOf(v))); - r.tableVersion().ifPresent(v -> addChildElement(row, QN_TABLE_VERSION, String.valueOf(v))); - r.cardinality().ifPresent(v -> addChildElement(row, QN_CARDINALITY, String.valueOf(v))); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.tablePropId().ifPresent(v -> addChildElement(row, QN_TABLE_PROP_ID, String.valueOf(v))); - } - - private static void addMdSchemaHierarchiesResponseRow(SOAPElement root, MdSchemaHierarchiesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - r.dimensionUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_UNIQUE_NAME, v)); - r.hierarchyName().ifPresent(v -> addChildElement(row, QN_HIERARCHY_NAME, v)); - r.hierarchyUniqueName().ifPresent(v -> addChildElement(row, QN_HIERARCHY_UNIQUE_NAME, v)); - r.hierarchyGuid().ifPresent(v -> addChildElement(row, QN_HIERARCHY_GUID, String.valueOf(v))); - r.hierarchyCaption().ifPresent(v -> addChildElement(row, QN_HIERARCHY_CAPTION, v)); - r.dimensionType().ifPresent(v -> addChildElement(row, QN_DIMENSION_TYPE, String.valueOf(v.getValue()))); - r.hierarchyCardinality() - .ifPresent(v -> addChildElement(row, QN_HIERARCHY_CARDINALITY, String.valueOf(v))); - r.defaultMember().ifPresent(v -> addChildElement(row, QN_DEFAULT_MEMBER, v)); - r.allMember().ifPresent(v -> addChildElement(row, QN_ALL_MEMBER, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.structure().ifPresent(v -> addChildElement(row, QN_STRUCTURE, String.valueOf(v.getValue()))); - r.isVirtual().ifPresent(v -> addChildElement(row, QN_IS_VIRTUAL, String.valueOf(v))); - r.isReadWrite().ifPresent(v -> addChildElement(row, QN_IS_READWRITE, String.valueOf(v))); - r.dimensionUniqueSettings().ifPresent( - v -> addChildElement(row, QN_DIMENSION_UNIQUE_SETTINGS, String.valueOf(v.getValue()))); - r.dimensionMasterUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_MASTER_UNIQUE_NAME, v)); - r.dimensionIsVisible().ifPresent(v -> addChildElement(row, QN_DIMENSION_IS_VISIBLE, String.valueOf(v))); - r.hierarchyOrdinal().ifPresent(v -> addChildElement(row, QN_HIERARCHY_ORDINAL, String.valueOf(v))); - r.dimensionIsShared().ifPresent(v -> addChildElement(row, QN_DIMENSION_IS_SHARED, String.valueOf(v))); - r.hierarchyIsVisible().ifPresent(v -> addChildElement(row, QN_HIERARCHY_IS_VISIBLE, String.valueOf(v))); - r.hierarchyOrigin() - .ifPresent(v -> addChildElement(row, QN_HIERARCHY_ORIGIN, String.valueOf(v.getValue()))); - r.hierarchyDisplayFolder().ifPresent(v -> addChildElement(row, QN_HIERARCHY_DISPLAY_FOLDER, v)); - //r.hierarchyIsVisible().ifPresent(v -> addChildElement(row, "HIERARCHY_VISIBILITY", prefix, v == true ? "1" : "0")); - //addChildElement(row, "PARENT_CHILD", prefix, "false"); - r.instanceSelection() - .ifPresent(v -> addChildElement(row, QN_INSTANCE_SELECTION, String.valueOf(v.getValue()))); - r.groupingBehavior() - .ifPresent(v -> addChildElement(row, QN_GROUPING_BEHAVIOR, String.valueOf(v.getValue()))); - r.structureType().ifPresent(v -> addChildElement(row, QN_STRUCTURE_TYPE, String.valueOf(v.getValue()))); - } - - private static void addMdSchemaLevelsResponseRow(SOAPElement root, MdSchemaLevelsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - r.dimensionUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_UNIQUE_NAME, v)); - r.hierarchyUniqueName().ifPresent(v -> addChildElement(row, QN_HIERARCHY_UNIQUE_NAME, v)); - r.levelName().ifPresent(v -> addChildElement(row, QN_LEVEL_NAME, v)); - r.levelUniqueName().ifPresent(v -> addChildElement(row, QN_LEVEL_UNIQUE_NAME, v)); - r.levelGuid().ifPresent(v -> addChildElement(row, QN_LEVEL_GUID, String.valueOf(v))); - r.levelCaption().ifPresent(v -> addChildElement(row, QN_LEVEL_CAPTION, v)); - r.levelNumber().ifPresent(v -> addChildElement(row, QN_LEVEL_NUMBER, String.valueOf(v))); - r.levelCardinality().ifPresent(v -> addChildElement(row, QN_LEVEL_CARDINALITY, String.valueOf(v))); - r.levelType().ifPresent(v -> addChildElement(row, QN_LEVEL_TYPE, String.valueOf(v.getValue()))); - r.customRollupSetting() - .ifPresent(v -> addChildElement(row, QN_CUSTOM_ROLLUP_SETTINGS, String.valueOf(v.getValue()))); - r.levelUniqueSettings() - .ifPresent(v -> addChildElement(row, QN_LEVEL_UNIQUE_SETTINGS, String.valueOf(v.getValue()))); - r.levelIsVisible().ifPresent(v -> addChildElement(row, QN_LEVEL_IS_VISIBLE, String.valueOf(v))); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - // absent in old mondrian - // r.levelOrderingProperty().ifPresent(v -> addChildElement(row, - // "LEVEL_ORDERING_PROPERTY", prefix, v)); - // r.levelDbType().ifPresent(v -> addChildElement(row, "LEVEL_DBTYPE", prefix, - // String.valueOf(v.getValue()))); - // r.levelMasterUniqueName().ifPresent(v -> addChildElement(row, - // "LEVEL_MASTER_UNIQUE_NAME", prefix, v)); - // r.levelNameSqlColumnName().ifPresent(v -> addChildElement(row, - // "LEVEL_NAME_SQL_COLUMN_NAME", prefix, v)); - // r.levelKeySqlColumnName().ifPresent(v -> addChildElement(row, - // "LEVEL_KEY_SQL_COLUMN_NAME", prefix, v)); - // r.levelUniqueNameSqlColumnName().ifPresent(v -> addChildElement(row, - // "LEVEL_UNIQUE_NAME_SQL_COLUMN_NAME", prefix, v)); - // r.levelAttributeHierarchyName().ifPresent(v -> addChildElement(row, - // "LEVEL_ATTRIBUTE_HIERARCHY_NAME", prefix, v)); - // r.levelKeyCardinality().ifPresent(v -> addChildElement(row, - // "LEVEL_KEY_CARDINALITY", prefix, String.valueOf(v))); - - r.levelOrigin().ifPresent(v -> addChildElement(row, QN_LEVEL_ORIGIN, String.valueOf(v.getValue()))); - } - - private static void addMdSchemaMeasureGroupDimensionsResponseRow(SOAPElement root, - MdSchemaMeasureGroupDimensionsResponseRow r) throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - - r.measureGroupName().ifPresent(v -> addChildElement(row, QN_MEASUREGROUP_NAME, v)); - r.measureGroupCardinality().ifPresent(v -> addChildElement(row, QN_MEASUREGROUP_CARDINALITY, v)); - r.dimensionUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_UNIQUE_NAME, v)); - r.dimensionCardinality().ifPresent(v -> addChildElement(row, QN_DIMENSION_CARDINALITY, v.name())); - r.dimensionIsVisible().ifPresent(v -> addChildElement(row, QN_DIMENSION_IS_VISIBLE, String.valueOf(v))); - r.dimensionIsFactDimension() - .ifPresent(v -> addChildElement(row, QN_DIMENSION_IS_FACT_DIMENSION, String.valueOf(v))); - r.dimensionPath().ifPresent(v -> addMeasureGroupDimensionXmlList(row, v)); - r.dimensionGranularity() - .ifPresent(v -> addChildElement(row, QN_DIMENSION_GRANULARITY, v)); - } - - private static void addMeasureGroupDimensionXmlList(SOAPElement el, List list) { - if (list != null) { - SOAPElement e = addChildElement(el, QN_DIMENSION_PATH); - list.forEach(it -> addMeasureGroupDimensionXml(e, it)); - } - } - - private static void addMeasureGroupDimensionXml(SOAPElement el, MeasureGroupDimension it) { - addChildElement(el, QN_MEASURE_GROUP_DIMENSION, it.measureGroupDimension()); - } - - private static void addMdSchemaMeasuresResponseRow(SOAPElement root, MdSchemaMeasuresResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - r.measureName().ifPresent(v -> addChildElement(row, QN_MEASURE_NAME, v)); - r.measureUniqueName().ifPresent(v -> addChildElement(row, QN_MEASURE_UNIQUE_NAME, v)); - r.measureCaption().ifPresent(v -> addChildElement(row, QN_MEASURE_CAPTION, v)); - r.measureGuid().ifPresent(v -> addChildElement(row, QN_MEASURE_GUID, String.valueOf(v))); - r.measureAggregator() - .ifPresent(v -> addChildElement(row, QN_MEASURE_AGGREGATOR, String.valueOf(v.getValue()))); - r.dataType().ifPresent(v -> addChildElement(row, QN_DATA_TYPE, String.valueOf(v.getValue()))); - r.numericPrecision().ifPresent(v -> addChildElement(row, QN_NUMERIC_PRECISION, String.valueOf(v))); - r.numericScale().ifPresent(v -> addChildElement(row, QN_NUMERIC_SCALE, String.valueOf(v))); - r.measureUnits().ifPresent(v -> addChildElement(row, QN_MEASURE_UNITS, v)); - r.expression().ifPresent(v -> addChildElement(row, QN_EXPRESSION, v)); - r.measureIsVisible().ifPresent(v -> addChildElement(row, QN_MEASURE_IS_VISIBLE, String.valueOf(v))); - r.levelsList().ifPresent(v -> addChildElement(row, QN_LEVELS_LIST, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.measureNameSqlColumnName().ifPresent(v -> addChildElement(row, QN_MEASURE_NAME_SQL_COLUMN_NAME, v)); - r.measureUnqualifiedCaption().ifPresent(v -> addChildElement(row, QN_MEASURE_UNQUALIFIED_CAPTION, v)); - r.measureGroupName().ifPresent(v -> addChildElement(row, QN_MEASUREGROUP_NAME, v)); - r.measureDisplayFolder().ifPresent(v -> addChildElement(row, QN_MEASURE_DISPLAY_FOLDER, v)); - r.defaultFormatString().ifPresent(v -> addChildElement(row, QN_DEFAULT_FORMAT_STRING, v)); - r.cubeSource().ifPresent(v -> addChildElement(row, QN_CUBE_SOURCE, String.valueOf(v.getValue()))); - r.measureVisibility() - .ifPresent(v -> addChildElement(row, QN_MEASURE_VISIBILITY, String.valueOf(v.getValue()))); - } - - private static void addMdSchemaMembersResponseRow(SOAPElement root, MdSchemaMembersResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - r.dimensionUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_UNIQUE_NAME, v)); - r.hierarchyUniqueName().ifPresent(v -> addChildElement(row, QN_HIERARCHY_UNIQUE_NAME, v)); - r.levelUniqueName().ifPresent(v -> addChildElement(row, QN_LEVEL_UNIQUE_NAME, v)); - r.levelNumber().ifPresent(v -> addChildElement(row, QN_LEVEL_NUMBER, String.valueOf(v))); - r.memberOrdinal().ifPresent(v -> addChildElement(row, QN_MEMBER_ORDINAL, String.valueOf(v))); - r.memberName().ifPresent(v -> addChildElement(row, QN_MEMBER_NAME, v)); - r.memberUniqueName().ifPresent(v -> addChildElement(row, QN_MEMBER_UNIQUE_NAME, v)); - r.memberType().ifPresent(v -> addChildElement(row, QN_MEMBER_TYPE, String.valueOf(v.getValue()))); - r.memberGuid().ifPresent(v -> addChildElement(row, QN_MEMBER_GUID, String.valueOf(v))); - r.memberCaption().ifPresent(v -> addChildElement(row, QN_MEMBER_CAPTION, v)); - r.childrenCardinality().ifPresent(v -> addChildElement(row, QN_CHILDREN_CARDINALITY, String.valueOf(v))); - r.parentLevel().ifPresent(v -> addChildElement(row, QN_PARENT_LEVEL, String.valueOf(v))); - r.parentUniqueName().ifPresent(v -> addChildElement(row, QN_PARENT_UNIQUE_NAME, v)); - r.parentCount().ifPresent(v -> addChildElement(row, QN_PARENT_COUNT, String.valueOf(v))); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.expression().ifPresent(v -> addChildElement(row, QN_EXPRESSION, v)); - r.memberKey().ifPresent(v -> addChildElement(row, QN_MEMBER_KEY, v)); - r.isPlaceHolderMember().ifPresent(v -> addChildElement(row, QN_IS_PLACEHOLDERMEMBER, String.valueOf(v))); - r.isDataMember().ifPresent(v -> addChildElement(row, QN_IS_DATAMEMBER, String.valueOf(v))); - r.scope().ifPresent(v -> addChildElement(row, QN_SCOPE, String.valueOf(v.getValue()))); - } - - private static void addMdSchemaPropertiesResponseRow(SOAPElement root, MdSchemaPropertiesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - - r.dimensionUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_UNIQUE_NAME, v)); - r.hierarchyUniqueName().ifPresent(v -> addChildElement(row, QN_HIERARCHY_UNIQUE_NAME, v)); - r.levelUniqueName().ifPresent(v -> addChildElement(row, QN_LEVEL_UNIQUE_NAME, v)); - r.memberUniqueName().ifPresent(v -> addChildElement(row, QN_MEMBER_UNIQUE_NAME, v)); - r.propertyType().ifPresent(v -> addChildElement(row, QN_PROPERTY_TYPE, String.valueOf(v.getValue()))); - r.propertyName().ifPresent(v -> addChildElement(row, QN_PROPERTY_NAME, v)); - r.propertyCaption().ifPresent(v -> addChildElement(row, QN_PROPERTY_CAPTION, v)); - r.dataType().ifPresent(v -> addChildElement(row, QN_DATA_TYPE, String.valueOf(v.getValue()))); - // r.characterMaximumLength().ifPresent(v -> addChildElement(row, - // "CHARACTER_MAXIMUM_LENGTH" - // , prefix, String.valueOf(v))); - // r.characterOctetLength().ifPresent(v -> addChildElement(row, - // "CHARACTER_OCTET_LENGTH", - // prefix, String.valueOf(v))); - // r.numericPrecision().ifPresent(v -> addChildElement(row, NUMERIC_PRECISION - // , prefix, String.valueOf(v))); - // r.numericScale().ifPresent(v -> addChildElement(row, NUMERIC_SCALE, prefix, - // String.valueOf(v))); - r.propertyContentType() - .ifPresent(v -> addChildElement(row, QN_PROPERTY_CONTENT_TYPE, String.valueOf(v.getValue()))); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.sqlColumnName().ifPresent(v -> addChildElement(row, QN_SQL_COLUMN_NAME, v)); - // r.language().ifPresent(v -> addChildElement(row, "LANGUAGE", prefix, - // String.valueOf(v))); - r.propertyOrigin() - .ifPresent(v -> addChildElement(row, QN_PROPERTY_ORIGIN, String.valueOf(v.getValue()))); - // r.propertyAttributeHierarchyName().ifPresent(v -> addChildElement(row - // , "PROPERTY_ATTRIBUTE_HIERARCHY_NAME", prefix, v)); - // r.propertyCardinality().ifPresent(v -> addChildElement(row, - // "PROPERTY_CARDINALITY" - // , prefix, v.name())); - // r.mimeType().ifPresent(v -> addChildElement(row, "MIME_TYPE" - // , prefix, v)); - r.cubeSource().ifPresent(v -> addChildElement(row, QN_CUBE_SOURCE, String.valueOf(v.getValue()))); - r.propertyIsVisible() - .ifPresent(v -> addChildElement(row, QN_PROPERTY_VISIBILITY, String.valueOf(v.getValue()))); - - } - - private static void addMdSchemaSetsResponseRow(SOAPElement root, MdSchemaSetsResponseRow r) throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - r.setName().ifPresent(v -> addChildElement(row, QN_SET_NAME, v)); - r.scope().ifPresent(v -> addChildElement(row, QN_SCOPE, String.valueOf(v.getValue()))); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.expression().ifPresent(v -> addChildElement(row, QN_EXPRESSION, v)); - r.dimension().ifPresent(v -> addChildElement(row, QN_DIMENSIONS, v)); - r.setCaption().ifPresent(v -> addChildElement(row, QN_SET_CAPTION, v)); - r.setDisplayFolder().ifPresent(v -> addChildElement(row, QN_SET_DISPLAY_FOLDER, v)); - } - - private static void addMdSchemaKpisResponseRow(SOAPElement root, MdSchemaKpisResponseRow r) throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - - r.measureGroupName().ifPresent(v -> addChildElement(row, QN_MEASUREGROUP_NAME, v)); - r.kpiName().ifPresent(v -> addChildElement(row, QN_KPI_NAME, v)); - r.kpiCaption().ifPresent(v -> addChildElement(row, QN_KPI_CAPTION, v)); - r.kpiDescription().ifPresent(v -> addChildElement(row, QN_KPI_DESCRIPTION, v)); - r.kpiDisplayFolder().ifPresent(v -> addChildElement(row, QN_KPI_DISPLAY_FOLDER, v)); - r.kpiValue().ifPresent(v -> addChildElement(row, QN_KPI_VALUE, v)); - r.kpiGoal().ifPresent(v -> addChildElement(row, QN_KPI_GOAL, v)); - r.kpiStatus().ifPresent(v -> addChildElement(row, QN_KPI_STATUS, v)); - r.kpiTrend().ifPresent(v -> addChildElement(row, QN_KPI_TREND, v)); - r.kpiStatusGraphic().ifPresent(v -> addChildElement(row, QN_KPI_STATUS_GRAPHIC, v)); - r.kpiTrendGraphic().ifPresent(v -> addChildElement(row, QN_KPI_TREND_GRAPHIC, v)); - r.kpiWight().ifPresent(v -> addChildElement(row, QN_KPI_WEIGHT, v)); - r.kpiCurrentTimeMember().ifPresent(v -> addChildElement(row, QN_KPI_CURRENT_TIME_MEMBER, v)); - r.kpiParentKpiName().ifPresent(v -> addChildElement(row, QN_KPI_PARENT_KPI_NAME, v)); - r.annotation().ifPresent(v -> addChildElement(row, QN_ANNOTATIONS, v)); - r.scope().ifPresent(v -> addChildElement(row, QN_SCOPE, String.valueOf(v.getValue()))); - } - - private static void addMdSchemaMeasureGroupsResponseRow(SOAPElement root, MdSchemaMeasureGroupsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - - r.measureGroupName().ifPresent(v -> addChildElement(row, QN_MEASUREGROUP_NAME, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.isWriteEnabled().ifPresent(v -> addChildElement(row, QN_IS_WRITE_ENABLED, String.valueOf(v))); - r.measureGroupCaption().ifPresent(v -> addChildElement(row, QN_MEASUREGROUP_CAPTION, v)); - } - - private static void addMdSchemaCubesResponseRow(SOAPElement root, MdSchemaCubesResponseRow r) throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_CATALOG_NAME, r.catalogName()); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - - r.cubeType().ifPresent(v -> addChildElement(row, QN_CUBE_TYPE, v.name())); - r.cubeGuid().ifPresent(v -> addChildElement(row, QN_CUBE_GUID, String.valueOf(v))); - r.createdOn().ifPresent(v -> addChildElement(row, QN_CREATED_ON, v.format(formatter))); - r.lastSchemaUpdate().ifPresent(v -> addChildElement(row, QN_LAST_SCHEMA_UPDATE, v.format(formatter))); - r.schemaUpdatedBy().ifPresent(v -> addChildElement(row, QN_SCHEMA_UPDATED_BY, v)); - r.lastDataUpdate().ifPresent(v -> addChildElement(row, Constants.ROWSET.ROW_PROPERTY.QN_LAST_DATA_UPDATE, v.format(formatter))); - r.dataUpdateDBy().ifPresent(v -> addChildElement(row, QN_DATA_UPDATED_BY, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.isDrillThroughEnabled() - .ifPresent(v -> addChildElement(row, QN_IS_DRILLTHROUGH_ENABLED, String.valueOf(v))); - r.isLinkable().ifPresent(v -> addChildElement(row, QN_IS_LINKABLE, String.valueOf(v))); - r.isWriteEnabled().ifPresent(v -> addChildElement(row, QN_IS_WRITE_ENABLED, String.valueOf(v))); - r.isSqlEnabled().ifPresent(v -> addChildElement(row, QN_IS_SQL_ENABLED, String.valueOf(v))); - r.cubeCaption().ifPresent(v -> addChildElement(row, QN_CUBE_CAPTION, v)); - r.baseCubeName().ifPresent(v -> addChildElement(row, QN_BASE_CUBE_NAME, v)); - r.cubeSource().ifPresent(v -> addChildElement(row, QN_CUBE_SOURCE, String.valueOf(v.getValue()))); - r.preferredQueryPatterns() - .ifPresent(v -> addChildElement(row, QN_PREFERRED_QUERY_PATTERNS, String.valueOf(v.getValue()))); - } - - private static void addMdSchemaDimensionsResponseRow(SOAPElement root, MdSchemaDimensionsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.catalogName().ifPresent(v -> addChildElement(row, QN_CATALOG_NAME, v)); - r.schemaName().ifPresent(v -> addChildElement(row, QN_SCHEMA_NAME, v)); - r.cubeName().ifPresent(v -> addChildElement(row, QN_CUBE_NAME, v)); - - r.dimensionName().ifPresent(v -> addChildElement(row, QN_DIMENSION_NAME, v)); - r.dimensionUniqueName().ifPresent(v -> addChildElement(row, QN_DIMENSION_UNIQUE_NAME, v)); - r.dimensionGuid().ifPresent(v -> addChildElement(row, QN_DIMENSION_GUID, String.valueOf(v))); - r.dimensionCaption().ifPresent(v -> addChildElement(row, QN_DIMENSION_CAPTION, v)); - r.dimensionOptional().ifPresent(v -> addChildElement(row, QN_DIMENSION_ORDINAL, String.valueOf(v))); - r.dimensionType().ifPresent(v -> addChildElement(row, QN_DIMENSION_TYPE, String.valueOf(v.getValue()))); - r.dimensionCardinality() - .ifPresent(v -> addChildElement(row, QN_DIMENSION_CARDINALITY, String.valueOf(v))); - r.defaultHierarchy().ifPresent(v -> addChildElement(row, QN_DEFAULT_HIERARCHY, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - r.isVirtual().ifPresent(v -> addChildElement(row, QN_IS_VIRTUAL, String.valueOf(v))); - r.isReadWrite().ifPresent(v -> addChildElement(row, QN_IS_READWRITE, String.valueOf(v))); - r.dimensionUniqueSetting().ifPresent( - v -> addChildElement(row, QN_DIMENSION_UNIQUE_SETTINGS, String.valueOf(v.getValue()))); - r.dimensionMasterName().ifPresent(v -> addChildElement(row, QN_DIMENSION_MASTER_NAME, v)); - r.dimensionIsVisible().ifPresent(v -> addChildElement(row, QN_DIMENSION_IS_VISIBLE, String.valueOf(v))); - } - - private static void addMdSchemaFunctionsResponseRow(SOAPElement root, MdSchemaFunctionsResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - r.functionalName().ifPresent(v -> addChildElement(row, QN_FUNCTION_NAME, v)); - r.description().ifPresent(v -> addChildElement(row, QN_DESCRIPTION, v)); - addChildElement(row, QN_PARAMETER_LIST, r.parameterList()); - r.returnType().ifPresent(v -> addChildElement(row, QN_RETURN_TYPE, String.valueOf(v))); - r.origin().ifPresent(v -> addChildElement(row, QN_ORIGIN, String.valueOf(v.getValue()))); - r.interfaceName().ifPresent(v -> addChildElement(row, QN_INTERFACE_NAME, v.name())); - r.libraryName().ifPresent(v -> addChildElement(row, QN_LIBRARY_NAME, v)); - r.dllName().ifPresent(v -> addChildElement(row, QN_DLL_NAME, v)); - r.helpFile().ifPresent(v -> addChildElement(row, QN_HELP_FILE, v)); - r.helpContext().ifPresent(v -> addChildElement(row, QN_HELP_CONTEXT, v)); - r.object().ifPresent(v -> addChildElement(row, QN_OBJECT, v)); - r.caption().ifPresent(v -> addChildElement(row, QN_CAPTION, v)); - r.parameterInfo().ifPresent(v -> addParameterInfoXmlList(row, v)); - r.directQueryPushable() - .ifPresent(v -> addChildElement(row, QN_DIRECTQUERY_PUSHABLE, String.valueOf(v.getValue()))); - } - - private static void addParameterInfoXmlList(SOAPElement root, List list) { - if (list != null) { - list.forEach(it -> addParameterInfoXml(root, it)); - } - } - - private static void addParameterInfoXml(SOAPElement root, ParameterInfo it) { - SOAPElement el = addChildElement(root, QN_PARAMETERINFO); - addChildElement(el, QN_NAME, it.name()); - addChildElement(el, QN_DESCRIPTION, it.description()); - addChildElement(el, QN_OPTIONAL, String.valueOf(it.optional())); - addChildElement(el, QN_REPEATABLE, String.valueOf(it.repeatable())); - addChildElement(el, QN_REPEATGROUP, String.valueOf(it.repeatGroup())); - } - - private static void addDiscoverPropertiesResponseRow(SOAPElement root, DiscoverPropertiesResponseRow r) - throws SOAPException { - SOAPElement row = root.addChildElement(Constants.ROWSET.QN_ROW); - addChildElement(row, QN_PROPERTY_NAME_LC, r.propertyName()); - r.propertyDescription().ifPresent(v -> addChildElement(row, QN_PROPERTY_DESCRIPTION, v)); - r.propertyType().ifPresent(v -> addChildElement(row, QN_PROPERTY_TYPE_LC, v)); - addChildElement(row, QN_PROPERTY_ACCESS_TYPE, r.propertyAccessType().getValue()); - r.required().ifPresent(v -> addChildElement(row, QN_IS_REQUIRED, String.valueOf(v))); - r.value().ifPresent(v -> addChildElement(row, QN_VALUE, v)); - } - - private static void addMdDataSet(SOAPElement el, Mddataset it) throws SOAPException { - if (it != null) { - addOlapInfo(el, it.olapInfo()); - addAxes(el, it.axes()); - addCellData(el, it.cellData()); - addException(el, it.exception()); - addMessages(el, it.messages()); - } - } - - private static void addMessages(SOAPElement e, Messages it) { - if (it != null) { - SOAPElement el = addChildElement(e, Constants.MDDATASET.QN_MESSAGES); - addExceptionTypeList(el, it.warningOrError()); - - } - } - - private static void addExceptionTypeList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addExceptionType(e, it)); - } - } - - private static void addExceptionType(SOAPElement e, org.eclipse.daanse.xmla.api.exception.Type it) { - if (it != null) { - if (it instanceof WarningType warningType) { - addWarningType(e, warningType); - } - if (it instanceof ErrorType errorType) { - addErrorType(e, errorType); - } - } - } - - private static void addErrorType(SOAPElement e, ErrorType it) { - if (it != null) { - SOAPElement el = addChildElement(e, "Error", null); - - addChildElement(el, "Callstack", null, it.callstack()); - addChildElement(el, "ErrorCode", null, String.valueOf(it.errorCode())); - addMessageLocation(el, it.location()); - setAttribute(el, DESCRIPTION, it.description()); - setAttribute(el, "Source", it.source()); - setAttribute(el, "HelpFile", it.helpFile()); - } - } - - private static void setAttribute(SOAPElement el, String name, String value) { - if (value != null) { - el.setAttribute(name, value); - } - } - - private static void addWarningType(SOAPElement e, WarningType it) { - if (it != null) { - SOAPElement el = addChildElement(e, "Warning", null); - addChildElement(el, "WarningCode", null, String.valueOf(it.warningCode())); - addMessageLocation(el, it.location()); - addChildElement(el, DESCRIPTION_LC, null, it.description()); - addChildElement(el, "Source", null, it.source()); - addChildElement(el, "HelpFile", null, it.helpFile()); - } - } - - private static void addMessageLocation(SOAPElement e, MessageLocation it) { - if (it != null) { - SOAPElement el = addChildElement(e, "Location", null); - addStartEnd(el, "Start", it.start()); - addStartEnd(el, "End", it.end()); - addChildElement(el, "LineOffset", null, String.valueOf(it.lineOffset())); - addChildElement(el, "TextLength", null, String.valueOf(it.textLength())); - addWarningLocationObject(el, "SourceObject", it.sourceObject()); - addWarningLocationObject(el, "DependsOnObject", it.dependsOnObject()); - addChildElement(el, "RowNumber", null, String.valueOf(it.rowNumber())); - } - - } - - private static void addWarningLocationObject(SOAPElement e, String tagName, WarningLocationObject it) { - if (it != null) { - SOAPElement el = addChildElement(e, tagName, null); - addWarningColumn(el, it.warningColumn()); - addWarningMeasure(el, it.warningMeasure()); - } - } - - private static void addWarningMeasure(SOAPElement e, WarningMeasure it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_WARNING_MEASURE); - addChildElement(el, "Cube", null, it.cube()); - addChildElement(el, "MeasureGroup", null, it.measureGroup()); - addChildElement(el, "MeasureName", null, it.measureName()); - } - } - - private static void addWarningColumn(SOAPElement e, WarningColumn it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_WARNING_COLUMN); - addChildElement(el, "Dimension", null, it.dimension()); - addChildElement(el, "Attribute", null, it.attribute()); - } - } - - private static void addStartEnd(SOAPElement e, String tagName, StartEnd it) { - if (it != null) { - SOAPElement el = addChildElement(e, tagName, null); - addChildElement(el, "Line", null, String.valueOf(it.line())); - addChildElement(el, "Column", null, String.valueOf(it.column())); - } - } - - private static void addException(SOAPElement e, Exception it) { - if (it != null) { - addChildElement(e, "Exception", null); - } - } - - private static void addCellData(SOAPElement e, CellData it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_CELL_DATA); - addCellTypeList(el, it.cell()); - // addCellSetType(el, it.cellSet()); - } - } - - private static void addData(SOAPElement e, byte[] it) { - if (it != null) { - addChildElement(e, "Data", new String(it, UTF_8)); - } - } - - private static void addCellTypeList(SOAPElement el, List list) { - if (list != null) { - list.forEach(it -> addCellType(el, it)); - } - } - - private static void addCellType(SOAPElement e, CellType it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_CELL); - addCellTypeValue(el, it.value()); - addCellInfoItemList(el, it.any()); - setAttribute(el, "CellOrdinal", String.valueOf(it.cellOrdinal())); - } - } - - private static void addCellTypeValue(SOAPElement e, Value it) { - if (it != null) { - SOAPElement el = addChildElement(e, Constants.MDDATASET.QN_VALUE); - el.setAttribute("xsi:type", it.type().getValue()); - el.setTextContent(it.value()); - addCellTypeErrorList(el, it.error()); - } - } - - private static void addCellTypeErrorList(SOAPElement el, List list) { - if (list != null) { - list.forEach(it -> addCellTypeError(el, it)); - } - } - - private static void addCellTypeError(SOAPElement e, CellTypeError it) { - if (it != null) { - SOAPElement el = addChildElement(e, Constants.MDDATASET.QN_ERROR); - setAttribute(el, "ErrorCode", String.valueOf(it.errorCode())); - setAttribute(el, DESCRIPTION, it.description()); - } - } - - private static void addAxes(SOAPElement e, Axes it) { - if (it != null) { - SOAPElement el = addChildElement(e, Constants.MDDATASET.QN_AXES); - addAxisList(el, it.axis()); - } - } - - private static void addAxisList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addAxis(e, it)); - } - } - - private static void addAxis(SOAPElement e, Axis it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_AXIS); - addTypeList(el, it.setType()); - setAttribute(el, "name", it.name()); - } - } - - private static void addTypeList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addType(e, it)); - } - } - - private static void addType(SOAPElement soapElement, Type type) { - if (type != null) { - if (type instanceof MembersType membersType) { - addMembersType(soapElement, membersType); - } - if (type instanceof TuplesType tuplesType) { - addTuplesType(soapElement, tuplesType); - } - if (type instanceof SetListType setListType) { - addSetListType(soapElement, setListType); - } - if (type instanceof NormTupleSet normTupleSet) { - addNormTupleSet(soapElement, normTupleSet); - } - if (type instanceof Union union) { - addUnion(soapElement, union); - } - } - } - - private static void addUnion(SOAPElement soapElement, Union union) { - if (union != null) { - SOAPElement el = addChildElement(soapElement, QN_UNION); - addTypeList(el, union.setType()); - } - } - - private static void addNormTupleSet(SOAPElement soapElement, NormTupleSet normTupleSet) { - if (normTupleSet != null) { - SOAPElement el = addChildElement(soapElement, QN_NORM_TUPLE_SET); - addNormTuplesType(el, normTupleSet.normTuples()); - addTupleTypeList(el, normTupleSet.membersLookup()); - } - } - - private static void addTupleTypeList(SOAPElement soapElement, MembersLookup membersLookup) { - if (membersLookup != null) { - SOAPElement el = addChildElement(soapElement, QN_MEMBERS_LOOKUP); - if (membersLookup.members() != null) { - membersLookup.members().forEach(it -> addTupleTypeMembers(el, it)); - } - } - } - - private static void addNormTuplesType(SOAPElement e, NormTuplesType it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_NORM_TUPLES); - addNormTupleList(el, it.normTuple()); - } - } - - private static void addNormTupleList(SOAPElement el, List list) { - if (list != null) { - list.forEach(it -> addNormTuple(el, it)); - } - } - - private static void addNormTuple(SOAPElement e, NormTuple it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_NORM_TUPLE); - addMemberRefList(el, it.memberRef()); - } - } - - private static void addMemberRefList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addMemberRef(e, it)); - } - } - - private static void addMemberRef(SOAPElement e, MemberRef it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_MEMBER_REF); - addChildElement(el, QN_MEMBER_ORDINAL, String.valueOf(it.memberOrdinal())); - addChildElement(el, QN_MEMBER_DISP_INFO, String.valueOf(it.memberDispInfo())); - } - } - - private static void addSetListType(SOAPElement e, SetListType it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_CROSS_PRODUCT); - addTypeList(el, it.setType()); - addChildElement(el, Constants.MDDATASET.QN_SIZE, String.valueOf(it.size())); - } - } - - private static void addTuplesType(SOAPElement e, TuplesType it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_TUPLES); - addTuplesTypeList(el, it.tuple()); - } - - } - - private static void addTuplesTypeList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addTupleTypeTuple(e, it)); - } - } - - private static void addTupleTypeMembers(SOAPElement e, TupleType it) { - if (it != null && it.member() != null) { - SOAPElement el = addChildElement(e, QN_MEMBERS); - it.member().forEach(item -> addMemberType(el, item)); - } - - } - - private static void addTupleTypeTuple(SOAPElement e, TupleType it) { - if (it != null && it.member() != null) { - SOAPElement el = addChildElement(e, QN_TUPLE); - it.member().forEach(item -> addMemberType(el, item)); - } - } - - private static void addMemberType(SOAPElement e, MemberType it) { - if (it != null) { - SOAPElement seMember = addChildElement(e, QN_MEMBER); - addCellInfoItemList(seMember, it.any()); - setAttribute(seMember, "Hierarchy", it.hierarchy()); - } - } - - private static void addMembersType(SOAPElement e, MembersType it) { - if (it != null && it.member() != null) { - SOAPElement el = addChildElement(e, QN_MEMBERS); - it.member().forEach(item -> addMemberType(el, item)); - setAttribute(e, "Hierarchy", it.hierarchy()); - } - } - - private static void addOlapInfo(SOAPElement e, OlapInfo it) throws SOAPException { - if (it != null) { - SOAPElement seOlapInfo = e.addChildElement(Constants.MDDATASET.QN_OLAP_INFO); - addCubeInfo(seOlapInfo, it.cubeInfo()); - addAxesInfo(seOlapInfo, it.axesInfo()); - addCellInfo(seOlapInfo, it.cellInfo()); - } - } - - private static void addCellInfo(SOAPElement e, CellInfo it) throws SOAPException { - if (it != null) { - SOAPElement seCellInfo = e.addChildElement(Constants.MDDATASET.QN_CELL_INFO); - addCellInfoItemListName(seCellInfo, it.any()); - } - } - - private static void addCellInfoItemListName(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addCellInfoItemName(e, it)); - } - } - - private static void addCellInfoItemList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addCellInfoItem(e, it)); - } - } - - private static void addCellInfoItemName(SOAPElement e, CellInfoItem it) { - if (it != null) { - String prefix = Constants.MDDATASET.PREFIX; - SOAPElement el = addChildElement(e, it.tagName(), prefix); - setAttribute(el, "name", it.name()); - it.type().ifPresent(v -> setAttribute(el, "type", v)); - } - } - - private static void addCellInfoItem(SOAPElement e, CellInfoItem it) { - if (it != null) { - String prefix = Constants.MDDATASET.PREFIX; - SOAPElement el = addChildElement(e, it.tagName(), prefix); - el.setTextContent(it.name()); - it.type().ifPresent(v -> setAttribute(el, "type", v)); - } - } - - private static void addAxesInfo(SOAPElement e, AxesInfo it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_AXES_INFO); - addAxisInfoList(el, it.axisInfo()); - } - } - - private static void addAxisInfoList(SOAPElement el, List list) { - if (list != null) { - list.forEach(it -> addAxisInfo(el, it)); - } - } - - private static void addAxisInfo(SOAPElement e, AxisInfo it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_AXIS_INFO); - setAttribute(el, "name", it.name()); - addHierarchyInfoList(el, it.hierarchyInfo()); - } - } - - private static void addHierarchyInfoList(SOAPElement el, List list) { - if (list != null) { - list.forEach(it -> addHierarchyInfo(el, it)); - } - } - - private static void addHierarchyInfo(SOAPElement e, HierarchyInfo it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_HIERARCHY_INFO); - addCellInfoItemListName(el, it.any()); - setAttribute(el, "name", it.name()); - } - } - - private static void addCubeInfo(SOAPElement e, CubeInfo it) { - if (it != null) { - SOAPElement el = addChildElement(e, QN_CUBE_INFO); - addOlapInfoCubeList(el, it.cube()); - } - } - - private static void addOlapInfoCubeList(SOAPElement e, List list) { - if (list != null) { - list.forEach(it -> addOlapInfoCube(e, it)); - } - } - - private static void addOlapInfoCube(SOAPElement e, OlapInfoCube it) { - if (it != null) { - SOAPElement el = addChildElement(e, Constants.MDDATASET.QN_CUBE); - addChildElement(el, Constants.MDDATASET.QN_CUBE_NAME, it.cubeName()); - addChildElement(el, Constants.ENGINE.QN_LAST_DATA_UPDATE, instantToString(it.lastDataUpdate())); - addChildElement(el, Constants.ENGINE.QN_LAST_SCHEMA_UPDATE, instantToString(it.lastSchemaUpdate())); - } - } - - private static String instantToString(Instant instant) { - return instant != null ? formatter.format(instant) : null; - } - - private static SOAPElement addDiscoverRowSetsRoot(SOAPElement body) throws SOAPException { - - SOAPElement seDiscoverResponse = body.addChildElement(Constants.MSXMLA.QN_DISCOVER_RESPONSE); - SOAPElement seReturn = seDiscoverResponse.addChildElement(Constants.MSXMLA.QN_RETURN); - SOAPElement seRoot = addChildElement(seReturn, Constants.ROWSET.QN_ROOT); - seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); - SOAPElement schema = addChildElement(seRoot, Constants.XSD.QN_SCHEMA); - schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - schema.setAttribute("xmlns", Constants.ROWSET.NS_URN); - schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); - schema.setAttribute("targetNamespace", Constants.ROWSET.NS_URN); - schema.setAttribute("elementFormDefault", "qualified"); - SOAPElement el = addChildElement(schema, Constants.XSD.QN_ELEMENT); - el.setAttribute("name", "root"); - SOAPElement ct = addChildElement(el, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement s = addChildElement(ct, Constants.XSD.QN_SEQUENCE); - SOAPElement se = addChildElement(s, Constants.XSD.QN_ELEMENT); - se.setAttribute("name", "row"); - se.setAttribute("type", "row"); - se.setAttribute("minOccurs", "0"); - se.setAttribute("maxOccurs", "unbounded"); - - SOAPElement st = addChildElement(schema, Constants.XSD.QN_SIMPLE_TYPE); - st.setAttribute("name", "uuid"); - SOAPElement r = addChildElement(st, Constants.XSD.QN_RESTRICTION); - r.setAttribute("base", "xsd:string"); - SOAPElement p = addChildElement(r, Constants.XSD.QN_PATTERN); - p.setAttribute("value", UUID_VALUE); - - SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct1.setAttribute("name", "row"); - SOAPElement s1 = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); - SOAPElement s1e1 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e1.setAttribute("sql:field", "SchemaName"); - s1e1.setAttribute("name", "SchemaName"); - s1e1.setAttribute("type", "xsd:string"); - SOAPElement s1e2 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e2.setAttribute("sql:field", "SchemaGuid"); - s1e2.setAttribute("name", "SchemaGuid"); - s1e2.setAttribute("type", "uuid"); - s1e2.setAttribute("minOccurs", "0"); - SOAPElement s1e3 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e3.setAttribute("sql:field", "Restrictions"); - s1e3.setAttribute("name", "Restrictions"); - s1e3.setAttribute("minOccurs", "0"); - s1e3.setAttribute("maxOccurs", "unbounded"); - SOAPElement s1e3ct = addChildElement(s1e3, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement s1e3cts = addChildElement(s1e3ct, Constants.XSD.QN_SEQUENCE); - SOAPElement s1e3ctse1 = addChildElement(s1e3cts, Constants.XSD.QN_ELEMENT); - s1e3ctse1.setAttribute("name", "Name"); - s1e3ctse1.setAttribute("type", "xsd:string"); - s1e3ctse1.setAttribute("sql:field", "Name"); - SOAPElement s1e3ctse2 = addChildElement(s1e3cts, Constants.XSD.QN_ELEMENT); - s1e3ctse2.setAttribute("name", "Type"); - s1e3ctse2.setAttribute("type", "xsd:string"); - s1e3ctse2.setAttribute("sql:field", "Type"); - - SOAPElement s1e4 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e4.setAttribute("sql:field", "Description"); - s1e4.setAttribute("name", "Description"); - s1e4.setAttribute("type", "xsd:string"); - - SOAPElement s1e5 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e5.setAttribute("sql:field", "RestrictionsMask"); - s1e5.setAttribute("name", "RestrictionsMask"); - s1e5.setAttribute("type", "xsd:unsignedLong"); - s1e5.setAttribute("minOccurs", "0"); - - return seRoot; - } - - private static SOAPElement addDiscoverPropertiesRoot(SOAPElement body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - seRoot.setAttribute("xmlns", "urn:schemas-microsoft-com:xml-analysis:rowset"); - seRoot.setAttribute("xmlns:EX", "urn:schemas-microsoft-com:xml-analysis:exception"); - SOAPElement schema = addChildElement(seRoot, Constants.XSD.QN_SCHEMA); - schema.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); - schema.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); - schema.setAttribute("xmlns", "urn:schemas-microsoft-com:xml-analysis:rowset"); - schema.setAttribute("targetNamespace", Constants.ROWSET.NS_URN); - schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); - schema.setAttribute("elementFormDefault", "qualified"); - SOAPElement el = addChildElement(schema, Constants.XSD.QN_ELEMENT); - el.setAttribute("name", "root"); - SOAPElement ct = addChildElement(el, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement s = addChildElement(ct, Constants.XSD.QN_SEQUENCE); - SOAPElement se = addChildElement(s, Constants.XSD.QN_ELEMENT); - se.setAttribute("name", "row"); - se.setAttribute("type", "row"); - se.setAttribute("minOccurs", "0"); - se.setAttribute("maxOccurs", "unbounded"); - - SOAPElement st = addChildElement(schema, Constants.XSD.QN_SIMPLE_TYPE); - st.setAttribute("name", "uuid"); - SOAPElement r = addChildElement(st, Constants.XSD.QN_RESTRICTION); - r.setAttribute("base", "xsd:string"); - SOAPElement p = addChildElement(r, Constants.XSD.QN_PATTERN); - p.setAttribute("value", UUID_VALUE); - - //0SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - //ct1.setAttribute("name", "xmlDocument"); - //SOAPElement s1 = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); - //SOAPElement a = addChildElement(s1, Constants.XSD.QN_ANY); - - SOAPElement ct2 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct2.setAttribute("name", "row"); - SOAPElement s2 = addChildElement(ct2, Constants.XSD.QN_SEQUENCE); - SOAPElement s2e1 = addChildElement(s2, Constants.XSD.QN_ELEMENT); - s2e1.setAttribute("sql:field", "PropertyName"); - s2e1.setAttribute("name", "PropertyName"); - s2e1.setAttribute("type", "xsd:string"); - - SOAPElement s2e2 = addChildElement(s2, Constants.XSD.QN_ELEMENT); - s2e2.setAttribute("sql:field", "PropertyDescription"); - s2e2.setAttribute("name", "PropertyDescription"); - s2e2.setAttribute("type", "xsd:string"); - //s2e2.setAttribute("minOccurs", "0"); - - SOAPElement s2e3 = addChildElement(s2, Constants.XSD.QN_ELEMENT); - s2e3.setAttribute("sql:field", "PropertyType"); - s2e3.setAttribute("name", "PropertyType"); - s2e3.setAttribute("type", "xsd:string"); - //s2e3.setAttribute("minOccurs", "0"); - - SOAPElement s2e4 = addChildElement(s2, Constants.XSD.QN_ELEMENT); - s2e4.setAttribute("sql:field", "PropertyAccessType"); - s2e4.setAttribute("name", "PropertyAccessType"); - s2e4.setAttribute("type", "xsd:string"); - - SOAPElement s2e5 = addChildElement(s2, Constants.XSD.QN_ELEMENT); - s2e5.setAttribute("sql:field", "IsRequired"); - s2e5.setAttribute("name", "IsRequired"); - s2e5.setAttribute("type", "xsd:boolean"); - //s2e5.setAttribute("minOccurs", "0"); - - SOAPElement s2e6 = addChildElement(s2, Constants.XSD.QN_ELEMENT); - s2e6.setAttribute("sql:field", "Value"); - s2e6.setAttribute("name", "Value"); - s2e6.setAttribute("type", "xsd:string"); - //s2e6.setAttribute("minOccurs", "0"); - - return seRoot; - } - - private static SOAPElement addDbSchemaCatalogsRoot(SOAPElement body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct1.setAttribute("name", "row"); - SOAPElement s1 = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); - SOAPElement s1e1 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e1.setAttribute("sql:field", "CATALOG_NAME"); - s1e1.setAttribute("name", "CATALOG_NAME"); - s1e1.setAttribute("type", "xsd:string"); - - SOAPElement s1e2 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e2.setAttribute("sql:field", "DESCRIPTION"); - s1e2.setAttribute("name", "DESCRIPTION"); - s1e2.setAttribute("type", "xsd:string"); - s1e2.setAttribute("minOccurs", "0"); - - SOAPElement s1e3 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e3.setAttribute("sql:field", "ROLES"); - s1e3.setAttribute("name", "ROLES"); - s1e3.setAttribute("type", "xsd:string"); - - SOAPElement s1e4 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e4.setAttribute("sql:field", "DATE_MODIFIED"); - s1e4.setAttribute("name", "DATE_MODIFIED"); - s1e4.setAttribute("type", "xsd:dateTime"); - s1e4.setAttribute("minOccurs", "0"); - return seRoot; - } - - private static SOAPElement addDiscoverEnumeratorsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct1.setAttribute("name", "row"); - SOAPElement s1 = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); - SOAPElement s1e1 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e1.setAttribute("sql:field", "EnumName"); - s1e1.setAttribute("name", "EnumName"); - s1e1.setAttribute("type", "xsd:string"); - - SOAPElement s1e2 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e2.setAttribute("sql:field", "EnumDescription"); - s1e2.setAttribute("name", "EnumDescription"); - s1e2.setAttribute("type", "xsd:string"); - s1e2.setAttribute("minOccurs", "0"); - - SOAPElement s1e3 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e3.setAttribute("sql:field", "EnumType"); - s1e3.setAttribute("name", "EnumType"); - s1e3.setAttribute("type", "xsd:string"); - - SOAPElement s1e4 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e4.setAttribute("sql:field", "ElementName"); - s1e4.setAttribute("name", "ElementName"); - s1e4.setAttribute("type", "xsd:string"); - - SOAPElement s1e5 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e5.setAttribute("sql:field", "ElementDescription"); - s1e5.setAttribute("name", "ElementDescription"); - s1e5.setAttribute("type", "xsd:string"); - s1e5.setAttribute("minOccurs", "0"); - - SOAPElement s1e6 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e6.setAttribute("sql:field", "ElementValue"); - s1e6.setAttribute("name", "ElementValue"); - s1e6.setAttribute("type", "xsd:string"); - s1e6.setAttribute("minOccurs", "0"); - - return seRoot; - } - - private static SOAPElement addDiscoverKeywordsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct1.setAttribute("name", "row"); - SOAPElement s1 = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); - SOAPElement s1e1 = addChildElement(s1, Constants.XSD.QN_ELEMENT); - s1e1.setAttribute("sql:field", "Keyword"); - s1e1.setAttribute("name", "Keyword"); - s1e1.setAttribute("type", "xsd:string"); - - return seRoot; - } - - private static SOAPElement addDiscoverLiteralsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - SOAPElement se1 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se1.setAttribute("sql:field", "LiteralName"); - se1.setAttribute("name", "LiteralName"); - se1.setAttribute("type", "xsd:string"); - - SOAPElement se2 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se2.setAttribute("sql:field", "LiteralValue"); - se2.setAttribute("name", "LiteralValue"); - se2.setAttribute("type", "xsd:string"); - se2.setAttribute("minOccurs", "0"); - - SOAPElement se3 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se3.setAttribute("sql:field", "LiteralInvalidChars"); - se3.setAttribute("name", "LiteralInvalidChars"); - se3.setAttribute("type", "xsd:string"); - se3.setAttribute("minOccurs", "0"); - - SOAPElement se4 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se4.setAttribute("sql:field", "LiteralInvalidStartingChars"); - se4.setAttribute("name", "LiteralInvalidStartingChars"); - se4.setAttribute("type", "xsd:string"); - se4.setAttribute("minOccurs", "0"); - - SOAPElement se5 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se5.setAttribute("sql:field", "LiteralMaxLength"); - se5.setAttribute("name", "LiteralMaxLength"); - se5.setAttribute("type", "xsd:int"); - se5.setAttribute("minOccurs", "0"); - - SOAPElement se6 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se6.setAttribute("sql:field", "LiteralNameEnumValue"); - se6.setAttribute("name", "LiteralNameEnumValue"); - se6.setAttribute("type", "xsd:int"); - se6.setAttribute("minOccurs", "0"); - - return seRoot; - } - - private static SOAPElement addDbSchemaTablesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - SOAPElement se1 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se1.setAttribute("sql:field", "TABLE_CATALOG"); - se1.setAttribute("name", "TABLE_CATALOG"); - se1.setAttribute("type", "xsd:string"); - - SOAPElement se2 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se2.setAttribute("sql:field", "TABLE_SCHEMA"); - se2.setAttribute("name", "TABLE_SCHEMA"); - se2.setAttribute("type", "xsd:string"); - se2.setAttribute("minOccurs", "0"); - - SOAPElement se3 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se3.setAttribute("sql:field", "TABLE_NAME"); - se3.setAttribute("name", "TABLE_NAME"); - se3.setAttribute("type", "xsd:string"); - - SOAPElement se4 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se4.setAttribute("sql:field", "TABLE_TYPE"); - se4.setAttribute("name", "TABLE_TYPE"); - se4.setAttribute("type", "xsd:string"); - - SOAPElement se5 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se5.setAttribute("sql:field", "TABLE_GUID"); - se5.setAttribute("name", "TABLE_GUID"); - se5.setAttribute("type", "uuid"); - se5.setAttribute("minOccurs", "0"); - - SOAPElement se6 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se6.setAttribute("sql:field", "DESCRIPTION"); - se6.setAttribute("name", "DESCRIPTION"); - se6.setAttribute("type", "xsd:string"); - se6.setAttribute("minOccurs", "0"); - - SOAPElement se7 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se7.setAttribute("sql:field", "TABLE_PROPID"); - se7.setAttribute("name", "TABLE_PROPID"); - se7.setAttribute("type", "xsd:unsignedInt"); - se7.setAttribute("minOccurs", "0"); - - SOAPElement se8 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se8.setAttribute("sql:field", "DATE_CREATED"); - se8.setAttribute("name", "DATE_CREATED"); - se8.setAttribute("type", "xsd:dateTime"); - se8.setAttribute("minOccurs", "0"); - - SOAPElement se9 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se9.setAttribute("sql:field", "DATE_MODIFIED"); - se9.setAttribute("name", "DATE_MODIFIED"); - se9.setAttribute("type", "xsd:dateTime"); - se9.setAttribute("minOccurs", "0"); - - return seRoot; - } - - private static SOAPElement addMdSchemaCubesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - - SOAPElement se1 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se1.setAttribute("sql:field", "CATALOG_NAME"); - se1.setAttribute("name", "CATALOG_NAME"); - se1.setAttribute("type", "xsd:string"); - se1.setAttribute("minOccurs", "0"); - - SOAPElement se2 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se2.setAttribute("sql:field", "SCHEMA_NAME"); - se2.setAttribute("name", "SCHEMA_NAME"); - se2.setAttribute("type", "xsd:string"); - se2.setAttribute("minOccurs", "0"); - - SOAPElement se3 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se3.setAttribute("sql:field", "CUBE_NAME"); - se3.setAttribute("name", "CUBE_NAME"); - se3.setAttribute("type", "xsd:string"); - - SOAPElement se4 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se4.setAttribute("sql:field", "CUBE_TYPE"); - se4.setAttribute("name", "CUBE_TYPE"); - se4.setAttribute("type", "xsd:string"); - - SOAPElement se5 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se5.setAttribute("sql:field", "CUBE_GUID"); - se5.setAttribute("name", "CUBE_GUID"); - se5.setAttribute("type", "uuid"); - se5.setAttribute("minOccurs", "0"); - - SOAPElement se6 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se6.setAttribute("sql:field", "CREATED_ON"); - se6.setAttribute("name", "CREATED_ON"); - se6.setAttribute("type", "xsd:dateTime"); - se6.setAttribute("minOccurs", "0"); - - SOAPElement se7 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se7.setAttribute("sql:field", "LAST_SCHEMA_UPDATE"); - se7.setAttribute("name", "LAST_SCHEMA_UPDATE"); - se7.setAttribute("type", "xsd:dateTime"); - se7.setAttribute("minOccurs", "0"); - - SOAPElement se8 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se8.setAttribute("sql:field", "SCHEMA_UPDATED_BY"); - se8.setAttribute("name", "SCHEMA_UPDATED_BY"); - se8.setAttribute("type", "xsd:string"); - se8.setAttribute("minOccurs", "0"); - - SOAPElement se9 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se9.setAttribute("sql:field", "LAST_DATA_UPDATE"); - se9.setAttribute("name", "LAST_DATA_UPDATE"); - se9.setAttribute("type", "xsd:dateTime"); - se9.setAttribute("minOccurs", "0"); - - SOAPElement se10 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se10.setAttribute("sql:field", "DATA_UPDATED_BY"); - se10.setAttribute("name", "DATA_UPDATED_BY"); - se10.setAttribute("type", "xsd:string"); - se10.setAttribute("minOccurs", "0"); - - SOAPElement se11 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se11.setAttribute("sql:field", "DESCRIPTION"); - se11.setAttribute("name", "DESCRIPTION"); - se11.setAttribute("type", "xsd:string"); - se11.setAttribute("minOccurs", "0"); - - SOAPElement se12 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se12.setAttribute("sql:field", "IS_DRILLTHROUGH_ENABLED"); - se12.setAttribute("name", "IS_DRILLTHROUGH_ENABLED"); - se12.setAttribute("type", "xsd:boolean"); - - SOAPElement se13 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se13.setAttribute("sql:field", "IS_LINKABLE"); - se13.setAttribute("name", "IS_LINKABLE"); - se13.setAttribute("type", "xsd:boolean"); - - SOAPElement se14 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se14.setAttribute("sql:field", "IS_WRITE_ENABLED"); - se14.setAttribute("name", "IS_WRITE_ENABLED"); - se14.setAttribute("type", "xsd:boolean"); - - SOAPElement se15 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se15.setAttribute("sql:field", "IS_SQL_ENABLED"); - se15.setAttribute("name", "IS_SQL_ENABLED"); - se15.setAttribute("type", "xsd:boolean"); - - SOAPElement se16 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se16.setAttribute("sql:field", "CUBE_CAPTION"); - se16.setAttribute("name", "CUBE_CAPTION"); - se16.setAttribute("type", "xsd:string"); - se16.setAttribute("minOccurs", "0"); - - SOAPElement se17 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se17.setAttribute("sql:field", "BASE_CUBE_NAME"); - se17.setAttribute("name", "BASE_CUBE_NAME"); - se17.setAttribute("type", "xsd:string"); - se17.setAttribute("minOccurs", "0"); - - SOAPElement se18 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se18.setAttribute("sql:field", "DIMENSIONS"); - se18.setAttribute("name", "DIMENSIONS"); - se18.setAttribute("minOccurs", "0"); +import java.io.IOException; +import java.io.StringReader; - SOAPElement se19 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se19.setAttribute("sql:field", "SETS"); - se19.setAttribute("name", "SETS"); - se19.setAttribute("minOccurs", "0"); +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; - SOAPElement se20 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se20.setAttribute("sql:field", "MEASURES"); - se20.setAttribute("name", "MEASURES"); - se20.setAttribute("minOccurs", "0"); +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; - SOAPElement se21 = addChildElement(s, Constants.XSD.QN_ELEMENT); - se21.setAttribute("sql:field", "CUBE_SOURCE"); - se21.setAttribute("name", "CUBE_SOURCE"); - se21.setAttribute("type", "xsd:int"); - se21.setAttribute("minOccurs", "0"); +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPFactory; - return seRoot; - } +/** + * Utility class for basic SOAP operations and Discover response handling. + */ +public class SoapUtil { - private static SOAPElement addMdSchemaHierarchiesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - SOAPElement s = prepareSequenceElement(schema); + private static final String UUID_VALUE = "[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}"; + private static final Logger LOGGER = LoggerFactory.getLogger(SoapUtil.class); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); - addElement(s, "HIERARCHY_NAME", "xsd:string", null); - addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); - addElement(s, "HIERARCHY_GUID", "uuid", "0"); - addElement(s, "HIERARCHY_CAPTION", "xsd:string", null); - addElement(s, "DIMENSION_TYPE", "xsd:short", null); - addElement(s, "HIERARCHY_CARDINALITY", "xsd:unsignedInt", null); - addElement(s, "DEFAULT_MEMBER", "xsd:string", "0"); - addElement(s, "ALL_MEMBER", "xsd:string", "0"); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "STRUCTURE", "xsd:short", null); - addElement(s, "IS_VIRTUAL", "xsd:boolean", null); - addElement(s, "IS_READWRITE", "xsd:boolean", null); - addElement(s, "DIMENSION_UNIQUE_SETTINGS", "xsd:int", null); - addElement(s, "DIMENSION_IS_VISIBLE", "xsd:boolean", null); - addElement(s, "HIERARCHY_ORDINAL", "xsd:unsignedInt", null); - addElement(s, "DIMENSION_IS_SHARED", "xsd:boolean", null); - addElement(s, "HIERARCHY_IS_VISIBLE", "xsd:boolean", null); - addElement(s, "HIERARCHY_ORIGIN", "xsd:unsignedShort", "0"); - addElement(s, "HIERARCHY_DISPLAY_FOLDER", "xsd:string", "0"); - addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); - addElement(s, "HIERARCHY_VISIBILITY", "xsd:unsignedShort", "0"); - addElement(s, "PARENT_CHILD", "xsd:boolean", "0"); - addElement(s, "LEVELS", null, "0"); - return seRoot; + private SoapUtil() { + // utility class } - private static SOAPElement prepareSequenceElement(SOAPElement schema) throws SOAPException { + public static SOAPElement prepareSequenceElement(SOAPElement schema) throws SOAPException { SOAPElement ct = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); ct.setAttribute("name", "row"); return addChildElement(ct, Constants.XSD.QN_SEQUENCE); } - private static SOAPElement prepareRootElement(SOAPElement body) throws SOAPException { + public static SOAPElement prepareRootElement(SOAPElement body) throws SOAPException { SOAPElement seDiscoverResponse = body.addChildElement(Constants.MSXMLA.QN_DISCOVER_RESPONSE); SOAPElement seReturn = seDiscoverResponse.addChildElement(Constants.MSXMLA.QN_RETURN); - return seReturn.addChildElement(Constants.ROWSET.QN_ROOT); - } - - private static SOAPElement addMdSchemaMeasuresRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "MEASURE_NAME", "xsd:string", null); - addElement(s, "MEASURE_UNIQUE_NAME", "xsd:string", null); - addElement(s, "MEASURE_CAPTION", "xsd:string", null); - addElement(s, "MEASURE_GUID", "uuid", "0"); - addElement(s, "MEASURE_AGGREGATOR", "xsd:int", null); - addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); - addElement(s, "MEASURE_IS_VISIBLE", "xsd:boolean", null); - addElement(s, "LEVELS_LIST", "xsd:string", "0"); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); - addElement(s, "MEASURE_DISPLAY_FOLDER", "xsd:string", "0"); - addElement(s, "DEFAULT_FORMAT_STRING", "xsd:string", "0"); - addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); - addElement(s, "MEASURE_VISIBILITY", "xsd:unsignedShort", "0"); - return seRoot; + return seReturn.addChildElement(DiscoverConstants.ROWSET.QN_ROOT); } - private static SOAPElement addMdSchemaDimensionsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "DIMENSION_NAME", "xsd:string", null); - addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); - addElement(s, "DIMENSION_GUID", "uuid", "0"); - addElement(s, "DIMENSION_CAPTION", "xsd:string", null); - addElement(s, "DIMENSION_ORDINAL", "xsd:unsignedInt", null); - addElement(s, "DIMENSION_TYPE", "xsd:short", null); - addElement(s, "DIMENSION_CARDINALITY", "xsd:unsignedInt", null); - addElement(s, "DEFAULT_HIERARCHY", "xsd:string", null); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "IS_VIRTUAL", "xsd:boolean", "0"); - addElement(s, "IS_READWRITE", "xsd:boolean", "0"); - addElement(s, "DIMENSION_UNIQUE_SETTINGS", "xsd:int", "0"); - addElement(s, "DIMENSION_MASTER_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "DIMENSION_IS_VISIBLE", "xsd:boolean", "0"); - addElement(s, "HIERARCHIES", null, "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaMeasureGroupsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "IS_WRITE_ENABLED", "xsd:boolean", "0"); - addElement(s, "MEASUREGROUP_CAPTION", "xsd:string", "0"); - return seRoot; - } - - - private static SOAPElement addMdSchemaKpiRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); - addElement(s, "KPI_NAME", "xsd:string", "0"); - addElement(s, "KPI_CAPTION", "xsd:string", "0"); - addElement(s, "KPI_DESCRIPTION", "xsd:string", "0"); - addElement(s, "KPI_DISPLAY_FOLDER", "xsd:string", "0"); - addElement(s, "KPI_VALUE", "xsd:string", "0"); - addElement(s, "KPI_GOAL", "xsd:string", "0"); - addElement(s, "KPI_STATUS", "xsd:string", "0"); - addElement(s, "KPI_TREND", "xsd:string", "0"); - addElement(s, "KPI_STATUS_GRAPHIC", "xsd:string", "0"); - addElement(s, "KPI_TREND_GRAPHIC", "xsd:string", "0"); - addElement(s, "KPI_WEIGHT", "xsd:string", "0"); - addElement(s, "KPI_CURRENT_TIME_MEMBER", "xsd:string", "0"); - addElement(s, "KPI_PARENT_KPI_NAME", "xsd:string", "0"); - addElement(s, "ANNOTATIONS", "xsd:string", "0"); - addElement(s, "SCOPE", "xsd:int", "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaMeasureGroupDimensionsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); - addElement(s, "MEASUREGROUP_CARDINALITY", "xsd:string", "0"); - addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "DIMENSION_CARDINALITY", "xsd:string", "0"); - addElement(s, "DIMENSION_IS_VISIBLE", "xsd:boolean", "0"); - addElement(s, "DIMENSION_IS_FACT_DIMENSION", "xsd:boolean", "0"); - addElement(s, "DIMENSION_PATH", "xsd:string", "0"); - addElement(s, "DIMENSION_GRANULARITY", "xsd:string", "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaLevelsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); - addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); - addElement(s, "LEVEL_NAME", "xsd:string", null); - addElement(s, "LEVEL_UNIQUE_NAME", "xsd:string", null); - addElement(s, "LEVEL_GUID", "uuid", "0"); - addElement(s, "LEVEL_CAPTION", "xsd:string", null); - addElement(s, "LEVEL_NUMBER", "xsd:unsignedInt", null); - addElement(s, "LEVEL_CARDINALITY", "xsd:unsignedInt", null); - addElement(s, "LEVEL_TYPE", "xsd:int", null); - addElement(s, "CUSTOM_ROLLUP_SETTINGS", "xsd:int", null); - addElement(s, "LEVEL_UNIQUE_SETTINGS", "xsd:int", null); - addElement(s, "LEVEL_IS_VISIBLE", "xsd:boolean", null); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "LEVEL_ORIGIN", "xsd:unsignedShort", "0"); - addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); - addElement(s, "LEVEL_VISIBILITY", "xsd:unsignedShort", "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaSetsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "SET_NAME", "xsd:string", null); - addElement(s, "SCOPE", "xsd:int", null); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "EXPRESSION", "xsd:string", "0"); - addElement(s, "DIMENSIONS", "xsd:string", "0"); - addElement(s, "SET_CAPTION", "xsd:string", "0"); - addElement(s, "SET_DISPLAY_FOLDER", "xsd:string", "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaPropertiesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "LEVEL_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "MEMBER_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "PROPERTY_TYPE", "xsd:short", null); - addElement(s, "PROPERTY_NAME", "xsd:string", null); - addElement(s, "PROPERTY_CAPTION", "xsd:string", null); - addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); - addElement(s, "PROPERTY_CONTENT_TYPE", "xsd:short", "0"); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "PROPERTY_ORIGIN", "xsd:unsignedShort", "0"); - addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); - addElement(s, "PROPERTY_VISIBILITY", "xsd:unsignedShort", "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaMembersRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", null); - addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); - addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); - addElement(s, "LEVEL_UNIQUE_NAME", "xsd:string", null); - addElement(s, "LEVEL_NUMBER", "xsd:unsignedInt", null); - addElement(s, "MEMBER_ORDINAL", "xsd:unsignedInt", null); - addElement(s, "MEMBER_NAME", "xsd:string", null); - addElement(s, "MEMBER_UNIQUE_NAME", "xsd:string", null); - addElement(s, "MEMBER_TYPE", "xsd:int", null); - addElement(s, "MEMBER_GUID", "uuid", "0"); - addElement(s, "MEMBER_CAPTION", "xsd:string", null); - addElement(s, "CHILDREN_CARDINALITY", "xsd:unsignedInt", null); - addElement(s, "PARENT_LEVEL", "xsd:unsignedInt", null); - addElement(s, "PARENT_UNIQUE_NAME", "xsd:string", "0"); - addElement(s, "PARENT_COUNT", "xsd:unsignedInt", null); - addElement(s, "TREE_OP", "xsd:string", "0"); - addElement(s, "DEPTH", "xsd:int", "0"); - return seRoot; - } - - private static SOAPElement addDbSchemaTablesInfoRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "TABLE_CATALOG", "xsd:string", "0"); - addElement(s, "TABLE_SCHEMA", "xsd:string", "0"); - addElement(s, "TABLE_NAME", "xsd:string", null); - addElement(s, "TABLE_TYPE", "xsd:string", null); - addElement(s, "TABLE_GUID", "uuid", "0"); - addElement(s, "BOOKMARKS", "xsd:boolean", null); - addElement(s, "BOOKMARK_TYPE", "xsd:int", "0"); - addElement(s, "BOOKMARK_DATATYPE", "xsd:unsignedShort", "0"); - addElement(s, "BOOKMARK_MAXIMUM_LENGTH", "xsd:unsignedInt", "0"); - addElement(s, "BOOKMARK_INFORMATION", "xsd:unsignedInt", "0"); - addElement(s, "TABLE_VERSION", "xsd:long", "0"); - addElement(s, "CARDINALITY", "xsd:unsignedLong", null); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "TABLE_PROPID", "xsd:unsignedInt", "0"); - return seRoot; - } - - private static SOAPElement addDbSchemaSourceTablesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "TABLE_CATALOG", "xsd:string", "0"); - addElement(s, "TABLE_SCHEMA", "xsd:string", "0"); - addElement(s, "TABLE_NAME", "xsd:string", null); - addElement(s, "TABLE_TYPE", "xsd:string", null); - return seRoot; - } - - private static SOAPElement addDbSchemaSchemataRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", null); - addElement(s, "SCHEMA_NAME", "xsd:string", null); - addElement(s, "SCHEMA_OWNER", "xsd:string", null); - return seRoot; - } - - private static SOAPElement addDbSchemaProviderTypesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "TYPE_NAME", "xsd:string", null); - addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); - addElement(s, "COLUMN_SIZE", "xsd:unsignedInt", null); - addElement(s, "LITERAL_PREFIX", "xsd:string", "0"); - addElement(s, "LITERAL_SUFFIX", "xsd:string", "0"); - addElement(s, "IS_NULLABLE", "xsd:boolean", "0"); - addElement(s, "CASE_SENSITIVE", "xsd:boolean", "0"); - addElement(s, "SEARCHABLE", "xsd:unsignedInt", "0"); - addElement(s, "UNSIGNED_ATTRIBUTE", "xsd:boolean", "0"); - addElement(s, "FIXED_PREC_SCALE", "xsd:boolean", "0"); - addElement(s, "AUTO_UNIQUE_VALUE", "xsd:boolean", "0"); - addElement(s, "IS_LONG", "xsd:boolean", "0"); - addElement(s, "BEST_MATCH", "xsd:boolean", "0"); - return seRoot; - } - - private static SOAPElement addDbSchemaColumnsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "TABLE_CATALOG", "xsd:string", null); - addElement(s, "TABLE_SCHEMA", "xsd:string", "0"); - addElement(s, "TABLE_NAME", "xsd:string", null); - addElement(s, "COLUMN_NAME", "xsd:string", null); - addElement(s, "ORDINAL_POSITION", "xsd:unsignedInt", null); - addElement(s, "COLUMN_HAS_DEFAULT", "xsd:boolean", "0"); - addElement(s, "COLUMN_FLAGS", "xsd:unsignedInt", null); - addElement(s, "IS_NULLABLE", "xsd:boolean", null); - addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); - addElement(s, "CHARACTER_MAXIMUM_LENGTH", "xsd:unsignedInt", "0"); - addElement(s, "CHARACTER_OCTET_LENGTH", "xsd:unsignedInt", "0"); - addElement(s, "NUMERIC_PRECISION", "xsd:unsignedShort", "0"); - addElement(s, "NUMERIC_SCALE", "xsd:short", "0"); - return seRoot; - } - - private static SOAPElement addDiscoverXmlMetaDataRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement el1complexType = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - el1complexType.setAttribute("name", "xmlDocument"); - SOAPElement sequence = addChildElement(el1complexType, Constants.XSD.QN_SEQUENCE); - addChildElement(sequence, Constants.XSD.QN_ANY); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "METADATA", "xmlDocument", null); - //addElement(s, "ObjectType", "xsd:string", "0"); - //addElement(s, "DatabaseID", "xsd:string", "0"); - return seRoot; - } - - private static SOAPElement addDiscoverCsdlMetaDataRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement el1complexType = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - el1complexType.setAttribute("name", "xmlDocument"); - SOAPElement sequence = addChildElement(el1complexType, Constants.XSD.QN_SEQUENCE); - addChildElement(sequence, Constants.XSD.QN_ANY); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "METADATA", "xmlDocument", null); - return seRoot; - } - - private static SOAPElement addDiscoverDataSourcesRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "DataSourceName", "xsd:string", null); - addElement(s, "DataSourceDescription", "xsd:string", "0"); - addElement(s, "URL", "xsd:string", "0"); - addElement(s, "DataSourceInfo", "xsd:string", "0"); - addElement(s, "ProviderName", "xsd:string", "0"); - addElement(s, "ProviderType", "xsd:string", "0"); - addElement(s, "AuthenticationMode", "xsd:string", null); - return seRoot; - } - - private static SOAPElement addMdSchemaActionsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "CATALOG_NAME", "xsd:string", "0"); - addElement(s, "SCHEMA_NAME", "xsd:string", "0"); - addElement(s, "CUBE_NAME", "xsd:string", "0"); - addElement(s, "ACTION_NAME", "xsd:string", "0"); - addElement(s, "ACTION_TYPE", "xsd:int", "0"); - addElement(s, "COORDINATE", "xsd:string", "0"); - addElement(s, "COORDINATE_TYPE", "xsd:int", "0"); - addElement(s, "ACTION_CAPTION", "xsd:string", "0"); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "CONTENT", "xsd:string", "0"); - addElement(s, "APPLICATION", "xsd:string", "0"); - addElement(s, "INVOCATION", "xsd:int", "0"); - return seRoot; - } - - private static SOAPElement addMdSchemaFunctionsRoot(SOAPBody body) throws SOAPException { - SOAPElement seRoot = prepareRootElement(body); - SOAPElement schema = fillRoot(seRoot); - - SOAPElement s = prepareSequenceElement(schema); - addElement(s, "FUNCTION_NAME", "xsd:string", null); - addElement(s, "DESCRIPTION", "xsd:string", "0"); - addElement(s, "PARAMETER_LIST", "xsd:string", "0"); - addElement(s, "RETURN_TYPE", "xsd:int", null); - addElement(s, "ORIGIN", "xsd:int", null); - addElement(s, "INTERFACE_NAME", "xsd:string", null); - addElement(s, "LIBRARY_NAME", "xsd:string", "0"); - addElement(s, "CAPTION", "xsd:string", "0"); - return seRoot; - } - - private static void addElement(SOAPElement s, String name, String type, String minOccurs) { + public static void addElement(SOAPElement s, String name, String type, String minOccurs) { SOAPElement se = addChildElement(s, Constants.XSD.QN_ELEMENT); se.setAttribute("sql:field", name); se.setAttribute("name", name); @@ -2400,16 +69,15 @@ private static void addElement(SOAPElement s, String name, String type, String m } } - private static SOAPElement fillRoot(SOAPElement root) { + public static SOAPElement fillRoot(SOAPElement root) { root.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - //root.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); root.setAttribute("xmlns:EX", Constants.EX.NS_URN); SOAPElement schema = addChildElement(root, Constants.XSD.QN_SCHEMA); schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - schema.setAttribute("xmlns", Constants.ROWSET.NS_URN); + schema.setAttribute("xmlns", DiscoverConstants.ROWSET.NS_URN); schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); - schema.setAttribute("targetNamespace", Constants.ROWSET.NS_URN); + schema.setAttribute("targetNamespace", DiscoverConstants.ROWSET.NS_URN); schema.setAttribute("elementFormDefault", "qualified"); SOAPElement el = addChildElement(schema, Constants.XSD.QN_ELEMENT); @@ -2431,498 +99,31 @@ private static SOAPElement fillRoot(SOAPElement root) { return schema; } - private static SOAPElement addEmptyRoot(SOAPBody body) throws SOAPException { - - SOAPElement seExecuteResponse = body.addChildElement(Constants.MSXMLA.QN_EXECUTE_RESPONSE); - SOAPElement seReturn = seExecuteResponse.addChildElement(Constants.MSXMLA.QN_RETURN); - SOAPElement seRoot = seReturn.addChildElement(Constants.EMPTY.QN_ROOT); - - seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); - return seRoot; - } - - private static SOAPElement addMddatasetRoot(SOAPElement body) throws SOAPException { - SOAPElement seExecuteResponse = body.addChildElement(Constants.MSXMLA.QN_EXECUTE_RESPONSE); - SOAPElement seReturn = seExecuteResponse.addChildElement(Constants.MSXMLA.QN_RETURN); - SOAPElement seRoot = seReturn.addChildElement(Constants.MDDATASET.QN_ROOT); - seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); - addMddatasetSchema(seRoot); - return seRoot; - } - - private static SOAPElement addRowSetRoot(SOAPBody body, RowSet rowSet) throws SOAPException { - - SOAPElement seExecuteResponse = body.addChildElement(Constants.MSXMLA.QN_EXECUTE_RESPONSE); - SOAPElement seReturn = seExecuteResponse.addChildElement(Constants.MSXMLA.QN_RETURN); - SOAPElement seRoot = seReturn.addChildElement(Constants.ROWSET.QN_ROOT); - - seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); - addRowsetSchema(seRoot, rowSet); - return seRoot; - } - - private static void addRowsetSchema(SOAPElement root, RowSet rowSet) { - SOAPElement schema = addChildElement(root, Constants.XSD.QN_SCHEMA); - schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - schema.setAttribute("targetNamespace", Constants.ROWSET.NS_URN); - schema.setAttribute("xmlns", Constants.ROWSET.NS_URN); - schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); - schema.setAttribute("elementFormDefault", "qualified"); - - SOAPElement el1 = addChildElement(schema, Constants.XSD.QN_ELEMENT); - el1.setAttribute("name", "root"); - SOAPElement el1complexType = addChildElement(el1, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement el1complexTypeSequence = addChildElement(el1complexType, Constants.XSD.QN_SEQUENCE); - SOAPElement el1complexTypeSequenceEl = addChildElement(el1complexTypeSequence, Constants.XSD.QN_ELEMENT); - el1complexTypeSequenceEl.setAttribute("maxOccurs", "unbounded"); - el1complexTypeSequenceEl.setAttribute("minOccurs", "0"); - el1complexTypeSequenceEl.setAttribute("name", "row"); - el1complexTypeSequenceEl.setAttribute("type", "row"); - - SOAPElement simpleType = addChildElement(schema, Constants.XSD.QN_SIMPLE_TYPE); - simpleType.setAttribute("name", "uuid"); - SOAPElement restriction = addChildElement(simpleType, Constants.XSD.QN_RESTRICTION); - restriction.setAttribute("base", "xsd:string"); - SOAPElement pattern = addChildElement(restriction, Constants.XSD.QN_PATTERN); - pattern.setAttribute("value", UUID_VALUE); - - SOAPElement complexType = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - complexType.setAttribute("name", "xmlDocument"); - SOAPElement sequence = addChildElement(complexType, Constants.XSD.QN_SEQUENCE); - addChildElement(sequence, Constants.XSD.QN_ANY); - - SOAPElement ct = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct.setAttribute("name", "row"); - SOAPElement ctSequence = addChildElement(ct, Constants.XSD.QN_SEQUENCE); - if (rowSet.rowSetRows() != null && !rowSet.rowSetRows().isEmpty() && rowSet.rowSetRows().get(0) != null - && rowSet.rowSetRows().get(0).rowSetRowItem() != null) { - for (RowSetRowItem item : rowSet.rowSetRows().get(0).rowSetRowItem()) { - SOAPElement ctSequenceEl1 = addChildElement(ctSequence, Constants.XSD.QN_ELEMENT); - ItemTypeEnum type = item.type().orElse(ItemTypeEnum.STRING); - ctSequenceEl1.setAttribute("minOccurs", "0"); - ctSequenceEl1.setAttribute("name", item.tagName()); - ctSequenceEl1.setAttribute("sql:field", item.fieldName()); - ctSequenceEl1.setAttribute("type", type.getValue()); - } - } - } - - private static void addMddatasetSchema(SOAPElement root) { - SOAPElement schema = addChildElement(root, Constants.XSD.QN_SCHEMA); - schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); - schema.setAttribute("targetNamespace", Constants.MDDATASET.NS_URN); - schema.setAttribute("xmlns", Constants.MDDATASET.NS_URN); - schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); - schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); - schema.setAttribute("elementFormDefault", "qualified"); - SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct1.setAttribute("name", "MemberType"); - SOAPElement ct1Sequence = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); - SOAPElement e1 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); - e1.setAttribute("name", "UName"); - e1.setAttribute("type", "xsd:string"); - SOAPElement e2 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); - e2.setAttribute("name", "Caption"); - e2.setAttribute("type", "xsd:string"); - SOAPElement e3 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); - e3.setAttribute("name", "LName"); - e3.setAttribute("type", "xsd:string"); - SOAPElement e4 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); - e4.setAttribute("name", "LNum"); - e4.setAttribute("type", "xsd:unsignedInt"); - SOAPElement e5 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); - e5.setAttribute("name", "DisplayInfo"); - e5.setAttribute("type", "xsd:unsignedInt"); - SOAPElement s = addChildElement(ct1Sequence, Constants.XSD.QN_SEQUENCE); - s.setAttribute("maxOccurs", "unbounded"); - s.setAttribute("minOccurs", "0"); - SOAPElement any = addChildElement(s, Constants.XSD.QN_ANY); - any.setAttribute("processContents", "lax"); - any.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct1Attribute = addChildElement(ct1, Constants.XSD.QN_ATTRIBUTE); - ct1Attribute.setAttribute("name", "Hierarchy"); - ct1Attribute.setAttribute("type", "xsd:string"); - - SOAPElement ct2 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct2.setAttribute("name", "PropType"); - SOAPElement ct2Attribute = addChildElement(ct2, Constants.XSD.QN_ATTRIBUTE); - ct2Attribute.setAttribute("name", "name"); - ct2Attribute.setAttribute("type", "xsd:string"); - - SOAPElement ct3 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct3.setAttribute("name", "TupleType"); - SOAPElement ct3Sequence = addChildElement(ct3, Constants.XSD.QN_SEQUENCE); - ct3Sequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct3SequenceElement = addChildElement(ct3Sequence, Constants.XSD.QN_ELEMENT); - ct3SequenceElement.setAttribute("name", "Member"); - ct3SequenceElement.setAttribute("type", "MemberType"); - - SOAPElement ct4 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct4.setAttribute("name", "MembersType"); - SOAPElement ct4Sequence = addChildElement(ct4, Constants.XSD.QN_SEQUENCE); - ct4Sequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct4SequenceElement = addChildElement(ct4Sequence, Constants.XSD.QN_ELEMENT); - ct4SequenceElement.setAttribute("name", "Member"); - ct4SequenceElement.setAttribute("type", "MemberType"); - SOAPElement ct4Attribute = addChildElement(ct4, Constants.XSD.QN_ATTRIBUTE); - ct4Attribute.setAttribute("name", "Hierarchy"); - ct4Attribute.setAttribute("type", "xsd:string"); - - SOAPElement ct5 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct5.setAttribute("name", "TuplesType"); - SOAPElement ct5Sequence = addChildElement(ct5, Constants.XSD.QN_SEQUENCE); - ct5Sequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct5SequenceElement = addChildElement(ct5Sequence, Constants.XSD.QN_ELEMENT); - ct5SequenceElement.setAttribute("name", "Tuple"); - ct5SequenceElement.setAttribute("type", "TupleType"); - - SOAPElement ct6 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct6.setAttribute("name", "CrossProductType"); - SOAPElement ct6Sequence = addChildElement(ct6, Constants.XSD.QN_SEQUENCE); - //ct6Sequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct6SequenceChoice = addChildElement(ct6Sequence, Constants.XSD.QN_CHOICE); - ct6SequenceChoice.setAttribute("minOccurs", "0"); - ct6SequenceChoice.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct6SequenceChoiceE1 = addChildElement(ct6SequenceChoice, Constants.XSD.QN_ELEMENT); - ct6SequenceChoiceE1.setAttribute("name", "Members"); - ct6SequenceChoiceE1.setAttribute("type", "MembersType"); - SOAPElement ct6SequenceChoiceE2 = addChildElement(ct6SequenceChoice, Constants.XSD.QN_ELEMENT); - ct6SequenceChoiceE2.setAttribute("name", "Tuples"); - ct6SequenceChoiceE2.setAttribute("type", "TuplesType"); - SOAPElement ct6Attribute = addChildElement(ct6, Constants.XSD.QN_ATTRIBUTE); - ct6Attribute.setAttribute("name", "Size"); - ct6Attribute.setAttribute("type", "xsd:unsignedInt"); - - SOAPElement ct7 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct7.setAttribute("name", "OlapInfo"); - SOAPElement ct7Sequence = addChildElement(ct7, Constants.XSD.QN_SEQUENCE); - SOAPElement ct7SequenceElement1 = addChildElement(ct7Sequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement1.setAttribute("name", "CubeInfo"); - - SOAPElement ct7SequenceElement1Ct = addChildElement(ct7SequenceElement1, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct7SequenceElement1CtSequence = addChildElement(ct7SequenceElement1Ct, Constants.XSD.QN_SEQUENCE); - SOAPElement ct7SequenceElement1CtSequenceEl = addChildElement(ct7SequenceElement1CtSequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement1CtSequenceEl.setAttribute("name", "Cube"); - ct7SequenceElement1CtSequenceEl.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement1CtSequenceElCt = addChildElement(ct7SequenceElement1CtSequenceEl, - Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct7SequenceElement1CtSequenceElCtSequence = addChildElement(ct7SequenceElement1CtSequenceElCt, - Constants.XSD.QN_SEQUENCE); - SOAPElement ct7SequenceElement1CtSequenceElCtSequenceEl = addChildElement( - ct7SequenceElement1CtSequenceElCtSequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement1CtSequenceElCtSequenceEl.setAttribute("name", "CubeName"); - ct7SequenceElement1CtSequenceElCtSequenceEl.setAttribute("type", "xsd:string"); - - SOAPElement ct7SequenceElement2 = addChildElement(ct7Sequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2.setAttribute("name", "AxesInfo"); - SOAPElement ct7SequenceElement2Ct = addChildElement(ct7SequenceElement2, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct7SequenceElement2CtSequence = addChildElement(ct7SequenceElement2Ct, Constants.XSD.QN_SEQUENCE); - SOAPElement ct7SequenceElement2CtSequenceEl = addChildElement(ct7SequenceElement2CtSequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceEl.setAttribute("name", "AxisInfo"); - ct7SequenceElement2CtSequenceEl.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement2CtSequenceElCt = addChildElement(ct7SequenceElement2CtSequenceEl, - Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct7SequenceElement2CtSequenceElCtSequence = addChildElement(ct7SequenceElement2CtSequenceElCt, - Constants.XSD.QN_SEQUENCE); - - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElement = addChildElement( - ct7SequenceElement2CtSequenceElCtSequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceElCtSequenceElement.setAttribute("name", "HierarchyInfo"); - ct7SequenceElement2CtSequenceElCtSequenceElement.setAttribute("minOccurs", "0"); - ct7SequenceElement2CtSequenceElCtSequenceElement.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElementCt = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceElement, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElementCtSequence = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceElementCt, Constants.XSD.QN_SEQUENCE); - - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceElementCtSequence, Constants.XSD.QN_SEQUENCE); - ct7SequenceElement2CtSequenceElCtSequenceSequence1.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E1 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E1.setAttribute("name", "UName"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E1.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E2 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E2.setAttribute("name", "Caption"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E2.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E3 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E3.setAttribute("name", "LName"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E3.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E4 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E4.setAttribute("name", "LNum"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E4.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E5 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("name", "DisplayInfo"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("type", "PropType"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("minOccurs", "0"); - ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence2 = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceElementCtSequence, Constants.XSD.QN_SEQUENCE); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence2Any = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceSequence2, Constants.XSD.QN_ANY); - ct7SequenceElement2CtSequenceElCtSequenceSequence2Any.setAttribute("processContents", "lax"); - ct7SequenceElement2CtSequenceElCtSequenceSequence2Any.setAttribute("minOccurs", "0"); - ct7SequenceElement2CtSequenceElCtSequenceSequence2Any.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute = addChildElement( - ct7SequenceElement2CtSequenceElCtSequenceElementCt, Constants.XSD.QN_ATTRIBUTE); - ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute.setAttribute("name", "name"); - ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute.setAttribute("type", "xsd:string"); - ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute.setAttribute("use", "required"); - SOAPElement ct7SequenceElement2CtAttribute = addChildElement(ct7SequenceElement2CtSequenceElCt, - Constants.XSD.QN_ATTRIBUTE); - ct7SequenceElement2CtAttribute.setAttribute("name", "name"); - ct7SequenceElement2CtAttribute.setAttribute("type", "xsd:string"); - - SOAPElement ct7SequenceElement3 = addChildElement(ct7Sequence, Constants.XSD.QN_ELEMENT); - ct7SequenceElement3.setAttribute("name", "CellInfo"); - SOAPElement ct7SequenceElement3Ct = addChildElement(ct7SequenceElement3, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct7SequenceElement3CtSequence = addChildElement(ct7SequenceElement3Ct, Constants.XSD.QN_SEQUENCE); - SOAPElement ct7SequenceElement2CtSequenceSequence1 = addChildElement(ct7SequenceElement3CtSequence, - Constants.XSD.QN_SEQUENCE); - ct7SequenceElement2CtSequenceSequence1.setAttribute("minOccurs", "0"); - ct7SequenceElement2CtSequenceSequence1.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct7SequenceElement2CtSequenceSequence1Ch = addChildElement(ct7SequenceElement2CtSequenceSequence1, - Constants.XSD.QN_CHOICE); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE1 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE1.setAttribute("name", "Value"); - ct7SequenceElement2CtSequenceSequence1ChE1.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE2 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE2.setAttribute("name", "FmtValue"); - ct7SequenceElement2CtSequenceSequence1ChE2.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE3 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE3.setAttribute("name", "BackColor"); - ct7SequenceElement2CtSequenceSequence1ChE3.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE4 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE4.setAttribute("name", "ForeColor"); - ct7SequenceElement2CtSequenceSequence1ChE4.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE5 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE5.setAttribute("name", "FontName"); - ct7SequenceElement2CtSequenceSequence1ChE5.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE6 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE6.setAttribute("name", "FontSize"); - ct7SequenceElement2CtSequenceSequence1ChE6.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE7 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE7.setAttribute("name", "FontFlags"); - ct7SequenceElement2CtSequenceSequence1ChE7.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE8 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE8.setAttribute("name", "FormatString"); - ct7SequenceElement2CtSequenceSequence1ChE8.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE9 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE9.setAttribute("name", "NonEmptyBehavior"); - ct7SequenceElement2CtSequenceSequence1ChE9.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE10 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE10.setAttribute("name", "SolveOrder"); - ct7SequenceElement2CtSequenceSequence1ChE10.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE11 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE11.setAttribute("name", "Updateable"); - ct7SequenceElement2CtSequenceSequence1ChE11.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE12 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE12.setAttribute("name", "Visible"); - ct7SequenceElement2CtSequenceSequence1ChE12.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence1ChE13 = addChildElement( - ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); - ct7SequenceElement2CtSequenceSequence1ChE13.setAttribute("name", "Expression"); - ct7SequenceElement2CtSequenceSequence1ChE13.setAttribute("type", "PropType"); - SOAPElement ct7SequenceElement2CtSequenceSequence2 = addChildElement(ct7SequenceElement3CtSequence, Constants.XSD.QN_SEQUENCE); - ct7SequenceElement2CtSequenceSequence2.setAttribute("maxOccurs", "unbounded"); - ct7SequenceElement2CtSequenceSequence2.setAttribute("minOccurs", "0"); - SOAPElement ct7SequenceElement2CtSequenceSequence2Any = addChildElement(ct7SequenceElement2CtSequenceSequence2, - Constants.XSD.QN_ANY); - ct7SequenceElement2CtSequenceSequence2Any.setAttribute("processContents", "lax"); - ct7SequenceElement2CtSequenceSequence2Any.setAttribute("maxOccurs", "unbounded"); - - SOAPElement ct8 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct8.setAttribute("name", "Axes"); - SOAPElement ct8Sequence = addChildElement(ct8, Constants.XSD.QN_SEQUENCE); - ct8Sequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct8SequenceElement = addChildElement(ct8Sequence, Constants.XSD.QN_ELEMENT); - ct8SequenceElement.setAttribute("name", "Axis"); - SOAPElement ct8SequenceElementComplexType = addChildElement(ct8SequenceElement, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct8SequenceElementComplexTypeChoice = addChildElement(ct8SequenceElementComplexType, - Constants.XSD.QN_CHOICE); - ct8SequenceElementComplexTypeChoice.setAttribute("minOccurs", "0"); - ct8SequenceElementComplexTypeChoice.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct8SequenceElementComplexTypeChoiceE1 = addChildElement(ct8SequenceElementComplexTypeChoice, - Constants.XSD.QN_ELEMENT); - ct8SequenceElementComplexTypeChoiceE1.setAttribute("name", "CrossProduct"); - ct8SequenceElementComplexTypeChoiceE1.setAttribute("type", "CrossProductType"); - SOAPElement ct8SequenceElementComplexTypeChoiceE2 = addChildElement(ct8SequenceElementComplexTypeChoice, - Constants.XSD.QN_ELEMENT); - ct8SequenceElementComplexTypeChoiceE2.setAttribute("name", "Tuples"); - ct8SequenceElementComplexTypeChoiceE2.setAttribute("type", "TuplesType"); - SOAPElement ct8SequenceElementComplexTypeChoiceE3 = addChildElement(ct8SequenceElementComplexTypeChoice, - Constants.XSD.QN_ELEMENT); - ct8SequenceElementComplexTypeChoiceE3.setAttribute("name", "Members"); - ct8SequenceElementComplexTypeChoiceE3.setAttribute("type", "MembersType"); - SOAPElement ct8SequenceElementComplexTypeAttribute = addChildElement(ct8SequenceElementComplexType, - Constants.XSD.QN_ATTRIBUTE); - ct8SequenceElementComplexTypeAttribute.setAttribute("name", "name"); - ct8SequenceElementComplexTypeAttribute.setAttribute("type", "xsd:string"); - - SOAPElement ct9 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); - ct9.setAttribute("name", "CellData"); - SOAPElement ct9Sequence = addChildElement(ct9, Constants.XSD.QN_SEQUENCE); - SOAPElement ct9SequenceElement = addChildElement(ct9Sequence, Constants.XSD.QN_ELEMENT); - ct9SequenceElement.setAttribute("name", "Cell"); - ct9SequenceElement.setAttribute("minOccurs", "0"); - ct9SequenceElement.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct9SequenceElementComplexType = addChildElement(ct9SequenceElement, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement ct9SequenceElementComplexTypeSequence = addChildElement(ct9SequenceElementComplexType, - Constants.XSD.QN_SEQUENCE); - ct9SequenceElementComplexTypeSequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoice = addChildElement(ct9SequenceElementComplexTypeSequence, - Constants.XSD.QN_CHOICE); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE1 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE1.setAttribute("name", "Value"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE2 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE2.setAttribute("name", "FmtValue"); - ct9SequenceElementComplexTypeSequenceChoiceE2.setAttribute("type", "xsd:string"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE3 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE3.setAttribute("name", "BackColor"); - ct9SequenceElementComplexTypeSequenceChoiceE3.setAttribute("type", "xsd:unsignedInt"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE4 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE4.setAttribute("name", "ForeColor"); - ct9SequenceElementComplexTypeSequenceChoiceE4.setAttribute("type", "xsd:unsignedInt"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE5 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE5.setAttribute("name", "FontName"); - ct9SequenceElementComplexTypeSequenceChoiceE5.setAttribute("type", "xsd:string"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE6 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE6.setAttribute("name", "FontSize"); - ct9SequenceElementComplexTypeSequenceChoiceE6.setAttribute("type", "xsd:unsignedShort"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE7 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE7.setAttribute("name", "FontFlags"); - ct9SequenceElementComplexTypeSequenceChoiceE7.setAttribute("type", "xsd:unsignedInt"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE8 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE8.setAttribute("name", "FormatString"); - ct9SequenceElementComplexTypeSequenceChoiceE8.setAttribute("type", "xsd:string"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE9 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE9.setAttribute("name", "NonEmptyBehavior"); - ct9SequenceElementComplexTypeSequenceChoiceE9.setAttribute("type", "xsd:unsignedShort"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE10 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE10.setAttribute("name", "SolveOrder"); - ct9SequenceElementComplexTypeSequenceChoiceE10.setAttribute("type", "xsd:unsignedInt"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE11 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE11.setAttribute("name", "Updateable"); - ct9SequenceElementComplexTypeSequenceChoiceE11.setAttribute("type", "xsd:unsignedInt"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE12 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE12.setAttribute("name", "Visible"); - ct9SequenceElementComplexTypeSequenceChoiceE12.setAttribute("type", "xsd:unsignedInt"); - SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE13 = addChildElement( - ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); - ct9SequenceElementComplexTypeSequenceChoiceE13.setAttribute("name", "Expression"); - ct9SequenceElementComplexTypeSequenceChoiceE13.setAttribute("type", "xsd:string"); - SOAPElement ct9SequenceElementComplexTypeAttribute = addChildElement(ct9SequenceElementComplexType, - Constants.XSD.QN_ATTRIBUTE); - ct9SequenceElementComplexTypeAttribute.setAttribute("name", "CellOrdinal"); - ct9SequenceElementComplexTypeAttribute.setAttribute("type", "xsd:unsignedInt"); - ct9SequenceElementComplexTypeAttribute.setAttribute("use", "required"); - - SOAPElement element = addChildElement(schema, Constants.XSD.QN_ELEMENT); - element.setAttribute("name", "root"); - SOAPElement elementComplexType = addChildElement(element, Constants.XSD.QN_COMPLEX_TYPE); - SOAPElement elementComplexTypeSequence = addChildElement(elementComplexType, Constants.XSD.QN_SEQUENCE); - elementComplexTypeSequence.setAttribute("maxOccurs", "unbounded"); - SOAPElement elementComplexTypeSequenceE1 = addChildElement(elementComplexTypeSequence, Constants.XSD.QN_ELEMENT); - elementComplexTypeSequenceE1.setAttribute("name", "OlapInfo"); - elementComplexTypeSequenceE1.setAttribute("type", "OlapInfo"); - SOAPElement elementComplexTypeSequenceE2 = addChildElement(elementComplexTypeSequence, Constants.XSD.QN_ELEMENT); - elementComplexTypeSequenceE2.setAttribute("name", "Axes"); - elementComplexTypeSequenceE2.setAttribute("type", "Axes"); - SOAPElement elementComplexTypeSequenceE3 = addChildElement(elementComplexTypeSequence, Constants.XSD.QN_ELEMENT); - elementComplexTypeSequenceE3.setAttribute("name", "CellData"); - elementComplexTypeSequenceE3.setAttribute("type", "CellData"); - } - - private static SOAPElement addChildElementTextNode(SOAPElement element, QName qNameOfChild, String valueOfChild) { - try { - SOAPElement createdChild = element.addChildElement(qNameOfChild); - createdChild.setAttribute("xmlns", "http://schemas.microsoft.com/analysisservices/2003/engine"); - createdChild.setAttribute("xmlns:ddl2", "http://schemas.microsoft.com/analysisservices/2003/engine/2"); - createdChild.setAttribute("xmlns:ddl2_2", "http://schemas.microsoft.com/analysisservices/2003/engine/2/2"); - createdChild.setAttribute("xmlns:ddl100", "http://schemas.microsoft.com/analysisservices/2008/engine/100"); - createdChild.setAttribute("xmlns:ddl100_100", "http://schemas.microsoft.com/analysisservices/2008/engine/100/100"); - createdChild.setAttribute("xmlns:ddl200", "http://schemas.microsoft.com/analysisservices/2010/engine/200"); - createdChild.setAttribute("xmlns:ddl200_200", "http://schemas.microsoft.com/analysisservices/2010/engine/200/200"); - createdChild.setAttribute("xmlns:ddl300", "http://schemas.microsoft.com/analysisservices/2011/engine/300"); - createdChild.setAttribute("xmlns:ddl300_300", "http://schemas.microsoft.com/analysisservices/2011/engine/300/300"); - createdChild.setAttribute("xmlns:ddl400", "http://schemas.microsoft.com/analysisservices/2012/engine/400"); - createdChild.setAttribute("xmlns:ddl400_400", "http://schemas.microsoft.com/analysisservices/2012/engine/400/400"); - if (valueOfChild != null && !valueOfChild.isEmpty()) { - SOAPElement se = xmlStringToSoapElement(valueOfChild, createdChild); - createdChild.addChildElement(se); - } - return createdChild; - - } catch (SOAPException | SAXException | IOException | ParserConfigurationException e) { - LOGGER.error("addChildElement {} error", qNameOfChild); - throw new RuntimeException("addChildElement error", e); - } - } - - public static SOAPElement xmlStringToSoapElement(String xmlFragment, SOAPElement context) throws SAXException, IOException, ParserConfigurationException, SOAPException { - // Парсим XML-строку как DOM + public static SOAPElement xmlStringToSoapElement(String xmlFragment, SOAPElement context) + throws SAXException, IOException, ParserConfigurationException, SOAPException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); - Document doc = dbf.newDocumentBuilder() - .parse(new InputSource(new StringReader(xmlFragment))); + // XXE prevention + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + Document doc = dbf.newDocumentBuilder().parse(new InputSource(new StringReader(xmlFragment))); Element root = doc.getDocumentElement(); - // Импортируем узел в документ SOAP'а Node imported = context.getOwnerDocument().importNode(root, true); - // Преобразуем к SOAPElement (если возможно) if (imported instanceof SOAPElement) { return (SOAPElement) imported; } else { - // Если нет — вручную создаём SOAPElement и копируем содержимое SOAPFactory soapFactory = SOAPFactory.newInstance(); SOAPElement newElement = soapFactory.createElement(root.getNodeName(), "", root.getNamespaceURI()); - // Копируем атрибуты for (int i = 0; i < root.getAttributes().getLength(); i++) { Node attr = root.getAttributes().item(i); - newElement.addAttribute( - soapFactory.createName(attr.getNodeName()), attr.getNodeValue() - ); + newElement.addAttribute(soapFactory.createName(attr.getNodeName()), attr.getNodeValue()); } - // Копируем дочерние узлы Node child = root.getFirstChild(); while (child != null) { Node importedChild = context.getOwnerDocument().importNode(child, true); @@ -2933,7 +134,8 @@ public static SOAPElement xmlStringToSoapElement(String xmlFragment, SOAPElement return newElement; } } - private static SOAPElement addChildElement(SOAPElement element, QName qNameOfChild, String valueOfChild) { + + public static SOAPElement addChildElement(SOAPElement element, QName qNameOfChild, String valueOfChild) { try { SOAPElement createdChild = element.addChildElement(qNameOfChild); createdChild.setTextContent(valueOfChild); @@ -2941,48 +143,16 @@ private static SOAPElement addChildElement(SOAPElement element, QName qNameOfChi } catch (SOAPException e) { LOGGER.error("addChildElement {} error", qNameOfChild); - throw new RuntimeException("addChildElement error", e); + throw new XmlaSoapException("addChildElement error", e); } } - private static SOAPElement addChildElement(SOAPElement element, QName qNameOfChild) { + public static SOAPElement addChildElement(SOAPElement element, QName qNameOfChild) { try { return element.addChildElement(qNameOfChild); } catch (SOAPException e) { LOGGER.error("addChildElement {} error", qNameOfChild); - throw new RuntimeException("addChildElement error", e); + throw new XmlaSoapException("addChildElement error", e); } } - - private static void addChildElement(SOAPElement element, String childElementName, String prefix, String value) { - try { - if (value != null) { - if (prefix != null) { - element.addChildElement(childElementName, prefix).setTextContent(value); - } else { - element.addChildElement(childElementName).setTextContent(value); - } - - } - } catch (SOAPException e) { - LOGGER.error("addChildElement {} error", childElementName); - throw new RuntimeException("addChildElement error", e); - } - } - - private static SOAPElement addChildElement(SOAPElement element, String childElementName, String prefix) { - - try { - if (prefix == null) { - return element.addChildElement(childElementName); - - } else { - return element.addChildElement(childElementName, prefix); - } - } catch (SOAPException e) { - LOGGER.error("addChildElement {} error", childElementName); - throw new RuntimeException("addChildElement error", e); - } - } - } diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlNodeHelper.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlNodeHelper.java new file mode 100644 index 0000000..4e646d3 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlNodeHelper.java @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; + +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Helper class for XML node parsing operations. Contains generic methods for + * parsing NodeLists into typed collections and values. + */ +public class XmlNodeHelper { + + private XmlNodeHelper() { + // utility class + } + + /** + * Generic method to parse a list of elements from a NodeList. + * + * @param nl NodeList to parse + * @param nodeName Name of the nodes to match + * @param factory Function to convert NodeList to the target type + * @param The type of elements in the resulting list + * @return List of parsed elements + */ + public static List getList(NodeList nl, String nodeName, Function factory) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null && nodeName.equals(node.getNodeName())) { + list.add(factory.apply(node.getChildNodes())); + } + } + return list; + } + + public static String getAttribute(NamedNodeMap attributes, String name) { + if (attributes == null) { + return null; + } + org.w3c.dom.Node node = attributes.getNamedItem(name); + if (node == null) { + return null; + } + return node.getNodeValue(); + } + + public static String getNodeType(org.w3c.dom.Node node) { + if (node == null || node.getAttributes() == null) { + return null; + } + return getAttribute(node.getAttributes(), "xsi:type"); + } + + public static Boolean toBoolean(String s) { + if (s == null) { + return null; + } + return Boolean.parseBoolean(s); + } + + public static Integer toInteger(String s) { + if (s == null) { + return null; + } + return Integer.parseInt(s); + } + + public static Long toLong(String s) { + if (s == null) { + return null; + } + return Long.parseLong(s); + } + + public static BigInteger toBigInteger(String s) { + if (s == null) { + return null; + } + return new BigInteger(s); + } + + public static Instant toInstant(String s) { + if (s == null) { + return null; + } + return Instant.parse(s); + } + + public static Duration toDuration(String s) { + if (s == null) { + return null; + } + return Duration.parse(s); + } + + /** + * Get text content from a node with a default value if null. + * + * @param node The node to get text content from + * @param defaultValue The default value if node is null or has no text content + * @return The text content or default value + */ + public static String getTextContent(Node node, String defaultValue) { + if (node == null) { + return defaultValue; + } + String content = node.getTextContent(); + return content != null ? content : defaultValue; + } + + /** + * Get optional text content from a node. + * + * @param node The node to get text content from + * @return Optional containing the text content, or empty if node is null + */ + public static Optional getOptionalText(Node node) { + if (node == null) { + return Optional.empty(); + } + return Optional.ofNullable(node.getTextContent()); + } + + /** + * Convert a NodeList to a Map of node names to text content values. Useful for + * parsing simple key-value style XML structures. + * + * @param nl The NodeList to convert + * @return Map of node names to text content values + */ + public static Map nodeListToMap(NodeList nl) { + Map map = new HashMap<>(); + for (int i = 0; i < nl.getLength(); i++) { + Node node = nl.item(i); + if (node != null) { + map.put(node.getNodeName(), node.getTextContent()); + } + } + return map; + } + + /** + * Generic method to parse a list of string values from a NodeList. + * + * @param nl NodeList to parse + * @param nodeName Name of the nodes to match + * @return List of text content values + */ + public static List getStringList(NodeList nl, String nodeName) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + Node node = nl.item(i); + if (node != null && nodeName.equals(node.getNodeName())) { + list.add(node.getTextContent()); + } + } + return list; + } + + /** + * Find the first node with the given name and return its text content. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Text content of the first matching node, or null if not found + */ + public static String findNodeValue(NodeList nl, String nodeName) { + for (int i = 0; i < nl.getLength(); i++) { + Node node = nl.item(i); + if (node != null && nodeName.equals(node.getNodeName())) { + return node.getTextContent(); + } + } + return null; + } + + /** + * Find the first node with the given name and return its text content as + * Optional. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Optional containing text content, or empty if not found + */ + public static Optional findOptionalNodeValue(NodeList nl, String nodeName) { + return Optional.ofNullable(findNodeValue(nl, nodeName)); + } + + /** + * Find a node by name and apply a converter function to its text content. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @param converter Function to convert the text content + * @param The result type + * @return Converted value, or null if node not found + */ + public static T findNodeValue(NodeList nl, String nodeName, java.util.function.Function converter) { + String value = findNodeValue(nl, nodeName); + return value != null ? converter.apply(value) : null; + } + + /** + * Find a node by name and return its text content as Boolean. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Boolean value, or null if not found + */ + public static Boolean findBooleanValue(NodeList nl, String nodeName) { + return findNodeValue(nl, nodeName, XmlNodeHelper::toBoolean); + } + + /** + * Find a node by name and return its text content as Long. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Long value, or null if not found + */ + public static Long findLongValue(NodeList nl, String nodeName) { + return findNodeValue(nl, nodeName, XmlNodeHelper::toLong); + } + + /** + * Find a node by name and return its text content as Integer. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Integer value, or null if not found + */ + public static Integer findIntegerValue(NodeList nl, String nodeName) { + return findNodeValue(nl, nodeName, XmlNodeHelper::toInteger); + } + + /** + * Find a node by name and return its text content as Instant. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Instant value, or null if not found + */ + public static Instant findInstantValue(NodeList nl, String nodeName) { + return findNodeValue(nl, nodeName, XmlNodeHelper::toInstant); + } + + /** + * Find a node by name and return its text content as BigInteger. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return BigInteger value, or null if not found + */ + public static BigInteger findBigIntegerValue(NodeList nl, String nodeName) { + return findNodeValue(nl, nodeName, XmlNodeHelper::toBigInteger); + } + + /** + * Find a node by name and return its text content as Duration. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return Duration value, or null if not found + */ + public static Duration findDurationValue(NodeList nl, String nodeName) { + return findNodeValue(nl, nodeName, XmlNodeHelper::toDuration); + } + + /** + * Find the first node with the given name. + * + * @param nl NodeList to search + * @param nodeName Name of the node to find + * @return The first matching node, or null if not found + */ + public static Node findNode(NodeList nl, String nodeName) { + for (int i = 0; i < nl.getLength(); i++) { + Node node = nl.item(i); + if (node != null && nodeName.equals(node.getNodeName())) { + return node; + } + } + return null; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaApiAdapter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaApiAdapter.java index a5305b0..6f7bd45 100644 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaApiAdapter.java +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaApiAdapter.java @@ -15,150 +15,17 @@ import java.security.Principal; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; -import javax.xml.namespace.QName; - import org.eclipse.daanse.xmla.api.RequestMetaData; import org.eclipse.daanse.xmla.api.UserRolePrincipal; import org.eclipse.daanse.xmla.api.XmlaService; -import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.columns.DbSchemaColumnsRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.columns.DbSchemaColumnsResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.providertypes.DbSchemaProviderTypesRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.providertypes.DbSchemaProviderTypesResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.schemata.DbSchemaSchemataRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.schemata.DbSchemaSchemataResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables.DbSchemaSourceTablesRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables.DbSchemaSourceTablesResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.tables.DbSchemaTablesRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.tables.DbSchemaTablesResponseRow; -import org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo.DbSchemaTablesInfoRequest; -import org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo.DbSchemaTablesInfoResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesRequest; -import org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.enumerators.DiscoverEnumeratorsRequest; -import org.eclipse.daanse.xmla.api.discover.discover.enumerators.DiscoverEnumeratorsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.keywords.DiscoverKeywordsRequest; -import org.eclipse.daanse.xmla.api.discover.discover.keywords.DiscoverKeywordsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.literals.DiscoverLiteralsRequest; -import org.eclipse.daanse.xmla.api.discover.discover.literals.DiscoverLiteralsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.properties.DiscoverPropertiesRequest; -import org.eclipse.daanse.xmla.api.discover.discover.properties.DiscoverPropertiesResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.schemarowsets.DiscoverSchemaRowsetsRequest; -import org.eclipse.daanse.xmla.api.discover.discover.schemarowsets.DiscoverSchemaRowsetsResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRequest; -import org.eclipse.daanse.xmla.api.discover.discover.csdlmetadata.DiscoverCsdlMetaDataResponseRow; -import org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata.DiscoverXmlMetaDataRequest; -import org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata.DiscoverXmlMetaDataResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.actions.MdSchemaActionsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.actions.MdSchemaActionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.cubes.MdSchemaCubesRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.cubes.MdSchemaCubesResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.demensions.MdSchemaDimensionsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.demensions.MdSchemaDimensionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.functions.MdSchemaFunctionsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.functions.MdSchemaFunctionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies.MdSchemaHierarchiesRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies.MdSchemaHierarchiesResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.kpis.MdSchemaKpisRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.kpis.MdSchemaKpisResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.levels.MdSchemaLevelsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.levels.MdSchemaLevelsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups.MdSchemaMeasureGroupsResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.measures.MdSchemaMeasuresRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.measures.MdSchemaMeasuresResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.members.MdSchemaMembersRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.members.MdSchemaMembersResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.properties.MdSchemaPropertiesRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.properties.MdSchemaPropertiesResponseRow; -import org.eclipse.daanse.xmla.api.discover.mdschema.sets.MdSchemaSetsRequest; -import org.eclipse.daanse.xmla.api.discover.mdschema.sets.MdSchemaSetsResponseRow; -import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; -import org.eclipse.daanse.xmla.api.execute.alter.AlterRequest; -import org.eclipse.daanse.xmla.api.execute.alter.AlterResponse; -import org.eclipse.daanse.xmla.api.execute.cancel.CancelRequest; -import org.eclipse.daanse.xmla.api.execute.cancel.CancelResponse; -import org.eclipse.daanse.xmla.api.execute.clearcache.ClearCacheRequest; -import org.eclipse.daanse.xmla.api.execute.clearcache.ClearCacheResponse; -import org.eclipse.daanse.xmla.api.execute.statement.StatementRequest; -import org.eclipse.daanse.xmla.api.execute.statement.StatementResponse; -import org.eclipse.daanse.xmla.api.xmla.BeginSession; -import org.eclipse.daanse.xmla.api.xmla.Command; -import org.eclipse.daanse.xmla.api.xmla.EndSession; import org.eclipse.daanse.xmla.api.xmla.Session; -import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.catalogs.DbSchemaCatalogsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.catalogs.DbSchemaCatalogsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.columns.DbSchemaColumnsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.columns.DbSchemaColumnsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.providertypes.DbSchemaProviderTypesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.providertypes.DbSchemaProviderTypesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.schemata.DbSchemaSchemataRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.schemata.DbSchemaSchemataRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.sourcetables.DbSchemaSourceTablesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.sourcetables.DbSchemaSourceTablesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.tables.DbSchemaTablesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.tables.DbSchemaTablesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.tablesinfo.DbSchemaTablesInfoRequestR; -import org.eclipse.daanse.xmla.model.record.discover.dbschema.tablesinfo.DbSchemaTablesInfoRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.datasources.DiscoverDataSourcesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.datasources.DiscoverDataSourcesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.enumerators.DiscoverEnumeratorsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.enumerators.DiscoverEnumeratorsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.keywords.DiscoverKeywordsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.keywords.DiscoverKeywordsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.literals.DiscoverLiteralsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.literals.DiscoverLiteralsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.properties.DiscoverPropertiesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.properties.DiscoverPropertiesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.schemarowsets.DiscoverSchemaRowsetsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.schemarowsets.DiscoverSchemaRowsetsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.discover.xmlmetadata.DiscoverXmlMetaDataRequestR; -import org.eclipse.daanse.xmla.model.record.discover.discover.xmlmetadata.DiscoverXmlMetaDataRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.actions.MdSchemaActionsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.actions.MdSchemaActionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.cubes.MdSchemaCubesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.cubes.MdSchemaCubesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.demensions.MdSchemaDimensionsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.demensions.MdSchemaDimensionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.functions.MdSchemaFunctionsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.functions.MdSchemaFunctionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.hierarchies.MdSchemaHierarchiesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.hierarchies.MdSchemaHierarchiesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.kpis.MdSchemaKpisRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.kpis.MdSchemaKpisRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.levels.MdSchemaLevelsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.levels.MdSchemaLevelsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measures.MdSchemaMeasuresRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.measures.MdSchemaMeasuresRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.members.MdSchemaMembersRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.members.MdSchemaMembersRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.properties.MdSchemaPropertiesRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.properties.MdSchemaPropertiesRestrictionsR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.sets.MdSchemaSetsRequestR; -import org.eclipse.daanse.xmla.model.record.discover.mdschema.sets.MdSchemaSetsRestrictionsR; -import org.eclipse.daanse.xmla.model.record.execute.alter.AlterRequestR; -import org.eclipse.daanse.xmla.model.record.execute.cancel.CancelRequestR; -import org.eclipse.daanse.xmla.model.record.execute.clearcache.ClearCacheRequestR; -import org.eclipse.daanse.xmla.model.record.execute.statement.StatementRequestR; -import org.eclipse.daanse.xmla.model.record.xmla.AlterR; -import org.eclipse.daanse.xmla.model.record.xmla.CancelR; -import org.eclipse.daanse.xmla.model.record.xmla.ClearCacheR; -import org.eclipse.daanse.xmla.model.record.xmla.StatementR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverDispatcher; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteDispatcher; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.session.SessionDispatcher; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -169,49 +36,26 @@ import jakarta.xml.soap.SOAPEnvelope; import jakarta.xml.soap.SOAPException; import jakarta.xml.soap.SOAPHeader; -import jakarta.xml.soap.SOAPHeaderElement; import jakarta.xml.soap.SOAPMessage; import jakarta.xml.soap.SOAPPart; +/** + * Main adapter for XMLA SOAP requests. Routes requests to appropriate + * dispatchers for Session, Discover and Execute operations. + */ public class XmlaApiAdapter { private static final Logger LOGGER = LoggerFactory.getLogger(XmlaApiAdapter.class); - private XmlaService xmlaService; + private final SessionDispatcher sessionDispatcher; + private final DiscoverDispatcher discoverDispatcher; + private final ExecuteDispatcher executeDispatcher; public XmlaApiAdapter(XmlaService xmlaService) { - this.xmlaService = xmlaService; + this.sessionDispatcher = new SessionDispatcher(xmlaService.session()); + this.discoverDispatcher = new DiscoverDispatcher(xmlaService.discover()); + this.executeDispatcher = new ExecuteDispatcher(xmlaService.execute()); } - private static final String MDSCHEMA_FUNCTIONS = "MDSCHEMA_FUNCTIONS"; - private static final String MDSCHEMA_DIMENSIONS = "MDSCHEMA_DIMENSIONS"; - private static final String MDSCHEMA_CUBES = "MDSCHEMA_CUBES"; - private static final String MDSCHEMA_ACTIONS = "MDSCHEMA_ACTIONS"; - private static final String DBSCHEMA_TABLES = "DBSCHEMA_TABLES"; - private static final String DISCOVER_LITERALS = "DISCOVER_LITERALS"; - private static final String DISCOVER_KEYWORDS = "DISCOVER_KEYWORDS"; - private static final String DISCOVER_ENUMERATORS = "DISCOVER_ENUMERATORS"; - private static final String DISCOVER_SCHEMA_ROWSETS = "DISCOVER_SCHEMA_ROWSETS"; - private static final String DISCOVER_PROPERTIES = "DISCOVER_PROPERTIES"; - private static final String DBSCHEMA_CATALOGS = "DBSCHEMA_CATALOGS"; - private static final String DISCOVER_DATASOURCES = "DISCOVER_DATASOURCES"; - private static final String DISCOVER_XML_METADATA = "DISCOVER_XML_METADATA"; - private static final String DISCOVER_CSDL_METADATA = "DISCOVER_CSDL_METADATA"; - private static final String DBSCHEMA_COLUMNS = "DBSCHEMA_COLUMNS"; - private static final String DBSCHEMA_PROVIDER_TYPES = "DBSCHEMA_PROVIDER_TYPES"; - private static final String DBSCHEMA_SCHEMATA = "DBSCHEMA_SCHEMATA"; - private static final String DBSCHEMA_SOURCE_TABLES = "DBSCHEMA_SOURCE_TABLES"; - private static final String DBSCHEMA_TABLES_INFO = "DBSCHEMA_TABLES_INFO"; - private static final String MDSCHEMA_HIERARCHIES = "MDSCHEMA_HIERARCHIES"; - private static final String MDSCHEMA_LEVELS = "MDSCHEMA_LEVELS"; - private static final String MDSCHEMA_MEASUREGROUP_DIMENSIONS = "MDSCHEMA_MEASUREGROUP_DIMENSIONS"; - private static final String MDSCHEMA_MEASURES = "MDSCHEMA_MEASURES"; - private static final String MDSCHEMA_MEMBERS = "MDSCHEMA_MEMBERS"; - private static final String MDSCHEMA_PROPERTIES = "MDSCHEMA_PROPERTIES"; - private static final String MDSCHEMA_SETS = "MDSCHEMA_SETS"; - private static final String MDSCHEMA_KPIS = "MDSCHEMA_KPIS"; - private static final String MDSCHEMA_MEASUREGROUPS = "MDSCHEMA_MEASUREGROUPS"; - private static final QName QN_SESSION = new QName("urn:schemas-microsoft-com:xml-analysis", "Session"); - public SOAPMessage handleRequest(SOAPMessage messageRequest, Map headers, Principal principal, Function isUserInRoleFunction, String url) { try { @@ -220,48 +64,16 @@ public SOAPMessage handleRequest(SOAPMessage messageRequest, Map SOAPPart soapPartResponse = messageResponse.getSOAPPart(); SOAPEnvelope envelopeResponse = soapPartResponse.getEnvelope(); - // envelopeResponse.addNamespaceDeclaration(Constants.MSXMLA.PREFIX, - // Constants.MSXMLA.NS_URN); - // envelopeResponse.addNamespaceDeclaration(Constants.ROWSET.PREFIX, - // Constants.ROWSET.NS_URN); - // envelopeResponse.addNamespaceDeclaration(Constants.MDDATASET.PREFIX, - // Constants.MDDATASET.NS_URN); - // envelopeResponse.addNamespaceDeclaration(Constants.ENGINE.PREFIX, - // Constants.ENGINE.NS_URN); - // envelopeResponse.addNamespaceDeclaration(Constants.ENGINE200.PREFIX, - // Constants.ENGINE200.NS_URN); - // envelopeResponse.addNamespaceDeclaration(Constants.EMPTY.PREFIX, - // Constants.EMPTY.NS_URN); - // envelopeResponse.addNamespaceDeclaration(Constants.XSI.PREFIX, - // Constants.XSI.NS_URN); + UserRolePrincipal userPrincipal = createUserPrincipal(principal, isUserInRoleFunction); - UserRolePrincipal userPrincipal = new UserRolePrincipal() { + // Process session headers + Optional oSession = sessionDispatcher.processSessionHeaders(messageRequest.getSOAPHeader(), + userPrincipal); - @Override - public String userName() { - if (principal == null) { - return ""; - } - return principal.getName(); - } + // Add session response header + SOAPHeader responseHeader = envelopeResponse.getHeader(); + sessionDispatcher.addSessionResponseHeader(responseHeader, oSession); - @Override - public boolean hasRole(String role) { - if (isUserInRoleFunction == null) { - return false; - } - return isUserInRoleFunction.apply(role); - } - }; - Optional oSession = session(messageRequest.getSOAPHeader(), userPrincipal); - if (oSession.isPresent()) { - SOAPHeader header = envelopeResponse.getHeader(); - SOAPHeaderElement sessionElement = header.addHeaderElement(QN_SESSION); - sessionElement.addAttribute(new QName("SessionId"), oSession.get().sessionId()); - } else { - SOAPHeader header = envelopeResponse.getHeader(); - header.setValue("\n"); - } RequestMetaData metaData = RequestMetaDataUtils.getRequestMetaData(headers, oSession, url); SOAPBody bodyResponse = envelopeResponse.getBody(); handleBody(messageRequest.getSOAPBody(), bodyResponse, metaData, userPrincipal); @@ -272,33 +84,28 @@ public boolean hasRole(String role) { return null; } - private Optional session(SOAPHeader soapRequestHeader, UserRolePrincipal userPrincipal) throws SOAPException { - Optional oSession = Convert.getSession(soapRequestHeader); - if (oSession.isPresent()) { - boolean checked = xmlaService.session().checkSession(oSession.get(), userPrincipal); - if (checked) { - return oSession; - } else { - Optional.empty(); + private UserRolePrincipal createUserPrincipal(Principal principal, Function isUserInRoleFunction) { + return new UserRolePrincipal() { + @Override + public String userName() { + if (principal == null) { + return ""; + } + return principal.getName(); } - } - - Optional beginSession = Convert.getBeginSession(soapRequestHeader); - if (beginSession.isPresent()) { - return xmlaService.session().beginSession(beginSession.get(), userPrincipal); - } - - Optional oEndSession = Convert.getEndSession(soapRequestHeader); - if (oEndSession.isPresent()) { - xmlaService.session().endSession(oEndSession.get(), userPrincipal); - return Optional.empty(); - } - return Optional.empty(); + @Override + public boolean hasRole(String role) { + if (isUserInRoleFunction == null) { + return false; + } + return isUserInRoleFunction.apply(role); + } + }; } - private void handleBody(SOAPBody body, SOAPBody responseBody, RequestMetaData metaData, UserRolePrincipal userPrincipal) - throws SOAPException { + private void handleBody(SOAPBody body, SOAPBody responseBody, RequestMetaData metaData, + UserRolePrincipal userPrincipal) throws SOAPException { SOAPElement node = null; Iterator nodeIterator = body.getChildElements(); @@ -309,483 +116,13 @@ private void handleBody(SOAPBody body, SOAPBody responseBody, RequestMetaData me break; } } - if (node != null) { - printNode(node); - } if (node != null && Constants.MSXMLA.QN_DISCOVER.equals(node.getElementQName())) { - - discover(node, responseBody, metaData); - + discoverDispatcher.dispatch(node, responseBody, metaData); } - if (node != null && Constants.MSXMLA.QN_EXECUTE.equals(node.getElementQName())) { - execute(node, responseBody, metaData, userPrincipal); - } - - } - - private void discover(SOAPElement discover, SOAPBody responseBody, RequestMetaData metaData) throws SOAPException { - - String requestType = null; - PropertiesR properties = null; - SOAPElement restictions = null; - - Iterator nodeIterator = discover.getChildElements(); - while (nodeIterator.hasNext()) { - Node node = nodeIterator.next(); - if (node instanceof SOAPElement element) { - if (requestType == null && Constants.MSXMLA.QN_REQUEST_TYPE.equals(element.getElementQName())) { - requestType = element.getTextContent(); - continue; - } - if (restictions == null && Constants.MSXMLA.QN_RESTRICTIONS.equals(element.getElementQName())) { - restictions = element; - continue; - } - if (properties == null && Constants.MSXMLA.QN_PROPERTIES.equals(element.getElementQName())) { - properties = Convert.propertiestoProperties(element); - } - } - } - - discover(requestType, metaData, properties, restictions, responseBody); - } - - private void execute(SOAPElement discover, SOAPBody responseBody, RequestMetaData metaData, - UserRolePrincipal userPrincipal) throws SOAPException { - - Command command = null; - PropertiesR properties = null; - List parameters = null; - - Iterator nodeIterator = discover.getChildElements(); - while (nodeIterator.hasNext()) { - Node node = nodeIterator.next(); - if (node instanceof SOAPElement element) { - if (properties == null && Constants.MSXMLA.QN_PROPERTIES.equals(element.getElementQName())) { - properties = Convert.propertiestoProperties(element); - } - if (parameters == null && Constants.MSXMLA.QN_PARAMETERS.equals(element.getElementQName())) { - parameters = Convert.parametersToParameters(element); - } - if (command == null && Constants.MSXMLA.QN_COMMAND.equals(element.getElementQName())) { - command = Convert.commandtoCommand(element); - } - } - } - - execute(command, properties, parameters, responseBody, metaData, userPrincipal); - } - - private void printNode(SOAPElement node) { - LOGGER.debug(node.getNamespaceURI()); - LOGGER.debug(node.getBaseURI()); - LOGGER.debug(node.getPrefix()); - LOGGER.debug(node.getNodeName()); - LOGGER.debug(node.getLocalName()); - LOGGER.debug(node.getNodeValue()); - LOGGER.debug(node.getTextContent()); - LOGGER.debug(node.getValue()); - String elementQNameStr = node.getElementQName().toString(); - LOGGER.debug(elementQNameStr); - } - - private void execute(Command command, PropertiesR properties, List parameters, - SOAPBody responseBody, RequestMetaData metaData, UserRolePrincipal userPrincipal) throws SOAPException { - - if (command instanceof StatementR statement) { - handleStatement(metaData, userPrincipal, statement, properties, parameters, responseBody); - } - if (command instanceof AlterR alter) { - handleAlter(metaData, userPrincipal, alter, properties, parameters, responseBody); - } - if (command instanceof ClearCacheR clearCache) { - handleClearCache(metaData, userPrincipal, clearCache, properties, parameters, responseBody); - } - if (command instanceof CancelR cancel) { - handleCancel(metaData, userPrincipal, cancel, properties, parameters, responseBody); - } - } - - private void discover(String requestType, RequestMetaData metaData, - PropertiesR properties, SOAPElement restrictionElement, SOAPBody responseBody) throws SOAPException { - - switch (requestType) { - case MDSCHEMA_FUNCTIONS -> - handleMdSchemaFunctions(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_DIMENSIONS -> - handleMdSchemaDimensions(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_CUBES -> - handleMdSchemaCubes(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_ACTIONS -> - handleMdSchemaActions(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_TABLES -> - handleDbSchemaTables(metaData, properties, restrictionElement, responseBody); - case DISCOVER_LITERALS -> - handleDiscoverLiterals(metaData, properties, restrictionElement, responseBody); - case DISCOVER_KEYWORDS -> - handleDiscoverKeywords(metaData, properties, restrictionElement, responseBody); - case DISCOVER_ENUMERATORS -> - handleDiscoverEnumerators(metaData, properties, restrictionElement, responseBody); - case DISCOVER_SCHEMA_ROWSETS -> - handleDiscoverSchemaRowsets(metaData, properties, restrictionElement, responseBody); - case DISCOVER_PROPERTIES -> - handleDiscoverProperties(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_CATALOGS -> - handleDbSchemaCatalogs(metaData, properties, restrictionElement, responseBody); - case DISCOVER_DATASOURCES -> - handleDiscoverDataSources(metaData, properties, restrictionElement, responseBody); - case DISCOVER_XML_METADATA -> - handleDiscoverXmlMetaData(metaData, properties, restrictionElement, responseBody); - case DISCOVER_CSDL_METADATA -> - handleDiscoverCsdlMetaData(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_COLUMNS -> - handleDbSchemaColumns(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_PROVIDER_TYPES -> - handleDbSchemaProviderTypes(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_SCHEMATA -> - handleDbSchemaSchemata(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_SOURCE_TABLES -> - handleDbSchemaSourceTables(metaData, properties, restrictionElement, responseBody); - case DBSCHEMA_TABLES_INFO -> - handleDbSchemaTablesInfo(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_HIERARCHIES -> - handleMdSchemaHierarchies(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_LEVELS -> - handleMdSchemaLevels(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_MEASUREGROUP_DIMENSIONS -> - handleMdSchemaMeasureGroupDimensions(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_MEASURES -> - handleMdSchemaMeasures(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_MEMBERS -> - handleMdSchemaMembers(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_PROPERTIES -> - handleMdSchemaProperties(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_SETS -> handleMdSchemaSets(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_KPIS -> handleMdSchemaKpis(metaData, properties, restrictionElement, responseBody); - case MDSCHEMA_MEASUREGROUPS -> - handleMdSchemaMeasureGroups(metaData, properties, restrictionElement, responseBody); - default -> throw new IllegalArgumentException("Unexpected value: " + requestType); + if (node != null && Constants.MSXMLA.QN_EXECUTE.equals(node.getElementQName())) { + executeDispatcher.dispatch(node, responseBody, metaData, userPrincipal); } } - - private void handleMdSchemaMeasureGroups(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaMeasureGroupsRestrictionsR restrictionsR = Convert.discoverMdSchemaMeasureGroups(restrictionElement); - MdSchemaMeasureGroupsRequest request = new MdSchemaMeasureGroupsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaMeasureGroups(request, metaData); - - SoapUtil.toMdSchemaMeasureGroups(rows, body); - } - - private void handleMdSchemaKpis(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaKpisRestrictionsR restrictionsR = Convert.discoverMdSchemaKpisRestrictions(restrictionElement); - MdSchemaKpisRequest request = new MdSchemaKpisRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaKpis(request, metaData); - - SoapUtil.toMdSchemaKpis(rows, body); - } - - private void handleMdSchemaSets(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaSetsRestrictionsR restrictionsR = Convert.discoverMdSchemaSetsRestrictions(restrictionElement); - MdSchemaSetsRequest request = new MdSchemaSetsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaSets(request, metaData); - - SoapUtil.toMdSchemaSets(rows, body); - } - - private void handleMdSchemaProperties(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaPropertiesRestrictionsR restrictionsR = Convert - .discoverMdSchemaPropertiesRestrictions(restrictionElement); - MdSchemaPropertiesRequest request = new MdSchemaPropertiesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaProperties(request, metaData); - - SoapUtil.toMdSchemaProperties(rows, body); - - } - - private void handleMdSchemaMembers(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaMembersRestrictionsR restrictionsR = Convert.discoverMdSchemaMembersRestrictions(restrictionElement); - MdSchemaMembersRequest request = new MdSchemaMembersRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaMembers(request, metaData); - - SoapUtil.toMdSchemaMembers(rows, body); - - } - - private void handleMdSchemaMeasures(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaMeasuresRestrictionsR restrictionsR = Convert.discoverMdSchemaMeasuresRestrictions(restrictionElement); - MdSchemaMeasuresRequest request = new MdSchemaMeasuresRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaMeasures(request, metaData); - - SoapUtil.toMdSchemaMeasures(rows, body); - - } - - private void handleMdSchemaMeasureGroupDimensions(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaMeasureGroupDimensionsRestrictionsR restrictionsR = Convert - .discoverMdSchemaMeasureGroupDimensionsRestrictions(restrictionElement); - MdSchemaMeasureGroupDimensionsRequest request = new MdSchemaMeasureGroupDimensionsRequestR(propertiesR, - restrictionsR); - List rows = xmlaService.discover() - .mdSchemaMeasureGroupDimensions(request, metaData); - - SoapUtil.toMdSchemaMeasureGroupDimensions(rows, body); - - } - - private void handleMdSchemaLevels(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaLevelsRestrictionsR restrictionsR = Convert.discoverMdSchemaLevelsRestrictions(restrictionElement); - MdSchemaLevelsRequest request = new MdSchemaLevelsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaLevels(request, metaData); - - SoapUtil.toMdSchemaLevels(rows, body); - } - - private void handleMdSchemaHierarchies(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaHierarchiesRestrictionsR restrictionsR = Convert - .discoverMdSchemaHierarchiesRestrictions(restrictionElement); - MdSchemaHierarchiesRequest request = new MdSchemaHierarchiesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaHierarchies(request, metaData); - - SoapUtil.toMdSchemaHierarchies(rows, body); - } - - private void handleDbSchemaTablesInfo(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaTablesInfoRestrictionsR restrictionsR = Convert.discoverDbSchemaTablesInfo(restrictionElement); - DbSchemaTablesInfoRequest request = new DbSchemaTablesInfoRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaTablesInfo(request, metaData); - - SoapUtil.toDbSchemaTablesInfo(rows, body); - - } - - private void handleDbSchemaSourceTables(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaSourceTablesRestrictionsR restrictionsR = Convert - .discoverDbSchemaSourceTablesRestrictions(restrictionElement); - DbSchemaSourceTablesRequest request = new DbSchemaSourceTablesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaSourceTables(request, metaData); - - SoapUtil.toDbSchemaSourceTables(rows, body); - - } - - private void handleDbSchemaSchemata(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaSchemataRestrictionsR restrictionsR = Convert.discoverDbSchemaSchemataRestrictions(restrictionElement); - DbSchemaSchemataRequest request = new DbSchemaSchemataRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaSchemata(request, metaData); - - SoapUtil.toDbSchemaSchemata(rows, body); - - } - - private void handleDbSchemaProviderTypes(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaProviderTypesRestrictionsR restrictionsR = Convert - .discoverDbSchemaProviderTypesRestrictions(restrictionElement); - DbSchemaProviderTypesRequest request = new DbSchemaProviderTypesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaProviderTypes(request, metaData); - - SoapUtil.toDbSchemaProviderTypes(rows, body); - - } - - private void handleDbSchemaColumns(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaColumnsRestrictionsR restrictionsR = Convert.discoverDbSchemaColumnsRestrictions(restrictionElement); - DbSchemaColumnsRequest request = new DbSchemaColumnsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaColumns(request, metaData); - - SoapUtil.toDbSchemaColumns(rows, body); - - } - - private void handleDiscoverXmlMetaData(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverXmlMetaDataRestrictionsR restrictionsR = Convert - .discoverDiscoverXmlMetaDataRestrictions(restrictionElement); - DiscoverXmlMetaDataRequest request = new DiscoverXmlMetaDataRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().xmlMetaData(request, metaData); - - SoapUtil.toDiscoverXmlMetaData(rows, body); - - } - - private void handleDiscoverCsdlMetaData(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverCsdlMetaDataRestrictionsR restrictionsR = Convert - .discoverDiscoverCsdlMetaDataRestrictions(restrictionElement); - DiscoverCsdlMetaDataRequest request = new DiscoverCsdlMetaDataRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().csdlMetaData(request, metaData); - - SoapUtil.toDiscoverCsdlMetaData(rows, body); - - } - - private void handleDiscoverDataSources(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverDataSourcesRestrictionsR restrictionsR = Convert - .discoverDiscoverDataSourcesRestrictions(restrictionElement); - DiscoverDataSourcesRequest request = new DiscoverDataSourcesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dataSources(request, metaData); - - SoapUtil.toDiscoverDataSources(rows, body); - - } - - private void handleDbSchemaCatalogs(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaCatalogsRestrictionsR restrictionsR = Convert.discoverDbSchemaCatalogsRestrictions(restrictionElement); - DbSchemaCatalogsRequest request = new DbSchemaCatalogsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaCatalogs(request, metaData); - - SoapUtil.toDbSchemaCatalogs(rows, body); - - } - - private void handleDiscoverSchemaRowsets(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverSchemaRowsetsRestrictionsR restrictionsR = Convert - .discoverSchemaRowsetsRestrictions(restrictionElement); - DiscoverSchemaRowsetsRequest request = new DiscoverSchemaRowsetsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().discoverSchemaRowsets(request, metaData); - - SoapUtil.toDiscoverSchemaRowsets(rows, body); - - } - - private void handleDiscoverEnumerators(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverEnumeratorsRestrictionsR restrictionsR = Convert.discoverDiscoverEnumerators(restrictionElement); - DiscoverEnumeratorsRequest request = new DiscoverEnumeratorsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().discoverEnumerators(request, metaData); - - SoapUtil.toDiscoverEnumerators(rows, body); - - } - - private void handleDiscoverKeywords(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverKeywordsRestrictionsR restrictionsR = Convert.discoverKeywordsRestrictions(restrictionElement); - DiscoverKeywordsRequest request = new DiscoverKeywordsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().discoverKeywords(request, metaData); - - SoapUtil.toDiscoverKeywords(rows, body); - - } - - private void handleDiscoverLiterals(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DiscoverLiteralsRestrictionsR restrictionsR = Convert.discoverLiteralsRestrictions(restrictionElement); - DiscoverLiteralsRequest request = new DiscoverLiteralsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().discoverLiterals(request, metaData); - - SoapUtil.toDiscoverLiterals(rows, body); - - } - - private void handleDbSchemaTables(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - DbSchemaTablesRestrictionsR restrictionsR = Convert.discoverDbSchemaTablesRestrictions(restrictionElement); - DbSchemaTablesRequest request = new DbSchemaTablesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().dbSchemaTables(request, metaData); - - SoapUtil.toDbSchemaTables(rows, body); - - } - - private void handleMdSchemaActions(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaActionsRestrictionsR restrictionsR = Convert.discoverMdSchemaActionsRestrictions(restrictionElement); - MdSchemaActionsRequest request = new MdSchemaActionsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaActions(request, metaData); - - SoapUtil.toMdSchemaActions(rows, body); - } - - private void handleMdSchemaCubes(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaCubesRestrictionsR restrictionsR = Convert.discoverMdSchemaCubesRestrictions(restrictionElement); - MdSchemaCubesRequest request = new MdSchemaCubesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaCubes(request, metaData); - - SoapUtil.toMdSchemaCubes(rows, body); - } - - private void handleMdSchemaDimensions(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - MdSchemaDimensionsRestrictionsR restrictionsR = Convert - .discoverMdSchemaDimensionsRestrictions(restrictionElement); - MdSchemaDimensionsRequest request = new MdSchemaDimensionsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaDimensions(request, metaData); - - SoapUtil.toMdSchemaDimensions(rows, body); - } - - private void handleDiscoverProperties(RequestMetaData metaData, - PropertiesR propertiesR, SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - - DiscoverPropertiesRestrictionsR restrictionsR = Convert.discoverPropertiesRestrictions(restrictionElement); - DiscoverPropertiesRequest request = new DiscoverPropertiesRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().discoverProperties(request, metaData); - - SoapUtil.toDiscoverProperties(rows, body); - } - - private void handleMdSchemaFunctions(RequestMetaData metaData, PropertiesR propertiesR, - SOAPElement restrictionElement, SOAPBody body) throws SOAPException { - - MdSchemaFunctionsRestrictionsR restrictionsR = Convert - .discoverMdSchemaFunctionsRestrictions(restrictionElement); - MdSchemaFunctionsRequest request = new MdSchemaFunctionsRequestR(propertiesR, restrictionsR); - List rows = xmlaService.discover().mdSchemaFunctions(request, metaData); - - SoapUtil.toMdSchemaFunctions(rows, body); - } - - private void handleStatement(RequestMetaData metaData, UserRolePrincipal userPrincipal, StatementR statement, - PropertiesR properties, List parameters, SOAPBody responseBody) throws SOAPException { - String sessionId = metaData != null && metaData.sessionId() != null && metaData.sessionId().isPresent() - ? metaData.sessionId().get() - : null; - StatementRequest statementRequest = new StatementRequestR(properties, parameters, statement, sessionId); - StatementResponse statementResponse = xmlaService.execute().statement(statementRequest, metaData, - userPrincipal); - SoapUtil.toStatementResponse(statementResponse, responseBody); - } - - private void handleAlter(RequestMetaData metaData, UserRolePrincipal userPrincipal, AlterR alter, - PropertiesR properties, List parameters, SOAPBody responseBody) throws SOAPException { - AlterRequest alterRequest = new AlterRequestR(properties, parameters, alter); - AlterResponse alterResponse = xmlaService.execute().alter(alterRequest, metaData, userPrincipal); - SoapUtil.toAlterResponse(alterResponse, responseBody); - } - - private void handleClearCache(RequestMetaData metaData, UserRolePrincipal userPrincipal, ClearCacheR clearCache, - PropertiesR properties, List parameters, SOAPBody responseBody) throws SOAPException { - ClearCacheRequest clearCacheRequest = new ClearCacheRequestR(properties, parameters, clearCache); - ClearCacheResponse clearCacheResponse = xmlaService.execute().clearCache(clearCacheRequest, metaData, - userPrincipal); - SoapUtil.toClearCacheResponse(clearCacheResponse, responseBody); - } - - private void handleCancel(RequestMetaData metaData, UserRolePrincipal userPrincipal, CancelR cancel, - PropertiesR properties, List parameters, SOAPBody responseBody) throws SOAPException { - CancelRequest cancelRequest = new CancelRequestR(properties, parameters, cancel); - CancelResponse cancelResponse = xmlaService.execute().cancel(cancelRequest, metaData, userPrincipal); - SoapUtil.toCancelResponse(cancelResponse, responseBody); - } - } diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaElementConstants.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaElementConstants.java new file mode 100644 index 0000000..7b2d5e2 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaElementConstants.java @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +/** + * XMLA element name constants used in XML parsing. Contains string constants + * for element names in XMLA requests and responses. + */ +public interface XmlaElementConstants { + + String STATEMENT = "Statement"; + String ALTER = "Alter"; + String CANCEL = "Cancel"; + String CLEAR_CACHE = "ClearCache"; + String COMMAND = "Command"; + + String SERVER_ID = "ServerID"; + String DATABASE_ID = "DatabaseID"; + String CUBE_ID = "CubeID"; + String DIMENSION_ID = "DimensionID"; + String MEASURE_GROUP_ID = "MeasureGroupID"; + String PARTITION_ID = "PartitionID"; + String MINING_STRUCTURE_ID = "MiningStructureID"; + String MINING_MODEL_ID = "MiningModelID"; + String ROLE_ID = "RoleID"; + String TRACE_ID = "TraceID"; + String ASSEMBLY_ID = "AssemblyID"; + String DATA_SOURCE_ID = "DataSourceID"; + String DATA_SOURCE_VIEW_ID = "DataSourceViewID"; + String DATA_SOURCE_PERMISSION_ID = "DataSourcePermissionID"; + String DATABASE_PERMISSION_ID = "DatabasePermissionID"; + String DIMENSION_PERMISSION_ID = "DimensionPermissionID"; + String CUBE_PERMISSION_ID = "CubePermissionID"; + String MINING_MODEL_PERMISSION_ID = "MiningModelPermissionID"; + String MINING_STRUCTURE_PERMISSION_ID = "MiningStructurePermissionID"; + String MDX_SCRIPT_ID = "MdxScriptID"; + String PERSPECTIVE_ID = "PerspectiveID"; + String AGGREGATION_DESIGN_ID = "AggregationDesignID"; + + String CONNECTION_ID = "ConnectionID"; + String SESSION_ID = "SessionID"; + String SPID = "SPID"; + String CANCEL_ASSOCIATED = "CancelAssociated"; + + String OBJECT_DEFINITION = "ObjectDefinition"; + String ALLOW_CREATE = "AllowCreate"; + String OBJECT_EXPANSION = "ObjectExpansion"; + + String ID = "ID"; + String NAME = "Name"; + String DESCRIPTION = "Description"; + String CAPTION = "Caption"; + String LANGUAGE = "Language"; + String COLLATION = "Collation"; + String VALUE = "Value"; + String VISIBLE = "Visible"; + String STATE = "State"; + String SOURCE = "Source"; + String TARGET = "Target"; + String TARGET_TYPE = "TargetType"; + String EXPRESSION = "Expression"; + String ORDINAL = "Ordinal"; + String TYPE = "TYPE"; + String VERSION = "VERSION"; + String WRITE = "Write"; + + String DIMENSION = "Dimension"; + String DIMENSIONS = "Dimensions"; + String CUBE_DIMENSION_ID = "CubeDimensionID"; + String HIERARCHY = "Hierarchy"; + String HIERARCHIES = "Hierarchies"; + String ATTRIBUTE = "Attribute"; + String ATTRIBUTES = "Attributes"; + String ATTRIBUTE_ID = "AttributeID"; + String MEASURE = "Measure"; + String MEASURES = "Measures"; + String MEASURE_ID = "MeasureID"; + String MEASURE_GROUP = "MeasureGroup"; + String ACTION = "Action"; + + String PROCESS = "Process"; + String PROCESSING_MODE = "ProcessingMode"; + String PROCESSING_PRIORITY = "ProcessingPriority"; + String PROCESSING_STATE = "ProcessingState"; + + String STORAGE_MODE = "StorageMode"; + String STORAGE_LOCATION = "StorageLocation"; + String PROACTIVE_CACHING = "ProactiveCaching"; + + String CREATED_TIMESTAMP = "CreatedTimestamp"; + String LAST_SCHEMA_UPDATE = "LastSchemaUpdate"; + String LAST_PROCESSED = "LastProcessed"; + String ESTIMATED_ROWS = "EstimatedRows"; + String ESTIMATED_SIZE = "EstimatedSize"; + String ANNOTATIONS = "Annotations"; + String TRANSLATIONS = "Translations"; + String TRANSLATION = "Translation"; + + String DISPLAY_FOLDER = "DisplayFolder"; + String FOLDER_POSITION = "FolderPosition"; + String DEFAULT_DETAILS_POSITION = "DefaultDetailsPosition"; + String SORT_PROPERTIES_POSITION = "SortPropertiesPosition"; + String VISUALIZATION_PROPERTIES = "VisualizationProperties"; + + String KEY_COLUMNS = "KeyColumns"; + String KEY_COLUMN = "KeyColumn"; + String COLUMNS = "Columns"; + + String TABLE_ID = "TableID"; + String TABLE_CATALOG = "TABLE_CATALOG"; + String TABLE_SCHEMA = "TABLE_SCHEMA"; + String TABLE_NAME = "TABLE_NAME"; + String TABLE_TYPE = "TABLE_TYPE"; + + String DATA_SOURCE_NAME = "DataSourceName"; + String DATA_SOURCE_DESCRIPTION = "DataSourceDescription"; + String DATA_SOURCE_INFO = "DataSourceInfo"; + String URL = "URL"; + String PROVIDER_NAME = "ProviderName"; + String PROVIDER_TYPE = "ProviderType"; + String AUTHENTICATION_MODE = "AuthenticationMode"; + + String FILTER = "Filter"; + String CONDITION = "Condition"; + String EQUAL = "Equal"; + String NOT_EQUAL = "NotEqual"; + String LESS_OR_EQUAL = "LessOrEqual"; + String GREATER_OR_EQUAL = "GreaterOrEqual"; + String GREATER = "Greater"; + String NOT_LIKE = "NotLike"; + + String AGGREGATION_PREFIX = "AggregationPrefix"; + String ALLOW_DRILL_THROUGH = "AllowDrillThrough"; + + String RESTRICTION_LIST = "RestrictionList"; + String REFRESH_INTERVAL = "RefreshInterval"; + String READ_DEFINITION = "ReadDefinition"; + String DEFAULT_MEMBER = "DefaultMember"; + String CONTEXTUAL_NAME_RULE = "ContextualNameRule"; + String CAPTION_IS_MDX = "CaptionIsMdx"; + String ATTRIBUTE_HIERARCHY_VISIBLE = "AttributeHierarchyVisible"; + String APPLICATION = "Application"; + String ERROR_CONFIGURATION = "ErrorConfiguration"; + String INVOCATION_LOW = "Invocation"; + String XSI_TYPE = "xsi:type"; + String VALUENS = "valuens"; + String EVENT_ID = "EventID"; + + String CATALOG_NAME = "CATALOG_NAME"; + String SCHEMA_NAME_LOW = "SchemaName"; + String SCHEMA_OWNER = "SCHEMA_OWNER"; + String CUBE_SOURCE = "CUBE_SOURCE"; + String CUBE_TYPE = "CUBE_TYPE"; + String BASE_CUBE_NAME = "BASE_CUBE_NAME"; + String DIMENSION_NAME = "DIMENSION_NAME"; + String DIMENSION_UNIQUE_NAME = "DIMENSION_UNIQUE_NAME"; + String DIMENSION_VISIBILITY = "DIMENSION_VISIBILITY"; + String HIERARCHY_NAME = "HIERARCHY_NAME"; + String HIERARCHY_UNIQUE_NAME = "HIERARCHY_UNIQUE_NAME"; + String HIERARCHY_ORIGIN = "HIERARCHY_ORIGIN"; + String HIERARCHY_VISIBILITY = "HIERARCHY_VISIBILITY"; + String LEVEL_NAME = "LEVEL_NAME"; + String LEVEL_UNIQUE_NAME = "LEVEL_UNIQUE_NAME"; + String LEVEL_NUMBER = "LEVEL_NUMBER"; + String MEASURE_NAME = "MEASURE_NAME"; + String MEASURE_UNIQUE_NAME = "MEASURE_UNIQUE_NAME"; + String MEASURE_VISIBILITY = "MEASURE_VISIBILITY"; + String MEASUREGROUP_NAME = "MEASUREGROUP_NAME"; + String MEMBER_NAME = "MEMBER_NAME"; + String MEMBER_UNIQUE_NAME = "MEMBER_UNIQUE_NAME"; + String MEMBER_TYPE = "MEMBER_TYPE"; + String MEMBER_CAPTION = "MEMBER_CAPTION"; + String TREE_OP = "TREE_OP"; + String PROPERTY_NAME = "PropertyName"; + String PROPERTY_NAME2 = "PROPERTY_NAME"; + String PROPERTY_TYPE = "PROPERTY_TYPE"; + String PROPERTY_CONTENT_TYPE = "PROPERTY_CONTENT_TYPE"; + String PROPERTY_ORIGIN = "PROPERTY_ORIGIN"; + String PROPERTY_VISIBILITY = "PROPERTY_VISIBILITY"; + String SET_NAME = "SET_NAME"; + String SET_CAPTION = "SET_CAPTION"; + String SCOPE = "SCOPE"; + String KPI_NAME = "KPI_NAME"; + String ACTION_NAME = "ACTION_NAME"; + String ACTION_TYPE = "ACTION_TYPE"; + String COORDINATE = "COORDINATE"; + String COORDINATE_TYPE = "COORDINATE_TYPE"; + String INVOCATION = "INVOCATION"; + String FUNCTION_NAME = "FUNCTION_NAME"; + String ORIGIN = "ORIGIN"; + String INTERFACE_NAME = "INTERFACE_NAME"; + String LIBRARY_NAME = "LIBRARY_NAME"; + String ENUM_NAME = "EnumName"; + String KEYWORD = "Keyword"; + String LITERAL_NAME = "LiteralName"; + String PERSPECTIVE_NAME = "PERSPECTIVE_NAME"; + String DATA_TYPE = "DATA_TYPE"; + String BEST_MATCH = "BEST_MATCH"; + String COLUMN_NAME = "COLUMN_NAME"; + String COLUMN_OLAP_TYPE = "COLUMN_OLAP_TYPE"; + String OBJECT_TYPE = "ObjectType"; + + String OBJECT2 = "Object"; + String SCOPE2 = "Scope"; + String ROLE2 = "Role"; + String ASSEMBLY2 = "Assembly"; + String CUBE2 = "Cube"; +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaMethodObjects.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaMethodObjects.java deleted file mode 100644 index 4212ed4..0000000 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaMethodObjects.java +++ /dev/null @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2023 Contributors to the Eclipse Foundation. -* -* This program and the accompanying materials are made -* available under the terms of the Eclipse Public License 2.0 -* which is available at https://www.eclipse.org/legal/epl-2.0/ -* -* SPDX-License-Identifier: EPL-2.0 -* -* Contributors: -* SmartCity Jena - initial -*/ -package org.eclipse.daanse.xmla.server.adapter.soapmessage; - -import javax.xml.namespace.QName; - -import jakarta.xml.soap.SOAPElement; - -public enum XmlaMethodObjects { - DISCOVER(new QName("urn:schemas-microsoft-com:xml-analysis", "Discover")); - - private QName qName; - - private XmlaMethodObjects(QName qName) { - - this.qName = qName; - } - - boolean matches(SOAPElement element) { - return qName.equals(element.getElementQName()); - - } - -} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaParseException.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaParseException.java new file mode 100644 index 0000000..8176236 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaParseException.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +/** + * Exception thrown when XMLA message parsing fails. Used for invalid commands, + * unsupported request types, or malformed XML content. + */ +public class XmlaParseException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public XmlaParseException(String message) { + super(message); + } + + public XmlaParseException(String message, Throwable cause) { + super(message, cause); + } + + public XmlaParseException(Throwable cause) { + super(cause); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaSoapException.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaSoapException.java new file mode 100644 index 0000000..eaf2060 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlaSoapException.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +/** + * Exception thrown when SOAP message operations fail. Typically wraps + * {@link jakarta.xml.soap.SOAPException} to provide unchecked exception + * handling for SOAP-related errors. + */ +public class XmlaSoapException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public XmlaSoapException(String message) { + super(message); + } + + public XmlaSoapException(String message, Throwable cause) { + super(message, cause); + } + + public XmlaSoapException(Throwable cause) { + super(cause); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaCatalogsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaCatalogsHandler.java new file mode 100644 index 0000000..1f4021a --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaCatalogsHandler.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.catalogs.DbSchemaCatalogsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.catalogs.DbSchemaCatalogsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.catalogs.DbSchemaCatalogsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaCatalogsHandler implements DiscoverHandler { + + private static final String CATALOG_NAME = "CATALOG_NAME"; + + private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") + .withZone(ZoneId.systemDefault()); + + private final DiscoverService discoverService; + + public DbSchemaCatalogsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaCatalogsRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaCatalogsRequest request = new DbSchemaCatalogsRequestR(properties, restrictions); + List rows = discoverService.dbSchemaCatalogs(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaCatalogsRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaCatalogsRestrictionsR(Optional.ofNullable(m.get(CATALOG_NAME))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaCatalogsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement ct1 = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct1.setAttribute("name", "row"); + SOAPElement s1 = SoapUtil.addChildElement(ct1, Constants.XSD.QN_SEQUENCE); + SOAPElement s1e1 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e1.setAttribute("sql:field", "CATALOG_NAME"); + s1e1.setAttribute("name", "CATALOG_NAME"); + s1e1.setAttribute("type", "xsd:string"); + + SOAPElement s1e2 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e2.setAttribute("sql:field", "DESCRIPTION"); + s1e2.setAttribute("name", "DESCRIPTION"); + s1e2.setAttribute("type", "xsd:string"); + s1e2.setAttribute("minOccurs", "0"); + + SOAPElement s1e3 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e3.setAttribute("sql:field", "ROLES"); + s1e3.setAttribute("name", "ROLES"); + s1e3.setAttribute("type", "xsd:string"); + + SOAPElement s1e4 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e4.setAttribute("sql:field", "DATE_MODIFIED"); + s1e4.setAttribute("name", "DATE_MODIFIED"); + s1e4.setAttribute("type", "xsd:dateTime"); + s1e4.setAttribute("minOccurs", "0"); + return seRoot; + } + + @SuppressWarnings("deprecation") + private void addResponseRow(SOAPElement root, DbSchemaCatalogsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.roles().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ROLES, v)); + r.dateModified().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATE_MODIFIED, v.format(formatter))); + r.compatibilityLevel() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COMPATIBILITY_LEVEL, String.valueOf(v))); + r.type().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TYPE, String.valueOf(v.getValue()))); + r.version().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_VERSION, String.valueOf(v))); + r.databaseId().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATABASE_ID, v)); + r.dateQueried().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATE_QUERIED, v.format(formatter))); + r.currentlyUsed().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CURRENTLY_USED, String.valueOf(v))); + r.popularity().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_POPULARITY, String.valueOf(v))); + r.weightedPopularity() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_WEIGHTEDPOPULARITY, String.valueOf(v))); + r.clientCacheRefreshPolicy().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_CLIENTCACHEREFRESHPOLICY, String.valueOf(v.getValue()))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaColumnsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaColumnsHandler.java new file mode 100644 index 0000000..b0f7cfc --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaColumnsHandler.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.ColumnOlapTypeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.columns.DbSchemaColumnsRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.columns.DbSchemaColumnsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.columns.DbSchemaColumnsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.columns.DbSchemaColumnsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaColumnsHandler implements DiscoverHandler { + + private static final String TABLE_CATALOG = "TABLE_CATALOG"; + private static final String TABLE_SCHEMA = "TABLE_SCHEMA"; + private static final String TABLE_NAME = "TABLE_NAME"; + private static final String COLUMN_NAME = "COLUMN_NAME"; + private static final String COLUMN_OLAP_TYPE = "COLUMN_OLAP_TYPE"; + + private final DiscoverService discoverService; + + public DbSchemaColumnsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaColumnsRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaColumnsRequest request = new DbSchemaColumnsRequestR(properties, restrictions); + List rows = discoverService.dbSchemaColumns(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaColumnsRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaColumnsRestrictionsR(Optional.ofNullable(m.get(TABLE_CATALOG)), + Optional.ofNullable(m.get(TABLE_SCHEMA)), Optional.ofNullable(m.get(TABLE_NAME)), + Optional.ofNullable(m.get(COLUMN_NAME)), + Optional.ofNullable(ColumnOlapTypeEnum.fromValue(m.get(COLUMN_OLAP_TYPE)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaColumnsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "TABLE_CATALOG", "xsd:string", null); + SoapUtil.addElement(s, "TABLE_SCHEMA", "xsd:string", "0"); + SoapUtil.addElement(s, "TABLE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "COLUMN_NAME", "xsd:string", null); + SoapUtil.addElement(s, "ORDINAL_POSITION", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "COLUMN_HAS_DEFAULT", "xsd:boolean", "0"); + SoapUtil.addElement(s, "COLUMN_FLAGS", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "IS_NULLABLE", "xsd:boolean", null); + SoapUtil.addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); + SoapUtil.addElement(s, "CHARACTER_MAXIMUM_LENGTH", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "CHARACTER_OCTET_LENGTH", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "NUMERIC_PRECISION", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "NUMERIC_SCALE", "xsd:short", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DbSchemaColumnsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.tableCatalog().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_CATALOG, v)); + r.tableSchema().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_SCHEMA, v)); + r.tableName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_NAME, v)); + r.columnName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_NAME, v)); + r.columnGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_GUID, String.valueOf(v))); + r.columnPropId().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_PROPID, String.valueOf(v))); + r.ordinalPosition().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ORDINAL_POSITION, String.valueOf(v))); + r.columnHasDefault() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_HAS_DEFAULT, String.valueOf(v))); + r.columnDefault().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_DEFAULT, v)); + r.columnFlags().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_FLAG, String.valueOf(v.getValue()))); + r.isNullable().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_NULLABLE, String.valueOf(v))); + r.dataType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_TYPE, String.valueOf(v))); + r.typeGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TYPE_GUID, String.valueOf(v))); + r.characterMaximum() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CHARACTER_MAXIMUM_LENGTH, String.valueOf(v))); + r.characterOctetLength() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CHARACTER_OCTET_LENGTH, String.valueOf(v))); + r.numericPrecision().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_NUMERIC_PRECISION, String.valueOf(v))); + r.numericScale().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_NUMERIC_SCALE, String.valueOf(v))); + r.dateTimePrecision() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATETIME_PRECISION, String.valueOf(v))); + r.characterSetCatalog().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CHARACTER_SET_CATALOG, v)); + r.characterSetSchema().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CHARACTER_SET_SCHEMA, v)); + r.characterSetName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CHARACTER_SET_NAME, v)); + r.collationCatalog().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLLATION_CATALOG, v)); + r.collationSchema().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLLATION_SCHEMA, v)); + r.collationName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLLATION_NAME, v)); + r.domainCatalog().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DOMAIN_CATALOG, v)); + r.domainSchema().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DOMAIN_SCHEMA, v)); + r.domainName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DOMAIN_NAME, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.columnOlapType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_OLAP_TYPE, v.name())); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaProviderTypesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaProviderTypesHandler.java new file mode 100644 index 0000000..db7f70a --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaProviderTypesHandler.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.LevelDbTypeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.providertypes.DbSchemaProviderTypesRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.providertypes.DbSchemaProviderTypesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.providertypes.DbSchemaProviderTypesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.providertypes.DbSchemaProviderTypesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaProviderTypesHandler implements DiscoverHandler { + + private static final String DATA_TYPE = "DATA_TYPE"; + private static final String BEST_MATCH = "BEST_MATCH"; + + private final DiscoverService discoverService; + + public DbSchemaProviderTypesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaProviderTypesRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaProviderTypesRequest request = new DbSchemaProviderTypesRequestR(properties, restrictions); + List rows = discoverService.dbSchemaProviderTypes(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaProviderTypesRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaProviderTypesRestrictionsR(Optional.ofNullable(LevelDbTypeEnum.fromValue(m.get(DATA_TYPE))), + Optional.ofNullable(Boolean.valueOf(m.get(BEST_MATCH)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaProviderTypesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "TYPE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); + SoapUtil.addElement(s, "COLUMN_SIZE", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "LITERAL_PREFIX", "xsd:string", "0"); + SoapUtil.addElement(s, "LITERAL_SUFFIX", "xsd:string", "0"); + SoapUtil.addElement(s, "IS_NULLABLE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "CASE_SENSITIVE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "SEARCHABLE", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "UNSIGNED_ATTRIBUTE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "FIXED_PREC_SCALE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "AUTO_UNIQUE_VALUE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "IS_LONG", "xsd:boolean", "0"); + SoapUtil.addElement(s, "BEST_MATCH", "xsd:boolean", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DbSchemaProviderTypesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.typeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TYPE_NAME, v)); + r.dataType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_TYPE, String.valueOf(v.getValue()))); + r.columnSize().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_COLUMN_SIZE, String.valueOf(v))); + r.literalPrefix().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LITERAL_PREFIX, v)); + r.literalSuffix().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LITERAL_SUFFIX, v)); + r.createParams().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CREATE_PARAMS, v)); + r.isNullable().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_NULLABLE, String.valueOf(v))); + r.caseSensitive().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CASE_SENSITIVE, String.valueOf(v))); + r.searchable().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SEARCHABLE, String.valueOf(v.getValue()))); + r.unsignedAttribute() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_UNSIGNED_ATTRIBUTE, String.valueOf(v))); + r.fixedPrecScale().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_FIXED_PREC_SCALE, String.valueOf(v))); + r.autoUniqueValue().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_AUTO_UNIQUE_VALUE, String.valueOf(v))); + r.localTypeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LOCAL_TYPE_NAME, v)); + r.minimumScale().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MINIMUM_SCALE, String.valueOf(v))); + r.maximumScale().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MAXIMUM_SCALE, String.valueOf(v))); + r.guid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_GUID, String.valueOf(v))); + r.typeLib().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TYPE_LIB, v)); + r.version().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_VERSION, v)); + r.isLong().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_LONG, String.valueOf(v))); + r.bestMatch().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BEST_MATCH, String.valueOf(v))); + r.isFixedLength().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_FIXEDLENGTH, String.valueOf(v))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaSchemataHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaSchemataHandler.java new file mode 100644 index 0000000..3b7a234 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaSchemataHandler.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.schemata.DbSchemaSchemataRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.schemata.DbSchemaSchemataResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.schemata.DbSchemaSchemataRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.schemata.DbSchemaSchemataRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaSchemataHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public DbSchemaSchemataHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaSchemataRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaSchemataRequest request = new DbSchemaSchemataRequestR(properties, restrictions); + List rows = discoverService.dbSchemaSchemata(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaSchemataRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaSchemataRestrictionsR(m.get(ROW.CATALOG_NAME), m.get(ROW.SCHEMA_NAME), + m.get(ROW.SCHEMA_OWNER)); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaSchemataResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", null); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", null); + SoapUtil.addElement(s, "SCHEMA_OWNER", "xsd:string", null); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DbSchemaSchemataResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, r.catalogName()); + SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, r.schemaName()); + SoapUtil.addChildElement(row, ROW.QN_SCHEMA_OWNER, r.schemaOwner()); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaSourceTablesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaSourceTablesHandler.java new file mode 100644 index 0000000..978ff7a --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaSourceTablesHandler.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.TableTypeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables.DbSchemaSourceTablesRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.sourcetables.DbSchemaSourceTablesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.sourcetables.DbSchemaSourceTablesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.sourcetables.DbSchemaSourceTablesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaSourceTablesHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public DbSchemaSourceTablesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaSourceTablesRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaSourceTablesRequest request = new DbSchemaSourceTablesRequestR(properties, restrictions); + List rows = discoverService.dbSchemaSourceTables(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaSourceTablesRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaSourceTablesRestrictionsR(Optional.ofNullable(m.get(ROW.TABLE_CATALOG)), + Optional.ofNullable(m.get(ROW.TABLE_SCHEMA)), m.get(ROW.TABLE_NAME), + TableTypeEnum.fromValue(m.get(ROW.TABLE_TYPE))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaSourceTablesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "TABLE_CATALOG", "xsd:string", "0"); + SoapUtil.addElement(s, "TABLE_SCHEMA", "xsd:string", "0"); + SoapUtil.addElement(s, "TABLE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "TABLE_TYPE", "xsd:string", null); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DbSchemaSourceTablesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_CATALOG, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_SCHEMA, v)); + SoapUtil.addChildElement(row, ROW.QN_TABLE_NAME, r.tableName()); + SoapUtil.addChildElement(row, ROW.QN_TABLE_TYPE, r.tableType().getValue()); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaTablesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaTablesHandler.java new file mode 100644 index 0000000..ee133aa --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaTablesHandler.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.tables.DbSchemaTablesRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.tables.DbSchemaTablesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.tables.DbSchemaTablesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.tables.DbSchemaTablesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaTablesHandler implements DiscoverHandler { + + private static final String TABLE_CATALOG = "TABLE_CATALOG"; + private static final String TABLE_SCHEMA = "TABLE_SCHEMA"; + private static final String TABLE_NAME = "TABLE_NAME"; + private static final String TABLE_TYPE = "TABLE_TYPE"; + + private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") + .withZone(ZoneId.systemDefault()); + + private final DiscoverService discoverService; + + public DbSchemaTablesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaTablesRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaTablesRequest request = new DbSchemaTablesRequestR(properties, restrictions); + List rows = discoverService.dbSchemaTables(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaTablesRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaTablesRestrictionsR(Optional.ofNullable(m.get(TABLE_CATALOG)), + Optional.ofNullable(m.get(TABLE_SCHEMA)), Optional.ofNullable(m.get(TABLE_NAME)), + Optional.ofNullable(m.get(TABLE_TYPE))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaTablesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SOAPElement se1 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se1.setAttribute("sql:field", "TABLE_CATALOG"); + se1.setAttribute("name", "TABLE_CATALOG"); + se1.setAttribute("type", "xsd:string"); + + SOAPElement se2 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se2.setAttribute("sql:field", "TABLE_SCHEMA"); + se2.setAttribute("name", "TABLE_SCHEMA"); + se2.setAttribute("type", "xsd:string"); + se2.setAttribute("minOccurs", "0"); + + SOAPElement se3 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se3.setAttribute("sql:field", "TABLE_NAME"); + se3.setAttribute("name", "TABLE_NAME"); + se3.setAttribute("type", "xsd:string"); + + SOAPElement se4 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se4.setAttribute("sql:field", "TABLE_TYPE"); + se4.setAttribute("name", "TABLE_TYPE"); + se4.setAttribute("type", "xsd:string"); + + SOAPElement se5 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se5.setAttribute("sql:field", "TABLE_GUID"); + se5.setAttribute("name", "TABLE_GUID"); + se5.setAttribute("type", "uuid"); + se5.setAttribute("minOccurs", "0"); + + SOAPElement se6 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se6.setAttribute("sql:field", "DESCRIPTION"); + se6.setAttribute("name", "DESCRIPTION"); + se6.setAttribute("type", "xsd:string"); + se6.setAttribute("minOccurs", "0"); + + SOAPElement se7 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se7.setAttribute("sql:field", "TABLE_PROPID"); + se7.setAttribute("name", "TABLE_PROPID"); + se7.setAttribute("type", "xsd:unsignedInt"); + se7.setAttribute("minOccurs", "0"); + + SOAPElement se8 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se8.setAttribute("sql:field", "DATE_CREATED"); + se8.setAttribute("name", "DATE_CREATED"); + se8.setAttribute("type", "xsd:dateTime"); + se8.setAttribute("minOccurs", "0"); + + SOAPElement se9 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se9.setAttribute("sql:field", "DATE_MODIFIED"); + se9.setAttribute("name", "DATE_MODIFIED"); + se9.setAttribute("type", "xsd:dateTime"); + se9.setAttribute("minOccurs", "0"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, DbSchemaTablesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.tableCatalog().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_CATALOG, v)); + r.tableSchema().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_SCHEMA, v)); + r.tableName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_NAME, v)); + r.tableType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_TYPE, v)); + r.tableGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_GUID, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.tablePropId().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_PROP_ID, String.valueOf(v))); + r.dateCreated().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATE_CREATED, v.format(formatter))); + r.dateModified().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATE_MODIFIED, v.format(formatter))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaTablesInfoHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaTablesInfoHandler.java new file mode 100644 index 0000000..689d8fa --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DbSchemaTablesInfoHandler.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.TableTypeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo.DbSchemaTablesInfoRequest; +import org.eclipse.daanse.xmla.api.discover.dbschema.tablesinfo.DbSchemaTablesInfoResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.tablesinfo.DbSchemaTablesInfoRequestR; +import org.eclipse.daanse.xmla.model.record.discover.dbschema.tablesinfo.DbSchemaTablesInfoRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DbSchemaTablesInfoHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public DbSchemaTablesInfoHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DbSchemaTablesInfoRestrictionsR restrictions = parseRestrictions(restrictionElement); + DbSchemaTablesInfoRequest request = new DbSchemaTablesInfoRequestR(properties, restrictions); + List rows = discoverService.dbSchemaTablesInfo(request, metaData); + writeResponse(rows, responseBody); + } + + private DbSchemaTablesInfoRestrictionsR parseRestrictions(SOAPElement restrictionElement) { + Map m = DiscoverDispatcher.getRestrictionMap(restrictionElement); + return new DbSchemaTablesInfoRestrictionsR(Optional.ofNullable(m.get(ROW.TABLE_CATALOG)), + Optional.ofNullable(m.get(ROW.TABLE_SCHEMA)), m.get(ROW.TABLE_NAME), + TableTypeEnum.fromValue(m.get(ROW.TABLE_TYPE))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DbSchemaTablesInfoResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "TABLE_CATALOG", "xsd:string", "0"); + SoapUtil.addElement(s, "TABLE_SCHEMA", "xsd:string", "0"); + SoapUtil.addElement(s, "TABLE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "TABLE_TYPE", "xsd:string", null); + SoapUtil.addElement(s, "TABLE_GUID", "uuid", "0"); + SoapUtil.addElement(s, "BOOKMARKS", "xsd:boolean", null); + SoapUtil.addElement(s, "BOOKMARK_TYPE", "xsd:int", "0"); + SoapUtil.addElement(s, "BOOKMARK_DATATYPE", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "BOOKMARK_MAXIMUM_LENGTH", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "BOOKMARK_INFORMATION", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "TABLE_VERSION", "xsd:long", "0"); + SoapUtil.addElement(s, "CARDINALITY", "xsd:unsignedLong", null); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "TABLE_PROPID", "xsd:unsignedInt", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DbSchemaTablesInfoResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_CATALOG, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_SCHEMA, v)); + SoapUtil.addChildElement(row, ROW.QN_TABLE_NAME, r.tableName()); + SoapUtil.addChildElement(row, ROW.QN_TABLE_TYPE, r.tableType()); + r.tableGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_GUID, String.valueOf(v))); + r.bookmarks().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BOOKMARKS, String.valueOf(v))); + r.bookmarkType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BOOKMARK_TYPE, String.valueOf(v))); + r.bookmarkDataType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BOOKMARK_DATATYPE, String.valueOf(v))); + r.bookmarkMaximumLength() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BOOKMARK_MAXIMUM_LENGTH, String.valueOf(v))); + r.bookmarkInformation() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BOOKMARK_INFORMATION, String.valueOf(v))); + r.tableVersion().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_VERSION, String.valueOf(v))); + r.cardinality().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CARDINALITY, String.valueOf(v))); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.tablePropId().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_TABLE_PROP_ID, String.valueOf(v))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverConstants.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverConstants.java new file mode 100644 index 0000000..3b35951 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverConstants.java @@ -0,0 +1,835 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import javax.xml.namespace.QName; + +/** + * Constants for XMLA Discover operations. Contains ROWSET namespace and row + * property QNames used by discover handlers. + */ +public interface DiscoverConstants { + + /** + * ROWSET namespace constants for discover response formatting. + */ + interface ROWSET { + String PREFIX = ""; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis:rowset"; + + QName QN_ROOT = new QName(NS_URN, "root", PREFIX); + QName QN_ROW = new QName(NS_URN, "row", PREFIX); + } + + /** + * Row property constants for discover response elements. Each property has a + * String name and corresponding QName. + */ + interface ROW { + String NS_URN = ROWSET.NS_URN; + String PREFIX = ROWSET.PREFIX; + + // Catalog/Schema + String CATALOG_NAME = "CATALOG_NAME"; + QName QN_CATALOG_NAME = new QName(NS_URN, CATALOG_NAME, PREFIX); + + String SCHEMA_NAME = "SCHEMA_NAME"; + QName QN_SCHEMA_NAME = new QName(NS_URN, SCHEMA_NAME, PREFIX); + + String SCHEMA_NAME_LC = "SchemaName"; + QName QN_SCHEMA_NAME_LC = new QName(NS_URN, SCHEMA_NAME_LC, PREFIX); + + // Cube + String CUBE_NAME = "CUBE_NAME"; + QName QN_CUBE_NAME = new QName(NS_URN, CUBE_NAME, PREFIX); + + String CUBE_TYPE = "CUBE_TYPE"; + QName QN_CUBE_TYPE = new QName(NS_URN, CUBE_TYPE, PREFIX); + + String CUBE_GUID = "CUBE_GUID"; + QName QN_CUBE_GUID = new QName(NS_URN, CUBE_GUID, PREFIX); + + String CUBE_CAPTION = "CUBE_CAPTION"; + QName QN_CUBE_CAPTION = new QName(NS_URN, CUBE_CAPTION, PREFIX); + + String CUBE_SOURCE = "CUBE_SOURCE"; + QName QN_CUBE_SOURCE = new QName(NS_URN, CUBE_SOURCE, PREFIX); + + String BASE_CUBE_NAME = "BASE_CUBE_NAME"; + QName QN_BASE_CUBE_NAME = new QName(NS_URN, BASE_CUBE_NAME, PREFIX); + + // Actions + String ACTION_NAME = "ACTION_NAME"; + QName QN_ACTION_NAME = new QName(NS_URN, ACTION_NAME, PREFIX); + + String ACTION_TYPE = "ACTION_TYPE"; + QName QN_ACTION_TYPE = new QName(NS_URN, ACTION_TYPE, PREFIX); + + String ACTION_CAPTION = "ACTION_CAPTION"; + QName QN_ACTION_CAPTION = new QName(NS_URN, ACTION_CAPTION, PREFIX); + + String COORDINATE = "COORDINATE"; + QName QN_COORDINATE = new QName(NS_URN, COORDINATE, PREFIX); + + String COORDINATE_TYPE = "COORDINATE_TYPE"; + QName QN_COORDINATE_TYPE = new QName(NS_URN, COORDINATE_TYPE, PREFIX); + + String INVOCATION = "INVOCATION"; + QName QN_INVOCATION = new QName(NS_URN, INVOCATION, PREFIX); + + // Common + String DESCRIPTION = "DESCRIPTION"; + QName QN_DESCRIPTION = new QName(NS_URN, DESCRIPTION, PREFIX); + + String DESCRIPTION_LC = "Description"; + QName QN_DESCRIPTION_LC = new QName(NS_URN, DESCRIPTION_LC, PREFIX); + + String CONTENT = "CONTENT"; + QName QN_CONTENT = new QName(NS_URN, CONTENT, PREFIX); + + String APPLICATION = "APPLICATION"; + QName QN_APPLICATION = new QName(NS_URN, APPLICATION, PREFIX); + + String TYPE = "TYPE"; + QName QN_TYPE = new QName(NS_URN, TYPE, PREFIX); + + String VERSION = "VERSION"; + QName QN_VERSION = new QName(NS_URN, VERSION, PREFIX); + + // Dimension + String DIMENSION_NAME = "DIMENSION_NAME"; + QName QN_DIMENSION_NAME = new QName(NS_URN, DIMENSION_NAME, PREFIX); + + String DIMENSION_UNIQUE_NAME = "DIMENSION_UNIQUE_NAME"; + QName QN_DIMENSION_UNIQUE_NAME = new QName(NS_URN, DIMENSION_UNIQUE_NAME, PREFIX); + + String DIMENSION_GUID = "DIMENSION_GUID"; + QName QN_DIMENSION_GUID = new QName(NS_URN, DIMENSION_GUID, PREFIX); + + String DIMENSION_CAPTION = "DIMENSION_CAPTION"; + QName QN_DIMENSION_CAPTION = new QName(NS_URN, DIMENSION_CAPTION, PREFIX); + + String DIMENSION_ORDINAL = "DIMENSION_ORDINAL"; + QName QN_DIMENSION_ORDINAL = new QName(NS_URN, DIMENSION_ORDINAL, PREFIX); + + String DIMENSION_TYPE = "DIMENSION_TYPE"; + QName QN_DIMENSION_TYPE = new QName(NS_URN, DIMENSION_TYPE, PREFIX); + + String DIMENSION_CARDINALITY = "DIMENSION_CARDINALITY"; + QName QN_DIMENSION_CARDINALITY = new QName(NS_URN, DIMENSION_CARDINALITY, PREFIX); + + String DIMENSION_IS_VISIBLE = "DIMENSION_IS_VISIBLE"; + QName QN_DIMENSION_IS_VISIBLE = new QName(NS_URN, DIMENSION_IS_VISIBLE, PREFIX); + + String DIMENSION_IS_SHARED = "DIMENSION_IS_SHARED"; + QName QN_DIMENSION_IS_SHARED = new QName(NS_URN, DIMENSION_IS_SHARED, PREFIX); + + String DIMENSION_VISIBILITY = "DIMENSION_VISIBILITY"; + QName QN_DIMENSION_VISIBILITY = new QName(NS_URN, DIMENSION_VISIBILITY, PREFIX); + + String DIMENSION_MASTER_NAME = "DIMENSION_MASTER_NAME"; + QName QN_DIMENSION_MASTER_NAME = new QName(NS_URN, DIMENSION_MASTER_NAME, PREFIX); + + String DIMENSION_MASTER_UNIQUE_NAME = "DIMENSION_MASTER_UNIQUE_NAME"; + QName QN_DIMENSION_MASTER_UNIQUE_NAME = new QName(NS_URN, DIMENSION_MASTER_UNIQUE_NAME, PREFIX); + + String DIMENSION_UNIQUE_SETTINGS = "DIMENSION_UNIQUE_SETTINGS"; + QName QN_DIMENSION_UNIQUE_SETTINGS = new QName(NS_URN, DIMENSION_UNIQUE_SETTINGS, PREFIX); + + String DIMENSION_IS_FACT_DIMENSION = "DIMENSION_IS_FACT_DIMENSION"; + QName QN_DIMENSION_IS_FACT_DIMENSION = new QName(NS_URN, DIMENSION_IS_FACT_DIMENSION, PREFIX); + + String DIMENSION_GRANULARITY = "DIMENSION_GRANULARITY"; + QName QN_DIMENSION_GRANULARITY = new QName(NS_URN, DIMENSION_GRANULARITY, PREFIX); + + String DIMENSION_PATH = "DIMENSION_PATH"; + QName QN_DIMENSION_PATH = new QName(NS_URN, DIMENSION_PATH, PREFIX); + + String DEFAULT_HIERARCHY = "DEFAULT_HIERARCHY"; + QName QN_DEFAULT_HIERARCHY = new QName(NS_URN, DEFAULT_HIERARCHY, PREFIX); + + // Hierarchy + String HIERARCHY_NAME = "HIERARCHY_NAME"; + QName QN_HIERARCHY_NAME = new QName(NS_URN, HIERARCHY_NAME, PREFIX); + + String HIERARCHY_UNIQUE_NAME = "HIERARCHY_UNIQUE_NAME"; + QName QN_HIERARCHY_UNIQUE_NAME = new QName(NS_URN, HIERARCHY_UNIQUE_NAME, PREFIX); + + String HIERARCHY_GUID = "HIERARCHY_GUID"; + QName QN_HIERARCHY_GUID = new QName(NS_URN, HIERARCHY_GUID, PREFIX); + + String HIERARCHY_CAPTION = "HIERARCHY_CAPTION"; + QName QN_HIERARCHY_CAPTION = new QName(NS_URN, HIERARCHY_CAPTION, PREFIX); + + String HIERARCHY_CARDINALITY = "HIERARCHY_CARDINALITY"; + QName QN_HIERARCHY_CARDINALITY = new QName(NS_URN, HIERARCHY_CARDINALITY, PREFIX); + + String HIERARCHY_ORDINAL = "HIERARCHY_ORDINAL"; + QName QN_HIERARCHY_ORDINAL = new QName(NS_URN, HIERARCHY_ORDINAL, PREFIX); + + String HIERARCHY_IS_VISIBLE = "HIERARCHY_IS_VISIBLE"; + QName QN_HIERARCHY_IS_VISIBLE = new QName(NS_URN, HIERARCHY_IS_VISIBLE, PREFIX); + + String HIERARCHY_ORIGIN = "HIERARCHY_ORIGIN"; + QName QN_HIERARCHY_ORIGIN = new QName(NS_URN, HIERARCHY_ORIGIN, PREFIX); + + String HIERARCHY_DISPLAY_FOLDER = "HIERARCHY_DISPLAY_FOLDER"; + QName QN_HIERARCHY_DISPLAY_FOLDER = new QName(NS_URN, HIERARCHY_DISPLAY_FOLDER, PREFIX); + + String DEFAULT_MEMBER = "DEFAULT_MEMBER"; + QName QN_DEFAULT_MEMBER = new QName(NS_URN, DEFAULT_MEMBER, PREFIX); + + String ALL_MEMBER = "ALL_MEMBER"; + QName QN_ALL_MEMBER = new QName(NS_URN, ALL_MEMBER, PREFIX); + + String STRUCTURE = "STRUCTURE"; + QName QN_STRUCTURE = new QName(NS_URN, STRUCTURE, PREFIX); + + String STRUCTURE_TYPE = "STRUCTURE_TYPE"; + QName QN_STRUCTURE_TYPE = new QName(NS_URN, STRUCTURE_TYPE, PREFIX); + + String IS_VIRTUAL = "IS_VIRTUAL"; + QName QN_IS_VIRTUAL = new QName(NS_URN, IS_VIRTUAL, PREFIX); + + String IS_READWRITE = "IS_READWRITE"; + QName QN_IS_READWRITE = new QName(NS_URN, IS_READWRITE, PREFIX); + + String GROUPING_BEHAVIOR = "GROUPING_BEHAVIOR"; + QName QN_GROUPING_BEHAVIOR = new QName(NS_URN, GROUPING_BEHAVIOR, PREFIX); + + String INSTANCE_SELECTION = "INSTANCE_SELECTION"; + QName QN_INSTANCE_SELECTION = new QName(NS_URN, INSTANCE_SELECTION, PREFIX); + + // Level + String LEVEL_NAME = "LEVEL_NAME"; + QName QN_LEVEL_NAME = new QName(NS_URN, LEVEL_NAME, PREFIX); + + String LEVEL_UNIQUE_NAME = "LEVEL_UNIQUE_NAME"; + QName QN_LEVEL_UNIQUE_NAME = new QName(NS_URN, LEVEL_UNIQUE_NAME, PREFIX); + + String LEVEL_GUID = "LEVEL_GUID"; + QName QN_LEVEL_GUID = new QName(NS_URN, LEVEL_GUID, PREFIX); + + String LEVEL_CAPTION = "LEVEL_CAPTION"; + QName QN_LEVEL_CAPTION = new QName(NS_URN, LEVEL_CAPTION, PREFIX); + + String LEVEL_NUMBER = "LEVEL_NUMBER"; + QName QN_LEVEL_NUMBER = new QName(NS_URN, LEVEL_NUMBER, PREFIX); + + String LEVEL_CARDINALITY = "LEVEL_CARDINALITY"; + QName QN_LEVEL_CARDINALITY = new QName(NS_URN, LEVEL_CARDINALITY, PREFIX); + + String LEVEL_TYPE = "LEVEL_TYPE"; + QName QN_LEVEL_TYPE = new QName(NS_URN, LEVEL_TYPE, PREFIX); + + String LEVEL_IS_VISIBLE = "LEVEL_IS_VISIBLE"; + QName QN_LEVEL_IS_VISIBLE = new QName(NS_URN, LEVEL_IS_VISIBLE, PREFIX); + + String LEVEL_ORIGIN = "LEVEL_ORIGIN"; + QName QN_LEVEL_ORIGIN = new QName(NS_URN, LEVEL_ORIGIN, PREFIX); + + String LEVEL_UNIQUE_SETTINGS = "LEVEL_UNIQUE_SETTINGS"; + QName QN_LEVEL_UNIQUE_SETTINGS = new QName(NS_URN, LEVEL_UNIQUE_SETTINGS, PREFIX); + + String CUSTOM_ROLLUP_SETTINGS = "CUSTOM_ROLLUP_SETTINGS"; + QName QN_CUSTOM_ROLLUP_SETTINGS = new QName(NS_URN, CUSTOM_ROLLUP_SETTINGS, PREFIX); + + // Measure + String MEASURE_NAME = "MEASURE_NAME"; + QName QN_MEASURE_NAME = new QName(NS_URN, MEASURE_NAME, PREFIX); + + String MEASURE_UNIQUE_NAME = "MEASURE_UNIQUE_NAME"; + QName QN_MEASURE_UNIQUE_NAME = new QName(NS_URN, MEASURE_UNIQUE_NAME, PREFIX); + + String MEASURE_CAPTION = "MEASURE_CAPTION"; + QName QN_MEASURE_CAPTION = new QName(NS_URN, MEASURE_CAPTION, PREFIX); + + String MEASURE_GUID = "MEASURE_GUID"; + QName QN_MEASURE_GUID = new QName(NS_URN, MEASURE_GUID, PREFIX); + + String MEASURE_AGGREGATOR = "MEASURE_AGGREGATOR"; + QName QN_MEASURE_AGGREGATOR = new QName(NS_URN, MEASURE_AGGREGATOR, PREFIX); + + String MEASURE_IS_VISIBLE = "MEASURE_IS_VISIBLE"; + QName QN_MEASURE_IS_VISIBLE = new QName(NS_URN, MEASURE_IS_VISIBLE, PREFIX); + + String MEASURE_VISIBILITY = "MEASURE_VISIBILITY"; + QName QN_MEASURE_VISIBILITY = new QName(NS_URN, MEASURE_VISIBILITY, PREFIX); + + String MEASURE_UNITS = "MEASURE_UNITS"; + QName QN_MEASURE_UNITS = new QName(NS_URN, MEASURE_UNITS, PREFIX); + + String MEASURE_DISPLAY_FOLDER = "MEASURE_DISPLAY_FOLDER"; + QName QN_MEASURE_DISPLAY_FOLDER = new QName(NS_URN, MEASURE_DISPLAY_FOLDER, PREFIX); + + String MEASURE_UNQUALIFIED_CAPTION = "MEASURE_UNQUALIFIED_CAPTION"; + QName QN_MEASURE_UNQUALIFIED_CAPTION = new QName(NS_URN, MEASURE_UNQUALIFIED_CAPTION, PREFIX); + + String MEASURE_NAME_SQL_COLUMN_NAME = "MEASURE_NAME_SQL_COLUMN_NAME"; + QName QN_MEASURE_NAME_SQL_COLUMN_NAME = new QName(NS_URN, MEASURE_NAME_SQL_COLUMN_NAME, PREFIX); + + String DEFAULT_FORMAT_STRING = "DEFAULT_FORMAT_STRING"; + QName QN_DEFAULT_FORMAT_STRING = new QName(NS_URN, DEFAULT_FORMAT_STRING, PREFIX); + + String EXPRESSION = "EXPRESSION"; + QName QN_EXPRESSION = new QName(NS_URN, EXPRESSION, PREFIX); + + String LEVELS_LIST = "LEVELS_LIST"; + QName QN_LEVELS_LIST = new QName(NS_URN, LEVELS_LIST, PREFIX); + + // MeasureGroup + String MEASUREGROUP_NAME = "MEASUREGROUP_NAME"; + QName QN_MEASUREGROUP_NAME = new QName(NS_URN, MEASUREGROUP_NAME, PREFIX); + + String MEASUREGROUP_CAPTION = "MEASUREGROUP_CAPTION"; + QName QN_MEASUREGROUP_CAPTION = new QName(NS_URN, MEASUREGROUP_CAPTION, PREFIX); + + String MEASUREGROUP_CARDINALITY = "MEASUREGROUP_CARDINALITY"; + QName QN_MEASUREGROUP_CARDINALITY = new QName(NS_URN, MEASUREGROUP_CARDINALITY, PREFIX); + + String IS_WRITE_ENABLED = "IS_WRITE_ENABLED"; + QName QN_IS_WRITE_ENABLED = new QName(NS_URN, IS_WRITE_ENABLED, PREFIX); + + String MEASURE_GROUP_DIMENSION = "MeasureGroupDimension"; + QName QN_MEASURE_GROUP_DIMENSION = new QName(NS_URN, MEASURE_GROUP_DIMENSION, PREFIX); + + // Member + String MEMBER_NAME = "MEMBER_NAME"; + QName QN_MEMBER_NAME = new QName(NS_URN, MEMBER_NAME, PREFIX); + + String MEMBER_UNIQUE_NAME = "MEMBER_UNIQUE_NAME"; + QName QN_MEMBER_UNIQUE_NAME = new QName(NS_URN, MEMBER_UNIQUE_NAME, PREFIX); + + String MEMBER_TYPE = "MEMBER_TYPE"; + QName QN_MEMBER_TYPE = new QName(NS_URN, MEMBER_TYPE, PREFIX); + + String MEMBER_GUID = "MEMBER_GUID"; + QName QN_MEMBER_GUID = new QName(NS_URN, MEMBER_GUID, PREFIX); + + String MEMBER_CAPTION = "MEMBER_CAPTION"; + QName QN_MEMBER_CAPTION = new QName(NS_URN, MEMBER_CAPTION, PREFIX); + + String MEMBER_ORDINAL = "MEMBER_ORDINAL"; + QName QN_MEMBER_ORDINAL = new QName(NS_URN, MEMBER_ORDINAL, PREFIX); + + String MEMBER_KEY = "MEMBER_KEY"; + QName QN_MEMBER_KEY = new QName(NS_URN, MEMBER_KEY, PREFIX); + + String CHILDREN_CARDINALITY = "CHILDREN_CARDINALITY"; + QName QN_CHILDREN_CARDINALITY = new QName(NS_URN, CHILDREN_CARDINALITY, PREFIX); + + String PARENT_LEVEL = "PARENT_LEVEL"; + QName QN_PARENT_LEVEL = new QName(NS_URN, PARENT_LEVEL, PREFIX); + + String PARENT_UNIQUE_NAME = "PARENT_UNIQUE_NAME"; + QName QN_PARENT_UNIQUE_NAME = new QName(NS_URN, PARENT_UNIQUE_NAME, PREFIX); + + String PARENT_COUNT = "PARENT_COUNT"; + QName QN_PARENT_COUNT = new QName(NS_URN, PARENT_COUNT, PREFIX); + + String IS_PLACEHOLDERMEMBER = "IS_PLACEHOLDERMEMBER"; + QName QN_IS_PLACEHOLDERMEMBER = new QName(NS_URN, IS_PLACEHOLDERMEMBER, PREFIX); + + String IS_DATAMEMBER = "IS_DATAMEMBER"; + QName QN_IS_DATAMEMBER = new QName(NS_URN, IS_DATAMEMBER, PREFIX); + + // Property + String PROPERTY_NAME = "PROPERTY_NAME"; + QName QN_PROPERTY_NAME = new QName(NS_URN, PROPERTY_NAME, PREFIX); + + String PROPERTY_NAME_LC = "PropertyName"; + QName QN_PROPERTY_NAME_LC = new QName(NS_URN, PROPERTY_NAME_LC, PREFIX); + + String PROPERTY_TYPE = "PROPERTY_TYPE"; + QName QN_PROPERTY_TYPE = new QName(NS_URN, PROPERTY_TYPE, PREFIX); + + String PROPERTY_TYPE_LC = "PropertyType"; + QName QN_PROPERTY_TYPE_LC = new QName(NS_URN, PROPERTY_TYPE_LC, PREFIX); + + String PROPERTY_CAPTION = "PROPERTY_CAPTION"; + QName QN_PROPERTY_CAPTION = new QName(NS_URN, PROPERTY_CAPTION, PREFIX); + + String PROPERTY_CONTENT_TYPE = "PROPERTY_CONTENT_TYPE"; + QName QN_PROPERTY_CONTENT_TYPE = new QName(NS_URN, PROPERTY_CONTENT_TYPE, PREFIX); + + String PROPERTY_ORIGIN = "PROPERTY_ORIGIN"; + QName QN_PROPERTY_ORIGIN = new QName(NS_URN, PROPERTY_ORIGIN, PREFIX); + + String PROPERTY_VISIBILITY = "PROPERTY_VISIBILITY"; + QName QN_PROPERTY_VISIBILITY = new QName(NS_URN, PROPERTY_VISIBILITY, PREFIX); + + String PROPERTY_DESCRIPTION = "PropertyDescription"; + QName QN_PROPERTY_DESCRIPTION = new QName(NS_URN, PROPERTY_DESCRIPTION, PREFIX); + + String PROPERTY_ACCESS_TYPE = "PropertyAccessType"; + QName QN_PROPERTY_ACCESS_TYPE = new QName(NS_URN, PROPERTY_ACCESS_TYPE, PREFIX); + + String IS_REQUIRED = "IsRequired"; + QName QN_IS_REQUIRED = new QName(NS_URN, IS_REQUIRED, PREFIX); + + String SCOPE = "SCOPE"; + QName QN_SCOPE = new QName(NS_URN, SCOPE, PREFIX); + + String SQL_COLUMN_NAME = "SQL_COLUMN_NAME"; + QName QN_SQL_COLUMN_NAME = new QName(NS_URN, SQL_COLUMN_NAME, PREFIX); + + // Set + String SET_NAME = "SET_NAME"; + QName QN_SET_NAME = new QName(NS_URN, SET_NAME, PREFIX); + + String SET_CAPTION = "SET_CAPTION"; + QName QN_SET_CAPTION = new QName(NS_URN, SET_CAPTION, PREFIX); + + String SET_DISPLAY_FOLDER = "SET_DISPLAY_FOLDER"; + QName QN_SET_DISPLAY_FOLDER = new QName(NS_URN, SET_DISPLAY_FOLDER, PREFIX); + + String DIMENSIONS = "DIMENSIONS"; + QName QN_DIMENSIONS = new QName(NS_URN, DIMENSIONS, PREFIX); + + // KPI + String KPI_NAME = "KPI_NAME"; + QName QN_KPI_NAME = new QName(NS_URN, KPI_NAME, PREFIX); + + String KPI_CAPTION = "KPI_CAPTION"; + QName QN_KPI_CAPTION = new QName(NS_URN, KPI_CAPTION, PREFIX); + + String KPI_DESCRIPTION = "KPI_DESCRIPTION"; + QName QN_KPI_DESCRIPTION = new QName(NS_URN, KPI_DESCRIPTION, PREFIX); + + String KPI_DISPLAY_FOLDER = "KPI_DISPLAY_FOLDER"; + QName QN_KPI_DISPLAY_FOLDER = new QName(NS_URN, KPI_DISPLAY_FOLDER, PREFIX); + + String KPI_VALUE = "KPI_VALUE"; + QName QN_KPI_VALUE = new QName(NS_URN, KPI_VALUE, PREFIX); + + String KPI_GOAL = "KPI_GOAL"; + QName QN_KPI_GOAL = new QName(NS_URN, KPI_GOAL, PREFIX); + + String KPI_STATUS = "KPI_STATUS"; + QName QN_KPI_STATUS = new QName(NS_URN, KPI_STATUS, PREFIX); + + String KPI_TREND = "KPI_TREND"; + QName QN_KPI_TREND = new QName(NS_URN, KPI_TREND, PREFIX); + + String KPI_STATUS_GRAPHIC = "KPI_STATUS_GRAPHIC"; + QName QN_KPI_STATUS_GRAPHIC = new QName(NS_URN, KPI_STATUS_GRAPHIC, PREFIX); + + String KPI_TREND_GRAPHIC = "KPI_TREND_GRAPHIC"; + QName QN_KPI_TREND_GRAPHIC = new QName(NS_URN, KPI_TREND_GRAPHIC, PREFIX); + + String KPI_WEIGHT = "KPI_WEIGHT"; + QName QN_KPI_WEIGHT = new QName(NS_URN, KPI_WEIGHT, PREFIX); + + String KPI_CURRENT_TIME_MEMBER = "KPI_CURRENT_TIME_MEMBER"; + QName QN_KPI_CURRENT_TIME_MEMBER = new QName(NS_URN, KPI_CURRENT_TIME_MEMBER, PREFIX); + + String KPI_PARENT_KPI_NAME = "KPI_PARENT_KPI_NAME"; + QName QN_KPI_PARENT_KPI_NAME = new QName(NS_URN, KPI_PARENT_KPI_NAME, PREFIX); + + // DB Schema - Catalog + String DATE_QUERIED = "DATE_QUERIED"; + QName QN_DATE_QUERIED = new QName(NS_URN, DATE_QUERIED, PREFIX); + + String CURRENTLY_USED = "CURRENTLY_USED"; + QName QN_CURRENTLY_USED = new QName(NS_URN, CURRENTLY_USED, PREFIX); + + String POPULARITY = "POPULARITY"; + QName QN_POPULARITY = new QName(NS_URN, POPULARITY, PREFIX); + + String WEIGHTEDPOPULARITY = "WEIGHTEDPOPULARITY"; + QName QN_WEIGHTEDPOPULARITY = new QName(NS_URN, WEIGHTEDPOPULARITY, PREFIX); + + String CLIENTCACHEREFRESHPOLICY = "CLIENTCACHEREFRESHPOLICY"; + QName QN_CLIENTCACHEREFRESHPOLICY = new QName(NS_URN, CLIENTCACHEREFRESHPOLICY, PREFIX); + + // DB Schema - Table + String TABLE_CATALOG = "TABLE_CATALOG"; + QName QN_TABLE_CATALOG = new QName(NS_URN, TABLE_CATALOG, PREFIX); + + String TABLE_SCHEMA = "TABLE_SCHEMA"; + QName QN_TABLE_SCHEMA = new QName(NS_URN, TABLE_SCHEMA, PREFIX); + + String TABLE_NAME = "TABLE_NAME"; + QName QN_TABLE_NAME = new QName(NS_URN, TABLE_NAME, PREFIX); + + String TABLE_TYPE = "TABLE_TYPE"; + QName QN_TABLE_TYPE = new QName(NS_URN, TABLE_TYPE, PREFIX); + + String TABLE_GUID = "TABLE_GUID"; + QName QN_TABLE_GUID = new QName(NS_URN, TABLE_GUID, PREFIX); + + String TABLE_PROP_ID = "TABLE_PROP_ID"; + QName QN_TABLE_PROP_ID = new QName(NS_URN, TABLE_PROP_ID, PREFIX); + + String BOOKMARKS = "BOOKMARKS"; + QName QN_BOOKMARKS = new QName(NS_URN, BOOKMARKS, PREFIX); + + String BOOKMARK_TYPE = "BOOKMARK_TYPE"; + QName QN_BOOKMARK_TYPE = new QName(NS_URN, BOOKMARK_TYPE, PREFIX); + + String BOOKMARK_DATA_TYPE = "BOOKMARK_DATA_TYPE"; + QName QN_BOOKMARK_DATA_TYPE = new QName(NS_URN, BOOKMARK_DATA_TYPE, PREFIX); + QName QN_BOOKMARK_DATATYPE = QN_BOOKMARK_DATA_TYPE; + + String BOOKMARK_MAXIMUM_LENGTH = "BOOKMARK_MAXIMUM_LENGTH"; + QName QN_BOOKMARK_MAXIMUM_LENGTH = new QName(NS_URN, BOOKMARK_MAXIMUM_LENGTH, PREFIX); + + String BOOKMARK_INFORMATION = "BOOKMARK_INFORMATION"; + QName QN_BOOKMARK_INFORMATION = new QName(NS_URN, BOOKMARK_INFORMATION, PREFIX); + + String TABLE_VERSION = "TABLE_VERSION"; + QName QN_TABLE_VERSION = new QName(NS_URN, TABLE_VERSION, PREFIX); + + String CARDINALITY = "CARDINALITY"; + QName QN_CARDINALITY = new QName(NS_URN, CARDINALITY, PREFIX); + + // DB Schema - Column + String COLUMN_NAME = "COLUMN_NAME"; + QName QN_COLUMN_NAME = new QName(NS_URN, COLUMN_NAME, PREFIX); + + String COLUMN_GUID = "COLUMN_GUID"; + QName QN_COLUMN_GUID = new QName(NS_URN, COLUMN_GUID, PREFIX); + + String COLUMN_PROPID = "COLUMN_PROPID"; + QName QN_COLUMN_PROPID = new QName(NS_URN, COLUMN_PROPID, PREFIX); + + String ORDINAL_POSITION = "ORDINAL_POSITION"; + QName QN_ORDINAL_POSITION = new QName(NS_URN, ORDINAL_POSITION, PREFIX); + + String COLUMN_HAS_DEFAULT = "COLUMN_HAS_DEFAULT"; + QName QN_COLUMN_HAS_DEFAULT = new QName(NS_URN, COLUMN_HAS_DEFAULT, PREFIX); + + String COLUMN_DEFAULT = "COLUMN_DEFAULT"; + QName QN_COLUMN_DEFAULT = new QName(NS_URN, COLUMN_DEFAULT, PREFIX); + + String COLUMN_FLAG = "COLUMN_FLAG"; + QName QN_COLUMN_FLAG = new QName(NS_URN, COLUMN_FLAG, PREFIX); + + String COLUMN_FLAGS = "COLUMN_FLAGS"; + QName QN_COLUMN_FLAGS = new QName(NS_URN, COLUMN_FLAGS, PREFIX); + + String TYPE_GUID = "TYPE_GUID"; + QName QN_TYPE_GUID = new QName(NS_URN, TYPE_GUID, PREFIX); + + String CHARACTER_MAXIMUM_LENGTH = "CHARACTER_MAXIMUM_LENGTH"; + QName QN_CHARACTER_MAXIMUM_LENGTH = new QName(NS_URN, CHARACTER_MAXIMUM_LENGTH, PREFIX); + + String CHARACTER_OCTET_LENGTH = "CHARACTER_OCTET_LENGTH"; + QName QN_CHARACTER_OCTET_LENGTH = new QName(NS_URN, CHARACTER_OCTET_LENGTH, PREFIX); + + String DATETIME_PRECISION = "DATETIME_PRECISION"; + QName QN_DATETIME_PRECISION = new QName(NS_URN, DATETIME_PRECISION, PREFIX); + + String CHARACTER_SET_CATALOG = "CHARACTER_SET_CATALOG"; + QName QN_CHARACTER_SET_CATALOG = new QName(NS_URN, CHARACTER_SET_CATALOG, PREFIX); + + String CHARACTER_SET_SCHEMA = "CHARACTER_SET_SCHEMA"; + QName QN_CHARACTER_SET_SCHEMA = new QName(NS_URN, CHARACTER_SET_SCHEMA, PREFIX); + + String CHARACTER_SET_NAME = "CHARACTER_SET_NAME"; + QName QN_CHARACTER_SET_NAME = new QName(NS_URN, CHARACTER_SET_NAME, PREFIX); + + String COLLATION_CATALOG = "COLLATION_CATALOG"; + QName QN_COLLATION_CATALOG = new QName(NS_URN, COLLATION_CATALOG, PREFIX); + + String COLLATION_SCHEMA = "COLLATION_SCHEMA"; + QName QN_COLLATION_SCHEMA = new QName(NS_URN, COLLATION_SCHEMA, PREFIX); + + String COLLATION_NAME = "COLLATION_NAME"; + QName QN_COLLATION_NAME = new QName(NS_URN, COLLATION_NAME, PREFIX); + + String DOMAIN_CATALOG = "DOMAIN_CATALOG"; + QName QN_DOMAIN_CATALOG = new QName(NS_URN, DOMAIN_CATALOG, PREFIX); + + String DOMAIN_SCHEMA = "DOMAIN_SCHEMA"; + QName QN_DOMAIN_SCHEMA = new QName(NS_URN, DOMAIN_SCHEMA, PREFIX); + + String DOMAIN_NAME = "DOMAIN_NAME"; + QName QN_DOMAIN_NAME = new QName(NS_URN, DOMAIN_NAME, PREFIX); + + String COLUMN_OLAP_TYPE = "COLUMN_OLAP_TYPE"; + QName QN_COLUMN_OLAP_TYPE = new QName(NS_URN, COLUMN_OLAP_TYPE, PREFIX); + + // DB Schema - Schema + String SCHEMA_OWNER = "SCHEMA_OWNER"; + QName QN_SCHEMA_OWNER = new QName(NS_URN, SCHEMA_OWNER, PREFIX); + + // DB Schema - Provider Types + String TYPE_NAME = "TYPE_NAME"; + QName QN_TYPE_NAME = new QName(NS_URN, TYPE_NAME, PREFIX); + + String COLUMN_SIZE = "COLUMN_SIZE"; + QName QN_COLUMN_SIZE = new QName(NS_URN, COLUMN_SIZE, PREFIX); + + String LITERAL_PREFIX = "LITERAL_PREFIX"; + QName QN_LITERAL_PREFIX = new QName(NS_URN, LITERAL_PREFIX, PREFIX); + + String LITERAL_SUFFIX = "LITERAL_SUFFIX"; + QName QN_LITERAL_SUFFIX = new QName(NS_URN, LITERAL_SUFFIX, PREFIX); + + String CREATE_PARAMS = "CREATE_PARAMS"; + QName QN_CREATE_PARAMS = new QName(NS_URN, CREATE_PARAMS, PREFIX); + + String CASE_SENSITIVE = "CASE_SENSITIVE"; + QName QN_CASE_SENSITIVE = new QName(NS_URN, CASE_SENSITIVE, PREFIX); + + String SEARCHABLE = "SEARCHABLE"; + QName QN_SEARCHABLE = new QName(NS_URN, SEARCHABLE, PREFIX); + + String UNSIGNED_ATTRIBUTE = "UNSIGNED_ATTRIBUTE"; + QName QN_UNSIGNED_ATTRIBUTE = new QName(NS_URN, UNSIGNED_ATTRIBUTE, PREFIX); + + String FIXED_PREC_SCALE = "FIXED_PREC_SCALE"; + QName QN_FIXED_PREC_SCALE = new QName(NS_URN, FIXED_PREC_SCALE, PREFIX); + + String AUTO_UNIQUE_VALUE = "AUTO_UNIQUE_VALUE"; + QName QN_AUTO_UNIQUE_VALUE = new QName(NS_URN, AUTO_UNIQUE_VALUE, PREFIX); + + String LOCAL_TYPE_NAME = "LOCAL_TYPE_NAME"; + QName QN_LOCAL_TYPE_NAME = new QName(NS_URN, LOCAL_TYPE_NAME, PREFIX); + + String MINIMUM_SCALE = "MINIMUM_SCALE"; + QName QN_MINIMUM_SCALE = new QName(NS_URN, MINIMUM_SCALE, PREFIX); + + String MAXIMUM_SCALE = "MAXIMUM_SCALE"; + QName QN_MAXIMUM_SCALE = new QName(NS_URN, MAXIMUM_SCALE, PREFIX); + + String GUID = "GUID"; + QName QN_GUID = new QName(NS_URN, GUID, PREFIX); + + String TYPELIB = "TYPELIB"; + QName QN_TYPELIB = new QName(NS_URN, TYPELIB, PREFIX); + + String IS_LONG = "IS_LONG"; + QName QN_IS_LONG = new QName(NS_URN, IS_LONG, PREFIX); + + String BEST_MATCH = "BEST_MATCH"; + QName QN_BEST_MATCH = new QName(NS_URN, BEST_MATCH, PREFIX); + + String IS_FIXEDLENGTH = "IS_FIXEDLENGTH"; + QName QN_IS_FIXEDLENGTH = new QName(NS_URN, IS_FIXEDLENGTH, PREFIX); + + // DB Schema - Source Tables + String TABLE_OLAP_TYPE = "TABLE_OLAP_TYPE"; + QName QN_TABLE_OLAP_TYPE = new QName(NS_URN, TABLE_OLAP_TYPE, PREFIX); + + String TYPE_LIB = "TYPE_LIB"; + QName QN_TYPE_LIB = new QName(NS_URN, TYPE_LIB, PREFIX); + + // Discover Enumerators + String ENUM_NAME = "EnumName"; + QName QN_ENUM_NAME = new QName(NS_URN, ENUM_NAME, PREFIX); + + String ENUM_DESCRIPTION = "EnumDescription"; + QName QN_ENUM_DESCRIPTION = new QName(NS_URN, ENUM_DESCRIPTION, PREFIX); + + String ENUM_TYPE = "EnumType"; + QName QN_ENUM_TYPE = new QName(NS_URN, ENUM_TYPE, PREFIX); + + String ELEMENT_NAME = "ElementName"; + QName QN_ELEMENT_NAME = new QName(NS_URN, ELEMENT_NAME, PREFIX); + + String ELEMENT_DESCRIPTION = "ElementDescription"; + QName QN_ELEMENT_DESCRIPTION = new QName(NS_URN, ELEMENT_DESCRIPTION, PREFIX); + + String ELEMENT_VALUE = "ElementValue"; + QName QN_ELEMENT_VALUE = new QName(NS_URN, ELEMENT_VALUE, PREFIX); + + // Discover Keywords + String KEYWORD = "Keyword"; + QName QN_KEYWORD = new QName(NS_URN, KEYWORD, PREFIX); + + // Discover Schema Rowsets + String SCHEMA_GUID = "SchemaGuid"; + QName QN_SCHEMA_GUID = new QName(NS_URN, SCHEMA_GUID, PREFIX); + + String RESTRICTIONS_MASK = "RestrictionsMask"; + QName QN_RESTRICTIONS_MASK = new QName(NS_URN, RESTRICTIONS_MASK, PREFIX); + + // Discover XML Metadata + String META_DATA = "METADATA"; + QName QN_META_DATA = new QName(NS_URN, META_DATA, "xars"); + + // Discover Literals + String LITERAL_NAME = "LiteralName"; + QName QN_LITERAL_NAME = new QName(NS_URN, LITERAL_NAME, PREFIX); + + String LITERAL_VALUE = "LiteralValue"; + QName QN_LITERAL_VALUE = new QName(NS_URN, LITERAL_VALUE, PREFIX); + + String LITERAL_INVALID_CHARS = "LiteralInvalidChars"; + QName QN_LITERAL_INVALID_CHARS = new QName(NS_URN, LITERAL_INVALID_CHARS, PREFIX); + + String LITERAL_INVALID_STARTING_CHARS = "LiteralInvalidStartingChars"; + QName QN_LITERAL_INVALID_STARTING_CHARS = new QName(NS_URN, LITERAL_INVALID_STARTING_CHARS, PREFIX); + + String LITERAL_MAX_LENGTH = "LiteralMaxLength"; + QName QN_LITERAL_MAX_LENGTH = new QName(NS_URN, LITERAL_MAX_LENGTH, PREFIX); + + String LITERAL_NAME_ENUM_VALUE = "LiteralNameEnumValue"; + QName QN_LITERAL_NAME_ENUM_VALUE = new QName(NS_URN, LITERAL_NAME_ENUM_VALUE, PREFIX); + + // Discover Data Sources + String DATA_SOURCE_NAME = "DataSourceName"; + QName QN_DATA_SOURCE_NAME = new QName(NS_URN, DATA_SOURCE_NAME, PREFIX); + + String DATA_SOURCE_DESCRIPTION = "DataSourceDescription"; + QName QN_DATA_SOURCE_DESCRIPTION = new QName(NS_URN, DATA_SOURCE_DESCRIPTION, PREFIX); + + String DATA_SOURCE_INFO = "DataSourceInfo"; + QName QN_DATA_SOURCE_INFO = new QName(NS_URN, DATA_SOURCE_INFO, PREFIX); + + String URL = "URL"; + QName QN_URL = new QName(NS_URN, URL, PREFIX); + + String PROVIDER_NAME = "ProviderName"; + QName QN_PROVIDER_NAME = new QName(NS_URN, PROVIDER_NAME, PREFIX); + + String PROVIDER_TYPE = "ProviderType"; + QName QN_PROVIDER_TYPE = new QName(NS_URN, PROVIDER_TYPE, PREFIX); + + String AUTHENTICATION_MODE = "AuthenticationMode"; + QName QN_AUTHENTICATION_MODE = new QName(NS_URN, AUTHENTICATION_MODE, PREFIX); + + // Function parameter info + String OPTIONAL = "Optional"; + QName QN_OPTIONAL = new QName(NS_URN, OPTIONAL, PREFIX); + + String REPEATABLE = "Repeatable"; + QName QN_REPEATABLE = new QName(NS_URN, REPEATABLE, PREFIX); + + String REPEATGROUP = "RepeatGroup"; + QName QN_REPEATGROUP = new QName(NS_URN, REPEATGROUP, PREFIX); + + // Function + String FUNCTION_NAME = "FUNCTION_NAME"; + QName QN_FUNCTION_NAME = new QName(NS_URN, FUNCTION_NAME, PREFIX); + + String PARAMETER_LIST = "PARAMETER_LIST"; + QName QN_PARAMETER_LIST = new QName(NS_URN, PARAMETER_LIST, PREFIX); + + String RETURN_TYPE = "RETURN_TYPE"; + QName QN_RETURN_TYPE = new QName(NS_URN, RETURN_TYPE, PREFIX); + + String ORIGIN = "ORIGIN"; + QName QN_ORIGIN = new QName(NS_URN, ORIGIN, PREFIX); + + String INTERFACE_NAME = "INTERFACE_NAME"; + QName QN_INTERFACE_NAME = new QName(NS_URN, INTERFACE_NAME, PREFIX); + + String LIBRARY_NAME = "LIBRARY_NAME"; + QName QN_LIBRARY_NAME = new QName(NS_URN, LIBRARY_NAME, PREFIX); + + String DLL_NAME = "DLL_NAME"; + QName QN_DLL_NAME = new QName(NS_URN, DLL_NAME, PREFIX); + + String HELP_FILE = "HELP_FILE"; + QName QN_HELP_FILE = new QName(NS_URN, HELP_FILE, PREFIX); + + String HELP_CONTEXT = "HELP_CONTEXT"; + QName QN_HELP_CONTEXT = new QName(NS_URN, HELP_CONTEXT, PREFIX); + + String OBJECT = "OBJECT"; + QName QN_OBJECT = new QName(NS_URN, OBJECT, PREFIX); + + String CAPTION = "CAPTION"; + QName QN_CAPTION = new QName(NS_URN, CAPTION, PREFIX); + + String DIRECTQUERY_PUSHABLE = "DIRECTQUERY_PUSHABLE"; + QName QN_DIRECTQUERY_PUSHABLE = new QName(NS_URN, DIRECTQUERY_PUSHABLE, PREFIX); + + String PARAMETERINFO = "PARAMETERINFO"; + QName QN_PARAMETERINFO = new QName(NS_URN, PARAMETERINFO, PREFIX); + + // Data types + String DATA_TYPE = "DATA_TYPE"; + QName QN_DATA_TYPE = new QName(NS_URN, DATA_TYPE, PREFIX); + + String NUMERIC_PRECISION = "NUMERIC_PRECISION"; + QName QN_NUMERIC_PRECISION = new QName(NS_URN, NUMERIC_PRECISION, PREFIX); + + String NUMERIC_SCALE = "NUMERIC_SCALE"; + QName QN_NUMERIC_SCALE = new QName(NS_URN, NUMERIC_SCALE, PREFIX); + + String IS_NULLABLE = "IS_NULLABLE"; + QName QN_IS_NULLABLE = new QName(NS_URN, IS_NULLABLE, PREFIX); + + // Perspective + String PERSPECTIVE_NAME = "PERSPECTIVE_NAME"; + QName QN_PERSPECTIVE_NAME = new QName(NS_URN, PERSPECTIVE_NAME, PREFIX); + + // Common metadata + String ANNOTATIONS = "ANNOTATIONS"; + QName QN_ANNOTATIONS = new QName(NS_URN, ANNOTATIONS, PREFIX); + + String ROLES = "ROLES"; + QName QN_ROLES = new QName(NS_URN, ROLES, PREFIX); + + String DATE_MODIFIED = "DATE_MODIFIED"; + QName QN_DATE_MODIFIED = new QName(NS_URN, DATE_MODIFIED, PREFIX); + + String DATE_CREATED = "DATE_CREATED"; + QName QN_DATE_CREATED = new QName(NS_URN, DATE_CREATED, PREFIX); + + String CREATED_ON = "CREATED_ON"; + QName QN_CREATED_ON = new QName(NS_URN, CREATED_ON, PREFIX); + + String LAST_SCHEMA_UPDATE = "LAST_SCHEMA_UPDATE"; + QName QN_LAST_SCHEMA_UPDATE = new QName(NS_URN, LAST_SCHEMA_UPDATE, PREFIX); + + String SCHEMA_UPDATED_BY = "SCHEMA_UPDATED_BY"; + QName QN_SCHEMA_UPDATED_BY = new QName(NS_URN, SCHEMA_UPDATED_BY, PREFIX); + + String LAST_DATA_UPDATE = "LAST_DATA_UPDATE"; + QName QN_LAST_DATA_UPDATE = new QName(NS_URN, LAST_DATA_UPDATE, PREFIX); + + String DATA_UPDATED_BY = "DATA_UPDATED_BY"; + QName QN_DATA_UPDATED_BY = new QName(NS_URN, DATA_UPDATED_BY, PREFIX); + + String COMPATIBILITY_LEVEL = "COMPATIBILITY_LEVEL"; + QName QN_COMPATIBILITY_LEVEL = new QName(NS_URN, COMPATIBILITY_LEVEL, PREFIX); + + String DATABASE_ID = "DATABASE_ID"; + QName QN_DATABASE_ID = new QName(NS_URN, DATABASE_ID, PREFIX); + + // Boolean flags + String IS_DRILLTHROUGH_ENABLED = "IS_DRILLTHROUGH_ENABLED"; + QName QN_IS_DRILLTHROUGH_ENABLED = new QName(NS_URN, IS_DRILLTHROUGH_ENABLED, PREFIX); + + String IS_LINKABLE = "IS_LINKABLE"; + QName QN_IS_LINKABLE = new QName(NS_URN, IS_LINKABLE, PREFIX); + + String IS_SQL_ENABLED = "IS_SQL_ENABLED"; + QName QN_IS_SQL_ENABLED = new QName(NS_URN, IS_SQL_ENABLED, PREFIX); + + String PREFERRED_QUERY_PATTERNS = "PREFERRED_QUERY_PATTERNS"; + QName QN_PREFERRED_QUERY_PATTERNS = new QName(NS_URN, PREFERRED_QUERY_PATTERNS, PREFIX); + + // Name/Value common + String NAME = "NAME"; + QName QN_NAME = new QName(NS_URN, NAME, PREFIX); + + String NAME_LC = "Name"; + QName QN_NAME_LC = new QName(NS_URN, NAME_LC, PREFIX); + + String VALUE = "Value"; + QName QN_VALUE = new QName(NS_URN, VALUE, PREFIX); + + String TYPE_LC = "Type"; + QName QN_TYPE_LC = new QName(NS_URN, TYPE_LC, PREFIX); + + String RESTRICTIONS = "Restrictions"; + QName QN_RESTRICTIONS = new QName(NS_URN, RESTRICTIONS, PREFIX); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverCsdlMetaDataHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverCsdlMetaDataHandler.java new file mode 100644 index 0000000..7d4ae93 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverCsdlMetaDataHandler.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import javax.xml.parsers.ParserConfigurationException; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRequest; +import org.eclipse.daanse.xmla.api.discover.discover.csdlmetadata.DiscoverCsdlMetaDataResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.csdlmetadata.DiscoverCsdlMetaDataRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaSoapException; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; +import org.xml.sax.SAXException; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverCsdlMetaDataHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public DiscoverCsdlMetaDataHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverCsdlMetaDataRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverCsdlMetaDataRequest request = new DiscoverCsdlMetaDataRequestR(properties, restrictions); + List rows = discoverService.csdlMetaData(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverCsdlMetaDataRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverCsdlMetaDataRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.PERSPECTIVE_NAME)), Optional.ofNullable(m.get(ROW.VERSION))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverCsdlMetaDataResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement el1complexType = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + el1complexType.setAttribute("name", "xmlDocument"); + SOAPElement sequence = SoapUtil.addChildElement(el1complexType, Constants.XSD.QN_SEQUENCE); + SoapUtil.addChildElement(sequence, Constants.XSD.QN_ANY); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "METADATA", "xmlDocument", null); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverCsdlMetaDataResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + addChildElementTextNode(row, r.metaData()); + } + + private void addChildElementTextNode(SOAPElement element, String valueOfChild) { + try { + SOAPElement createdChild = element.addChildElement(ROW.QN_META_DATA); + createdChild.setAttribute("xmlns", "http://schemas.microsoft.com/analysisservices/2003/engine"); + createdChild.setAttribute("xmlns:ddl2", "http://schemas.microsoft.com/analysisservices/2003/engine/2"); + createdChild.setAttribute("xmlns:ddl2_2", "http://schemas.microsoft.com/analysisservices/2003/engine/2/2"); + createdChild.setAttribute("xmlns:ddl100", "http://schemas.microsoft.com/analysisservices/2008/engine/100"); + createdChild.setAttribute("xmlns:ddl100_100", + "http://schemas.microsoft.com/analysisservices/2008/engine/100/100"); + createdChild.setAttribute("xmlns:ddl200", "http://schemas.microsoft.com/analysisservices/2010/engine/200"); + createdChild.setAttribute("xmlns:ddl200_200", + "http://schemas.microsoft.com/analysisservices/2010/engine/200/200"); + createdChild.setAttribute("xmlns:ddl300", "http://schemas.microsoft.com/analysisservices/2011/engine/300"); + createdChild.setAttribute("xmlns:ddl300_300", + "http://schemas.microsoft.com/analysisservices/2011/engine/300/300"); + createdChild.setAttribute("xmlns:ddl400", "http://schemas.microsoft.com/analysisservices/2012/engine/400"); + createdChild.setAttribute("xmlns:ddl400_400", + "http://schemas.microsoft.com/analysisservices/2012/engine/400/400"); + if (valueOfChild != null && !valueOfChild.isEmpty()) { + SOAPElement se = SoapUtil.xmlStringToSoapElement(valueOfChild, createdChild); + createdChild.addChildElement(se); + } + } catch (SOAPException | SAXException | IOException | ParserConfigurationException e) { + throw new XmlaSoapException("addChildElementTextNode error", e); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDataSourcesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDataSourcesHandler.java new file mode 100644 index 0000000..65a5e23 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDataSourcesHandler.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.AuthenticationModeEnum; +import org.eclipse.daanse.xmla.api.common.enums.ProviderTypeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesRequest; +import org.eclipse.daanse.xmla.api.discover.discover.datasources.DiscoverDataSourcesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.datasources.DiscoverDataSourcesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.datasources.DiscoverDataSourcesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverDataSourcesHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public DiscoverDataSourcesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverDataSourcesRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverDataSourcesRequest request = new DiscoverDataSourcesRequestR(properties, restrictions); + List rows = discoverService.dataSources(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverDataSourcesRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverDataSourcesRestrictionsR(m.get(ROW.DATA_SOURCE_NAME), + Optional.ofNullable(m.get(ROW.DATA_SOURCE_DESCRIPTION)), Optional.ofNullable(m.get(ROW.URL)), + Optional.ofNullable(m.get(ROW.DATA_SOURCE_INFO)), m.get(ROW.PROVIDER_NAME), + Optional.ofNullable(ProviderTypeEnum.fromValue(m.get(ROW.PROVIDER_TYPE))), + Optional.ofNullable(AuthenticationModeEnum.fromValue(m.get(ROW.AUTHENTICATION_MODE)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverDataSourcesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "DataSourceName", "xsd:string", null); + SoapUtil.addElement(s, "DataSourceDescription", "xsd:string", "0"); + SoapUtil.addElement(s, "URL", "xsd:string", "0"); + SoapUtil.addElement(s, "DataSourceInfo", "xsd:string", "0"); + SoapUtil.addElement(s, "ProviderName", "xsd:string", "0"); + SoapUtil.addElement(s, "ProviderType", "xsd:string", "0"); + SoapUtil.addElement(s, "AuthenticationMode", "xsd:string", null); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverDataSourcesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_DATA_SOURCE_NAME, r.dataSourceName()); + r.dataSourceDescription().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_SOURCE_DESCRIPTION, v)); + r.url().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_URL, v)); + r.dataSourceInfo().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_SOURCE_INFO, v)); + SoapUtil.addChildElement(row, ROW.QN_PROVIDER_NAME, r.providerName()); + r.providerType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROVIDER_TYPE, v.name())); + r.authenticationMode().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_AUTHENTICATION_MODE, v.getValue())); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDispatcher.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDispatcher.java new file mode 100644 index 0000000..891048d --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDispatcher.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.PropertyConverter; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaParseException; + +import jakarta.xml.soap.Node; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +/** + * Dispatcher for XMLA Discover operations. Routes Discover requests to the + * appropriate handler based on request type. + */ +public class DiscoverDispatcher { + + // Request type constants + private static final String MDSCHEMA_FUNCTIONS = "MDSCHEMA_FUNCTIONS"; + private static final String MDSCHEMA_DIMENSIONS = "MDSCHEMA_DIMENSIONS"; + private static final String MDSCHEMA_CUBES = "MDSCHEMA_CUBES"; + private static final String MDSCHEMA_ACTIONS = "MDSCHEMA_ACTIONS"; + private static final String MDSCHEMA_HIERARCHIES = "MDSCHEMA_HIERARCHIES"; + private static final String MDSCHEMA_LEVELS = "MDSCHEMA_LEVELS"; + private static final String MDSCHEMA_MEASUREGROUP_DIMENSIONS = "MDSCHEMA_MEASUREGROUP_DIMENSIONS"; + private static final String MDSCHEMA_MEASURES = "MDSCHEMA_MEASURES"; + private static final String MDSCHEMA_MEMBERS = "MDSCHEMA_MEMBERS"; + private static final String MDSCHEMA_PROPERTIES = "MDSCHEMA_PROPERTIES"; + private static final String MDSCHEMA_SETS = "MDSCHEMA_SETS"; + private static final String MDSCHEMA_KPIS = "MDSCHEMA_KPIS"; + private static final String MDSCHEMA_MEASUREGROUPS = "MDSCHEMA_MEASUREGROUPS"; + private static final String DBSCHEMA_TABLES = "DBSCHEMA_TABLES"; + private static final String DBSCHEMA_CATALOGS = "DBSCHEMA_CATALOGS"; + private static final String DBSCHEMA_COLUMNS = "DBSCHEMA_COLUMNS"; + private static final String DBSCHEMA_PROVIDER_TYPES = "DBSCHEMA_PROVIDER_TYPES"; + private static final String DBSCHEMA_SCHEMATA = "DBSCHEMA_SCHEMATA"; + private static final String DBSCHEMA_SOURCE_TABLES = "DBSCHEMA_SOURCE_TABLES"; + private static final String DBSCHEMA_TABLES_INFO = "DBSCHEMA_TABLES_INFO"; + private static final String DISCOVER_LITERALS = "DISCOVER_LITERALS"; + private static final String DISCOVER_KEYWORDS = "DISCOVER_KEYWORDS"; + private static final String DISCOVER_ENUMERATORS = "DISCOVER_ENUMERATORS"; + private static final String DISCOVER_SCHEMA_ROWSETS = "DISCOVER_SCHEMA_ROWSETS"; + private static final String DISCOVER_PROPERTIES = "DISCOVER_PROPERTIES"; + private static final String DISCOVER_DATASOURCES = "DISCOVER_DATASOURCES"; + private static final String DISCOVER_XML_METADATA = "DISCOVER_XML_METADATA"; + private static final String DISCOVER_CSDL_METADATA = "DISCOVER_CSDL_METADATA"; + + private final Map handlers; + + public DiscoverDispatcher(DiscoverService discoverService) { + this.handlers = initHandlers(discoverService); + } + + /** + * Dispatch a Discover SOAP element to the appropriate handler. + * + * @param discoverElement the Discover SOAP element + * @param responseBody the response body to write to + * @param metaData request metadata + * @throws SOAPException if SOAP processing fails + */ + public void dispatch(SOAPElement discoverElement, SOAPBody responseBody, RequestMetaData metaData) + throws SOAPException { + + String requestType = null; + PropertiesR properties = null; + SOAPElement restrictions = null; + + Iterator nodeIterator = discoverElement.getChildElements(); + while (nodeIterator.hasNext()) { + Node node = nodeIterator.next(); + if (node instanceof SOAPElement element) { + if (requestType == null && Constants.MSXMLA.QN_REQUEST_TYPE.equals(element.getElementQName())) { + requestType = element.getTextContent(); + continue; + } + if (restrictions == null && Constants.MSXMLA.QN_RESTRICTIONS.equals(element.getElementQName())) { + restrictions = element; + continue; + } + if (properties == null && Constants.MSXMLA.QN_PROPERTIES.equals(element.getElementQName())) { + properties = PropertyConverter.propertiestoProperties(element); + } + } + } + + DiscoverHandler handler = handlers.get(requestType); + if (handler == null) { + throw new XmlaParseException("Unknown request type: " + requestType); + } + handler.handle(metaData, properties, restrictions, responseBody); + } + + private Map initHandlers(DiscoverService ds) { + Map map = new HashMap<>(); + map.put(MDSCHEMA_FUNCTIONS, new MdSchemaFunctionsHandler(ds)); + map.put(MDSCHEMA_DIMENSIONS, new MdSchemaDimensionsHandler(ds)); + map.put(MDSCHEMA_CUBES, new MdSchemaCubesHandler(ds)); + map.put(MDSCHEMA_ACTIONS, new MdSchemaActionsHandler(ds)); + map.put(MDSCHEMA_HIERARCHIES, new MdSchemaHierarchiesHandler(ds)); + map.put(MDSCHEMA_LEVELS, new MdSchemaLevelsHandler(ds)); + map.put(MDSCHEMA_MEASUREGROUP_DIMENSIONS, new MdSchemaMeasureGroupDimensionsHandler(ds)); + map.put(MDSCHEMA_MEASURES, new MdSchemaMeasuresHandler(ds)); + map.put(MDSCHEMA_MEMBERS, new MdSchemaMembersHandler(ds)); + map.put(MDSCHEMA_PROPERTIES, new MdSchemaPropertiesHandler(ds)); + map.put(MDSCHEMA_SETS, new MdSchemaSetsHandler(ds)); + map.put(MDSCHEMA_KPIS, new MdSchemaKpisHandler(ds)); + map.put(MDSCHEMA_MEASUREGROUPS, new MdSchemaMeasureGroupsHandler(ds)); + map.put(DBSCHEMA_TABLES, new DbSchemaTablesHandler(ds)); + map.put(DBSCHEMA_CATALOGS, new DbSchemaCatalogsHandler(ds)); + map.put(DBSCHEMA_COLUMNS, new DbSchemaColumnsHandler(ds)); + map.put(DBSCHEMA_PROVIDER_TYPES, new DbSchemaProviderTypesHandler(ds)); + map.put(DBSCHEMA_SCHEMATA, new DbSchemaSchemataHandler(ds)); + map.put(DBSCHEMA_SOURCE_TABLES, new DbSchemaSourceTablesHandler(ds)); + map.put(DBSCHEMA_TABLES_INFO, new DbSchemaTablesInfoHandler(ds)); + map.put(DISCOVER_LITERALS, new DiscoverLiteralsHandler(ds)); + map.put(DISCOVER_KEYWORDS, new DiscoverKeywordsHandler(ds)); + map.put(DISCOVER_ENUMERATORS, new DiscoverEnumeratorsHandler(ds)); + map.put(DISCOVER_SCHEMA_ROWSETS, new DiscoverSchemaRowsetsHandler(ds)); + map.put(DISCOVER_PROPERTIES, new DiscoverPropertiesHandler(ds)); + map.put(DISCOVER_DATASOURCES, new DiscoverDataSourcesHandler(ds)); + map.put(DISCOVER_XML_METADATA, new DiscoverXmlMetaDataHandler(ds)); + map.put(DISCOVER_CSDL_METADATA, new DiscoverCsdlMetaDataHandler(ds)); + return map; + } + + /** + * Parse restriction map from a SOAP element. + * + * @param el the SOAP element containing restrictions + * @return map of restriction name to value + */ + public static Map getRestrictionMap(SOAPElement el) { + Iterator 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 restrictionValues(SOAPElement restrictionList) { + Map result = new HashMap<>(); + Iterator 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; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverEnumeratorsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverEnumeratorsHandler.java new file mode 100644 index 0000000..c6c6f43 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverEnumeratorsHandler.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.enumerators.DiscoverEnumeratorsRequest; +import org.eclipse.daanse.xmla.api.discover.discover.enumerators.DiscoverEnumeratorsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.enumerators.DiscoverEnumeratorsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.enumerators.DiscoverEnumeratorsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverEnumeratorsHandler implements DiscoverHandler { + + private static final String ENUM_NAME = "EnumName"; + + private final DiscoverService discoverService; + + public DiscoverEnumeratorsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverEnumeratorsRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverEnumeratorsRequest request = new DiscoverEnumeratorsRequestR(properties, restrictions); + List rows = discoverService.discoverEnumerators(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverEnumeratorsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverEnumeratorsRestrictionsR(Optional.ofNullable(m.get(ENUM_NAME))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverEnumeratorsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement ct1 = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct1.setAttribute("name", "row"); + SOAPElement s1 = SoapUtil.addChildElement(ct1, Constants.XSD.QN_SEQUENCE); + SOAPElement s1e1 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e1.setAttribute("sql:field", "EnumName"); + s1e1.setAttribute("name", "EnumName"); + s1e1.setAttribute("type", "xsd:string"); + + SOAPElement s1e2 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e2.setAttribute("sql:field", "EnumDescription"); + s1e2.setAttribute("name", "EnumDescription"); + s1e2.setAttribute("type", "xsd:string"); + s1e2.setAttribute("minOccurs", "0"); + + SOAPElement s1e3 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e3.setAttribute("sql:field", "EnumType"); + s1e3.setAttribute("name", "EnumType"); + s1e3.setAttribute("type", "xsd:string"); + + SOAPElement s1e4 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e4.setAttribute("sql:field", "ElementName"); + s1e4.setAttribute("name", "ElementName"); + s1e4.setAttribute("type", "xsd:string"); + + SOAPElement s1e5 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e5.setAttribute("sql:field", "ElementDescription"); + s1e5.setAttribute("name", "ElementDescription"); + s1e5.setAttribute("type", "xsd:string"); + s1e5.setAttribute("minOccurs", "0"); + + SOAPElement s1e6 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e6.setAttribute("sql:field", "ElementValue"); + s1e6.setAttribute("name", "ElementValue"); + s1e6.setAttribute("type", "xsd:string"); + s1e6.setAttribute("minOccurs", "0"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverEnumeratorsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_ENUM_NAME, r.enumName()); + r.enumDescription().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ENUM_DESCRIPTION, v)); + SoapUtil.addChildElement(row, ROW.QN_ENUM_TYPE, r.enumType()); + SoapUtil.addChildElement(row, ROW.QN_ELEMENT_NAME, r.elementName()); + r.elementDescription().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ELEMENT_DESCRIPTION, v)); + r.elementValue().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ELEMENT_VALUE, v)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverHandler.java new file mode 100644 index 0000000..45e09ff --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverHandler.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +@FunctionalInterface +public interface DiscoverHandler { + + void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, SOAPBody responseBody) + throws SOAPException; +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverKeywordsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverKeywordsHandler.java new file mode 100644 index 0000000..6cb747b --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverKeywordsHandler.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.keywords.DiscoverKeywordsRequest; +import org.eclipse.daanse.xmla.api.discover.discover.keywords.DiscoverKeywordsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.keywords.DiscoverKeywordsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.keywords.DiscoverKeywordsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverKeywordsHandler implements DiscoverHandler { + + private static final String KEYWORD = "Keyword"; + + private final DiscoverService discoverService; + + public DiscoverKeywordsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverKeywordsRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverKeywordsRequest request = new DiscoverKeywordsRequestR(properties, restrictions); + List rows = discoverService.discoverKeywords(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverKeywordsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverKeywordsRestrictionsR(Optional.ofNullable(m.get(KEYWORD))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverKeywordsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement ct1 = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct1.setAttribute("name", "row"); + SOAPElement s1 = SoapUtil.addChildElement(ct1, Constants.XSD.QN_SEQUENCE); + SOAPElement s1e1 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e1.setAttribute("sql:field", "Keyword"); + s1e1.setAttribute("name", "Keyword"); + s1e1.setAttribute("type", "xsd:string"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverKeywordsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_KEYWORD, r.keyword()); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverLiteralsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverLiteralsHandler.java new file mode 100644 index 0000000..f8644b4 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverLiteralsHandler.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.literals.DiscoverLiteralsRequest; +import org.eclipse.daanse.xmla.api.discover.discover.literals.DiscoverLiteralsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.literals.DiscoverLiteralsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.literals.DiscoverLiteralsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverLiteralsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public DiscoverLiteralsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverLiteralsRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverLiteralsRequest request = new DiscoverLiteralsRequestR(properties, restrictions); + List rows = discoverService.discoverLiterals(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverLiteralsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverLiteralsRestrictionsR(Optional.ofNullable(m.get(ROW.LITERAL_NAME))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverLiteralsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SOAPElement se1 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se1.setAttribute("sql:field", "LiteralName"); + se1.setAttribute("name", "LiteralName"); + se1.setAttribute("type", "xsd:string"); + + SOAPElement se2 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se2.setAttribute("sql:field", "LiteralValue"); + se2.setAttribute("name", "LiteralValue"); + se2.setAttribute("type", "xsd:string"); + se2.setAttribute("minOccurs", "0"); + + SOAPElement se3 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se3.setAttribute("sql:field", "LiteralInvalidChars"); + se3.setAttribute("name", "LiteralInvalidChars"); + se3.setAttribute("type", "xsd:string"); + se3.setAttribute("minOccurs", "0"); + + SOAPElement se4 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se4.setAttribute("sql:field", "LiteralInvalidStartingChars"); + se4.setAttribute("name", "LiteralInvalidStartingChars"); + se4.setAttribute("type", "xsd:string"); + se4.setAttribute("minOccurs", "0"); + + SOAPElement se5 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se5.setAttribute("sql:field", "LiteralMaxLength"); + se5.setAttribute("name", "LiteralMaxLength"); + se5.setAttribute("type", "xsd:int"); + se5.setAttribute("minOccurs", "0"); + + SOAPElement se6 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se6.setAttribute("sql:field", "LiteralNameEnumValue"); + se6.setAttribute("name", "LiteralNameEnumValue"); + se6.setAttribute("type", "xsd:int"); + se6.setAttribute("minOccurs", "0"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverLiteralsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_LITERAL_NAME, r.literalName()); + SoapUtil.addChildElement(row, ROW.QN_LITERAL_VALUE, r.literalValue()); + SoapUtil.addChildElement(row, ROW.QN_LITERAL_INVALID_CHARS, r.literalInvalidChars()); + SoapUtil.addChildElement(row, ROW.QN_LITERAL_INVALID_STARTING_CHARS, r.literalInvalidStartingChars()); + SoapUtil.addChildElement(row, ROW.QN_LITERAL_MAX_LENGTH, String.valueOf(r.literalMaxLength())); + SoapUtil.addChildElement(row, ROW.QN_LITERAL_NAME_ENUM_VALUE, + String.valueOf(r.literalNameEnumValue().getValue())); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverPropertiesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverPropertiesHandler.java new file mode 100644 index 0000000..fe24b99 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverPropertiesHandler.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROPERTY_NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.RESTRICTION_LIST; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.properties.DiscoverPropertiesRequest; +import org.eclipse.daanse.xmla.api.discover.discover.properties.DiscoverPropertiesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.properties.DiscoverPropertiesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.properties.DiscoverPropertiesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; +import org.w3c.dom.NodeList; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverPropertiesHandler implements DiscoverHandler { + + private static final String UUID_VALUE = "[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}"; + + private final DiscoverService discoverService; + + public DiscoverPropertiesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverPropertiesRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverPropertiesRequest request = new DiscoverPropertiesRequestR(properties, restrictions); + List rows = discoverService.discoverProperties(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverPropertiesRestrictionsR parseRestrictions(SOAPElement restriction) { + 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(pnList); + } + + private 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 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 void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverPropertiesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPElement body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + seRoot.setAttribute("xmlns", "urn:schemas-microsoft-com:xml-analysis:rowset"); + seRoot.setAttribute("xmlns:EX", "urn:schemas-microsoft-com:xml-analysis:exception"); + SOAPElement schema = SoapUtil.addChildElement(seRoot, Constants.XSD.QN_SCHEMA); + schema.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); + schema.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + schema.setAttribute("xmlns", "urn:schemas-microsoft-com:xml-analysis:rowset"); + schema.setAttribute("targetNamespace", ROWSET.NS_URN); + schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); + schema.setAttribute("elementFormDefault", "qualified"); + SOAPElement el = SoapUtil.addChildElement(schema, Constants.XSD.QN_ELEMENT); + el.setAttribute("name", "root"); + SOAPElement ct = SoapUtil.addChildElement(el, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement s = SoapUtil.addChildElement(ct, Constants.XSD.QN_SEQUENCE); + SOAPElement se = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se.setAttribute("name", "row"); + se.setAttribute("type", "row"); + se.setAttribute("minOccurs", "0"); + se.setAttribute("maxOccurs", "unbounded"); + + SOAPElement st = SoapUtil.addChildElement(schema, Constants.XSD.QN_SIMPLE_TYPE); + st.setAttribute("name", "uuid"); + SOAPElement r = SoapUtil.addChildElement(st, Constants.XSD.QN_RESTRICTION); + r.setAttribute("base", "xsd:string"); + SOAPElement p = SoapUtil.addChildElement(r, Constants.XSD.QN_PATTERN); + p.setAttribute("value", UUID_VALUE); + + SOAPElement ct2 = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct2.setAttribute("name", "row"); + SOAPElement s2 = SoapUtil.addChildElement(ct2, Constants.XSD.QN_SEQUENCE); + SOAPElement s2e1 = SoapUtil.addChildElement(s2, Constants.XSD.QN_ELEMENT); + s2e1.setAttribute("sql:field", "PropertyName"); + s2e1.setAttribute("name", "PropertyName"); + s2e1.setAttribute("type", "xsd:string"); + + SOAPElement s2e2 = SoapUtil.addChildElement(s2, Constants.XSD.QN_ELEMENT); + s2e2.setAttribute("sql:field", "PropertyDescription"); + s2e2.setAttribute("name", "PropertyDescription"); + s2e2.setAttribute("type", "xsd:string"); + + SOAPElement s2e3 = SoapUtil.addChildElement(s2, Constants.XSD.QN_ELEMENT); + s2e3.setAttribute("sql:field", "PropertyType"); + s2e3.setAttribute("name", "PropertyType"); + s2e3.setAttribute("type", "xsd:string"); + + SOAPElement s2e4 = SoapUtil.addChildElement(s2, Constants.XSD.QN_ELEMENT); + s2e4.setAttribute("sql:field", "PropertyAccessType"); + s2e4.setAttribute("name", "PropertyAccessType"); + s2e4.setAttribute("type", "xsd:string"); + + SOAPElement s2e5 = SoapUtil.addChildElement(s2, Constants.XSD.QN_ELEMENT); + s2e5.setAttribute("sql:field", "IsRequired"); + s2e5.setAttribute("name", "IsRequired"); + s2e5.setAttribute("type", "xsd:boolean"); + + SOAPElement s2e6 = SoapUtil.addChildElement(s2, Constants.XSD.QN_ELEMENT); + s2e6.setAttribute("sql:field", "Value"); + s2e6.setAttribute("name", "Value"); + s2e6.setAttribute("type", "xsd:string"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverPropertiesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_PROPERTY_NAME_LC, r.propertyName()); + r.propertyDescription().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_DESCRIPTION, v)); + r.propertyType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_TYPE_LC, v)); + SoapUtil.addChildElement(row, ROW.QN_PROPERTY_ACCESS_TYPE, r.propertyAccessType().getValue()); + r.required().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_REQUIRED, String.valueOf(v))); + r.value().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_VALUE, v)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverSchemaRowsetsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverSchemaRowsetsHandler.java new file mode 100644 index 0000000..4b115cd --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverSchemaRowsetsHandler.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.schemarowsets.DiscoverSchemaRowsetsRequest; +import org.eclipse.daanse.xmla.api.discover.discover.schemarowsets.DiscoverSchemaRowsetsResponseRow; +import org.eclipse.daanse.xmla.api.xmla.Restriction; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.schemarowsets.DiscoverSchemaRowsetsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.schemarowsets.DiscoverSchemaRowsetsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverSchemaRowsetsHandler implements DiscoverHandler { + + private static final String UUID_VALUE = "[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}"; + private static final String SCHEMA_NAME_LOW = "SchemaName"; + + private final DiscoverService discoverService; + + public DiscoverSchemaRowsetsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverSchemaRowsetsRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverSchemaRowsetsRequest request = new DiscoverSchemaRowsetsRequestR(properties, restrictions); + List rows = discoverService.discoverSchemaRowsets(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverSchemaRowsetsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverSchemaRowsetsRestrictionsR(Optional.ofNullable(m.get(SCHEMA_NAME_LOW))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverSchemaRowsetsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPElement body) throws SOAPException { + SOAPElement seDiscoverResponse = body.addChildElement(Constants.MSXMLA.QN_DISCOVER_RESPONSE); + SOAPElement seReturn = seDiscoverResponse.addChildElement(Constants.MSXMLA.QN_RETURN); + SOAPElement seRoot = SoapUtil.addChildElement(seReturn, ROWSET.QN_ROOT); + seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); + SOAPElement schema = SoapUtil.addChildElement(seRoot, Constants.XSD.QN_SCHEMA); + schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + schema.setAttribute("xmlns", ROWSET.NS_URN); + schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); + schema.setAttribute("targetNamespace", ROWSET.NS_URN); + schema.setAttribute("elementFormDefault", "qualified"); + SOAPElement el = SoapUtil.addChildElement(schema, Constants.XSD.QN_ELEMENT); + el.setAttribute("name", "root"); + SOAPElement ct = SoapUtil.addChildElement(el, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement s = SoapUtil.addChildElement(ct, Constants.XSD.QN_SEQUENCE); + SOAPElement se = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se.setAttribute("name", "row"); + se.setAttribute("type", "row"); + se.setAttribute("minOccurs", "0"); + se.setAttribute("maxOccurs", "unbounded"); + + SOAPElement st = SoapUtil.addChildElement(schema, Constants.XSD.QN_SIMPLE_TYPE); + st.setAttribute("name", "uuid"); + SOAPElement r = SoapUtil.addChildElement(st, Constants.XSD.QN_RESTRICTION); + r.setAttribute("base", "xsd:string"); + SOAPElement p = SoapUtil.addChildElement(r, Constants.XSD.QN_PATTERN); + p.setAttribute("value", UUID_VALUE); + + SOAPElement ct1 = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct1.setAttribute("name", "row"); + SOAPElement s1 = SoapUtil.addChildElement(ct1, Constants.XSD.QN_SEQUENCE); + SOAPElement s1e1 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e1.setAttribute("sql:field", "SchemaName"); + s1e1.setAttribute("name", "SchemaName"); + s1e1.setAttribute("type", "xsd:string"); + SOAPElement s1e2 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e2.setAttribute("sql:field", "SchemaGuid"); + s1e2.setAttribute("name", "SchemaGuid"); + s1e2.setAttribute("type", "uuid"); + s1e2.setAttribute("minOccurs", "0"); + SOAPElement s1e3 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e3.setAttribute("sql:field", "Restrictions"); + s1e3.setAttribute("name", "Restrictions"); + s1e3.setAttribute("minOccurs", "0"); + s1e3.setAttribute("maxOccurs", "unbounded"); + SOAPElement s1e3ct = SoapUtil.addChildElement(s1e3, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement s1e3cts = SoapUtil.addChildElement(s1e3ct, Constants.XSD.QN_SEQUENCE); + SOAPElement s1e3ctse1 = SoapUtil.addChildElement(s1e3cts, Constants.XSD.QN_ELEMENT); + s1e3ctse1.setAttribute("name", "Name"); + s1e3ctse1.setAttribute("type", "xsd:string"); + s1e3ctse1.setAttribute("sql:field", "Name"); + SOAPElement s1e3ctse2 = SoapUtil.addChildElement(s1e3cts, Constants.XSD.QN_ELEMENT); + s1e3ctse2.setAttribute("name", "Type"); + s1e3ctse2.setAttribute("type", "xsd:string"); + s1e3ctse2.setAttribute("sql:field", "Type"); + + SOAPElement s1e4 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e4.setAttribute("sql:field", "Description"); + s1e4.setAttribute("name", "Description"); + s1e4.setAttribute("type", "xsd:string"); + s1e4.setAttribute("minOccurs", "0"); + + SOAPElement s1e5 = SoapUtil.addChildElement(s1, Constants.XSD.QN_ELEMENT); + s1e5.setAttribute("sql:field", "RestrictionsMask"); + s1e5.setAttribute("name", "RestrictionsMask"); + s1e5.setAttribute("type", "xsd:unsignedLong"); + s1e5.setAttribute("minOccurs", "0"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverSchemaRowsetsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME_LC, r.schemaName()); + r.schemaGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_GUID, v)); + r.restrictions().ifPresent(v -> addRestrictionList(row, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION_LC, v)); + r.restrictionsMask().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_RESTRICTIONS_MASK, String.valueOf(v))); + } + + private void addRestrictionList(SOAPElement el, List list) { + if (list != null) { + list.forEach(it -> addRestriction(el, it)); + } + } + + private void addRestriction(SOAPElement e, Restriction it) { + if (it != null) { + SOAPElement el = SoapUtil.addChildElement(e, ROW.QN_RESTRICTIONS); + SOAPElement name = SoapUtil.addChildElement(el, ROW.QN_NAME_LC); + name.setTextContent(it.name()); + SOAPElement type = SoapUtil.addChildElement(el, ROW.QN_TYPE_LC); + type.setTextContent(it.type()); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverXmlMetaDataHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverXmlMetaDataHandler.java new file mode 100644 index 0000000..3db5126 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverXmlMetaDataHandler.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import javax.xml.parsers.ParserConfigurationException; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.ObjectExpansionEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata.DiscoverXmlMetaDataRequest; +import org.eclipse.daanse.xmla.api.discover.discover.xmlmetadata.DiscoverXmlMetaDataResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.discover.xmlmetadata.DiscoverXmlMetaDataRequestR; +import org.eclipse.daanse.xmla.model.record.discover.discover.xmlmetadata.DiscoverXmlMetaDataRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaSoapException; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; +import org.xml.sax.SAXException; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class DiscoverXmlMetaDataHandler implements DiscoverHandler { + + private static final String OBJECT_TYPE = "ObjectType"; + private static final String DATABASE_ID = "DatabaseID"; + private static final String DIMENSION_ID = "DimensionID"; + private static final String CUBE_ID = "CubeID"; + private static final String MEASURE_GROUP_ID = "MeasureGroupID"; + private static final String PARTITION_ID = "PartitionID"; + private static final String PERSPECTIVE_ID = "PerspectiveID"; + private static final String DIMENSION_PERMISSION_ID = "DimensionPermissionID"; + private static final String ROLE_ID = "RoleID"; + private static final String DATABASE_PERMISSION_ID = "DatabasePermissionID"; + private static final String MINING_MODEL_ID = "MiningModelID"; + private static final String MINING_MODEL_PERMISSION_ID = "MiningModelPermissionID"; + private static final String DATA_SOURCE_ID = "DataSourceID"; + private static final String MINING_STRUCTURE_ID = "MiningStructureID"; + private static final String AGGREGATION_DESIGN_ID = "AggregationDesignID"; + private static final String TRACE_ID = "TraceID"; + private static final String MINING_STRUCTURE_PERMISSION_ID = "MiningStructurePermissionID"; + private static final String CUBE_PERMISSION_ID = "CubePermissionID"; + private static final String ASSEMBLY_ID = "AssemblyID"; + private static final String MDX_SCRIPT_ID = "MdxScriptID"; + private static final String DATA_SOURCE_VIEW_ID = "DataSourceViewID"; + private static final String DATA_SOURCE_PERMISSION_ID = "DataSourcePermissionID"; + private static final String OBJECT_EXPANSION = "ObjectExpansion"; + + private final DiscoverService discoverService; + + public DiscoverXmlMetaDataHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + DiscoverXmlMetaDataRestrictionsR restrictions = parseRestrictions(restrictionElement); + DiscoverXmlMetaDataRequest request = new DiscoverXmlMetaDataRequestR(properties, restrictions); + List rows = discoverService.xmlMetaData(request, metaData); + writeResponse(rows, responseBody); + } + + private DiscoverXmlMetaDataRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new DiscoverXmlMetaDataRestrictionsR(Optional.ofNullable(m.get(OBJECT_TYPE)), + Optional.ofNullable(m.get(DATABASE_ID)), Optional.ofNullable(m.get(DIMENSION_ID)), + Optional.ofNullable(m.get(CUBE_ID)), Optional.ofNullable(m.get(MEASURE_GROUP_ID)), + Optional.ofNullable(m.get(PARTITION_ID)), Optional.ofNullable(m.get(PERSPECTIVE_ID)), + Optional.ofNullable(m.get(DIMENSION_PERMISSION_ID)), Optional.ofNullable(m.get(ROLE_ID)), + Optional.ofNullable(m.get(DATABASE_PERMISSION_ID)), Optional.ofNullable(m.get(MINING_MODEL_ID)), + Optional.ofNullable(m.get(MINING_MODEL_PERMISSION_ID)), Optional.ofNullable(m.get(DATA_SOURCE_ID)), + Optional.ofNullable(m.get(MINING_STRUCTURE_ID)), Optional.ofNullable(m.get(AGGREGATION_DESIGN_ID)), + Optional.ofNullable(m.get(TRACE_ID)), Optional.ofNullable(m.get(MINING_STRUCTURE_PERMISSION_ID)), + Optional.ofNullable(m.get(CUBE_PERMISSION_ID)), Optional.ofNullable(m.get(ASSEMBLY_ID)), + Optional.ofNullable(m.get(MDX_SCRIPT_ID)), Optional.ofNullable(m.get(DATA_SOURCE_VIEW_ID)), + Optional.ofNullable(m.get(DATA_SOURCE_PERMISSION_ID)), + Optional.ofNullable(ObjectExpansionEnum.fromValue(m.get(OBJECT_EXPANSION)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (DiscoverXmlMetaDataResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement el1complexType = SoapUtil.addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + el1complexType.setAttribute("name", "xmlDocument"); + SOAPElement sequence = SoapUtil.addChildElement(el1complexType, Constants.XSD.QN_SEQUENCE); + SoapUtil.addChildElement(sequence, Constants.XSD.QN_ANY); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "METADATA", "xmlDocument", null); + return seRoot; + } + + private void addResponseRow(SOAPElement root, DiscoverXmlMetaDataResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + addChildElementTextNode(row, r.metaData()); + } + + private void addChildElementTextNode(SOAPElement element, String valueOfChild) { + try { + SOAPElement createdChild = element.addChildElement(ROW.QN_META_DATA); + createdChild.setAttribute("xmlns", "http://schemas.microsoft.com/analysisservices/2003/engine"); + createdChild.setAttribute("xmlns:ddl2", "http://schemas.microsoft.com/analysisservices/2003/engine/2"); + createdChild.setAttribute("xmlns:ddl2_2", "http://schemas.microsoft.com/analysisservices/2003/engine/2/2"); + createdChild.setAttribute("xmlns:ddl100", "http://schemas.microsoft.com/analysisservices/2008/engine/100"); + createdChild.setAttribute("xmlns:ddl100_100", + "http://schemas.microsoft.com/analysisservices/2008/engine/100/100"); + createdChild.setAttribute("xmlns:ddl200", "http://schemas.microsoft.com/analysisservices/2010/engine/200"); + createdChild.setAttribute("xmlns:ddl200_200", + "http://schemas.microsoft.com/analysisservices/2010/engine/200/200"); + createdChild.setAttribute("xmlns:ddl300", "http://schemas.microsoft.com/analysisservices/2011/engine/300"); + createdChild.setAttribute("xmlns:ddl300_300", + "http://schemas.microsoft.com/analysisservices/2011/engine/300/300"); + createdChild.setAttribute("xmlns:ddl400", "http://schemas.microsoft.com/analysisservices/2012/engine/400"); + createdChild.setAttribute("xmlns:ddl400_400", + "http://schemas.microsoft.com/analysisservices/2012/engine/400/400"); + if (valueOfChild != null && !valueOfChild.isEmpty()) { + SOAPElement se = SoapUtil.xmlStringToSoapElement(valueOfChild, createdChild); + createdChild.addChildElement(se); + } + } catch (SOAPException | SAXException | IOException | ParserConfigurationException e) { + throw new XmlaSoapException("addChildElementTextNode error", e); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaActionsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaActionsHandler.java new file mode 100644 index 0000000..798c277 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaActionsHandler.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CoordinateTypeEnum; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.InvocationEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.actions.MdSchemaActionsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.actions.MdSchemaActionsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.actions.MdSchemaActionsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.actions.MdSchemaActionsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaActionsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public MdSchemaActionsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaActionsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaActionsRequest request = new MdSchemaActionsRequestR(properties, restrictions); + List rows = discoverService.mdSchemaActions(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaActionsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaActionsRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), m.get(ROW.CUBE_NAME), + Optional.ofNullable(m.get(ROW.ACTION_NAME)), + // Optional.ofNullable(ActionTypeEnum.fromValue(m.get(ACTION_TYPE))), //wrong + // value from excel + Optional.empty(), Optional.ofNullable(m.get(ROW.COORDINATE)), + CoordinateTypeEnum.fromValue(m.get(ROW.COORDINATE_TYPE)), + m.get(ROW.INVOCATION) == null ? null : InvocationEnum.fromValue(m.get(ROW.INVOCATION)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(ROW.CUBE_SOURCE)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaActionsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "ACTION_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "ACTION_TYPE", "xsd:int", "0"); + SoapUtil.addElement(s, "COORDINATE", "xsd:string", "0"); + SoapUtil.addElement(s, "COORDINATE_TYPE", "xsd:int", "0"); + SoapUtil.addElement(s, "ACTION_CAPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "CONTENT", "xsd:string", "0"); + SoapUtil.addElement(s, "APPLICATION", "xsd:string", "0"); + SoapUtil.addElement(s, "INVOCATION", "xsd:int", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaActionsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, r.cubeName()); + r.actionName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ACTION_NAME, v)); + r.actionType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ACTION_TYPE, String.valueOf(v.getValue()))); + SoapUtil.addChildElement(row, ROW.QN_COORDINATE, r.coordinate()); + SoapUtil.addChildElement(row, ROW.QN_COORDINATE_TYPE, String.valueOf(r.coordinateType().getValue())); + r.actionCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ACTION_CAPTION, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.content().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CONTENT, v)); + r.application().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_APPLICATION, v)); + r.invocation().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_INVOCATION, String.valueOf(v.getValue()))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaCubesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaCubesHandler.java new file mode 100644 index 0000000..c8d51ea --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaCubesHandler.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.time.format.DateTimeFormatter; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.CubeTypeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.cubes.MdSchemaCubesRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.cubes.MdSchemaCubesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.cubes.MdSchemaCubesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.cubes.MdSchemaCubesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaCubesHandler implements DiscoverHandler { + + private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"); + + private final DiscoverService discoverService; + + public MdSchemaCubesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaCubesRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaCubesRequest request = new MdSchemaCubesRequestR(properties, restrictions); + List rows = discoverService.mdSchemaCubes(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaCubesRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaCubesRestrictionsR(m.get(ROW.CATALOG_NAME), Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), + Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(CubeTypeEnum.fromValue(m.get(ROW.CUBE_TYPE))), + Optional.ofNullable(m.get(ROW.BASE_CUBE_NAME)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(ROW.CUBE_SOURCE)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaCubesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + + SOAPElement se1 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se1.setAttribute("sql:field", "CATALOG_NAME"); + se1.setAttribute("name", "CATALOG_NAME"); + se1.setAttribute("type", "xsd:string"); + se1.setAttribute("minOccurs", "0"); + + SOAPElement se2 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se2.setAttribute("sql:field", "SCHEMA_NAME"); + se2.setAttribute("name", "SCHEMA_NAME"); + se2.setAttribute("type", "xsd:string"); + se2.setAttribute("minOccurs", "0"); + + SOAPElement se3 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se3.setAttribute("sql:field", "CUBE_NAME"); + se3.setAttribute("name", "CUBE_NAME"); + se3.setAttribute("type", "xsd:string"); + + SOAPElement se4 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se4.setAttribute("sql:field", "CUBE_TYPE"); + se4.setAttribute("name", "CUBE_TYPE"); + se4.setAttribute("type", "xsd:string"); + + SOAPElement se5 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se5.setAttribute("sql:field", "CUBE_GUID"); + se5.setAttribute("name", "CUBE_GUID"); + se5.setAttribute("type", "uuid"); + se5.setAttribute("minOccurs", "0"); + + SOAPElement se6 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se6.setAttribute("sql:field", "CREATED_ON"); + se6.setAttribute("name", "CREATED_ON"); + se6.setAttribute("type", "xsd:dateTime"); + se6.setAttribute("minOccurs", "0"); + + SOAPElement se7 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se7.setAttribute("sql:field", "LAST_SCHEMA_UPDATE"); + se7.setAttribute("name", "LAST_SCHEMA_UPDATE"); + se7.setAttribute("type", "xsd:dateTime"); + se7.setAttribute("minOccurs", "0"); + + SOAPElement se8 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se8.setAttribute("sql:field", "SCHEMA_UPDATED_BY"); + se8.setAttribute("name", "SCHEMA_UPDATED_BY"); + se8.setAttribute("type", "xsd:string"); + se8.setAttribute("minOccurs", "0"); + + SOAPElement se9 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se9.setAttribute("sql:field", "LAST_DATA_UPDATE"); + se9.setAttribute("name", "LAST_DATA_UPDATE"); + se9.setAttribute("type", "xsd:dateTime"); + se9.setAttribute("minOccurs", "0"); + + SOAPElement se10 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se10.setAttribute("sql:field", "DATA_UPDATED_BY"); + se10.setAttribute("name", "DATA_UPDATED_BY"); + se10.setAttribute("type", "xsd:string"); + se10.setAttribute("minOccurs", "0"); + + SOAPElement se11 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se11.setAttribute("sql:field", "DESCRIPTION"); + se11.setAttribute("name", "DESCRIPTION"); + se11.setAttribute("type", "xsd:string"); + se11.setAttribute("minOccurs", "0"); + + SOAPElement se12 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se12.setAttribute("sql:field", "IS_DRILLTHROUGH_ENABLED"); + se12.setAttribute("name", "IS_DRILLTHROUGH_ENABLED"); + se12.setAttribute("type", "xsd:boolean"); + + SOAPElement se13 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se13.setAttribute("sql:field", "IS_LINKABLE"); + se13.setAttribute("name", "IS_LINKABLE"); + se13.setAttribute("type", "xsd:boolean"); + + SOAPElement se14 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se14.setAttribute("sql:field", "IS_WRITE_ENABLED"); + se14.setAttribute("name", "IS_WRITE_ENABLED"); + se14.setAttribute("type", "xsd:boolean"); + + SOAPElement se15 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se15.setAttribute("sql:field", "IS_SQL_ENABLED"); + se15.setAttribute("name", "IS_SQL_ENABLED"); + se15.setAttribute("type", "xsd:boolean"); + + SOAPElement se16 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se16.setAttribute("sql:field", "CUBE_CAPTION"); + se16.setAttribute("name", "CUBE_CAPTION"); + se16.setAttribute("type", "xsd:string"); + se16.setAttribute("minOccurs", "0"); + + SOAPElement se17 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se17.setAttribute("sql:field", "BASE_CUBE_NAME"); + se17.setAttribute("name", "BASE_CUBE_NAME"); + se17.setAttribute("type", "xsd:string"); + se17.setAttribute("minOccurs", "0"); + + SOAPElement se18 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se18.setAttribute("sql:field", "DIMENSIONS"); + se18.setAttribute("name", "DIMENSIONS"); + se18.setAttribute("minOccurs", "0"); + + SOAPElement se19 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se19.setAttribute("sql:field", "SETS"); + se19.setAttribute("name", "SETS"); + se19.setAttribute("minOccurs", "0"); + + SOAPElement se20 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se20.setAttribute("sql:field", "MEASURES"); + se20.setAttribute("name", "MEASURES"); + se20.setAttribute("minOccurs", "0"); + + SOAPElement se21 = SoapUtil.addChildElement(s, Constants.XSD.QN_ELEMENT); + se21.setAttribute("sql:field", "CUBE_SOURCE"); + se21.setAttribute("name", "CUBE_SOURCE"); + se21.setAttribute("type", "xsd:int"); + se21.setAttribute("minOccurs", "0"); + + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaCubesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, r.catalogName()); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + + r.cubeType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_TYPE, v.name())); + r.cubeGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_GUID, String.valueOf(v))); + r.createdOn().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CREATED_ON, v.format(formatter))); + r.lastSchemaUpdate() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LAST_SCHEMA_UPDATE, v.format(formatter))); + r.schemaUpdatedBy().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_UPDATED_BY, v)); + r.lastDataUpdate().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LAST_DATA_UPDATE, v.format(formatter))); + r.dataUpdateDBy().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_UPDATED_BY, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.isDrillThroughEnabled() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_DRILLTHROUGH_ENABLED, String.valueOf(v))); + r.isLinkable().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_LINKABLE, String.valueOf(v))); + r.isWriteEnabled().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_WRITE_ENABLED, String.valueOf(v))); + r.isSqlEnabled().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_SQL_ENABLED, String.valueOf(v))); + r.cubeCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_CAPTION, v)); + r.baseCubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_BASE_CUBE_NAME, v)); + r.cubeSource().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_SOURCE, String.valueOf(v.getValue()))); + r.preferredQueryPatterns().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_PREFERRED_QUERY_PATTERNS, String.valueOf(v.getValue()))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaDimensionsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaDimensionsHandler.java new file mode 100644 index 0000000..b53c5f1 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaDimensionsHandler.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.demensions.MdSchemaDimensionsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.demensions.MdSchemaDimensionsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.demensions.MdSchemaDimensionsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.demensions.MdSchemaDimensionsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaDimensionsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public MdSchemaDimensionsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaDimensionsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaDimensionsRequest request = new MdSchemaDimensionsRequestR(properties, restrictions); + List rows = discoverService.mdSchemaDimensions(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaDimensionsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaDimensionsRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.DIMENSION_NAME)), Optional.ofNullable(m.get(ROW.DIMENSION_UNIQUE_NAME)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(ROW.CUBE_SOURCE))), + Optional.ofNullable(VisibilityEnum.fromValue(m.get(ROW.DIMENSION_VISIBILITY)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaDimensionsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_GUID", "uuid", "0"); + SoapUtil.addElement(s, "DIMENSION_CAPTION", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_ORDINAL", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "DIMENSION_TYPE", "xsd:short", null); + SoapUtil.addElement(s, "DIMENSION_CARDINALITY", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "DEFAULT_HIERARCHY", "xsd:string", null); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "IS_VIRTUAL", "xsd:boolean", "0"); + SoapUtil.addElement(s, "IS_READWRITE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_SETTINGS", "xsd:int", "0"); + SoapUtil.addElement(s, "DIMENSION_MASTER_UNIQUE_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "DIMENSION_IS_VISIBLE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "HIERARCHIES", null, "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaDimensionsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.dimensionName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_NAME, v)); + r.dimensionUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_NAME, v)); + r.dimensionGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_GUID, String.valueOf(v))); + r.dimensionCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_CAPTION, v)); + r.dimensionOptional() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_ORDINAL, String.valueOf(v))); + r.dimensionType() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_TYPE, String.valueOf(v.getValue()))); + r.dimensionCardinality() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_CARDINALITY, String.valueOf(v))); + r.defaultHierarchy().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DEFAULT_HIERARCHY, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.isVirtual().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_VIRTUAL, String.valueOf(v))); + r.isReadWrite().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_READWRITE, String.valueOf(v))); + r.dimensionUniqueSetting().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_SETTINGS, String.valueOf(v.getValue()))); + r.dimensionMasterName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_MASTER_NAME, v)); + r.dimensionIsVisible() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_IS_VISIBLE, String.valueOf(v))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaFunctionsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaFunctionsHandler.java new file mode 100644 index 0000000..fb84f08 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaFunctionsHandler.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.InterfaceNameEnum; +import org.eclipse.daanse.xmla.api.common.enums.OriginEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.functions.MdSchemaFunctionsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.functions.MdSchemaFunctionsResponseRow; +import org.eclipse.daanse.xmla.api.discover.mdschema.functions.ParameterInfo; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.functions.MdSchemaFunctionsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.functions.MdSchemaFunctionsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaFunctionsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public MdSchemaFunctionsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaFunctionsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaFunctionsRequest request = new MdSchemaFunctionsRequestR(properties, restrictions); + List rows = discoverService.mdSchemaFunctions(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaFunctionsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaFunctionsRestrictionsR(Optional.ofNullable(m.get(ROW.FUNCTION_NAME)), + Optional.ofNullable(OriginEnum.fromValue(m.get(ROW.ORIGIN))), + Optional.ofNullable(InterfaceNameEnum.fromValue(m.get(ROW.INTERFACE_NAME))), + Optional.ofNullable(m.get(ROW.LIBRARY_NAME))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaFunctionsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "FUNCTION_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "PARAMETER_LIST", "xsd:string", "0"); + SoapUtil.addElement(s, "RETURN_TYPE", "xsd:int", null); + SoapUtil.addElement(s, "ORIGIN", "xsd:int", null); + SoapUtil.addElement(s, "INTERFACE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LIBRARY_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CAPTION", "xsd:string", "0"); + return seRoot; + } + + @SuppressWarnings("deprecation") + private void addResponseRow(SOAPElement root, MdSchemaFunctionsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.functionalName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_FUNCTION_NAME, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + SoapUtil.addChildElement(row, ROW.QN_PARAMETER_LIST, r.parameterList()); + r.returnType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_RETURN_TYPE, String.valueOf(v))); + r.origin().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ORIGIN, String.valueOf(v.getValue()))); + r.interfaceName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_INTERFACE_NAME, v.name())); + r.libraryName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LIBRARY_NAME, v)); + r.dllName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DLL_NAME, v)); + r.helpFile().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HELP_FILE, v)); + r.helpContext().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HELP_CONTEXT, v)); + r.object().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_OBJECT, v)); + r.caption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CAPTION, v)); + r.parameterInfo().ifPresent(v -> addParameterInfoList(row, v)); + r.directQueryPushable().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_DIRECTQUERY_PUSHABLE, String.valueOf(v.getValue()))); + } + + private void addParameterInfoList(SOAPElement root, List list) { + if (list != null) { + list.forEach(it -> addParameterInfo(root, it)); + } + } + + private void addParameterInfo(SOAPElement root, ParameterInfo it) { + SOAPElement el = SoapUtil.addChildElement(root, ROW.QN_PARAMETERINFO); + SoapUtil.addChildElement(el, ROW.QN_NAME_LC, it.name()); + SoapUtil.addChildElement(el, ROW.QN_DESCRIPTION_LC, it.description()); + SoapUtil.addChildElement(el, ROW.QN_OPTIONAL, String.valueOf(it.optional())); + SoapUtil.addChildElement(el, ROW.QN_REPEATABLE, String.valueOf(it.repeatable())); + SoapUtil.addChildElement(el, ROW.QN_REPEATGROUP, String.valueOf(it.repeatGroup())); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaHierarchiesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaHierarchiesHandler.java new file mode 100644 index 0000000..965a759 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaHierarchiesHandler.java @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies.MdSchemaHierarchiesRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.hierarchies.MdSchemaHierarchiesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.hierarchies.MdSchemaHierarchiesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.hierarchies.MdSchemaHierarchiesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaHierarchiesHandler implements DiscoverHandler { + + private static final String CUBE_SOURCE = "CUBE_SOURCE"; + private static final String HIERARCHY_VISIBILITY = "HIERARCHY_VISIBILITY"; + + private final DiscoverService discoverService; + + public MdSchemaHierarchiesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaHierarchiesRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaHierarchiesRequest request = new MdSchemaHierarchiesRequestR(properties, restrictions); + List rows = discoverService.mdSchemaHierarchies(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaHierarchiesRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaHierarchiesRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.DIMENSION_UNIQUE_NAME)), Optional.ofNullable(m.get(ROW.HIERARCHY_NAME)), + Optional.ofNullable(m.get(ROW.HIERARCHY_UNIQUE_NAME)), + Optional.ofNullable(toInt(m.get(ROW.HIERARCHY_ORIGIN))), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), + Optional.ofNullable(VisibilityEnum.fromValue(m.get(HIERARCHY_VISIBILITY)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaHierarchiesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "HIERARCHY_NAME", "xsd:string", null); + SoapUtil.addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "HIERARCHY_GUID", "uuid", "0"); + SoapUtil.addElement(s, "HIERARCHY_CAPTION", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_TYPE", "xsd:short", null); + SoapUtil.addElement(s, "HIERARCHY_CARDINALITY", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "DEFAULT_MEMBER", "xsd:string", "0"); + SoapUtil.addElement(s, "ALL_MEMBER", "xsd:string", "0"); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "STRUCTURE", "xsd:short", null); + SoapUtil.addElement(s, "IS_VIRTUAL", "xsd:boolean", null); + SoapUtil.addElement(s, "IS_READWRITE", "xsd:boolean", null); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_SETTINGS", "xsd:int", null); + SoapUtil.addElement(s, "DIMENSION_IS_VISIBLE", "xsd:boolean", null); + SoapUtil.addElement(s, "HIERARCHY_ORDINAL", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "DIMENSION_IS_SHARED", "xsd:boolean", null); + SoapUtil.addElement(s, "HIERARCHY_IS_VISIBLE", "xsd:boolean", null); + SoapUtil.addElement(s, "HIERARCHY_ORIGIN", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "HIERARCHY_DISPLAY_FOLDER", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "HIERARCHY_VISIBILITY", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "PARENT_CHILD", "xsd:boolean", "0"); + SoapUtil.addElement(s, "LEVELS", null, "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaHierarchiesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.dimensionUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_NAME, v)); + r.hierarchyName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_NAME, v)); + r.hierarchyUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_UNIQUE_NAME, v)); + r.hierarchyGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_GUID, String.valueOf(v))); + r.hierarchyCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_CAPTION, v)); + r.dimensionType() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_TYPE, String.valueOf(v.getValue()))); + r.hierarchyCardinality() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_CARDINALITY, String.valueOf(v))); + r.defaultMember().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DEFAULT_MEMBER, v)); + r.allMember().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ALL_MEMBER, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.structure().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_STRUCTURE, String.valueOf(v.getValue()))); + r.isVirtual().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_VIRTUAL, String.valueOf(v))); + r.isReadWrite().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_READWRITE, String.valueOf(v))); + r.dimensionUniqueSettings().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_SETTINGS, String.valueOf(v.getValue()))); + r.dimensionMasterUniqueName() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_MASTER_UNIQUE_NAME, v)); + r.dimensionIsVisible() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_IS_VISIBLE, String.valueOf(v))); + r.hierarchyOrdinal().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_ORDINAL, String.valueOf(v))); + r.dimensionIsShared() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_IS_SHARED, String.valueOf(v))); + r.hierarchyIsVisible() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_IS_VISIBLE, String.valueOf(v))); + r.hierarchyOrigin() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_ORIGIN, String.valueOf(v.getValue()))); + r.hierarchyDisplayFolder().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_DISPLAY_FOLDER, v)); + r.instanceSelection() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_INSTANCE_SELECTION, String.valueOf(v.getValue()))); + r.groupingBehavior() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_GROUPING_BEHAVIOR, String.valueOf(v.getValue()))); + r.structureType() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_STRUCTURE_TYPE, String.valueOf(v.getValue()))); + } + + private static Integer toInt(String s) { + if (s == null) { + return null; + } + return Integer.valueOf(s); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaKpisHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaKpisHandler.java new file mode 100644 index 0000000..0779386 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaKpisHandler.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.kpis.MdSchemaKpisRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.kpis.MdSchemaKpisResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.kpis.MdSchemaKpisRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.kpis.MdSchemaKpisRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaKpisHandler implements DiscoverHandler { + + private static final String CUBE_SOURCE = "CUBE_SOURCE"; + + private final DiscoverService discoverService; + + public MdSchemaKpisHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaKpisRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaKpisRequest request = new MdSchemaKpisRequestR(properties, restrictions); + List rows = discoverService.mdSchemaKpis(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaKpisRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaKpisRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.KPI_NAME)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaKpisResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_NAME", "xsd:string", null); + SoapUtil.addElement(s, "KPI_CAPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_DISPLAY_FOLDER", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_VALUE", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_GOAL", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_STATUS", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_TREND", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_STATUS_GRAPHIC", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_TREND_GRAPHIC", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_WEIGHT", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_CURRENT_TIME_MEMBER", "xsd:string", "0"); + SoapUtil.addElement(s, "KPI_PARENT_KPI_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCOPE", "xsd:int", null); + SoapUtil.addElement(s, "ANNOTATIONS", "xsd:string", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaKpisResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.measureGroupName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASUREGROUP_NAME, v)); + r.kpiName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_NAME, v)); + r.kpiCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_CAPTION, v)); + r.kpiDescription().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_DESCRIPTION, v)); + r.kpiDisplayFolder().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_DISPLAY_FOLDER, v)); + r.kpiValue().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_VALUE, v)); + r.kpiGoal().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_GOAL, v)); + r.kpiStatus().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_STATUS, v)); + r.kpiTrend().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_TREND, v)); + r.kpiStatusGraphic().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_STATUS_GRAPHIC, v)); + r.kpiTrendGraphic().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_TREND_GRAPHIC, v)); + r.kpiWight().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_WEIGHT, v)); + r.kpiCurrentTimeMember().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_CURRENT_TIME_MEMBER, v)); + r.kpiParentKpiName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_KPI_PARENT_KPI_NAME, v)); + r.scope().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCOPE, String.valueOf(v.getValue()))); + r.annotation().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_ANNOTATIONS, v)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaLevelsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaLevelsHandler.java new file mode 100644 index 0000000..eb3b518 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaLevelsHandler.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.levels.MdSchemaLevelsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.levels.MdSchemaLevelsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.levels.MdSchemaLevelsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.levels.MdSchemaLevelsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaLevelsHandler implements DiscoverHandler { + + private static final String DIMENSION_VISIBILITY = "DIMENSION_VISIBILITY"; + + private final DiscoverService discoverService; + + public MdSchemaLevelsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaLevelsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaLevelsRequest request = new MdSchemaLevelsRequestR(properties, restrictions); + List rows = discoverService.mdSchemaLevels(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaLevelsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaLevelsRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.DIMENSION_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.HIERARCHY_UNIQUE_NAME)), Optional.ofNullable(m.get(ROW.LEVEL_NAME)), + Optional.ofNullable(m.get(ROW.LEVEL_UNIQUE_NAME)), Optional.empty(), Optional.empty(), + Optional.ofNullable(VisibilityEnum.fromValue(m.get(DIMENSION_VISIBILITY)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaLevelsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_GUID", "uuid", "0"); + SoapUtil.addElement(s, "LEVEL_CAPTION", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_NUMBER", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "LEVEL_CARDINALITY", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "LEVEL_TYPE", "xsd:int", null); + SoapUtil.addElement(s, "CUSTOM_ROLLUP_SETTINGS", "xsd:int", null); + SoapUtil.addElement(s, "LEVEL_UNIQUE_SETTINGS", "xsd:int", null); + SoapUtil.addElement(s, "LEVEL_IS_VISIBLE", "xsd:boolean", null); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "LEVEL_ORIGIN", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "LEVEL_VISIBILITY", "xsd:unsignedShort", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaLevelsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.dimensionUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_NAME, v)); + r.hierarchyUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_UNIQUE_NAME, v)); + r.levelName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_NAME, v)); + r.levelUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_UNIQUE_NAME, v)); + r.levelGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_GUID, String.valueOf(v))); + r.levelCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_CAPTION, v)); + r.levelNumber().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_NUMBER, String.valueOf(v))); + r.levelCardinality().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_CARDINALITY, String.valueOf(v))); + r.levelType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_TYPE, String.valueOf(v.getValue()))); + r.customRollupSetting().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_CUSTOM_ROLLUP_SETTINGS, String.valueOf(v.getValue()))); + r.levelUniqueSettings().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_UNIQUE_SETTINGS, String.valueOf(v.getValue()))); + r.levelIsVisible().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_IS_VISIBLE, String.valueOf(v))); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.levelOrigin() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_ORIGIN, String.valueOf(v.getValue()))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasureGroupDimensionsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasureGroupDimensionsHandler.java new file mode 100644 index 0000000..eb7e1a0 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasureGroupDimensionsHandler.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsResponseRow; +import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroupdimensions.MeasureGroupDimension; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroupdimensions.MdSchemaMeasureGroupDimensionsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaMeasureGroupDimensionsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public MdSchemaMeasureGroupDimensionsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaMeasureGroupDimensionsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaMeasureGroupDimensionsRequest request = new MdSchemaMeasureGroupDimensionsRequestR(properties, + restrictions); + List rows = discoverService.mdSchemaMeasureGroupDimensions(request, + metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaMeasureGroupDimensionsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaMeasureGroupDimensionsRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.DIMENSION_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.MEASUREGROUP_NAME)), + Optional.ofNullable(VisibilityEnum.fromValue(m.get(ROW.DIMENSION_VISIBILITY)))); + } + + private void writeResponse(List rows, SOAPBody body) + throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaMeasureGroupDimensionsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "MEASUREGROUP_CARDINALITY", "xsd:string", "0"); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "DIMENSION_CARDINALITY", "xsd:string", "0"); + SoapUtil.addElement(s, "DIMENSION_IS_VISIBLE", "xsd:boolean", "0"); + SoapUtil.addElement(s, "DIMENSION_IS_FACT_DIMENSION", "xsd:boolean", "0"); + SoapUtil.addElement(s, "DIMENSION_PATH", "xsd:string", "0"); + SoapUtil.addElement(s, "DIMENSION_GRANULARITY", "xsd:string", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaMeasureGroupDimensionsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + + r.measureGroupName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASUREGROUP_NAME, v)); + r.measureGroupCardinality().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASUREGROUP_CARDINALITY, v)); + r.dimensionUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_NAME, v)); + r.dimensionCardinality().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_CARDINALITY, v.name())); + r.dimensionIsVisible() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_IS_VISIBLE, String.valueOf(v))); + r.dimensionIsFactDimension() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_IS_FACT_DIMENSION, String.valueOf(v))); + r.dimensionPath().ifPresent(v -> addMeasureGroupDimensionList(row, v)); + r.dimensionGranularity().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_GRANULARITY, v)); + } + + private void addMeasureGroupDimensionList(SOAPElement el, List list) { + if (list != null) { + SOAPElement e = SoapUtil.addChildElement(el, ROW.QN_DIMENSION_PATH); + list.forEach(it -> addMeasureGroupDimension(e, it)); + } + } + + private void addMeasureGroupDimension(SOAPElement el, MeasureGroupDimension it) { + SoapUtil.addChildElement(el, ROW.QN_MEASURE_GROUP_DIMENSION, it.measureGroupDimension()); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasureGroupsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasureGroupsHandler.java new file mode 100644 index 0000000..8fd65ab --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasureGroupsHandler.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.measuregroups.MdSchemaMeasureGroupsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.measuregroups.MdSchemaMeasureGroupsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaMeasureGroupsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public MdSchemaMeasureGroupsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaMeasureGroupsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaMeasureGroupsRequest request = new MdSchemaMeasureGroupsRequestR(properties, restrictions); + List rows = discoverService.mdSchemaMeasureGroups(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaMeasureGroupsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaMeasureGroupsRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.MEASUREGROUP_NAME))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaMeasureGroupsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "IS_WRITE_ENABLED", "xsd:boolean", null); + SoapUtil.addElement(s, "MEASUREGROUP_CAPTION", "xsd:string", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaMeasureGroupsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.measureGroupName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASUREGROUP_NAME, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.isWriteEnabled().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_WRITE_ENABLED, String.valueOf(v))); + r.measureGroupCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASUREGROUP_CAPTION, v)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasuresHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasuresHandler.java new file mode 100644 index 0000000..23d6c6b --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMeasuresHandler.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.measures.MdSchemaMeasuresRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.measures.MdSchemaMeasuresResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.measures.MdSchemaMeasuresRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.measures.MdSchemaMeasuresRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaMeasuresHandler implements DiscoverHandler { + + private static final String CUBE_SOURCE = "CUBE_SOURCE"; + private static final String MEASURE_VISIBILITY = "MEASURE_VISIBILITY"; + + private final DiscoverService discoverService; + + public MdSchemaMeasuresHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaMeasuresRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaMeasuresRequest request = new MdSchemaMeasuresRequestR(properties, restrictions); + List rows = discoverService.mdSchemaMeasures(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaMeasuresRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaMeasuresRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.MEASURE_NAME)), Optional.ofNullable(m.get(ROW.MEASURE_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.MEASUREGROUP_NAME)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), + Optional.ofNullable(VisibilityEnum.fromValue(m.get(MEASURE_VISIBILITY)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaMeasuresResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEASURE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEASURE_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEASURE_CAPTION", "xsd:string", null); + SoapUtil.addElement(s, "MEASURE_GUID", "uuid", "0"); + SoapUtil.addElement(s, "MEASURE_AGGREGATOR", "xsd:int", null); + SoapUtil.addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); + SoapUtil.addElement(s, "MEASURE_IS_VISIBLE", "xsd:boolean", null); + SoapUtil.addElement(s, "LEVELS_LIST", "xsd:string", "0"); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "NUMERIC_PRECISION", "xsd:short", "0"); + SoapUtil.addElement(s, "NUMERIC_SCALE", "xsd:short", "0"); + SoapUtil.addElement(s, "MEASURE_UNITS", "xsd:string", "0"); + SoapUtil.addElement(s, "EXPRESSION", "xsd:string", "0"); + SoapUtil.addElement(s, "MEASURE_NAME_SQL_COLUMN_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "MEASURE_UNQUALIFIED_CAPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "MEASUREGROUP_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "MEASURE_DISPLAY_FOLDER", "xsd:string", "0"); + SoapUtil.addElement(s, "DEFAULT_FORMAT_STRING", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "MEASURE_VISIBILITY", "xsd:unsignedShort", "0"); + return seRoot; + } + + @SuppressWarnings("deprecation") + private void addResponseRow(SOAPElement root, MdSchemaMeasuresResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.measureName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_NAME, v)); + r.measureUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_UNIQUE_NAME, v)); + r.measureCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_CAPTION, v)); + r.measureGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_GUID, String.valueOf(v))); + r.measureAggregator() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_AGGREGATOR, String.valueOf(v.getValue()))); + r.dataType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_TYPE, String.valueOf(v.getValue()))); + r.numericPrecision().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_NUMERIC_PRECISION, String.valueOf(v))); + r.numericScale().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_NUMERIC_SCALE, String.valueOf(v))); + r.measureUnits().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_UNITS, v)); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.expression().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_EXPRESSION, v)); + r.measureIsVisible() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_IS_VISIBLE, String.valueOf(v))); + r.levelsList().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVELS_LIST, v)); + r.measureNameSqlColumnName() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_NAME_SQL_COLUMN_NAME, v)); + r.measureUnqualifiedCaption() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_UNQUALIFIED_CAPTION, v)); + r.measureGroupName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASUREGROUP_NAME, v)); + r.measureDisplayFolder().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEASURE_DISPLAY_FOLDER, v)); + r.defaultFormatString().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DEFAULT_FORMAT_STRING, v)); + r.cubeSource().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_SOURCE, String.valueOf(v.getValue()))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMembersHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMembersHandler.java new file mode 100644 index 0000000..cbf3522 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaMembersHandler.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.MemberTypeEnum; +import org.eclipse.daanse.xmla.api.common.enums.TreeOpEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.members.MdSchemaMembersRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.members.MdSchemaMembersResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.members.MdSchemaMembersRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.members.MdSchemaMembersRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaMembersHandler implements DiscoverHandler { + + private static final String CUBE_SOURCE = "CUBE_SOURCE"; + private static final String TREE_OP = "TREE_OP"; + + private final DiscoverService discoverService; + + public MdSchemaMembersHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaMembersRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaMembersRequest request = new MdSchemaMembersRequestR(properties, restrictions); + List rows = discoverService.mdSchemaMembers(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaMembersRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaMembersRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.DIMENSION_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.HIERARCHY_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.LEVEL_UNIQUE_NAME)), Optional.ofNullable(toInt(m.get(ROW.LEVEL_NUMBER))), + Optional.ofNullable(m.get(ROW.MEMBER_NAME)), Optional.ofNullable(m.get(ROW.MEMBER_UNIQUE_NAME)), + Optional.ofNullable(MemberTypeEnum.fromValue(m.get(ROW.MEMBER_TYPE))), + Optional.ofNullable(m.get(ROW.MEMBER_CAPTION)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), + Optional.ofNullable(TreeOpEnum.fromValue(m.get(TREE_OP)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaMembersResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_NUMBER", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "MEMBER_ORDINAL", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "MEMBER_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEMBER_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEMBER_TYPE", "xsd:int", null); + SoapUtil.addElement(s, "MEMBER_GUID", "uuid", "0"); + SoapUtil.addElement(s, "MEMBER_CAPTION", "xsd:string", null); + SoapUtil.addElement(s, "CHILDREN_CARDINALITY", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "PARENT_LEVEL", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "PARENT_UNIQUE_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "PARENT_COUNT", "xsd:unsignedInt", null); + SoapUtil.addElement(s, "TREE_OP", "xsd:int", "0"); + SoapUtil.addElement(s, "DEPTH", "xsd:int", "0"); + SoapUtil.addElement(s, "MEMBER_KEY", "xsd:string", "0"); + SoapUtil.addElement(s, "IS_PLACEHOLDERMEMBER", "xsd:boolean", "0"); + SoapUtil.addElement(s, "IS_DATAMEMBER", "xsd:boolean", "0"); + SoapUtil.addElement(s, "SCOPE", "xsd:int", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaMembersResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.dimensionUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_NAME, v)); + r.hierarchyUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_UNIQUE_NAME, v)); + r.levelUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_UNIQUE_NAME, v)); + r.levelNumber().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_NUMBER, String.valueOf(v))); + r.memberOrdinal().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_ORDINAL, String.valueOf(v))); + r.memberName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_NAME, v)); + r.memberUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_UNIQUE_NAME, v)); + r.memberType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_TYPE, String.valueOf(v.getValue()))); + r.memberGuid().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_GUID, String.valueOf(v))); + r.memberCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_CAPTION, v)); + r.childrenCardinality() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CHILDREN_CARDINALITY, String.valueOf(v))); + r.parentLevel().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PARENT_LEVEL, String.valueOf(v))); + r.parentUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PARENT_UNIQUE_NAME, v)); + r.parentCount().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PARENT_COUNT, String.valueOf(v))); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.expression().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_EXPRESSION, v)); + r.memberKey().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_KEY, v)); + r.isPlaceHolderMember() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_PLACEHOLDERMEMBER, String.valueOf(v))); + r.isDataMember().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_IS_DATAMEMBER, String.valueOf(v))); + r.scope().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCOPE, String.valueOf(v.getValue()))); + } + + private static Integer toInt(String s) { + if (s == null) { + return null; + } + return Integer.valueOf(s); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaPropertiesHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaPropertiesHandler.java new file mode 100644 index 0000000..b169ec3 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaPropertiesHandler.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.PropertyContentTypeEnum; +import org.eclipse.daanse.xmla.api.common.enums.PropertyOriginEnum; +import org.eclipse.daanse.xmla.api.common.enums.PropertyTypeEnum; +import org.eclipse.daanse.xmla.api.common.enums.VisibilityEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.properties.MdSchemaPropertiesRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.properties.MdSchemaPropertiesResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.properties.MdSchemaPropertiesRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.properties.MdSchemaPropertiesRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaPropertiesHandler implements DiscoverHandler { + + private static final String CUBE_SOURCE = "CUBE_SOURCE"; + private static final String PROPERTY_NAME2 = "PROPERTY_NAME"; + private static final String PROPERTY_TYPE = "PROPERTY_TYPE"; + private static final String PROPERTY_CONTENT_TYPE = "PROPERTY_CONTENT_TYPE"; + private static final String PROPERTY_ORIGIN = "PROPERTY_ORIGIN"; + private static final String PROPERTY_VISIBILITY = "PROPERTY_VISIBILITY"; + + private final DiscoverService discoverService; + + public MdSchemaPropertiesHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaPropertiesRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaPropertiesRequest request = new MdSchemaPropertiesRequestR(properties, restrictions); + List rows = discoverService.mdSchemaProperties(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaPropertiesRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaPropertiesRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.DIMENSION_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.HIERARCHY_UNIQUE_NAME)), + Optional.ofNullable(m.get(ROW.LEVEL_UNIQUE_NAME)), Optional.ofNullable(m.get(ROW.MEMBER_UNIQUE_NAME)), + Optional.ofNullable(m.get(PROPERTY_NAME2)), + Optional.ofNullable(PropertyTypeEnum.fromValue(m.get(PROPERTY_TYPE))), + Optional.ofNullable(PropertyContentTypeEnum.fromValue(m.get(PROPERTY_CONTENT_TYPE))), + Optional.ofNullable(PropertyOriginEnum.fromValue(m.get(PROPERTY_ORIGIN))), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(CUBE_SOURCE))), + Optional.ofNullable(VisibilityEnum.fromValue(m.get(PROPERTY_VISIBILITY)))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaPropertiesResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "DIMENSION_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "HIERARCHY_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "LEVEL_UNIQUE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "MEMBER_UNIQUE_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "PROPERTY_NAME", "xsd:string", null); + SoapUtil.addElement(s, "PROPERTY_CAPTION", "xsd:string", null); + SoapUtil.addElement(s, "PROPERTY_TYPE", "xsd:short", null); + SoapUtil.addElement(s, "DATA_TYPE", "xsd:unsignedShort", null); + SoapUtil.addElement(s, "PROPERTY_CONTENT_TYPE", "xsd:short", "0"); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "PROPERTY_ORIGIN", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "CUBE_SOURCE", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "PROPERTY_VISIBILITY", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "CHARACTER_MAXIMUM_LENGTH", "xsd:unsignedInt", "0"); + SoapUtil.addElement(s, "SQL_COLUMN_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "LANGUAGE", "xsd:unsignedShort", "0"); + SoapUtil.addElement(s, "PROPERTY_ATTRIBUTE_HIERARCHY_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "PROPERTY_CARDINALITY", "xsd:string", "0"); + SoapUtil.addElement(s, "MIME_TYPE", "xsd:string", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaPropertiesResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.dimensionUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSION_UNIQUE_NAME, v)); + r.hierarchyUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_HIERARCHY_UNIQUE_NAME, v)); + r.levelUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_LEVEL_UNIQUE_NAME, v)); + r.memberUniqueName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_MEMBER_UNIQUE_NAME, v)); + r.propertyName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_NAME, v)); + r.propertyCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_CAPTION, v)); + r.propertyType() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_TYPE, String.valueOf(v.getValue()))); + r.dataType().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DATA_TYPE, String.valueOf(v.getValue()))); + r.propertyContentType().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_CONTENT_TYPE, String.valueOf(v.getValue()))); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.sqlColumnName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SQL_COLUMN_NAME, v)); + r.propertyOrigin() + .ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_ORIGIN, String.valueOf(v.getValue()))); + r.propertyIsVisible().ifPresent( + v -> SoapUtil.addChildElement(row, ROW.QN_PROPERTY_VISIBILITY, String.valueOf(v.getValue()))); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaSetsHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaSetsHandler.java new file mode 100644 index 0000000..ea8aad7 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/MdSchemaSetsHandler.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.common.enums.CubeSourceEnum; +import org.eclipse.daanse.xmla.api.common.enums.ScopeEnum; +import org.eclipse.daanse.xmla.api.discover.DiscoverService; +import org.eclipse.daanse.xmla.api.discover.mdschema.sets.MdSchemaSetsRequest; +import org.eclipse.daanse.xmla.api.discover.mdschema.sets.MdSchemaSetsResponseRow; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.sets.MdSchemaSetsRequestR; +import org.eclipse.daanse.xmla.model.record.discover.mdschema.sets.MdSchemaSetsRestrictionsR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROW; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants.ROWSET; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class MdSchemaSetsHandler implements DiscoverHandler { + + private final DiscoverService discoverService; + + public MdSchemaSetsHandler(DiscoverService discoverService) { + this.discoverService = discoverService; + } + + @Override + public void handle(RequestMetaData metaData, PropertiesR properties, SOAPElement restrictionElement, + SOAPBody responseBody) throws SOAPException { + MdSchemaSetsRestrictionsR restrictions = parseRestrictions(restrictionElement); + MdSchemaSetsRequest request = new MdSchemaSetsRequestR(properties, restrictions); + List rows = discoverService.mdSchemaSets(request, metaData); + writeResponse(rows, responseBody); + } + + private MdSchemaSetsRestrictionsR parseRestrictions(SOAPElement restriction) { + Map m = DiscoverDispatcher.getRestrictionMap(restriction); + return new MdSchemaSetsRestrictionsR(Optional.ofNullable(m.get(ROW.CATALOG_NAME)), + Optional.ofNullable(m.get(ROW.SCHEMA_NAME)), Optional.ofNullable(m.get(ROW.CUBE_NAME)), + Optional.ofNullable(m.get(ROW.SET_NAME)), Optional.ofNullable(ScopeEnum.fromValue(m.get(ROW.SCOPE))), + Optional.ofNullable(m.get(ROW.SET_CAPTION)), + Optional.ofNullable(CubeSourceEnum.fromValue(m.get(ROW.CUBE_SOURCE))), + Optional.ofNullable(m.get(ROW.HIERARCHY_UNIQUE_NAME))); + } + + private void writeResponse(List rows, SOAPBody body) throws SOAPException { + SOAPElement root = addRoot(body); + for (MdSchemaSetsResponseRow row : rows) { + addResponseRow(root, row); + } + } + + private SOAPElement addRoot(SOAPBody body) throws SOAPException { + SOAPElement seRoot = SoapUtil.prepareRootElement(body); + SOAPElement schema = SoapUtil.fillRoot(seRoot); + + SOAPElement s = SoapUtil.prepareSequenceElement(schema); + SoapUtil.addElement(s, "CATALOG_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "SCHEMA_NAME", "xsd:string", "0"); + SoapUtil.addElement(s, "CUBE_NAME", "xsd:string", null); + SoapUtil.addElement(s, "SET_NAME", "xsd:string", null); + SoapUtil.addElement(s, "SCOPE", "xsd:int", null); + SoapUtil.addElement(s, "DESCRIPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "EXPRESSION", "xsd:string", "0"); + SoapUtil.addElement(s, "DIMENSIONS", "xsd:string", "0"); + SoapUtil.addElement(s, "SET_CAPTION", "xsd:string", "0"); + SoapUtil.addElement(s, "SET_DISPLAY_FOLDER", "xsd:string", "0"); + return seRoot; + } + + private void addResponseRow(SOAPElement root, MdSchemaSetsResponseRow r) throws SOAPException { + SOAPElement row = root.addChildElement(ROWSET.QN_ROW); + + r.catalogName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CATALOG_NAME, v)); + r.schemaName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCHEMA_NAME, v)); + r.cubeName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_CUBE_NAME, v)); + r.setName().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SET_NAME, v)); + r.scope().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SCOPE, String.valueOf(v.getValue()))); + r.description().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DESCRIPTION, v)); + r.expression().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_EXPRESSION, v)); + r.dimension().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_DIMENSIONS, v)); + r.setCaption().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SET_CAPTION, v)); + r.setDisplayFolder().ifPresent(v -> SoapUtil.addChildElement(row, ROW.QN_SET_DISPLAY_FOLDER, v)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/package-info.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/package-info.java new file mode 100644 index 0000000..6da0d9d --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ + +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/AlterHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/AlterHandler.java new file mode 100644 index 0000000..2185b7d --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/AlterHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import java.util.List; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; +import org.eclipse.daanse.xmla.api.execute.ExecuteService; +import org.eclipse.daanse.xmla.api.execute.alter.AlterRequest; +import org.eclipse.daanse.xmla.api.execute.alter.AlterResponse; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.execute.alter.AlterRequestR; +import org.eclipse.daanse.xmla.model.record.xmla.AlterR; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class AlterHandler implements ExecuteHandler { + + private final ExecuteService executeService; + + public AlterHandler(ExecuteService executeService) { + this.executeService = executeService; + } + + @Override + public void handle(Command command, PropertiesR properties, List parameters, + RequestMetaData metaData, UserRolePrincipal userPrincipal, SOAPBody responseBody) throws SOAPException { + if (!(command instanceof AlterR alter)) { + return; + } + AlterRequest request = new AlterRequestR(properties, parameters, alter); + AlterResponse response = executeService.alter(request, metaData, userPrincipal); + writeResponse(response, responseBody); + } + + private void writeResponse(AlterResponse response, SOAPBody body) throws SOAPException { + SOAPElement root = ExecuteResponseUtil.addEmptyRoot(body); + if (response != null) { + ExecuteResponseUtil.addEmptyresult(root, response.emptyresult()); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ClearCacheHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ClearCacheHandler.java new file mode 100644 index 0000000..e1a0b6c --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ClearCacheHandler.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import java.util.List; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; +import org.eclipse.daanse.xmla.api.execute.ExecuteService; +import org.eclipse.daanse.xmla.api.execute.clearcache.ClearCacheRequest; +import org.eclipse.daanse.xmla.api.execute.clearcache.ClearCacheResponse; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.execute.clearcache.ClearCacheRequestR; +import org.eclipse.daanse.xmla.model.record.xmla.ClearCacheR; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class ClearCacheHandler implements ExecuteHandler { + + private final ExecuteService executeService; + + public ClearCacheHandler(ExecuteService executeService) { + this.executeService = executeService; + } + + @Override + public void handle(Command command, PropertiesR properties, List parameters, + RequestMetaData metaData, UserRolePrincipal userPrincipal, SOAPBody responseBody) throws SOAPException { + if (!(command instanceof ClearCacheR clearCache)) { + return; + } + ClearCacheRequest request = new ClearCacheRequestR(properties, parameters, clearCache); + ClearCacheResponse response = executeService.clearCache(request, metaData, userPrincipal); + writeResponse(response, responseBody); + } + + private void writeResponse(ClearCacheResponse response, SOAPBody body) throws SOAPException { + SOAPElement root = ExecuteResponseUtil.addEmptyRoot(body); + if (response != null) { + ExecuteResponseUtil.addEmptyresult(root, response.emptyresult()); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteConstants.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteConstants.java new file mode 100644 index 0000000..6f9893a --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteConstants.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import javax.xml.namespace.QName; + +/** + * Constants for XMLA Execute operations. Contains namespace and QName constants + * for execute response formatting. + */ +public interface ExecuteConstants { + + /** + * MDDATASET namespace constants for MDX result formatting. + */ + interface MDDATASET { + String PREFIX = ""; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis:mddataset"; + + QName QN_ROOT = new QName(NS_URN, "root", PREFIX); + QName QN_OLAP_INFO = new QName(NS_URN, "OlapInfo", PREFIX); + QName QN_CELL_INFO = new QName(NS_URN, "CellInfo", PREFIX); + QName QN_CUBE_NAME = new QName(NS_URN, "CubeName", PREFIX); + QName QN_SIZE = new QName(NS_URN, "Size", PREFIX); + QName QN_MESSAGES = new QName(NS_URN, "Messages", PREFIX); + QName QN_CELL_DATA = new QName(NS_URN, "CellData", PREFIX); + QName QN_CELL = new QName(NS_URN, "Cell", PREFIX); + QName QN_VALUE = new QName(NS_URN, "Value", PREFIX); + QName QN_ERROR = new QName(NS_URN, "Error", PREFIX); + QName QN_AXES = new QName(NS_URN, "Axes", PREFIX); + QName QN_AXIS = new QName(NS_URN, "Axis", PREFIX); + QName QN_UNION = new QName(NS_URN, "Union", PREFIX); + QName QN_NORM_TUPLE_SET = new QName(NS_URN, "NormTupleSet", PREFIX); + QName QN_CROSS_PRODUCT = new QName(NS_URN, "CrossProduct", PREFIX); + QName QN_TUPLES = new QName(NS_URN, "Tuples", PREFIX); + QName QN_MEMBER = new QName(NS_URN, "Member", PREFIX); + QName QN_AXES_INFO = new QName(NS_URN, "AxesInfo", PREFIX); + QName QN_AXIS_INFO = new QName(NS_URN, "AxisInfo", PREFIX); + QName QN_HIERARCHY_INFO = new QName(NS_URN, "HierarchyInfo", PREFIX); + QName QN_CUBE_INFO = new QName(NS_URN, "CubeInfo", PREFIX); + QName QN_CUBE = new QName(NS_URN, "Cube", PREFIX); + QName QN_MEMBERS = new QName(NS_URN, "Members", PREFIX); + QName QN_TUPLE = new QName(NS_URN, "Tuple", PREFIX); + } + + /** + * ENGINE namespace constants for Analysis Services engine. + */ + interface ENGINE { + String PREFIX = "engine"; + String NS_URN = "http://schemas.microsoft.com/analysisservices/2003/engine"; + + QName QN_LAST_DATA_UPDATE = new QName(MDDATASET.NS_URN, "LastDataUpdate", MDDATASET.PREFIX); + QName QN_LAST_SCHEMA_UPDATE = new QName(MDDATASET.NS_URN, "LastSchemaUpdate", MDDATASET.PREFIX); + } + + /** + * ENGINE200 namespace constants for Analysis Services engine 2010. + */ + interface ENGINE200 { + String PREFIX = "engine200"; + String NS_URN = "http://schemas.microsoft.com/analysisservices/2010/engine/200"; + + QName QN_WARNING_MEASURE = new QName(NS_URN, "WarningMeasure", PREFIX); + QName QN_WARNING_COLUMN = new QName(NS_URN, "WarningColumn", PREFIX); + } + + /** + * EMPTY namespace constants for empty result formatting. + */ + interface EMPTY { + String PREFIX = "empty"; + String NS_URN = "urn:schemas-microsoft-com:xml-analysis:empty"; + + QName QN_ROOT = new QName(NS_URN, "root", PREFIX); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteDispatcher.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteDispatcher.java new file mode 100644 index 0000000..e1a898f --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteDispatcher.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; +import org.eclipse.daanse.xmla.api.execute.ExecuteService; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.execute.ExecuteParameterR; +import org.eclipse.daanse.xmla.model.record.xmla.AlterR; +import org.eclipse.daanse.xmla.model.record.xmla.CancelR; +import org.eclipse.daanse.xmla.model.record.xmla.ClearCacheR; +import org.eclipse.daanse.xmla.model.record.xmla.StatementR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.PropertyConverter; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaParseException; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.CancelHandler; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.CommandConverter; + +import jakarta.xml.soap.Node; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +/** + * Dispatcher for XMLA Execute operations. Routes Execute requests to the + * appropriate handler based on command type. + */ +public class ExecuteDispatcher { + + private final Map, ExecuteHandler> handlers; + + public ExecuteDispatcher(ExecuteService executeService) { + this.handlers = initHandlers(executeService); + } + + /** + * Dispatch an Execute SOAP element to the appropriate handler. + * + * @param executeElement the Execute SOAP element + * @param responseBody the response body to write to + * @param metaData request metadata + * @param userPrincipal user principal information + * @throws SOAPException if SOAP processing fails + */ + public void dispatch(SOAPElement executeElement, SOAPBody responseBody, RequestMetaData metaData, + UserRolePrincipal userPrincipal) throws SOAPException { + + Command command = null; + PropertiesR properties = null; + List parameters = null; + + Iterator nodeIterator = executeElement.getChildElements(); + while (nodeIterator.hasNext()) { + Node node = nodeIterator.next(); + if (node instanceof SOAPElement element) { + if (properties == null && Constants.MSXMLA.QN_PROPERTIES.equals(element.getElementQName())) { + properties = PropertyConverter.propertiestoProperties(element); + } + if (parameters == null && Constants.MSXMLA.QN_PARAMETERS.equals(element.getElementQName())) { + parameters = parametersToParameters(element); + } + if (command == null && Constants.MSXMLA.QN_COMMAND.equals(element.getElementQName())) { + command = CommandConverter.commandToCommand(element); + } + } + } + + ExecuteHandler handler = handlers.get(command.getClass()); + if (handler == null) { + throw new XmlaParseException("Unsupported command type: " + command.getClass()); + } + handler.handle(command, properties, parameters, metaData, userPrincipal, responseBody); + } + + private Map, ExecuteHandler> initHandlers(ExecuteService es) { + Map, ExecuteHandler> map = new HashMap<>(); + map.put(StatementR.class, new StatementHandler(es)); + map.put(AlterR.class, new AlterHandler(es)); + map.put(ClearCacheR.class, new ClearCacheHandler(es)); + map.put(CancelR.class, new CancelHandler(es)); + return map; + } + + private List parametersToParameters(SOAPElement parametersElement) { + List parameters = new ArrayList<>(); + + Iterator nodeIteratorParameterList = parametersElement.getChildElements(); + while (nodeIteratorParameterList.hasNext()) { + Node n = nodeIteratorParameterList.next(); + + if (n instanceof SOAPElement parameterElement) { + Iterator parameterList = parameterElement.getChildElements(); + String name = null; + String value = null; + while (parameterList.hasNext()) { + Node n1 = parameterList.next(); + if (n1 instanceof SOAPElement pElement) { + if ("name".equalsIgnoreCase(pElement.getLocalName())) { + name = pElement.getTextContent(); + } + if ("value".equalsIgnoreCase(pElement.getLocalName())) { + value = pElement.getTextContent(); + } + } + } + if (name != null && value != null) { + parameters.add(new ExecuteParameterR(name, value)); + } + } + } + return parameters; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteHandler.java new file mode 100644 index 0000000..4aa4776 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteHandler.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import java.util.List; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPException; + +@FunctionalInterface +public interface ExecuteHandler { + + void handle(Command command, PropertiesR properties, List parameters, RequestMetaData metaData, + UserRolePrincipal userPrincipal, SOAPBody responseBody) throws SOAPException; +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteResponseUtil.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteResponseUtil.java new file mode 100644 index 0000000..a7a1009 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ExecuteResponseUtil.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; + +import java.util.List; + +import javax.xml.namespace.QName; + +import org.eclipse.daanse.xmla.api.engine200.WarningColumn; +import org.eclipse.daanse.xmla.api.engine200.WarningLocationObject; +import org.eclipse.daanse.xmla.api.engine200.WarningMeasure; +import org.eclipse.daanse.xmla.api.exception.ErrorType; +import org.eclipse.daanse.xmla.api.exception.Exception; +import org.eclipse.daanse.xmla.api.exception.MessageLocation; +import org.eclipse.daanse.xmla.api.exception.Messages; +import org.eclipse.daanse.xmla.api.exception.StartEnd; +import org.eclipse.daanse.xmla.api.exception.WarningType; +import org.eclipse.daanse.xmla.api.xmla_empty.Emptyresult; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaSoapException; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteConstants.ENGINE200; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteConstants.MDDATASET; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class ExecuteResponseUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(ExecuteResponseUtil.class); + private static final String DESCRIPTION_LC = "Description"; + + private ExecuteResponseUtil() { + // utility class + } + + public static SOAPElement addEmptyRoot(SOAPBody body) throws SOAPException { + SOAPElement seExecuteResponse = body.addChildElement(Constants.MSXMLA.QN_EXECUTE_RESPONSE); + SOAPElement seReturn = seExecuteResponse.addChildElement(Constants.MSXMLA.QN_RETURN); + SOAPElement seRoot = seReturn.addChildElement(ExecuteConstants.EMPTY.QN_ROOT); + + seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); + return seRoot; + } + + public static void addEmptyresult(SOAPElement root, Emptyresult emptyresult) { + addException(root, emptyresult.exception()); + addMessages(root, emptyresult.messages()); + } + + public static void addException(SOAPElement e, Exception it) { + if (it != null) { + addChildElement(e, "Exception", null); + } + } + + public static void addMessages(SOAPElement e, Messages it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_MESSAGES); + addExceptionTypeList(el, it.warningOrError()); + } + } + + private static void addExceptionTypeList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addExceptionType(e, it)); + } + } + + private static void addExceptionType(SOAPElement e, org.eclipse.daanse.xmla.api.exception.Type it) { + if (it != null) { + if (it instanceof WarningType warningType) { + addWarningType(e, warningType); + } + if (it instanceof ErrorType errorType) { + addErrorType(e, errorType); + } + } + } + + private static void addErrorType(SOAPElement e, ErrorType it) { + if (it != null) { + SOAPElement el = addChildElement(e, "Error", null); + + addChildElement(el, "Callstack", null, it.callstack()); + addChildElement(el, "ErrorCode", null, String.valueOf(it.errorCode())); + addMessageLocation(el, it.location()); + setAttribute(el, DESCRIPTION, it.description()); + setAttribute(el, "Source", it.source()); + setAttribute(el, "HelpFile", it.helpFile()); + } + } + + private static void addWarningType(SOAPElement e, WarningType it) { + if (it != null) { + SOAPElement el = addChildElement(e, "Warning", null); + addChildElement(el, "WarningCode", null, String.valueOf(it.warningCode())); + addMessageLocation(el, it.location()); + addChildElement(el, DESCRIPTION_LC, null, it.description()); + addChildElement(el, "Source", null, it.source()); + addChildElement(el, "HelpFile", null, it.helpFile()); + } + } + + private static void addMessageLocation(SOAPElement e, MessageLocation it) { + if (it != null) { + SOAPElement el = addChildElement(e, "Location", null); + addStartEnd(el, "Start", it.start()); + addStartEnd(el, "End", it.end()); + addChildElement(el, "LineOffset", null, String.valueOf(it.lineOffset())); + addChildElement(el, "TextLength", null, String.valueOf(it.textLength())); + addWarningLocationObject(el, "SourceObject", it.sourceObject()); + addWarningLocationObject(el, "DependsOnObject", it.dependsOnObject()); + addChildElement(el, "RowNumber", null, String.valueOf(it.rowNumber())); + } + } + + private static void addWarningLocationObject(SOAPElement e, String tagName, WarningLocationObject it) { + if (it != null) { + SOAPElement el = addChildElement(e, tagName, null); + addWarningColumn(el, it.warningColumn()); + addWarningMeasure(el, it.warningMeasure()); + } + } + + private static void addWarningMeasure(SOAPElement e, WarningMeasure it) { + if (it != null) { + SOAPElement el = addChildElement(e, ENGINE200.QN_WARNING_MEASURE); + addChildElement(el, "Cube", null, it.cube()); + addChildElement(el, "MeasureGroup", null, it.measureGroup()); + addChildElement(el, "MeasureName", null, it.measureName()); + } + } + + private static void addWarningColumn(SOAPElement e, WarningColumn it) { + if (it != null) { + SOAPElement el = addChildElement(e, ENGINE200.QN_WARNING_COLUMN); + addChildElement(el, "Dimension", null, it.dimension()); + addChildElement(el, "Attribute", null, it.attribute()); + } + } + + private static void addStartEnd(SOAPElement e, String tagName, StartEnd it) { + if (it != null) { + SOAPElement el = addChildElement(e, tagName, null); + addChildElement(el, "Line", null, String.valueOf(it.line())); + addChildElement(el, "Column", null, String.valueOf(it.column())); + } + } + + // Helper methods for SOAP element creation + + private static void setAttribute(SOAPElement el, String name, String value) { + if (value != null) { + el.setAttribute(name, value); + } + } + + private static SOAPElement addChildElement(SOAPElement element, QName qNameOfChild) { + try { + return element.addChildElement(qNameOfChild); + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", qNameOfChild); + throw new XmlaSoapException("addChildElement error", e); + } + } + + private static void addChildElement(SOAPElement element, String childElementName, String prefix, String value) { + try { + if (value != null) { + if (prefix != null) { + element.addChildElement(childElementName, prefix).setTextContent(value); + } else { + element.addChildElement(childElementName).setTextContent(value); + } + } + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", childElementName); + throw new XmlaSoapException("addChildElement error", e); + } + } + + private static SOAPElement addChildElement(SOAPElement element, String childElementName, String prefix) { + try { + if (prefix == null) { + return element.addChildElement(childElementName); + } else { + return element.addChildElement(childElementName, prefix); + } + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", childElementName); + throw new XmlaSoapException("addChildElement error", e); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/StatementHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/StatementHandler.java new file mode 100644 index 0000000..569789a --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/StatementHandler.java @@ -0,0 +1,948 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.List; + +import javax.xml.namespace.QName; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.common.enums.ItemTypeEnum; +import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; +import org.eclipse.daanse.xmla.api.execute.ExecuteService; +import org.eclipse.daanse.xmla.api.execute.statement.StatementRequest; +import org.eclipse.daanse.xmla.api.execute.statement.StatementResponse; +import org.eclipse.daanse.xmla.api.mddataset.Axes; +import org.eclipse.daanse.xmla.api.mddataset.AxesInfo; +import org.eclipse.daanse.xmla.api.mddataset.Axis; +import org.eclipse.daanse.xmla.api.mddataset.AxisInfo; +import org.eclipse.daanse.xmla.api.mddataset.CellData; +import org.eclipse.daanse.xmla.api.mddataset.CellInfo; +import org.eclipse.daanse.xmla.api.mddataset.CellInfoItem; +import org.eclipse.daanse.xmla.api.mddataset.CellType; +import org.eclipse.daanse.xmla.api.mddataset.CellTypeError; +import org.eclipse.daanse.xmla.api.mddataset.CubeInfo; +import org.eclipse.daanse.xmla.api.mddataset.HierarchyInfo; +import org.eclipse.daanse.xmla.api.mddataset.Mddataset; +import org.eclipse.daanse.xmla.api.mddataset.MemberType; +import org.eclipse.daanse.xmla.api.mddataset.MembersType; +import org.eclipse.daanse.xmla.api.mddataset.NormTupleSet; +import org.eclipse.daanse.xmla.api.mddataset.OlapInfo; +import org.eclipse.daanse.xmla.api.mddataset.OlapInfoCube; +import org.eclipse.daanse.xmla.api.mddataset.RowSet; +import org.eclipse.daanse.xmla.api.mddataset.RowSetRow; +import org.eclipse.daanse.xmla.api.mddataset.RowSetRowItem; +import org.eclipse.daanse.xmla.api.mddataset.SetListType; +import org.eclipse.daanse.xmla.api.mddataset.TupleType; +import org.eclipse.daanse.xmla.api.mddataset.TuplesType; +import org.eclipse.daanse.xmla.api.mddataset.Type; +import org.eclipse.daanse.xmla.api.mddataset.Union; +import org.eclipse.daanse.xmla.api.mddataset.Value; +import org.eclipse.daanse.xmla.api.msxmla.MemberRef; +import org.eclipse.daanse.xmla.api.msxmla.MembersLookup; +import org.eclipse.daanse.xmla.api.msxmla.NormTuple; +import org.eclipse.daanse.xmla.api.msxmla.NormTuplesType; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.execute.statement.StatementRequestR; +import org.eclipse.daanse.xmla.model.record.xmla.StatementR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaSoapException; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.discover.DiscoverConstants; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteConstants.MDDATASET; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class StatementHandler implements ExecuteHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(StatementHandler.class); + private static final String UUID_VALUE = "[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}"; + private static final String QN_MEMBER_ORDINAL = "MemberOrdinal"; + private static final String QN_MEMBER_DISP_INFO = "MemberDispInfo"; + private static final String QN_NORM_TUPLES = "NormTuples"; + private static final String QN_NORM_TUPLE = "NormTuple"; + private static final String QN_MEMBER_REF = "MemberRef"; + private static final String QN_MEMBERS_LOOKUP = "MembersLookup"; + + private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss") + .withZone(ZoneId.systemDefault()); + + private final ExecuteService executeService; + + public StatementHandler(ExecuteService executeService) { + this.executeService = executeService; + } + + @Override + public void handle(Command command, PropertiesR properties, List parameters, + RequestMetaData metaData, UserRolePrincipal userPrincipal, SOAPBody responseBody) throws SOAPException { + if (!(command instanceof StatementR statement)) { + return; + } + String sessionId = metaData != null && metaData.sessionId() != null && metaData.sessionId().isPresent() + ? metaData.sessionId().get() + : null; + StatementRequest request = new StatementRequestR(properties, parameters, statement, sessionId); + StatementResponse response = executeService.statement(request, metaData, userPrincipal); + writeResponse(response, responseBody); + } + + private void writeResponse(StatementResponse response, SOAPBody body) throws SOAPException { + if (response != null && response.mdDataSet() != null) { + SOAPElement root = addMddatasetRoot(body); + addMdDataSet(root, response.mdDataSet()); + } + if (response.rowSet() != null) { + SOAPElement root = addRowSetRoot(body, response.rowSet()); + List rowSetRows = response.rowSet().rowSetRows(); + if (rowSetRows != null) { + for (RowSetRow rowSetRow : rowSetRows) { + addRowSetRow(root, rowSetRow); + } + } + } + if (response.mdDataSet() == null && response.rowSet() == null) { + ExecuteResponseUtil.addEmptyRoot(body); + } + } + + private SOAPElement addMddatasetRoot(SOAPElement body) throws SOAPException { + SOAPElement seExecuteResponse = body.addChildElement(Constants.MSXMLA.QN_EXECUTE_RESPONSE); + SOAPElement seReturn = seExecuteResponse.addChildElement(Constants.MSXMLA.QN_RETURN); + SOAPElement seRoot = seReturn.addChildElement(MDDATASET.QN_ROOT); + seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); + addMddatasetSchema(seRoot); + return seRoot; + } + + private void addMddatasetSchema(SOAPElement root) { + SOAPElement schema = addChildElement(root, Constants.XSD.QN_SCHEMA); + schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + schema.setAttribute("targetNamespace", MDDATASET.NS_URN); + schema.setAttribute("xmlns", MDDATASET.NS_URN); + schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); + schema.setAttribute("elementFormDefault", "qualified"); + SOAPElement ct1 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct1.setAttribute("name", "MemberType"); + SOAPElement ct1Sequence = addChildElement(ct1, Constants.XSD.QN_SEQUENCE); + SOAPElement e1 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); + e1.setAttribute("name", "UName"); + e1.setAttribute("type", "xsd:string"); + SOAPElement e2 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); + e2.setAttribute("name", "Caption"); + e2.setAttribute("type", "xsd:string"); + SOAPElement e3 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); + e3.setAttribute("name", "LName"); + e3.setAttribute("type", "xsd:string"); + SOAPElement e4 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); + e4.setAttribute("name", "LNum"); + e4.setAttribute("type", "xsd:unsignedInt"); + SOAPElement e5 = addChildElement(ct1Sequence, Constants.XSD.QN_ELEMENT); + e5.setAttribute("name", "DisplayInfo"); + e5.setAttribute("type", "xsd:unsignedInt"); + SOAPElement s = addChildElement(ct1Sequence, Constants.XSD.QN_SEQUENCE); + s.setAttribute("maxOccurs", "unbounded"); + s.setAttribute("minOccurs", "0"); + SOAPElement any = addChildElement(s, Constants.XSD.QN_ANY); + any.setAttribute("processContents", "lax"); + any.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct1Attribute = addChildElement(ct1, Constants.XSD.QN_ATTRIBUTE); + ct1Attribute.setAttribute("name", "Hierarchy"); + ct1Attribute.setAttribute("type", "xsd:string"); + + SOAPElement ct2 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct2.setAttribute("name", "PropType"); + SOAPElement ct2Attribute = addChildElement(ct2, Constants.XSD.QN_ATTRIBUTE); + ct2Attribute.setAttribute("name", "name"); + ct2Attribute.setAttribute("type", "xsd:string"); + + SOAPElement ct3 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct3.setAttribute("name", "TupleType"); + SOAPElement ct3Sequence = addChildElement(ct3, Constants.XSD.QN_SEQUENCE); + ct3Sequence.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct3SequenceElement = addChildElement(ct3Sequence, Constants.XSD.QN_ELEMENT); + ct3SequenceElement.setAttribute("name", "Member"); + ct3SequenceElement.setAttribute("type", "MemberType"); + + SOAPElement ct4 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct4.setAttribute("name", "MembersType"); + SOAPElement ct4Sequence = addChildElement(ct4, Constants.XSD.QN_SEQUENCE); + ct4Sequence.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct4SequenceElement = addChildElement(ct4Sequence, Constants.XSD.QN_ELEMENT); + ct4SequenceElement.setAttribute("name", "Member"); + ct4SequenceElement.setAttribute("type", "MemberType"); + SOAPElement ct4Attribute = addChildElement(ct4, Constants.XSD.QN_ATTRIBUTE); + ct4Attribute.setAttribute("name", "Hierarchy"); + ct4Attribute.setAttribute("type", "xsd:string"); + + SOAPElement ct5 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct5.setAttribute("name", "TuplesType"); + SOAPElement ct5Sequence = addChildElement(ct5, Constants.XSD.QN_SEQUENCE); + ct5Sequence.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct5SequenceElement = addChildElement(ct5Sequence, Constants.XSD.QN_ELEMENT); + ct5SequenceElement.setAttribute("name", "Tuple"); + ct5SequenceElement.setAttribute("type", "TupleType"); + + SOAPElement ct6 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct6.setAttribute("name", "CrossProductType"); + SOAPElement ct6Sequence = addChildElement(ct6, Constants.XSD.QN_SEQUENCE); + SOAPElement ct6SequenceChoice = addChildElement(ct6Sequence, Constants.XSD.QN_CHOICE); + ct6SequenceChoice.setAttribute("minOccurs", "0"); + ct6SequenceChoice.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct6SequenceChoiceE1 = addChildElement(ct6SequenceChoice, Constants.XSD.QN_ELEMENT); + ct6SequenceChoiceE1.setAttribute("name", "Members"); + ct6SequenceChoiceE1.setAttribute("type", "MembersType"); + SOAPElement ct6SequenceChoiceE2 = addChildElement(ct6SequenceChoice, Constants.XSD.QN_ELEMENT); + ct6SequenceChoiceE2.setAttribute("name", "Tuples"); + ct6SequenceChoiceE2.setAttribute("type", "TuplesType"); + SOAPElement ct6Attribute = addChildElement(ct6, Constants.XSD.QN_ATTRIBUTE); + ct6Attribute.setAttribute("name", "Size"); + ct6Attribute.setAttribute("type", "xsd:unsignedInt"); + + SOAPElement ct7 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct7.setAttribute("name", "OlapInfo"); + SOAPElement ct7Sequence = addChildElement(ct7, Constants.XSD.QN_SEQUENCE); + SOAPElement ct7SequenceElement1 = addChildElement(ct7Sequence, Constants.XSD.QN_ELEMENT); + ct7SequenceElement1.setAttribute("name", "CubeInfo"); + + SOAPElement ct7SequenceElement1Ct = addChildElement(ct7SequenceElement1, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct7SequenceElement1CtSequence = addChildElement(ct7SequenceElement1Ct, Constants.XSD.QN_SEQUENCE); + SOAPElement ct7SequenceElement1CtSequenceEl = addChildElement(ct7SequenceElement1CtSequence, + Constants.XSD.QN_ELEMENT); + ct7SequenceElement1CtSequenceEl.setAttribute("name", "Cube"); + ct7SequenceElement1CtSequenceEl.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement1CtSequenceElCt = addChildElement(ct7SequenceElement1CtSequenceEl, + Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct7SequenceElement1CtSequenceElCtSequence = addChildElement(ct7SequenceElement1CtSequenceElCt, + Constants.XSD.QN_SEQUENCE); + SOAPElement ct7SequenceElement1CtSequenceElCtSequenceEl = addChildElement( + ct7SequenceElement1CtSequenceElCtSequence, Constants.XSD.QN_ELEMENT); + ct7SequenceElement1CtSequenceElCtSequenceEl.setAttribute("name", "CubeName"); + ct7SequenceElement1CtSequenceElCtSequenceEl.setAttribute("type", "xsd:string"); + + SOAPElement ct7SequenceElement2 = addChildElement(ct7Sequence, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2.setAttribute("name", "AxesInfo"); + SOAPElement ct7SequenceElement2Ct = addChildElement(ct7SequenceElement2, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct7SequenceElement2CtSequence = addChildElement(ct7SequenceElement2Ct, Constants.XSD.QN_SEQUENCE); + SOAPElement ct7SequenceElement2CtSequenceEl = addChildElement(ct7SequenceElement2CtSequence, + Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceEl.setAttribute("name", "AxisInfo"); + ct7SequenceElement2CtSequenceEl.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement2CtSequenceElCt = addChildElement(ct7SequenceElement2CtSequenceEl, + Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct7SequenceElement2CtSequenceElCtSequence = addChildElement(ct7SequenceElement2CtSequenceElCt, + Constants.XSD.QN_SEQUENCE); + + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElement = addChildElement( + ct7SequenceElement2CtSequenceElCtSequence, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceElCtSequenceElement.setAttribute("name", "HierarchyInfo"); + ct7SequenceElement2CtSequenceElCtSequenceElement.setAttribute("minOccurs", "0"); + ct7SequenceElement2CtSequenceElCtSequenceElement.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElementCt = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceElement, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElementCtSequence = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceElementCt, Constants.XSD.QN_SEQUENCE); + + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceElementCtSequence, Constants.XSD.QN_SEQUENCE); + ct7SequenceElement2CtSequenceElCtSequenceSequence1.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E1 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E1.setAttribute("name", "UName"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E1.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E2 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E2.setAttribute("name", "Caption"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E2.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E3 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E3.setAttribute("name", "LName"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E3.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E4 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E4.setAttribute("name", "LNum"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E4.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence1E5 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceSequence1, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("name", "DisplayInfo"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("type", "PropType"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("minOccurs", "0"); + ct7SequenceElement2CtSequenceElCtSequenceSequence1E5.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence2 = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceElementCtSequence, Constants.XSD.QN_SEQUENCE); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceSequence2Any = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceSequence2, Constants.XSD.QN_ANY); + ct7SequenceElement2CtSequenceElCtSequenceSequence2Any.setAttribute("processContents", "lax"); + ct7SequenceElement2CtSequenceElCtSequenceSequence2Any.setAttribute("minOccurs", "0"); + ct7SequenceElement2CtSequenceElCtSequenceSequence2Any.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute = addChildElement( + ct7SequenceElement2CtSequenceElCtSequenceElementCt, Constants.XSD.QN_ATTRIBUTE); + ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute.setAttribute("name", "name"); + ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute.setAttribute("type", "xsd:string"); + ct7SequenceElement2CtSequenceElCtSequenceElementCtAttribute.setAttribute("use", "required"); + SOAPElement ct7SequenceElement2CtAttribute = addChildElement(ct7SequenceElement2CtSequenceElCt, + Constants.XSD.QN_ATTRIBUTE); + ct7SequenceElement2CtAttribute.setAttribute("name", "name"); + ct7SequenceElement2CtAttribute.setAttribute("type", "xsd:string"); + + SOAPElement ct7SequenceElement3 = addChildElement(ct7Sequence, Constants.XSD.QN_ELEMENT); + ct7SequenceElement3.setAttribute("name", "CellInfo"); + SOAPElement ct7SequenceElement3Ct = addChildElement(ct7SequenceElement3, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct7SequenceElement3CtSequence = addChildElement(ct7SequenceElement3Ct, Constants.XSD.QN_SEQUENCE); + SOAPElement ct7SequenceElement2CtSequenceSequence1 = addChildElement(ct7SequenceElement3CtSequence, + Constants.XSD.QN_SEQUENCE); + ct7SequenceElement2CtSequenceSequence1.setAttribute("minOccurs", "0"); + ct7SequenceElement2CtSequenceSequence1.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct7SequenceElement2CtSequenceSequence1Ch = addChildElement(ct7SequenceElement2CtSequenceSequence1, + Constants.XSD.QN_CHOICE); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE1 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE1.setAttribute("name", "Value"); + ct7SequenceElement2CtSequenceSequence1ChE1.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE2 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE2.setAttribute("name", "FmtValue"); + ct7SequenceElement2CtSequenceSequence1ChE2.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE3 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE3.setAttribute("name", "BackColor"); + ct7SequenceElement2CtSequenceSequence1ChE3.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE4 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE4.setAttribute("name", "ForeColor"); + ct7SequenceElement2CtSequenceSequence1ChE4.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE5 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE5.setAttribute("name", "FontName"); + ct7SequenceElement2CtSequenceSequence1ChE5.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE6 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE6.setAttribute("name", "FontSize"); + ct7SequenceElement2CtSequenceSequence1ChE6.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE7 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE7.setAttribute("name", "FontFlags"); + ct7SequenceElement2CtSequenceSequence1ChE7.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE8 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE8.setAttribute("name", "FormatString"); + ct7SequenceElement2CtSequenceSequence1ChE8.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE9 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE9.setAttribute("name", "NonEmptyBehavior"); + ct7SequenceElement2CtSequenceSequence1ChE9.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE10 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE10.setAttribute("name", "SolveOrder"); + ct7SequenceElement2CtSequenceSequence1ChE10.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE11 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE11.setAttribute("name", "Updateable"); + ct7SequenceElement2CtSequenceSequence1ChE11.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE12 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE12.setAttribute("name", "Visible"); + ct7SequenceElement2CtSequenceSequence1ChE12.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence1ChE13 = addChildElement( + ct7SequenceElement2CtSequenceSequence1Ch, Constants.XSD.QN_ELEMENT); + ct7SequenceElement2CtSequenceSequence1ChE13.setAttribute("name", "Expression"); + ct7SequenceElement2CtSequenceSequence1ChE13.setAttribute("type", "PropType"); + SOAPElement ct7SequenceElement2CtSequenceSequence2 = addChildElement(ct7SequenceElement3CtSequence, + Constants.XSD.QN_SEQUENCE); + ct7SequenceElement2CtSequenceSequence2.setAttribute("maxOccurs", "unbounded"); + ct7SequenceElement2CtSequenceSequence2.setAttribute("minOccurs", "0"); + SOAPElement ct7SequenceElement2CtSequenceSequence2Any = addChildElement(ct7SequenceElement2CtSequenceSequence2, + Constants.XSD.QN_ANY); + ct7SequenceElement2CtSequenceSequence2Any.setAttribute("processContents", "lax"); + ct7SequenceElement2CtSequenceSequence2Any.setAttribute("maxOccurs", "unbounded"); + + SOAPElement ct8 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct8.setAttribute("name", "Axes"); + SOAPElement ct8Sequence = addChildElement(ct8, Constants.XSD.QN_SEQUENCE); + ct8Sequence.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct8SequenceElement = addChildElement(ct8Sequence, Constants.XSD.QN_ELEMENT); + ct8SequenceElement.setAttribute("name", "Axis"); + SOAPElement ct8SequenceElementComplexType = addChildElement(ct8SequenceElement, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct8SequenceElementComplexTypeChoice = addChildElement(ct8SequenceElementComplexType, + Constants.XSD.QN_CHOICE); + ct8SequenceElementComplexTypeChoice.setAttribute("minOccurs", "0"); + ct8SequenceElementComplexTypeChoice.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct8SequenceElementComplexTypeChoiceE1 = addChildElement(ct8SequenceElementComplexTypeChoice, + Constants.XSD.QN_ELEMENT); + ct8SequenceElementComplexTypeChoiceE1.setAttribute("name", "CrossProduct"); + ct8SequenceElementComplexTypeChoiceE1.setAttribute("type", "CrossProductType"); + SOAPElement ct8SequenceElementComplexTypeChoiceE2 = addChildElement(ct8SequenceElementComplexTypeChoice, + Constants.XSD.QN_ELEMENT); + ct8SequenceElementComplexTypeChoiceE2.setAttribute("name", "Tuples"); + ct8SequenceElementComplexTypeChoiceE2.setAttribute("type", "TuplesType"); + SOAPElement ct8SequenceElementComplexTypeChoiceE3 = addChildElement(ct8SequenceElementComplexTypeChoice, + Constants.XSD.QN_ELEMENT); + ct8SequenceElementComplexTypeChoiceE3.setAttribute("name", "Members"); + ct8SequenceElementComplexTypeChoiceE3.setAttribute("type", "MembersType"); + SOAPElement ct8SequenceElementComplexTypeAttribute = addChildElement(ct8SequenceElementComplexType, + Constants.XSD.QN_ATTRIBUTE); + ct8SequenceElementComplexTypeAttribute.setAttribute("name", "name"); + ct8SequenceElementComplexTypeAttribute.setAttribute("type", "xsd:string"); + + SOAPElement ct9 = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct9.setAttribute("name", "CellData"); + SOAPElement ct9Sequence = addChildElement(ct9, Constants.XSD.QN_SEQUENCE); + SOAPElement ct9SequenceElement = addChildElement(ct9Sequence, Constants.XSD.QN_ELEMENT); + ct9SequenceElement.setAttribute("name", "Cell"); + ct9SequenceElement.setAttribute("minOccurs", "0"); + ct9SequenceElement.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct9SequenceElementComplexType = addChildElement(ct9SequenceElement, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement ct9SequenceElementComplexTypeSequence = addChildElement(ct9SequenceElementComplexType, + Constants.XSD.QN_SEQUENCE); + ct9SequenceElementComplexTypeSequence.setAttribute("maxOccurs", "unbounded"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoice = addChildElement(ct9SequenceElementComplexTypeSequence, + Constants.XSD.QN_CHOICE); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE1 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE1.setAttribute("name", "Value"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE2 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE2.setAttribute("name", "FmtValue"); + ct9SequenceElementComplexTypeSequenceChoiceE2.setAttribute("type", "xsd:string"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE3 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE3.setAttribute("name", "BackColor"); + ct9SequenceElementComplexTypeSequenceChoiceE3.setAttribute("type", "xsd:unsignedInt"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE4 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE4.setAttribute("name", "ForeColor"); + ct9SequenceElementComplexTypeSequenceChoiceE4.setAttribute("type", "xsd:unsignedInt"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE5 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE5.setAttribute("name", "FontName"); + ct9SequenceElementComplexTypeSequenceChoiceE5.setAttribute("type", "xsd:string"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE6 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE6.setAttribute("name", "FontSize"); + ct9SequenceElementComplexTypeSequenceChoiceE6.setAttribute("type", "xsd:unsignedShort"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE7 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE7.setAttribute("name", "FontFlags"); + ct9SequenceElementComplexTypeSequenceChoiceE7.setAttribute("type", "xsd:unsignedInt"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE8 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE8.setAttribute("name", "FormatString"); + ct9SequenceElementComplexTypeSequenceChoiceE8.setAttribute("type", "xsd:string"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE9 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE9.setAttribute("name", "NonEmptyBehavior"); + ct9SequenceElementComplexTypeSequenceChoiceE9.setAttribute("type", "xsd:unsignedShort"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE10 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE10.setAttribute("name", "SolveOrder"); + ct9SequenceElementComplexTypeSequenceChoiceE10.setAttribute("type", "xsd:unsignedInt"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE11 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE11.setAttribute("name", "Updateable"); + ct9SequenceElementComplexTypeSequenceChoiceE11.setAttribute("type", "xsd:unsignedInt"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE12 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE12.setAttribute("name", "Visible"); + ct9SequenceElementComplexTypeSequenceChoiceE12.setAttribute("type", "xsd:unsignedInt"); + SOAPElement ct9SequenceElementComplexTypeSequenceChoiceE13 = addChildElement( + ct9SequenceElementComplexTypeSequenceChoice, Constants.XSD.QN_ELEMENT); + ct9SequenceElementComplexTypeSequenceChoiceE13.setAttribute("name", "Expression"); + ct9SequenceElementComplexTypeSequenceChoiceE13.setAttribute("type", "xsd:string"); + SOAPElement ct9SequenceElementComplexTypeAttribute = addChildElement(ct9SequenceElementComplexType, + Constants.XSD.QN_ATTRIBUTE); + ct9SequenceElementComplexTypeAttribute.setAttribute("name", "CellOrdinal"); + ct9SequenceElementComplexTypeAttribute.setAttribute("type", "xsd:unsignedInt"); + ct9SequenceElementComplexTypeAttribute.setAttribute("use", "required"); + + SOAPElement element = addChildElement(schema, Constants.XSD.QN_ELEMENT); + element.setAttribute("name", "root"); + SOAPElement elementComplexType = addChildElement(element, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement elementComplexTypeSequence = addChildElement(elementComplexType, Constants.XSD.QN_SEQUENCE); + elementComplexTypeSequence.setAttribute("maxOccurs", "unbounded"); + SOAPElement elementComplexTypeSequenceE1 = addChildElement(elementComplexTypeSequence, + Constants.XSD.QN_ELEMENT); + elementComplexTypeSequenceE1.setAttribute("name", "OlapInfo"); + elementComplexTypeSequenceE1.setAttribute("type", "OlapInfo"); + SOAPElement elementComplexTypeSequenceE2 = addChildElement(elementComplexTypeSequence, + Constants.XSD.QN_ELEMENT); + elementComplexTypeSequenceE2.setAttribute("name", "Axes"); + elementComplexTypeSequenceE2.setAttribute("type", "Axes"); + SOAPElement elementComplexTypeSequenceE3 = addChildElement(elementComplexTypeSequence, + Constants.XSD.QN_ELEMENT); + elementComplexTypeSequenceE3.setAttribute("name", "CellData"); + elementComplexTypeSequenceE3.setAttribute("type", "CellData"); + } + + private void addMdDataSet(SOAPElement el, Mddataset it) throws SOAPException { + if (it != null) { + addOlapInfo(el, it.olapInfo()); + addAxes(el, it.axes()); + addCellData(el, it.cellData()); + ExecuteResponseUtil.addException(el, it.exception()); + ExecuteResponseUtil.addMessages(el, it.messages()); + } + } + + private void addOlapInfo(SOAPElement e, OlapInfo it) throws SOAPException { + if (it != null) { + SOAPElement seOlapInfo = e.addChildElement(MDDATASET.QN_OLAP_INFO); + addCubeInfo(seOlapInfo, it.cubeInfo()); + addAxesInfo(seOlapInfo, it.axesInfo()); + addCellInfo(seOlapInfo, it.cellInfo()); + } + } + + private void addCubeInfo(SOAPElement e, CubeInfo it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_CUBE_INFO); + addOlapInfoCubeList(el, it.cube()); + } + } + + private void addOlapInfoCubeList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addOlapInfoCube(e, it)); + } + } + + private void addOlapInfoCube(SOAPElement e, OlapInfoCube it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_CUBE); + addChildElement(el, MDDATASET.QN_CUBE_NAME, it.cubeName()); + addChildElement(el, ExecuteConstants.ENGINE.QN_LAST_DATA_UPDATE, instantToString(it.lastDataUpdate())); + addChildElement(el, ExecuteConstants.ENGINE.QN_LAST_SCHEMA_UPDATE, instantToString(it.lastSchemaUpdate())); + } + } + + private void addAxesInfo(SOAPElement e, AxesInfo it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_AXES_INFO); + addAxisInfoList(el, it.axisInfo()); + } + } + + private void addAxisInfoList(SOAPElement el, List list) { + if (list != null) { + list.forEach(it -> addAxisInfo(el, it)); + } + } + + private void addAxisInfo(SOAPElement e, AxisInfo it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_AXIS_INFO); + setAttribute(el, "name", it.name()); + addHierarchyInfoList(el, it.hierarchyInfo()); + } + } + + private void addHierarchyInfoList(SOAPElement el, List list) { + if (list != null) { + list.forEach(it -> addHierarchyInfo(el, it)); + } + } + + private void addHierarchyInfo(SOAPElement e, HierarchyInfo it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_HIERARCHY_INFO); + addCellInfoItemListName(el, it.any()); + setAttribute(el, "name", it.name()); + } + } + + private void addCellInfo(SOAPElement e, CellInfo it) throws SOAPException { + if (it != null) { + SOAPElement seCellInfo = e.addChildElement(MDDATASET.QN_CELL_INFO); + addCellInfoItemListName(seCellInfo, it.any()); + } + } + + private void addCellInfoItemListName(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addCellInfoItemName(e, it)); + } + } + + private void addCellInfoItemName(SOAPElement e, CellInfoItem it) { + if (it != null) { + String prefix = MDDATASET.PREFIX; + SOAPElement el = addChildElementWithPrefix(e, it.tagName(), prefix); + setAttribute(el, "name", it.name()); + it.type().ifPresent(v -> setAttribute(el, "type", v)); + } + } + + private void addCellInfoItemList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addCellInfoItem(e, it)); + } + } + + private void addCellInfoItem(SOAPElement e, CellInfoItem it) { + if (it != null) { + String prefix = MDDATASET.PREFIX; + SOAPElement el = addChildElementWithPrefix(e, it.tagName(), prefix); + el.setTextContent(it.name()); + it.type().ifPresent(v -> setAttribute(el, "type", v)); + } + } + + private void addAxes(SOAPElement e, Axes it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_AXES); + addAxisList(el, it.axis()); + } + } + + private void addAxisList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addAxis(e, it)); + } + } + + private void addAxis(SOAPElement e, Axis it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_AXIS); + addTypeList(el, it.setType()); + setAttribute(el, "name", it.name()); + } + } + + private void addTypeList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addType(e, it)); + } + } + + private void addType(SOAPElement soapElement, Type type) { + if (type != null) { + if (type instanceof MembersType membersType) { + addMembersType(soapElement, membersType); + } + if (type instanceof TuplesType tuplesType) { + addTuplesType(soapElement, tuplesType); + } + if (type instanceof SetListType setListType) { + addSetListType(soapElement, setListType); + } + if (type instanceof NormTupleSet normTupleSet) { + addNormTupleSet(soapElement, normTupleSet); + } + if (type instanceof Union union) { + addUnion(soapElement, union); + } + } + } + + private void addMembersType(SOAPElement e, MembersType it) { + if (it != null && it.member() != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_MEMBERS); + it.member().forEach(item -> addMemberType(el, item)); + setAttribute(e, "Hierarchy", it.hierarchy()); + } + } + + private void addTuplesType(SOAPElement e, TuplesType it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_TUPLES); + addTuplesTypeList(el, it.tuple()); + } + } + + private void addTuplesTypeList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addTupleTypeTuple(e, it)); + } + } + + private void addTupleTypeTuple(SOAPElement e, TupleType it) { + if (it != null && it.member() != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_TUPLE); + it.member().forEach(item -> addMemberType(el, item)); + } + } + + private void addTupleTypeMembers(SOAPElement e, TupleType it) { + if (it != null && it.member() != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_MEMBERS); + it.member().forEach(item -> addMemberType(el, item)); + } + } + + private void addMemberType(SOAPElement e, MemberType it) { + if (it != null) { + SOAPElement seMember = addChildElement(e, MDDATASET.QN_MEMBER); + addCellInfoItemList(seMember, it.any()); + setAttribute(seMember, "Hierarchy", it.hierarchy()); + } + } + + private void addSetListType(SOAPElement e, SetListType it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_CROSS_PRODUCT); + addTypeList(el, it.setType()); + addChildElement(el, MDDATASET.QN_SIZE, String.valueOf(it.size())); + } + } + + private void addNormTupleSet(SOAPElement soapElement, NormTupleSet normTupleSet) { + if (normTupleSet != null) { + SOAPElement el = addChildElement(soapElement, MDDATASET.QN_NORM_TUPLE_SET); + addNormTuplesType(el, normTupleSet.normTuples()); + addTupleTypeList(el, normTupleSet.membersLookup()); + } + } + + private void addNormTuplesType(SOAPElement e, NormTuplesType it) { + if (it != null) { + SOAPElement el = addChildElement(e, QN_NORM_TUPLES); + addNormTupleList(el, it.normTuple()); + } + } + + private void addNormTupleList(SOAPElement el, List list) { + if (list != null) { + list.forEach(it -> addNormTuple(el, it)); + } + } + + private void addNormTuple(SOAPElement e, NormTuple it) { + if (it != null) { + SOAPElement el = addChildElement(e, QN_NORM_TUPLE); + addMemberRefList(el, it.memberRef()); + } + } + + private void addMemberRefList(SOAPElement e, List list) { + if (list != null) { + list.forEach(it -> addMemberRef(e, it)); + } + } + + private void addMemberRef(SOAPElement e, MemberRef it) { + if (it != null) { + SOAPElement el = addChildElement(e, QN_MEMBER_REF); + addChildElementWithValue(el, QN_MEMBER_ORDINAL, String.valueOf(it.memberOrdinal())); + addChildElementWithValue(el, QN_MEMBER_DISP_INFO, String.valueOf(it.memberDispInfo())); + } + } + + private void addTupleTypeList(SOAPElement soapElement, MembersLookup membersLookup) { + if (membersLookup != null) { + SOAPElement el = addChildElement(soapElement, QN_MEMBERS_LOOKUP); + if (membersLookup.members() != null) { + membersLookup.members().forEach(it -> addTupleTypeMembers(el, it)); + } + } + } + + private void addUnion(SOAPElement soapElement, Union union) { + if (union != null) { + SOAPElement el = addChildElement(soapElement, MDDATASET.QN_UNION); + addTypeList(el, union.setType()); + } + } + + private void addCellData(SOAPElement e, CellData it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_CELL_DATA); + addCellTypeList(el, it.cell()); + } + } + + private void addCellTypeList(SOAPElement el, List list) { + if (list != null) { + list.forEach(it -> addCellType(el, it)); + } + } + + private void addCellType(SOAPElement e, CellType it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_CELL); + addCellTypeValue(el, it.value()); + addCellInfoItemList(el, it.any()); + setAttribute(el, "CellOrdinal", String.valueOf(it.cellOrdinal())); + } + } + + private void addCellTypeValue(SOAPElement e, Value it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_VALUE); + el.setAttribute("xsi:type", it.type().getValue()); + el.setTextContent(it.value()); + addCellTypeErrorList(el, it.error()); + } + } + + private void addCellTypeErrorList(SOAPElement el, List list) { + if (list != null) { + list.forEach(it -> addCellTypeError(el, it)); + } + } + + private void addCellTypeError(SOAPElement e, CellTypeError it) { + if (it != null) { + SOAPElement el = addChildElement(e, MDDATASET.QN_ERROR); + setAttribute(el, "ErrorCode", String.valueOf(it.errorCode())); + setAttribute(el, "Description", it.description()); + } + } + + private SOAPElement addRowSetRoot(SOAPBody body, RowSet rowSet) throws SOAPException { + SOAPElement seExecuteResponse = body.addChildElement(Constants.MSXMLA.QN_EXECUTE_RESPONSE); + SOAPElement seReturn = seExecuteResponse.addChildElement(Constants.MSXMLA.QN_RETURN); + SOAPElement seRoot = seReturn.addChildElement(DiscoverConstants.ROWSET.QN_ROOT); + + seRoot.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + seRoot.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + seRoot.setAttribute("xmlns:EX", Constants.EX.NS_URN); + addRowsetSchema(seRoot, rowSet); + return seRoot; + } + + private void addRowsetSchema(SOAPElement root, RowSet rowSet) { + SOAPElement schema = addChildElement(root, Constants.XSD.QN_SCHEMA); + schema.setAttribute("xmlns:xsd", Constants.XSD.NS_URN); + schema.setAttribute("targetNamespace", DiscoverConstants.ROWSET.NS_URN); + schema.setAttribute("xmlns", DiscoverConstants.ROWSET.NS_URN); + schema.setAttribute("xmlns:xsi", Constants.XSI.NS_URN); + schema.setAttribute("xmlns:sql", Constants.SQL.NS_URN); + schema.setAttribute("elementFormDefault", "qualified"); + + SOAPElement el1 = addChildElement(schema, Constants.XSD.QN_ELEMENT); + el1.setAttribute("name", "root"); + SOAPElement el1complexType = addChildElement(el1, Constants.XSD.QN_COMPLEX_TYPE); + SOAPElement el1complexTypeSequence = addChildElement(el1complexType, Constants.XSD.QN_SEQUENCE); + SOAPElement el1complexTypeSequenceEl = addChildElement(el1complexTypeSequence, Constants.XSD.QN_ELEMENT); + el1complexTypeSequenceEl.setAttribute("maxOccurs", "unbounded"); + el1complexTypeSequenceEl.setAttribute("minOccurs", "0"); + el1complexTypeSequenceEl.setAttribute("name", "row"); + el1complexTypeSequenceEl.setAttribute("type", "row"); + + SOAPElement simpleType = addChildElement(schema, Constants.XSD.QN_SIMPLE_TYPE); + simpleType.setAttribute("name", "uuid"); + SOAPElement restriction = addChildElement(simpleType, Constants.XSD.QN_RESTRICTION); + restriction.setAttribute("base", "xsd:string"); + SOAPElement pattern = addChildElement(restriction, Constants.XSD.QN_PATTERN); + pattern.setAttribute("value", UUID_VALUE); + + SOAPElement complexType = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + complexType.setAttribute("name", "xmlDocument"); + SOAPElement sequence = addChildElement(complexType, Constants.XSD.QN_SEQUENCE); + addChildElement(sequence, Constants.XSD.QN_ANY); + + SOAPElement ct = addChildElement(schema, Constants.XSD.QN_COMPLEX_TYPE); + ct.setAttribute("name", "row"); + SOAPElement ctSequence = addChildElement(ct, Constants.XSD.QN_SEQUENCE); + if (rowSet.rowSetRows() != null && !rowSet.rowSetRows().isEmpty() && rowSet.rowSetRows().get(0) != null + && rowSet.rowSetRows().get(0).rowSetRowItem() != null) { + for (RowSetRowItem item : rowSet.rowSetRows().get(0).rowSetRowItem()) { + SOAPElement ctSequenceEl1 = addChildElement(ctSequence, Constants.XSD.QN_ELEMENT); + ItemTypeEnum type = item.type().orElse(ItemTypeEnum.STRING); + ctSequenceEl1.setAttribute("minOccurs", "0"); + ctSequenceEl1.setAttribute("name", item.tagName()); + ctSequenceEl1.setAttribute("sql:field", item.fieldName()); + ctSequenceEl1.setAttribute("type", type.getValue()); + } + } + } + + private void addRowSetRow(SOAPElement e, RowSetRow it) throws SOAPException { + SOAPElement seRow = e.addChildElement(DiscoverConstants.ROWSET.QN_ROW); + if (it.rowSetRowItem() != null) { + it.rowSetRowItem().forEach(i -> addRowSetRowItem(seRow, i)); + } + } + + private void addRowSetRowItem(SOAPElement e, RowSetRowItem it) { + if (it != null) { + SOAPElement el = addChildElementWithPrefix(e, it.tagName(), DiscoverConstants.ROWSET.PREFIX); + el.setTextContent(it.value()); + it.type().ifPresent(v -> setAttribute(el, "type", v.getValue())); + } + } + + private String instantToString(Instant instant) { + return instant != null ? formatter.format(instant) : null; + } + + private void setAttribute(SOAPElement el, String name, String value) { + if (value != null) { + el.setAttribute(name, value); + } + } + + private SOAPElement addChildElement(SOAPElement element, QName qNameOfChild, String valueOfChild) { + try { + SOAPElement createdChild = element.addChildElement(qNameOfChild); + createdChild.setTextContent(valueOfChild); + return createdChild; + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", qNameOfChild); + throw new XmlaSoapException("addChildElement error", e); + } + } + + private SOAPElement addChildElement(SOAPElement element, QName qNameOfChild) { + try { + return element.addChildElement(qNameOfChild); + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", qNameOfChild); + throw new XmlaSoapException("addChildElement error", e); + } + } + + private SOAPElement addChildElement(SOAPElement element, String childElementName) { + try { + return element.addChildElement(childElementName); + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", childElementName); + throw new XmlaSoapException("addChildElement error", e); + } + } + + private void addChildElementWithValue(SOAPElement element, String childElementName, String value) { + try { + if (value != null) { + element.addChildElement(childElementName).setTextContent(value); + } + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", childElementName); + throw new XmlaSoapException("addChildElement error", e); + } + } + + private SOAPElement addChildElementWithPrefix(SOAPElement element, String childElementName, String prefix) { + try { + if (prefix == null || prefix.isEmpty()) { + return element.addChildElement(childElementName); + } else { + return element.addChildElement(childElementName, prefix); + } + } catch (SOAPException e) { + LOGGER.error("addChildElement {} error", childElementName); + throw new XmlaSoapException("addChildElement error", e); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/ActionConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/ActionConverter.java new file mode 100644 index 0000000..f9c4607 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/ActionConverter.java @@ -0,0 +1,387 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ACTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.APPLICATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CAPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CAPTION_IS_MDX; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CONDITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.EXPRESSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.INVOCATION_LOW; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TARGET; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TARGET_TYPE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getNodeType; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.Action; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.Binding; +import org.eclipse.daanse.xmla.api.xmla.ReportFormatParameter; +import org.eclipse.daanse.xmla.api.xmla.ReportParameter; +import org.eclipse.daanse.xmla.api.xmla.TargetTypeEnum; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.api.xmla.TypeEnum; +import org.eclipse.daanse.xmla.model.record.xmla.DrillThroughActionR; +import org.eclipse.daanse.xmla.model.record.xmla.ReportActionR; +import org.eclipse.daanse.xmla.model.record.xmla.ReportFormatParameterR; +import org.eclipse.daanse.xmla.model.record.xmla.ReportParameterR; +import org.eclipse.daanse.xmla.model.record.xmla.StandardActionR; +import org.w3c.dom.NodeList; + +/** + * Converter for Action types (StandardAction, ReportAction, DrillThroughAction) + * from XML NodeList. + */ +public class ActionConverter { + + private ActionConverter() { + // utility class + } + + public static List getActionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ACTION.equals(node.getNodeName()))) { + list.add(getAction(node.getChildNodes(), getNodeType(node))); + } + } + return list; + } + + public static Action getAction(NodeList nl, String type) { + if ("StandardAction".equals(type)) { + return getStandardAction(nl); + } + if ("ReportAction".equals(type)) { + return getReportAction(nl); + } + if ("DrillThroughAction".equals(type)) { + return getDrillThroughAction(nl); + } + return null; + } + + public static Action getStandardAction(NodeList nl) { + String name = null; + String id = null; + String caption = null; + Boolean captionIsMdx = null; + List translations = null; + TargetTypeEnum targetType = null; + String target = null; + String condition = null; + TypeEnum type = null; + String invocation = null; + String application = null; + String description = null; + List annotations = null; + String expression = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CAPTION.equals(node.getNodeName())) { + caption = node.getTextContent(); + } + if (CAPTION_IS_MDX.equals(node.getNodeName())) { + captionIsMdx = toBoolean(node.getTextContent()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (TARGET_TYPE.equals(node.getNodeName())) { + targetType = TargetTypeEnum.fromValue(node.getTextContent()); + } + if (TARGET.equals(node.getNodeName())) { + target = node.getTextContent(); + } + if (CONDITION.equals(node.getNodeName())) { + condition = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = TypeEnum.fromValue(node.getTextContent()); + } + if (INVOCATION_LOW.equals(node.getNodeName())) { + invocation = node.getTextContent(); + } + if (APPLICATION.equals(node.getNodeName())) { + application = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (EXPRESSION.equals(node.getNodeName())) { + expression = node.getTextContent(); + } + } + } + return new StandardActionR(name, Optional.ofNullable(id), Optional.ofNullable(caption), + Optional.ofNullable(captionIsMdx), Optional.ofNullable(translations), targetType, + Optional.ofNullable(target), Optional.ofNullable(condition), type, Optional.ofNullable(invocation), + Optional.ofNullable(application), Optional.ofNullable(description), Optional.ofNullable(annotations), + expression); + } + + public static Action getReportAction(NodeList nl) { + String name = null; + String id = null; + String caption = null; + Boolean captionIsMdx = null; + List translations = null; + TargetTypeEnum targetType = null; + String target = null; + String condition = null; + TypeEnum type = null; + String invocation = null; + String application = null; + String description = null; + List annotations = null; + String reportServer = null; + String path = null; + List reportParameters = null; + List reportFormatParameters = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CAPTION.equals(node.getNodeName())) { + caption = node.getTextContent(); + } + if (CAPTION_IS_MDX.equals(node.getNodeName())) { + captionIsMdx = toBoolean(node.getTextContent()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (TARGET_TYPE.equals(node.getNodeName())) { + targetType = TargetTypeEnum.fromValue(node.getTextContent()); + } + if (TARGET.equals(node.getNodeName())) { + target = node.getTextContent(); + } + if (CONDITION.equals(node.getNodeName())) { + condition = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = TypeEnum.fromValue(node.getTextContent()); + } + if (INVOCATION_LOW.equals(node.getNodeName())) { + invocation = node.getTextContent(); + } + if (APPLICATION.equals(node.getNodeName())) { + application = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("ReportServer".equals(node.getNodeName())) { + reportServer = node.getTextContent(); + } + if ("Path".equals(node.getNodeName())) { + path = node.getTextContent(); + } + if ("ReportParameters".equals(node.getNodeName())) { + reportParameters = getReportParameterList(node.getChildNodes()); + } + if ("ReportFormatParameters".equals(node.getNodeName())) { + reportFormatParameters = getReportFormatParametersList(node.getChildNodes()); + } + } + } + return new ReportActionR(name, Optional.ofNullable(id), Optional.ofNullable(caption), + Optional.ofNullable(captionIsMdx), Optional.ofNullable(translations), targetType, + Optional.ofNullable(target), Optional.ofNullable(condition), type, Optional.ofNullable(invocation), + Optional.ofNullable(application), Optional.ofNullable(description), Optional.ofNullable(annotations), + reportServer, Optional.ofNullable(path), Optional.ofNullable(reportParameters), + Optional.ofNullable(reportFormatParameters)); + } + + public static Action getDrillThroughAction(NodeList nl) { + String name = null; + String id = null; + String caption = null; + Boolean captionIsMdx = null; + List translations = null; + TargetTypeEnum targetType = null; + String target = null; + String condition = null; + TypeEnum type = null; + String invocation = null; + String application = null; + String description = null; + List annotations = null; + Boolean defaultAction = null; + List columns = null; + Integer maximumRows = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CAPTION.equals(node.getNodeName())) { + caption = node.getTextContent(); + } + if (CAPTION_IS_MDX.equals(node.getNodeName())) { + captionIsMdx = toBoolean(node.getTextContent()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (TARGET_TYPE.equals(node.getNodeName())) { + targetType = TargetTypeEnum.fromValue(node.getTextContent()); + } + if (TARGET.equals(node.getNodeName())) { + target = node.getTextContent(); + } + if (CONDITION.equals(node.getNodeName())) { + condition = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = TypeEnum.fromValue(node.getTextContent()); + } + if (INVOCATION_LOW.equals(node.getNodeName())) { + invocation = node.getTextContent(); + } + if (APPLICATION.equals(node.getNodeName())) { + application = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("Default".equals(node.getNodeName())) { + defaultAction = toBoolean(node.getTextContent()); + } + if (COLUMNS.equals(node.getNodeName())) { + columns = getBindingList(node.getChildNodes()); + } + if ("MaximumRows".equals(node.getNodeName())) { + maximumRows = toInteger(node.getTextContent()); + } + } + } + return new DrillThroughActionR(name, Optional.ofNullable(id), Optional.ofNullable(caption), + Optional.ofNullable(captionIsMdx), Optional.ofNullable(translations), targetType, + Optional.ofNullable(target), Optional.ofNullable(condition), type, Optional.ofNullable(invocation), + Optional.ofNullable(application), Optional.ofNullable(description), Optional.ofNullable(annotations), + Optional.ofNullable(defaultAction), Optional.ofNullable(columns), Optional.ofNullable(maximumRows)); + } + + private static List getBindingList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Column".equals(node.getNodeName()))) { + list.add(BindingConverter.getBinding(node.getChildNodes(), getNodeType(node))); + } + } + return list; + } + + private static List getReportFormatParametersList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("ReportFormatParameter".equals(node.getNodeName()))) { + list.add(getReportFormatParameter(node.getChildNodes())); + } + } + return list; + } + + private static ReportFormatParameter getReportFormatParameter(NodeList nl) { + String name = null; + String value = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (VALUE.equals(node.getNodeName())) { + value = node.getTextContent(); + } + } + } + return new ReportFormatParameterR(name, value); + } + + private static List getReportParameterList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("ReportParameter".equals(node.getNodeName()))) { + list.add(getReportParameter(node.getChildNodes())); + } + } + return list; + } + + private static ReportParameter getReportParameter(NodeList nl) { + String name = null; + String value = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (VALUE.equals(node.getNodeName())) { + value = node.getTextContent(); + } + } + } + return new ReportParameterR(name, value); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/AggregationConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/AggregationConverter.java new file mode 100644 index 0000000..86ef686 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/AggregationConverter.java @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ESTIMATED_ROWS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.time.Instant; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.Aggregation; +import org.eclipse.daanse.xmla.api.xmla.AggregationAttribute; +import org.eclipse.daanse.xmla.api.xmla.AggregationDesign; +import org.eclipse.daanse.xmla.api.xmla.AggregationDesignAttribute; +import org.eclipse.daanse.xmla.api.xmla.AggregationDesignDimension; +import org.eclipse.daanse.xmla.api.xmla.AggregationDimension; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationDesignAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationDesignDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationDesignR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationR; +import org.w3c.dom.NodeList; + +/** + * Converter for Aggregation-related XMLA types. Handles AggregationDesign, + * Aggregation, and related nested types. + */ +public class AggregationConverter { + + private AggregationConverter() { + // utility class + } + + /** + * Functional interface for annotation list parsing. Allows AggregationConverter + * to use shared annotation parsing from Convert. + */ + @FunctionalInterface + public interface AnnotationListParser { + List getAnnotationList(NodeList nl); + } + + public static AggregationDesign getAggregationDesign(NodeList nl, AnnotationListParser annotationParser) { + String name = null; + Optional id = Optional.empty(); + Optional createdTimestamp = Optional.empty(); + Optional lastSchemaUpdate = Optional.empty(); + Optional description = Optional.empty(); + Optional> annotations = Optional.empty(); + Optional estimatedRows = Optional.empty(); + Optional> dimensions = Optional.empty(); + Optional> aggregations = Optional.empty(); + Optional estimatedPerformanceGain = Optional.empty(); + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = Optional.ofNullable(node.getTextContent()); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = Optional.ofNullable(toInstant(node.getTextContent())); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = Optional.ofNullable(toInstant(node.getTextContent())); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = Optional.ofNullable(node.getTextContent()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = Optional.ofNullable(annotationParser.getAnnotationList(node.getChildNodes())); + } + if (ESTIMATED_ROWS.equals(node.getNodeName())) { + estimatedRows = Optional.ofNullable(toLong(node.getTextContent())); + } + if (DIMENSIONS.equals(node.getNodeName())) { + dimensions = Optional + .ofNullable(getAggregationDesignDimensionList(node.getChildNodes(), annotationParser)); + } + if ("Aggregations".equals(node.getNodeName())) { + aggregations = Optional.ofNullable(getAggregationList(node.getChildNodes(), annotationParser)); + } + if ("EstimatedPerformanceGain".equals(node.getNodeName())) { + estimatedPerformanceGain = Optional.ofNullable(toInteger(node.getTextContent())); + } + } + } + return new AggregationDesignR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, + estimatedRows, dimensions, aggregations, estimatedPerformanceGain); + } + + public static List getAggregationList(NodeList nl, AnnotationListParser annotationParser) { + return getList(nl, "Aggregation", childNl -> getAggregation(childNl, annotationParser)); + } + + public static Aggregation getAggregation(NodeList nl, AnnotationListParser annotationParser) { + Optional id = Optional.empty(); + String name = null; + Optional> dimensions = Optional.empty(); + Optional> annotations = Optional.empty(); + Optional description = Optional.empty(); + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ID.equals(node.getNodeName())) { + id = Optional.ofNullable(node.getTextContent()); + } + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = Optional.ofNullable(node.getTextContent()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = Optional.ofNullable(annotationParser.getAnnotationList(node.getChildNodes())); + } + if (DIMENSIONS.equals(node.getNodeName())) { + dimensions = Optional + .ofNullable(getAggregationDimensionList(node.getChildNodes(), annotationParser)); + } + } + } + return new AggregationR(id, name, dimensions, annotations, description); + } + + public static List getAggregationDimensionList(NodeList nl, + AnnotationListParser annotationParser) { + return getList(nl, DIMENSION, childNl -> getAggregationDimension(childNl, annotationParser)); + } + + public static AggregationDimension getAggregationDimension(NodeList nl, AnnotationListParser annotationParser) { + String cubeDimensionID = null; + Optional> attributes = Optional.empty(); + Optional> annotations = Optional.empty(); + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { + cubeDimensionID = node.getTextContent(); + } + if (ATTRIBUTES.equals(node.getNodeName())) { + attributes = Optional + .ofNullable(getAggregationAttributeList(node.getChildNodes(), annotationParser)); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = Optional.ofNullable(annotationParser.getAnnotationList(node.getChildNodes())); + } + } + } + return new AggregationDimensionR(cubeDimensionID, attributes, annotations); + } + + public static List getAggregationAttributeList(NodeList nl, + AnnotationListParser annotationParser) { + return getList(nl, ATTRIBUTE, childNl -> getAggregationAttribute(childNl, annotationParser)); + } + + public static AggregationAttribute getAggregationAttribute(NodeList nl, AnnotationListParser annotationParser) { + String attributeID = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = annotationParser.getAnnotationList(node.getChildNodes()); + } + } + } + return new AggregationAttributeR(attributeID, Optional.ofNullable(annotations)); + } + + public static List getAggregationDesignDimensionList(NodeList nl, + AnnotationListParser annotationParser) { + return getList(nl, DIMENSION, childNl -> getAggregationDesignDimension(childNl, annotationParser)); + } + + public static AggregationDesignDimension getAggregationDesignDimension(NodeList nl, + AnnotationListParser annotationParser) { + String cubeDimensionID = null; + List attributes = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { + cubeDimensionID = node.getTextContent(); + } + if (ATTRIBUTES.equals(node.getNodeName())) { + attributes = getAggregationDesignAttributeList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = annotationParser.getAnnotationList(node.getChildNodes()); + } + } + } + return new AggregationDesignDimensionR(cubeDimensionID, Optional.ofNullable(attributes), + Optional.ofNullable(annotations)); + } + + public static List getAggregationDesignAttributeList(NodeList nl) { + return getList(nl, ATTRIBUTE, AggregationConverter::getAggregationDesignAttribute); + } + + public static AggregationDesignAttribute getAggregationDesignAttribute(NodeList nl) { + String attributeID = null; + Long estimatedCount = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if ("EstimatedCount".equals(node.getNodeName())) { + estimatedCount = toLong(node.getTextContent()); + } + } + } + return new AggregationDesignAttributeR(attributeID, Optional.ofNullable(estimatedCount)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/AssemblyConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/AssemblyConverter.java new file mode 100644 index 0000000..d0ff900 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/AssemblyConverter.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ASSEMBLY2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; + +import java.time.Instant; +import java.util.List; + +import org.eclipse.daanse.xmla.api.engine.ImpersonationInfo; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.Assembly; +import org.eclipse.daanse.xmla.model.record.xmla.AssemblyR; +import org.w3c.dom.NodeList; + +/** + * Converter for Assembly types from XML NodeList. + */ +public class AssemblyConverter { + + private AssemblyConverter() { + // utility class + } + + public static List getAssemblyList(NodeList nl) { + return getList(nl, ASSEMBLY2, AssemblyConverter::getAssembly); + } + + public static Assembly getAssembly(NodeList nl) { + String id = null; + String name = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + ImpersonationInfo impersonationInfo = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("ImpersonationInfo".equals(node.getNodeName())) { + impersonationInfo = DataSourceConverter.getImpersonationInfo(node.getChildNodes()); + } + } + } + return new AssemblyR(id, name, createdTimestamp, lastSchemaUpdate, description, annotations, impersonationInfo); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/BindingConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/BindingConverter.java new file mode 100644 index 0000000..12b3c23 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/BindingConverter.java @@ -0,0 +1,680 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_VIEW_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.EXPRESSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.FILTER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ORDINAL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.REFRESH_INTERVAL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TABLE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getStringList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toDuration; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; + +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.AttributeBindingTypeEnum; +import org.eclipse.daanse.xmla.api.xmla.Binding; +import org.eclipse.daanse.xmla.api.xmla.FiscalYearNameEnum; +import org.eclipse.daanse.xmla.api.xmla.Group; +import org.eclipse.daanse.xmla.api.xmla.IncrementalProcessingNotification; +import org.eclipse.daanse.xmla.api.xmla.PersistenceEnum; +import org.eclipse.daanse.xmla.api.xmla.ProactiveCachingBinding; +import org.eclipse.daanse.xmla.api.xmla.RefreshPolicyEnum; +import org.eclipse.daanse.xmla.api.xmla.ReportingWeekToMonthPatternEnum; +import org.eclipse.daanse.xmla.api.xmla.TabularBinding; +import org.eclipse.daanse.xmla.model.record.engine200_200.ExpressionBindingR; +import org.eclipse.daanse.xmla.model.record.engine200_200.RowNumberBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.AttributeBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.CalculatedMeasureBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.ColumnBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeAttributeBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeDimensionBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DSVTableBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DataSourceViewBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DimensionBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.GroupR; +import org.eclipse.daanse.xmla.model.record.xmla.IncrementalProcessingNotificationR; +import org.eclipse.daanse.xmla.model.record.xmla.InheritedBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureGroupDimensionBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.ProactiveCachingBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.ProactiveCachingIncrementalProcessingBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.QueryBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.RowBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.TableBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.TimeAttributeBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.TimeBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.UserDefinedGroupBindingR; +import org.w3c.dom.NodeList; + +/** + * Converter for Binding-related XMLA types. Handles all Binding variants + * including TabularBinding and ProactiveCachingBinding. + */ +public class BindingConverter { + + private BindingConverter() { + // utility class + } + + /** + * Functional interface for column binding parsing dependency. + */ + @FunctionalInterface + public interface ColumnBindingParser { + Binding getColumnBinding(NodeList nl); + } + + /** + * Functional interface for MeasureGroupBinding parsing dependency. + */ + @FunctionalInterface + public interface MeasureGroupBindingParser { + Binding getMeasureGroupBinding(NodeList nl); + } + + /** + * Simplified getBinding without callbacks. For ColumnBinding and + * MeasureGroupBinding, use the full version with callbacks. + */ + public static Binding getBinding(NodeList nl, String type) { + if ("ColumnBinding".equals(type)) { + return getColumnBinding(nl); + } + if ("RowBinding".equals(type)) { + return getRowBinding(nl); + } + if ("DataSourceViewBinding".equals(type)) { + return getDataSourceViewBinding(nl); + } + if ("AttributeBinding".equals(type)) { + return getAttributeBinding(nl); + } + if ("UserDefinedGroupBinding".equals(type)) { + return getUserDefinedGroupBinding(nl); + } + if ("MeasureBinding".equals(type)) { + return getMeasureBinding(nl); + } + if ("CubeAttributeBinding".equals(type)) { + return getCubeAttributeBinding(nl); + } + if ("DimensionBinding".equals(type)) { + return getDimensionBinding(nl); + } + if ("CubeDimensionBinding".equals(type)) { + return getCubeDimensionBinding(nl); + } + if ("MeasureGroupBinding".equals(type)) { + // MeasureGroupBinding requires CubeConverter - use full version with callback + return null; + } + if ("MeasureGroupDimensionBinding".equals(type)) { + return getMeasureGroupDimensionBinding(nl); + } + if ("TimeBinding".equals(type)) { + return getTimeBinding(nl); + } + if ("TimeAttributeBinding".equals(type)) { + return getTimeAttributeBinding(); + } + if ("InheritedBinding".equals(type)) { + return getInheritedBinding(); + } + if ("CalculatedMeasureBinding".equals(type)) { + return getCalculatedMeasureBinding(nl); + } + if ("RowNumberBinding".equals(type)) { + return getRowNumberBinding(); + } + if ("ExpressionBinding".equals(type)) { + return getExpressionBinding(nl); + } + return null; + } + + // Main Binding dispatcher with callbacks (for complex cases) + public static Binding getBinding(NodeList nl, String type, ColumnBindingParser columnParser, + MeasureGroupBindingParser mgParser) { + if ("ColumnBinding".equals(type)) { + return columnParser.getColumnBinding(nl); + } + if ("RowBinding".equals(type)) { + return getRowBinding(nl); + } + if ("DataSourceViewBinding".equals(type)) { + return getDataSourceViewBinding(nl); + } + if ("AttributeBinding".equals(type)) { + return getAttributeBinding(nl); + } + if ("UserDefinedGroupBinding".equals(type)) { + return getUserDefinedGroupBinding(nl); + } + if ("MeasureBinding".equals(type)) { + return getMeasureBinding(nl); + } + if ("CubeAttributeBinding".equals(type)) { + return getCubeAttributeBinding(nl); + } + if ("DimensionBinding".equals(type)) { + return getDimensionBinding(nl); + } + if ("CubeDimensionBinding".equals(type)) { + return getCubeDimensionBinding(nl); + } + if ("MeasureGroupBinding".equals(type)) { + return mgParser.getMeasureGroupBinding(nl); + } + if ("MeasureGroupDimensionBinding".equals(type)) { + return getMeasureGroupDimensionBinding(nl); + } + if ("TimeBinding".equals(type)) { + return getTimeBinding(nl); + } + if ("TimeAttributeBinding".equals(type)) { + return getTimeAttributeBinding(); + } + if ("InheritedBinding".equals(type)) { + return getInheritedBinding(); + } + if ("CalculatedMeasureBinding".equals(type)) { + return getCalculatedMeasureBinding(nl); + } + if ("RowNumberBinding".equals(type)) { + return getRowNumberBinding(); + } + if ("ExpressionBinding".equals(type)) { + return getExpressionBinding(nl); + } + return null; + } + + public static Binding getExpressionBinding(NodeList nl) { + String expression = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (EXPRESSION.equals(node.getNodeName()))) { + expression = node.getTextContent(); + } + } + return new ExpressionBindingR(expression); + } + + public static Binding getRowNumberBinding() { + return new RowNumberBindingR(); + } + + public static Binding getCalculatedMeasureBinding(NodeList nl) { + String measureName = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("MeasureName".equals(node.getNodeName()))) { + measureName = node.getTextContent(); + } + } + return new CalculatedMeasureBindingR(measureName); + } + + public static Binding getInheritedBinding() { + return new InheritedBindingR(); + } + + public static Binding getTimeAttributeBinding() { + return new TimeAttributeBindingR(); + } + + public static Binding getTimeBinding(NodeList nl) { + Instant calendarStartDate = null; + Instant calendarEndDate = null; + Integer firstDayOfWeek = null; + BigInteger calendarLanguage = null; + Integer fiscalFirstMonth = null; + Integer fiscalFirstDayOfMonth = null; + FiscalYearNameEnum fiscalYearName = null; + Integer reportingFirstMonth = null; + String reportingFirstWeekOfMonth = null; + ReportingWeekToMonthPatternEnum reportingWeekToMonthPattern = null; + Integer manufacturingFirstMonth = null; + Integer manufacturingFirstWeekOfMonth = null; + Integer manufacturingExtraMonthQuarter = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("CalendarStartDate".equals(node.getNodeName())) { + calendarStartDate = toInstant(node.getTextContent()); + } + if ("CalendarEndDate".equals(node.getNodeName())) { + calendarEndDate = toInstant(node.getTextContent()); + } + if ("FirstDayOfWeek".equals(node.getNodeName())) { + firstDayOfWeek = toInteger(node.getTextContent()); + } + if ("CalendarLanguage".equals(node.getNodeName())) { + calendarLanguage = toBigInteger(node.getTextContent()); + } + if ("FiscalFirstMonth".equals(node.getNodeName())) { + fiscalFirstMonth = toInteger(node.getTextContent()); + } + if ("FiscalFirstDayOfMonth".equals(node.getNodeName())) { + fiscalFirstDayOfMonth = toInteger(node.getTextContent()); + } + if ("FiscalYearName".equals(node.getNodeName())) { + fiscalYearName = FiscalYearNameEnum.fromValue(node.getTextContent()); + } + if ("ReportingFirstMonth".equals(node.getNodeName())) { + reportingFirstMonth = toInteger(node.getTextContent()); + } + if ("ReportingFirstWeekOfMonth".equals(node.getNodeName())) { + reportingFirstWeekOfMonth = node.getTextContent(); + } + if ("ReportingWeekToMonthPattern".equals(node.getNodeName())) { + reportingWeekToMonthPattern = ReportingWeekToMonthPatternEnum.fromValue(node.getTextContent()); + } + if ("ManufacturingFirstMonth".equals(node.getNodeName())) { + manufacturingFirstMonth = toInteger(node.getTextContent()); + } + if ("ManufacturingFirstWeekOfMonth".equals(node.getNodeName())) { + manufacturingFirstWeekOfMonth = toInteger(node.getTextContent()); + } + if ("ManufacturingExtraMonthQuarter".equals(node.getNodeName())) { + manufacturingExtraMonthQuarter = toInteger(node.getTextContent()); + } + } + } + return new TimeBindingR(calendarStartDate, calendarEndDate, Optional.ofNullable(firstDayOfWeek), + Optional.ofNullable(calendarLanguage), Optional.ofNullable(fiscalFirstMonth), + Optional.ofNullable(fiscalFirstDayOfMonth), Optional.ofNullable(fiscalYearName), + Optional.ofNullable(reportingFirstMonth), Optional.ofNullable(reportingFirstWeekOfMonth), + Optional.ofNullable(reportingWeekToMonthPattern), Optional.ofNullable(manufacturingFirstMonth), + Optional.ofNullable(manufacturingFirstWeekOfMonth), + Optional.ofNullable(manufacturingExtraMonthQuarter)); + } + + public static Binding getMeasureGroupDimensionBinding(NodeList nl) { + String cubeDimensionID = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (CUBE_DIMENSION_ID.equals(node.getNodeName()))) { + cubeDimensionID = node.getTextContent(); + } + } + return new MeasureGroupDimensionBindingR(cubeDimensionID); + } + + public static Binding getCubeDimensionBinding(NodeList nl) { + String dataSourceID = null; + String cubeID = null; + String cubeDimensionID = null; + String filter = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (DATA_SOURCE_ID.equals(node.getNodeName())) { + dataSourceID = node.getTextContent(); + } + if (CUBE_ID.equals(node.getNodeName())) { + cubeID = node.getTextContent(); + } + if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { + cubeDimensionID = node.getTextContent(); + } + if (FILTER.equals(node.getNodeName())) { + filter = node.getTextContent(); + } + } + } + return new CubeDimensionBindingR(dataSourceID, cubeID, cubeDimensionID, Optional.ofNullable(filter)); + } + + public static Binding getDimensionBinding(NodeList nl) { + String dataSourceID = null; + String dimensionID = null; + PersistenceEnum persistence = null; + RefreshPolicyEnum refreshPolicy = null; + Duration refreshInterval = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (DATA_SOURCE_ID.equals(node.getNodeName())) { + dataSourceID = node.getTextContent(); + } + if (DIMENSION_ID.equals(node.getNodeName())) { + dimensionID = node.getTextContent(); + } + if ("Persistence".equals(node.getNodeName())) { + persistence = PersistenceEnum.fromValue(node.getTextContent()); + } + if ("RefreshPolicy".equals(node.getNodeName())) { + refreshPolicy = RefreshPolicyEnum.fromValue(node.getTextContent()); + } + if (REFRESH_INTERVAL.equals(node.getNodeName())) { + refreshInterval = toDuration(node.getTextContent()); + } + } + } + return new DimensionBindingR(dataSourceID, dimensionID, Optional.ofNullable(persistence), + Optional.ofNullable(refreshPolicy), Optional.ofNullable(refreshInterval)); + } + + public static Binding getCubeAttributeBinding(NodeList nl) { + String cubeID = null; + String cubeDimensionID = null; + String attributeID = null; + AttributeBindingTypeEnum type = null; + List ordinal = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (CUBE_ID.equals(node.getNodeName())) { + cubeID = node.getTextContent(); + } + if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { + cubeDimensionID = node.getTextContent(); + } + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = AttributeBindingTypeEnum.fromValue(node.getTextContent()); + } + if (ORDINAL.equals(node.getNodeName())) { + ordinal = getOrdinalList(node.getChildNodes()); + } + } + } + return new CubeAttributeBindingR(cubeID, cubeDimensionID, attributeID, type, Optional.ofNullable(ordinal)); + } + + public static List getOrdinalList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ORDINAL.equals(node.getNodeName()))) { + list.add(toBigInteger(node.getTextContent())); + } + } + return list; + } + + public static Binding getMeasureBinding(NodeList nl) { + String measureID = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (MEASURE_ID.equals(node.getNodeName()))) { + measureID = node.getTextContent(); + } + } + return new MeasureBindingR(measureID); + } + + public static Binding getUserDefinedGroupBinding(NodeList nl) { + String attributeID = null; + List groups = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if ("Groups".equals(node.getNodeName())) { + groups = getGroupList(node.getChildNodes()); + } + } + } + return new UserDefinedGroupBindingR(attributeID, Optional.ofNullable(groups)); + } + + public static List getGroupList(NodeList nl) { + return getList(nl, "Group", BindingConverter::getGroup); + } + + public static Group getGroup(NodeList nl) { + String name = null; + List members = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if ("Members".equals(node.getNodeName())) { + members = getMemberStringList(node.getChildNodes()); + } + } + } + return new GroupR(name, Optional.ofNullable(members)); + } + + public static List getMemberStringList(NodeList nl) { + return getStringList(nl, "Member"); + } + + public static Binding getAttributeBinding(NodeList nl) { + String attributeID = null; + AttributeBindingTypeEnum type = null; + Integer ordinal = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = AttributeBindingTypeEnum.fromValue(node.getTextContent()); + } + if (ORDINAL.equals(node.getNodeName())) { + ordinal = toInteger(node.getTextContent()); + } + } + } + return new AttributeBindingR(attributeID, type, Optional.ofNullable(ordinal)); + } + + public static Binding getRowBinding(NodeList nl) { + String tableID = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (TABLE_ID.equals(node.getNodeName()))) { + tableID = node.getTextContent(); + } + } + return new RowBindingR(tableID); + } + + public static Binding getDataSourceViewBinding(NodeList nl) { + String dataSourceViewID = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("DataSourceViewID".equals(node.getNodeName()))) { + dataSourceViewID = node.getTextContent(); + } + } + return new DataSourceViewBindingR(dataSourceViewID); + } + + // TabularBinding methods + public static TabularBinding getTabularBinding(NodeList nl, String type) { + if ("TableBinding".equals(type)) { + return getTableBinding(nl); + } + if ("QueryBinding".equals(type)) { + return getQueryBinding(nl); + } + if ("DSVTableBinding".equals(type)) { + return getDSVTableBinding(nl); + } + return null; + } + + public static TabularBinding getDSVTableBinding(NodeList nl) { + String dataSourceViewID = null; + String tableID = null; + String dataEmbeddingStyle = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (DATA_SOURCE_VIEW_ID.equals(node.getNodeName())) { + dataSourceViewID = node.getTextContent(); + } + if (TABLE_ID.equals(node.getNodeName())) { + tableID = node.getTextContent(); + } + if ("DataEmbeddingStyle".equals(node.getNodeName())) { + dataEmbeddingStyle = node.getTextContent(); + } + } + } + return new DSVTableBindingR(Optional.ofNullable(dataSourceViewID), tableID, + Optional.ofNullable(dataEmbeddingStyle)); + } + + public static TabularBinding getQueryBinding(NodeList nl) { + String dataSourceID = null; + String queryDefinition = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (DATA_SOURCE_ID.equals(node.getNodeName())) { + dataSourceID = node.getTextContent(); + } + if ("QueryDefinition".equals(node.getNodeName())) { + queryDefinition = node.getTextContent(); + } + } + } + return new QueryBindingR(Optional.ofNullable(dataSourceID), queryDefinition); + } + + public static TabularBinding getTableBinding(NodeList nl) { + String dataSourceID = null; + String dbTableName = null; + String dbSchemaName = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (DATA_SOURCE_ID.equals(node.getNodeName())) { + dataSourceID = node.getTextContent(); + } + if ("DbTableName".equals(node.getNodeName())) { + dbTableName = node.getTextContent(); + } + if ("DbSchemaName".equals(node.getNodeName())) { + dbSchemaName = node.getTextContent(); + } + } + } + return new TableBindingR(Optional.ofNullable(dataSourceID), dbTableName, Optional.ofNullable(dbSchemaName)); + } + + // ProactiveCachingBinding methods + public static ProactiveCachingBinding getProactiveCachingBinding(NodeList nl, String type) { + if ("ProactiveCachingQueryBinding".equals(type)) { + return getProactiveCachingQueryBinding(); + } + if ("ProactiveCachingIncrementalProcessingBinding".equals(type)) { + return getProactiveCachingIncrementalProcessingBinding(nl); + } + return null; + } + + public static ProactiveCachingBinding getProactiveCachingIncrementalProcessingBinding(NodeList nl) { + Duration refreshInterval = null; + List incrementalProcessingNotifications = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (REFRESH_INTERVAL.equals(node.getNodeName())) { + refreshInterval = toDuration(node.getTextContent()); + } + if ("IncrementalProcessingNotifications".equals(node.getNodeName())) { + incrementalProcessingNotifications = getIncrementalProcessingNotificationList(node.getChildNodes()); + } + } + } + return new ProactiveCachingIncrementalProcessingBindingR(Optional.ofNullable(refreshInterval), + incrementalProcessingNotifications); + } + + public static List getIncrementalProcessingNotificationList(NodeList nl) { + return getList(nl, "IncrementalProcessingNotification", BindingConverter::getIncrementalProcessingNotification); + } + + public static IncrementalProcessingNotification getIncrementalProcessingNotification(NodeList nl) { + String tableID = null; + String processingQuery = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (TABLE_ID.equals(node.getNodeName())) { + tableID = node.getTextContent(); + } + if ("ProcessingQuery".equals(node.getNodeName())) { + processingQuery = node.getTextContent(); + } + } + } + return new IncrementalProcessingNotificationR(tableID, processingQuery); + } + + public static ProactiveCachingBinding getProactiveCachingQueryBinding() { + return new ProactiveCachingBindingR(); + } + + public static Binding getColumnBinding(NodeList nl) { + String tableID = null; + String columnID = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (TABLE_ID.equals(node.getNodeName())) { + tableID = node.getTextContent(); + } + if ("ColumnID".equals(node.getNodeName())) { + columnID = node.getTextContent(); + } + } + } + return new ColumnBindingR(tableID, columnID); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CancelHandler.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CancelHandler.java new file mode 100644 index 0000000..031d769 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CancelHandler.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import java.util.List; + +import org.eclipse.daanse.xmla.api.RequestMetaData; +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.execute.ExecuteParameter; +import org.eclipse.daanse.xmla.api.execute.ExecuteService; +import org.eclipse.daanse.xmla.api.execute.cancel.CancelRequest; +import org.eclipse.daanse.xmla.api.execute.cancel.CancelResponse; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.model.record.discover.PropertiesR; +import org.eclipse.daanse.xmla.model.record.execute.cancel.CancelRequestR; +import org.eclipse.daanse.xmla.model.record.xmla.CancelR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteHandler; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.ExecuteResponseUtil; + +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; + +public class CancelHandler implements ExecuteHandler { + + private final ExecuteService executeService; + + public CancelHandler(ExecuteService executeService) { + this.executeService = executeService; + } + + @Override + public void handle(Command command, PropertiesR properties, List parameters, + RequestMetaData metaData, UserRolePrincipal userPrincipal, SOAPBody responseBody) throws SOAPException { + if (!(command instanceof CancelR cancel)) { + return; + } + CancelRequest request = new CancelRequestR(properties, parameters, cancel); + CancelResponse response = executeService.cancel(request, metaData, userPrincipal); + writeResponse(response, responseBody); + } + + private void writeResponse(CancelResponse response, SOAPBody body) throws SOAPException { + SOAPElement root = ExecuteResponseUtil.addEmptyRoot(body); + if (response != null) { + ExecuteResponseUtil.addEmptyresult(root, response.emptyresult()); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandConverter.java new file mode 100644 index 0000000..48a64f1 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandConverter.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ASSEMBLY2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_GROUP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE2; + +import org.eclipse.daanse.xmla.api.xmla.AggregationDesign; +import org.eclipse.daanse.xmla.api.xmla.Assembly; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.Cube; +import org.eclipse.daanse.xmla.api.xmla.DataSource; +import org.eclipse.daanse.xmla.api.xmla.DataSourceView; +import org.eclipse.daanse.xmla.api.xmla.Database; +import org.eclipse.daanse.xmla.api.xmla.Dimension; +import org.eclipse.daanse.xmla.api.xmla.MajorObject; +import org.eclipse.daanse.xmla.api.xmla.MdxScript; +import org.eclipse.daanse.xmla.api.xmla.MeasureGroup; +import org.eclipse.daanse.xmla.api.xmla.MiningModel; +import org.eclipse.daanse.xmla.api.xmla.MiningStructure; +import org.eclipse.daanse.xmla.api.xmla.Partition; +import org.eclipse.daanse.xmla.api.xmla.Permission; +import org.eclipse.daanse.xmla.api.xmla.Perspective; +import org.eclipse.daanse.xmla.api.xmla.Role; +import org.eclipse.daanse.xmla.api.xmla.Server; +import org.eclipse.daanse.xmla.api.xmla.Trace; +import org.eclipse.daanse.xmla.model.record.xmla.MajorObjectR; +import org.w3c.dom.NodeList; + +import jakarta.xml.soap.SOAPElement; + +/** + * Converter for XMLA Command elements. Handles command parsing and MajorObject + * conversion for Execute operations. + */ +public class CommandConverter { + + private CommandConverter() { + // utility class + } + + /** + * Parse a Command from a SOAPElement. Entry point for ExecuteDispatcher. + * + * @param element the SOAP element containing the command + * @return the parsed Command + */ + public static Command commandToCommand(SOAPElement element) { + return CommandParser.commandToCommand(element, CommandConverter::getMajorObject); + } + + /** + * Parse a MajorObject from a NodeList. Used for Alter command ObjectDefinition + * parsing. + * + * @param nl the NodeList containing the MajorObject definition + * @return the parsed MajorObject + */ + static MajorObject getMajorObject(NodeList nl) { + AggregationDesign aggregationDesign = null; + Assembly assembly = null; + Cube cube = null; + Database database = null; + DataSource dataSource = null; + DataSourceView dataSourceView = null; + Dimension dimension = null; + MdxScript mdxScript = null; + MeasureGroup measureGroup = null; + MiningModel miningModel = null; + MiningStructure miningStructure = null; + Partition partition = null; + Permission permission = null; + Perspective perspective = null; + Role role = null; + Server server = null; + Trace trace = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("AggregationDesign".equals(node.getNodeName())) { + aggregationDesign = AggregationConverter.getAggregationDesign(node.getChildNodes(), + CommonConverter::getAnnotationList); + } + if (ASSEMBLY2.equals(node.getNodeName())) { + assembly = AssemblyConverter.getAssembly(node.getChildNodes()); + } + if (CUBE2.equals(node.getNodeName())) { + cube = CubeConverter.getCube(node.getChildNodes(), CommandConverter::getCommandFromNodeList); + } + if ("Database".equals(node.getNodeName())) { + database = DatabaseConverter.getDatabase(node.getChildNodes(), + CommandConverter::getCommandFromNodeList, AssemblyConverter::getAssemblyList); + } + if ("DataSource".equals(node.getNodeName())) { + dataSource = DataSourceConverter.getDataSource(node.getChildNodes()); + } + if ("DataSourceView".equals(node.getNodeName())) { + dataSourceView = DataSourceConverter.getDataSourceView(node.getChildNodes()); + } + if (DIMENSION.equals(node.getNodeName())) { + dimension = DimensionConverter.getDimension(node.getChildNodes()); + } + if ("MdxScript".equals(node.getNodeName())) { + mdxScript = CubeConverter.getMdxScript(node.getChildNodes(), + CommandConverter::getCommandFromNodeList); + } + if (MEASURE_GROUP.equals(node.getNodeName())) { + measureGroup = CubeConverter.getMeasureGroup(node.getChildNodes()); + } + if ("MiningModel".equals(node.getNodeName())) { + miningModel = MiningConverter.getMiningModel(node.getChildNodes()); + } + if ("MiningStructure".equals(node.getNodeName())) { + miningStructure = MiningConverter.getMiningStructure(node.getChildNodes()); + } + if ("Partition".equals(node.getNodeName())) { + partition = PartitionConverter.getPartition(node.getChildNodes()); + } + if ("Permission".equals(node.getNodeName())) { + permission = PermissionConverter.getPermission(node.getChildNodes()); + } + if ("Perspective".equals(node.getNodeName())) { + perspective = PerspectiveConverter.getPerspective(node.getChildNodes()); + } + if (ROLE2.equals(node.getNodeName())) { + role = RoleConverter.getRole(node.getChildNodes()); + } + if ("Server".equals(node.getNodeName())) { + server = ServerConverter.getServer(node.getChildNodes(), CommandConverter::getCommandFromNodeList, + AssemblyConverter::getAssemblyList); + } + if ("Trace".equals(node.getNodeName())) { + trace = TraceEventConverter.getTrace(node.getChildNodes()); + } + } + } + return new MajorObjectR(aggregationDesign, assembly, cube, database, dataSource, dataSourceView, dimension, + mdxScript, measureGroup, miningModel, miningStructure, partition, permission, perspective, role, server, + trace); + } + + /** + * Parse a Command from a NodeList. Used by CubeConverter and DatabaseConverter + * for nested commands. + * + * @param nl the NodeList containing the command + * @return the parsed Command + */ + public static Command getCommandFromNodeList(NodeList nl) { + return CommandParser.getCommand(nl, CommandConverter::getMajorObject); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandParser.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandParser.java new file mode 100644 index 0000000..6769661 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandParser.java @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.AGGREGATION_DESIGN_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ALLOW_CREATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ALTER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ASSEMBLY_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CANCEL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CLEAR_CACHE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_PERMISSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATABASE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATABASE_PERMISSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_PERMISSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_VIEW_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION_PERMISSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MDX_SCRIPT_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_GROUP_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MINING_MODEL_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MINING_MODEL_PERMISSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MINING_STRUCTURE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MINING_STRUCTURE_PERMISSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.OBJECT_DEFINITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.OBJECT_EXPANSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PARTITION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PERSPECTIVE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SERVER_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STATEMENT; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRACE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.nodeListToMap; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; + +import java.math.BigInteger; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.MajorObject; +import org.eclipse.daanse.xmla.api.xmla.ObjectExpansion; +import org.eclipse.daanse.xmla.api.xmla.ObjectReference; +import org.eclipse.daanse.xmla.api.xmla.Scope; +import org.eclipse.daanse.xmla.model.record.xmla.AlterR; +import org.eclipse.daanse.xmla.model.record.xmla.CancelR; +import org.eclipse.daanse.xmla.model.record.xmla.ClearCacheR; +import org.eclipse.daanse.xmla.model.record.xmla.ObjectReferenceR; +import org.eclipse.daanse.xmla.model.record.xmla.StatementR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaParseException; +import org.w3c.dom.NodeList; + +import jakarta.xml.soap.Node; +import jakarta.xml.soap.SOAPElement; + +/** + * Parser for XMLA Command elements. Handles Statement, Alter, Cancel, and + * ClearCache commands. + */ +public class CommandParser { + + // Command-specific constants (not in Constants.java) + private static final String OBJECT_REFERENCE = "Object"; + private static final String COMMAND_SCOPE = "Scope"; + private static final String CONNECTION_ID = "ConnectionID"; + private static final String SESSION_ID = "SessionID"; + private static final String SPID = "SPID"; + private static final String CANCEL_ASSOCIATED = "CancelAssociated"; + + private CommandParser() { + // utility class + } + + /** + * Parse a Command from a SOAPElement. + */ + public static Command commandToCommand(SOAPElement element, MajorObjectParser majorObjectParser) { + Iterator nodeIterator = element.getChildElements(); + while (nodeIterator.hasNext()) { + Node n = nodeIterator.next(); + if (n instanceof SOAPElement) { + Command command = getCommand(n, majorObjectParser); + if (command != null) { + return command; + } + } + } + return null; + } + + public static Command getCommand(NodeList nl, MajorObjectParser majorObjectParser) { + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node n = nl.item(i); + Command command = getCommand(n, majorObjectParser); + if (command != null) { + return command; + } + } + throw new XmlaParseException("Illegal command"); + } + + static Command getCommand(org.w3c.dom.Node n, MajorObjectParser majorObjectParser) { + String nodeName = n.getNodeName(); + if (STATEMENT.equals(nodeName)) { + return new StatementR(n.getTextContent()); + } + if (ALTER.equals(nodeName)) { + return getAlterCommand(n.getChildNodes(), majorObjectParser); + } + if (CLEAR_CACHE.equals(nodeName)) { + return getClearCacheCommand(n.getChildNodes()); + } + if (CANCEL.equals(nodeName)) { + return getCancelCommand(n.getChildNodes()); + } + return null; + } + + static Command getCancelCommand(NodeList nl) { + Map map = nodeListToMap(nl); + BigInteger connectionID = toBigInteger(map.get(CONNECTION_ID)); + String sessionID = map.get(SESSION_ID); + BigInteger spid = toBigInteger(map.get(SPID)); + Boolean cancelAssociated = toBoolean(map.get(CANCEL_ASSOCIATED)); + + return new CancelR(connectionID, sessionID, spid, cancelAssociated); + } + + static Command getClearCacheCommand(NodeList nl) { + ObjectReference object = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null && OBJECT_REFERENCE.equals(node.getNodeName())) { + object = getObjectReference(node.getChildNodes()); + break; + } + } + return new ClearCacheR(object); + } + + static Command getAlterCommand(NodeList nl, MajorObjectParser majorObjectParser) { + ObjectReference object = null; + MajorObject objectDefinition = null; + Scope scope = null; + Boolean allowCreate = null; + ObjectExpansion objectExpansion = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (OBJECT_REFERENCE.equals(node.getNodeName())) { + object = getObjectReference(node.getChildNodes()); + } + if (OBJECT_DEFINITION.equals(node.getNodeName())) { + objectDefinition = majorObjectParser.getMajorObject(node.getChildNodes()); + } + if (COMMAND_SCOPE.equals(node.getNodeName())) { + scope = Scope.fromValue(node.getTextContent()); + } + if (ALLOW_CREATE.equals(node.getNodeName())) { + allowCreate = toBoolean(node.getTextContent()); + } + if (OBJECT_EXPANSION.equals(node.getNodeName())) { + objectExpansion = ObjectExpansion.fromValue(node.getTextContent()); + } + } + } + return new AlterR(object, objectDefinition, scope, allowCreate, objectExpansion); + } + + static ObjectReference getObjectReference(NodeList nl) { + Map map = nodeListToMap(nl); + return new ObjectReferenceR(map.get(SERVER_ID), map.get(DATABASE_ID), map.get(ROLE_ID), map.get(TRACE_ID), + map.get(ASSEMBLY_ID), map.get(DIMENSION_ID), map.get(DIMENSION_PERMISSION_ID), map.get(DATA_SOURCE_ID), + map.get(DATA_SOURCE_PERMISSION_ID), map.get(DATABASE_PERMISSION_ID), map.get(DATA_SOURCE_VIEW_ID), + map.get(CUBE_ID), map.get(MINING_STRUCTURE_ID), map.get(MEASURE_GROUP_ID), map.get(PERSPECTIVE_ID), + map.get(CUBE_PERMISSION_ID), map.get(MDX_SCRIPT_ID), map.get(PARTITION_ID), + map.get(AGGREGATION_DESIGN_ID), map.get(MINING_MODEL_ID), map.get(MINING_MODEL_PERMISSION_ID), + map.get(MINING_STRUCTURE_PERMISSION_ID)); + } + + /** + * Functional interface for parsing MajorObject. This allows CommandParser to + * delegate complex object parsing back to the main parser. + */ + @FunctionalInterface + public interface MajorObjectParser { + MajorObject getMajorObject(NodeList nl); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommonConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommonConverter.java new file mode 100644 index 0000000..8c345b9 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommonConverter.java @@ -0,0 +1,318 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CAPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DISPLAY_FOLDER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LANGUAGE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SOURCE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getNodeType; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toDuration; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.time.Duration; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.AttributeTranslation; +import org.eclipse.daanse.xmla.api.xmla.Binding; +import org.eclipse.daanse.xmla.api.xmla.DataItem; +import org.eclipse.daanse.xmla.api.xmla.DataItemFormatEnum; +import org.eclipse.daanse.xmla.api.xmla.ErrorConfiguration; +import org.eclipse.daanse.xmla.api.xmla.InvalidXmlCharacterEnum; +import org.eclipse.daanse.xmla.api.xmla.NullProcessingEnum; +import org.eclipse.daanse.xmla.api.xmla.ProactiveCaching; +import org.eclipse.daanse.xmla.api.xmla.ProactiveCachingBinding; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.model.record.xmla.AnnotationR; +import org.eclipse.daanse.xmla.model.record.xmla.AttributeTranslationR; +import org.eclipse.daanse.xmla.model.record.xmla.DataItemR; +import org.eclipse.daanse.xmla.model.record.xmla.ErrorConfigurationR; +import org.eclipse.daanse.xmla.model.record.xmla.ProactiveCachingR; +import org.eclipse.daanse.xmla.model.record.xmla.TranslationR; +import org.w3c.dom.NodeList; + +/** + * Common converter for shared parsing methods used by multiple converters. + * Contains methods for Annotation, Translation, DataItem, ErrorConfiguration, + * and ProactiveCaching. + */ +public class CommonConverter { + + private CommonConverter() { + // utility class + } + + public static List getAnnotationList(NodeList nl) { + return getList(nl, "Annotation", CommonConverter::getAnnotation); + } + + public static Annotation getAnnotation(NodeList nl) { + String name = null; + Optional visibility = Optional.empty(); + Optional value = Optional.empty(); + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if ("Visibility".equals(node.getNodeName())) { + visibility = Optional.ofNullable(node.getTextContent()); + } + if (VALUE.equals(node.getNodeName())) { + value = Optional.ofNullable(node.getTextContent()); + } + } + } + + return new AnnotationR(name, visibility, value); + } + + public static List getTranslationList(NodeList nl, String nodeName) { + return getList(nl, nodeName, CommonConverter::getTranslation); + } + + public static Translation getTranslation(NodeList nl) { + long language = 0; + String caption = null; + String description = null; + String displayFolder = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (LANGUAGE.equals(node.getNodeName())) { + language = toLong(node.getTextContent()); + } + if (CAPTION.equals(node.getNodeName())) { + caption = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (DISPLAY_FOLDER.equals(node.getNodeName())) { + displayFolder = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = getAnnotationList(node.getChildNodes()); + } + } + } + return new TranslationR(language, caption, description, displayFolder, annotations); + } + + public static List getAttributeTranslationList(NodeList nl) { + return getList(nl, TRANSLATION, CommonConverter::getAttributeTranslation); + } + + public static AttributeTranslation getAttributeTranslation(NodeList nl) { + long language = 0; + String caption = null; + String description = null; + String displayFolder = null; + List annotations = null; + DataItem captionColumn = null; + String membersWithDataCaption = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (LANGUAGE.equals(node.getNodeName())) { + language = toLong(node.getTextContent()); + } + if (CAPTION.equals(node.getNodeName())) { + caption = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (DISPLAY_FOLDER.equals(node.getNodeName())) { + displayFolder = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = getAnnotationList(node.getChildNodes()); + } + if ("CaptionColumn".equals(node.getNodeName())) { + captionColumn = getDataItem(node.getChildNodes()); + } + if ("MembersWithDataCaption".equals(node.getNodeName())) { + membersWithDataCaption = node.getTextContent(); + } + } + } + return new AttributeTranslationR(language, Optional.ofNullable(caption), Optional.ofNullable(description), + Optional.ofNullable(displayFolder), Optional.ofNullable(annotations), + Optional.ofNullable(captionColumn), Optional.ofNullable(membersWithDataCaption)); + } + + public static List getDataItemList(NodeList nl, String nodeName) { + return getList(nl, nodeName, CommonConverter::getDataItem); + } + + public static DataItem getDataItem(NodeList nl) { + String dataType = null; + Integer dataSize = null; + String mimeType = null; + NullProcessingEnum nullProcessing = null; + String trimming = null; + InvalidXmlCharacterEnum invalidXmlCharacters = null; + String collation = null; + DataItemFormatEnum format = null; + Binding source = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("DataType".equals(node.getNodeName())) { + dataType = node.getTextContent(); + } + if ("DataSize".equals(node.getNodeName())) { + dataSize = toInteger(node.getTextContent()); + } + if ("MimeType".equals(node.getNodeName())) { + mimeType = node.getTextContent(); + } + if ("NullProcessing".equals(node.getNodeName())) { + nullProcessing = NullProcessingEnum.fromValue(node.getTextContent()); + } + if ("Trimming".equals(node.getNodeName())) { + trimming = node.getTextContent(); + } + if ("InvalidXmlCharacters".equals(node.getNodeName())) { + invalidXmlCharacters = InvalidXmlCharacterEnum.fromValue(node.getTextContent()); + } + if (COLLATION.equals(node.getNodeName())) { + collation = node.getTextContent(); + } + if ("Format".equals(node.getNodeName())) { + format = DataItemFormatEnum.fromValue(node.getTextContent()); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getBinding(node.getChildNodes(), getNodeType(node)); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = getAnnotationList(node.getChildNodes()); + } + } + } + return new DataItemR(dataType, Optional.ofNullable(dataSize), Optional.ofNullable(mimeType), + Optional.ofNullable(nullProcessing), Optional.ofNullable(trimming), + Optional.ofNullable(invalidXmlCharacters), Optional.ofNullable(collation), Optional.ofNullable(format), + Optional.ofNullable(source), Optional.ofNullable(annotations)); + } + + public static ErrorConfiguration getErrorConfiguration(NodeList nl) { + Long keyErrorLimit = null; + String keyErrorLogFile = null; + String keyErrorAction = null; + String keyErrorLimitAction = null; + String keyNotFound = null; + String keyDuplicate = null; + String nullKeyConvertedToUnknown = null; + String nullKeyNotAllowed = null; + String calculationError = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("KeyErrorLimit".equals(node.getNodeName())) { + keyErrorLimit = toLong(node.getTextContent()); + } + if ("KeyErrorLogFile".equals(node.getNodeName())) { + keyErrorLogFile = node.getTextContent(); + } + if ("KeyErrorAction".equals(node.getNodeName())) { + keyErrorAction = node.getTextContent(); + } + if ("KeyErrorLimitAction".equals(node.getNodeName())) { + keyErrorLimitAction = node.getTextContent(); + } + if ("KeyNotFound".equals(node.getNodeName())) { + keyNotFound = node.getTextContent(); + } + if ("KeyDuplicate".equals(node.getNodeName())) { + keyDuplicate = node.getTextContent(); + } + if ("NullKeyConvertedToUnknown".equals(node.getNodeName())) { + nullKeyConvertedToUnknown = node.getTextContent(); + } + if ("NullKeyNotAllowed".equals(node.getNodeName())) { + nullKeyNotAllowed = node.getTextContent(); + } + if ("CalculationError".equals(node.getNodeName())) { + calculationError = node.getTextContent(); + } + } + } + return new ErrorConfigurationR(Optional.ofNullable(keyErrorLimit), Optional.ofNullable(keyErrorLogFile), + Optional.ofNullable(keyErrorAction), Optional.ofNullable(keyErrorLimitAction), + Optional.ofNullable(keyNotFound), Optional.ofNullable(keyDuplicate), + Optional.ofNullable(nullKeyConvertedToUnknown), Optional.ofNullable(nullKeyNotAllowed), + Optional.ofNullable(calculationError)); + } + + public static ProactiveCaching getProactiveCaching(NodeList nl) { + String onlineMode = null; + String aggregationStorage = null; + ProactiveCachingBinding source = null; + Duration silenceInterval = null; + Duration latency = null; + Duration silenceOverrideInterval = null; + Duration forceRebuildInterval = null; + Boolean enabled = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("OnlineMode".equals(node.getNodeName())) { + onlineMode = node.getTextContent(); + } + if ("AggregationStorage".equals(node.getNodeName())) { + aggregationStorage = node.getTextContent(); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getProactiveCachingBinding(node.getChildNodes(), getNodeType(node)); + } + if ("SilenceInterval".equals(node.getNodeName())) { + silenceInterval = toDuration(node.getTextContent()); + } + if ("Latency".equals(node.getNodeName())) { + latency = toDuration(node.getTextContent()); + } + if ("SilenceOverrideInterval".equals(node.getNodeName())) { + silenceOverrideInterval = toDuration(node.getTextContent()); + } + if ("ForceRebuildInterval".equals(node.getNodeName())) { + forceRebuildInterval = toDuration(node.getTextContent()); + } + if ("Enabled".equals(node.getNodeName())) { + enabled = toBoolean(node.getTextContent()); + } + } + } + return new ProactiveCachingR(Optional.ofNullable(onlineMode), Optional.ofNullable(aggregationStorage), + Optional.ofNullable(source), Optional.ofNullable(silenceInterval), Optional.ofNullable(latency), + Optional.ofNullable(silenceOverrideInterval), Optional.ofNullable(forceRebuildInterval), + Optional.ofNullable(enabled)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CubeConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CubeConverter.java new file mode 100644 index 0000000..d98f5a7 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CubeConverter.java @@ -0,0 +1,1370 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.AGGREGATION_PREFIX; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_HIERARCHY_VISIBLE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COMMAND; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_VIEW_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DISPLAY_FOLDER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ERROR_CONFIGURATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ESTIMATED_ROWS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ESTIMATED_SIZE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.EXPRESSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.HIERARCHIES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.HIERARCHY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMN; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LANGUAGE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_PROCESSED; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_GROUP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_GROUP_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROACTIVE_CACHING; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_MODE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_PRIORITY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.READ_DEFINITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SOURCE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STORAGE_LOCATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STORAGE_MODE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VISIBLE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VISUALIZATION_PROPERTIES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.WRITE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getAttribute; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getNodeType; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toDuration; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; + +import org.eclipse.daanse.xmla.api.engine300.CalculationPropertiesVisualizationProperties; +import org.eclipse.daanse.xmla.api.xmla.AccessEnum; +import org.eclipse.daanse.xmla.api.xmla.Action; +import org.eclipse.daanse.xmla.api.xmla.AggregationDesign; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.AttributePermission; +import org.eclipse.daanse.xmla.api.xmla.CalculationProperty; +import org.eclipse.daanse.xmla.api.xmla.CellPermission; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.Cube; +import org.eclipse.daanse.xmla.api.xmla.CubeAttribute; +import org.eclipse.daanse.xmla.api.xmla.CubeDimension; +import org.eclipse.daanse.xmla.api.xmla.CubeDimensionPermission; +import org.eclipse.daanse.xmla.api.xmla.CubeHierarchy; +import org.eclipse.daanse.xmla.api.xmla.CubePermission; +import org.eclipse.daanse.xmla.api.xmla.DataItem; +import org.eclipse.daanse.xmla.api.xmla.DataSourceViewBinding; +import org.eclipse.daanse.xmla.api.xmla.ErrorConfiguration; +import org.eclipse.daanse.xmla.api.xmla.Kpi; +import org.eclipse.daanse.xmla.api.xmla.MdxScript; +import org.eclipse.daanse.xmla.api.xmla.Measure; +import org.eclipse.daanse.xmla.api.xmla.MeasureGroup; +import org.eclipse.daanse.xmla.api.xmla.MeasureGroupAttribute; +import org.eclipse.daanse.xmla.api.xmla.MeasureGroupBinding; +import org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimensionBinding; +import org.eclipse.daanse.xmla.api.xmla.Partition; +import org.eclipse.daanse.xmla.api.xmla.PersistenceEnum; +import org.eclipse.daanse.xmla.api.xmla.Perspective; +import org.eclipse.daanse.xmla.api.xmla.ProactiveCaching; +import org.eclipse.daanse.xmla.api.xmla.ReadDefinitionEnum; +import org.eclipse.daanse.xmla.api.xmla.ReadWritePermissionEnum; +import org.eclipse.daanse.xmla.api.xmla.RefreshPolicyEnum; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.model.record.engine300.CalculationPropertiesVisualizationPropertiesR; +import org.eclipse.daanse.xmla.model.record.xmla.CalculationPropertyR; +import org.eclipse.daanse.xmla.model.record.xmla.CellPermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeDimensionPermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeHierarchyR; +import org.eclipse.daanse.xmla.model.record.xmla.CubePermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.CubeR; +import org.eclipse.daanse.xmla.model.record.xmla.DataMiningMeasureGroupDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.DataSourceViewBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DegenerateMeasureGroupDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.KpiR; +import org.eclipse.daanse.xmla.model.record.xmla.ManyToManyMeasureGroupDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.MdxScriptR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureGroupAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureGroupBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureGroupR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureR; +import org.eclipse.daanse.xmla.model.record.xmla.ReferenceMeasureGroupDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.RegularMeasureGroupDimensionR; +import org.w3c.dom.NodeList; + +/** + * Converter for Cube-related XML parsing. Handles Cube, MeasureGroup, Measure, + * Kpi, CubeDimension, and related types. + */ +public class CubeConverter { + + private CubeConverter() { + // Utility class + } + + public static List getCubeList(NodeList nl, Function commandParser) { + return getList(nl, CUBE2, childNodes -> getCube(childNodes, commandParser)); + } + + public static Cube getCube(NodeList nl, Function commandParser) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + BigInteger language = null; + String collation = null; + List translations = null; + List dimensions = null; + List cubePermissions = null; + List mdxScripts = null; + List perspectives = null; + String state = null; + String defaultMeasure = null; + Boolean visible = null; + List measureGroups = null; + DataSourceViewBinding source = null; + String aggregationPrefix = null; + BigInteger processingPriority = null; + Cube.StorageMode storageMode = null; + String processingMode = null; + String scriptCacheProcessingMode = null; + String scriptErrorHandlingMode = null; + String daxOptimizationMode = null; + ProactiveCaching proactiveCaching = null; + List kpis = null; + ErrorConfiguration errorConfiguration = null; + List actions = null; + String storageLocation = null; + Long estimatedRows = null; + Instant lastProcessed = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (NAME.equals(nodeName)) { + name = node.getTextContent(); + } + if (ID.equals(nodeName)) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(nodeName)) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(nodeName)) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (LANGUAGE.equals(nodeName)) { + language = toBigInteger(node.getTextContent()); + } + if (COLLATION.equals(nodeName)) { + collation = node.getTextContent(); + } + if (TRANSLATIONS.equals(nodeName)) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (DIMENSIONS.equals(nodeName)) { + dimensions = getCubeDimensionList(node.getChildNodes()); + } + if ("CubePermissions".equals(nodeName)) { + cubePermissions = getCubePermissionList(node.getChildNodes()); + } + if ("MdxScripts".equals(nodeName)) { + mdxScripts = getMdxScriptList(node.getChildNodes(), commandParser); + } + if ("Perspectives".equals(nodeName)) { + perspectives = PerspectiveConverter.getPerspectiveList(node.getChildNodes()); + } + if (STATE.equals(nodeName)) { + state = node.getTextContent(); + } + if ("DefaultMeasure".equals(nodeName)) { + defaultMeasure = node.getTextContent(); + } + if (VISIBLE.equals(nodeName)) { + visible = toBoolean(node.getTextContent()); + } + if ("MeasureGroups".equals(nodeName)) { + measureGroups = getMeasureGroupList(node.getChildNodes()); + } + if (SOURCE.equals(nodeName)) { + source = getDataSourceViewBinding(node.getChildNodes()); + } + if (AGGREGATION_PREFIX.equals(nodeName)) { + aggregationPrefix = node.getTextContent(); + } + if (PROCESSING_PRIORITY.equals(nodeName)) { + processingPriority = toBigInteger(node.getTextContent()); + } + if (STORAGE_MODE.equals(nodeName)) { + storageMode = getCubeStorageMode(node.getChildNodes()); + } + if (PROCESSING_MODE.equals(nodeName)) { + processingMode = node.getTextContent(); + } + if ("ScriptCacheProcessingMode".equals(nodeName)) { + scriptCacheProcessingMode = node.getTextContent(); + } + if ("ScriptErrorHandlingMode".equals(nodeName)) { + scriptErrorHandlingMode = node.getTextContent(); + } + if ("DaxOptimizationMode".equals(nodeName)) { + daxOptimizationMode = node.getTextContent(); + } + if (PROACTIVE_CACHING.equals(nodeName)) { + proactiveCaching = CommonConverter.getProactiveCaching(node.getChildNodes()); + } + if ("Kpis".equals(nodeName)) { + kpis = getKpiList(node.getChildNodes()); + } + if (ERROR_CONFIGURATION.equals(nodeName)) { + errorConfiguration = CommonConverter.getErrorConfiguration(node.getChildNodes()); + } + if ("Actions".equals(nodeName)) { + actions = ActionConverter.getActionList(node.getChildNodes()); + } + if (STORAGE_LOCATION.equals(nodeName)) { + storageLocation = node.getTextContent(); + } + if (ESTIMATED_ROWS.equals(nodeName)) { + estimatedRows = toLong(node.getTextContent()); + } + if (LAST_PROCESSED.equals(nodeName)) { + lastProcessed = toInstant(node.getTextContent()); + } + } + } + return new CubeR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, language, collation, + translations, dimensions, cubePermissions, mdxScripts, perspectives, state, defaultMeasure, visible, + measureGroups, source, aggregationPrefix, processingPriority, storageMode, processingMode, + scriptCacheProcessingMode, scriptErrorHandlingMode, daxOptimizationMode, proactiveCaching, kpis, + errorConfiguration, actions, storageLocation, estimatedRows, lastProcessed); + } + + public static Cube.StorageMode getCubeStorageMode(NodeList nl) { + String valuens = null; + String value = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + valuens = getAttribute(node.getAttributes(), "valuens"); + value = node.getTextContent(); + } + } + return new CubeR.StorageMode(org.eclipse.daanse.xmla.api.xmla.CubeStorageModeEnumType.fromValue(value), + valuens); + } + + public static List getCubeDimensionList(NodeList nl) { + return getList(nl, "CubeDimension", childNodes -> getCubeDimension(childNodes)); + } + + public static CubeDimension getCubeDimension(NodeList nl) { + String id = null; + String name = null; + String description = null; + List translations = null; + String dimensionID = null; + Boolean visible = null; + String allMemberAggregationUsage = null; + String hierarchyUniqueNameStyle = null; + String memberUniqueNameStyle = null; + List attributes = null; + List hierarchies = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (ID.equals(nodeName)) { + id = node.getTextContent(); + } + if (NAME.equals(nodeName)) { + name = node.getTextContent(); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if (TRANSLATIONS.equals(nodeName)) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (DIMENSION_ID.equals(nodeName)) { + dimensionID = node.getTextContent(); + } + if (VISIBLE.equals(nodeName)) { + visible = toBoolean(node.getTextContent()); + } + if ("AllMemberAggregationUsage".equals(nodeName)) { + allMemberAggregationUsage = node.getTextContent(); + } + if ("HierarchyUniqueNameStyle".equals(nodeName)) { + hierarchyUniqueNameStyle = node.getTextContent(); + } + if ("MemberUniqueNameStyle".equals(nodeName)) { + memberUniqueNameStyle = node.getTextContent(); + } + if (ATTRIBUTES.equals(nodeName)) { + attributes = getCubeAttributeList(node.getChildNodes()); + } + if (HIERARCHIES.equals(nodeName)) { + hierarchies = getCubeHierarchyList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new CubeDimensionR(id, name, description, translations, dimensionID, visible, allMemberAggregationUsage, + hierarchyUniqueNameStyle, memberUniqueNameStyle, attributes, hierarchies, annotations); + } + + public static List getCubeAttributeList(NodeList nl) { + return getList(nl, ATTRIBUTE, childNodes -> getCubeAttribute(childNodes)); + } + + public static CubeAttribute getCubeAttribute(NodeList nl) { + String attributeID = null; + String aggregationUsage = null; + String attributeHierarchyOptimizedState = null; + Boolean attributeHierarchyEnabled = null; + Boolean attributeHierarchyVisible = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (ATTRIBUTE_ID.equals(nodeName)) { + attributeID = node.getTextContent(); + } + if ("AggregationUsage".equals(nodeName)) { + aggregationUsage = node.getTextContent(); + } + if ("AttributeHierarchyOptimizedState".equals(nodeName)) { + attributeHierarchyOptimizedState = node.getTextContent(); + } + if ("AttributeHierarchyEnabled".equals(nodeName)) { + attributeHierarchyEnabled = toBoolean(node.getTextContent()); + } + if (ATTRIBUTE_HIERARCHY_VISIBLE.equals(nodeName)) { + attributeHierarchyVisible = toBoolean(node.getTextContent()); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new CubeAttributeR(attributeID, aggregationUsage, attributeHierarchyOptimizedState, + attributeHierarchyEnabled, attributeHierarchyVisible, annotations); + } + + public static List getCubeHierarchyList(NodeList nl) { + return getList(nl, HIERARCHY, childNodes -> getCubeHierarchy(childNodes)); + } + + public static CubeHierarchy getCubeHierarchy(NodeList nl) { + String hierarchyID = null; + String optimizedState = null; + Boolean visible = null; + Boolean enabled = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if ("HierarchyID".equals(nodeName)) { + hierarchyID = node.getTextContent(); + } + if ("OptimizedState".equals(nodeName)) { + optimizedState = node.getTextContent(); + } + if (VISIBLE.equals(nodeName)) { + visible = toBoolean(node.getTextContent()); + } + if ("Enabled".equals(nodeName)) { + enabled = toBoolean(node.getTextContent()); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new CubeHierarchyR(hierarchyID, optimizedState, visible, enabled, annotations); + } + + public static List getCubePermissionList(NodeList nl) { + return getList(nl, "CubePermission", childNodes -> getCubePermission(childNodes)); + } + + public static CubePermission getCubePermission(NodeList nl) { + String readSourceData = null; + List dimensionPermissions = null; + List cellPermissions = null; + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (NAME.equals(nodeName)) { + name = node.getTextContent(); + } + if (ID.equals(nodeName)) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(nodeName)) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(nodeName)) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (ROLE_ID.equals(nodeName)) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(nodeName)) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(nodeName)) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(nodeName)) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(nodeName)) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if ("ReadSourceData".equals(nodeName)) { + readSourceData = node.getTextContent(); + } + if ("DimensionPermissions".equals(nodeName)) { + dimensionPermissions = getCubeDimensionPermissionList(node.getChildNodes()); + } + if ("CellPermissions".equals(nodeName)) { + cellPermissions = getCellPermissionList(node.getChildNodes()); + } + } + } + return new CubePermissionR(Optional.ofNullable(readSourceData), Optional.ofNullable(dimensionPermissions), + Optional.ofNullable(cellPermissions), name, Optional.ofNullable(id), + Optional.ofNullable(createdTimestamp), Optional.ofNullable(lastSchemaUpdate), + Optional.ofNullable(description), Optional.ofNullable(annotations), roleID, + Optional.ofNullable(process), Optional.ofNullable(readDefinition), Optional.ofNullable(read), + Optional.ofNullable(write)); + } + + public static List getCellPermissionList(NodeList nl) { + return getList(nl, "CellPermission", childNodes -> getCellPermission(childNodes)); + } + + public static CellPermission getCellPermission(NodeList nl) { + AccessEnum access = null; + String description = null; + String expression = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if ("Access".equals(nodeName)) { + access = AccessEnum.fromValue(node.getTextContent()); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if (EXPRESSION.equals(nodeName)) { + expression = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new CellPermissionR(Optional.ofNullable(access), Optional.ofNullable(description), + Optional.ofNullable(expression), Optional.ofNullable(annotations)); + } + + public static List getCubeDimensionPermissionList(NodeList nl) { + return getList(nl, "DimensionPermission", childNodes -> getCubeDimensionPermission(childNodes)); + } + + public static CubeDimensionPermission getCubeDimensionPermission(NodeList nl) { + String cubeDimensionID = null; + String description = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + List attributePermissions = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (CUBE_DIMENSION_ID.equals(nodeName)) { + cubeDimensionID = node.getTextContent(); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if ("Read".equals(nodeName)) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(nodeName)) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if ("AttributePermissions".equals(nodeName)) { + attributePermissions = DimensionConverter.getAttributePermissionList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new CubeDimensionPermissionR(cubeDimensionID, Optional.ofNullable(description), + Optional.ofNullable(read), Optional.ofNullable(write), Optional.ofNullable(attributePermissions), + Optional.ofNullable(annotations)); + } + + public static List getKpiList(NodeList nl) { + return getList(nl, "Kpi", childNodes -> getKpi(childNodes)); + } + + public static Kpi getKpi(NodeList nl) { + String name = null; + String id = null; + String description = null; + List translations = null; + String displayFolder = null; + String associatedMeasureGroupID = null; + String value = null; + String goal = null; + String status = null; + String trend = null; + String weight = null; + String trendGraphic = null; + String statusGraphic = null; + String currentTimeMember = null; + String parentKpiID = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (NAME.equals(nodeName)) { + name = node.getTextContent(); + } + if (ID.equals(nodeName)) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if (TRANSLATIONS.equals(nodeName)) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (DISPLAY_FOLDER.equals(nodeName)) { + displayFolder = node.getTextContent(); + } + if ("AssociatedMeasureGroupID".equals(nodeName)) { + associatedMeasureGroupID = node.getTextContent(); + } + if (VALUE.equals(nodeName)) { + value = node.getTextContent(); + } + if ("Goal".equals(nodeName)) { + goal = node.getTextContent(); + } + if ("Status".equals(nodeName)) { + status = node.getTextContent(); + } + if ("Trend".equals(nodeName)) { + trend = node.getTextContent(); + } + if ("Weight".equals(nodeName)) { + weight = node.getTextContent(); + } + if ("TrendGraphic".equals(nodeName)) { + trendGraphic = node.getTextContent(); + } + if ("StatusGraphic".equals(nodeName)) { + statusGraphic = node.getTextContent(); + } + if ("CurrentTimeMember".equals(nodeName)) { + currentTimeMember = node.getTextContent(); + } + if ("ParentKpiID".equals(nodeName)) { + parentKpiID = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new KpiR(name, id, description, translations, displayFolder, associatedMeasureGroupID, value, goal, + status, trend, weight, trendGraphic, statusGraphic, currentTimeMember, parentKpiID, annotations); + } + + public static List getMeasureGroupList(NodeList nl) { + return getList(nl, MEASURE_GROUP, childNodes -> getMeasureGroup(childNodes)); + } + + public static MeasureGroup getMeasureGroup(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + Instant lastProcessed = null; + List translations = null; + String type = null; + String state = null; + List measures = null; + String dataAggregation = null; + MeasureGroupBinding source = null; + MeasureGroup.StorageMode storageMode = null; + String storageLocation = null; + Boolean ignoreUnrelatedDimensions = null; + ProactiveCaching proactiveCaching = null; + Long estimatedRows = null; + ErrorConfiguration errorConfiguration = null; + Long estimatedSize = null; + String processingMode = null; + List dimensions = null; + List partitions = null; + String aggregationPrefix = null; + BigInteger processingPriority = null; + List aggregationDesigns = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (LAST_PROCESSED.equals(nodeName)) { + lastProcessed = toInstant(node.getTextContent()); + } + if (TRANSLATIONS.equals(nodeName)) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if ("Type".equals(nodeName)) { + type = node.getTextContent(); + } + if (STATE.equals(nodeName)) { + state = node.getTextContent(); + } + if (MEASURES.equals(nodeName)) { + measures = getMeasureList(node.getChildNodes()); + } + if ("DataAggregation".equals(nodeName)) { + dataAggregation = node.getTextContent(); + } + if (SOURCE.equals(nodeName)) { + source = getMeasureGroupBinding(node.getChildNodes()); + } + if (STORAGE_MODE.equals(nodeName)) { + storageMode = getMeasureGroupStorageMode(node.getChildNodes()); + } + if (STORAGE_LOCATION.equals(nodeName)) { + storageLocation = node.getTextContent(); + } + if ("IgnoreUnrelatedDimensions".equals(nodeName)) { + ignoreUnrelatedDimensions = toBoolean(node.getTextContent()); + } + if (PROACTIVE_CACHING.equals(nodeName)) { + proactiveCaching = CommonConverter.getProactiveCaching(node.getChildNodes()); + } + if (ESTIMATED_ROWS.equals(nodeName)) { + estimatedRows = toLong(node.getTextContent()); + } + if (ERROR_CONFIGURATION.equals(nodeName)) { + errorConfiguration = CommonConverter.getErrorConfiguration(node.getChildNodes()); + } + if (ESTIMATED_SIZE.equals(nodeName)) { + estimatedSize = toLong(node.getTextContent()); + } + if (PROCESSING_MODE.equals(nodeName)) { + processingMode = node.getTextContent(); + } + if (DIMENSIONS.equals(nodeName)) { + dimensions = getMeasureGroupDimensionList(node.getChildNodes()); + } + if ("Partitions".equals(nodeName)) { + partitions = PartitionConverter.getPartitionList(node.getChildNodes()); + } + if (AGGREGATION_PREFIX.equals(nodeName)) { + aggregationPrefix = node.getTextContent(); + } + if (PROCESSING_PRIORITY.equals(nodeName)) { + processingPriority = toBigInteger(node.getTextContent()); + } + if ("AggregationDesigns".equals(nodeName)) { + aggregationDesigns = getAggregationDesignList(node.getChildNodes()); + } + } + } + return new MeasureGroupR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, lastProcessed, + translations, type, state, measures, dataAggregation, source, storageMode, storageLocation, + ignoreUnrelatedDimensions, proactiveCaching, estimatedRows, errorConfiguration, estimatedSize, + processingMode, dimensions, partitions, aggregationPrefix, processingPriority, aggregationDesigns); + } + + public static MeasureGroup.StorageMode getMeasureGroupStorageMode(NodeList nl) { + String valuens = null; + String value = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + valuens = getAttribute(node.getAttributes(), "valuens"); + value = node.getTextContent(); + } + } + return new MeasureGroupR.StorageMode( + org.eclipse.daanse.xmla.api.xmla.MeasureGroupStorageModeEnumType.fromValue(value), valuens); + } + + public static MeasureGroupBinding getMeasureGroupBinding(NodeList nl) { + String dataSourceID = null; + String cubeID = null; + String measureGroupID = null; + PersistenceEnum persistence = null; + RefreshPolicyEnum refreshPolicy = null; + Duration refreshInterval = null; + String filter = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (DATA_SOURCE_ID.equals(nodeName)) { + dataSourceID = node.getTextContent(); + } + if (CUBE_ID.equals(nodeName)) { + cubeID = node.getTextContent(); + } + if (MEASURE_GROUP_ID.equals(nodeName)) { + measureGroupID = node.getTextContent(); + } + if ("Persistence".equals(nodeName)) { + persistence = PersistenceEnum.fromValue(node.getTextContent()); + } + if ("RefreshPolicy".equals(nodeName)) { + refreshPolicy = RefreshPolicyEnum.fromValue(node.getTextContent()); + } + if ("RefreshInterval".equals(nodeName)) { + refreshInterval = toDuration(node.getTextContent()); + } + if ("Filter".equals(nodeName)) { + filter = node.getTextContent(); + } + } + } + return new MeasureGroupBindingR(dataSourceID, cubeID, measureGroupID, Optional.ofNullable(persistence), + Optional.ofNullable(refreshPolicy), Optional.ofNullable(refreshInterval), Optional.ofNullable(filter)); + } + + public static List getMeasureGroupDimensionList( + NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (DIMENSIONS.equals(node.getNodeName()))) { + list.add(getMeasureGroupDimension(node.getChildNodes(), getNodeType(node))); + } + } + return list; + } + + public static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getMeasureGroupDimension(NodeList nl, + String type) { + if ("ManyToManyMeasureGroupDimension".equals(type)) { + return getManyToManyMeasureGroupDimension(nl); + } + if ("RegularMeasureGroupDimension".equals(type)) { + return getRegularMeasureGroupDimension(nl); + } + if ("ReferenceMeasureGroupDimension".equals(type)) { + return getReferenceMeasureGroupDimension(nl); + } + if ("DegenerateMeasureGroupDimension".equals(type)) { + return getDegenerateMeasureGroupDimension(nl); + } + if ("DataMiningMeasureGroupDimension".equals(type)) { + return getDataMiningMeasureGroupDimension(nl); + } + return null; + } + + public static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getDataMiningMeasureGroupDimension( + NodeList nl) { + String cubeDimensionID = null; + List annotations = null; + MeasureGroupDimensionBinding source = null; + String caseCubeDimensionID = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (CUBE_DIMENSION_ID.equals(nodeName)) { + cubeDimensionID = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(nodeName)) { + source = (MeasureGroupDimensionBinding) BindingConverter + .getMeasureGroupDimensionBinding(node.getChildNodes()); + } + if ("CaseCubeDimensionID".equals(nodeName)) { + caseCubeDimensionID = node.getTextContent(); + } + } + } + return new DataMiningMeasureGroupDimensionR(cubeDimensionID, annotations, source, caseCubeDimensionID); + } + + public static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getDegenerateMeasureGroupDimension( + NodeList nl) { + String cubeDimensionID = null; + List annotations = null; + MeasureGroupDimensionBinding source = null; + String shareDimensionStorage = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (CUBE_DIMENSION_ID.equals(nodeName)) { + cubeDimensionID = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(nodeName)) { + source = (MeasureGroupDimensionBinding) BindingConverter + .getMeasureGroupDimensionBinding(node.getChildNodes()); + } + if ("ShareDimensionStorage".equals(nodeName)) { + shareDimensionStorage = node.getTextContent(); + } + } + } + return new DegenerateMeasureGroupDimensionR(cubeDimensionID, annotations, source, shareDimensionStorage); + } + + public static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getReferenceMeasureGroupDimension( + NodeList nl) { + String cubeDimensionID = null; + List annotations = null; + MeasureGroupDimensionBinding source = null; + String intermediateCubeDimensionID = null; + String intermediateGranularityAttributeID = null; + String materialization = null; + String processingState = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (CUBE_DIMENSION_ID.equals(nodeName)) { + cubeDimensionID = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(nodeName)) { + source = (MeasureGroupDimensionBinding) BindingConverter + .getMeasureGroupDimensionBinding(node.getChildNodes()); + } + if ("IntermediateCubeDimensionID".equals(nodeName)) { + intermediateCubeDimensionID = node.getTextContent(); + } + if ("IntermediateGranularityAttributeID".equals(nodeName)) { + intermediateGranularityAttributeID = node.getTextContent(); + } + if ("Materialization".equals(nodeName)) { + materialization = node.getTextContent(); + } + if ("ProcessingState".equals(nodeName)) { + processingState = node.getTextContent(); + } + } + } + return new ReferenceMeasureGroupDimensionR(cubeDimensionID, annotations, source, intermediateCubeDimensionID, + intermediateGranularityAttributeID, materialization, processingState); + } + + public static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getRegularMeasureGroupDimension(NodeList nl) { + String cubeDimensionID = null; + List annotations = null; + MeasureGroupDimensionBinding source = null; + String cardinality = null; + List attributes = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (CUBE_DIMENSION_ID.equals(nodeName)) { + cubeDimensionID = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(nodeName)) { + source = (MeasureGroupDimensionBinding) BindingConverter + .getMeasureGroupDimensionBinding(node.getChildNodes()); + } + if ("Cardinality".equals(nodeName)) { + cardinality = node.getTextContent(); + } + if (ATTRIBUTES.equals(nodeName)) { + attributes = getMeasureGroupAttributeList(node.getChildNodes()); + } + } + } + return new RegularMeasureGroupDimensionR(cubeDimensionID, annotations, source, cardinality, attributes); + } + + public static List getMeasureGroupAttributeList(NodeList nl) { + return getList(nl, ATTRIBUTE, childNodes -> getMeasureGroupAttribute(childNodes)); + } + + public static MeasureGroupAttribute getMeasureGroupAttribute(NodeList nl) { + String attributeID = null; + List keyColumns = null; + String type = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (ATTRIBUTE_ID.equals(nodeName)) { + attributeID = node.getTextContent(); + } + if (KEY_COLUMNS.equals(nodeName)) { + keyColumns = getKeyColumnList(node.getChildNodes()); + } + if ("Type".equals(nodeName)) { + type = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new MeasureGroupAttributeR(attributeID, keyColumns, type, annotations); + } + + private static List getKeyColumnList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (KEY_COLUMN.equals(node.getNodeName()))) { + list.add(CommonConverter.getDataItem(node.getChildNodes())); + } + } + return list; + } + + public static org.eclipse.daanse.xmla.api.xmla.MeasureGroupDimension getManyToManyMeasureGroupDimension( + NodeList nl) { + String cubeDimensionID = null; + List annotations = null; + MeasureGroupDimensionBinding source = null; + String measureGroupID = null; + String directSlice = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (CUBE_DIMENSION_ID.equals(nodeName)) { + cubeDimensionID = node.getTextContent(); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(nodeName)) { + source = (MeasureGroupDimensionBinding) BindingConverter + .getMeasureGroupDimensionBinding(node.getChildNodes()); + } + if (MEASURE_GROUP_ID.equals(nodeName)) { + measureGroupID = node.getTextContent(); + } + if ("DirectSlice".equals(nodeName)) { + directSlice = node.getTextContent(); + } + } + } + return new ManyToManyMeasureGroupDimensionR(cubeDimensionID, annotations, source, measureGroupID, directSlice); + } + + public static List getMeasureList(NodeList nl) { + return getList(nl, MEASURE, childNodes -> getMeasure(childNodes)); + } + + public static Measure getMeasure(NodeList nl) { + String name = null; + String id = null; + String description = null; + String aggregateFunction = null; + String dataType = null; + DataItem source = null; + Boolean visible = null; + String measureExpression = null; + String displayFolder = null; + String formatString = null; + String backColor = null; + String foreColor = null; + String fontName = null; + String fontSize = null; + String fontFlags = null; + List translations = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if (NAME.equals(nodeName)) { + name = node.getTextContent(); + } + if (ID.equals(nodeName)) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if ("AggregateFunction".equals(nodeName)) { + aggregateFunction = node.getTextContent(); + } + if ("DataType".equals(nodeName)) { + dataType = node.getTextContent(); + } + if (SOURCE.equals(nodeName)) { + source = CommonConverter.getDataItem(node.getChildNodes()); + } + if (VISIBLE.equals(nodeName)) { + visible = toBoolean(node.getTextContent()); + } + if ("MeasureExpression".equals(nodeName)) { + measureExpression = node.getTextContent(); + } + if (DISPLAY_FOLDER.equals(nodeName)) { + displayFolder = node.getTextContent(); + } + if ("FormatString".equals(nodeName)) { + formatString = node.getTextContent(); + } + if ("BackColor".equals(nodeName)) { + backColor = node.getTextContent(); + } + if ("ForeColor".equals(nodeName)) { + foreColor = node.getTextContent(); + } + if ("FontName".equals(nodeName)) { + fontName = node.getTextContent(); + } + if ("FontSize".equals(nodeName)) { + fontSize = node.getTextContent(); + } + if ("FontFlags".equals(nodeName)) { + fontFlags = node.getTextContent(); + } + if (TRANSLATIONS.equals(nodeName)) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (ANNOTATIONS.equals(nodeName)) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new MeasureR(name, id, description, aggregateFunction, dataType, source, visible, measureExpression, + displayFolder, formatString, backColor, foreColor, fontName, fontSize, fontFlags, translations, + annotations); + } + + public static List getMdxScriptList(NodeList nl, Function commandParser) { + return getList(nl, "MdxScript", childNodes -> getMdxScript(childNodes, commandParser)); + } + + public static MdxScript getMdxScript(NodeList nl, Function commandParser) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + List commands = null; + Boolean defaultScript = null; + List calculationProperties = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if ("Commands".equals(nodeName)) { + commands = getCommandList(node.getChildNodes(), commandParser); + } + if ("DefaultScript".equals(nodeName)) { + defaultScript = toBoolean(node.getTextContent()); + } + if ("CalculationProperties".equals(nodeName)) { + calculationProperties = getCalculationPropertyList(node.getChildNodes()); + } + } + } + return new MdxScriptR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, commands, + defaultScript, calculationProperties); + } + + public static List getCommandList(NodeList nl, Function commandParser) { + return getList(nl, COMMAND, commandParser); + } + + public static List getCalculationPropertyList(NodeList nl) { + return getList(nl, "CalculationProperty", childNodes -> getCalculationProperty(childNodes)); + } + + public static CalculationProperty getCalculationProperty(NodeList nl) { + String calculationReference = null; + String calculationType = null; + List translations = null; + String description = null; + Boolean visible = null; + BigInteger solveOrder = null; + String formatString = null; + String foreColor = null; + String backColor = null; + String fontName = null; + String fontSize = null; + String fontFlags = null; + String nonEmptyBehavior = null; + String associatedMeasureGroupID = null; + String displayFolder = null; + BigInteger language = null; + CalculationPropertiesVisualizationProperties visualizationProperties = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if ("CalculationReference".equals(nodeName)) { + calculationReference = node.getTextContent(); + } + if ("CalculationType".equals(nodeName)) { + calculationType = node.getTextContent(); + } + if (TRANSLATIONS.equals(nodeName)) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (DESCRIPTION.equals(nodeName)) { + description = node.getTextContent(); + } + if (VISIBLE.equals(nodeName)) { + visible = toBoolean(node.getTextContent()); + } + if ("SolveOrder".equals(nodeName)) { + solveOrder = toBigInteger(node.getTextContent()); + } + if ("FormatString".equals(nodeName)) { + formatString = node.getTextContent(); + } + if ("ForeColor".equals(nodeName)) { + foreColor = node.getTextContent(); + } + if ("BackColor".equals(nodeName)) { + backColor = node.getTextContent(); + } + if ("FontName".equals(nodeName)) { + fontName = node.getTextContent(); + } + if ("FontSize".equals(nodeName)) { + fontSize = node.getTextContent(); + } + if ("FontFlags".equals(nodeName)) { + fontFlags = node.getTextContent(); + } + if ("NonEmptyBehavior".equals(nodeName)) { + nonEmptyBehavior = node.getTextContent(); + } + if ("AssociatedMeasureGroupID".equals(nodeName)) { + associatedMeasureGroupID = node.getTextContent(); + } + if (DISPLAY_FOLDER.equals(nodeName)) { + displayFolder = node.getTextContent(); + } + if (LANGUAGE.equals(nodeName)) { + language = toBigInteger(node.getTextContent()); + } + if (VISUALIZATION_PROPERTIES.equals(nodeName)) { + visualizationProperties = getCalculationPropertiesVisualizationProperties(node.getChildNodes()); + } + } + } + return new CalculationPropertyR(calculationReference, calculationType, translations, description, visible, + solveOrder, formatString, foreColor, backColor, fontName, fontSize, fontFlags, nonEmptyBehavior, + associatedMeasureGroupID, displayFolder, language, visualizationProperties); + } + + public static CalculationPropertiesVisualizationProperties getCalculationPropertiesVisualizationProperties( + NodeList nl) { + BigInteger folderPosition = null; + String contextualNameRule = null; + String alignment = null; + Boolean isFolderDefault = null; + Boolean isRightToLeft = null; + String sortDirection = null; + String units = null; + BigInteger width = null; + Boolean isDefaultMeasure = null; + BigInteger defaultDetailsPosition = null; + BigInteger sortPropertiesPosition = null; + Boolean isSimpleMeasure = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + String nodeName = node.getNodeName(); + if ("FolderPosition".equals(nodeName)) { + folderPosition = toBigInteger(node.getTextContent()); + } + if ("ContextualNameRule".equals(nodeName)) { + contextualNameRule = node.getTextContent(); + } + if ("Alignment".equals(nodeName)) { + alignment = node.getTextContent(); + } + if ("IsFolderDefault".equals(nodeName)) { + isFolderDefault = toBoolean(node.getTextContent()); + } + if ("IsRightToLeft".equals(nodeName)) { + isRightToLeft = toBoolean(node.getTextContent()); + } + if ("SortDirection".equals(nodeName)) { + sortDirection = node.getTextContent(); + } + if ("Units".equals(nodeName)) { + units = node.getTextContent(); + } + if ("Width".equals(nodeName)) { + width = toBigInteger(node.getTextContent()); + } + if ("IsDefaultMeasure".equals(nodeName)) { + isDefaultMeasure = toBoolean(node.getTextContent()); + } + if ("DefaultDetailsPosition".equals(nodeName)) { + defaultDetailsPosition = toBigInteger(node.getTextContent()); + } + if ("SortPropertiesPosition".equals(nodeName)) { + sortPropertiesPosition = toBigInteger(node.getTextContent()); + } + if ("IsSimpleMeasure".equals(nodeName)) { + isSimpleMeasure = toBoolean(node.getTextContent()); + } + } + } + return new CalculationPropertiesVisualizationPropertiesR(folderPosition, contextualNameRule, alignment, + isFolderDefault, isRightToLeft, sortDirection, units, width, isDefaultMeasure, defaultDetailsPosition, + sortPropertiesPosition, isSimpleMeasure); + } + + public static DataSourceViewBinding getDataSourceViewBinding(NodeList nl) { + String dataSourceViewID = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (DATA_SOURCE_VIEW_ID.equals(node.getNodeName())) { + dataSourceViewID = node.getTextContent(); + } + } + } + return new DataSourceViewBindingR(dataSourceViewID); + } + + static List getAggregationDesignList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("AggregationDesigns".equals(node.getNodeName()))) { + list.add(AggregationConverter.getAggregationDesign(node.getChildNodes(), + CommonConverter::getAnnotationList)); + } + } + return list; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DataSourceConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DataSourceConverter.java new file mode 100644 index 0000000..cf682af --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DataSourceConverter.java @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DATA_SOURCE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.nodeListToMap; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toDuration; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; + +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.engine.ImpersonationInfo; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.DataSource; +import org.eclipse.daanse.xmla.api.xmla.DataSourcePermission; +import org.eclipse.daanse.xmla.api.xmla.DataSourceView; +import org.eclipse.daanse.xmla.api.xmla.DataSourceViewBinding; +import org.eclipse.daanse.xmla.model.record.engine.ImpersonationInfoR; +import org.eclipse.daanse.xmla.model.record.xmla.DataSourceR; +import org.eclipse.daanse.xmla.model.record.xmla.DataSourceViewBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DataSourceViewR; +import org.w3c.dom.NodeList; + +/** + * Converter for DataSource and DataSourceView types from XML NodeList. + */ +public class DataSourceConverter { + + private DataSourceConverter() { + // utility class + } + + public static DataSourceViewBinding getDataSourceViewBinding(NodeList childNodes) { + Map map = nodeListToMap(childNodes); + return new DataSourceViewBindingR(map.get("DataSourceViewID")); + } + + public static List getDataSourceViewList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("DataSourceView".equals(node.getNodeName()))) { + list.add(getDataSourceView(node.getChildNodes())); + } + } + return list; + } + + public static DataSourceView getDataSourceView(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String dataSourceID = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (DATA_SOURCE_ID.equals(node.getNodeName())) { + dataSourceID = node.getTextContent(); + } + } + } + return new DataSourceViewR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, + dataSourceID); + } + + public static List getDataSourceList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("DataSource".equals(node.getNodeName()))) { + list.add(getDataSource(node.getChildNodes())); + } + } + return list; + } + + public static DataSource getDataSource(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String managedProvider = null; + String connectionString = null; + String connectionStringSecurity = null; + ImpersonationInfo impersonationInfo = null; + String isolation = null; + BigInteger maxActiveConnections = null; + Duration timeout = null; + List dataSourcePermissions = null; + ImpersonationInfo queryImpersonationInfo = null; + String queryHints = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("ManagedProvider".equals(node.getNodeName())) { + managedProvider = node.getTextContent(); + } + if ("ConnectionString".equals(node.getNodeName())) { + connectionString = node.getTextContent(); + } + if ("ConnectionStringSecurity".equals(node.getNodeName())) { + connectionStringSecurity = node.getTextContent(); + } + if ("ImpersonationInfo".equals(node.getNodeName())) { + impersonationInfo = getImpersonationInfo(node.getChildNodes()); + } + if ("Isolation".equals(node.getNodeName())) { + isolation = node.getTextContent(); + } + if ("MaxActiveConnections".equals(node.getNodeName())) { + maxActiveConnections = toBigInteger(node.getTextContent()); + } + if ("Timeout".equals(node.getNodeName())) { + timeout = toDuration(node.getTextContent()); + } + if ("DataSourcePermissions".equals(node.getNodeName())) { + dataSourcePermissions = PermissionConverter.getDataSourcePermissionList(node.getChildNodes()); + } + if ("QueryImpersonationInfo".equals(node.getNodeName())) { + queryImpersonationInfo = getImpersonationInfo(node.getChildNodes()); + } + if ("QueryHints".equals(node.getNodeName())) { + queryHints = node.getTextContent(); + } + } + } + return new DataSourceR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, managedProvider, + connectionString, connectionStringSecurity, impersonationInfo, isolation, maxActiveConnections, timeout, + dataSourcePermissions, queryImpersonationInfo, queryHints); + } + + public static ImpersonationInfo getImpersonationInfo(NodeList nl) { + String impersonationMode = null; + String account = null; + String password = null; + String impersonationInfoSecurity = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("ImpersonationMode".equals(node.getNodeName())) { + impersonationMode = node.getTextContent(); + } + if ("Account".equals(node.getNodeName())) { + account = node.getTextContent(); + } + if ("Password".equals(node.getNodeName())) { + password = node.getTextContent(); + } + if ("ImpersonationInfoSecurity".equals(node.getNodeName())) { + impersonationInfoSecurity = node.getTextContent(); + } + } + } + + return new ImpersonationInfoR(impersonationMode, Optional.ofNullable(account), Optional.ofNullable(password), + Optional.ofNullable(impersonationInfoSecurity)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DatabaseConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DatabaseConverter.java new file mode 100644 index 0000000..749b9c9 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DatabaseConverter.java @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.AGGREGATION_PREFIX; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ESTIMATED_SIZE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LANGUAGE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_PROCESSED; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_PRIORITY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VISIBLE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getStringList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.math.BigInteger; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; + +import org.eclipse.daanse.xmla.api.engine.ImpersonationInfo; +import org.eclipse.daanse.xmla.api.xmla.Account; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.Assembly; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.Cube; +import org.eclipse.daanse.xmla.api.xmla.DataSource; +import org.eclipse.daanse.xmla.api.xmla.DataSourceView; +import org.eclipse.daanse.xmla.api.xmla.Database; +import org.eclipse.daanse.xmla.api.xmla.DatabasePermission; +import org.eclipse.daanse.xmla.api.xmla.Dimension; +import org.eclipse.daanse.xmla.api.xmla.MiningStructure; +import org.eclipse.daanse.xmla.api.xmla.Role; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.model.record.xmla.AccountR; +import org.eclipse.daanse.xmla.model.record.xmla.DatabaseR; +import org.w3c.dom.NodeList; + +/** + * Converter for Database and Account types from XML NodeList. + */ +public class DatabaseConverter { + + private DatabaseConverter() { + // utility class + } + + public static List getDatabaseList(NodeList nl, Function commandParser, + Function> assemblySupplier) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Database".equals(node.getNodeName()))) { + list.add(getDatabase(node.getChildNodes(), commandParser, assemblySupplier)); + } + } + return list; + } + + public static Database getDatabase(NodeList nl, Function commandParser, + Function> assemblySupplier) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + Instant lastUpdate = null; + String state = null; + String readWriteMode = null; + String dbStorageLocation = null; + String aggregationPrefix = null; + BigInteger processingPriority = null; + Long estimatedSize = null; + Instant lastProcessed = null; + BigInteger language = null; + String collation = null; + Boolean visible = null; + String masterDataSourceID = null; + ImpersonationInfo dataSourceImpersonationInfo = null; + List accounts = null; + List dataSources = null; + List dataSourceViews = null; + List dimensions = null; + List cubes = null; + List miningStructures = null; + List roles = null; + List assemblies = null; + List databasePermissions = null; + List translations = null; + String storageEngineUsed = null; + String imagePath = null; + String imageUrl = null; + String imageUniqueID = null; + String imageVersion = null; + String token = null; + BigInteger compatibilityLevel = null; + String directQueryMode = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("LastUpdate".equals(node.getNodeName())) { + lastUpdate = toInstant(node.getTextContent()); + } + if (STATE.equals(node.getNodeName())) { + state = node.getTextContent(); + } + if ("ReadWriteMode".equals(node.getNodeName())) { + readWriteMode = node.getTextContent(); + } + if ("DbStorageLocation".equals(node.getNodeName())) { + dbStorageLocation = node.getTextContent(); + } + if (AGGREGATION_PREFIX.equals(node.getNodeName())) { + aggregationPrefix = node.getTextContent(); + } + if (PROCESSING_PRIORITY.equals(node.getNodeName())) { + processingPriority = toBigInteger(node.getTextContent()); + } + if (ESTIMATED_SIZE.equals(node.getNodeName())) { + estimatedSize = toLong(node.getTextContent()); + } + if (LAST_PROCESSED.equals(node.getNodeName())) { + lastProcessed = toInstant(node.getTextContent()); + } + if (LANGUAGE.equals(node.getNodeName())) { + language = toBigInteger(node.getTextContent()); + } + if (COLLATION.equals(node.getNodeName())) { + collation = node.getTextContent(); + } + if (VISIBLE.equals(node.getNodeName())) { + visible = toBoolean(node.getTextContent()); + } + if ("MasterDataSourceID".equals(node.getNodeName())) { + masterDataSourceID = node.getTextContent(); + } + if ("DataSourceImpersonationInfo".equals(node.getNodeName())) { + dataSourceImpersonationInfo = DataSourceConverter.getImpersonationInfo(node.getChildNodes()); + } + if ("Accounts".equals(node.getNodeName())) { + accounts = getAccountList(node.getChildNodes()); + } + if ("DataSources".equals(node.getNodeName())) { + dataSources = DataSourceConverter.getDataSourceList(node.getChildNodes()); + } + if ("DataSourceViews".equals(node.getNodeName())) { + dataSourceViews = DataSourceConverter.getDataSourceViewList(node.getChildNodes()); + } + if (DIMENSIONS.equals(node.getNodeName())) { + dimensions = DimensionConverter.getDimensionList(node.getChildNodes()); + } + if ("Cubes".equals(node.getNodeName())) { + cubes = CubeConverter.getCubeList(node.getChildNodes(), commandParser); + } + if ("MiningStructures".equals(node.getNodeName())) { + miningStructures = MiningConverter.getMiningStructureList(node.getChildNodes()); + } + if ("Roles".equals(node.getNodeName())) { + roles = RoleConverter.getRoleList(node.getChildNodes(), ROLE2); + } + if ("Assemblies".equals(node.getNodeName())) { + assemblies = assemblySupplier.apply(node.getChildNodes()); + } + if ("DatabasePermissions".equals(node.getNodeName())) { + databasePermissions = PermissionConverter.getDatabasePermissionList(node.getChildNodes()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if ("StorageEngineUsed".equals(node.getNodeName())) { + storageEngineUsed = node.getTextContent(); + } + if ("ImagePath".equals(node.getNodeName())) { + imagePath = node.getTextContent(); + } + if ("ImageUrl".equals(node.getNodeName())) { + imageUrl = node.getTextContent(); + } + if ("ImageUniqueID".equals(node.getNodeName())) { + imageUniqueID = node.getTextContent(); + } + if ("ImageVersion".equals(node.getNodeName())) { + imageVersion = node.getTextContent(); + } + if ("Token".equals(node.getNodeName())) { + token = node.getTextContent(); + } + if ("CompatibilityLevel".equals(node.getNodeName())) { + compatibilityLevel = toBigInteger(node.getTextContent()); + } + if ("DirectQueryMode".equals(node.getNodeName())) { + directQueryMode = node.getTextContent(); + } + } + } + return new DatabaseR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, lastUpdate, state, + readWriteMode, dbStorageLocation, aggregationPrefix, processingPriority, estimatedSize, lastProcessed, + language, collation, visible, masterDataSourceID, dataSourceImpersonationInfo, accounts, dataSources, + dataSourceViews, dimensions, cubes, miningStructures, roles, assemblies, databasePermissions, + translations, storageEngineUsed, imagePath, imageUrl, imageUniqueID, imageVersion, token, + compatibilityLevel, directQueryMode); + } + + public static List getAccountList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Account".equals(node.getNodeName()))) { + list.add(getAccount(node.getChildNodes())); + } + } + return list; + } + + public static Account getAccount(NodeList nl) { + String accountType = null; + String aggregationFunction = null; + List aliases = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("AccountType".equals(node.getNodeName())) { + accountType = node.getTextContent(); + } + if ("AggregationFunction".equals(node.getNodeName())) { + aggregationFunction = node.getTextContent(); + } + if ("Aliases".equals(node.getNodeName())) { + aliases = getAliasList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new AccountR(accountType, aggregationFunction, aliases, annotations); + } + + private static List getAliasList(NodeList nl) { + return getStringList(nl, "Alias"); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DimensionConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DimensionConverter.java new file mode 100644 index 0000000..ef86c52 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/DimensionConverter.java @@ -0,0 +1,1012 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_HIERARCHY_VISIBLE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CAPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CONTEXTUAL_NAME_RULE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DEFAULT_DETAILS_POSITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DEFAULT_MEMBER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DISPLAY_FOLDER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ERROR_CONFIGURATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.FOLDER_POSITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.HIERARCHIES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.HIERARCHY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMN; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LANGUAGE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_PROCESSED; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MINING_MODEL_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROACTIVE_CACHING; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_MODE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_PRIORITY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_STATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.READ_DEFINITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SORT_PROPERTIES_POSITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SOURCE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STORAGE_MODE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUENS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VISIBLE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VISUALIZATION_PROPERTIES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.WRITE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getAttribute; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getNodeType; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.math.BigInteger; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.engine300.AttributeHierarchyProcessingState; +import org.eclipse.daanse.xmla.api.engine300.DimensionAttributeVisualizationProperties; +import org.eclipse.daanse.xmla.api.engine300.HierarchyVisualizationProperties; +import org.eclipse.daanse.xmla.api.engine300.RelationshipEndVisualizationProperties; +import org.eclipse.daanse.xmla.api.engine300_300.Relationship; +import org.eclipse.daanse.xmla.api.engine300_300.RelationshipEnd; +import org.eclipse.daanse.xmla.api.engine300_300.RelationshipEndTranslation; +import org.eclipse.daanse.xmla.api.engine300_300.Relationships; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.AttributePermission; +import org.eclipse.daanse.xmla.api.xmla.AttributeRelationship; +import org.eclipse.daanse.xmla.api.xmla.AttributeTranslation; +import org.eclipse.daanse.xmla.api.xmla.Binding; +import org.eclipse.daanse.xmla.api.xmla.DataItem; +import org.eclipse.daanse.xmla.api.xmla.Dimension; +import org.eclipse.daanse.xmla.api.xmla.DimensionAttribute; +import org.eclipse.daanse.xmla.api.xmla.DimensionAttributeTypeEnumType; +import org.eclipse.daanse.xmla.api.xmla.DimensionPermission; +import org.eclipse.daanse.xmla.api.xmla.ErrorConfiguration; +import org.eclipse.daanse.xmla.api.xmla.Hierarchy; +import org.eclipse.daanse.xmla.api.xmla.Level; +import org.eclipse.daanse.xmla.api.xmla.ProactiveCaching; +import org.eclipse.daanse.xmla.api.xmla.ReadDefinitionEnum; +import org.eclipse.daanse.xmla.api.xmla.ReadWritePermissionEnum; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.api.xmla.UnknownMemberEnumType; +import org.eclipse.daanse.xmla.model.record.engine300.DimensionAttributeVisualizationPropertiesR; +import org.eclipse.daanse.xmla.model.record.engine300.HierarchyVisualizationPropertiesR; +import org.eclipse.daanse.xmla.model.record.engine300.RelationshipEndVisualizationPropertiesR; +import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipEndR; +import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipEndTranslationR; +import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipR; +import org.eclipse.daanse.xmla.model.record.engine300_300.RelationshipsR; +import org.eclipse.daanse.xmla.model.record.xmla.AttributePermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.DimensionAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.DimensionPermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.DimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.HierarchyR; +import org.eclipse.daanse.xmla.model.record.xmla.LevelR; +import org.w3c.dom.NodeList; + +/** + * Converter for Dimension-related XML parsing. Handles Dimension, + * DimensionAttribute, Hierarchy, Level, and related types. + */ +public class DimensionConverter { + + private DimensionConverter() { + // utility class + } + + public static List getDimensionList(NodeList nl) { + return getList(nl, DIMENSION, childNodes -> getDimension(childNodes)); + } + + public static Dimension getDimension(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + Binding source = null; + String miningModelID = null; + String type = null; + Dimension.UnknownMember unknownMember = null; + String mdxMissingMemberMode = null; + ErrorConfiguration errorConfiguration = null; + String storageMode = null; + Boolean writeEnabled = null; + BigInteger processingPriority = null; + Instant lastProcessed = null; + List dimensionPermissions = null; + String dependsOnDimensionID = null; + BigInteger language = null; + String collation = null; + String unknownMemberName = null; + List unknownMemberTranslations = null; + String state = null; + ProactiveCaching proactiveCaching = null; + String processingMode = null; + String processingGroup = null; + Dimension.CurrentStorageMode currentStorageMode = null; + List translations = null; + List attributes = null; + String attributeAllMemberName = null; + List attributeAllMemberTranslations = null; + List hierarchies = null; + String processingRecommendation = null; + Relationships relationships = null; + Integer stringStoresCompatibilityLevel = null; + Integer currentStringStoresCompatibilityLevel = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getBinding(node.getChildNodes(), getNodeType(node)); + } + if (MINING_MODEL_ID.equals(node.getNodeName())) { + miningModelID = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = node.getTextContent(); + } + if ("UnknownMember".equals(node.getNodeName())) { + unknownMember = getDimensionUnknownMember(node.getChildNodes()); + } + if ("MdxMissingMemberMode".equals(node.getNodeName())) { + mdxMissingMemberMode = node.getTextContent(); + } + if (ERROR_CONFIGURATION.equals(node.getNodeName())) { + errorConfiguration = CommonConverter.getErrorConfiguration(node.getChildNodes()); + } + if (STORAGE_MODE.equals(node.getNodeName())) { + storageMode = node.getTextContent(); + } + if ("WriteEnabled".equals(node.getNodeName())) { + writeEnabled = toBoolean(node.getTextContent()); + } + if (PROCESSING_PRIORITY.equals(node.getNodeName())) { + processingPriority = toBigInteger(node.getTextContent()); + } + if (LAST_PROCESSED.equals(node.getNodeName())) { + lastProcessed = toInstant(node.getTextContent()); + } + if ("DimensionPermissions".equals(node.getNodeName())) { + dimensionPermissions = getDimensionPermissionList(node.getChildNodes()); + } + if ("DependsOnDimensionID".equals(node.getNodeName())) { + dependsOnDimensionID = node.getTextContent(); + } + if (LANGUAGE.equals(node.getNodeName())) { + language = toBigInteger(node.getTextContent()); + } + if (COLLATION.equals(node.getNodeName())) { + collation = node.getTextContent(); + } + if ("UnknownMemberName".equals(node.getNodeName())) { + unknownMemberName = node.getTextContent(); + } + if ("UnknownMemberTranslations".equals(node.getNodeName())) { + unknownMemberTranslations = CommonConverter.getTranslationList(node.getChildNodes(), + "UnknownMemberTranslation"); + } + if (STATE.equals(node.getNodeName())) { + state = node.getTextContent(); + } + if (PROACTIVE_CACHING.equals(node.getNodeName())) { + proactiveCaching = CommonConverter.getProactiveCaching(node.getChildNodes()); + } + if (PROCESSING_MODE.equals(node.getNodeName())) { + processingMode = node.getTextContent(); + } + if ("ProcessingGroup".equals(node.getNodeName())) { + processingGroup = node.getTextContent(); + } + if ("CurrentStorageMode".equals(node.getNodeName())) { + processingGroup = node.getTextContent(); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (ATTRIBUTES.equals(node.getNodeName())) { + attributes = getDimensionAttributeList(node.getChildNodes()); + } + if ("AttributeAllMemberName".equals(node.getNodeName())) { + attributeAllMemberName = node.getTextContent(); + } + if ("AttributeAllMemberTranslations".equals(node.getNodeName())) { + attributeAllMemberTranslations = CommonConverter.getTranslationList(node.getChildNodes(), + "AttributeAllMemberTranslation"); + } + if (HIERARCHIES.equals(node.getNodeName())) { + hierarchies = getHierarchyList(node.getChildNodes()); + } + if ("ProcessingRecommendation".equals(node.getNodeName())) { + processingRecommendation = node.getTextContent(); + } + if ("Relationships".equals(node.getNodeName())) { + relationships = getRelationships(node.getChildNodes()); + } + if ("StringStoresCompatibilityLevel".equals(node.getNodeName())) { + stringStoresCompatibilityLevel = toInteger(node.getTextContent()); + } + if ("CurrentStringStoresCompatibilityLevel".equals(node.getNodeName())) { + currentStringStoresCompatibilityLevel = toInteger(node.getTextContent()); + } + } + } + return new DimensionR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, source, + miningModelID, type, unknownMember, mdxMissingMemberMode, errorConfiguration, storageMode, writeEnabled, + processingPriority, lastProcessed, dimensionPermissions, dependsOnDimensionID, language, collation, + unknownMemberName, unknownMemberTranslations, state, proactiveCaching, processingMode, processingGroup, + currentStorageMode, translations, attributes, attributeAllMemberName, attributeAllMemberTranslations, + hierarchies, processingRecommendation, relationships, stringStoresCompatibilityLevel, + currentStringStoresCompatibilityLevel); + } + + public static List getDimensionPermissionList(NodeList nl) { + return getList(nl, "DimensionPermission", childNodes -> getDimensionPermission(childNodes)); + } + + public static DimensionPermission getDimensionPermission(NodeList nl) { + List attributePermissions = null; + String allowedRowsExpression = null; + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (ROLE_ID.equals(node.getNodeName())) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(node.getNodeName())) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(node.getNodeName())) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(node.getNodeName())) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(node.getNodeName())) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if ("AttributePermissions".equals(node.getNodeName())) { + attributePermissions = getAttributePermissionList(node.getChildNodes()); + } + if ("AllowedRowsExpression".equals(node.getNodeName())) { + allowedRowsExpression = node.getTextContent(); + } + } + } + + return new DimensionPermissionR(Optional.ofNullable(attributePermissions), + Optional.ofNullable(allowedRowsExpression), name, Optional.ofNullable(id), + Optional.ofNullable(createdTimestamp), Optional.ofNullable(lastSchemaUpdate), + Optional.ofNullable(description), Optional.ofNullable(annotations), roleID, + Optional.ofNullable(process), Optional.ofNullable(readDefinition), Optional.ofNullable(read), + Optional.ofNullable(write)); + } + + public static List getAttributePermissionList(NodeList nl) { + return getList(nl, "AttributePermission", childNodes -> getAttributePermission(childNodes)); + } + + public static AttributePermission getAttributePermission(NodeList nl) { + String attributeID = null; + String description = null; + String defaultMember = null; + String visualTotals = null; + String allowedSet = null; + String deniedSet = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (DEFAULT_MEMBER.equals(node.getNodeName())) { + defaultMember = node.getTextContent(); + } + if ("VisualTotals".equals(node.getNodeName())) { + visualTotals = node.getTextContent(); + } + if ("AllowedSet".equals(node.getNodeName())) { + allowedSet = node.getTextContent(); + } + if ("DeniedSet".equals(node.getNodeName())) { + deniedSet = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new AttributePermissionR(attributeID, Optional.ofNullable(description), + Optional.ofNullable(defaultMember), Optional.ofNullable(visualTotals), Optional.ofNullable(allowedSet), + Optional.ofNullable(deniedSet), Optional.ofNullable(annotations)); + } + + public static Dimension.UnknownMember getDimensionUnknownMember(NodeList nl) { + UnknownMemberEnumType value = null; + String valuens = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + value = UnknownMemberEnumType.fromValue(node.getTextContent()); + valuens = getAttribute(node.getAttributes(), VALUENS); + } + } + return new DimensionR.UnknownMember(value, valuens); + } + + public static List getDimensionAttributeList(NodeList nl) { + return getList(nl, ATTRIBUTE, childNodes -> getDimensionAttribute(childNodes)); + } + + public static DimensionAttribute getDimensionAttribute(NodeList nl) { + String name = null; + String id = null; + String description = null; + DimensionAttribute.Type type = null; + String usage = null; + Binding source = null; + Long estimatedCount = null; + List keyColumns = null; + DataItem nameColumn = null; + DataItem valueColumn = null; + List translations = null; + List attributeRelationships = null; + String discretizationMethod = null; + BigInteger discretizationBucketCount = null; + String rootMemberIf = null; + String orderBy = null; + String defaultMember = null; + String orderByAttributeID = null; + DataItem skippedLevelsColumn = null; + String namingTemplate = null; + String membersWithData = null; + String membersWithDataCaption = null; + List namingTemplateTranslations = null; + DataItem customRollupColumn = null; + DataItem customRollupPropertiesColumn = null; + DataItem unaryOperatorColumn = null; + Boolean attributeHierarchyOrdered = null; + Boolean memberNamesUnique = null; + Boolean isAggregatable = null; + Boolean attributeHierarchyEnabled = null; + String attributeHierarchyOptimizedState = null; + Boolean attributeHierarchyVisible = null; + String attributeHierarchyDisplayFolder = null; + Boolean keyUniquenessGuarantee = null; + String groupingBehavior = null; + String instanceSelection = null; + List annotations = null; + String processingState = null; + AttributeHierarchyProcessingState attributeHierarchyProcessingState = null; + DimensionAttributeVisualizationProperties visualizationProperties = null; + String extendedType = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = getDimensionAttributeType(node.getChildNodes()); + } + if ("Usage".equals(node.getNodeName())) { + usage = node.getTextContent(); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getBinding(node.getChildNodes(), getNodeType(node)); + } + if ("EstimatedCount".equals(node.getNodeName())) { + estimatedCount = toLong(node.getTextContent()); + } + if (KEY_COLUMNS.equals(node.getNodeName())) { + keyColumns = CommonConverter.getDataItemList(node.getChildNodes(), KEY_COLUMN); + } + if ("NameColumn".equals(node.getNodeName())) { + nameColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if ("ValueColumn".equals(node.getNodeName())) { + valueColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getAttributeTranslationList(node.getChildNodes()); + } + if ("AttributeRelationships".equals(node.getNodeName())) { + translations = getAttributeRelationshipsList(node.getChildNodes()); + } + if ("DiscretizationMethod".equals(node.getNodeName())) { + discretizationMethod = node.getTextContent(); + } + if ("DiscretizationBucketCount".equals(node.getNodeName())) { + discretizationBucketCount = toBigInteger(node.getTextContent()); + } + if ("RootMemberIf".equals(node.getNodeName())) { + rootMemberIf = node.getTextContent(); + } + if ("OrderBy".equals(node.getNodeName())) { + orderBy = node.getTextContent(); + } + if (DEFAULT_MEMBER.equals(node.getNodeName())) { + defaultMember = node.getTextContent(); + } + if ("OrderByAttributeID".equals(node.getNodeName())) { + orderByAttributeID = node.getTextContent(); + } + if ("SkippedLevelsColumn".equals(node.getNodeName())) { + skippedLevelsColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if ("NamingTemplate".equals(node.getNodeName())) { + namingTemplate = node.getTextContent(); + } + if ("MembersWithData".equals(node.getNodeName())) { + membersWithData = node.getTextContent(); + } + if ("MembersWithDataCaption".equals(node.getNodeName())) { + membersWithDataCaption = node.getTextContent(); + } + if ("NamingTemplateTranslations".equals(node.getNodeName())) { + namingTemplateTranslations = getNamingTemplateTranslationList(node.getChildNodes()); + } + if ("CustomRollupColumn".equals(node.getNodeName())) { + customRollupColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if ("CustomRollupPropertiesColumn".equals(node.getNodeName())) { + customRollupPropertiesColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if ("unaryOperatorColumn".equals(node.getNodeName())) { + unaryOperatorColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if ("AttributeHierarchyOrdered".equals(node.getNodeName())) { + attributeHierarchyOrdered = toBoolean(node.getTextContent()); + } + if ("MemberNamesUnique".equals(node.getNodeName())) { + memberNamesUnique = toBoolean(node.getTextContent()); + } + if ("IsAggregatable".equals(node.getNodeName())) { + isAggregatable = toBoolean(node.getTextContent()); + } + if ("AttributeHierarchyEnabled".equals(node.getNodeName())) { + attributeHierarchyEnabled = toBoolean(node.getTextContent()); + } + if ("AttributeHierarchyOptimizedState".equals(node.getNodeName())) { + attributeHierarchyOptimizedState = node.getTextContent(); + } + if (ATTRIBUTE_HIERARCHY_VISIBLE.equals(node.getNodeName())) { + attributeHierarchyVisible = toBoolean(node.getTextContent()); + } + if ("AttributeHierarchyDisplayFolder".equals(node.getNodeName())) { + attributeHierarchyDisplayFolder = node.getTextContent(); + } + if ("KeyUniquenessGuarantee".equals(node.getNodeName())) { + keyUniquenessGuarantee = toBoolean(node.getTextContent()); + } + if ("GroupingBehavior".equals(node.getNodeName())) { + groupingBehavior = node.getTextContent(); + } + if ("InstanceSelection".equals(node.getNodeName())) { + instanceSelection = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (PROCESSING_STATE.equals(node.getNodeName())) { + processingState = node.getTextContent(); + } + if ("AttributeHierarchyProcessingState".equals(node.getNodeName())) { + attributeHierarchyProcessingState = AttributeHierarchyProcessingState + .fromValue(node.getTextContent()); + } + if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { + visualizationProperties = getDimensionAttributeVisualizationProperties(node.getChildNodes()); + } + if ("ExtendedType".equals(node.getNodeName())) { + extendedType = node.getTextContent(); + } + } + } + return new DimensionAttributeR(name, id, description, type, usage, source, estimatedCount, keyColumns, + nameColumn, valueColumn, translations, attributeRelationships, discretizationMethod, + discretizationBucketCount, rootMemberIf, orderBy, defaultMember, orderByAttributeID, + skippedLevelsColumn, namingTemplate, membersWithData, membersWithDataCaption, + namingTemplateTranslations, customRollupColumn, customRollupPropertiesColumn, unaryOperatorColumn, + attributeHierarchyOrdered, memberNamesUnique, isAggregatable, attributeHierarchyEnabled, + attributeHierarchyOptimizedState, attributeHierarchyVisible, attributeHierarchyDisplayFolder, + keyUniquenessGuarantee, groupingBehavior, instanceSelection, annotations, processingState, + attributeHierarchyProcessingState, visualizationProperties, extendedType); + } + + public static DimensionAttributeVisualizationProperties getDimensionAttributeVisualizationProperties(NodeList nl) { + BigInteger folderPosition = null; + String contextualNameRule = null; + String alignment = null; + Boolean isFolderDefault = null; + Boolean isRightToLeft = null; + String sortDirection = null; + String units = null; + BigInteger width = null; + BigInteger defaultDetailsPosition = null; + BigInteger commonIdentifierPosition = null; + BigInteger sortPropertiesPosition = null; + BigInteger displayKeyPosition = null; + Boolean isDefaultImage = null; + String defaultAggregateFunction = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (FOLDER_POSITION.equals(node.getNodeName())) { + folderPosition = toBigInteger(node.getTextContent()); + } + if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { + contextualNameRule = node.getTextContent(); + } + if ("Alignment".equals(node.getNodeName())) { + alignment = node.getTextContent(); + } + if ("IsFolderDefault".equals(node.getNodeName())) { + isFolderDefault = toBoolean(node.getTextContent()); + } + if ("IsRightToLeft".equals(node.getNodeName())) { + isRightToLeft = toBoolean(node.getTextContent()); + } + if ("SortDirection".equals(node.getNodeName())) { + sortDirection = node.getTextContent(); + } + if ("Units".equals(node.getNodeName())) { + units = node.getTextContent(); + } + if ("Width".equals(node.getNodeName())) { + width = toBigInteger(node.getTextContent()); + } + if (DEFAULT_DETAILS_POSITION.equals(node.getNodeName())) { + defaultDetailsPosition = toBigInteger(node.getTextContent()); + } + if (SORT_PROPERTIES_POSITION.equals(node.getNodeName())) { + sortPropertiesPosition = toBigInteger(node.getTextContent()); + } + if ("CommonIdentifierPosition".equals(node.getNodeName())) { + commonIdentifierPosition = toBigInteger(node.getTextContent()); + } + if ("DisplayKeyPosition".equals(node.getNodeName())) { + displayKeyPosition = toBigInteger(node.getTextContent()); + } + if ("IsDefaultImage".equals(node.getNodeName())) { + isDefaultImage = toBoolean(node.getTextContent()); + } + if ("DefaultAggregateFunction".equals(node.getNodeName())) { + defaultAggregateFunction = node.getTextContent(); + } + } + } + return new DimensionAttributeVisualizationPropertiesR(folderPosition, contextualNameRule, alignment, + isFolderDefault, isRightToLeft, sortDirection, units, width, defaultDetailsPosition, + commonIdentifierPosition, sortPropertiesPosition, displayKeyPosition, isDefaultImage, + defaultAggregateFunction); + } + + public static List getNamingTemplateTranslationList(NodeList nl) { + return getList(nl, "NamingTemplateTranslation", childNodes -> getTranslation(childNodes)); + } + + public static List getAttributeRelationshipsList(NodeList nl) { + return getList(nl, "AttributeRelationship", childNodes -> getAttributeRelationship(childNodes)); + } + + private static AttributeTranslation getAttributeRelationship(NodeList nl) { + return CommonConverter.getAttributeTranslationList(nl).isEmpty() ? null + : CommonConverter.getAttributeTranslationList(nl).get(0); + } + + private static Translation getTranslation(NodeList nl) { + return CommonConverter.getTranslationList(nl, TRANSLATION).isEmpty() ? null + : CommonConverter.getTranslationList(nl, TRANSLATION).get(0); + } + + public static DimensionAttribute.Type getDimensionAttributeType(NodeList nl) { + DimensionAttributeTypeEnumType value = null; + String valuens = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + value = DimensionAttributeTypeEnumType.fromValue(node.getTextContent()); + valuens = getAttribute(node.getAttributes(), VALUENS); + break; + } + } + return new DimensionAttributeR.Type(value, valuens); + } + + public static List getHierarchyList(NodeList nl) { + return getList(nl, HIERARCHY, childNodes -> getHierarchy(childNodes)); + } + + public static Hierarchy getHierarchy(NodeList nl) { + String name = null; + String id = null; + String description = null; + String processingState = null; + String structureType = null; + String displayFolder = null; + List translations = null; + String allMemberName = null; + List allMemberTranslations = null; + Boolean memberNamesUnique = null; + String memberKeysUnique = null; + Boolean allowDuplicateNames = null; + List levels = null; + List annotations = null; + HierarchyVisualizationProperties visualizationProperties = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (PROCESSING_STATE.equals(node.getNodeName())) { + processingState = node.getTextContent(); + } + if ("StructureType".equals(node.getNodeName())) { + structureType = node.getTextContent(); + } + if (DISPLAY_FOLDER.equals(node.getNodeName())) { + displayFolder = node.getTextContent(); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if ("AllMemberName".equals(node.getNodeName())) { + allMemberName = node.getTextContent(); + } + if ("AllMemberTranslations".equals(node.getNodeName())) { + allMemberTranslations = CommonConverter.getTranslationList(node.getChildNodes(), + "AllMemberTranslation"); + } + if ("MemberNamesUnique".equals(node.getNodeName())) { + memberNamesUnique = toBoolean(node.getTextContent()); + } + if ("MemberKeysUnique".equals(node.getNodeName())) { + memberKeysUnique = node.getTextContent(); + } + if ("AllowDuplicateNames".equals(node.getNodeName())) { + allowDuplicateNames = toBoolean(node.getTextContent()); + } + if ("Levels".equals(node.getNodeName())) { + levels = getLevelList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { + visualizationProperties = getHierarchyVisualizationProperties(node.getChildNodes()); + } + } + } + return new HierarchyR(name, id, description, processingState, structureType, displayFolder, translations, + allMemberName, allMemberTranslations, memberNamesUnique, memberKeysUnique, allowDuplicateNames, levels, + annotations, visualizationProperties); + } + + public static HierarchyVisualizationProperties getHierarchyVisualizationProperties(NodeList nl) { + String contextualNameRule = null; + BigInteger folderPosition = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { + contextualNameRule = node.getTextContent(); + } + if (FOLDER_POSITION.equals(node.getNodeName())) { + folderPosition = toBigInteger(node.getTextContent()); + } + } + } + return new HierarchyVisualizationPropertiesR(contextualNameRule, folderPosition); + } + + public static List getLevelList(NodeList nl) { + return getList(nl, "Level", childNodes -> getLevel(childNodes)); + } + + public static Level getLevel(NodeList nl) { + String name = null; + String id = null; + String description = null; + String sourceAttributeID = null; + String hideMemberIf = null; + List translations = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if ("SourceAttributeID".equals(node.getNodeName())) { + sourceAttributeID = node.getTextContent(); + } + if ("HideMemberIf".equals(node.getNodeName())) { + hideMemberIf = node.getTextContent(); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new LevelR(name, id, description, sourceAttributeID, hideMemberIf, translations, annotations); + } + + public static Relationships getRelationships(NodeList nl) { + List relationship = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Relationship".equals(node.getNodeName()))) { + relationship.add(getRelationship(node.getChildNodes())); + break; + } + } + return new RelationshipsR(relationship); + } + + public static Relationship getRelationship(NodeList nl) { + String id = null; + boolean visible = false; + RelationshipEnd fromRelationshipEnd = null; + RelationshipEnd toRelationshipEnd = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (VISIBLE.equals(node.getNodeName())) { + visible = toBoolean(node.getTextContent()); + } + if ("FromRelationshipEnd".equals(node.getNodeName())) { + fromRelationshipEnd = getRelationshipEnd(node.getChildNodes()); + } + if ("ToRelationshipEnd".equals(node.getNodeName())) { + toRelationshipEnd = getRelationshipEnd(node.getChildNodes()); + } + } + } + return new RelationshipR(id, visible, fromRelationshipEnd, toRelationshipEnd); + } + + public static RelationshipEnd getRelationshipEnd(NodeList nl) { + String role = null; + String multiplicity = null; + String dimensionID = null; + List attributes = null; + List translations = null; + RelationshipEndVisualizationProperties visualizationProperties = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ROLE2.equals(node.getNodeName())) { + role = node.getTextContent(); + } + if ("Multiplicity".equals(node.getNodeName())) { + multiplicity = node.getTextContent(); + } + if (DIMENSION_ID.equals(node.getNodeName())) { + dimensionID = node.getTextContent(); + } + if (ATTRIBUTES.equals(node.getNodeName())) { + attributes = getRelationshipEndAttributes(node.getChildNodes()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = getRelationshipEndTranslations(node.getChildNodes()); + } + if (VISUALIZATION_PROPERTIES.equals(node.getNodeName())) { + visualizationProperties = getRelationshipEndVisualizationProperties(node.getChildNodes()); + } + } + } + return new RelationshipEndR(role, multiplicity, dimensionID, attributes, translations, visualizationProperties); + } + + public static RelationshipEndVisualizationProperties getRelationshipEndVisualizationProperties(NodeList nl) { + BigInteger folderPosition = null; + String contextualNameRule = null; + BigInteger defaultDetailsPosition = null; + BigInteger displayKeyPosition = null; + BigInteger commonIdentifierPosition = null; + Boolean isDefaultMeasure = null; + Boolean isDefaultImage = null; + BigInteger sortPropertiesPosition = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (FOLDER_POSITION.equals(node.getNodeName())) { + folderPosition = toBigInteger(node.getTextContent()); + } + if (CONTEXTUAL_NAME_RULE.equals(node.getNodeName())) { + contextualNameRule = node.getTextContent(); + } + if (DEFAULT_DETAILS_POSITION.equals(node.getNodeName())) { + defaultDetailsPosition = toBigInteger(node.getTextContent()); + } + if ("DisplayKeyPosition".equals(node.getNodeName())) { + displayKeyPosition = toBigInteger(node.getTextContent()); + } + if ("CommonIdentifierPosition".equals(node.getNodeName())) { + commonIdentifierPosition = toBigInteger(node.getTextContent()); + } + if ("IsDefaultMeasure".equals(node.getNodeName())) { + isDefaultMeasure = toBoolean(node.getTextContent()); + } + if ("IsDefaultImage".equals(node.getNodeName())) { + isDefaultImage = toBoolean(node.getTextContent()); + } + if (SORT_PROPERTIES_POSITION.equals(node.getNodeName())) { + sortPropertiesPosition = toBigInteger(node.getTextContent()); + } + } + } + return new RelationshipEndVisualizationPropertiesR(folderPosition, contextualNameRule, defaultDetailsPosition, + displayKeyPosition, commonIdentifierPosition, isDefaultMeasure, isDefaultImage, sortPropertiesPosition); + } + + public static List getRelationshipEndTranslations(NodeList nl) { + List translations = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (TRANSLATION.equals(node.getNodeName()))) { + translations.add(getRelationshipEndTranslation(node.getChildNodes())); + } + } + return translations; + } + + public static RelationshipEndTranslation getRelationshipEndTranslation(NodeList nl) { + long language = 0; + String caption = null; + String collectionCaption = null; + String description = null; + String displayFolder = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (LANGUAGE.equals(node.getNodeName())) { + language = toLong(node.getTextContent()); + } + if (CAPTION.equals(node.getNodeName())) { + caption = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (DISPLAY_FOLDER.equals(node.getNodeName())) { + displayFolder = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("CollectionCaption".equals(node.getNodeName())) { + collectionCaption = node.getTextContent(); + } + } + } + return new RelationshipEndTranslationR(language, caption, collectionCaption, description, displayFolder, + annotations); + } + + public static List getRelationshipEndAttributes(NodeList nl) { + List attributes = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ATTRIBUTE.equals(node.getNodeName()))) { + attributes.add(getAttributeId(node.getChildNodes())); + } + } + return attributes; + } + + public static String getAttributeId(NodeList nl) { + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ATTRIBUTE_ID.equals(node.getNodeName()))) { + return node.getTextContent(); + } + } + return null; + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/MiningConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/MiningConverter.java new file mode 100644 index 0000000..4b16d5a --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/MiningConverter.java @@ -0,0 +1,636 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ALLOW_DRILL_THROUGH; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ERROR_CONFIGURATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.FILTER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMN; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LANGUAGE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_PROCESSED; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.READ_DEFINITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SOURCE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.WRITE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getNodeType; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getStringList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.math.BigInteger; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.AlgorithmParameter; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.AttributeTranslation; +import org.eclipse.daanse.xmla.api.xmla.Binding; +import org.eclipse.daanse.xmla.api.xmla.DataItem; +import org.eclipse.daanse.xmla.api.xmla.ErrorConfiguration; +import org.eclipse.daanse.xmla.api.xmla.FoldingParameters; +import org.eclipse.daanse.xmla.api.xmla.MeasureGroupBinding; +import org.eclipse.daanse.xmla.api.xmla.MiningModel; +import org.eclipse.daanse.xmla.api.xmla.MiningModelColumn; +import org.eclipse.daanse.xmla.api.xmla.MiningModelPermission; +import org.eclipse.daanse.xmla.api.xmla.MiningModelingFlag; +import org.eclipse.daanse.xmla.api.xmla.MiningStructure; +import org.eclipse.daanse.xmla.api.xmla.MiningStructureColumn; +import org.eclipse.daanse.xmla.api.xmla.MiningStructurePermission; +import org.eclipse.daanse.xmla.api.xmla.ReadDefinitionEnum; +import org.eclipse.daanse.xmla.api.xmla.ReadWritePermissionEnum; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.model.record.xmla.AlgorithmParameterR; +import org.eclipse.daanse.xmla.model.record.xmla.FoldingParametersR; +import org.eclipse.daanse.xmla.model.record.xmla.MiningModelColumnR; +import org.eclipse.daanse.xmla.model.record.xmla.MiningModelPermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.MiningModelR; +import org.eclipse.daanse.xmla.model.record.xmla.MiningModelingFlagR; +import org.eclipse.daanse.xmla.model.record.xmla.MiningStructurePermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.MiningStructureR; +import org.eclipse.daanse.xmla.model.record.xmla.ScalarMiningStructureColumnR; +import org.eclipse.daanse.xmla.model.record.xmla.TableMiningStructureColumnR; +import org.w3c.dom.NodeList; + +/** + * Converter for Mining-related XMLA types. Handles MiningStructure, + * MiningModel, and related types. + */ +public class MiningConverter { + + private MiningConverter() { + // utility class + } + + public static List getMiningStructureList(NodeList nl) { + return getList(nl, "MiningStructure", childNl -> getMiningStructure(childNl)); + } + + public static MiningStructure getMiningStructure(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + Binding source = null; + Instant lastProcessed = null; + List translations = null; + BigInteger language = null; + String collation = null; + ErrorConfiguration errorConfiguration = null; + String cacheMode = null; + Integer holdoutMaxPercent = null; + Integer holdoutMaxCases = null; + Integer holdoutSeed = null; + Integer holdoutActualSize = null; + List columns = null; + String state = null; + List miningStructurePermissions = null; + List miningModels = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getBinding(node.getChildNodes(), getNodeType(node)); + } + if (LAST_PROCESSED.equals(node.getNodeName())) { + lastProcessed = toInstant(node.getTextContent()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (LANGUAGE.equals(node.getNodeName())) { + language = toBigInteger(node.getTextContent()); + } + if (COLLATION.equals(node.getNodeName())) { + collation = node.getTextContent(); + } + if (ERROR_CONFIGURATION.equals(node.getNodeName())) { + errorConfiguration = CommonConverter.getErrorConfiguration(node.getChildNodes()); + } + if ("CacheMode".equals(node.getNodeName())) { + cacheMode = node.getTextContent(); + } + if ("HoldoutMaxPercent".equals(node.getNodeName())) { + holdoutMaxPercent = toInteger(node.getTextContent()); + } + if ("HoldoutMaxCases".equals(node.getNodeName())) { + holdoutMaxCases = toInteger(node.getTextContent()); + } + if ("HoldoutSeed".equals(node.getNodeName())) { + holdoutSeed = toInteger(node.getTextContent()); + } + if ("HoldoutActualSize".equals(node.getNodeName())) { + holdoutSeed = toInteger(node.getTextContent()); + } + if (COLUMNS.equals(node.getNodeName())) { + columns = getMiningStructureColumnList(node.getChildNodes()); + } + if (STATE.equals(node.getNodeName())) { + state = node.getTextContent(); + } + if ("MiningStructurePermissions".equals(node.getNodeName())) { + miningStructurePermissions = getMiningStructurePermissionList(node.getChildNodes()); + } + if ("MiningModels".equals(node.getNodeName())) { + miningModels = getMiningModelList(node.getChildNodes()); + } + } + } + return new MiningStructureR(name, Optional.ofNullable(id), Optional.ofNullable(createdTimestamp), + Optional.ofNullable(lastSchemaUpdate), Optional.ofNullable(description), + Optional.ofNullable(annotations), Optional.ofNullable(source), Optional.ofNullable(lastProcessed), + Optional.ofNullable(translations), Optional.ofNullable(language), Optional.ofNullable(collation), + Optional.ofNullable(errorConfiguration), Optional.ofNullable(cacheMode), + Optional.ofNullable(holdoutMaxPercent), Optional.ofNullable(holdoutMaxCases), + Optional.ofNullable(holdoutSeed), Optional.ofNullable(holdoutActualSize), columns, + Optional.ofNullable(state), Optional.ofNullable(miningStructurePermissions), + Optional.ofNullable(miningModels)); + } + + public static List getMiningModelList(NodeList nl) { + return getList(nl, "MiningModel", childNl -> getMiningModel(childNl)); + } + + private static List getMiningStructurePermissionList(NodeList nl) { + return getList(nl, "MiningStructurePermission", childNl -> getMiningStructurePermission(childNl)); + } + + private static MiningStructurePermission getMiningStructurePermission(NodeList nl) { + Boolean allowDrillThrough = null; + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ALLOW_DRILL_THROUGH.equals(node.getNodeName())) { + allowDrillThrough = toBoolean(node.getTextContent()); + } + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (ROLE_ID.equals(node.getNodeName())) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(node.getNodeName())) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(node.getNodeName())) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(node.getNodeName())) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(node.getNodeName())) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + } + } + return new MiningStructurePermissionR(Optional.ofNullable(allowDrillThrough), name, Optional.ofNullable(id), + Optional.ofNullable(createdTimestamp), Optional.ofNullable(lastSchemaUpdate), + Optional.ofNullable(description), Optional.ofNullable(annotations), roleID, + Optional.ofNullable(process), Optional.ofNullable(readDefinition), Optional.ofNullable(read), + Optional.ofNullable(write)); + } + + private static List getMiningStructureColumnList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("MiningStructurePermission".equals(node.getNodeName()))) { + list.add(getMiningStructureColumn(node.getChildNodes(), getNodeType(node))); + } + } + return list; + } + + private static MiningStructureColumn getMiningStructureColumn(NodeList nl, String type) { + if ("ScalarMiningStructureColumn".equals(type)) { + return getScalarMiningStructureColumn(nl); + } + if ("TableMiningStructureColumn".equals(type)) { + return getTableMiningStructureColumn(nl); + } + return null; + } + + private static MiningStructureColumn getTableMiningStructureColumn(NodeList nl) { + List foreignKeyColumns = null; + MeasureGroupBinding sourceMeasureGroup = null; + List columns = null; + List translations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("ForeignKeyColumns".equals(node.getNodeName())) { + foreignKeyColumns = CommonConverter.getDataItemList(node.getChildNodes(), "ForeignKeyColumn"); + } + if ("SourceMeasureGroup".equals(node.getNodeName())) { + sourceMeasureGroup = CubeConverter.getMeasureGroupBinding(node.getChildNodes()); + } + if (COLUMNS.equals(node.getNodeName())) { + columns = getMiningStructureColumnList(node.getChildNodes()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + } + } + return new TableMiningStructureColumnR(Optional.ofNullable(foreignKeyColumns), + Optional.ofNullable(sourceMeasureGroup), Optional.ofNullable(columns), + Optional.ofNullable(translations)); + } + + private static MiningStructureColumn getScalarMiningStructureColumn(NodeList nl) { + String name = null; + String id = null; + String description = null; + String type = null; + List annotations = null; + Boolean isKey = null; + Binding source = null; + String distribution = null; + List modelingFlags = null; + String content = null; + List classifiedColumns = null; + String discretizationMethod = null; + BigInteger discretizationBucketCount = null; + List keyColumns = null; + DataItem nameColumn = null; + List translations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("IsKey".equals(node.getNodeName())) { + isKey = toBoolean(node.getTextContent()); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getBinding(node.getChildNodes(), getNodeType(node)); + } + if ("Distribution".equals(node.getNodeName())) { + distribution = node.getTextContent(); + } + if ("ModelingFlags".equals(node.getNodeName())) { + modelingFlags = getMiningModelingFlagList(node.getChildNodes()); + } + if ("Content".equals(node.getNodeName())) { + content = node.getTextContent(); + } + if ("ClassifiedColumns".equals(node.getNodeName())) { + classifiedColumns = getClassifiedColumnList(node.getChildNodes()); + } + if ("DiscretizationMethod".equals(node.getNodeName())) { + discretizationMethod = node.getTextContent(); + } + if ("DiscretizationBucketCount".equals(node.getNodeName())) { + discretizationBucketCount = toBigInteger(node.getTextContent()); + } + if (KEY_COLUMNS.equals(node.getNodeName())) { + keyColumns = CommonConverter.getDataItemList(node.getChildNodes(), KEY_COLUMN); + } + if ("NameColumn".equals(node.getNodeName())) { + nameColumn = CommonConverter.getDataItem(node.getChildNodes()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + } + } + return new ScalarMiningStructureColumnR(name, Optional.ofNullable(id), Optional.ofNullable(description), + Optional.ofNullable(type), Optional.ofNullable(annotations), Optional.ofNullable(isKey), + Optional.ofNullable(source), Optional.ofNullable(distribution), Optional.ofNullable(modelingFlags), + content, Optional.ofNullable(classifiedColumns), Optional.ofNullable(discretizationMethod), + Optional.ofNullable(discretizationBucketCount), Optional.ofNullable(keyColumns), + Optional.ofNullable(nameColumn), Optional.ofNullable(translations)); + } + + private static List getClassifiedColumnList(NodeList nl) { + return getStringList(nl, "ClassifiedColumn"); + } + + public static MiningModel getMiningModel(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String algorithm = null; + Instant lastProcessed = null; + List algorithmParameters = null; + Boolean allowDrillThrough = null; + List translations = null; + List columns = null; + String state = null; + FoldingParameters foldingParameters = null; + String filter = null; + List miningModelPermissions = null; + String language = null; + String collation = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("Algorithm".equals(node.getNodeName())) { + algorithm = node.getTextContent(); + } + if (LAST_PROCESSED.equals(node.getNodeName())) { + lastProcessed = toInstant(node.getTextContent()); + } + if ("AlgorithmParameters".equals(node.getNodeName())) { + algorithmParameters = getAlgorithmParameterList(node.getChildNodes()); + } + if (ALLOW_DRILL_THROUGH.equals(node.getNodeName())) { + allowDrillThrough = toBoolean(node.getTextContent()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getAttributeTranslationList(node.getChildNodes()); + } + if (COLUMNS.equals(node.getNodeName())) { + columns = getMiningModelColumnList(node.getChildNodes()); + } + if (STATE.equals(node.getNodeName())) { + state = node.getTextContent(); + } + if ("FoldingParameters".equals(node.getNodeName())) { + foldingParameters = getFoldingParameters(node.getChildNodes()); + } + if (FILTER.equals(node.getNodeName())) { + filter = node.getTextContent(); + } + if ("MiningModelPermissions".equals(node.getNodeName())) { + miningModelPermissions = getMiningModelPermissionList(node.getChildNodes()); + } + if (LANGUAGE.equals(node.getNodeName())) { + language = node.getTextContent(); + } + if (COLLATION.equals(node.getNodeName())) { + collation = node.getTextContent(); + } + } + } + return new MiningModelR(name, Optional.ofNullable(id), Optional.ofNullable(createdTimestamp), + Optional.ofNullable(lastSchemaUpdate), Optional.ofNullable(description), + Optional.ofNullable(annotations), algorithm, Optional.ofNullable(lastProcessed), + Optional.ofNullable(algorithmParameters), Optional.ofNullable(allowDrillThrough), + Optional.ofNullable(translations), Optional.ofNullable(columns), Optional.ofNullable(state), + Optional.ofNullable(foldingParameters), Optional.ofNullable(filter), + Optional.ofNullable(miningModelPermissions), Optional.ofNullable(language), + Optional.ofNullable(collation)); + } + + private static List getMiningModelPermissionList(NodeList nl) { + return getList(nl, "MiningModelPermission", childNl -> getMiningModelPermission(childNl)); + } + + private static MiningModelPermission getMiningModelPermission(NodeList nl) { + Boolean allowDrillThrough = null; + Boolean allowBrowsing = null; + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ALLOW_DRILL_THROUGH.equals(node.getNodeName())) { + allowDrillThrough = toBoolean(node.getTextContent()); + } + if ("AllowBrowsing".equals(node.getNodeName())) { + allowBrowsing = toBoolean(node.getTextContent()); + } + if (ROLE_ID.equals(node.getNodeName())) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(node.getNodeName())) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(node.getNodeName())) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(node.getNodeName())) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(node.getNodeName())) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + } + } + return new MiningModelPermissionR(Optional.ofNullable(allowDrillThrough), Optional.ofNullable(allowBrowsing), + name, Optional.ofNullable(id), Optional.ofNullable(createdTimestamp), + Optional.ofNullable(lastSchemaUpdate), Optional.ofNullable(description), + Optional.ofNullable(annotations), roleID, Optional.ofNullable(process), + Optional.ofNullable(readDefinition), Optional.ofNullable(read), Optional.ofNullable(write)); + } + + private static FoldingParameters getFoldingParameters(NodeList nl) { + Integer foldIndex = null; + Integer foldCount = null; + Long foldMaxCases = null; + String foldTargetAttribute = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("FoldIndex".equals(node.getNodeName())) { + foldIndex = toInteger(node.getTextContent()); + } + if ("FoldCount".equals(node.getNodeName())) { + foldCount = toInteger(node.getTextContent()); + } + if ("FoldMaxCases".equals(node.getNodeName())) { + foldMaxCases = toLong(node.getTextContent()); + } + if ("FoldTargetAttribute".equals(node.getNodeName())) { + foldTargetAttribute = node.getTextContent(); + } + } + } + return new FoldingParametersR(foldIndex, foldCount, Optional.ofNullable(foldMaxCases), + Optional.ofNullable(foldTargetAttribute)); + } + + private static List getMiningModelColumnList(NodeList nl) { + return getList(nl, "MiningModelColumn", childNl -> getMiningModelColumn(childNl)); + } + + private static MiningModelColumn getMiningModelColumn(NodeList nl) { + String name = null; + String id = null; + String description = null; + String sourceColumnID = null; + String usage = null; + String filter = null; + List translations = null; + List columns = null; + List modelingFlags = null; + List annotations = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if ("SourceColumnID".equals(node.getNodeName())) { + sourceColumnID = node.getTextContent(); + } + if ("Usage".equals(node.getNodeName())) { + usage = node.getTextContent(); + } + if (FILTER.equals(node.getNodeName())) { + filter = node.getTextContent(); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if (COLUMNS.equals(node.getNodeName())) { + columns = getMiningModelColumnList(node.getChildNodes()); + } + if ("ModelingFlags".equals(node.getNodeName())) { + modelingFlags = getMiningModelingFlagList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + + return new MiningModelColumnR(name, Optional.ofNullable(id), Optional.ofNullable(description), + Optional.ofNullable(sourceColumnID), Optional.ofNullable(usage), Optional.ofNullable(filter), + Optional.ofNullable(translations), Optional.ofNullable(columns), Optional.ofNullable(modelingFlags), + Optional.ofNullable(annotations)); + } + + private static List getMiningModelingFlagList(NodeList nl) { + return getList(nl, "ModelingFlag", MiningConverter::getMiningModelingFlag); + } + + private static MiningModelingFlag getMiningModelingFlag(NodeList nl) { + String modelingFlag = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("ModelingFlag".equals(node.getNodeName()))) { + modelingFlag = node.getTextContent(); + break; + } + } + return new MiningModelingFlagR(Optional.ofNullable(modelingFlag)); + } + + private static List getAlgorithmParameterList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("AlgorithmParameter".equals(node.getNodeName()))) { + list.add(getAlgorithmParameter(node.getChildNodes())); + } + } + return list; + } + + private static AlgorithmParameter getAlgorithmParameter(NodeList nl) { + String name = null; + java.lang.Object value = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (VALUE.equals(node.getNodeName())) { + value = node.getTextContent(); + } + } + } + return new AlgorithmParameterR(name, value); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PartitionConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PartitionConverter.java new file mode 100644 index 0000000..e37e978 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PartitionConverter.java @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.AGGREGATION_DESIGN_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.AGGREGATION_PREFIX; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ERROR_CONFIGURATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ESTIMATED_ROWS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ESTIMATED_SIZE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMN; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.KEY_COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_PROCESSED; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROACTIVE_CACHING; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_MODE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESSING_PRIORITY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.SOURCE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STORAGE_LOCATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.STORAGE_MODE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUENS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getAttribute; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getNodeType; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.math.BigInteger; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.AggregationInstance; +import org.eclipse.daanse.xmla.api.xmla.AggregationInstanceAttribute; +import org.eclipse.daanse.xmla.api.xmla.AggregationInstanceDimension; +import org.eclipse.daanse.xmla.api.xmla.AggregationInstanceMeasure; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.ColumnBinding; +import org.eclipse.daanse.xmla.api.xmla.DataItem; +import org.eclipse.daanse.xmla.api.xmla.DataSourceViewBinding; +import org.eclipse.daanse.xmla.api.xmla.ErrorConfiguration; +import org.eclipse.daanse.xmla.api.xmla.Partition; +import org.eclipse.daanse.xmla.api.xmla.PartitionCurrentStorageModeEnumType; +import org.eclipse.daanse.xmla.api.xmla.PartitionStorageModeEnumType; +import org.eclipse.daanse.xmla.api.xmla.ProactiveCaching; +import org.eclipse.daanse.xmla.api.xmla.TabularBinding; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationInstanceAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationInstanceDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationInstanceMeasureR; +import org.eclipse.daanse.xmla.model.record.xmla.AggregationInstanceR; +import org.eclipse.daanse.xmla.model.record.xmla.PartitionR; +import org.w3c.dom.NodeList; + +/** + * Converter for Partition types from XML NodeList. + */ +public class PartitionConverter { + + private PartitionConverter() { + // utility class + } + + public static List getPartitionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Partition".equals(node.getNodeName()))) { + list.add(getPartition(node.getChildNodes())); + } + } + return list; + } + + public static Partition getPartition(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + TabularBinding source = null; + BigInteger processingPriority = null; + String aggregationPrefix = null; + Partition.StorageMode storageMode = null; + String processingMode = null; + ErrorConfiguration errorConfiguration = null; + String storageLocation = null; + String remoteDatasourceID = null; + String slice = null; + ProactiveCaching proactiveCaching = null; + String type = null; + Long estimatedSize = null; + Long estimatedRows = null; + Partition.CurrentStorageMode currentStorageMode = null; + String aggregationDesignID = null; + List aggregationInstances = null; + DataSourceViewBinding aggregationInstanceSource = null; + Instant lastProcessed = null; + String state = null; + Integer stringStoresCompatibilityLevel = null; + Integer currentStringStoresCompatibilityLevel = null; + String directQueryUsage = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getTabularBinding(node.getChildNodes(), getNodeType(node)); + } + if (PROCESSING_PRIORITY.equals(node.getNodeName())) { + processingPriority = toBigInteger(node.getTextContent()); + } + if (AGGREGATION_PREFIX.equals(node.getNodeName())) { + aggregationPrefix = node.getTextContent(); + } + if (STORAGE_MODE.equals(node.getNodeName())) { + storageMode = getPartitionStorageMode(node.getChildNodes()); + } + if (PROCESSING_MODE.equals(node.getNodeName())) { + processingMode = node.getTextContent(); + } + if (ERROR_CONFIGURATION.equals(node.getNodeName())) { + errorConfiguration = CommonConverter.getErrorConfiguration(node.getChildNodes()); + } + if (STORAGE_LOCATION.equals(node.getNodeName())) { + storageLocation = node.getTextContent(); + } + if ("RemoteDatasourceID".equals(node.getNodeName())) { + remoteDatasourceID = node.getTextContent(); + } + if ("Slice".equals(node.getNodeName())) { + slice = node.getTextContent(); + } + if (PROACTIVE_CACHING.equals(node.getNodeName())) { + proactiveCaching = CommonConverter.getProactiveCaching(node.getChildNodes()); + } + if ("Type".equals(node.getNodeName())) { + type = node.getTextContent(); + } + if (ESTIMATED_SIZE.equals(node.getNodeName())) { + estimatedSize = toLong(node.getTextContent()); + } + if (ESTIMATED_ROWS.equals(node.getNodeName())) { + estimatedRows = toLong(node.getTextContent()); + } + if ("CurrentStorageMode".equals(node.getNodeName())) { + currentStorageMode = getPartitionCurrentStorageMode(node.getChildNodes()); + } + if (AGGREGATION_DESIGN_ID.equals(node.getNodeName())) { + aggregationDesignID = node.getTextContent(); + } + if ("AggregationInstances".equals(node.getNodeName())) { + aggregationInstances = getAggregationInstanceList(node.getChildNodes()); + } + if ("AggregationInstanceSource".equals(node.getNodeName())) { + aggregationInstanceSource = DataSourceConverter.getDataSourceViewBinding(node.getChildNodes()); + } + if (LAST_PROCESSED.equals(node.getNodeName())) { + lastProcessed = toInstant(node.getTextContent()); + } + if (STATE.equals(node.getNodeName())) { + state = node.getTextContent(); + } + if ("StringStoresCompatibilityLevel".equals(node.getNodeName())) { + stringStoresCompatibilityLevel = toInteger(node.getTextContent()); + } + if ("CurrentStringStoresCompatibilityLevel".equals(node.getNodeName())) { + currentStringStoresCompatibilityLevel = toInteger(node.getTextContent()); + } + if ("DirectQueryUsage".equals(node.getNodeName())) { + directQueryUsage = node.getTextContent(); + } + } + } + + return new PartitionR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, source, + processingPriority, aggregationPrefix, storageMode, processingMode, errorConfiguration, storageLocation, + remoteDatasourceID, slice, proactiveCaching, type, estimatedSize, estimatedRows, currentStorageMode, + aggregationDesignID, aggregationInstances, aggregationInstanceSource, lastProcessed, state, + stringStoresCompatibilityLevel, currentStringStoresCompatibilityLevel, directQueryUsage); + } + + public static Partition.StorageMode getPartitionStorageMode(NodeList nl) { + PartitionStorageModeEnumType value = null; + String valuens = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + value = PartitionStorageModeEnumType.fromValue(node.getTextContent()); + valuens = getAttribute(node.getAttributes(), VALUENS); + } + } + return new PartitionR.StorageMode(value, valuens); + } + + public static Partition.CurrentStorageMode getPartitionCurrentStorageMode(NodeList nl) { + PartitionCurrentStorageModeEnumType value = null; + String valuens = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + value = PartitionCurrentStorageModeEnumType.fromValue(node.getTextContent()); + valuens = getAttribute(node.getAttributes(), VALUENS); + } + } + return new PartitionR.CurrentStorageMode(value, valuens); + } + + static List getAggregationInstanceList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("AggregationInstance".equals(node.getNodeName()))) { + list.add(getAggregationInstance(node.getChildNodes())); + } + } + return list; + } + + private static AggregationInstance getAggregationInstance(NodeList nl) { + String id = null; + String name = null; + String aggregationType = null; + TabularBinding source = null; + List dimensions = null; + List measures = null; + List annotations = null; + String description = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("AggregationType".equals(node.getNodeName())) { + aggregationType = node.getTextContent(); + } + if (SOURCE.equals(node.getNodeName())) { + source = BindingConverter.getTabularBinding(node.getChildNodes(), getNodeType(node)); + } + if (DIMENSIONS.equals(node.getNodeName())) { + dimensions = getAggregationInstanceDimensionList(node.getChildNodes()); + } + if (MEASURES.equals(node.getNodeName())) { + measures = getAggregationInstanceMeasureList(node.getChildNodes()); + } + } + } + return new AggregationInstanceR(id, name, aggregationType, source, dimensions, measures, annotations, + description); + } + + private static List getAggregationInstanceMeasureList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (MEASURE.equals(node.getNodeName()))) { + list.add(getAggregationInstanceMeasure(node.getChildNodes())); + } + } + return list; + } + + private static AggregationInstanceMeasure getAggregationInstanceMeasure(NodeList nl) { + String measureID = null; + ColumnBinding source = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (MEASURE_ID.equals(node.getNodeName())) { + measureID = node.getTextContent(); + } + if (SOURCE.equals(node.getNodeName())) { + source = (ColumnBinding) BindingConverter.getColumnBinding(node.getChildNodes()); + } + } + } + return new AggregationInstanceMeasureR(measureID, source); + } + + private static List getAggregationInstanceDimensionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (DIMENSION.equals(node.getNodeName()))) { + list.add(getAggregationInstanceDimension(node.getChildNodes())); + } + } + return list; + } + + private static AggregationInstanceDimension getAggregationInstanceDimension(NodeList nl) { + String cubeDimensionID = null; + List attributes = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { + cubeDimensionID = node.getTextContent(); + } + if (ATTRIBUTES.equals(node.getNodeName())) { + attributes = getAggregationInstanceAttributeList(node.getChildNodes()); + } + } + } + return new AggregationInstanceDimensionR(cubeDimensionID, Optional.ofNullable(attributes)); + } + + private static List getAggregationInstanceAttributeList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ATTRIBUTE.equals(node.getNodeName()))) { + list.add(getAggregationInstanceAttribute(node.getChildNodes())); + } + } + return list; + } + + private static AggregationInstanceAttribute getAggregationInstanceAttribute(NodeList nl) { + String attributeID = null; + List keyColumns = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if (KEY_COLUMNS.equals(node.getNodeName())) { + keyColumns = CommonConverter.getDataItemList(node.getChildNodes(), KEY_COLUMN); + } + } + } + return new AggregationInstanceAttributeR(attributeID, Optional.ofNullable(keyColumns)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PermissionConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PermissionConverter.java new file mode 100644 index 0000000..5c2f28e --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PermissionConverter.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.PROCESS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.READ_DEFINITION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.WRITE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.DataSourcePermission; +import org.eclipse.daanse.xmla.api.xmla.DatabasePermission; +import org.eclipse.daanse.xmla.api.xmla.Permission; +import org.eclipse.daanse.xmla.api.xmla.ReadDefinitionEnum; +import org.eclipse.daanse.xmla.api.xmla.ReadWritePermissionEnum; +import org.eclipse.daanse.xmla.model.record.xmla.DataSourcePermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.DatabasePermissionR; +import org.eclipse.daanse.xmla.model.record.xmla.PermissionR; +import org.w3c.dom.NodeList; + +/** + * Converter for Permission and related types from XML NodeList. + */ +public class PermissionConverter { + + private PermissionConverter() { + // utility class + } + + public static Permission getPermission(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ROLE_ID.equals(node.getNodeName())) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(node.getNodeName())) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(node.getNodeName())) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(node.getNodeName())) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(node.getNodeName())) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + } + } + return new PermissionR(name, Optional.ofNullable(id), Optional.ofNullable(createdTimestamp), + Optional.ofNullable(lastSchemaUpdate), Optional.ofNullable(description), + Optional.ofNullable(annotations), roleID, Optional.ofNullable(process), + Optional.ofNullable(readDefinition), Optional.ofNullable(read), Optional.ofNullable(write)); + } + + public static List getDataSourcePermissionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("DataSourcePermission".equals(node.getNodeName()))) { + list.add(getDataSourcePermission(node.getChildNodes())); + } + } + return list; + } + + public static DataSourcePermission getDataSourcePermission(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (ROLE_ID.equals(node.getNodeName())) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(node.getNodeName())) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(node.getNodeName())) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(node.getNodeName())) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(node.getNodeName())) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + } + } + return new DataSourcePermissionR(name, Optional.ofNullable(id), Optional.ofNullable(createdTimestamp), + Optional.ofNullable(lastSchemaUpdate), Optional.ofNullable(description), + Optional.ofNullable(annotations), roleID, Optional.ofNullable(process), + Optional.ofNullable(readDefinition), Optional.ofNullable(read), Optional.ofNullable(write)); + } + + public static List getDatabasePermissionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("DatabasePermission".equals(node.getNodeName()))) { + list.add(getDatabasePermission(node.getChildNodes())); + } + } + return list; + } + + public static DatabasePermission getDatabasePermission(NodeList nl) { + Boolean administer = null; + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String roleID = null; + Boolean process = null; + ReadDefinitionEnum readDefinition = null; + ReadWritePermissionEnum read = null; + ReadWritePermissionEnum write = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (ROLE_ID.equals(node.getNodeName())) { + roleID = node.getTextContent(); + } + if (PROCESS.equals(node.getNodeName())) { + process = toBoolean(node.getTextContent()); + } + if (READ_DEFINITION.equals(node.getNodeName())) { + readDefinition = ReadDefinitionEnum.fromValue(node.getTextContent()); + } + if ("Read".equals(node.getNodeName())) { + read = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if (WRITE.equals(node.getNodeName())) { + write = ReadWritePermissionEnum.fromValue(node.getTextContent()); + } + if ("Administer".equals(node.getNodeName())) { + administer = toBoolean(node.getTextContent()); + } + } + } + return new DatabasePermissionR(Optional.ofNullable(administer), name, Optional.ofNullable(id), + Optional.ofNullable(createdTimestamp), Optional.ofNullable(lastSchemaUpdate), + Optional.ofNullable(description), Optional.ofNullable(annotations), roleID, + Optional.ofNullable(process), Optional.ofNullable(readDefinition), Optional.ofNullable(read), + Optional.ofNullable(write)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PerspectiveConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PerspectiveConverter.java new file mode 100644 index 0000000..5d35bd6 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/PerspectiveConverter.java @@ -0,0 +1,403 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ACTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_HIERARCHY_VISIBLE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ATTRIBUTE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CUBE_DIMENSION_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DEFAULT_MEMBER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DIMENSIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.HIERARCHIES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.HIERARCHY; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURES; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_GROUP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_GROUP_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.MEASURE_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.TRANSLATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.Perspective; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveAction; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveAttribute; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveCalculation; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveDimension; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveHierarchy; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveKpi; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveMeasure; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveMeasureGroup; +import org.eclipse.daanse.xmla.api.xmla.Translation; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveActionR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveAttributeR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveCalculationR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveDimensionR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveHierarchyR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveKpiR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveMeasureGroupR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveMeasureR; +import org.eclipse.daanse.xmla.model.record.xmla.PerspectiveR; +import org.w3c.dom.NodeList; + +/** + * Converter for Perspective and related types from XML NodeList. + */ +public class PerspectiveConverter { + + private PerspectiveConverter() { + // utility class + } + + public static List getPerspectiveList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Perspective".equals(node.getNodeName()))) { + list.add(getPerspective(node.getChildNodes())); + } + } + return list; + } + + public static Perspective getPerspective(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + List translations = null; + String defaultMeasure = null; + List dimensions = null; + List measureGroups = null; + List calculations = null; + List kpis = null; + List actions = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if (TRANSLATIONS.equals(node.getNodeName())) { + translations = CommonConverter.getTranslationList(node.getChildNodes(), TRANSLATION); + } + if ("DefaultMeasure".equals(node.getNodeName())) { + defaultMeasure = node.getTextContent(); + } + if (DIMENSIONS.equals(node.getNodeName())) { + dimensions = getPerspectiveDimensionList(node.getChildNodes()); + } + if ("MeasureGroups".equals(node.getNodeName())) { + measureGroups = getPerspectiveMeasureGroupList(node.getChildNodes()); + } + if ("Calculations".equals(node.getNodeName())) { + calculations = getPerspectiveCalculationList(node.getChildNodes()); + } + if ("Kpis".equals(node.getNodeName())) { + kpis = getPerspectiveKpiList(node.getChildNodes()); + } + if ("Actions".equals(node.getNodeName())) { + actions = getPerspectiveActionList(node.getChildNodes()); + } + } + } + return new PerspectiveR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, translations, + defaultMeasure, dimensions, measureGroups, calculations, kpis, actions); + } + + public static List getPerspectiveActionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ACTION.equals(node.getNodeName()))) { + list.add(getPerspectiveAction(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveAction getPerspectiveAction(NodeList nl) { + String actionID = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("ActionID".equals(node.getNodeName())) { + actionID = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveActionR(actionID, Optional.ofNullable(annotations)); + } + + public static List getPerspectiveKpiList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Kpi".equals(node.getNodeName()))) { + list.add(getPerspectiveKpi(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveKpi getPerspectiveKpi(NodeList nl) { + String kpiID = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("KpiID".equals(node.getNodeName())) { + kpiID = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveKpiR(kpiID, Optional.ofNullable(annotations)); + } + + public static List getPerspectiveCalculationList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Calculation".equals(node.getNodeName()))) { + list.add(getPerspectiveCalculation(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveCalculation getPerspectiveCalculation(NodeList nl) { + String name = null; + String type = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if ("Type".equals(node.getNodeName())) { + type = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveCalculationR(name, type, Optional.ofNullable(annotations)); + } + + public static List getPerspectiveMeasureGroupList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (MEASURE_GROUP.equals(node.getNodeName()))) { + list.add(getPerspectiveMeasureGroup(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveMeasureGroup getPerspectiveMeasureGroup(NodeList nl) { + String measureGroupID = null; + List measures = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (MEASURE_GROUP_ID.equals(node.getNodeName())) { + measureGroupID = node.getTextContent(); + } + if (MEASURES.equals(node.getNodeName())) { + measures = getPerspectiveMeasureList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveMeasureGroupR(measureGroupID, Optional.ofNullable(measures), + Optional.ofNullable(annotations)); + } + + public static List getPerspectiveMeasureList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (MEASURE.equals(node.getNodeName()))) { + list.add(getPerspectiveMeasure(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveMeasure getPerspectiveMeasure(NodeList nl) { + String measureID = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (MEASURE_ID.equals(node.getNodeName())) { + measureID = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveMeasureR(measureID, annotations); + } + + public static List getPerspectiveDimensionList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (DIMENSION.equals(node.getNodeName()))) { + list.add(getPerspectiveDimension(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveDimension getPerspectiveDimension(NodeList nl) { + String cubeDimensionID = null; + List attributes = null; + List hierarchies = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (CUBE_DIMENSION_ID.equals(node.getNodeName())) { + cubeDimensionID = node.getTextContent(); + } + if (ATTRIBUTES.equals(node.getNodeName())) { + attributes = getPerspectiveAttributeList(node.getChildNodes()); + } + if (HIERARCHIES.equals(node.getNodeName())) { + hierarchies = getPerspectiveHierarchyList(node.getChildNodes()); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveDimensionR(cubeDimensionID, Optional.ofNullable(attributes), + Optional.ofNullable(hierarchies), Optional.ofNullable(annotations)); + } + + public static List getPerspectiveHierarchyList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (HIERARCHY.equals(node.getNodeName()))) { + list.add(getPerspectiveHierarchy(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveHierarchy getPerspectiveHierarchy(NodeList nl) { + String hierarchyID = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("HierarchyID".equals(node.getNodeName())) { + hierarchyID = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveHierarchyR(hierarchyID, Optional.ofNullable(annotations)); + } + + public static List getPerspectiveAttributeList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (ATTRIBUTE.equals(node.getNodeName()))) { + list.add(getPerspectiveAttribute(node.getChildNodes())); + } + } + return list; + } + + public static PerspectiveAttribute getPerspectiveAttribute(NodeList nl) { + String attributeID = null; + Boolean attributeHierarchyVisible = null; + String defaultMember = null; + List annotations = null; + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (ATTRIBUTE_ID.equals(node.getNodeName())) { + attributeID = node.getTextContent(); + } + if (ATTRIBUTE_HIERARCHY_VISIBLE.equals(node.getNodeName())) { + attributeHierarchyVisible = toBoolean(node.getTextContent()); + } + if (DEFAULT_MEMBER.equals(node.getNodeName())) { + defaultMember = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + } + } + return new PerspectiveAttributeR(attributeID, Optional.ofNullable(attributeHierarchyVisible), + Optional.ofNullable(defaultMember), Optional.ofNullable(annotations)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/RoleConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/RoleConverter.java new file mode 100644 index 0000000..dd0f92f --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/RoleConverter.java @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.Member; +import org.eclipse.daanse.xmla.api.xmla.Role; +import org.eclipse.daanse.xmla.model.record.xmla.MemberR; +import org.eclipse.daanse.xmla.model.record.xmla.RoleR; +import org.w3c.dom.NodeList; + +/** + * Converter for Role and Member types from XML NodeList. + */ +public class RoleConverter { + + private RoleConverter() { + // utility class + } + + public static List getRoleList(NodeList nl, String elementName) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (elementName.equals(node.getNodeName()))) { + list.add(getRole(node.getChildNodes())); + } + } + return list; + } + + public static Role getRole(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + List members = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("Members".equals(node.getNodeName())) { + members = getMemberList(node.getChildNodes()); + } + } + } + return new RoleR(name, Optional.ofNullable(id), Optional.ofNullable(createdTimestamp), + Optional.ofNullable(lastSchemaUpdate), Optional.ofNullable(description), + Optional.ofNullable(annotations), Optional.ofNullable(members)); + } + + public static List getMemberList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("Member".equals(node.getNodeName()))) { + list.add(getMember(node.getChildNodes())); + } + } + return list; + } + + public static Member getMember(NodeList nl) { + String name = null; + String sid = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if ("Sid".equals(node.getNodeName())) { + sid = node.getTextContent(); + } + } + } + return new MemberR(Optional.ofNullable(name), Optional.ofNullable(sid)); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/ServerConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/ServerConverter.java new file mode 100644 index 0000000..cb18682 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/ServerConverter.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ANNOTATIONS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.CREATED_TIMESTAMP; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.DESCRIPTION; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LAST_SCHEMA_UPDATE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NAME; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.ROLE2; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; + +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.Assembly; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.Database; +import org.eclipse.daanse.xmla.api.xmla.Role; +import org.eclipse.daanse.xmla.api.xmla.Server; +import org.eclipse.daanse.xmla.api.xmla.ServerProperty; +import org.eclipse.daanse.xmla.api.xmla.Trace; +import org.eclipse.daanse.xmla.model.record.xmla.ServerPropertyR; +import org.eclipse.daanse.xmla.model.record.xmla.ServerR; +import org.w3c.dom.NodeList; + +/** + * Converter for Server and ServerProperty types from XML NodeList. + */ +public class ServerConverter { + + private ServerConverter() { + // utility class + } + + public static Server getServer(NodeList nl, Function commandParser, + Function> assemblySupplier) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String productName = null; + String edition = null; + Long editionID = null; + String version = null; + String serverMode = null; + String productLevel = null; + Long defaultCompatibilityLevel = null; + String supportedCompatibilityLevels = null; + List databases = null; + List assemblies = null; + List traces = null; + List roles = null; + List serverProperties = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (ID.equals(node.getNodeName())) { + id = node.getTextContent(); + } + if (CREATED_TIMESTAMP.equals(node.getNodeName())) { + createdTimestamp = toInstant(node.getTextContent()); + } + if (LAST_SCHEMA_UPDATE.equals(node.getNodeName())) { + lastSchemaUpdate = toInstant(node.getTextContent()); + } + if (DESCRIPTION.equals(node.getNodeName())) { + description = node.getTextContent(); + } + if (ANNOTATIONS.equals(node.getNodeName())) { + annotations = CommonConverter.getAnnotationList(node.getChildNodes()); + } + if ("ProductName".equals(node.getNodeName())) { + productName = node.getTextContent(); + } + if ("Edition".equals(node.getNodeName())) { + edition = node.getTextContent(); + } + if ("EditionID".equals(node.getNodeName())) { + editionID = toLong(node.getTextContent()); + } + if ("Version".equals(node.getNodeName())) { + version = node.getTextContent(); + } + if ("ServerMode".equals(node.getNodeName())) { + serverMode = node.getTextContent(); + } + if ("ProductLevel".equals(node.getNodeName())) { + productLevel = node.getTextContent(); + } + if ("DefaultCompatibilityLevel".equals(node.getNodeName())) { + defaultCompatibilityLevel = toLong(node.getTextContent()); + } + if ("SupportedCompatibilityLevels".equals(node.getNodeName())) { + supportedCompatibilityLevels = node.getTextContent(); + } + if ("Databases".equals(node.getNodeName())) { + databases = DatabaseConverter.getDatabaseList(node.getChildNodes(), commandParser, + assemblySupplier); + } + if ("Assemblies".equals(node.getNodeName())) { + assemblies = assemblySupplier.apply(node.getChildNodes()); + } + if ("Traces".equals(node.getNodeName())) { + traces = TraceEventConverter.getTraceList(node.getChildNodes()); + } + if ("Roles".equals(node.getNodeName())) { + roles = RoleConverter.getRoleList(node.getChildNodes(), ROLE2); + } + if ("ServerProperties".equals(node.getNodeName())) { + serverProperties = getServerPropertyList(node.getChildNodes()); + } + } + } + return new ServerR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, productName, edition, + editionID, version, serverMode, productLevel, defaultCompatibilityLevel, supportedCompatibilityLevels, + databases, assemblies, traces, roles, serverProperties); + } + + public static List getServerPropertyList(NodeList nl) { + List list = new ArrayList<>(); + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("ServerProperty".equals(node.getNodeName()))) { + list.add(getServerProperty(node.getChildNodes())); + } + } + return list; + } + + public static ServerProperty getServerProperty(NodeList nl) { + String name = null; + String value = null; + Boolean requiresRestart = null; + java.lang.Object pendingValue = null; + java.lang.Object defaultValue = null; + Boolean displayFlag = null; + String type = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (NAME.equals(node.getNodeName())) { + name = node.getTextContent(); + } + if (VALUE.equals(node.getNodeName())) { + value = node.getTextContent(); + } + if ("RequiresRestart".equals(node.getNodeName())) { + requiresRestart = toBoolean(node.getTextContent()); + } + if ("PendingValue".equals(node.getNodeName())) { + pendingValue = node.getTextContent(); + } + if ("DefaultValue".equals(node.getNodeName())) { + defaultValue = node.getTextContent(); + } + if ("DisplayFlag".equals(node.getNodeName())) { + displayFlag = toBoolean(node.getTextContent()); + } + if ("Type".equals(node.getNodeName())) { + type = node.getTextContent(); + } + } + } + return new ServerPropertyR(name, value, requiresRestart, pendingValue, defaultValue, displayFlag, type); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/TraceEventConverter.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/TraceEventConverter.java new file mode 100644 index 0000000..b234454 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/TraceEventConverter.java @@ -0,0 +1,412 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.COLUMNS; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.EQUAL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.EVENT_ID; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.FILTER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.GREATER; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.GREATER_OR_EQUAL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.LESS_OR_EQUAL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NOT_EQUAL; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.NOT_LIKE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants.VALUE; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getAttribute; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.getList; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBigInteger; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toBoolean; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInstant; +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toLong; + +import java.math.BigInteger; +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.daanse.xmla.api.engine300_300.XEvent; +import org.eclipse.daanse.xmla.api.xmla.AndOrType; +import org.eclipse.daanse.xmla.api.xmla.AndOrTypeEnum; +import org.eclipse.daanse.xmla.api.xmla.Annotation; +import org.eclipse.daanse.xmla.api.xmla.BoolBinop; +import org.eclipse.daanse.xmla.api.xmla.Event; +import org.eclipse.daanse.xmla.api.xmla.EventColumnID; +import org.eclipse.daanse.xmla.api.xmla.EventSession; +import org.eclipse.daanse.xmla.api.xmla.EventType; +import org.eclipse.daanse.xmla.api.xmla.NotType; +import org.eclipse.daanse.xmla.api.xmla.PartitionModes; +import org.eclipse.daanse.xmla.api.xmla.RetentionModes; +import org.eclipse.daanse.xmla.api.xmla.Trace; +import org.eclipse.daanse.xmla.api.xmla.TraceFilter; +import org.eclipse.daanse.xmla.model.record.engine300_300.XEventR; +import org.eclipse.daanse.xmla.model.record.xmla.AndOrTypeR; +import org.eclipse.daanse.xmla.model.record.xmla.BoolBinopR; +import org.eclipse.daanse.xmla.model.record.xmla.EventColumnIDR; +import org.eclipse.daanse.xmla.model.record.xmla.EventR; +import org.eclipse.daanse.xmla.model.record.xmla.EventSessionR; +import org.eclipse.daanse.xmla.model.record.xmla.EventTypeR; +import org.eclipse.daanse.xmla.model.record.xmla.NotTypeR; +import org.eclipse.daanse.xmla.model.record.xmla.TraceFilterR; +import org.eclipse.daanse.xmla.model.record.xmla.TraceR; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +/** + * Converter for Trace and Event-related XMLA types. Handles Trace, TraceFilter, + * Event, EventType, XEvent, and related filter types. + */ +public class TraceEventConverter { + + private TraceEventConverter() { + // utility class + } + + public static List getTraceList(NodeList nl) { + return getList(nl, "Trace", TraceEventConverter::getTrace); + } + + public static Trace getTrace(NodeList nl) { + String name = null; + String id = null; + Instant createdTimestamp = null; + Instant lastSchemaUpdate = null; + String description = null; + List annotations = null; + String logFileName = null; + Boolean logFileAppend = null; + Long logFileSize = null; + Boolean audit = null; + Boolean logFileRollover = null; + Boolean autoRestart = null; + Instant stopTime = null; + TraceFilter filter = null; + EventType eventType = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("LogFileName".equals(node.getNodeName())) { + logFileName = node.getTextContent(); + } + if ("LogFileAppend".equals(node.getNodeName())) { + logFileAppend = toBoolean(node.getTextContent()); + } + if ("LogFileSize".equals(node.getNodeName())) { + logFileSize = toLong(node.getTextContent()); + } + if ("Audit".equals(node.getNodeName())) { + audit = toBoolean(node.getTextContent()); + } + if ("LogFileRollover".equals(node.getNodeName())) { + logFileRollover = toBoolean(node.getTextContent()); + } + if ("AutoRestart".equals(node.getNodeName())) { + autoRestart = toBoolean(node.getTextContent()); + } + if ("StopTime".equals(node.getNodeName())) { + stopTime = toInstant(node.getTextContent()); + } + if (FILTER.equals(node.getNodeName())) { + filter = getTraceFilter(node.getChildNodes()); + } + if ("EventType".equals(node.getNodeName())) { + eventType = getEventType(node.getChildNodes()); + } + } + } + return new TraceR(name, id, createdTimestamp, lastSchemaUpdate, description, annotations, logFileName, + logFileAppend, logFileSize, audit, logFileRollover, autoRestart, stopTime, filter, eventType); + } + + public static EventType getEventType(NodeList nl) { + List events = null; + XEvent xEvent = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("Events".equals(node.getNodeName())) { + events = getEventList(node.getChildNodes()); + } + if ("XEvent".equals(node.getNodeName())) { + xEvent = getXEvent(node.getChildNodes()); + } + } + } + return new EventTypeR(events, xEvent); + } + + public static XEvent getXEvent(NodeList nl) { + EventSession eventSession = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && ("event_session".equals(node.getNodeName()))) { + eventSession = getEventSession(node.getChildNodes()); + } + } + return new XEventR(eventSession); + } + + public static EventSession getEventSession(NodeList nl) { + String templateCategory = null; + String templateName = null; + String templateDescription = null; + List event = new ArrayList<>(); + List target = new ArrayList<>(); + String name = null; + BigInteger maxMemory = null; + RetentionModes eventRetentionMode = null; + Long dispatchLatency = null; + Long maxEventSize = null; + PartitionModes memoryPartitionMode = null; + Boolean trackCausality = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("templateCategory".equals(node.getNodeName())) { + templateCategory = node.getTextContent(); + } + if ("templateName".equals(node.getNodeName())) { + templateName = node.getTextContent(); + } + if ("templateDescription".equals(node.getNodeName())) { + templateDescription = node.getTextContent(); + } + if ("event".equals(node.getNodeName())) { + event.add(node.getTextContent()); + } + if ("target".equals(node.getNodeName())) { + target.add(node.getTextContent()); + } + NamedNodeMap nm = node.getAttributes(); + name = getAttribute(nm, "name"); + maxMemory = toBigInteger(getAttribute(nm, "maxMemory")); + eventRetentionMode = RetentionModes.fromValue(getAttribute(nm, "eventRetentionMode")); + dispatchLatency = toLong(getAttribute(nm, "dispatchLatency")); + maxEventSize = toLong(getAttribute(nm, "maxEventSize")); + memoryPartitionMode = PartitionModes.fromValue(getAttribute(nm, "memoryPartitionMode")); + trackCausality = toBoolean(getAttribute(nm, "trackCausality")); + } + } + return new EventSessionR(templateCategory, templateName, templateDescription, event, target, name, maxMemory, + eventRetentionMode, dispatchLatency, maxEventSize, memoryPartitionMode, trackCausality); + } + + public static List getEventList(NodeList nl) { + return getList(nl, "Event", TraceEventConverter::getEvent); + } + + public static Event getEvent(NodeList nl) { + String eventID = null; + EventColumnID columns = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if (EVENT_ID.equals(node.getNodeName())) { + eventID = node.getTextContent(); + } + if (COLUMNS.equals(node.getNodeName())) { + columns = getEventColumnID(node.getChildNodes()); + } + } + } + return new EventR(eventID, columns); + } + + public static EventColumnID getEventColumnID(NodeList nl) { + List columnID = new ArrayList<>(); + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if ((node != null) && (EVENT_ID.equals(node.getNodeName()))) { + columnID.add(node.getTextContent()); + } + } + return new EventColumnIDR(columnID); + } + + public static TraceFilter getTraceFilter(NodeList nl) { + NotType not = null; + AndOrType or = null; + AndOrType and = null; + BoolBinop isEqual = null; + BoolBinop notEqual = null; + BoolBinop less = null; + BoolBinop lessOrEqual = null; + BoolBinop greater = null; + BoolBinop greaterOrEqual = null; + BoolBinop like = null; + BoolBinop notLike = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("Not".equals(node.getNodeName())) { + not = getNotType(node.getChildNodes()); + } + if ("Or".equals(node.getNodeName())) { + or = getAndOrType(node.getChildNodes()); + } + if ("And".equals(node.getNodeName())) { + and = getAndOrType(node.getChildNodes()); + } + if (EQUAL.equals(node.getNodeName())) { + isEqual = getBoolBinop(node.getChildNodes()); + } + if (NOT_EQUAL.equals(node.getNodeName())) { + notEqual = getBoolBinop(node.getChildNodes()); + } + if ("Less".equals(node.getNodeName())) { + less = getBoolBinop(node.getChildNodes()); + } + if (LESS_OR_EQUAL.equals(node.getNodeName())) { + lessOrEqual = getBoolBinop(node.getChildNodes()); + } + if (GREATER.equals(node.getNodeName())) { + greater = getBoolBinop(node.getChildNodes()); + } + if (GREATER_OR_EQUAL.equals(node.getNodeName())) { + greaterOrEqual = getBoolBinop(node.getChildNodes()); + } + if ("Like".equals(node.getNodeName())) { + like = getBoolBinop(node.getChildNodes()); + } + if (NOT_LIKE.equals(node.getNodeName())) { + notLike = getBoolBinop(node.getChildNodes()); + } + } + } + return new TraceFilterR(not, or, and, isEqual, notEqual, less, lessOrEqual, greater, greaterOrEqual, like, + notLike); + } + + public static BoolBinop getBoolBinop(NodeList nl) { + String columnID = null; + String value = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("ColumnID".equals(node.getNodeName())) { + columnID = node.getTextContent(); + } + if (VALUE.equals(node.getNodeName())) { + value = node.getTextContent(); + } + } + } + return new BoolBinopR(columnID, value); + } + + public static AndOrType getAndOrType(NodeList nl) { + List notOrOrOrAnd = new ArrayList<>(); + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("Not".equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.Not); + } + if ("Or".equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.Or); + } + if ("And".equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.And); + } + if (EQUAL.equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.Equal); + } + if (NOT_EQUAL.equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.NotEqual); + } + if ("Less".equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.Less); + } + if (LESS_OR_EQUAL.equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.LessOrEqual); + } + if (GREATER.equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.Greater); + } + if (GREATER_OR_EQUAL.equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.GreaterOrEqual); + } + if ("Like".equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.Like); + } + if (NOT_LIKE.equals(node.getNodeName())) { + notOrOrOrAnd.add(AndOrTypeEnum.NotLike); + } + } + } + return new AndOrTypeR(notOrOrOrAnd); + } + + public static NotType getNotType(NodeList nl) { + NotType not = null; + AndOrType or = null; + AndOrType and = null; + BoolBinop isEqual = null; + BoolBinop notEqual = null; + BoolBinop less = null; + BoolBinop lessOrEqual = null; + BoolBinop greater = null; + BoolBinop greaterOrEqual = null; + BoolBinop like = null; + BoolBinop notLike = null; + + for (int i = 0; i < nl.getLength(); i++) { + org.w3c.dom.Node node = nl.item(i); + if (node != null) { + if ("Not".equals(node.getNodeName())) { + not = getNotType(node.getChildNodes()); + } + if ("Or".equals(node.getNodeName())) { + or = getAndOrType(node.getChildNodes()); + } + if ("And".equals(node.getNodeName())) { + and = getAndOrType(node.getChildNodes()); + } + if (EQUAL.equals(node.getNodeName())) { + isEqual = getBoolBinop(node.getChildNodes()); + } + if (NOT_EQUAL.equals(node.getNodeName())) { + notEqual = getBoolBinop(node.getChildNodes()); + } + if ("Less".equals(node.getNodeName())) { + less = getBoolBinop(node.getChildNodes()); + } + if (LESS_OR_EQUAL.equals(node.getNodeName())) { + lessOrEqual = getBoolBinop(node.getChildNodes()); + } + if (GREATER.equals(node.getNodeName())) { + greater = getBoolBinop(node.getChildNodes()); + } + if (GREATER_OR_EQUAL.equals(node.getNodeName())) { + greaterOrEqual = getBoolBinop(node.getChildNodes()); + } + if ("Like".equals(node.getNodeName())) { + like = getBoolBinop(node.getChildNodes()); + } + if (NOT_LIKE.equals(node.getNodeName())) { + notLike = getBoolBinop(node.getChildNodes()); + } + } + } + return new NotTypeR(not, or, and, isEqual, notEqual, less, lessOrEqual, greater, greaterOrEqual, like, notLike); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/package-info.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/package-info.java new file mode 100644 index 0000000..52d937e --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/package-info.java @@ -0,0 +1 @@ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/package-info.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/package-info.java new file mode 100644 index 0000000..0a530c0 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ + +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/package-info.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/package-info.java index ea6c0df..a17f8bc 100644 --- a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/package-info.java +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/package-info.java @@ -1,18 +1,66 @@ /* -* Copyright (c) 2023 Contributors to the Eclipse Foundation. -* -* This program and the accompanying materials are made -* available under the terms of the Eclipse Public License 2.0 -* which is available at https://www.eclipse.org/legal/epl-2.0/ -* -* SPDX-License-Identifier: EPL-2.0 -* -* Contributors: -* SmartCity Jena - initial -* Stefan Bischof (bipolis.org) - initial -* Sergei Semenkov - initial -*/ + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + * Sergei Semenkov - initial + */ +/** + * SOAP message adapter for XMLA server implementations. + * + *

+ * This package provides the core adapter layer between XMLA API calls and SOAP + * message format. It handles serialization, deserialization, and protocol + * adaptation for XML for Analysis (XMLA) operations. + * + *

Core Components

+ *
    + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaApiAdapter} + * - Main entry point, routes SOAP requests to appropriate handlers
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.Convert} - + * Facade for XML-to-API object conversion methods
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.SoapUtil} - + * SOAP message building utilities
  • + *
+ * + *

Constants

+ *
    + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.Constants} - + * All constants (legacy, for backwards compatibility)
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.NamespaceConstants} + * - XML namespace URIs and prefixes
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaElementConstants} + * - XMLA element name strings
  • + *
+ * + *

Exceptions

+ *
    + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaSoapException} + * - SOAP operation failures
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaParseException} + * - XML parsing and command errors
  • + *
+ * + *

Subpackages

+ *
    + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.convert} - XML + * parsing utilities
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.discover} - + * Discover operation handlers
  • + *
  • {@link org.eclipse.daanse.xmla.server.adapter.soapmessage.execute} - + * Execute operation handlers
  • + *
+ * + * @see org.eclipse.daanse.xmla.api + */ @org.osgi.annotation.bundle.Export @org.osgi.annotation.versioning.Version("0.0.1") package org.eclipse.daanse.xmla.server.adapter.soapmessage; diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionDispatcher.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionDispatcher.java new file mode 100644 index 0000000..c8551fb --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionDispatcher.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.session; + +import java.util.Optional; + +import javax.xml.namespace.QName; + +import org.eclipse.daanse.xmla.api.UserRolePrincipal; +import org.eclipse.daanse.xmla.api.session.SessionService; +import org.eclipse.daanse.xmla.api.xmla.BeginSession; +import org.eclipse.daanse.xmla.api.xmla.EndSession; +import org.eclipse.daanse.xmla.api.xmla.Session; + +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPException; +import jakarta.xml.soap.SOAPHeader; +import jakarta.xml.soap.SOAPHeaderElement; + +/** + * Dispatcher for XMLA Session operations. Handles BeginSession, Session + * validation, and EndSession requests. + */ +public class SessionDispatcher { + + private static final QName QN_SESSION = new QName("urn:schemas-microsoft-com:xml-analysis", "Session"); + + private final SessionService sessionService; + + public SessionDispatcher(SessionService sessionService) { + this.sessionService = sessionService; + } + + /** + * Process session headers from the SOAP request. + *

+ * Handles three cases: + *

    + *
  • Session header present - validates the session
  • + *
  • BeginSession header present - creates a new session
  • + *
  • EndSession header present - terminates the session
  • + *
+ * + * @param soapRequestHeader the SOAP request header + * @param userPrincipal the user principal + * @return Optional containing the session if active, empty otherwise + * @throws SOAPException if SOAP processing fails + */ + public Optional processSessionHeaders(SOAPElement soapRequestHeader, UserRolePrincipal userPrincipal) + throws SOAPException { + // Check for existing session + Optional oSession = SessionHeaderParser.getSession(soapRequestHeader); + if (oSession.isPresent()) { + boolean checked = sessionService.checkSession(oSession.get(), userPrincipal); + if (checked) { + return oSession; + } else { + return Optional.empty(); + } + } + + // Check for begin session request + Optional beginSession = SessionHeaderParser.getBeginSession(soapRequestHeader); + if (beginSession.isPresent()) { + return sessionService.beginSession(beginSession.get(), userPrincipal); + } + + // Check for end session request + Optional oEndSession = SessionHeaderParser.getEndSession(soapRequestHeader); + if (oEndSession.isPresent()) { + sessionService.endSession(oEndSession.get(), userPrincipal); + return Optional.empty(); + } + + return Optional.empty(); + } + + /** + * Add session header to the SOAP response if a session is active. + * + * @param responseHeader the SOAP response header + * @param session the active session, or empty if no session + * @throws SOAPException if SOAP processing fails + */ + public void addSessionResponseHeader(SOAPHeader responseHeader, Optional session) throws SOAPException { + if (session.isPresent()) { + SOAPHeaderElement sessionElement = responseHeader.addHeaderElement(QN_SESSION); + sessionElement.addAttribute(new QName("SessionId"), session.get().sessionId()); + } else { + responseHeader.setValue("\n"); + } + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionHeaderParser.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionHeaderParser.java new file mode 100644 index 0000000..249a64e --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionHeaderParser.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.session; + +import static org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlNodeHelper.toInteger; + +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.BeginSession; +import org.eclipse.daanse.xmla.api.xmla.EndSession; +import org.eclipse.daanse.xmla.api.xmla.Session; +import org.eclipse.daanse.xmla.model.record.xmla.BeginSessionR; +import org.eclipse.daanse.xmla.model.record.xmla.EndSessionR; +import org.eclipse.daanse.xmla.model.record.xmla.SessionR; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; + +import jakarta.xml.soap.SOAPElement; + +/** + * Parser for SOAP header session elements. Handles Session, BeginSession, and + * EndSession parsing. + */ +public class SessionHeaderParser { + + private static final String XMLA_NS = "urn:schemas-microsoft-com:xml-analysis"; + + private SessionHeaderParser() { + // utility class + } + + public static Optional getSession(SOAPElement soapHeader) { + NodeList nl = soapHeader.getElementsByTagNameNS(XMLA_NS, "Session"); + if (nl != null && nl.getLength() > 0) { + NamedNodeMap nnm = nl.item(0).getAttributes(); + org.w3c.dom.Node n = nnm.getNamedItem("SessionId"); + org.w3c.dom.Node n1 = nnm.getNamedItem("mustUnderstand"); + String sId = null; + Integer mustUnderstand = null; + if (n != null) { + sId = n.getNodeValue(); + } + if (n1 != null) { + mustUnderstand = toInteger(n1.getNodeValue()); + } + return Optional.of(new SessionR(sId, mustUnderstand)); + } + return Optional.empty(); + } + + public static Optional getEndSession(SOAPElement soapHeader) { + NodeList nl = soapHeader.getElementsByTagNameNS(XMLA_NS, "EndSession"); + if (nl != null && nl.getLength() > 0) { + NamedNodeMap nnm = nl.item(0).getAttributes(); + org.w3c.dom.Node n = nnm.getNamedItem("SessionId"); + org.w3c.dom.Node n1 = nnm.getNamedItem("mustUnderstand"); + String sId = null; + Integer mustUnderstand = null; + if (n != null) { + sId = n.getNodeValue(); + } + if (n1 != null) { + mustUnderstand = toInteger(n1.getNodeValue()); + } + return Optional.of(new EndSessionR(sId, mustUnderstand)); + } + return Optional.empty(); + } + + public static Optional getBeginSession(SOAPElement soapHeader) { + NodeList nl = soapHeader.getElementsByTagNameNS(XMLA_NS, "BeginSession"); + if (nl != null && nl.getLength() > 0) { + NamedNodeMap nnm = nl.item(0).getAttributes(); + org.w3c.dom.Node n = nnm.getNamedItem("mustUnderstand"); + Integer mustUnderstand = null; + if (n != null) { + mustUnderstand = toInteger(n.getNodeValue()); + } + return Optional.of(new BeginSessionR(mustUnderstand)); + } + return Optional.empty(); + } +} diff --git a/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/package-info.java b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/package-info.java new file mode 100644 index 0000000..57a8932 --- /dev/null +++ b/server/adapter.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/package-info.java @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ + +package org.eclipse.daanse.xmla.server.adapter.soapmessage.session; diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlNodeHelperTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlNodeHelperTest.java new file mode 100644 index 0000000..0812f98 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/XmlNodeHelperTest.java @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.math.BigInteger; +import java.time.Duration; +import java.time.Instant; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class XmlNodeHelperTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class ConversionMethods { + + @Test + void toBoolean_nullReturnsNull() { + assertNull(XmlNodeHelper.toBoolean(null)); + } + + @Test + void toBoolean_trueString() { + assertTrue(XmlNodeHelper.toBoolean("true")); + } + + @Test + void toBoolean_falseString() { + assertFalse(XmlNodeHelper.toBoolean("false")); + } + + @Test + void toInteger_nullReturnsNull() { + assertNull(XmlNodeHelper.toInteger(null)); + } + + @Test + void toInteger_validNumber() { + assertEquals(Integer.valueOf(42), XmlNodeHelper.toInteger("42")); + } + + @Test + void toInteger_negativeNumber() { + assertEquals(Integer.valueOf(-123), XmlNodeHelper.toInteger("-123")); + } + + @Test + void toLong_nullReturnsNull() { + assertNull(XmlNodeHelper.toLong(null)); + } + + @Test + void toLong_validNumber() { + assertEquals(Long.valueOf(9876543210L), XmlNodeHelper.toLong("9876543210")); + } + + @Test + void toBigInteger_nullReturnsNull() { + assertNull(XmlNodeHelper.toBigInteger(null)); + } + + @Test + void toBigInteger_validNumber() { + assertEquals(new BigInteger("12345678901234567890"), XmlNodeHelper.toBigInteger("12345678901234567890")); + } + + @Test + void toInstant_nullReturnsNull() { + assertNull(XmlNodeHelper.toInstant(null)); + } + + @Test + void toInstant_validIsoString() { + Instant expected = Instant.parse("2023-06-15T10:30:00Z"); + assertEquals(expected, XmlNodeHelper.toInstant("2023-06-15T10:30:00Z")); + } + + @Test + void toDuration_nullReturnsNull() { + assertNull(XmlNodeHelper.toDuration(null)); + } + + @Test + void toDuration_validIsoString() { + Duration expected = Duration.parse("PT2H30M"); + assertEquals(expected, XmlNodeHelper.toDuration("PT2H30M")); + } + } + + @Nested + class AttributeMethods { + + @Test + void getAttribute_nullAttributesReturnsNull() { + assertNull(XmlNodeHelper.getAttribute(null, "test")); + } + + @Test + void getAttribute_existingAttribute() throws Exception { + Document doc = parseXml(""); + NamedNodeMap attributes = doc.getDocumentElement().getAttributes(); + assertEquals("value", XmlNodeHelper.getAttribute(attributes, "attr")); + } + + @Test + void getAttribute_nonExistingAttribute() throws Exception { + Document doc = parseXml(""); + NamedNodeMap attributes = doc.getDocumentElement().getAttributes(); + assertNull(XmlNodeHelper.getAttribute(attributes, "nonexistent")); + } + + @Test + void getNodeType_nullNodeReturnsNull() { + assertNull(XmlNodeHelper.getNodeType(null)); + } + + @Test + void getNodeType_nodeWithXsiType() throws Exception { + Document doc = parseXml( + ""); + assertEquals("MyType", XmlNodeHelper.getNodeType(doc.getDocumentElement())); + } + + @Test + void getNodeType_nodeWithoutXsiType() throws Exception { + Document doc = parseXml(""); + assertNull(XmlNodeHelper.getNodeType(doc.getDocumentElement())); + } + } + + @Nested + class TextContentMethods { + + @Test + void getTextContent_nullNodeReturnsDefault() { + assertEquals("default", XmlNodeHelper.getTextContent(null, "default")); + } + + @Test + void getTextContent_nodeWithContent() throws Exception { + Document doc = parseXml("content"); + assertEquals("content", XmlNodeHelper.getTextContent(doc.getDocumentElement(), "default")); + } + + @Test + void getOptionalText_nullNodeReturnsEmpty() { + assertEquals(Optional.empty(), XmlNodeHelper.getOptionalText(null)); + } + + @Test + void getOptionalText_nodeWithContent() throws Exception { + Document doc = parseXml("content"); + assertEquals(Optional.of("content"), XmlNodeHelper.getOptionalText(doc.getDocumentElement())); + } + } + + @Nested + class NodeListMethods { + + @Test + void nodeListToMap_convertsCorrectly() throws Exception { + Document doc = parseXml("Test123"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + Map map = XmlNodeHelper.nodeListToMap(nl); + assertEquals("Test", map.get("name")); + assertEquals("123", map.get("value")); + } + + @Test + void getStringList_extractsMatchingNodes() throws Exception { + Document doc = parseXml("ABC"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + List list = XmlNodeHelper.getStringList(nl, "item"); + assertEquals(2, list.size()); + assertEquals("A", list.get(0)); + assertEquals("B", list.get(1)); + } + + @Test + void getStringList_noMatchesReturnsEmpty() throws Exception { + Document doc = parseXml("C"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + List list = XmlNodeHelper.getStringList(nl, "item"); + assertTrue(list.isEmpty()); + } + + @Test + void getList_withFactoryFunction() throws Exception { + Document doc = parseXml("XY"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + List list = XmlNodeHelper.getList(nl, "item", childNodes -> childNodes.item(0).getTextContent()); + assertEquals(2, list.size()); + assertEquals("X", list.get(0)); + assertEquals("Y", list.get(1)); + } + } + + @Nested + class FindNodeValueMethods { + + @Test + void findNodeValue_existingNode() throws Exception { + Document doc = parseXml("Test123"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + assertEquals("Test", XmlNodeHelper.findNodeValue(nl, "name")); + assertEquals("123", XmlNodeHelper.findNodeValue(nl, "value")); + } + + @Test + void findNodeValue_nonExistingNode() throws Exception { + Document doc = parseXml("Test"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + assertNull(XmlNodeHelper.findNodeValue(nl, "nonexistent")); + } + + @Test + void findOptionalNodeValue_existingNode() throws Exception { + Document doc = parseXml("Test"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + assertEquals(Optional.of("Test"), XmlNodeHelper.findOptionalNodeValue(nl, "name")); + } + + @Test + void findOptionalNodeValue_nonExistingNode() throws Exception { + Document doc = parseXml("Test"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + assertEquals(Optional.empty(), XmlNodeHelper.findOptionalNodeValue(nl, "nonexistent")); + } + + @Test + void findNodeValue_withConverter() throws Exception { + Document doc = parseXml("42"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + Integer result = XmlNodeHelper.findNodeValue(nl, "count", Integer::parseInt); + assertEquals(Integer.valueOf(42), result); + } + + @Test + void findNodeValue_withConverter_nonExistingNode() throws Exception { + Document doc = parseXml("Test"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + Integer result = XmlNodeHelper.findNodeValue(nl, "count", Integer::parseInt); + assertNull(result); + } + } + + @Nested + class TypedFindValueTests { + + @Test + void findBooleanValue_returnsBoolean() throws Exception { + String xml = "true"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Boolean result = XmlNodeHelper.findBooleanValue(nl, "enabled"); + assertTrue(result); + } + + @Test + void findBooleanValue_returnsFalse() throws Exception { + String xml = "false"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Boolean result = XmlNodeHelper.findBooleanValue(nl, "enabled"); + assertFalse(result); + } + + @Test + void findLongValue_returnsLong() throws Exception { + String xml = "123456789012"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Long result = XmlNodeHelper.findLongValue(nl, "size"); + assertEquals(123456789012L, result); + } + + @Test + void findIntegerValue_returnsInteger() throws Exception { + String xml = "42"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Integer result = XmlNodeHelper.findIntegerValue(nl, "count"); + assertEquals(42, result); + } + + @Test + void findInstantValue_returnsInstant() throws Exception { + String xml = "2024-01-15T10:30:00Z"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + java.time.Instant result = XmlNodeHelper.findInstantValue(nl, "timestamp"); + assertNotNull(result); + assertEquals(java.time.Instant.parse("2024-01-15T10:30:00Z"), result); + } + + @Test + void findBigIntegerValue_returnsBigInteger() throws Exception { + String xml = "999999999999999999999"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + java.math.BigInteger result = XmlNodeHelper.findBigIntegerValue(nl, "bignum"); + assertEquals(new java.math.BigInteger("999999999999999999999"), result); + } + + @Test + void findDurationValue_returnsDuration() throws Exception { + String xml = "PT1H30M"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + java.time.Duration result = XmlNodeHelper.findDurationValue(nl, "duration"); + assertEquals(java.time.Duration.parse("PT1H30M"), result); + } + + @Test + void findNode_returnsNode() throws Exception { + String xml = "textvalue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + org.w3c.dom.Node result = XmlNodeHelper.findNode(nl, "child"); + assertNotNull(result); + assertEquals("child", result.getNodeName()); + assertEquals("text", result.getTextContent()); + } + + @Test + void findNode_notFound_returnsNull() throws Exception { + String xml = "text"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + org.w3c.dom.Node result = XmlNodeHelper.findNode(nl, "nonexistent"); + assertNull(result); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDispatcherTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDispatcherTest.java new file mode 100644 index 0000000..1347b32 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/discover/DiscoverDispatcherTest.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.discover; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +class DiscoverDispatcherTest { + + private static final String XMLA_NS = "urn:schemas-microsoft-com:xml-analysis"; + private static final QName QN_RESTRICTIONS = new QName(XMLA_NS, "Restrictions"); + private static final QName QN_RESTRICTION_LIST = new QName(XMLA_NS, "RestrictionList"); + + private SOAPMessage soapMessage; + private SOAPElement bodyElement; + + @BeforeEach + void setUp() throws Exception { + MessageFactory factory = MessageFactory.newInstance(); + soapMessage = factory.createMessage(); + SOAPPart soapPart = soapMessage.getSOAPPart(); + SOAPEnvelope envelope = soapPart.getEnvelope(); + bodyElement = envelope.getBody().addChildElement("TestElement"); + } + + @Nested + class GetRestrictionMapTests { + + @Test + void getRestrictionMap_withRestrictions() throws Exception { + // getRestrictionMap expects the Restrictions element directly + SOAPElement restrictions = bodyElement.addChildElement(QN_RESTRICTIONS); + SOAPElement restrictionList = restrictions.addChildElement(QN_RESTRICTION_LIST); + restrictionList.addChildElement("CATALOG_NAME").setTextContent("TestCatalog"); + restrictionList.addChildElement("SCHEMA_NAME").setTextContent("TestSchema"); + + Map result = DiscoverDispatcher.getRestrictionMap(restrictions); + + assertEquals(2, result.size()); + assertEquals("TestCatalog", result.get("CATALOG_NAME")); + assertEquals("TestSchema", result.get("SCHEMA_NAME")); + } + + @Test + void getRestrictionMap_emptyRestrictionList() throws Exception { + SOAPElement restrictions = bodyElement.addChildElement(QN_RESTRICTIONS); + restrictions.addChildElement(QN_RESTRICTION_LIST); + + Map result = DiscoverDispatcher.getRestrictionMap(restrictions); + + assertTrue(result.isEmpty()); + } + + @Test + void getRestrictionMap_noRestrictionList() throws Exception { + SOAPElement restrictions = bodyElement.addChildElement(QN_RESTRICTIONS); + + Map result = DiscoverDispatcher.getRestrictionMap(restrictions); + + assertTrue(result.isEmpty()); + } + + @Test + void getRestrictionMap_singleRestriction() throws Exception { + SOAPElement restrictions = bodyElement.addChildElement(QN_RESTRICTIONS); + SOAPElement restrictionList = restrictions.addChildElement(QN_RESTRICTION_LIST); + restrictionList.addChildElement("CUBE_NAME").setTextContent("SalesCube"); + + Map result = DiscoverDispatcher.getRestrictionMap(restrictions); + + assertEquals(1, result.size()); + assertEquals("SalesCube", result.get("CUBE_NAME")); + } + + @Test + void getRestrictionMap_withEmptyValue() throws Exception { + SOAPElement restrictions = bodyElement.addChildElement(QN_RESTRICTIONS); + SOAPElement restrictionList = restrictions.addChildElement(QN_RESTRICTION_LIST); + restrictionList.addChildElement("EMPTY_RESTRICTION").setTextContent(""); + + Map result = DiscoverDispatcher.getRestrictionMap(restrictions); + + assertEquals(1, result.size()); + assertEquals("", result.get("EMPTY_RESTRICTION")); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ActionConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ActionConverterTest.java new file mode 100644 index 0000000..68c39d7 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ActionConverterTest.java @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Action; +import org.eclipse.daanse.xmla.model.record.xmla.DrillThroughActionR; +import org.eclipse.daanse.xmla.model.record.xmla.ReportActionR; +import org.eclipse.daanse.xmla.model.record.xmla.StandardActionR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.ActionConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class ActionConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class StandardActionTests { + + @Test + void getStandardAction_withNameAndExpression() throws Exception { + String xml = "TestActionSELECT * FROM Sales"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getStandardAction(nl); + + assertNotNull(action); + assertInstanceOf(StandardActionR.class, action); + StandardActionR std = (StandardActionR) action; + assertEquals("TestAction", std.name()); + assertEquals("SELECT * FROM Sales", std.expression()); + } + + @Test + void getStandardAction_withId() throws Exception { + String xml = "Testaction-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getStandardAction(nl); + + StandardActionR std = (StandardActionR) action; + assertTrue(std.id().isPresent()); + assertEquals("action-123", std.id().get()); + } + + @Test + void getStandardAction_withCaption() throws Exception { + String xml = "TestTest Captiontrue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getStandardAction(nl); + + StandardActionR std = (StandardActionR) action; + assertTrue(std.caption().isPresent()); + assertEquals("Test Caption", std.caption().get()); + assertTrue(std.captionIsMdx().isPresent()); + assertTrue(std.captionIsMdx().get()); + } + + @Test + void getStandardAction_withDescription() throws Exception { + String xml = "TestA test action"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getStandardAction(nl); + + StandardActionR std = (StandardActionR) action; + assertTrue(std.description().isPresent()); + assertEquals("A test action", std.description().get()); + } + } + + @Nested + class ReportActionTests { + + @Test + void getReportAction_withReportServer() throws Exception { + String xml = "ReportTesthttp://reports.example.com"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getReportAction(nl); + + assertNotNull(action); + assertInstanceOf(ReportActionR.class, action); + ReportActionR report = (ReportActionR) action; + assertEquals("ReportTest", report.name()); + assertEquals("http://reports.example.com", report.reportServer()); + } + + @Test + void getReportAction_withPath() throws Exception { + String xml = "Testhttp://reports/Sales/Monthly"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getReportAction(nl); + + ReportActionR report = (ReportActionR) action; + assertTrue(report.path().isPresent()); + assertEquals("/Sales/Monthly", report.path().get()); + } + + @Test + void getReportAction_withId() throws Exception { + String xml = "Testreport-456http://reports"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getReportAction(nl); + + ReportActionR report = (ReportActionR) action; + assertTrue(report.id().isPresent()); + assertEquals("report-456", report.id().get()); + } + } + + @Nested + class DrillThroughActionTests { + + @Test + void getDrillThroughAction_withName() throws Exception { + String xml = "DrillTest"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getDrillThroughAction(nl); + + assertNotNull(action); + assertInstanceOf(DrillThroughActionR.class, action); + DrillThroughActionR drill = (DrillThroughActionR) action; + assertEquals("DrillTest", drill.name()); + } + + @Test + void getDrillThroughAction_withDefault() throws Exception { + String xml = "Testtrue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getDrillThroughAction(nl); + + DrillThroughActionR drill = (DrillThroughActionR) action; + assertTrue(drill.defaultAction().isPresent()); + assertTrue(drill.defaultAction().get()); + } + + @Test + void getDrillThroughAction_withMaximumRows() throws Exception { + String xml = "Test1000"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getDrillThroughAction(nl); + + DrillThroughActionR drill = (DrillThroughActionR) action; + assertTrue(drill.maximumRows().isPresent()); + assertEquals(Integer.valueOf(1000), drill.maximumRows().get()); + } + + @Test + void getDrillThroughAction_withId() throws Exception { + String xml = "Testdrill-789"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getDrillThroughAction(nl); + + DrillThroughActionR drill = (DrillThroughActionR) action; + assertTrue(drill.id().isPresent()); + assertEquals("drill-789", drill.id().get()); + } + } + + @Nested + class ActionDispatchTests { + + @Test + void getAction_dispatchesToStandardAction() throws Exception { + String xml = "TestSELECT 1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getAction(nl, "StandardAction"); + + assertNotNull(action); + assertInstanceOf(StandardActionR.class, action); + } + + @Test + void getAction_dispatchesToReportAction() throws Exception { + String xml = "Testhttp://reports"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getAction(nl, "ReportAction"); + + assertNotNull(action); + assertInstanceOf(ReportActionR.class, action); + } + + @Test + void getAction_dispatchesToDrillThroughAction() throws Exception { + String xml = "Test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getAction(nl, "DrillThroughAction"); + + assertNotNull(action); + assertInstanceOf(DrillThroughActionR.class, action); + } + + @Test + void getAction_returnsNullForUnknownType() throws Exception { + String xml = "Test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Action action = ActionConverter.getAction(nl, "UnknownAction"); + + assertNull(action); + } + } + + @Nested + class ActionListTests { + + @Test + void getActionList_multipleStandardActions() throws Exception { + String xml = "" + + "A1" + + "A2" + + ""; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = ActionConverter.getActionList(nl); + + assertEquals(2, list.size()); + } + + @Test + void getActionList_emptyList() throws Exception { + String xml = ""; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = ActionConverter.getActionList(nl); + + assertNotNull(list); + assertTrue(list.isEmpty()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/AggregationConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/AggregationConverterTest.java new file mode 100644 index 0000000..ad71cb0 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/AggregationConverterTest.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.Collections; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Aggregation; +import org.eclipse.daanse.xmla.api.xmla.AggregationDesign; +import org.eclipse.daanse.xmla.api.xmla.AggregationDimension; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.AggregationConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class AggregationConverterTest { + + private DocumentBuilder documentBuilder; + private AggregationConverter.AnnotationListParser annotationParser; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + annotationParser = _ -> Collections.emptyList(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class AggregationDesignTests { + + @Test + void getAggregationDesign_withName() throws Exception { + String xml = "TestDesign"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + AggregationDesign design = AggregationConverter.getAggregationDesign(nl, annotationParser); + + assertNotNull(design); + assertEquals("TestDesign", design.name()); + } + + @Test + void getAggregationDesign_withEstimatedRows() throws Exception { + String xml = "Test1000"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + AggregationDesign design = AggregationConverter.getAggregationDesign(nl, annotationParser); + + assertTrue(design.estimatedRows().isPresent()); + assertEquals(1000L, design.estimatedRows().get()); + } + + @Test + void getAggregationDesign_withEstimatedPerformanceGain() throws Exception { + String xml = "Test50"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + AggregationDesign design = AggregationConverter.getAggregationDesign(nl, annotationParser); + + assertTrue(design.estimatedPerformanceGain().isPresent()); + assertEquals(50, design.estimatedPerformanceGain().get()); + } + } + + @Nested + class AggregationTests { + + @Test + void getAggregation_withName() throws Exception { + String xml = "TestAgg"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Aggregation agg = AggregationConverter.getAggregation(nl, annotationParser); + + assertNotNull(agg); + assertEquals("TestAgg", agg.name()); + } + + @Test + void getAggregation_withId() throws Exception { + String xml = "agg-123Test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Aggregation agg = AggregationConverter.getAggregation(nl, annotationParser); + + assertTrue(agg.id().isPresent()); + assertEquals("agg-123", agg.id().get()); + } + } + + @Nested + class AggregationDimensionTests { + + @Test + void getAggregationDimension_withCubeDimensionID() throws Exception { + String xml = "dim-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + AggregationDimension dim = AggregationConverter.getAggregationDimension(nl, annotationParser); + + assertNotNull(dim); + assertEquals("dim-1", dim.cubeDimensionID()); + } + } + + @Nested + class AggregationDesignAttributeTests { + + @Test + void getAggregationDesignAttribute_withAttributeID() throws Exception { + String xml = "attr-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + var attr = AggregationConverter.getAggregationDesignAttribute(nl); + + assertNotNull(attr); + assertEquals("attr-1", attr.attributeID()); + } + + @Test + void getAggregationDesignAttribute_withEstimatedCount() throws Exception { + String xml = "attr-1500"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + var attr = AggregationConverter.getAggregationDesignAttribute(nl); + + assertTrue(attr.estimatedCount().isPresent()); + assertEquals(500L, attr.estimatedCount().get()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/BindingConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/BindingConverterTest.java new file mode 100644 index 0000000..5a1d4e6 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/BindingConverterTest.java @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Binding; +import org.eclipse.daanse.xmla.api.xmla.TabularBinding; +import org.eclipse.daanse.xmla.model.record.xmla.AttributeBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DSVTableBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.DimensionBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.MeasureBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.QueryBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.RowBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.TableBindingR; +import org.eclipse.daanse.xmla.model.record.xmla.TimeBindingR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.BindingConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class BindingConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class RowBindingTests { + + @Test + void getRowBinding_withTableID() throws Exception { + String xml = "table1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Binding binding = BindingConverter.getRowBinding(nl); + + assertNotNull(binding); + assertInstanceOf(RowBindingR.class, binding); + assertEquals("table1", ((RowBindingR) binding).tableID()); + } + } + + @Nested + class MeasureBindingTests { + + @Test + void getMeasureBinding_withMeasureID() throws Exception { + String xml = "measure1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Binding binding = BindingConverter.getMeasureBinding(nl); + + assertNotNull(binding); + assertInstanceOf(MeasureBindingR.class, binding); + assertEquals("measure1", ((MeasureBindingR) binding).measureID()); + } + } + + @Nested + class AttributeBindingTests { + + @Test + void getAttributeBinding_withAttributeID() throws Exception { + String xml = "attr1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Binding binding = BindingConverter.getAttributeBinding(nl); + + assertNotNull(binding); + assertInstanceOf(AttributeBindingR.class, binding); + assertEquals("attr1", ((AttributeBindingR) binding).attributeID()); + } + } + + @Nested + class DimensionBindingTests { + + @Test + void getDimensionBinding_withDataSourceIDAndDimensionID() throws Exception { + String xml = "ds1dim1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Binding binding = BindingConverter.getDimensionBinding(nl); + + assertNotNull(binding); + assertInstanceOf(DimensionBindingR.class, binding); + DimensionBindingR dimBinding = (DimensionBindingR) binding; + assertEquals("ds1", dimBinding.dataSourceID()); + assertEquals("dim1", dimBinding.dimensionID()); + } + } + + @Nested + class TimeBindingTests { + + @Test + void getTimeBinding_withCalendarDates() throws Exception { + String xml = "2024-01-01T00:00:00Z"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Binding binding = BindingConverter.getTimeBinding(nl); + + assertNotNull(binding); + assertInstanceOf(TimeBindingR.class, binding); + } + } + + @Nested + class TabularBindingTests { + + @Test + void getTableBinding_withDataSourceIDAndTableName() throws Exception { + String xml = "ds1MyTable"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TabularBinding binding = BindingConverter.getTableBinding(nl); + + assertNotNull(binding); + assertInstanceOf(TableBindingR.class, binding); + TableBindingR tableBinding = (TableBindingR) binding; + assertEquals("MyTable", tableBinding.dbTableName()); + } + + @Test + void getQueryBinding_withQueryDefinition() throws Exception { + String xml = "SELECT * FROM test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TabularBinding binding = BindingConverter.getQueryBinding(nl); + + assertNotNull(binding); + assertInstanceOf(QueryBindingR.class, binding); + assertEquals("SELECT * FROM test", ((QueryBindingR) binding).queryDefinition()); + } + + @Test + void getDSVTableBinding_withTableID() throws Exception { + String xml = "dsvTable1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TabularBinding binding = BindingConverter.getDSVTableBinding(nl); + + assertNotNull(binding); + assertInstanceOf(DSVTableBindingR.class, binding); + assertEquals("dsvTable1", ((DSVTableBindingR) binding).tableID()); + } + + @Test + void getTabularBinding_dispatchesCorrectly() throws Exception { + String xml = "Test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TabularBinding binding = BindingConverter.getTabularBinding(nl, "TableBinding"); + + assertInstanceOf(TableBindingR.class, binding); + } + } + + @Nested + class SimpleBindingTests { + + @Test + void getRowNumberBinding_returnsInstance() { + Binding binding = BindingConverter.getRowNumberBinding(); + assertNotNull(binding); + } + + @Test + void getInheritedBinding_returnsInstance() { + Binding binding = BindingConverter.getInheritedBinding(); + assertNotNull(binding); + } + + @Test + void getTimeAttributeBinding_returnsInstance() { + Binding binding = BindingConverter.getTimeAttributeBinding(); + assertNotNull(binding); + } + } + + @Nested + class GroupTests { + + @Test + void getGroup_withNameAndMembers() throws Exception { + String xml = "Group1m1m2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + var group = BindingConverter.getGroup(nl); + + assertNotNull(group); + assertEquals("Group1", group.name()); + assertTrue(group.members().isPresent()); + assertEquals(2, group.members().get().size()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/DataSourceConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/DataSourceConverterTest.java new file mode 100644 index 0000000..6105a90 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/DataSourceConverterTest.java @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.engine.ImpersonationInfo; +import org.eclipse.daanse.xmla.api.xmla.DataSource; +import org.eclipse.daanse.xmla.api.xmla.DataSourceView; +import org.eclipse.daanse.xmla.api.xmla.DataSourceViewBinding; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.DataSourceConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class DataSourceConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class DataSourceViewBindingTests { + + @Test + void getDataSourceViewBinding_withDataSourceViewID() throws Exception { + String xml = "dsv-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourceViewBinding binding = DataSourceConverter.getDataSourceViewBinding(nl); + + assertNotNull(binding); + assertEquals("dsv-123", binding.dataSourceViewID()); + } + + @Test + void getDataSourceViewBinding_withEmptyId() throws Exception { + String xml = ""; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourceViewBinding binding = DataSourceConverter.getDataSourceViewBinding(nl); + + assertNotNull(binding); + assertNull(binding.dataSourceViewID()); + } + } + + @Nested + class DataSourceViewTests { + + @Test + void getDataSourceView_withNameAndId() throws Exception { + String xml = "TestDSVdsv-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourceView dsv = DataSourceConverter.getDataSourceView(nl); + + assertNotNull(dsv); + assertEquals("TestDSV", dsv.name()); + assertEquals("dsv-1", dsv.id()); + } + + @Test + void getDataSourceView_withDataSourceID() throws Exception { + String xml = "Testds-ref-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourceView dsv = DataSourceConverter.getDataSourceView(nl); + + assertEquals("ds-ref-1", dsv.dataSourceID()); + } + + @Test + void getDataSourceView_withDescription() throws Exception { + String xml = "TestA test DSV"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourceView dsv = DataSourceConverter.getDataSourceView(nl); + + assertEquals("A test DSV", dsv.description()); + } + + @Test + void getDataSourceViewList_multipleItems() throws Exception { + String xml = "DSV1" + + "DSV2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = DataSourceConverter.getDataSourceViewList(nl); + + assertEquals(2, list.size()); + assertEquals("DSV1", list.get(0).name()); + assertEquals("DSV2", list.get(1).name()); + } + } + + @Nested + class DataSourceTests { + + @Test + void getDataSource_withNameAndId() throws Exception { + String xml = "TestDSds-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSource ds = DataSourceConverter.getDataSource(nl); + + assertNotNull(ds); + assertEquals("TestDS", ds.name()); + assertEquals("ds-1", ds.id()); + } + + @Test + void getDataSource_withConnectionString() throws Exception { + String xml = "TestServer=localhost;Database=test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSource ds = DataSourceConverter.getDataSource(nl); + + assertEquals("Server=localhost;Database=test", ds.connectionString()); + } + + @Test + void getDataSource_withManagedProvider() throws Exception { + String xml = "TestMSOLAP"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSource ds = DataSourceConverter.getDataSource(nl); + + assertEquals("MSOLAP", ds.managedProvider()); + } + + @Test + void getDataSource_withTimeout() throws Exception { + String xml = "TestPT30S"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSource ds = DataSourceConverter.getDataSource(nl); + + assertNotNull(ds.timeout()); + } + + @Test + void getDataSource_withIsolation() throws Exception { + String xml = "TestReadCommitted"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSource ds = DataSourceConverter.getDataSource(nl); + + assertEquals("ReadCommitted", ds.isolation()); + } + + @Test + void getDataSourceList_multipleItems() throws Exception { + String xml = "DS1" + + "DS2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = DataSourceConverter.getDataSourceList(nl); + + assertEquals(2, list.size()); + assertEquals("DS1", list.get(0).name()); + assertEquals("DS2", list.get(1).name()); + } + } + + @Nested + class ImpersonationInfoTests { + + @Test + void getImpersonationInfo_withMode() throws Exception { + String xml = "ImpersonateCurrentUser"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ImpersonationInfo info = DataSourceConverter.getImpersonationInfo(nl); + + assertNotNull(info); + assertEquals("ImpersonateCurrentUser", info.impersonationMode()); + } + + @Test + void getImpersonationInfo_withAccount() throws Exception { + String xml = "ImpersonateAccount" + + "domain\\user"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ImpersonationInfo info = DataSourceConverter.getImpersonationInfo(nl); + + assertTrue(info.account().isPresent()); + assertEquals("domain\\user", info.account().get()); + } + + @Test + void getImpersonationInfo_withPassword() throws Exception { + String xml = "ImpersonateAccount" + + "secret123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ImpersonationInfo info = DataSourceConverter.getImpersonationInfo(nl); + + assertTrue(info.password().isPresent()); + assertEquals("secret123", info.password().get()); + } + + @Test + void getImpersonationInfo_withSecurity() throws Exception { + String xml = "ImpersonateAccount" + + "PasswordRemoved"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ImpersonationInfo info = DataSourceConverter.getImpersonationInfo(nl); + + assertTrue(info.impersonationInfoSecurity().isPresent()); + assertEquals("PasswordRemoved", info.impersonationInfoSecurity().get()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/DatabaseConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/DatabaseConverterTest.java new file mode 100644 index 0000000..1c5f638 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/DatabaseConverterTest.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Account; +import org.eclipse.daanse.xmla.api.xmla.Assembly; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.Database; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.DatabaseConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class DatabaseConverterTest { + + private DocumentBuilder documentBuilder; + private Function mockCommandParser; + private Function> mockAssemblySupplier; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + + // Simple mocks that return null/empty - sufficient for basic field tests + mockCommandParser = _ -> null; + mockAssemblySupplier = _ -> new ArrayList<>(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class DatabaseTests { + + @Test + void getDatabase_withNameAndId() throws Exception { + String xml = "TestDBdb-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Database db = DatabaseConverter.getDatabase(nl, mockCommandParser, mockAssemblySupplier); + + assertNotNull(db); + assertEquals("TestDB", db.name()); + assertEquals("db-123", db.id()); + } + + @Test + void getDatabase_withDescription() throws Exception { + String xml = "TestDBA test database"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Database db = DatabaseConverter.getDatabase(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("A test database", db.description()); + } + + @Test + void getDatabase_withCollation() throws Exception { + String xml = "TestDBLatin1_General_CI_AS"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Database db = DatabaseConverter.getDatabase(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("Latin1_General_CI_AS", db.collation()); + } + + @Test + void getDatabase_withReadWriteMode() throws Exception { + String xml = "TestDBReadWrite"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Database db = DatabaseConverter.getDatabase(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("ReadWrite", db.readWriteMode()); + } + + @Test + void getDatabase_withCompatibilityLevel() throws Exception { + String xml = "TestDB1500"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Database db = DatabaseConverter.getDatabase(nl, mockCommandParser, mockAssemblySupplier); + + assertNotNull(db.compatibilityLevel()); + assertEquals(1500, db.compatibilityLevel().intValue()); + } + + @Test + void getDatabase_withVisible() throws Exception { + String xml = "TestDBtrue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Database db = DatabaseConverter.getDatabase(nl, mockCommandParser, mockAssemblySupplier); + + assertTrue(db.visible()); + } + + @Test + void getDatabaseList_multipleItems() throws Exception { + String xml = "DB1" + + "DB2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = DatabaseConverter.getDatabaseList(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals(2, list.size()); + assertEquals("DB1", list.get(0).name()); + assertEquals("DB2", list.get(1).name()); + } + } + + @Nested + class AccountTests { + + @Test + void getAccount_withAccountType() throws Exception { + String xml = "Revenue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Account account = DatabaseConverter.getAccount(nl); + + assertNotNull(account); + assertEquals("Revenue", account.accountType()); + } + + @Test + void getAccount_withAggregationFunction() throws Exception { + String xml = "RevenueSum"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Account account = DatabaseConverter.getAccount(nl); + + assertEquals("Sum", account.aggregationFunction()); + } + + @Test + void getAccount_withAliases() throws Exception { + String xml = "RevenueSalesIncome"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Account account = DatabaseConverter.getAccount(nl); + + assertNotNull(account.aliases()); + assertEquals(2, account.aliases().size()); + assertTrue(account.aliases().contains("Sales")); + assertTrue(account.aliases().contains("Income")); + } + + @Test + void getAccountList_multipleItems() throws Exception { + String xml = "Revenue" + + "Expense"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = DatabaseConverter.getAccountList(nl); + + assertEquals(2, list.size()); + assertEquals("Revenue", list.get(0).accountType()); + assertEquals("Expense", list.get(1).accountType()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PartitionConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PartitionConverterTest.java new file mode 100644 index 0000000..2989dbf --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PartitionConverterTest.java @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.io.StringReader; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Partition; +import org.eclipse.daanse.xmla.api.xmla.PartitionStorageModeEnumType; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.PartitionConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class PartitionConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class PartitionTests { + + @Test + void getPartition_withNameAndId() throws Exception { + String xml = "TestPartitionpart-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertNotNull(partition); + assertEquals("TestPartition", partition.name()); + assertEquals("part-123", partition.id()); + } + + @Test + void getPartition_withDescription() throws Exception { + String xml = "TestA test partition"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("A test partition", partition.description()); + } + + @Test + void getPartition_withAggregationPrefix() throws Exception { + String xml = "TestAgg_"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("Agg_", partition.aggregationPrefix()); + } + + @Test + void getPartition_withProcessingMode() throws Exception { + String xml = "TestRegular"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("Regular", partition.processingMode()); + } + + @Test + void getPartition_withStorageLocation() throws Exception { + String xml = "Test/data/partition1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("/data/partition1", partition.storageLocation()); + } + + @Test + void getPartition_withSlice() throws Exception { + String xml = "Test[Year].[2023]"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("[Year].[2023]", partition.slice()); + } + + @Test + void getPartition_withType() throws Exception { + String xml = "TestData"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("Data", partition.type()); + } + + @Test + void getPartition_withEstimatedSize() throws Exception { + String xml = "Test1024000"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals(1024000L, partition.estimatedSize()); + } + + @Test + void getPartition_withEstimatedRows() throws Exception { + String xml = "Test50000"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals(50000L, partition.estimatedRows()); + } + + @Test + void getPartition_withState() throws Exception { + String xml = "TestProcessed"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("Processed", partition.state()); + } + + @Test + void getPartition_withDirectQueryUsage() throws Exception { + String xml = "TestInMemoryOnly"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition partition = PartitionConverter.getPartition(nl); + + assertEquals("InMemoryOnly", partition.directQueryUsage()); + } + + @Test + void getPartitionList_multipleItems() throws Exception { + String xml = "P1" + + "P2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = PartitionConverter.getPartitionList(nl); + + assertEquals(2, list.size()); + assertEquals("P1", list.get(0).name()); + assertEquals("P2", list.get(1).name()); + } + } + + @Nested + class StorageModeTests { + + @Test + void getPartitionStorageMode_withMolap() throws Exception { + String xml = "Molap"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition.StorageMode mode = PartitionConverter.getPartitionStorageMode(nl); + + assertNotNull(mode); + assertEquals(PartitionStorageModeEnumType.MOLAP, mode.value()); + } + + @Test + void getPartitionStorageMode_withRolap() throws Exception { + String xml = "Rolap"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition.StorageMode mode = PartitionConverter.getPartitionStorageMode(nl); + + assertEquals(PartitionStorageModeEnumType.ROLAP, mode.value()); + } + + @Test + void getPartitionStorageMode_withHolap() throws Exception { + String xml = "Holap"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition.StorageMode mode = PartitionConverter.getPartitionStorageMode(nl); + + assertEquals(PartitionStorageModeEnumType.HOLAP, mode.value()); + } + } + + @Nested + class CurrentStorageModeTests { + + @Test + void getPartitionCurrentStorageMode_withMolap() throws Exception { + String xml = "Molap"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Partition.CurrentStorageMode mode = PartitionConverter.getPartitionCurrentStorageMode(nl); + + assertNotNull(mode); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PermissionConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PermissionConverterTest.java new file mode 100644 index 0000000..f9a4485 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PermissionConverterTest.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.DataSourcePermission; +import org.eclipse.daanse.xmla.api.xmla.DatabasePermission; +import org.eclipse.daanse.xmla.api.xmla.Permission; +import org.eclipse.daanse.xmla.api.xmla.ReadDefinitionEnum; +import org.eclipse.daanse.xmla.api.xmla.ReadWritePermissionEnum; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.PermissionConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class PermissionConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class PermissionTests { + + @Test + void getPermission_withRoleID() throws Exception { + String xml = "role-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Permission permission = PermissionConverter.getPermission(nl); + + assertNotNull(permission); + assertEquals("role-123", permission.roleID()); + } + + @Test + void getPermission_withProcess() throws Exception { + String xml = "role-1true"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Permission permission = PermissionConverter.getPermission(nl); + + assertTrue(permission.process().isPresent()); + assertTrue(permission.process().get()); + } + + @Test + void getPermission_withReadDefinition() throws Exception { + String xml = "role-1Allowed"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Permission permission = PermissionConverter.getPermission(nl); + + assertTrue(permission.readDefinition().isPresent()); + assertEquals(ReadDefinitionEnum.ALLOWED, permission.readDefinition().get()); + } + + @Test + void getPermission_withReadWrite() throws Exception { + String xml = "role-1AllowedAllowed"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Permission permission = PermissionConverter.getPermission(nl); + + assertTrue(permission.read().isPresent()); + assertEquals(ReadWritePermissionEnum.ALLOWED, permission.read().get()); + assertTrue(permission.write().isPresent()); + assertEquals(ReadWritePermissionEnum.ALLOWED, permission.write().get()); + } + } + + @Nested + class DataSourcePermissionTests { + + @Test + void getDataSourcePermission_withNameAndRoleID() throws Exception { + String xml = "DSPerm1role-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourcePermission permission = PermissionConverter.getDataSourcePermission(nl); + + assertNotNull(permission); + assertEquals("DSPerm1", permission.name()); + assertEquals("role-1", permission.roleID()); + } + + @Test + void getDataSourcePermission_withId() throws Exception { + String xml = "DSPerm1dsp-123role-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourcePermission permission = PermissionConverter.getDataSourcePermission(nl); + + assertTrue(permission.id().isPresent()); + assertEquals("dsp-123", permission.id().get()); + } + + @Test + void getDataSourcePermissionList_multipleItems() throws Exception { + String xml = "P1r1" + + "P2r2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = PermissionConverter.getDataSourcePermissionList(nl); + + assertEquals(2, list.size()); + assertEquals("P1", list.get(0).name()); + assertEquals("P2", list.get(1).name()); + } + + @Test + void getDataSourcePermission_withReadWritePermissions() throws Exception { + String xml = "DSPermrole-1" + + "AllowedNone"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DataSourcePermission permission = PermissionConverter.getDataSourcePermission(nl); + + assertTrue(permission.read().isPresent()); + assertEquals(ReadWritePermissionEnum.ALLOWED, permission.read().get()); + assertTrue(permission.write().isPresent()); + assertEquals(ReadWritePermissionEnum.NONE, permission.write().get()); + } + } + + @Nested + class DatabasePermissionTests { + + @Test + void getDatabasePermission_withNameAndRoleID() throws Exception { + String xml = "DBPerm1role-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DatabasePermission permission = PermissionConverter.getDatabasePermission(nl); + + assertNotNull(permission); + assertEquals("DBPerm1", permission.name()); + assertEquals("role-1", permission.roleID()); + } + + @Test + void getDatabasePermission_withAdminister() throws Exception { + String xml = "DBPerm1role-1true"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DatabasePermission permission = PermissionConverter.getDatabasePermission(nl); + + assertTrue(permission.administer().isPresent()); + assertTrue(permission.administer().get()); + } + + @Test + void getDatabasePermission_withAdministerFalse() throws Exception { + String xml = "DBPerm1role-1false"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DatabasePermission permission = PermissionConverter.getDatabasePermission(nl); + + assertTrue(permission.administer().isPresent()); + assertFalse(permission.administer().get()); + } + + @Test + void getDatabasePermissionList_multipleItems() throws Exception { + String xml = "P1r1" + + "P2r2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = PermissionConverter.getDatabasePermissionList(nl); + + assertEquals(2, list.size()); + assertEquals("P1", list.get(0).name()); + assertEquals("P2", list.get(1).name()); + } + + @Test + void getDatabasePermission_withDescription() throws Exception { + String xml = "DBPerm1role-1" + + "Admin permissions for database"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DatabasePermission permission = PermissionConverter.getDatabasePermission(nl); + + assertTrue(permission.description().isPresent()); + assertEquals("Admin permissions for database", permission.description().get()); + } + + @Test + void getDatabasePermission_withReadDefinition() throws Exception { + String xml = "DBPerm1role-1" + + "Basic"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + DatabasePermission permission = PermissionConverter.getDatabasePermission(nl); + + assertTrue(permission.readDefinition().isPresent()); + assertEquals(ReadDefinitionEnum.BASIC, permission.readDefinition().get()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PerspectiveConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PerspectiveConverterTest.java new file mode 100644 index 0000000..77d7404 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/PerspectiveConverterTest.java @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Perspective; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveAction; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveAttribute; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveCalculation; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveDimension; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveHierarchy; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveKpi; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveMeasure; +import org.eclipse.daanse.xmla.api.xmla.PerspectiveMeasureGroup; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.PerspectiveConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class PerspectiveConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class PerspectiveTests { + + @Test + void getPerspective_withNameAndId() throws Exception { + String xml = "TestPerspectivepersp-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Perspective perspective = PerspectiveConverter.getPerspective(nl); + + assertNotNull(perspective); + assertEquals("TestPerspective", perspective.name()); + assertEquals("persp-1", perspective.id()); + } + + @Test + void getPerspective_withDefaultMeasure() throws Exception { + String xml = "TestSalesMeasure"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Perspective perspective = PerspectiveConverter.getPerspective(nl); + + assertEquals("SalesMeasure", perspective.defaultMeasure()); + } + + @Test + void getPerspectiveList_multipleItems() throws Exception { + String xml = "P1P2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = PerspectiveConverter.getPerspectiveList(nl); + + assertEquals(2, list.size()); + assertEquals("P1", list.get(0).name()); + assertEquals("P2", list.get(1).name()); + } + } + + @Nested + class PerspectiveActionTests { + + @Test + void getPerspectiveAction_withActionID() throws Exception { + String xml = "action-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveAction action = PerspectiveConverter.getPerspectiveAction(nl); + + assertNotNull(action); + assertEquals("action-123", action.actionID()); + } + + @Test + void getPerspectiveActionList_multipleItems() throws Exception { + String xml = "a1a2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = PerspectiveConverter.getPerspectiveActionList(nl); + + assertEquals(2, list.size()); + } + } + + @Nested + class PerspectiveKpiTests { + + @Test + void getPerspectiveKpi_withKpiID() throws Exception { + String xml = "kpi-456"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveKpi kpi = PerspectiveConverter.getPerspectiveKpi(nl); + + assertNotNull(kpi); + assertEquals("kpi-456", kpi.kpiID()); + } + } + + @Nested + class PerspectiveCalculationTests { + + @Test + void getPerspectiveCalculation_withNameAndType() throws Exception { + String xml = "CalcMemberMember"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveCalculation calc = PerspectiveConverter.getPerspectiveCalculation(nl); + + assertNotNull(calc); + assertEquals("CalcMember", calc.name()); + assertEquals("Member", calc.type()); + } + } + + @Nested + class PerspectiveMeasureGroupTests { + + @Test + void getPerspectiveMeasureGroup_withMeasureGroupID() throws Exception { + String xml = "mg-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveMeasureGroup mg = PerspectiveConverter.getPerspectiveMeasureGroup(nl); + + assertNotNull(mg); + assertEquals("mg-1", mg.measureGroupID()); + } + } + + @Nested + class PerspectiveMeasureTests { + + @Test + void getPerspectiveMeasure_withMeasureID() throws Exception { + String xml = "measure-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveMeasure measure = PerspectiveConverter.getPerspectiveMeasure(nl); + + assertNotNull(measure); + assertEquals("measure-1", measure.measureID()); + } + } + + @Nested + class PerspectiveDimensionTests { + + @Test + void getPerspectiveDimension_withCubeDimensionID() throws Exception { + String xml = "dim-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveDimension dim = PerspectiveConverter.getPerspectiveDimension(nl); + + assertNotNull(dim); + assertEquals("dim-1", dim.cubeDimensionID()); + } + } + + @Nested + class PerspectiveHierarchyTests { + + @Test + void getPerspectiveHierarchy_withHierarchyID() throws Exception { + String xml = "hier-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveHierarchy hierarchy = PerspectiveConverter.getPerspectiveHierarchy(nl); + + assertNotNull(hierarchy); + assertEquals("hier-1", hierarchy.hierarchyID()); + } + } + + @Nested + class PerspectiveAttributeTests { + + @Test + void getPerspectiveAttribute_withAttributeID() throws Exception { + String xml = "attr-1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveAttribute attr = PerspectiveConverter.getPerspectiveAttribute(nl); + + assertNotNull(attr); + assertEquals("attr-1", attr.attributeID()); + } + + @Test + void getPerspectiveAttribute_withAttributeHierarchyVisible() throws Exception { + String xml = "attr-1true"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveAttribute attr = PerspectiveConverter.getPerspectiveAttribute(nl); + + assertTrue(attr.attributeHierarchyVisible().isPresent()); + assertTrue(attr.attributeHierarchyVisible().get()); + } + + @Test + void getPerspectiveAttribute_withDefaultMember() throws Exception { + String xml = "attr-1[Product].[All]"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + PerspectiveAttribute attr = PerspectiveConverter.getPerspectiveAttribute(nl); + + assertTrue(attr.defaultMember().isPresent()); + assertEquals("[Product].[All]", attr.defaultMember().get()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/RoleConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/RoleConverterTest.java new file mode 100644 index 0000000..46c4570 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/RoleConverterTest.java @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Member; +import org.eclipse.daanse.xmla.api.xmla.Role; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.RoleConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class RoleConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class RoleTests { + + @Test + void getRole_withName() throws Exception { + String xml = "AdminRole"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Role role = RoleConverter.getRole(nl); + + assertNotNull(role); + assertEquals("AdminRole", role.name()); + } + + @Test + void getRole_withId() throws Exception { + String xml = "Testrole-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Role role = RoleConverter.getRole(nl); + + assertTrue(role.id().isPresent()); + assertEquals("role-123", role.id().get()); + } + + @Test + void getRole_withDescription() throws Exception { + String xml = "TestA test role"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Role role = RoleConverter.getRole(nl); + + assertTrue(role.description().isPresent()); + assertEquals("A test role", role.description().get()); + } + + @Test + void getRole_withMembers() throws Exception { + String xml = "TestUser1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Role role = RoleConverter.getRole(nl); + + assertTrue(role.members().isPresent()); + assertEquals(1, role.members().get().size()); + } + + @Test + void getRoleList_multipleItems() throws Exception { + String xml = "Role1" + + "Role2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = RoleConverter.getRoleList(nl, "Role"); + + assertEquals(2, list.size()); + assertEquals("Role1", list.get(0).name()); + assertEquals("Role2", list.get(1).name()); + } + } + + @Nested + class MemberTests { + + @Test + void getMember_withName() throws Exception { + String xml = "JohnDoe"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Member member = RoleConverter.getMember(nl); + + assertNotNull(member); + assertTrue(member.name().isPresent()); + assertEquals("JohnDoe", member.name().get()); + } + + @Test + void getMember_withSid() throws Exception { + String xml = "TestS-1-5-21-123456789"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Member member = RoleConverter.getMember(nl); + + assertTrue(member.sid().isPresent()); + assertEquals("S-1-5-21-123456789", member.sid().get()); + } + + @Test + void getMemberList_multipleItems() throws Exception { + String xml = "User1" + + "User2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = RoleConverter.getMemberList(nl); + + assertEquals(2, list.size()); + assertTrue(list.get(0).name().isPresent()); + assertEquals("User1", list.get(0).name().get()); + assertTrue(list.get(1).name().isPresent()); + assertEquals("User2", list.get(1).name().get()); + } + + @Test + void getMember_empty() throws Exception { + String xml = ""; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Member member = RoleConverter.getMember(nl); + + assertNotNull(member); + assertFalse(member.name().isPresent()); + assertFalse(member.sid().isPresent()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ServerConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ServerConverterTest.java new file mode 100644 index 0000000..4217441 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/ServerConverterTest.java @@ -0,0 +1,256 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Assembly; +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.Server; +import org.eclipse.daanse.xmla.api.xmla.ServerProperty; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.ServerConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class ServerConverterTest { + + private DocumentBuilder documentBuilder; + private Function mockCommandParser; + private Function> mockAssemblySupplier; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + + // Simple mocks that return null/empty - sufficient for basic field tests + mockCommandParser = _ -> null; + mockAssemblySupplier = _ -> new ArrayList<>(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class ServerTests { + + @Test + void getServer_withNameAndId() throws Exception { + String xml = "TestServersrv-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertNotNull(server); + assertEquals("TestServer", server.name()); + assertEquals("srv-123", server.id()); + } + + @Test + void getServer_withProductName() throws Exception { + String xml = "TestMicrosoft Analysis Services"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("Microsoft Analysis Services", server.productName()); + } + + @Test + void getServer_withEdition() throws Exception { + String xml = "TestEnterprise Edition (64-bit)"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("Enterprise Edition (64-bit)", server.edition()); + } + + @Test + void getServer_withEditionID() throws Exception { + String xml = "Test1"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals(1L, server.editionID()); + } + + @Test + void getServer_withVersion() throws Exception { + String xml = "Test15.0.35.39"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("15.0.35.39", server.version()); + } + + @Test + void getServer_withServerMode() throws Exception { + String xml = "TestMultidimensional"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("Multidimensional", server.serverMode()); + } + + @Test + void getServer_withProductLevel() throws Exception { + String xml = "TestSP2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("SP2", server.productLevel()); + } + + @Test + void getServer_withDefaultCompatibilityLevel() throws Exception { + String xml = "Test1500"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals(1500L, server.defaultCompatibilityLevel()); + } + + @Test + void getServer_withSupportedCompatibilityLevels() throws Exception { + String xml = "Test1100,1103,1200,1400,1500"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Server server = ServerConverter.getServer(nl, mockCommandParser, mockAssemblySupplier); + + assertEquals("1100,1103,1200,1400,1500", server.supportedCompatibilityLevels()); + } + } + + @Nested + class ServerPropertyTests { + + @Test + void getServerProperty_withName() throws Exception { + String xml = "MaxConnections"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertNotNull(prop); + assertEquals("MaxConnections", prop.name()); + } + + @Test + void getServerProperty_withValue() throws Exception { + String xml = "Test100"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertEquals("100", prop.value()); + } + + @Test + void getServerProperty_withRequiresRestart() throws Exception { + String xml = "Testtrue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertTrue(prop.requiresRestart()); + } + + @Test + void getServerProperty_withPendingValue() throws Exception { + String xml = "Test200"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertEquals("200", prop.pendingValue()); + } + + @Test + void getServerProperty_withDefaultValue() throws Exception { + String xml = "Test50"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertEquals("50", prop.defaultValue()); + } + + @Test + void getServerProperty_withDisplayFlag() throws Exception { + String xml = "Testtrue"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertTrue(prop.displayFlag()); + } + + @Test + void getServerProperty_withType() throws Exception { + String xml = "Testinteger"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ServerProperty prop = ServerConverter.getServerProperty(nl); + + assertEquals("integer", prop.type()); + } + + @Test + void getServerPropertyList_multipleItems() throws Exception { + String xml = "Prop1" + + "Prop2"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + List list = ServerConverter.getServerPropertyList(nl); + + assertEquals(2, list.size()); + assertEquals("Prop1", list.get(0).name()); + assertEquals("Prop2", list.get(1).name()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/TraceEventConverterTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/TraceEventConverterTest.java new file mode 100644 index 0000000..0f48482 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/TraceEventConverterTest.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.BoolBinop; +import org.eclipse.daanse.xmla.api.xmla.Event; +import org.eclipse.daanse.xmla.api.xmla.EventType; +import org.eclipse.daanse.xmla.api.xmla.NotType; +import org.eclipse.daanse.xmla.api.xmla.Trace; +import org.eclipse.daanse.xmla.api.xmla.TraceFilter; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter.TraceEventConverter; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class TraceEventConverterTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class TraceTests { + + @Test + void getTrace_withLogFileName() throws Exception { + String xml = "/var/log/trace.log"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Trace trace = TraceEventConverter.getTrace(nl); + + assertNotNull(trace); + assertEquals("/var/log/trace.log", trace.logFileName()); + } + + @Test + void getTrace_withAuditTrue() throws Exception { + String xml = "true"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Trace trace = TraceEventConverter.getTrace(nl); + + assertTrue(trace.audit()); + } + + @Test + void getTrace_withLogFileSize() throws Exception { + String xml = "1024000"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Trace trace = TraceEventConverter.getTrace(nl); + + assertEquals(1024000L, trace.logFileSize()); + } + } + + @Nested + class TraceFilterTests { + + @Test + void getTraceFilter_withEqual() throws Exception { + String xml = "col1test"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TraceFilter filter = TraceEventConverter.getTraceFilter(nl); + + assertNotNull(filter); + assertNotNull(filter.isEqual()); + assertEquals("col1", filter.isEqual().columnID()); + assertEquals("test", filter.isEqual().value()); + } + + @Test + void getTraceFilter_withNotEqual() throws Exception { + String xml = "col2excluded"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TraceFilter filter = TraceEventConverter.getTraceFilter(nl); + + assertNotNull(filter.notEqual()); + assertEquals("col2", filter.notEqual().columnID()); + } + + @Test + void getTraceFilter_withLike() throws Exception { + String xml = "name%pattern%"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + TraceFilter filter = TraceEventConverter.getTraceFilter(nl); + + assertNotNull(filter.like()); + assertEquals("%pattern%", filter.like().value()); + } + } + + @Nested + class BoolBinopTests { + + @Test + void getBoolBinop_withColumnIDAndValue() throws Exception { + String xml = "testColtestVal"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + BoolBinop binop = TraceEventConverter.getBoolBinop(nl); + + assertNotNull(binop); + assertEquals("testCol", binop.columnID()); + assertEquals("testVal", binop.value()); + } + } + + @Nested + class EventTests { + + @Test + void getEvent_withEventID() throws Exception { + String xml = "evt-123"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Event event = TraceEventConverter.getEvent(nl); + + assertNotNull(event); + assertEquals("evt-123", event.eventID()); + } + } + + @Nested + class EventTypeTests { + + @Test + void getEventType_empty() throws Exception { + String xml = ""; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + EventType eventType = TraceEventConverter.getEventType(nl); + + assertNotNull(eventType); + } + } + + @Nested + class NotTypeTests { + + @Test + void getNotType_withEqual() throws Exception { + String xml = "colval"; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + NotType notType = TraceEventConverter.getNotType(nl); + + assertNotNull(notType); + assertNotNull(notType.isEqual()); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandParserTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandParserTest.java new file mode 100644 index 0000000..00d5dc2 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/execute/converter/CommandParserTest.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.execute.converter; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.StringReader; +import java.math.BigInteger; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.daanse.xmla.api.xmla.Command; +import org.eclipse.daanse.xmla.api.xmla.ObjectReference; +import org.eclipse.daanse.xmla.model.record.xmla.CancelR; +import org.eclipse.daanse.xmla.model.record.xmla.ClearCacheR; +import org.eclipse.daanse.xmla.model.record.xmla.StatementR; +import org.eclipse.daanse.xmla.server.adapter.soapmessage.XmlaParseException; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +class CommandParserTest { + + private DocumentBuilder documentBuilder; + + @BeforeEach + void setUp() throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + documentBuilder = factory.newDocumentBuilder(); + } + + private Document parseXml(String xml) throws Exception { + return documentBuilder.parse(new InputSource(new StringReader(xml))); + } + + @Nested + class StatementCommand { + + @Test + void getCommand_statementCommand() throws Exception { + Document doc = parseXml("SELECT * FROM table"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getCommand(nl, null); + + assertNotNull(command); + assertInstanceOf(StatementR.class, command); + StatementR statement = (StatementR) command; + assertEquals("SELECT * FROM table", statement.statement()); + } + + @Test + void getCommand_statementWithMdxQuery() throws Exception { + Document doc = parseXml( + "SELECT [Measures].Members ON COLUMNS FROM [Sales]"); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getCommand(nl, null); + + assertInstanceOf(StatementR.class, command); + assertEquals("SELECT [Measures].Members ON COLUMNS FROM [Sales]", ((StatementR) command).statement()); + } + } + + @Nested + class CancelCommand { + + @Test + void getCancelCommand_allFields() throws Exception { + String xml = """ + + 123 + session-abc-123 + 456 + true + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getCancelCommand(nl); + + assertInstanceOf(CancelR.class, command); + CancelR cancel = (CancelR) command; + assertEquals(BigInteger.valueOf(123), cancel.connectionID()); + assertEquals("session-abc-123", cancel.sessionID()); + assertEquals(BigInteger.valueOf(456), cancel.spid()); + assertTrue(cancel.cancelAssociated()); + } + + @Test + void getCancelCommand_minimalFields() throws Exception { + String xml = """ + + my-session + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getCancelCommand(nl); + + assertInstanceOf(CancelR.class, command); + CancelR cancel = (CancelR) command; + assertNull(cancel.connectionID()); + assertEquals("my-session", cancel.sessionID()); + assertNull(cancel.spid()); + assertNull(cancel.cancelAssociated()); + } + + @Test + void getCommand_cancelFromNode() throws Exception { + String xml = """ + + + test-session + + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getCommand(nl, null); + + assertInstanceOf(CancelR.class, command); + } + } + + @Nested + class ClearCacheCommand { + + @Test + void getClearCacheCommand_withObject() throws Exception { + String xml = """ + + + AdventureWorks + Sales + + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getClearCacheCommand(nl); + + assertInstanceOf(ClearCacheR.class, command); + ClearCacheR clearCache = (ClearCacheR) command; + assertNotNull(clearCache.object()); + assertEquals("AdventureWorks", clearCache.object().databaseID()); + assertEquals("Sales", clearCache.object().cubeID()); + } + + @Test + void getClearCacheCommand_emptyObject() throws Exception { + String xml = ""; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getClearCacheCommand(nl); + + assertInstanceOf(ClearCacheR.class, command); + ClearCacheR clearCache = (ClearCacheR) command; + assertNull(clearCache.object()); + } + + @Test + void getCommand_clearCacheFromNode() throws Exception { + String xml = """ + + + + TestDB + + + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + Command command = CommandParser.getCommand(nl, null); + + assertInstanceOf(ClearCacheR.class, command); + } + } + + @Nested + class ObjectReferenceParsing { + + @Test + void getObjectReference_allFields() throws Exception { + String xml = """ + + server1 + db1 + role1 + trace1 + assembly1 + dim1 + dimPerm1 + ds1 + dsPerm1 + dbPerm1 + dsv1 + cube1 + mining1 + mg1 + persp1 + cubePerm1 + mdx1 + part1 + agg1 + model1 + modelPerm1 + structPerm1 + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ObjectReference ref = CommandParser.getObjectReference(nl); + + assertNotNull(ref); + assertEquals("server1", ref.serverID()); + assertEquals("db1", ref.databaseID()); + assertEquals("role1", ref.roleID()); + assertEquals("trace1", ref.traceID()); + assertEquals("assembly1", ref.assemblyID()); + assertEquals("dim1", ref.dimensionID()); + assertEquals("dimPerm1", ref.dimensionPermissionID()); + assertEquals("ds1", ref.dataSourceID()); + assertEquals("dsPerm1", ref.dataSourcePermissionID()); + assertEquals("dbPerm1", ref.databasePermissionID()); + assertEquals("dsv1", ref.dataSourceViewID()); + assertEquals("cube1", ref.cubeID()); + assertEquals("mining1", ref.miningStructureID()); + assertEquals("mg1", ref.measureGroupID()); + assertEquals("persp1", ref.perspectiveID()); + assertEquals("cubePerm1", ref.cubePermissionID()); + assertEquals("mdx1", ref.mdxScriptID()); + assertEquals("part1", ref.partitionID()); + assertEquals("agg1", ref.aggregationDesignID()); + assertEquals("model1", ref.miningModelID()); + assertEquals("modelPerm1", ref.miningModelPermissionID()); + assertEquals("structPerm1", ref.miningStructurePermissionID()); + } + + @Test + void getObjectReference_minimalFields() throws Exception { + String xml = """ + + TestDatabase + + """; + Document doc = parseXml(xml); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + ObjectReference ref = CommandParser.getObjectReference(nl); + + assertNotNull(ref); + assertEquals("TestDatabase", ref.databaseID()); + assertNull(ref.serverID()); + assertNull(ref.cubeID()); + } + } + + @Nested + class EdgeCases { + + @Test + void getCommand_unknownCommandReturnsNull() throws Exception { + Document doc = parseXml("data"); + org.w3c.dom.Node node = doc.getDocumentElement().getFirstChild(); + + Command command = CommandParser.getCommand(node, null); + + assertNull(command); + } + + @Test + void getCommand_emptyNodeListThrowsException() throws Exception { + Document doc = parseXml(""); + NodeList nl = doc.getDocumentElement().getChildNodes(); + + assertThrows(XmlaParseException.class, () -> { + CommandParser.getCommand(nl, null); + }); + } + } +} diff --git a/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionHeaderParserTest.java b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionHeaderParserTest.java new file mode 100644 index 0000000..fb7d1e8 --- /dev/null +++ b/server/adapter.soapmessage/src/test/java/org/eclipse/daanse/xmla/server/adapter/soapmessage/session/SessionHeaderParserTest.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2023 Contributors to the Eclipse Foundation. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * SmartCity Jena - initial + * Stefan Bischof (bipolis.org) - initial + */ +package org.eclipse.daanse.xmla.server.adapter.soapmessage.session; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.Optional; + +import org.eclipse.daanse.xmla.api.xmla.BeginSession; +import org.eclipse.daanse.xmla.api.xmla.EndSession; +import org.eclipse.daanse.xmla.api.xmla.Session; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPHeader; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +class SessionHeaderParserTest { + + private static final String XMLA_NS = "urn:schemas-microsoft-com:xml-analysis"; + + private SOAPMessage soapMessage; + private SOAPHeader soapHeader; + + @BeforeEach + void setUp() throws Exception { + MessageFactory factory = MessageFactory.newInstance(); + soapMessage = factory.createMessage(); + SOAPPart soapPart = soapMessage.getSOAPPart(); + SOAPEnvelope envelope = soapPart.getEnvelope(); + soapHeader = envelope.getHeader(); + } + + @Nested + class SessionParsing { + + @Test + void getSession_withSessionIdAndMustUnderstand() throws Exception { + SOAPElement sessionElement = soapHeader.addChildElement("Session", "xmla", XMLA_NS); + sessionElement.setAttribute("SessionId", "session-12345"); + sessionElement.setAttribute("mustUnderstand", "1"); + + Optional result = SessionHeaderParser.getSession(soapHeader); + + assertTrue(result.isPresent()); + Session session = result.get(); + assertEquals("session-12345", session.sessionId()); + assertEquals(Integer.valueOf(1), session.mustUnderstand()); + } + + @Test + void getSession_withSessionIdOnly() throws Exception { + SOAPElement sessionElement = soapHeader.addChildElement("Session", "xmla", XMLA_NS); + sessionElement.setAttribute("SessionId", "my-session"); + + Optional result = SessionHeaderParser.getSession(soapHeader); + + assertTrue(result.isPresent()); + Session session = result.get(); + assertEquals("my-session", session.sessionId()); + assertNull(session.mustUnderstand()); + } + + @Test + void getSession_noSessionElement() throws Exception { + Optional result = SessionHeaderParser.getSession(soapHeader); + + assertFalse(result.isPresent()); + } + + @Test + void getSession_emptySessionElement() throws Exception { + soapHeader.addChildElement("Session", "xmla", XMLA_NS); + + Optional result = SessionHeaderParser.getSession(soapHeader); + + assertTrue(result.isPresent()); + Session session = result.get(); + assertNull(session.sessionId()); + assertNull(session.mustUnderstand()); + } + } + + @Nested + class BeginSessionParsing { + + @Test + void getBeginSession_withMustUnderstand() throws Exception { + SOAPElement beginSessionElement = soapHeader.addChildElement("BeginSession", "xmla", XMLA_NS); + beginSessionElement.setAttribute("mustUnderstand", "1"); + + Optional result = SessionHeaderParser.getBeginSession(soapHeader); + + assertTrue(result.isPresent()); + BeginSession beginSession = result.get(); + assertEquals(Integer.valueOf(1), beginSession.mustUnderstand()); + } + + @Test + void getBeginSession_withoutMustUnderstand() throws Exception { + soapHeader.addChildElement("BeginSession", "xmla", XMLA_NS); + + Optional result = SessionHeaderParser.getBeginSession(soapHeader); + + assertTrue(result.isPresent()); + BeginSession beginSession = result.get(); + assertNull(beginSession.mustUnderstand()); + } + + @Test + void getBeginSession_noBeginSessionElement() throws Exception { + Optional result = SessionHeaderParser.getBeginSession(soapHeader); + + assertFalse(result.isPresent()); + } + } + + @Nested + class EndSessionParsing { + + @Test + void getEndSession_withSessionIdAndMustUnderstand() throws Exception { + SOAPElement endSessionElement = soapHeader.addChildElement("EndSession", "xmla", XMLA_NS); + endSessionElement.setAttribute("SessionId", "session-to-end"); + endSessionElement.setAttribute("mustUnderstand", "1"); + + Optional result = SessionHeaderParser.getEndSession(soapHeader); + + assertTrue(result.isPresent()); + EndSession endSession = result.get(); + assertEquals("session-to-end", endSession.sessionId()); + assertEquals(Integer.valueOf(1), endSession.mustUnderstand()); + } + + @Test + void getEndSession_withSessionIdOnly() throws Exception { + SOAPElement endSessionElement = soapHeader.addChildElement("EndSession", "xmla", XMLA_NS); + endSessionElement.setAttribute("SessionId", "my-ending-session"); + + Optional result = SessionHeaderParser.getEndSession(soapHeader); + + assertTrue(result.isPresent()); + EndSession endSession = result.get(); + assertEquals("my-ending-session", endSession.sessionId()); + assertNull(endSession.mustUnderstand()); + } + + @Test + void getEndSession_noEndSessionElement() throws Exception { + Optional result = SessionHeaderParser.getEndSession(soapHeader); + + assertFalse(result.isPresent()); + } + } + + @Nested + class MultipleHeaders { + + @Test + void getSession_withOtherElements() throws Exception { + // Add other header elements that should be ignored + soapHeader.addChildElement("OtherHeader", "other", "http://other.namespace"); + SOAPElement sessionElement = soapHeader.addChildElement("Session", "xmla", XMLA_NS); + sessionElement.setAttribute("SessionId", "target-session"); + soapHeader.addChildElement("AnotherHeader", "another", "http://another.namespace"); + + Optional result = SessionHeaderParser.getSession(soapHeader); + + assertTrue(result.isPresent()); + assertEquals("target-session", result.get().sessionId()); + } + + @Test + void multipleSessionTypes_onlyReturnsRequested() throws Exception { + // Add all three types + SOAPElement beginElement = soapHeader.addChildElement("BeginSession", "xmla", XMLA_NS); + beginElement.setAttribute("mustUnderstand", "1"); + + SOAPElement sessionElement = soapHeader.addChildElement("Session", "xmla", XMLA_NS); + sessionElement.setAttribute("SessionId", "active-session"); + + SOAPElement endElement = soapHeader.addChildElement("EndSession", "xmla", XMLA_NS); + endElement.setAttribute("SessionId", "ending-session"); + + // Verify each parser only returns its type + Optional beginResult = SessionHeaderParser.getBeginSession(soapHeader); + Optional sessionResult = SessionHeaderParser.getSession(soapHeader); + Optional endResult = SessionHeaderParser.getEndSession(soapHeader); + + assertTrue(beginResult.isPresent()); + assertTrue(sessionResult.isPresent()); + assertTrue(endResult.isPresent()); + + assertEquals(Integer.valueOf(1), beginResult.get().mustUnderstand()); + assertEquals("active-session", sessionResult.get().sessionId()); + assertEquals("ending-session", endResult.get().sessionId()); + } + } +} diff --git a/server/jakarta.jws/src/main/java/org/eclipse/daanse/xmla/server/jakarta/jws/Convert.java b/server/jakarta.jws/src/main/java/org/eclipse/daanse/xmla/server/jakarta/jws/Convert.java index a319e74..d240ced 100644 --- a/server/jakarta.jws/src/main/java/org/eclipse/daanse/xmla/server/jakarta/jws/Convert.java +++ b/server/jakarta.jws/src/main/java/org/eclipse/daanse/xmla/server/jakarta/jws/Convert.java @@ -403,6 +403,7 @@ public static DiscoverResponse toDiscoverDbSchemaCatalogs(List iterable = () -> soapMessage.getMimeHeaders().getAllHeaders(); Map map = StreamSupport.stream(iterable.spliterator(), true).collect( - Collectors.toMap(MimeHeader::getName, MimeHeader::getValue, (oldValue, newValue) -> oldValue)); + Collectors.toMap(MimeHeader::getName, MimeHeader::getValue, (oldValue, _) -> oldValue)); SOAPMessage returnMessage = xmlaAdapter.handleRequest(soapMessage, map, principal, isUserInRoleFunction, url); @@ -73,7 +73,7 @@ public SOAPMessage onMessage(SOAPMessage soapMessage,Principal principal, Functi return returnMessage; } catch (Exception e) { - e.printStackTrace(); + LOGGER.error("Error processing SOAP message", e); return null; } } diff --git a/server/jakarta.saaj/test.bndrun b/server/jakarta.saaj/test.bndrun index cc23db6..ca4fd4a 100644 --- a/server/jakarta.saaj/test.bndrun +++ b/server/jakarta.saaj/test.bndrun @@ -21,9 +21,6 @@ org.slf4j.simpleLogger.defaultLogLevel=debug,\ org.osgi.service.http.port=8090 -port : 17290 --runproperties.local.agent : osgi.fx.agent.port=0.0.0.0:${port} - -runrequires: \ bnd.identity;id='${project.artifactId}-tests',\ bnd.identity;id='${project.artifactId}',\ @@ -34,8 +31,7 @@ port : 17290 bnd.identity;id='org.eclipse.daanse.xmla.server.tck' -runee: JavaSE-25 -#-runfw: org.apache.felix.framework --runfw: org.eclipse.osgi +-runfw: org.apache.felix.framework # This will help us keep -runbundles sorted -runstartlevel: \ @@ -43,6 +39,7 @@ port : 17290 begin=-1 # The following is calculated by the bnd-resolver-maven-plugin + -runbundles: \ assertj-core;version='[3.26.0,3.26.1)',\ ch.qos.logback.classic;version='[1.5.6,1.5.7)',\ @@ -61,14 +58,13 @@ port : 17290 junit-platform-launcher;version='[1.12.2,1.12.3)',\ net.bytebuddy.byte-buddy;version='[1.17.5,1.17.6)',\ net.bytebuddy.byte-buddy-agent;version='[1.17.5,1.17.6)',\ - org.apache.aries.spifly.dynamic.framework.extension;version='[1.3.7,1.3.8)',\ - org.apache.commons.commons-fileupload;version='[1.5.0,1.5.1)',\ - org.apache.commons.commons-io;version='[2.11.0,2.11.1)',\ + org.apache.aries.spifly.dynamic.bundle;version='[1.3.7,1.3.8)',\ + org.apache.commons.commons-fileupload;version='[1.6.0,1.6.1)',\ + org.apache.commons.commons-io;version='[2.19.0,2.19.1)',\ org.apache.felix.configadmin;version='[1.9.26,1.9.27)',\ - org.apache.felix.http.jetty12.light;version='[1.0.2,1.0.3)',\ + org.apache.felix.http.jetty12;version='[1.1.6,1.1.7)',\ org.apache.felix.http.servlet-api;version='[3.0.0,3.0.1)',\ org.apache.felix.scr;version='[2.2.10,2.2.11)',\ - org.apache.tomcat-servlet-api;version='[9.0.80,9.0.81)',\ org.eclipse.daanse.jakarta.servlet.soap;version='[0.0.1,0.0.2)',\ org.eclipse.daanse.xmla.api;version='[0.0.1,0.0.2)',\ org.eclipse.daanse.xmla.model.record;version='[0.0.1,0.0.2)',\ @@ -76,18 +72,6 @@ port : 17290 org.eclipse.daanse.xmla.server.jakarta.saaj;version='[0.0.1,0.0.2)',\ org.eclipse.daanse.xmla.server.jakarta.saaj-tests;version='[0.0.1,0.0.2)',\ org.eclipse.daanse.xmla.server.tck;version='[0.0.1,0.0.2)',\ - org.eclipse.jetty.alpn.server;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.ee10.servlet;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.http;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.http2.common;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.http2.hpack;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.http2.server;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.io;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.jmx;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.security;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.server;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.session;version='[12.0.5,12.0.6)',\ - org.eclipse.jetty.util;version='[12.0.5,12.0.6)',\ org.glassfish.hk2.osgi-resource-locator;version='[2.4.0,2.4.1)',\ org.jvnet.staxex.stax-ex;version='[2.1.0,2.1.1)',\ org.mockito.mockito-core;version='[4.9.0,4.9.1)',\ diff --git a/server/jakarta.xml.ws.provider.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/jakarta/xml/ws/provider/soapmessage/XmlaWebserviceProvider.java b/server/jakarta.xml.ws.provider.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/jakarta/xml/ws/provider/soapmessage/XmlaWebserviceProvider.java index 16051e2..1a03d99 100644 --- a/server/jakarta.xml.ws.provider.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/jakarta/xml/ws/provider/soapmessage/XmlaWebserviceProvider.java +++ b/server/jakarta.xml.ws.provider.soapmessage/src/main/java/org/eclipse/daanse/xmla/server/jakarta/xml/ws/provider/soapmessage/XmlaWebserviceProvider.java @@ -13,18 +13,8 @@ */ package org.eclipse.daanse.xmla.server.jakarta.xml.ws.provider.soapmessage; -import jakarta.annotation.Resource; -import jakarta.xml.soap.SOAPConstants; -import jakarta.xml.soap.SOAPException; -import jakarta.xml.soap.SOAPFactory; -import jakarta.xml.soap.SOAPFault; -import jakarta.xml.soap.SOAPMessage; -import jakarta.xml.ws.Provider; -import jakarta.xml.ws.Service; -import jakarta.xml.ws.ServiceMode; -import jakarta.xml.ws.WebServiceContext; -import jakarta.xml.ws.WebServiceProvider; -import jakarta.xml.ws.handler.MessageContext; +import java.util.Map; + //import org.eclipse.daanse.jakarta.xml.ws.api.whiteboard.annotations.RequireSoapWhiteboard; //import org.eclipse.daanse.jakarta.xml.ws.api.whiteboard.prototypes.SOAPWhiteboardEndpoint; import org.eclipse.daanse.xmla.api.XmlaService; @@ -38,7 +28,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Map; +import jakarta.annotation.Resource; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.ws.Provider; +import jakarta.xml.ws.Service; +import jakarta.xml.ws.ServiceMode; +import jakarta.xml.ws.WebServiceContext; +import jakarta.xml.ws.WebServiceProvider; +import jakarta.xml.ws.handler.MessageContext; @WebServiceProvider() @ServiceMode(value = Service.Mode.MESSAGE) @@ -48,7 +45,7 @@ //@SOAPWhiteboardEndpoint(contextpath = "xmla") public class XmlaWebserviceProvider implements Provider { private static final Logger LOGGER = LoggerFactory.getLogger(XmlaWebserviceProvider.class); - private static final String USER_AGENT = "User-agent"; +// private static final String USER_AGENT = "User-agent"; @ObjectClassDefinition() @interface Config { @@ -72,22 +69,23 @@ public void activate() { @Override public SOAPMessage invoke(SOAPMessage request) { - Map headers = (Map) context.getMessageContext() - .get(MessageContext.HTTP_REQUEST_HEADERS); + Object o = context.getMessageContext().get(MessageContext.HTTP_REQUEST_HEADERS); + @SuppressWarnings("unchecked") + Map headers = (Map) o; LOGGER.debug("===== The provider got a request ====="); - return wsAdapter.handleRequest(request, headers,null,null, null); + return wsAdapter.handleRequest(request, headers, null, null, null); } - private SOAPFault getFault(Exception ex) { - try { - SOAPFault fault = SOAPFactory.newInstance().createFault(); - fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT); - fault.setFaultString(ex.toString()); - return fault; - } catch (SOAPException e) { - throw new IllegalStateException(e); - } - } +// private SOAPFault getFault(Exception ex) { +// try { +// SOAPFault fault = SOAPFactory.newInstance().createFault(); +// fault.setFaultCode(SOAPConstants.SOAP_SENDER_FAULT); +// fault.setFaultString(ex.toString()); +// return fault; +// } catch (SOAPException e) { +// throw new IllegalStateException(e); +// } +// } } diff --git a/server/tck/src/main/java/org/eclipse/daanse/xmla/server/tck/Constants.java b/server/tck/src/main/java/org/eclipse/daanse/xmla/server/tck/Constants.java index 25f03a5..84deed0 100644 --- a/server/tck/src/main/java/org/eclipse/daanse/xmla/server/tck/Constants.java +++ b/server/tck/src/main/java/org/eclipse/daanse/xmla/server/tck/Constants.java @@ -22,7 +22,7 @@ private Constants() { public static final String XMLASERVICE_FILTER_KEY = "type"; public static final String XMLASERVICE_FILTER_VALUE = "mock"; - @SuppressWarnings("java:S1075") + public static final String WS_PATH = "/xmla"; public static final String SERVER_PORT_WHITEBOARD = "8090";