diff --git a/CODEOWNERS b/CODEOWNERS index 78d8a85389c..894e955395a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -17,7 +17,6 @@ open-metadata-distribution/ @mandy-chessell @planetf1 open-metadata-implementation/ @mandy-chessell open-metadata-implementation/access-services/ @mandy-chessell -open-metadata-implementation/access-services/analytics-modeling/ @mandy-chessell open-metadata-implementation/access-services/asset-catalog/ @alexandra-bucur @lcpopa open-metadata-implementation/access-services/asset-consumer/ @mandy-chessell open-metadata-implementation/access-services/asset-lineage/ @lcpopa @popa-raluca @@ -77,7 +76,6 @@ open-metadata-resources/open-metadata-samples/access-services-samples/subject-ar open-metadata-test/ @mandy-chessell open-metadata-test/open-metadata-fvt/ @planetf1 @mandy-chessell open-metadata-test/open-metadata-fvt/access-services-fvt/ @planetf1 @mandy-chessell -open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/ @mandy-chessell open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/ @mandy-chessell open-metadata-test/open-metadata-fvt/access-services-fvt/asset-manager-fvt/ @mandy-chessell open-metadata-test/open-metadata-fvt/access-services-fvt/data-engine-fvt/ @alexandra-bucur @lcpopa diff --git a/Content-Organization.md b/Content-Organization.md index 79d0fb73e04..85354789743 100644 --- a/Content-Organization.md +++ b/Content-Organization.md @@ -18,7 +18,6 @@ The Egeria core repository contains the core Egeria functionality, and is organi * **[open-metadata-implementation](open-metadata-implementation)** - implementation of standards, frameworks and connectors. * **[access-services](open-metadata-implementation/access-services)** - domain specific APIs known as the Open Metadata Access Services (OMAS). - * **[analytics-modeling](open-metadata-implementation/access-services/analytics-modeling)** - manage assets for an analytics platform. * **[asset-catalog](open-metadata-implementation/access-services/asset-catalog)** - search for assets. * **[asset-consumer](open-metadata-implementation/access-services/asset-consumer)** - create connectors to access assets. * **[asset-lineage](open-metadata-implementation/access-services/asset-lineage)** - provide lineage reporting. diff --git a/open-metadata-implementation/access-services/README.md b/open-metadata-implementation/access-services/README.md index 1940be5ec14..ee7d78af61b 100644 --- a/open-metadata-implementation/access-services/README.md +++ b/open-metadata-implementation/access-services/README.md @@ -8,11 +8,6 @@ for data tools, engines and platforms to integrate with open metadata. The access services are as follows: -* **[analytics-modeling](analytics-modeling)** - model analytics and reports. - - The Analytics Modeling OMAS configures and manages metadata for modeling -analytics and reporting services. - * **[asset-catalog](asset-catalog)** - search for assets. The Asset Catalog OMAS provides search and query capabilities for tools and applications diff --git a/open-metadata-implementation/access-services/analytics-modeling/README.md b/open-metadata-implementation/access-services/analytics-modeling/README.md deleted file mode 100644 index bee3ffa41a3..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/README.md +++ /dev/null @@ -1,19 +0,0 @@ - - - - -![InDev](../../../images/egeria-content-status-in-development.png#pagewidth) - -# Analytics Modeling Open Metadata Access Service (OMAS) - -The Analytics Modeling OMAS configures and manages metadata for modeling -analytics and reporting services. - -* [Documentation](https://egeria-project.org/services/omas/analytics-modeling/overview) - ----- -Return to the [access-services](..) module. - ----- -License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), -Copyright Contributors to the ODPi Egeria project. \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/build.gradle b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/build.gradle deleted file mode 100644 index 9b4585c8fab..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright Contributors to the ODPi Egeria project. - */ - - -dependencies { - implementation project(':open-metadata-implementation:common-services:ffdc-services') - implementation project(':open-metadata-implementation:frameworks:open-connector-framework') - implementation project(':open-metadata-implementation:frameworks:audit-log-framework') - compileOnly 'com.fasterxml.jackson.core:jackson-annotations' - implementation 'com.fasterxml.jackson.core:jackson-core' - implementation 'com.fasterxml.jackson.core:jackson-databind' - testImplementation project(':open-metadata-test:open-metadata-ut') - testImplementation 'org.testng:testng' -} - -description = 'Analytics Modeling OMAS API' - -tasks.register('testsJar', Jar) { - archiveClassifier = 'tests' - from(sourceSets.test.output) -} - -//TODO: publishing.publications.maven.artifact(testsJar) - -java { - withJavadocJar() -} - -test { - useTestNG() - // This will default to standard search pattern - see https://docs.gradle.org/current/userguide/java_testing.html#sec:test_detection - scanForTestClasses = false -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/api/AnalyticsModelingImport.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/api/AnalyticsModelingImport.java deleted file mode 100644 index 3c279d37d28..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/api/AnalyticsModelingImport.java +++ /dev/null @@ -1,86 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.api; - - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; - -public interface AnalyticsModelingImport { - - /** - * Get databases available on the server for the user. - * - * @param userId of the user. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of databases for the requested server/user. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public List getDatabases(String userId, int startFrom, int pageSize) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException; - - /** - * Get schema defined by database GUID. - * - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of schemas for the requested database. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public List getSchemas(String userId, String databaseGuid, int startFrom, int pageSize) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException; - - /** - * Get tables for the schema. - * - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param catalog catalog name of the database. - * @param schema schema name on the database. - * @return list of tables for the requested schema. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerSchemaTables getTables(String userId, String databaseGuid, String catalog, String schema) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException; - - /** - * Build module for the schema. - * - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param catalog catalog name of the database. - * @param schema schema name of the database. - * @param request table filter - * @return module for the requested schema. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerModule getModule(String userId, String databaseGuid, String catalog, String schema, ModuleTableFilter request) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException; - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/api/AnalyticsModelingSynchronization.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/api/AnalyticsModelingSynchronization.java deleted file mode 100644 index cf2ccdd3d92..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/api/AnalyticsModelingSynchronization.java +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.api; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; - -public interface AnalyticsModelingSynchronization { - - /** - * Create analytics artifact defined as input. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param artifact definition. - * @return response with artifact or error description. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerAssets createArtifact(String userId, String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException; - - /** - * Update analytics artifact defined as input. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param artifact definition. - * @return response with artifact or error description. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerAssets updateArtifact(String userId, String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException; - - /** - * Delete assets in repository defined by artifact unique identifier. - * @param userId request user - * @param serverCapability where the artifact is stored. - * @param serverCapabilityGUID source where artifact persist. - * @param identifier of the artifact in 3rd party system. - * @return errors or list of created assets. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerAssets deleteArtifact(String userId, String serverCapability, String serverCapabilityGUID, String identifier) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException; - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/ffdc/AnalyticsModelingErrorCode.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/ffdc/AnalyticsModelingErrorCode.java deleted file mode 100644 index 4195165302d..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/ffdc/AnalyticsModelingErrorCode.java +++ /dev/null @@ -1,382 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc; - -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageSet; - -/** - * The AnalyticsModelingErrorCode is definition of the first failure data capture (FFDC) for errors that occur when working with - * the Analytics Modeling OMAS Services. It is used in conjunction with both Checked and Runtime (unchecked) exceptions. - *

- * The fields in the enum are defined in {@link org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition}. - * The object is used to build exception augmented with parameters to identify related context: - *

- */ - -public enum AnalyticsModelingErrorCode implements ExceptionMessageSet { - - ADD_RELATIONSHIP_EXCEPTION( - "OMAS-ANALYTICS-MODELING-001", - "Relationship {0} could not be added.", - "The system is unable to create relationship.", - "Review the exception cause and retry to create the relationship."), - GET_ENTITY_EXCEPTION( - "OMAS-ANALYTICS-MODELING-002", - "Entity matching criteria [{0}={1}] could not be fetched.", - "The system is unable to fetch entity with requested property.", - "Review the exception cause and retry to fetch the entity."), - GET_RELATIONSHIP_EXCEPTION( - "OMAS-ANALYTICS-MODELING-003", - "Relationship {0} for entity {1} could not be fetched. Cause: {2}", - "The system is unable to fetch relationship for entity.", - "Review the exception cause and retry to fetch the relationship."), - SERVICE_NOT_INITIALIZED( - "OMAS-ANALYTICS-MODELING-004", - "The access service has not been initialized for server {0} and can not support REST API calls", - "The server has received a call to one of its open metadata access services but is unable to process it because the access service is not active for the requested server.", - "If the server is supposed to have this access service activated, correct the server configuration and restart the server."), - ENTITY_NOT_FOUND_EXCEPTION(404, - "OMAS-ANALYTICS-MODELING-006", - "The entity with GUID = {0} was not found.", - "The system is unable to find entity with the requested GUID.", - "Review the exception cause and confirm the requested entity exists."), - INCORRECT_MODEL_EXCEPTION( - "OMAS-ANALYTICS-MODELING-007", - "The model for entity {0} is not correct: {1}", - "The system is unable to process the model.", - "Correct the metadata model."), - SCHEMA_UNKNOWN(403, - "OMAS-ANALYTICS-MODELING-010", - "Requested schema {0} does not exist.", - "The system is unable to find requested schema.", - "Review the exception cause and confirm the schema exists."), - UPDATE_PROPERTY_EXCEPTION( - "OMAS-ANALYTICS-MODELING-011", - "Propertyies for entity {0} can not be updated with values {1}.", - "The system is unable to update properties.", - "Review the exception cause to fix problem and retry to update properties."), - CLASSIFICATION_EXCEPTION( - "OMAS-ANALYTICS-MODELING-012", - "Classification for entity {0} failed set classification {1}.", - "The system is unable to process the request.", - "Refresh data."), - ERROR_INITIALIZING_ANALYTICS_MODELING_TOPIC_CONNECTION(400, - "OMAS-ANALYTICS-MODELING-0013", - "Unable to initialize the connection to topic {0} in the Analytics Modeling Open Metadata Access Service (OMAS) instance for server {1} ", - "The connection to Analytics Modeling topic could not be initialized.", - "Review the exception and resolve the connection topic problem."), - SERVICE_INSTANCE_FAILURE( - "OMAS-ANALYTICS-MODELING-014", - "The access service can't find instance for server {0}, user {1}, operation {2}.", - "The system is unable to complete operation on the server.", - "Review the exception and resolve the server configuration. "), - INVALID_REQUEST_PARAMER(400, - "OMAS-ANALYTICS-MODELING-015", - "The request parameter {0} has invalid value.", - "The system is unable to process the request due to invalid parameter.", - "Verify parameter value."), - FAILED_FETCH_DATABASES( - "OMAS-ANALYTICS-MODELING-016", - "Databases could not be fetched.", - "The system failed to find databases.", - "Review the exception to resolve the issue."), - FAILED_FETCH_DATABASE_SCHEMAS( - "OMAS-ANALYTICS-MODELING-017", - "Schemas for database {0} could not be fetched.", - "The system is unable to fetch schemas for database.", - "Review the exception to resolve the issue and validate database GUID."), - UNEXPECTED_CLASS( - "OMAS-ANALYTICS-MODELING-020", - "Unexpected class {0} of the AnalyticsMetadata for entity {1}.", - "The system is unable to create bean for the unexpected class.", - "Fix data in repository. Provide correct class for the entity."), - FAILED_CREATE_BEAN( - "OMAS-ANALYTICS-MODELING-021", - "Failed to create bean of class {0} of the AnalyticsMetadata.", - "The system is unable to create bean for the requested class.", - "Fix data in repository or class path."), - MISSING_BEAN_CLASS( - "OMAS-ANALYTICS-MODELING-022", - "Java class of the AnalyticsMetadata is not defined for entity {0}.", - "The system is unable to create bean without defined class.", - "Fix data in repository. Define class for entity."), - MISSING_BEAN_PROPERTIES( - "OMAS-ANALYTICS-MODELING-023", - "Entity {0} of the AnalyticsMetadata is missing properties.", - "The system is unable process entity without properties.", - "Fix data in repository. Define entity properties."), - FAILED_CREATE_ARTIFACT( - "OMAS-ANALYTICS-MODELING-025", - "Failed to create analytics artifact.", - "The system is unable to create assets for analytics artifact.", - "Review the exception to resolve the issue. Verify artifact definition."), - FAILED_CREATE_SERVER_CAPABILITY( - "OMAS-ANALYTICS-MODELING-026", - "User {0} failed to create server capability {1}. Cause: {2}", - "The system is unable to create server capability.", - "Review the exception to resolve the issue with the server capability."), - FAILED_UPDATE_ARTIFACT( - "OMAS-ANALYTICS-MODELING-027", - "User {0} failed to update artifact {1}. Cause: {2}", - "The system is unable update assets.", - "Review the exception to resolve the issue and repeat request to fix assets for the artifact."), - FAILED_DELETE_ARTIFACT( - "OMAS-ANALYTICS-MODELING-028", - "User {0} failed to delete analytics artifact {1}. Cause: {2}", - "The system is unable to delete asset for the artifact.", - "Review the exception to resolve the issue and repeat request to remove assets for the artifact."), - FAIL_REST_CALL( - "OMAS-ANALYTICS-MODELING-029", - "Rest call {0} failed. Cause: {1}", - "The client is unable to make the REST request.", - "Review the exception to resolve the issue and repeat request."), - UNAUTHORIZED_USER ( - "OMAS-ANALYTICS-MODELING-030", - "User {0} is not authorized to perform operation: {1}", - "The system is unable to process the unauthorized request.", - "Review the user permissions to resolve the issue and repeat request."), - FAILED_UPDATE_UNKNOWN_ARTIFACT(404, - "OMAS-ANALYTICS-MODELING-031", - "User {0} failed to update artifact {1}. The artifact is unknown.", - "The system is unable to update unknown artifact.", - "Confirm the artifact exists."), - FAILED_FIND_ARTIFACT_ASSETS(404, - "OMAS-ANALYTICS-MODELING-032", - "User {0} failed to find assets for analytics artifact {1}. Cause: {2}", - "The system is unable to find asset for the artifact.", - "Review the exception to resolve the issue to remove assets for the artifact."), - MULTIPLE_ASSETS_SAME_QUALIFIEDNAME( - "OMAS-ANALYTICS-MODELING-033", - "Multiple referenced assets have same qualified name {0}", - "The system is unable to uniquely define source of metadata.", - "Resolve ambiguity with assets qualified names."), - FAILED_GET_ASSET_BY_QUALIFIEDNAME( - "OMAS-ANALYTICS-MODELING-034", - "Failed to fetch assets by qualified name {0}. Cause: {1}", - "The system is unable to fetch assets.", - "Review exception message and requested qualified name."), - FAILED_GET_SCHEMA_ATTRIBUTES_BY_QUALIFIEDNAME( - "OMAS-ANALYTICS-MODELING-035", - "Failed to fetch schema attributes by qualified name {0}. Cause: {1}", - "The system is unable to fetch schema attributes.", - "Review exception message and requested qualified name pattern."), - FAILED_GET_SERVER_CAPABILITY_GUID( - "OMAS-ANALYTICS-MODELING-036", - "User {0} failed to retrieve server capability with GUID {1}. Cause: {2}", - "The system is unable to retrieve server capability by GUID.", - "Verify the server capability GUID and access rights."), - FAILED_GET_SERVER_CAPABILITY_NAME( - "OMAS-ANALYTICS-MODELING-037", - "User {0} failed to retrieve server capability with name {1}. Cause: {2}", - "The system is unable to retrieve server capability by name.", - "Verify the server capability name, and access rights."), - - - // information messages codes 200-299, HTTP status 100: Continue. - -// INFO_SAMPLE(100, -// "OMAS-ANALYTICS-MODELING-200", -// "Short description of the state or event.", -// "Description of the state or event from system point of view.", -// "Description of the state or event from user point of view."), - - // warning messages 300-499, HTTP status 206: Partial Content. - - WARNING_TABLE_NO_COLUMNS(206, - "OMAS-ANALYTICS-MODELING-300", - "The tables {0} is excluded from import because it doesn't have any column.", - "Table without columns is not useful. It is excluded from the import to avoid confusion.", - "Review the message and fix the table definition, permissions, etc."), - WARNING_TABLES_NO_COLUMNS(206, - "OMAS-ANALYTICS-MODELING-301", - "Tables {0} are excluded from import because they don't have any column.", - "Tables without columns are not useful. They are excluded from the import to avoid confusion.", - "Review the message and fix the tables definition, permissions, etc."), - TABLE_COLUMN_RELATIONSHIPS_EXCEPTION(206, - "OMAS-ANALYTICS-MODELING-302", - "Failed to get relationships for table {0}.", - "The system is unable to fetch relationships for the table.", - "Review the exception cause to fix table relationships."), - GLOSSARY_TERM_EXCEPTION(206, - "OMAS-ANALYTICS-MODELING-303", - "Failed to get glossary terms for entity {0}.", - "The system is unable to fetch relationships for the entity.", - "Review the exception cause to fix entity relationships."), - BUILD_GLOSSARY_TERM_EXCEPTION(206, - "OMAS-ANALYTICS-MODELING-304", - "Failed to get build glossary terms {0}.", - "The system is unable to build glossary term.", - "Review the exception cause to fix json serialization."), - WARNING_ENTITY_NOT_FOUND(206, - "OMAS-ANALYTICS-MODELING-305", - "The entity with GUID = {0} was not found while loading other object.", - "The system is unable to find entity with the requested GUID while loading other object.", - "The warning may be the cause of the citical error."), - WARNING_FOREIGN_KEY_UNKNOWN_CATALOG(206, - "OMAS-ANALYTICS-MODELING-306", - "The catalog was not found while loading foreign key for column {0}.", - "The system is unable to define foreign key to unknown catalog.", - "This is normal state when target catalog is not imported."), - WARNING_FOREIGN_KEY_UNKNOWN_SCHEMA(206, - "OMAS-ANALYTICS-MODELING-307", - "The schema was not found while loading foreign key for column {0}.", - "The system is unable to define foreign key to unknown schema.", - "This is normal state when target schema is not imported."), - WARNING_FOREIGN_KEY_UNKNOWN_TABLE(206, - "OMAS-ANALYTICS-MODELING-308", - "The table was not found while loading foreign key for column {0}.", - "The system is unable to define foreign key to unknown table.", - "This is normal state when target table is not imported."), - WARNING_COLUMN_NOT_FOUND(206, - "OMAS-ANALYTICS-MODELING-309", - "The column with GUID = {0} was not found.", - "The system is unable to find column with the requested GUID.", - "The warning may be the cause of the missing column."), - WARNING_COLUMN_NO_DATATYPE(206, - "OMAS-ANALYTICS-MODELING-310", - "The column {0} does not have data type.", - "The system is unable to find column data type.", - "Fix the column data type if the column is required."), - WARNING_FOREIGN_KEY(206, - "OMAS-ANALYTICS-MODELING-311", - "Failed to load foreign key for the column {0}.", - "The system is unable to load foreign key from relationship.", - "Review the error message and check foreign key of the column."), - WARNING_UNRESOLVED_REFERENCE(206, - "OMAS-ANALYTICS-MODELING-312", - "Asset {0} has unresolved reference {1}.", - "The system is unable to resolve reference to another asset.", - "Review the error message and validate GUID of the reference."), - WARNING_CREATE_METADATA_LINK(206, - "OMAS-ANALYTICS-MODELING-313", - "Can not create metadata link between item {0} and item {1}.", - "The system is unable to create metadata link.", - "Review the error message and permissions."), - WARNING_UPDATE_METADATA_LINK(206, - "OMAS-ANALYTICS-MODELING-314", - "Can't update metadata links of the item {0}.", - "The system is unable to update metadata link.", - "Review the error message and link existance and permissions."), - WARNING_DELETE_METADATA_LINK(206, - "OMAS-ANALYTICS-MODELING-315", - "Can not delete metadata link {0} of the item {1}.", - "The system is unable to delete metadata link.", - "Review the error message and link existance."), - WARNING_LINKED_ASSET_NO_REFERENCE(206, - "OMAS-ANALYTICS-MODELING-316", - "Asset {0} referencing the asset {1} missed link definition.", - "The assets connected by relathionship but missing link definition.", - "Review the asset dependencies and fix link."), - WARNING_MANUAL_UPDATE_DEPENDENTS(206, - "OMAS-ANALYTICS-MODELING-317", - "All assets referencing the asset {0} should be updated manually.", - "Failed to get relationships of dependent assets.", - "Update dependent assets manually."), - WARNING_REVERENCE_NO_ALIAS(206, - "OMAS-ANALYTICS-MODELING-318", - "The reference {0} of the asset {1} is missing alias and can not be used.", - "Referenced stored in repository is missing alias.", - "Remove unused reference or define its alias."), - WARNING_FAILED_RESTORE_METADATA_LINK(206, - "OMAS-ANALYTICS-MODELING-319", - "Can't resore metadata link between item {0} and item {1}.", - "The system is unable to restore metadata link.", - "Review the error message and update dependent asset."), - WARNING_REVERENCE_NO_GUID(206, - "OMAS-ANALYTICS-MODELING-320", - "The reference {0} of the asset {1} is missing guid.", - "Referenced stored in repository is missing guid.", - "Fix reference definition in the repository."), - WARNING_ASSET_NO_REVERENCE(206, - "OMAS-ANALYTICS-MODELING-321", - "The asset {1} does not refere any asset.", - "Asset does not have reference to any asset. It is normal for modules or visualizations with only constant constructs.", - "Define source of metadata for asset content."), - WARNING_ASSET_NO_UPDATE(206, - "OMAS-ANALYTICS-MODELING-322", - "Dependent asset with qualified name {0} was not updated. Cause: {1}", - "The system is unable to update dependent asset.", - "Review exception message and request the update of the dependent asset."), - - UNEXPECTED_EXCEPTION(400, - "OMAS-ANALYTICS-MODELING-500", - "An unexpected {0} exception was caught by {1}; error message was {2}", - "The system is unable to process the request and has returned an exception to the caller.", - "Review the error message. Also look up its full message definition which includes the system action " + - "and user action. This is most likely to describe the correct action to take to resolve the error. " + - "If that does not help, look for other diagnostics created at the same time. Also validate that the " + - "caller is a valid client of this server and is operating correctly."); - - private static final long serialVersionUID = 1L; - - private ExceptionMessageDefinition messageDefinition; - - - /** - * Constructor with all fields initialized from passed parameters. - * @param httpErrorCode suggested for response. - * @param errorMessageId to uniquely identify the message. - * @param errorMessage placeholder to allow additional values to be captured from context. - * @param systemAction describes the result of the error - * @param userAction describes how a consumer should correct the error. - */ - AnalyticsModelingErrorCode(int httpErrorCode, String errorMessageId, String errorMessage, String systemAction, - String userAction) { - this.messageDefinition = new ExceptionMessageDefinition(httpErrorCode, - errorMessageId, - errorMessage, - systemAction, - userAction); - } - - /** - * Constructor for HTTP response status 500. - * @param errorMessageId to uniquely identify the message. - * @param errorMessage placeholder to allow additional values to be captured from context. - * @param systemAction describes the result of the error - * @param userAction describes how a consumer should correct the error. - */ - AnalyticsModelingErrorCode(String errorMessageId, String errorMessage, String systemAction, String userAction) { - this(500, errorMessageId, errorMessage, systemAction, userAction); - } - - /** - * Retrieve a message definition object for an exception. This method is used when there are no message inserts. - * - * @return message definition object. - */ - @Override - public ExceptionMessageDefinition getMessageDefinition() - { - return messageDefinition; - } - - - /** - * Retrieve a message definition object for an exception. This method is used when there are values to be inserted into the message. - * - * @param params array of parameters (all strings). They are inserted into the message according to the numbering in the message text. - * @return message definition object. - */ - @Override - public ExceptionMessageDefinition getMessageDefinition(String... params) - { - messageDefinition.setMessageParameters(params); - - return messageDefinition; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/ffdc/exceptions/AnalyticsModelingCheckedException.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/ffdc/exceptions/AnalyticsModelingCheckedException.java deleted file mode 100644 index 031691f6209..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/ffdc/exceptions/AnalyticsModelingCheckedException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions; - -import org.odpi.openmetadata.commonservices.ffdc.exceptions.OMAGCheckedExceptionBase; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; - -/** - * Exception based on AnalyticsModelingErrorCode class {@link org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode} - * - */ -public class AnalyticsModelingCheckedException extends OMAGCheckedExceptionBase { - - private static final long serialVersionUID = 1L; - - /** - * Constructor wrapping original external exception. - * @param msg standard block of data related to the problem. - * @param className where exception was thrown. - * @param actionDescription interrupted by the exception. - * @param caughtError original cause of the exception. - */ - public AnalyticsModelingCheckedException(ExceptionMessageDefinition msg, String className, String actionDescription, Throwable caughtError) { - super(msg, className, actionDescription, caughtError); - } - - /** - * Constructor for exception caused within component. - * @param msg standard block of data related to the problem. - * @param className where exception was thrown. - * @param actionDescription interrupted by the exception. - */ - public AnalyticsModelingCheckedException(ExceptionMessageDefinition msg, String className, String actionDescription) { - super(msg, className, actionDescription); - } - - /** - * Helper function to provide details of the original error. - * @return message of original exception. - */ - public String getErrorCause() { - return this.getCause() != null ? this.getCause().getMessage() : null; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/Database.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/Database.java deleted file mode 100644 index 50e92da3566..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/Database.java +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.metadata; - -/** - * Database contains the properties and guid for a database entity retrieved from the metadata repository. - */ -public class Database extends MetadataBase { - - String name; - String type; - String version; - - /** - * Get name of the database. - * @return name of the database. - */ - public String getName() { - return name; - } - - /** - * Set name of the database bean usually from entity. - * @param name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get type of the database. - * @return type of the database. - */ - public String getType() { - return type; - } - - /** - * Set type of the database bean usually from entity. - * @param type to set. - */ - public void setType(String type) { - this.type = type; - } - - /** - * Get version of the database. - * @return version of the database. - */ - public String getVersion() { - return version; - } - /** - * Set version of the data base bean usually from entity. - * @param version to set. - */ - - public void setVersion(String version) { - this.version = version; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/GlossaryTerm.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/GlossaryTerm.java deleted file mode 100644 index 07a148c40db..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/GlossaryTerm.java +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.metadata; - -/** - * Glossary term contains the properties and guid for a term entity retrieved from the metadata repository. - */ -public class GlossaryTerm extends MetadataBase { - - String name; - String description; - String summary; - - /** - * Get name of the term. - * @return name of the term. - */ - public String getName() { - return name; - } - - /** - * Set name of the term bean. - * @param name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get description of the term. - * @return description of the term. - */ - public String getDescription() { - return description; - } - - /** - * Set description of the term. - * @param description to set. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Get summary of the term. - * @return summary of the term. - */ - public String getSummary() { - return summary; - } - /** - * Set summary of the term bean. - * @param summary to set. - */ - - public void setSummary(String summary) { - this.summary = summary; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/MetadataBase.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/MetadataBase.java deleted file mode 100644 index 0d4d290509b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/MetadataBase.java +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.metadata; - - -/** - * Base class for metadata beans retrieved from the metadata repository. - */ -public class MetadataBase { - - String guid; - - /** - * Get repository entity GUID for bean instantiated from that entity. - * @return guid. - */ - public String getGuid() { - return guid; - } - - /** - * Set GUID of the bean usually from the entity. - * @param guid to set. - */ - public void setGuid(String guid) { - this.guid = guid; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/Schema.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/Schema.java deleted file mode 100644 index 89eeb444173..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/metadata/Schema.java +++ /dev/null @@ -1,48 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.metadata; - -/** - * Schema metadata bean contains the properties and guid for a schema entity - * retrieved from the metadata repository. - */ -public class Schema extends MetadataBase { - - String name; - String type; // user or system expected - - /** - * Get name of the database. - * @return name of the database. - */ - public String getName() { - return name; - } - - /** - * Set name of the database bean usually from entity. - * @param name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get type of the database. - * @return type of the database. - */ - public String getType() { - return type; - } - - /** - * Set type of the database bean usually from entity. - * @param type to set. - */ - public void setType(String type) { - this.type = type; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ModuleTableFilter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ModuleTableFilter.java deleted file mode 100644 index 412144210a4..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ModuleTableFilter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Filter for tables to include in a module. - * - * Filter can have two mutually excluded definitions: - * 1. List of tables explicitly include in the module. - * 2. All tables except listed should be included in the module. - * - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class ModuleTableFilter { - - @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonIgnoreProperties(ignoreUnknown = true) - public class Envelop { - - @JsonProperty("excludedTables") - private List excludedTables; - @JsonProperty("includedTables") - private List includedTables; - - public List getExcludedTables() { - return excludedTables; - } - public void setExcludedTables(List excludedTables) { - this.excludedTables = excludedTables; - } - public List getIncludedTables() { - return includedTables; - } - public void setIncludedTables(List includedTables) { - this.includedTables = includedTables; - } - - }; - - @JsonProperty("meta") - Envelop meta; - - public Envelop getMeta() { - if (meta == null) { - meta = new Envelop(); - } - return meta; - } - - public void setMeta(Envelop meta) { - this.meta = meta; - } - - /** - * Test if the value passes filter conditions. - * @param value to test. - * @return true if passes. - */ - public boolean match(String value) { - - if (meta == null) { - return true; // passed if empty - } - - if (getMeta().getExcludedTables() != null) { - // not passed if excluded list is define and value is listed - return !getMeta().getExcludedTables().contains(value); - } else if (getMeta().getIncludedTables() != null) { - // passed if included list is define and value is listed - return getMeta().getIncludedTables().contains(value); - } - return true; // passed if there are no conditions - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainer.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainer.java deleted file mode 100644 index 949043be735..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainer.java +++ /dev/null @@ -1,68 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; - - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Base class container for the generic data in a response.
- * - * Each response data has set of attributes defined by names.
- * Id - identifier of the response data
- * Type - set by subclass to identify content of the response.
- * - */ -@JsonAutoDetect(getterVisibility=NONE, setterVisibility=NONE, fieldVisibility=ANY) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class ResponseContainer { - - private String id; - private final String type; - - /** - * Default constructor required for serialization. - */ - ResponseContainer() { - type = null; - } - - /** - * Constructor defines type of response/data stored - * @param type of the response. - */ - ResponseContainer(String type) { - this.type = type; - } - /** - * Get response data identifier. - * @return response data identifier. - */ - public String getId() { - return id; - } - - /** - * Set response data identifier. - * @param id response data identifier. - */ - public void setId(String id) { - this.id = id; - } - - /** - * Get type of the response data. - * @return type of the response data. - */ - public String getType() { - return type; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerAssets.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerAssets.java deleted file mode 100644 index 0dcac10565b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerAssets.java +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Assets; - -/** - * Response container for list of GUIDs.
- * The container has following attributes:
- *  assets - list of affected asset GUIDs (created, modified, or deleted).
- * - * The type of the container is 'assets'. - * - * - */ - -public class ResponseContainerAssets extends ResponseContainer { - - public static final String TYPE_ASSETS = "assets"; - - Assets attributes = new Assets(); - - public ResponseContainerAssets() { - super(TYPE_ASSETS); - } - - public void setAssetsList(List value) { - attributes.setAssets(value); - } - - public List getAssetsList() { - return attributes.getAssets(); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerDatabase.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerDatabase.java deleted file mode 100644 index 05ef30da239..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerDatabase.java +++ /dev/null @@ -1,90 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Database; - -/** - * Response container for database.
- * The container has following attributes:
- *  name - database name.
- *  guid - unique identifier to access database metdata.
- *  type - of the database, vendor.
- *  version - database version.
- * - * The type of the container is 'database'. - * - * - */ -public class ResponseContainerDatabase extends ResponseContainer { - - public static final String TYPE_DATABASE = "database"; - - - private Database attributes = new Database(); - - /** - * Constructor defines 'database' type - */ - public ResponseContainerDatabase() { - super(TYPE_DATABASE); - } - - /** - * Get database name. - * @return database name. - */ - public String getDbName() { - return attributes.getName(); - } - /** - * Set database name. - * @param value database name. - */ - public void setDbName(String value ) { - attributes.setName(value); - } - /** - * Get global unique identifier of the database. - * @return global unique identifier of the database. - */ - public String getGUID() { - return attributes.getGuid(); - } - /** - * Set global unique identifier of the database. - * @param value of the global unique identifier. - */ - public void setGUID(String value ) { - attributes.setGuid(value); - } - /** - * Get type defining vendor. - * @return vendor of database. - */ - public String getDbType() { - return attributes.getType(); - } - /** - * Set type defining vendor. - * @param value database vendor. - */ - public void setDbType(String value ) { - attributes.setType(value); - } - - /** - * Get version of the database. - * @return string version. - */ - public String getDbVersion() { - return attributes.getVersion(); - } - /** - * Set version of the database. - * @param value of database version. - */ - public void setDbVersion(String value ) { - attributes.setVersion(value); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerDatabaseSchema.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerDatabaseSchema.java deleted file mode 100644 index 1da58c4c92f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerDatabaseSchema.java +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Schema; - -/** - * Response container for Analytics Modeling schema representation.
- * The container has following attributes:
- *  catalog - name of the schema catalog.
- *  schema - name of the schema.
- *  schemaType - this can be 'user' or 'system'. It is always set to 'user' now.
- * - * The type of the container is 'schema'. - * - * - */ -public class ResponseContainerDatabaseSchema extends ResponseContainer { - - public static final String TYPE_SCHEMA = "schema"; - - private Schema attributes = new Schema(); - - /** - * Constructor defines 'schema' type and sets schemaType to 'user' - */ - public ResponseContainerDatabaseSchema() { - super(TYPE_SCHEMA); - attributes.setSchemaType("user"); - } - - /** - * Get schema name. - * @return schema name. - */ - public String getSchema() { - return attributes.getSchema(); - } - /** - * Set schema name. - * @param name of the schema. - */ - public void setSchema(String name ) { - attributes.setSchema(name); - } - /** - * Get catalog name. - * @return catalog name. - */ - public String getCatalog() { - return attributes.getCatalog(); - } - /** - * Set catalog name. - * @param value catalog name. - */ - public void setCatalog(String value) { - attributes.setCatalog(value); - } - /** - * Get schema type - * @return schema type. - */ - public String getSchemaType() { - return attributes.getSchemaType(); - } - - - /** - * Build id based on names of catalog and schema. - * @return id as "catalog/schema" - */ - public String buildId() { - String catalog = attributes.getCatalog(); - String schema = attributes.getSchema(); - if (catalog == null) { - return schema; - } else if (schema == null) { - return catalog; - } - return catalog + "/" + schema; - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerModule.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerModule.java deleted file mode 100644 index 3fd063268a6..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerModule.java +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.PhysicalModule; - -/** - * Response container for Analytics Modeling module representation.
- * The container has following attributes:
- *  physicalDefinition - Analytics Modeling module representation.
- * - * The type of the container is 'module'. - * - * - */ -public class ResponseContainerModule extends ResponseContainer { - - public static final String TYPE_MODULE = "module"; - - PhysicalModule attributes = new PhysicalModule(); - - /** - * Constructor defines 'module' type - */ - public ResponseContainerModule() { - super(TYPE_MODULE); - } - - /** - * Set Analytics Modeling module. - * @param value module definition to set. - */ - public void setPhysicalModule(MetadataModule value) { - attributes.setModule(value); - } - - /** - * Get Analytics Modeling module. - * @return Analytics Modeling module. - */ - public MetadataModule getPhysicalModule() { - return attributes.getModule(); - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerSchemaTables.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerSchemaTables.java deleted file mode 100644 index f39799a91d8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/ResponseContainerSchemaTables.java +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model; - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Tables; - -/** - * Response container for list of table names available in the schema.
- * The container has following attributes:
- *  tables - list of table names available in the schema.
- * - * The type of the container is 'tables'. - * - * - */ - -public class ResponseContainerSchemaTables extends ResponseContainer { - - public static final String TYPE_TABLES = "tables"; - - private Tables attributes = new Tables(); - - public ResponseContainerSchemaTables() { - super(TYPE_TABLES); - } - - public void setTablesList(List value) { - attributes.setTables(value); - } - - public List getTablesList() { - return attributes.getTables(); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/BaseObjectType.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/BaseObjectType.java deleted file mode 100644 index 039554d7f38..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/BaseObjectType.java +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.ArrayList; -import java.util.List; - -/** - * Base class for model objects having custom properties. - *
Sample:
- * {
- *   "property": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType}
- *   ]
- * } - **/ -public class BaseObjectType implements IModuleObject { - - List property; - - /** - * Get list of the object properties. - * @return list of the object properties. - */ - public List getProperty() { - return property; - } - - /** - * Set list of the object properties. - * @param property list. - */ - public void setProperty(List property) { - this.property = property; - } - - /** - * Get property by name. - * @param name of the property. - * @return the property or null if not found. - */ - public PropertyType getPropertyByName(String name) { - if (property == null || name == null) { - return null; - } - return property.stream() - .filter(prop->name.equals(prop.getName())) - .findFirst().orElse(null); - } - - /** - * Add property to the collection. - * @param property to add. - */ - void addProperty(PropertyType property) { - if(this.property == null) { - this.property = new ArrayList<>(); - } - this.property.add(property); - } - /** - * Add property to the collection. - * @param name of the property. - * @param value of the property. - */ - public void addProperty(String name, String value) { - if(this.property == null) { - this.property = new ArrayList<>(); - } - this.property.add(new PropertyType(name, value)); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/Column.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/Column.java deleted file mode 100644 index 96f1b72b10a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/Column.java +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - - -/** - * Relational database column abstraction. - *
Sample:
- * {
- *   "property": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType}
- *   ],
- *   "name": "AddressID",
- *   "vendorType": "INT32",
- *   "nullable": false,
- *   "datatype": "INTEGER"
- * } - * - */ -public class Column extends BaseObjectType { - - private String name; - private String vendorType; - private Boolean nullable; - private String datatype; - - /** - * Get name of the relational database column. - * @return name of the relational database column. - */ - public String getName() { - return name; - } - /** - * Set name of the relational database column. - * @param name of the relational database column. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get name of the relational database column data type defined by vendor. - * @return name of the relational database column data type defined by vendor. - */ - public String getVendorType() { - return vendorType; - } - /** - * Set name of the relational database column data type defined by vendor. - * @param vendorType name of the relational database column data type defined by vendor. - */ - public void setVendorType(String vendorType) { - this.vendorType = vendorType; - } - /** - * Query if the column value can be NULL - not set - * @return true if the column value can be NULL - */ - public Boolean isNullable() { - return nullable; - } - /** - * Define if the column value can be NULL - not set - * @param nullable true if the column value can be NULL - */ - public void setNullable(Boolean nullable) { - this.nullable = nullable; - } - - /** - * Get name of the column data type defined by ODBC standard. - * @return name of the column data type defined by ODBC standard. - */ - public String getDatatype() { - return datatype; - } - /** - * Set name of the column data type defined by ODBC standard. - * @param datatype name of the column data type defined by ODBC standard. - */ - public void setDatatype(String datatype) { - this.datatype = datatype; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/DataSource.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/DataSource.java deleted file mode 100644 index 2b63b074a12..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/DataSource.java +++ /dev/null @@ -1,95 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.List; - -/** - * Data source model. - *
Sample:
- * {
- *   "property": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType}
- *   ],
- *   "schema": "Person",
- *   "catalog": "AdventureWorks2014",
- *   "name": "AdventureWorks2014.Person",
- *   "table": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Table} - *   ]
- * } - * - * - */ -public class DataSource extends BaseObjectType { - - private String schema; - private String catalog; - private String name; - - private List table; - - /** - * Get name of the relational database schema. - * @return name of the relational database schema. - */ - public String getSchema() { - return schema; - } - - /** - * Set name of the relational database schema. - * @param schema name of the relational database schema. - */ - public void setSchema(String schema) { - this.schema = schema; - } - - /** - * Get name of the relational database catalog. - * @return name of the relational database catalog. - */ - public String getCatalog() { - return catalog; - } - - /** - * Set name of the relational database catalog. - * @param catalog name of the relational database catalog. - */ - public void setCatalog(String catalog) { - this.catalog = catalog; - } - - /** - * Get name of the data source. - * @return name of the data source. - */ - public String getName() { - return name; - } - - /** - * Set name of the data source. - * @param name of the data source. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get list of tables of the data source schema. - * @return list of tables. - */ - public List
getTable() { - return table; - } - - /** - * Set tables of the data source schema. - * @param tables list of tables. - */ - public void setTable(List
tables) { - this.table = tables; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/ForeignColumn.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/ForeignColumn.java deleted file mode 100644 index 085130ecfd1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/ForeignColumn.java +++ /dev/null @@ -1,99 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - - -/** - * Database table foreign column of foreign key abstraction. - *
Sample:
- * {
- *   "pkColumn": "StateProvinceID",
- *   "pkCatalog": "AdventureWorks2014",
- *   "pkSchema": "Person",
- *   "pkTable": "StateProvince",
- *   "columnName": "StateProvinceID"
- * } - * - * - */ -public class ForeignColumn implements IModuleObject { - - private String pkColumn; - private String pkCatalog; - private String pkSchema; - private String pkTable; - private String columnName; - - /** - * Get name of the primary column. - * @return name of the primary column. - */ - public String getPkColumn() { - return pkColumn; - } - /** - * Set name of the primary column. - * @param pkColumn name of the primary column. - */ - public void setPkColumn(String pkColumn) { - this.pkColumn = pkColumn; - } - /** - * Get name of the catalog the primary column belongs to. - * @return name of the catalog the primary column belongs to. - */ - public String getPkCatalog() { - return pkCatalog; - } - - /** - * Set name of the catalog the primary column belongs to. - * @param pkCatalog name of the catalog the primary column belongs to. - */ - public void setPkCatalog(String pkCatalog) { - this.pkCatalog = pkCatalog; - } - /** - * Get name of the schema the primary column belongs to. - * @return name of the schema the primary column belongs to. - */ - public String getPkSchema() { - return pkSchema; - } - /** - * Set name of the schema the primary column belongs to. - * @param pkSchema name of the schema the primary column belongs to. - */ - public void setPkSchema(String pkSchema) { - this.pkSchema = pkSchema; - } - /** - * Get name of the table the primary column belongs to. - * @return name of the table the primary column belongs to. - */ - public String getPkTable() { - return pkTable; - } - /** - * Set name of the table the primary column belongs to. - * @param pkTable name of the table the primary column belongs to. - */ - public void setPkTable(String pkTable) { - this.pkTable = pkTable; - } - /** - * Get name of the column referencing primary key. - * @return name of column referencing primary key. - */ - public String getColumnName() { - return columnName; - } - /** - * Set name of the column referencing primary key. - * @param columnName name of the column referencing primary key. - */ - public void setColumnName(String columnName) { - this.columnName = columnName; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/ForeignKey.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/ForeignKey.java deleted file mode 100644 index fe5f0191d0c..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/ForeignKey.java +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.List; - -/** - * Database table foreign key abstraction. - *
Sample:
- * {
- *   "name": "FK_Address_StateProvince_StateProvinceID",
- *   "fkColumn": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignColumn} - *   ]
- * }
- * - * - */ -public class ForeignKey implements IModuleObject { - - private String name; - private List fkColumn; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List getFkColumn() { - return fkColumn; - } - public void setFkColumn(List fkColumn) { - this.fkColumn = fkColumn; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/IModuleObject.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/IModuleObject.java deleted file mode 100644 index 3cfe58039d5..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/IModuleObject.java +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - - - - -/** - * Common interface for model classes. - * - * Json annotations applied to the base class will be applied to the derived classes. - * This way same rules applied in the single location. - * Derived classes may override annotations. - * - * - */ -@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) - -public interface IModuleObject { - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/MetadataModule.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/MetadataModule.java deleted file mode 100644 index 33a04ff11b1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/MetadataModule.java +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.List; - -/** - * Analytics Modeling service module. - *
Sample:
- * {
- *   "property": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType}
- *   ],
- *   "identifier": "AdventureWorks2014.Person",
- *   "version": "9.0",
- *   "dataSource": [  - * {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.DataSource} - *   ]
- * } - * - */ -public class MetadataModule extends BaseObjectType { - - private String identifier; - private String version = "9.0"; // fixed version matching MOSER XSD on the moment of development. - private List dataSource; - - /** - * Get module identifier. - * @return module identifier. - */ - public String getIdentifier() { - return identifier; - } - /** - * Set module identifier. - * @param identifier of the module. - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * Get version of the module. - * @return version of the module. - */ - public String getVersion() { - return version; - } - - /** - * Set version of the module. - * @param version of the module. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Get data source element of the module. - * @return data source element of the module. - */ - public List getDataSource() { - return dataSource; - } - /** - * Set data source element of the module. - * @param dataSource element - */ - public void setDataSource(List dataSource) { - this.dataSource = dataSource; - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/PrimaryKey.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/PrimaryKey.java deleted file mode 100644 index f4bf8f9f867..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/PrimaryKey.java +++ /dev/null @@ -1,54 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.List; - -/** - * Database table primary key abstraction. - *
Sample:
- * {
- *   "keyedColumn": [  - * "AddressID" - *   ],
- *   "name": "PK_Address_AddressID"
- * }
- * - * - */ -public class PrimaryKey implements IModuleObject { - - private String name; - private List keyedColumn; - - /** - * Get name of the primary key. Usually PK_TableName - * @return name of the primary key - */ - public String getName() { - return name; - } - - /** - * Set the name of primary key. - * @param name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get list of columns names defining primary key. - * @return set of columns names defining primary key. - */ - public List getKeyedColumn() { - return keyedColumn; - } - /** - * Set list of names defining primary key columns. - * @param keyedColumn list of names defining primary key columns. - */ - public void setKeyedColumn(List keyedColumn) { - this.keyedColumn = keyedColumn; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/PropertyType.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/PropertyType.java deleted file mode 100644 index 37e5004ca81..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/PropertyType.java +++ /dev/null @@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -/** - * Generic property abstraction. - *
Sample:
- * {
- *   "name": "guid",
- *   "value": "abc_123"
- * } - * - */ -public class PropertyType implements IModuleObject { - - private String name; - private String value; - - public PropertyType() { - } - - public PropertyType(String name, String value) { - this.name = name; - this.value = value; - } - /** - * Get name of the property. - * @return name of the property. - */ - public String getName() { - return name; - } - /** - * Set name of the property. - * @param name of the property. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get property value. - * @return value of the property. - */ - public String getValue() { - return value; - } - - /** - * Set property value. - * @param value of the property. - */ - public void setValue(String value) { - this.value = value; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/Table.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/Table.java deleted file mode 100644 index 005ccaa3ad1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/Table.java +++ /dev/null @@ -1,96 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.List; - -/** - * Abstraction of the table in MOSER module. - *
Sample:
- * {
- *   "property": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType}
- *   ],
- *   "name": "Address",
- *   "tableItem": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.TableItem} - *   ],
- *   "foreignKey": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignKey} - *   ],
- *   "primaryKey": [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PrimaryKey} - *   ]
- * } - * - * - */ -public class Table extends BaseObjectType { - - private String name; - private List tableItem; - private List foreignKey; - private List primaryKey; - - /** - * Get name of the table. - * @return table name. - */ - public String getName() { - return name; - } - /** - * Set table name. - * @param name of the table - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get list of table items. - * @return list of table items. - */ - public List getTableItem() { - return tableItem; - } - - /** - * Set list of table items. - * @param tableItem list of table items. - */ - public void setTableItem(List tableItem) { - this.tableItem = tableItem; - } - - /** - * Get list of foreign keys defined in the table. - * @return list of foreign keys. - */ - public List getForeignKey() { - return foreignKey; - } - - /** - * Set list of foreign keys for the table. - * @param foreignKey list of foreign keys. - */ - public void setForeignKey(List foreignKey) { - this.foreignKey = foreignKey; - } - - /** - * Get definition of the primary key. - * @return primary key definition. - */ - public List getPrimaryKey() { - return primaryKey; - } - /** - * Set primary key for the table. - * @param primaryKey definition. - */ - public void setPrimaryKey(List primaryKey) { - this.primaryKey = primaryKey; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/TableItem.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/TableItem.java deleted file mode 100644 index 88e47687b3e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/module/TableItem.java +++ /dev/null @@ -1,90 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.module; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * Container to define column and additional attributes related to it. - *
Sample:
- * {
- *   "column": {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Column}
- * } - * - */ -public class TableItem implements IModuleObject { - - private Column column; - @JsonIgnore - private int position; // used for sorting columns within table, should not be serialized - @JsonIgnore - private String pkName; // used to build PK for table, should not be serialized - @JsonIgnore - private List referencedColumns; // GUIDs for referenced columns, used to build FK for table, should not be serialized - - /** - * Get list of GUIDs for referenced columns. - * @return GUIDs list. - */ - public List getReferencedColumns() { - return referencedColumns; - } - - /** - * Set list of referenced columns defined by GUID. - * @param referencedColumns list of referenced columns defined by GUID. - */ - public void setReferencedColumns(List referencedColumns) { - this.referencedColumns = referencedColumns; - } - - /** - * Get name of the primary key. - * @return name of the primary key. - */ - public String getPkName() { - return pkName; - } - - /** - * Set name of the primary key. - * @param pkName name of the primary key. - */ - public void setPkName(String pkName) { - this.pkName = pkName; - } - - /** - * Get position of the item in the table. - * @return position of the item in the table. - */ - public int getPosition() { - return position; - } - - /** - * Set position of the item in the table. - * @param position of the item in the table. - */ - public void setPosition(int position) { - this.position = position; - } - - /** - * Get column definition. - * @return column definition. - */ - public Column getColumn() { - return column; - } - - /** - * Set column definition. - * @param column definition. - */ - public void setColumn(Column column) { - this.column = column; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/AnalyticsMessage.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/AnalyticsMessage.java deleted file mode 100644 index 78f7de018c7..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/AnalyticsMessage.java +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.TreeMap; - -import org.odpi.openmetadata.frameworks.auditlog.MessageFormatter; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Generic error structure. - * - *
{ - *
  "code": error code, - *
  "detail": explanation, - *
  "meta": { - *
   "severity": "error" || "info" || "warning" - *
  }, - *
  "status": HTTP status code, - *
  "title": short description. - *
} - *
- */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class AnalyticsMessage { - - private static final String ERROR = "error"; - private static final String SEVERITY = "severity"; - - private static final MessageFormatter messageFormatter = new MessageFormatter(); - - String status; - String code; - String title; - String detail; - - TreeMap meta; - - public AnalyticsMessage() { - setSeverity(ERROR); - } - - private AnalyticsMessage(String severity, ExceptionMessageDefinition message) { - this.status = Integer.toString(message.getHttpErrorCode()); - this.code = message.getMessageId(); - this.title = messageFormatter.getFormattedMessage(message); - this.detail = message.getSystemAction() + " " + message.getUserAction(); - setSeverity(severity); - } - - public static AnalyticsMessage createError(String status, String code, String title, String detail) { - AnalyticsMessage ret = new AnalyticsMessage(); - ret.status = status; - ret.code = code; - ret.title = title; - ret.detail = detail; - ret.setSeverity(ERROR); - return ret; - } - - public static AnalyticsMessage createError(ExceptionMessageDefinition message) { - return new AnalyticsMessage(ERROR, message); - } - - public static AnalyticsMessage createWarning(ExceptionMessageDefinition message) { - return new AnalyticsMessage("warning", message); - } - - public static AnalyticsMessage createInfo(ExceptionMessageDefinition message) { - return new AnalyticsMessage("info", message); - } - - /** - * Get error status. - * @return error status. - */ - public String getStatus() { - return status; - } - - /** - * Set error status. - * @param value of error status. - */ - public void setStatus(String value) { - status = value; - } - - /** - * Get error code. - * @return error code. - */ - public String getCode() { - return code; - } - - /** - * Set error code. - * @param value of error code. - */ - public void setCode(String value) { - code = value; - } - - /** - * Get error title. - * @return error title. - */ - public String getTitle() { - return title; - } - /** - * Set error title. - * @param value to set. - */ - - public void setTitle(String value) { - title = value; - } - - /** - * Get error detail. - * @return error detail. - */ - public String getDetail() { - return detail; - } - - /** - * Set error detail. - * @param value of error detail. - */ - public void setDetail(String value) { - detail = value; - } - - /** - * Get error meta. - * @return error meta. - */ - public TreeMap getMeta() { - return meta; - } - - /** - * Set error meta. - * @param value of error detail. - */ - public void setMeta(TreeMap value) { - meta = value; - } - - public void setSeverity(String value) { - if (meta == null) { - meta = new TreeMap<>(); - } - meta.put(SEVERITY, value); - - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Assets.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Assets.java deleted file mode 100644 index ba6e97f7721..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Assets.java +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * List of asset GUIDS. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Assets { - - List assets; - - /** - * Get list of asset GUIDS. - * @return list of tables. - */ - public List getAssets() { - return assets; - } - - /** - * Set list of asset GUIDS. - * @param value to set. - */ - public void setAssets(List value) { - assets = value; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Database.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Database.java deleted file mode 100644 index 0e878ed6211..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Database.java +++ /dev/null @@ -1,89 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Database contains the properties and guid for a database. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Database { - - String guid; - String name; - String type; - String version; - - /** - * Get GUID of the database. - * @return GUID of the database. - */ - public String getGuid() { - return guid; - } - - /** - * Set GUID of the database. - * @param guid to set. - */ - public void setGuid(String guid) { - this.guid = guid; - } - - /** - * Get name of the database. - * @return name of the database. - */ - public String getName() { - return name; - } - - /** - * Set name of the database. - * @param name to set. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get type of the database. - * @return type of the database. - */ - public String getType() { - return type; - } - - /** - * Set type of the database. - * @param type to set. - */ - public void setType(String type) { - this.type = type; - } - - /** - * Get version of the database. - * @return version of the database. - */ - public String getVersion() { - return version; - } - /** - * Set version of the database. - * @param version to set. - */ - - public void setVersion(String version) { - this.version = version; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Messages.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Messages.java deleted file mode 100644 index d4abb17d331..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Messages.java +++ /dev/null @@ -1,77 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.ArrayList; -import java.util.List; - -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Container of the messages. - * It contain non critical errors, warning and info messages - * while successfully executing the request. - * - * - *
{
- *   "messages" : [  - *   {@link org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.AnalyticsMessage}
- *    ]
- * }
- *
- */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Messages { - - private List messages; - - public List getMessages() { - return messages; - } - - public void setMessages(List messages) { - this.messages = messages; - } - - public void addWarning(ExceptionMessageDefinition message) { - if (messages == null) { - messages = new ArrayList<>(); - } - messages.add(AnalyticsMessage.createWarning(message)); - } - - public void addWarning(ExceptionMessageDefinition message, String detail) { - if (messages == null) { - messages = new ArrayList<>(); - } - AnalyticsMessage error = AnalyticsMessage.createWarning(message); - error.setDetail(detail); - messages.add(error); - } - - public void addInfo(ExceptionMessageDefinition message) { - if (messages == null) { - messages = new ArrayList<>(); - } - messages.add(AnalyticsMessage.createInfo(message)); - } - - public void addError(ExceptionMessageDefinition message) { - if (messages == null) { - messages = new ArrayList<>(); - } - messages.add(AnalyticsMessage.createError(message)); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/PhysicalModule.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/PhysicalModule.java deleted file mode 100644 index faee6e637df..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/PhysicalModule.java +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Schema contains the properties and guid for a database schema. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class PhysicalModule { - - @JsonProperty("physicalDefinition") - MetadataModule module; - - /** - * Get list of tables in database schema. - * @return list of tables. - */ - public MetadataModule getModule() { - return module; - } - - /** - * Set list of table names of the database schema. - * @param value to set. - */ - public void setModule(MetadataModule value) { - module = value; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Schema.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Schema.java deleted file mode 100644 index dc06e41a65d..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Schema.java +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Schema contains the properties and guid for a database schema. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Schema { - - String catalog; - String schema; - String schemaType; - - /** - * Get name of the database catalog. - * @return name of the database catalog. - */ - public String getCatalog() { - return catalog; - } - - /** - * Set name of the database catalog. - * @param value to set. - */ - public void setCatalog(String value) { - catalog = value; - } - - /** - * Get schema name of the database. - * @return schema name of the database. - */ - public String getSchema() { - return schema; - } - /** - * Set schema name of the database. - * @param value to set. - */ - - public void setSchema(String value) { - schema = value; - } - - /** - * Get type of the database schema. - * @return type of the database schema. - */ - public String getSchemaType() { - return schemaType; - } - - /** - * Set type of the database schema. - * @param value to set. - */ - public void setSchemaType(String value) { - schemaType = value; - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Tables.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Tables.java deleted file mode 100644 index 28e321636ff..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/model/response/Tables.java +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.model.response; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * Schema contains the properties and guid for a database schema. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown = true) -public class Tables { - - List tables; - - /** - * Get list of tables in database schema. - * @return list of tables. - */ - public List getTables() { - return tables; - } - - /** - * Set list of table names of the database schema. - * @param value to set. - */ - public void setTables(List value) { - tables = value; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/AnalyticsModelingOMASAPIResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/AnalyticsModelingOMASAPIResponse.java deleted file mode 100644 index 1081b31fe61..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/AnalyticsModelingOMASAPIResponse.java +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCResponseBase; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.ANY; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; - -/** - * The class is base for all responses of Analytics Modeling OMAS.
- * - * Response data is stored in data field as list of a response containers. - * - */ -@JsonAutoDetect(getterVisibility=NONE, setterVisibility=NONE, fieldVisibility=ANY) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "class") -@JsonSubTypes - ({ - @JsonSubTypes.Type(value = ErrorResponse.class, name = "ErrorResponse"), - @JsonSubTypes.Type(value = DatabasesResponse.class, name = "DatabasesResponse"), - @JsonSubTypes.Type(value = SchemasResponse.class, name = "SchemasResponse"), - @JsonSubTypes.Type(value = SchemaTablesResponse.class, name = "SchemaTablesResponse"), - @JsonSubTypes.Type(value = AssetsResponse.class, name = "AssetsResponse"), - @JsonSubTypes.Type(value = ModuleResponse.class, name = "ModuleResponse") - }) -public class AnalyticsModelingOMASAPIResponse extends FFDCResponseBase { - - private static final long serialVersionUID = 1L; - - private Messages meta; - - @Override - public String toString() { - return "AnalyticsModelingOMASAPIResponse{" + - '}'; - } - - public Messages getMeta() { - return meta; - } - - public void setMeta(Messages meta) { - this.meta = meta; - } - - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/AssetsResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/AssetsResponse.java deleted file mode 100644 index cefd737e5aa..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/AssetsResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -/** - * Response for request of the tables of the schema. - * - * - */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class AssetsResponse extends AnalyticsModelingOMASAPIResponse { - - private List data; - - /** - * Set list of asset GUIDs. - * @param assets GUIDs to set. - */ - public void setAssetList(ResponseContainerAssets assets) { - data = Arrays.asList(assets); - } - /** - * Get list of asset GUIDs. - * @return list of asset GUIDs. - */ - public ResponseContainerAssets getAssetList() { - return (data == null || data.isEmpty()) ? null : (ResponseContainerAssets) data.get(0); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/DatabasesResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/DatabasesResponse.java deleted file mode 100644 index 8be75105037..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/DatabasesResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; - -/** - * Response for request of the available databases. - * - */ -public class DatabasesResponse extends AnalyticsModelingOMASAPIResponse { - - private List data; - - /** - * Set list of databases as response content. - * @param databases set as the response. - */ - public void setDatabasesList(List databases) { - data = databases; - } - - /** - * Get list of databases as response content. - * @return databases list. - */ - public List getDatabasesList() { - return data; - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/ErrorResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/ErrorResponse.java deleted file mode 100644 index 50e0bc1050a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/ErrorResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - -import java.util.ArrayList; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.AnalyticsMessage; - -/** - * Response to return error. - * - * Sample of an error: - *{ - * "class" : "ErrorResponse", - * "relatedHTTPCode" : 500, - * "exceptionClassName": "org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException", - * "exceptionCausedBy": "org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException", - * "actionDescription": "getModule", - * "exceptionErrorMessage": "OMAG-COMMON-400-016 An unexpected org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException exception was caught by getModule; error message was OMAS-ANALYTICS-MODELING-003 Relationship AttributeForSchema for entity gen!RDBST@(host)=vottcteds4.canlab.ibm.com::(database)=adventworksDW::(database_schema)=dbo could not be fetched.", - * "exceptionErrorMessageId": "OMAG-COMMON-400-016", - * "exceptionErrorMessageParameters": [ - * "org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException", - * "getModule", - * "OMAS-ANALYTICS-MODELING-003 Relationship AttributeForSchema for entity gen!RDBST@(host)=vottcteds4.canlab.ibm.com::(database)=adventworksDW::(database_schema)=dbo could not be fetched." - * ], - * "exceptionSystemAction": "The system is unable to process the request.", - * "exceptionUserAction": "Review the error message and other diagnostics created at the same time.", - * "errors" : [ - * { - * org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.AnalyticsMessage - * }, - * ... - * ] - *} - * - */ -public class ErrorResponse extends AnalyticsModelingOMASAPIResponse { - - private List errors; - - - public ErrorResponse() { - // required to deserialize - } - /** - * Constructor initialized from exception thrown. - * @param source of the error. - */ - public ErrorResponse(AnalyticsModelingCheckedException source) { - setRelatedHTTPCode(source.getReportedHTTPCode()); - - AnalyticsMessage error = AnalyticsMessage.createError(Integer.toString(source.getReportedHTTPCode()), - source.getReportedErrorMessageId(), source.getMessage(), source.getErrorCause()); - - errors = new ArrayList<>(); - errors.add(error); - } - - /** - * Get the errors. - * @return the response errors. - */ - public List getErrors() { - return errors; - } - - /** - * Set response errors. - * @param errors response errors. - */ - protected void setErrors(List errors) { - this.errors = errors; - } - - - /** - * Add error to the response. - * @param messageId of the error. - * @param httpStatus of the error. - * @param message title. - * @param detail of the error. - */ - public void addError(String messageId, String httpStatus, String message, String detail) { - if (errors == null) { - errors = new ArrayList<>(); - } - - AnalyticsMessage error = new AnalyticsMessage(); - errors.add(error); - error.setCode(messageId); - error.setStatus(httpStatus); - error.setTitle(message); - error.setDetail(detail); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/ModuleResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/ModuleResponse.java deleted file mode 100644 index 1d010eb66bd..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/ModuleResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - - -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; - -/** - * Response for request of the Analytics Modeling module. - * - */ - -public class ModuleResponse extends AnalyticsModelingOMASAPIResponse { - - private List data; - - /** - * Set module definition. - * @param module definition. - */ - public void setModule(ResponseContainerModule module) { - data = Arrays.asList(module); - } - - /** - * Get module definition. - * @return module definition. - */ - public ResponseContainerModule getModule() { - return (data == null || data.isEmpty()) ? null : data.get(0); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/SchemaTablesResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/SchemaTablesResponse.java deleted file mode 100644 index 13c48ae2c16..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/SchemaTablesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -/** - * Response for request of the tables of the schema. - * - * - */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; - -public class SchemaTablesResponse extends AnalyticsModelingOMASAPIResponse { - - private List data; - /** - * Set list of tables of the schema. - * @param tables to set. - */ - public void setTableList(ResponseContainerSchemaTables tables) { - data = Arrays.asList(tables); - } - /** - * Get list of tables of the schema. - * @return list of tables. - */ - public ResponseContainerSchemaTables getTableList() { - return (data == null || data.isEmpty()) ? null : (ResponseContainerSchemaTables)data.get(0); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/SchemasResponse.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/SchemasResponse.java deleted file mode 100644 index a9c0a933259..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/responses/SchemasResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.responses; - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; - - -/** - * Response for request of the available database schemas. - * - */ -public class SchemasResponse extends AnalyticsModelingOMASAPIResponse{ - - private List data; - /** - * Set list of schemas available for database. - * @param databaseSchemas set as response. - */ - public void setSchemaList(List databaseSchemas) { - data = databaseSchemas; - } - - /** - * Get list of schemas available for database. - * @return list of schemas available for database. - */ - public List getSchemaList() { - return data; - } -} - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/Asset.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/Asset.java deleted file mode 100644 index d6c233137a3..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/Asset.java +++ /dev/null @@ -1,154 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans; - -import java.util.*; - -/** - * Asset holds properties accordingly Asset - model 0010. - *
    - *
  • displayName - A consumable name for the asset. Often a shortened form of the assetQualifiedName - * for use on user interfaces and messages. The assetDisplayName should only be used for audit logs and error - * messages if the assetQualifiedName is not set. (Sourced from attribute name within Asset - model 0010)
  • - *
  • description - full description of the asset. - * (Sourced from attribute description within Asset - model 0010)
  • - *
  • qualifiedName - The official (unique) name for the asset. This is often defined by the IT systems - * management organization and should be used (when available) on audit logs and error messages. - * (qualifiedName from Referenceable - model 0010)
  • - *
  • additionalProperties - list of properties assigned to the asset as additional properties. - * (additionalProperties from Referenceable - model 0010)
  • - *
- */ -public class Asset extends Referenceable -{ - protected String displayName = null; - protected String description = null; - - - /** - * Default constructor - */ - public Asset() - { - } - - - /** - * Copy/clone constructor. Note, this is a deep copy - * - * @param template template values for asset summary - */ - public Asset(Asset template) - { - super(template); - - if (template != null) - { - displayName = template.getDisplayName(); - description = template.getDescription(); - } - } - - - /** - * Returns the stored display name property for the asset. - * If no display name is available then null is returned. - * - * @return String name - */ - public String getDisplayName() - { - return displayName; - } - - - /** - * Set up the stored display name property for the asset. - * - * @param displayName String name - */ - public void setDisplayName(String displayName) - { - this.displayName = displayName; - } - - - /** - * Returns the stored description property for the asset. - * If no description is provided then null is returned. - * - * @return description String text - */ - public String getDescription() - { - return description; - } - - - /** - * Set up the stored description property associated with the asset. - * - * @param description String text - */ - public void setDescription(String description) - { - this.description = description; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Asset{" + - "displayName='" + displayName + '\'' + - ", description='" + description + '\'' + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - Asset asset = (Asset) objectToCompare; - return Objects.equals(getDisplayName(), asset.getDisplayName()) - && Objects.equals(getDescription(), asset.getDescription()) - && super.equals(objectToCompare); - } - - - - /** - * Return hash code based on properties. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), getDisplayName(), getDescription()); - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/Referenceable.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/Referenceable.java deleted file mode 100644 index 3296ca2169b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/Referenceable.java +++ /dev/null @@ -1,193 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans; - -import com.fasterxml.jackson.annotation.*; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - - -/** - * Many open metadata entities are referenceable. It means that they have a qualified name and additional - * properties. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonSubTypes( - { - @JsonSubTypes.Type(value = Asset.class, name = "Asset"), - @JsonSubTypes.Type(value = SchemaElement.class, name = "SchemaElement"), - }) -public class Referenceable { - - protected String qualifiedName = null; - protected Map additionalProperties = null; - - - /** - * GUID of the entity in repository used to create bean. - */ - protected String guid = null; - - - /** - * Default constructor - */ - public Referenceable() - { - super(); - } - - - /** - * Copy/clone constructor. Retrieves values from the supplied template - * - * @param template element to copy - */ - public Referenceable(Referenceable template) - { - if (template != null) - { - qualifiedName = template.getQualifiedName(); - additionalProperties = template.getAdditionalProperties(); - } - } - - - /** - * Set up the fully qualified name. - * - * @param qualifiedName String name - */ - public void setQualifiedName(String qualifiedName) - { - this.qualifiedName = qualifiedName; - } - - - /** - * Returns the stored guid for the metadata entity. - * If no guid is available then the null is returned. - * - * @return guid - */ - public String getGuid() - { - return guid; - } - - - - /** - * Set up the guid. - * - * @param guid String name - */ - public void setGuid(String guid) - { - this.guid = guid; - } - - - /** - * Returns the stored qualified name property for the metadata entity. - * If no qualified name is available then the empty string is returned. - * - * @return qualifiedName - */ - public String getQualifiedName() - { - return qualifiedName; - } - - /** - * Set up additional properties. - * - * @param additionalProperties Additional properties object - */ - public void setAdditionalProperties(Map additionalProperties) - { - this.additionalProperties = additionalProperties; - } - - - /** - * Return a copy of the additional properties. Null means no additional properties are available. - * - * @return AdditionalProperties - */ - public Map getAdditionalProperties() - { - if (additionalProperties == null) - { - return null; - } - else if (additionalProperties.isEmpty()) - { - return null; - } - else - { - return new HashMap<>(additionalProperties); - } - } - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "Referenceable{" + - "qualifiedName='" + qualifiedName + '\'' + - ", additionalProperties=" + additionalProperties + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - * - * GUID is not used in equals(...) to compare beans from repository and request. - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - - Referenceable that = (Referenceable) objectToCompare; - return Objects.equals(qualifiedName, that.qualifiedName) && - Objects.equals(additionalProperties, that.additionalProperties); - } - - - /** - * Return hash code based on properties. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), qualifiedName, additionalProperties); - } -} - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaAttribute.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaAttribute.java deleted file mode 100644 index dc3419b1504..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaAttribute.java +++ /dev/null @@ -1,144 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans; - -import java.util.Objects; - -/** - * SchemaAttribute describes a single attribute within a schema. The attribute has a name, order within - * the parent schema element. - */ -public class SchemaAttribute extends SchemaElement -{ - protected int elementPosition = 0; - protected String nativeJavaClass = null; - - - /** - * Default constructor - */ - public SchemaAttribute() - { - super(); - } - - - /** - * Copy/clone constructor. - * - * @param template template schema attribute to copy. - */ - public SchemaAttribute(SchemaAttribute template) - { - super(template); - - if (template != null) - { - elementPosition = template.getElementPosition(); - } - } - - - /** - * Return a clone of this schema element. This method is needed because schema element - * is abstract. - * - * @return Clone of subclass. - */ - @Override - public SchemaElement cloneSchemaElement() - { - return new SchemaAttribute(this); - } - - /** - * Return the position of this schema attribute in its parent schema. - * - * @return int position in schema - 0 means first - */ - public int getElementPosition() { return elementPosition; } - - - /** - * Set up the position of this schema attribute in its parent schema. - * - * @param elementPosition int position in schema - 0 means first - */ - public void setElementPosition(int elementPosition) - { - this.elementPosition = elementPosition; - } - - /** - * @return the nativeJavaClass - */ - public String getNativeJavaClass() { - return nativeJavaClass; - } - - - /** - * @param nativeJavaClass the nativeJavaClass to set - */ - public void setNativeJavaClass(String nativeJavaClass) { - this.nativeJavaClass = nativeJavaClass; - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaAttribute{" + - "elementPosition=" + elementPosition + - "nativeJavaClass=" + nativeJavaClass + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SchemaAttribute that = (SchemaAttribute) objectToCompare; - return Objects.equals(elementPosition, that.elementPosition); - } - - - /** - * Return a number that represents the contents of this object. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), elementPosition, nativeJavaClass); - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaElement.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaElement.java deleted file mode 100644 index 603c734acf8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaElement.java +++ /dev/null @@ -1,171 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans; - -import com.fasterxml.jackson.annotation.*; - - - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.Objects; - -/** - *

- * The SchemaElement object provides a base class for the pieces that make up a schema for an asset. - * A schema provides information about how the data is structured in the asset. Schemas are typically - * described as nested structures of schema elements. There are two basic types: - *

- *
    - *
  • SchemaType describes the structure of data.
  • - *
  • SchemaAttribute describes the use of another schema as part of the structure within a bigger schema.
  • - *
- *

- * Assets are linked to a SchemaType. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonSubTypes( - { - @JsonSubTypes.Type(value = SchemaAttribute.class, name = "SchemaAttribute"), - @JsonSubTypes.Type(value = SchemaType.class, name = "SchemaType") - }) - -public abstract class SchemaElement extends Referenceable -{ - private static final long serialVersionUID = 1L; - - protected String displayName = null; - protected String description = null; - - /** - * Default constructor - */ - public SchemaElement() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public SchemaElement(SchemaElement template) - { - super(template); - - if (template != null) - { - displayName = template.getDisplayName(); - description = template.getDescription(); - } - } - - /** - * Return the simple name of the schema element. - * - * @return string name - */ - public String getDisplayName() { return displayName; } - - - /** - * Set up the simple name of the schema element. - * - * @param name String display name - */ - public void setDisplayName(String name) - { - this.displayName = name; - } - - - /** - * Returns the stored description property for the schema element. - * - * @return string description - */ - public String getDescription() - { - return description; - } - - - /** - * Set up the stored description property for the schema element. - * - * @param description string description - */ - public void setDescription(String description) - { - this.description = description; - } - - /** - * Return a clone of this schema element. This method is needed because schema element - * is abstract. - * - * @return Clone of subclass. - */ - public abstract SchemaElement cloneSchemaElement(); - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaElement{" + - ", displayName='" + displayName + '\'' + - ", description='" + description + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - '}'; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SchemaElement that = (SchemaElement) objectToCompare; - return Objects.equals(displayName, that.displayName) && - Objects.equals(description, that.description); - } - - - /** - * Return a number that represents the contents of this object. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), displayName, description); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaType.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaType.java deleted file mode 100644 index 5a8479e73c1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/beans/SchemaType.java +++ /dev/null @@ -1,237 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans; - -import java.util.Objects; - -/** - *

- * The SchemaType object provides a base class for the pieces that make up a schema for a data asset. - * A schema provides information about how the data is structured in the asset. Schemas are typically - * described as nested structures of linked schema elements. Schemas can also be reused in other schemas. - *

- */ -public class SchemaType extends SchemaElement -{ - protected String versionNumber = null; - protected String author = null; - protected String usage = null; - protected String encodingStandard = null; - protected String namespace = null; - - /** - * Default constructor - */ - public SchemaType() - { - super(); - } - - - /** - * Copy/clone Constructor. - * - * @param template template object to copy. - */ - public SchemaType(SchemaType template) - { - super(template); - - if (template != null) - { - versionNumber = template.getVersionNumber(); - author = template.getAuthor(); - usage = template.getUsage(); - encodingStandard = template.getEncodingStandard(); - namespace = template.getNamespace(); - } - } - - - /** - * Returns a clone of this object as the abstract SchemaElement class. - * - * @return SchemaElement - */ - @Override - public SchemaElement cloneSchemaElement() - { - return new SchemaType(this); - } - - - /** - * Return a clone of this schema type. - * - * @return Clone of subclass. - */ - public SchemaType cloneSchemaType() - { - return new SchemaType(this); - } - - - /** - * Return the version number of the schema element - null means no version number. - * - * @return String version number - */ - public String getVersionNumber() { return versionNumber; } - - - /** - * Set up the version number of the schema element - null means no version number. - * - * @param versionNumber String version number - */ - public void setVersionNumber(String versionNumber) - { - this.versionNumber = versionNumber; - } - - - /** - * Return the name of the author of the schema element. Null means the author is unknown. - * - * @return String author name - */ - public String getAuthor() { return author; } - - - /** - * Set up the name of the author of the schema element. Null means the author is unknown. - * - * @param author String author name - */ - public void setAuthor(String author) - { - this.author = author; - } - - - /** - * Return the usage guidance for this schema element. Null means no guidance available. - * - * @return String usage guidance - */ - public String getUsage() { return usage; } - - - /** - * Set up the usage guidance for this schema element. Null means no guidance available. - * - * @param usage String usage guidance - */ - public void setUsage(String usage) - { - this.usage = usage; - } - - - /** - * Return the format (encoding standard) used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - * - * @return String encoding standard - */ - public String getEncodingStandard() { return encodingStandard; } - - - /** - * Set up the format (encoding standard) used for this schema. It may be XML, JSON, SQL DDL or something else. - * Null means the encoding standard is unknown or there are many choices. - * - * @param encodingStandard String encoding standard - */ - public void setEncodingStandard(String encodingStandard) - { - this.encodingStandard = encodingStandard; - } - - - /** - * Return the name of the namespace that this type belongs to. - * - * @return string name - */ - public String getNamespace() - { - return namespace; - } - - - /** - * Set up the name of the namespace that this type belongs to. - * - * @param namespace string name - */ - public void setNamespace(String namespace) - { - this.namespace = namespace; - } - - - /** - * Compare the values of the supplied object with those stored in the current object. - * - * @param objectToCompare supplied object - * @return boolean result of comparison - */ - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (!(objectToCompare instanceof SchemaType)) - { - return false; - } - if (!super.equals(objectToCompare)) - { - return false; - } - SchemaType that = (SchemaType) objectToCompare; - return Objects.equals(getVersionNumber(), that.getVersionNumber()) && - Objects.equals(getAuthor(), that.getAuthor()) && - Objects.equals(getUsage(), that.getUsage()) && - Objects.equals(getNamespace(), that.getNamespace()) && - Objects.equals(getEncodingStandard(), that.getEncodingStandard()); - } - - - /** - * Standard toString method. - * - * @return print out of variables in a JSON-style - */ - @Override - public String toString() - { - return "SchemaType{" + - "versionNumber='" + versionNumber + '\'' + - ", author='" + author + '\'' + - ", usage='" + usage + '\'' + - ", encodingStandard='" + encodingStandard + '\'' + - ", namespace='" + namespace + '\'' + - ", displayName='" + getDisplayName() + '\'' + - ", description='" + getDescription() + '\'' + - ", qualifiedName='" + getQualifiedName() + '\'' + - ", additionalProperties=" + getAdditionalProperties() + - '}'; - } - - /** - * Return a number that represents the contents of this object. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), versionNumber, author, usage, encodingStandard, namespace); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AnalyticsAsset.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AnalyticsAsset.java deleted file mode 100644 index f4f7d548284..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AnalyticsAsset.java +++ /dev/null @@ -1,158 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model; - - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.List; -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.Asset; - -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class AnalyticsAsset extends Asset { - - private String uid; // external unique identifiers - private String location; // external location of the asset - private String type; // type defines asset content - private String lastModified; // string timestamp - - private List sourceGuid; // GUIDs of external metadata objects - - private List reference; - private List container; - private List item; - - private List visualization; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public List getSourceGuid() { - return sourceGuid; - } - - public void setSourceGuid(List sourceGuid) { - this.sourceGuid = sourceGuid; - } - - public List getReference() { - return reference; - } - - public void setReference(List reference) { - this.reference = reference; - } - - public List getContainer() { - return container; - } - - public void setContainer(List container) { - this.container = container; - } - - public List getItem() { - return item; - } - - public void setItem(List items) { - this.item = items; - } - - /** - * @return the visualization - */ - public List getVisualization() { - return visualization; - } - /** - * @param visualization the visualization to set - */ - public void setVisualization(List visualization) { - this.visualization = visualization; - } - - /** - * @return the location - */ - public String getLocation() { - return location; - } - - /** - * @param location the location to set - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * Get string time stamp when the module was modified. - * @return the lastModified - */ - public String getLastModified() { - return lastModified; - } - - /** - * Set string time stamp when the module was modified. - * @param lastModified the lastModified to set - */ - public void setLastModified(String lastModified) { - this.lastModified = lastModified; - } - - @Override - public boolean equals(Object obj) { - - if (this == obj) { - return true; - } - - if (!(obj instanceof AnalyticsAsset)) { - return false; - } - - AnalyticsAsset asset = (AnalyticsAsset)obj; - - return Objects.equals(uid, asset.uid) - && Objects.equals(location, asset.location) - && Objects.equals(type, asset.type) - && Objects.equals(lastModified, asset.lastModified) - && super.equals(asset); - } - - /** - * Return a number that represents the contents of this object. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), uid, location, type, lastModified); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AnalyticsMetadata.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AnalyticsMetadata.java deleted file mode 100644 index 089b331f88e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AnalyticsMetadata.java +++ /dev/null @@ -1,156 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaAttribute; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSubTypes; - - -/** - * Base class for analytics metadata provides common attributes. - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -@JsonSubTypes( - { - @JsonSubTypes.Type(value = MetadataContainer.class, name = "MetadataContainer"), - @JsonSubTypes.Type(value = MetadataItem.class, name = "MetadataItem") - }) -public abstract class AnalyticsMetadata extends SchemaAttribute { - - private String identifier; // 3rd party system identifier within parent element - private List sourceGuid; // repository GUIDs of entities representing external metadata objects - private List sourceId; // IDs of external metadata objects - private String type; // arbitrary type of the metadata as defined in 3rd party system - // display name and type should represent element for the user in UI - // Samples of possible values for types: - // queryItem - metadata stored in storage like RDBMS, OLAP, CSV files, etc. - // dataItem - projected metadata within visualization - // querySubject - group of related metadata items: Relation/Table/View in RDBMS, Dimension in OLAP - // query - group of metadata items projected in a query: SQL (RDBMS), MDX (OLAP) - // widget - visual elements with metadata items - // page - multiple page report logical grouping for widgets - // tab - multiple tab per page logical grouping for widgets - - - /** - * Get type of the metadata. - * @return the type - */ - public String getType() { - return type; - } - - /** - * Set type of the metadata. - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - - /** - * Getter method for attribute identifier - * @return the identifier - */ - public String getIdentifier() { - return identifier; - } - - /** - * Setter method for attribute identifier - * @param identifier the identifier to set - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * Get GUID list the element is connected to. - * @return the sourceGuid - */ - public List getSourceGuid() { - return sourceGuid; - } - - /** - * Set GUID list the element is connected to. - * @param sourceGuid the sourceGuid to set - */ - public void setSourceGuid(List sourceGuid) { - this.sourceGuid = sourceGuid; - } - - /** - * @return the sourceId - */ - public List getSourceId() { - return sourceId; - } - - /** - * @param sourceId the sourceId to set - */ - public void setSourceId(List sourceId) { - this.sourceId = sourceId; - } - - public void addSourceGuid(String guid) { - if (sourceGuid == null) { - sourceGuid = new ArrayList<>(); - } - sourceGuid.add(guid); - } - - public void addSourceId(String id) { - if (sourceId == null) { - sourceId = new ArrayList<>(); - } - sourceId.add(id); - } - - @Override - public boolean equals(Object objectToCompare) - { - if (this == objectToCompare) - { - return true; - } - if (objectToCompare == null || getClass() != objectToCompare.getClass()) - { - return false; - } - - AnalyticsMetadata that = (AnalyticsMetadata) objectToCompare; - return Objects.equals(identifier, that.identifier) - && Objects.equals(type, that.type) - && Objects.equals(sourceGuid, that.sourceGuid) - && Objects.equals(sourceId, that.sourceId) - && super.equals(objectToCompare); - } - - /** - * Return a number that represents the contents of this object. - * - * @return int - */ - @Override - public int hashCode() - { - return Objects.hash(super.hashCode(), identifier, type); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AssetReference.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AssetReference.java deleted file mode 100644 index 3f9443a3dfa..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/AssetReference.java +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class AssetReference { - - private String uid; // external unique identifiers of the metadata source - private String location; // location of the metadata source in external system - private String guid; // repository GUID of the asset corresponding to external metadata source - private String alias; // alias used inside asset - - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - /** - * @return the location - */ - public String getLocation() { - return location; - } - - /** - * @param location the location to set - */ - public void setLocation(String location) { - this.location = location; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getAlias() { - return alias; - } - - public void setAlias(String alias) { - this.alias = alias; - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/MetadataContainer.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/MetadataContainer.java deleted file mode 100644 index cb61893b89c..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/MetadataContainer.java +++ /dev/null @@ -1,99 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * MetadataContainer is abstraction of grouping element for - * {@link org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem} - * and nested containers. - * - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class MetadataContainer extends AnalyticsMetadata { - - private List container; - private List item; - - /** - * @return the item - */ - public List getItem() { - return item; - } - - /** - * @param item the items to set - */ - public void setItem(List item) { - this.item = item; - } - - public void addItem(MetadataItem item) { - if (this.item == null) { - this.item = new ArrayList<>(); - } - this.item.add(item); - } - - public MetadataItem removeItem(int index) { - if (item != null && item.size() > index) { - return item.remove(index); - } - return null; - } - - public MetadataItem getItem(int index) { - if (item != null && item.size() > index) { - return item.get(index); - } - return null; - } - - /** - * @return the container - */ - public List getContainer() { - return container; - } - - /** - * @param container the container to set - */ - public void setContainer(List container) { - this.container = container; - } - - public void addContainer(MetadataContainer child) { - if (container == null) { - container = new ArrayList<>(); - } - container.add(child); - } - - public MetadataContainer removeContainer(int index) { - if (container != null && container.size() > index) { - return container.remove(index); - } - return null; - } - - public MetadataContainer getContainer(int index) { - if (container != null && container.size() > index) { - return container.get(index); - } - return null; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/MetadataItem.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/MetadataItem.java deleted file mode 100644 index 86cde60f3c8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/model/MetadataItem.java +++ /dev/null @@ -1,89 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model; - -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; -import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - -/** - * MetadataItem is an abstraction of something that references source of - * simple data that have same type like integer, string, etc. - * - */ -@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE) -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonIgnoreProperties(ignoreUnknown=true) -public class MetadataItem extends AnalyticsMetadata { - - private String expression; - private String dataType; - - /** - * Nested items. - * OLAP hierarchy/levels/members. - * DATE, TIMESTAMP consist of smaller items. - */ - private List items; - - /** - * Get the nested data. - * @return the items. - */ - public List getItem() { - return items; - } - /** - * Set all nested items. - * @param items the items to set. - */ - public void setItem(List items) { - this.items = items; - } - - /** - * Add single nested item. - * @param item to add. - */ - public void addItem(MetadataItem item) { - if (items == null) { - items = new ArrayList<>(); - } - items.add(item); - } - - public MetadataItem removeItem(int index) { - if (items != null && items.size() > index) { - return items.remove(index); - } - return null; - } - - public MetadataItem getItem(int index) { - if (items != null && items.size() > index) { - return items.get(index); - } - return null; - } - - public String getExpression() { - return expression; - } - public void setExpression(String expression) { - this.expression = expression; - } - public String getDataType() { - return dataType; - } - public void setDataType(String dataType) { - this.dataType = dataType; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/ffdc/ErrorCodeTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/ffdc/ErrorCodeTest.java deleted file mode 100644 index 186a787c487..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/ffdc/ErrorCodeTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.ffdc; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.test.unittest.utilities.ExceptionMessageSetTest; -import org.testng.annotations.Test; - -/** - * Verify the AnalyticsModelingErrorCode enum contains unique message ids, - * non-null names, descriptions and can be serialized to JSON and back again. - */ -public class ErrorCodeTest extends ExceptionMessageSetTest -{ - final static String messageIdPrefix = "OMAS-ANALYTICS-MODELING"; - - /** - * Validated the values of the enum. - */ - @Test public void testAllErrorCodeValues() - { - for (AnalyticsModelingErrorCode errorCode : AnalyticsModelingErrorCode.values()) - { - super.testSingleErrorCodeValue(errorCode, messageIdPrefix); - } - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ModuleTableFilterTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ModuleTableFilterTest.java deleted file mode 100644 index ab8573446c1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ModuleTableFilterTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model; - -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; - -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.testng.annotations.Test; - -public class ModuleTableFilterTest { - - private List tables = Arrays.asList("ORDERDETAIL", "PRODUCT"); - - @Test - public void toJsonExcludedTables() { - ModuleTableFilter obj = new ModuleTableFilter(); - obj.getMeta().setExcludedTables(tables); - TestUtilities.assertObjectJson(obj, JsonMocks.getModuleTableExcludedFilterBody()); - } - @Test - public void toJsonIncludedTables() { - ModuleTableFilter obj = new ModuleTableFilter(); - obj.getMeta().setIncludedTables(tables); - TestUtilities.assertObjectJson(obj, JsonMocks.getModuleTableIncludedFilterBody()); - } - @Test - public void fromJsonExcludedTables() { - ModuleTableFilter obj = TestUtilities.readObjectJson(JsonMocks.getModuleTableExcludedFilterBody(), ModuleTableFilter.class); - assertEquals(tables, obj.getMeta().getExcludedTables()); - assertNull(obj.getMeta().getIncludedTables()); - } - @Test - public void fromJsonIncludedTables() { - ModuleTableFilter obj = TestUtilities.readObjectJson(JsonMocks.getModuleTableIncludedFilterBody(), ModuleTableFilter.class); - assertEquals(tables, obj.getMeta().getIncludedTables()); - assertNull(obj.getMeta().getExcludedTables()); - } - @Test - public void filterIncludedTables() { - ModuleTableFilter obj = TestUtilities.readObjectJson(JsonMocks.getModuleTableIncludedFilterBody(), ModuleTableFilter.class); - assertTrue(obj.match(tables.get(0))); - assertFalse(obj.match("NOT_INCLUDED_TABLE")); - } - @Test - public void filterExcludedTables() { - ModuleTableFilter obj = TestUtilities.readObjectJson(JsonMocks.getModuleTableExcludedFilterBody(), ModuleTableFilter.class); - assertFalse(obj.match(tables.get(0))); - assertTrue(obj.match("NOT_EXCLUDED_TABLE")); - } - @Test - public void filterEmptyTables() { - ModuleTableFilter obj = new ModuleTableFilter(); - assertTrue(obj.match(tables.get(0))); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerDatabaseSchemaTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerDatabaseSchemaTest.java deleted file mode 100644 index 5ef736da969..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerDatabaseSchemaTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model; - -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ResponseContainerDatabaseSchemaTest { - - private static final String CATALOG_NAME = "GOSALES"; - private static final String SCHEMA_NAME = "sys"; - - - String master = String.format("{%n" + - " \"id\" : \"GOSALES/sys\",%n" + - " \"type\" : \"schema\",%n" + - " \"attributes\" : {%n" + - " \"catalog\" : \"GOSALES\",%n" + - " \"schema\" : \"sys\",%n" + - " \"schemaType\" : \"user\"%n" + - " }%n" + - "}"); - - @Test - public void toJson() { - ResponseContainerDatabaseSchema ds = new ResponseContainerDatabaseSchema(); - - ds.setSchema(SCHEMA_NAME); - ds.setCatalog(CATALOG_NAME); - ds.setId(ds.buildId()); - - TestUtilities.assertObjectJson(ds, master); - } - - @Test - public void fromJson() { - - ResponseContainerDatabaseSchema ds = TestUtilities.readObjectJson(master, ResponseContainerDatabaseSchema.class); - - assertEquals(SCHEMA_NAME, ds.getSchema()); - assertEquals(CATALOG_NAME, ds.getCatalog()); - assertEquals("user", ds.getSchemaType()); - assertEquals(CATALOG_NAME + "/" + SCHEMA_NAME, ds.getId()); - assertEquals(ResponseContainerDatabaseSchema.TYPE_SCHEMA, ds.getType()); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerDatabaseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerDatabaseTest.java deleted file mode 100644 index d9dc7ed5bf5..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerDatabaseTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model; - -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ResponseContainerDatabaseTest { - - private static final String GUID = "database@1234"; - private static final String DB_NAME = "GOSALES"; - private static final String TYPE = "Microsoft SQL Server"; - private static final String VERSION = "12.00.6108"; - - - String master = String.format("{%n" + - " \"id\" : \"%s\",%n" + - " \"type\" : \"database\",%n" + - " \"attributes\" : {%n" + - " \"guid\" : \"%s\",%n" + - " \"name\" : \"%s\",%n" + - " \"type\" : \"%s\",%n" + - " \"version\" : \"%s\"%n" + - " }%n" + - "}", DB_NAME, GUID, DB_NAME, TYPE, VERSION); - - @Test - public void toJson() { - ResponseContainerDatabase ds = new ResponseContainerDatabase(); - - ds.setId(DB_NAME); - ds.setGUID(GUID); - ds.setDbName(DB_NAME); - ds.setDbType(TYPE); - ds.setDbVersion(VERSION); - - TestUtilities.assertObjectJson(ds, master); - } - - @Test - public void fromJson() { - - ResponseContainerDatabase ds = TestUtilities.readObjectJson(master, ResponseContainerDatabase.class); - - assertEquals(GUID, ds.getGUID()); - assertEquals(DB_NAME, ds.getDbName()); - assertEquals(TYPE, ds.getDbType()); - assertEquals(VERSION, ds.getDbVersion()); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerSchemaTablesTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerSchemaTablesTest.java deleted file mode 100644 index c4d33be3213..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/ResponseContainerSchemaTablesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model; - - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; - -import java.util.Arrays; -import java.util.List; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ResponseContainerSchemaTablesTest { - - String master = String.format("{%n" + - " \"type\" : \"tables\",%n" + - " \"attributes\" : {%n" + - " \"tables\" : [ \"A\", \"C\", \"B\" ]%n" + - " }%n" + - "}"); - - List tables = Arrays.asList("A", "C", "B"); - - @Test - public void toJson() { - ResponseContainerSchemaTables st = new ResponseContainerSchemaTables(); - - st.setTablesList(tables); - - TestUtilities.assertObjectJson(st, master); - } - - @Test - public void fromJson() { - - ResponseContainerSchemaTables st = TestUtilities.readObjectJson(master, ResponseContainerSchemaTables.class); - - assertNull(st.getId()); - assertEquals(ResponseContainerSchemaTables.TYPE_TABLES, st.getType()); - assertEquals(tables, st.getTablesList()); - - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/BaseObjectTypeTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/BaseObjectTypeTest.java deleted file mode 100644 index be2fbc96283..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/BaseObjectTypeTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.*; -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.BaseObjectType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class BaseObjectTypeTest { - - String master = JsonMocks.getBaseObjectType(); - - @Test - public void toJson() { - BaseObjectType obj = new BaseObjectType(); - - obj.addProperty(JsonMocks.PROPERTY_NAME,JsonMocks.PROPERTY_VALUE); - obj.addProperty(JsonMocks.PROPERTY_NAME2,JsonMocks.PROPERTY_VALUE2); - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - BaseObjectType obj = new BaseObjectType(); - - TestUtilities.assertObjectJson(obj, JsonMocks.getEmptyJson()); - } - - @Test - public void fromJson() { - - BaseObjectType obj = TestUtilities.readObjectJson(master, BaseObjectType.class); - - assertEquals(obj.getProperty().size(), 2, "Wrong property collection size"); - assertEquals(obj.getPropertyByName(JsonMocks.PROPERTY_NAME).getValue(), JsonMocks.PROPERTY_VALUE, "Wrong property value"); - assertEquals(obj.getPropertyByName(JsonMocks.PROPERTY_NAME2).getValue(), JsonMocks.PROPERTY_VALUE2, "Wrong property2 value"); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ColumnTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ColumnTest.java deleted file mode 100644 index 05cd1589291..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ColumnTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.*; -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Column; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ColumnTest { - - private static final String DATA_TYPE = "DATA_TYPE"; - private static final String VENDOR_TYPE = "VENDOR_TYPE"; - private static final String COLUMN_NAME = "COLUMN_NAME"; - - String master = String.format("{%n" + - " \"name\" : \"COLUMN_NAME\",%n" + - " \"vendorType\" : \"VENDOR_TYPE\",%n" + - " \"nullable\" : true,%n" + - " \"datatype\" : \"DATA_TYPE\"%n" + - "}"); - - String master_empty = "{ }"; - - @Test - public void toJson() { - Column obj = new Column(); - - obj.setName(COLUMN_NAME); - obj.setNullable(true); - obj.setVendorType(VENDOR_TYPE); - obj.setDatatype(DATA_TYPE); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - Column obj = new Column(); - - TestUtilities.assertObjectJson(obj, master_empty); - } - - @Test - public void fromJson() { - - Column obj = TestUtilities.readObjectJson(master, Column.class); - - assertEquals(COLUMN_NAME, obj.getName()); - assertEquals(Boolean.TRUE, obj.isNullable()); - assertEquals(VENDOR_TYPE, obj.getVendorType()); - assertEquals(DATA_TYPE, obj.getDatatype()); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/DataSourceTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/DataSourceTest.java deleted file mode 100644 index c597e94a78b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/DataSourceTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.assertEquals; - -import java.util.Arrays; -import java.util.List; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.DataSource; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Table; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class DataSourceTest { - - private static final String DATASOURCE_NAME = "DATASOURCE_NAME"; - private static final String SCHEMA = "SCHEMA"; - private static final String CATALOG = "CATALOG"; - - String master = String.format("{%n" + - " \"schema\" : \"SCHEMA\",%n" + - " \"catalog\" : \"CATALOG\",%n" + - " \"name\" : \"DATASOURCE_NAME\",%n" + - " \"table\" : [ { }, { } ]%n" + - "}"); - - String master_empty = "{ }"; - - List
tables = Arrays.asList(new Table(), new Table()); - - @Test - public void toJson() { - DataSource obj = new DataSource(); - - obj.setName(DATASOURCE_NAME); - obj.setCatalog(CATALOG); - obj.setSchema(SCHEMA); - obj.setTable(tables); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - TestUtilities.assertObjectJson(new DataSource(), master_empty); - } - - @Test - public void fromJson() { - - DataSource obj = TestUtilities.readObjectJson(master, DataSource.class); - - assertEquals(DATASOURCE_NAME, obj.getName()); - assertEquals(SCHEMA, obj.getSchema()); - assertEquals(CATALOG, obj.getCatalog()); - assertEquals(2, obj.getTable().size()); - - TestUtilities.assertObjectJson(obj, master); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ForeignColumnTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ForeignColumnTest.java deleted file mode 100644 index c2fe73e2c95..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ForeignColumnTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignColumn; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ForeignColumnTest { - - private static final String COLUMN_NAME = "COLUMN_NAME"; - private static final String PK_CATALOG = "PK_CATALOG"; - private static final String PK_COLUMN = "PK_COLUMN"; - private static final String PK_SCHEMA = "PK_SCHEMA"; - private static final String PK_TABLE = "PK_TABLE"; - - String master = String.format("{%n" + - " \"pkColumn\" : \"PK_COLUMN\",%n" + - " \"pkCatalog\" : \"PK_CATALOG\",%n" + - " \"pkSchema\" : \"PK_SCHEMA\",%n" + - " \"pkTable\" : \"PK_TABLE\",%n" + - " \"columnName\" : \"COLUMN_NAME\"%n" + - "}"); - - String master_empty = "{ }"; - - @Test - public void toJson() { - ForeignColumn obj = new ForeignColumn(); - - obj.setColumnName(COLUMN_NAME); - obj.setPkCatalog(PK_CATALOG); - obj.setPkColumn(PK_COLUMN); - obj.setPkSchema(PK_SCHEMA); - obj.setPkTable(PK_TABLE); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - TestUtilities.assertObjectJson(new ForeignColumn(), master_empty); - } - - @Test - public void fromJson() { - - ForeignColumn obj = TestUtilities.readObjectJson(master, ForeignColumn.class); - - assertEquals(COLUMN_NAME, obj.getColumnName()); - assertEquals(PK_CATALOG, obj.getPkCatalog()); - assertEquals(PK_COLUMN, obj.getPkColumn()); - assertEquals(PK_SCHEMA, obj.getPkSchema()); - assertEquals(PK_TABLE, obj.getPkTable()); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ForeignKeyTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ForeignKeyTest.java deleted file mode 100644 index b19d7a53e7a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ForeignKeyTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - - -import static org.testng.Assert.assertEquals; - -import java.util.Arrays; -import java.util.List; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignColumn; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignKey; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ForeignKeyTest { - - private static final String FK_NAME = "FK_NAME"; - - String master = String.format("{%n" + - " \"name\" : \"FK_NAME\",%n" + - " \"fkColumn\" : [ {%n" + - " \"columnName\" : \"A\"%n" + - " }, {%n" + - " \"columnName\" : \"B\"%n" + - " } ]%n" + - "}"); - - String master_empty = "{ }"; - - List columns = Arrays.asList(newNamedFK("A"), newNamedFK("B")); - - /** - * Helper function to create foreign key column - * @param name of the foreign key columns - * @return created new foreign key column - */ - ForeignColumn newNamedFK (String name) { - ForeignColumn ret = new ForeignColumn(); - ret.setColumnName(name); - return ret; - } - - @Test - public void toJson() { - ForeignKey obj = new ForeignKey(); - - obj.setName(FK_NAME); - obj.setFkColumn(columns); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - TestUtilities.assertObjectJson(new ForeignColumn(), master_empty); - } - - @Test - public void fromJson() { - - ForeignKey obj = TestUtilities.readObjectJson(master, ForeignKey.class); - - assertEquals(FK_NAME, obj.getName()); - assertEquals(2, obj.getFkColumn().size()); - assertEquals("A", obj.getFkColumn().get(0).getColumnName()); - - TestUtilities.assertObjectJson(obj, master); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ModuleTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ModuleTest.java deleted file mode 100644 index 93e3759f8a3..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/ModuleTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.DataSource; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ModuleTest { - - private static final String IDENTIFIER = "IDENTIFIER"; - private static final String VERSION = "9.0"; - - String master = String.format("{%n" + - " \"identifier\" : \"IDENTIFIER\",%n" + - " \"version\" : \"9.0\",%n" + - " \"dataSource\" : [ { }, { } ]%n" + - "}"); - - String master_empty = String.format("{%n" + - " \"version\" : \"9.0\"%n" + - "}"); - - List sources = Arrays.asList(new DataSource(), new DataSource()); - - @Test - public void toJson() { - MetadataModule obj = new MetadataModule(); - - obj.setIdentifier(IDENTIFIER); - obj.setDataSource(sources); - // version set fixed - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - TestUtilities.assertObjectJson(new MetadataModule(), master_empty); - } - - @Test - public void fromJson() { - - MetadataModule obj = TestUtilities.readObjectJson(master, MetadataModule.class); - - assertEquals(IDENTIFIER, obj.getIdentifier()); - assertEquals(VERSION, obj.getVersion()); - assertEquals(2, obj.getDataSource().size()); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void completeModule() throws IOException { - - String module = TestUtilities.readJsonFile("/src/test/resources/", "completeModule"); - - MetadataModule obj = TestUtilities.readObjectJson(module, MetadataModule.class); - - assertEquals("AdventureWorks2014.Person", obj.getIdentifier()); - assertEquals(VERSION, obj.getVersion()); - assertEquals(1, obj.getDataSource().size()); - - TestUtilities.assertObjectJson(obj, module); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/PrimaryKeyTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/PrimaryKeyTest.java deleted file mode 100644 index f564d6509f9..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/PrimaryKeyTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - - -import static org.testng.Assert.assertEquals; - -import java.util.Arrays; -import java.util.List; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PrimaryKey; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class PrimaryKeyTest { - - private static final String PK_NAME = "PK_NAME"; - - String master = String.format("{%n" + - " \"name\" : \"PK_NAME\",%n" + - " \"keyedColumn\" : [ \"KEY_COLUMN_1\", \"KEY_COLUMN_2\" ]%n" + - "}"); - - List columns = Arrays.asList("KEY_COLUMN_1", "KEY_COLUMN_2"); - - @Test - public void toJson() { - PrimaryKey obj = new PrimaryKey(); - - obj.setName(PK_NAME); - obj.setKeyedColumn(columns); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void fromJson() { - - PrimaryKey obj = TestUtilities.readObjectJson(master, PrimaryKey.class); - - assertEquals(PK_NAME, obj.getName()); - assertEquals(columns, obj.getKeyedColumn()); - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/PropertyTypeTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/PropertyTypeTest.java deleted file mode 100644 index bf04b3a924a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/PropertyTypeTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.*; -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class PropertyTypeTest { - - String master = JsonMocks.getProperty(JsonMocks.PROPERTY_NAME,JsonMocks.PROPERTY_VALUE); - - @Test - public void toJson() { - PropertyType obj = new PropertyType(); - - obj.setName(JsonMocks.PROPERTY_NAME); - obj.setValue(JsonMocks.PROPERTY_VALUE); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - PropertyType obj = new PropertyType(); - - TestUtilities.assertObjectJson(obj, JsonMocks.getEmptyJson()); - } - - @Test - public void fromJson() { - - PropertyType obj = TestUtilities.readObjectJson(master, PropertyType.class); - - assertEquals(JsonMocks.PROPERTY_NAME, obj.getName()); - assertEquals(JsonMocks.PROPERTY_VALUE, obj.getValue()); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/TableItemTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/TableItemTest.java deleted file mode 100644 index a4c85068126..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/TableItemTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.assertNotNull; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Column; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.TableItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class TableItemTest { - - String master = String.format("{%n" + - " \"column\" : { }%n" + - "}"); - - String master_empty = "{ }"; - - @Test - public void toJson() { - TableItem obj = new TableItem(); - obj.setColumn(new Column()); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - TableItem obj = new TableItem(); - - TestUtilities.assertObjectJson(obj, master_empty); - } - - @Test - public void fromJson() { - - TableItem obj = TestUtilities.readObjectJson(master, TableItem.class); - - assertNotNull(obj.getColumn()); - TestUtilities.assertObjectJson(obj, master); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/TableTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/TableTest.java deleted file mode 100644 index b69adebc8ab..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/module/TableTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.module; - -import static org.testng.Assert.assertEquals; - -import java.util.Arrays; -import java.util.List; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignKey; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PrimaryKey; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Table; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.TableItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class TableTest { - - private static final String TABLE_NAME = "TABLE_NAME"; - - String master = String.format("{%n" + - " \"name\" : \"TABLE_NAME\",%n" + - " \"tableItem\" : [ { }, { } ],%n" + - " \"foreignKey\" : [ { }, { } ],%n" + - " \"primaryKey\" : [ { }, { } ]%n" + - "}"); - - String master_empty = "{ }"; - - List columns = Arrays.asList(new TableItem(), new TableItem()); - List foreignKey = Arrays.asList(new ForeignKey(), new ForeignKey()); - List primaryKey = Arrays.asList(new PrimaryKey(), new PrimaryKey()); - - @Test - public void toJson() { - Table obj = new Table(); - - obj.setName(TABLE_NAME); - obj.setTableItem(columns); - obj.setForeignKey(foreignKey); - obj.setPrimaryKey(primaryKey); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - TestUtilities.assertObjectJson(new Table(), master_empty); - } - - @Test - public void fromJson() { - - Table obj = TestUtilities.readObjectJson(master, Table.class); - - assertEquals(TABLE_NAME, obj.getName()); - assertEquals(2, obj.getForeignKey().size()); - assertEquals(2, obj.getPrimaryKey().size()); - assertEquals(2, obj.getTableItem().size()); - - TestUtilities.assertObjectJson(obj, master); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/response/AnalyticsMessageTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/response/AnalyticsMessageTest.java deleted file mode 100644 index 50e14cf9e32..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/model/response/AnalyticsMessageTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.model.response; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.AnalyticsMessage; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.testng.annotations.Test; - -public class AnalyticsMessageTest { - - - private static final String SEVERITY = "error"; - private static final String ERROR_TITLE = "Error title"; - private static final String ERROR_DETAIL = "Error Detail"; - private static final String HTTP_STATUS = "200"; - private static final String CODE = "CODE"; - - String master = JsonMocks.getError(HTTP_STATUS, CODE, ERROR_TITLE, ERROR_DETAIL, SEVERITY); - - String master_empty = String.format("{%n" + - " \"meta\" : {%n" + - " \"severity\" : \"%s\"%n" + - " }%n" + - "}", SEVERITY); - - @Test - public void toJson() { - AnalyticsMessage obj = new AnalyticsMessage(); - - obj.setCode(CODE); - obj.setStatus(HTTP_STATUS); - obj.setDetail(ERROR_DETAIL); - obj.setTitle(ERROR_TITLE); - obj.setSeverity(SEVERITY); - - TestUtilities.assertObjectJson(obj, master); - } - - @Test - public void toJsonEmpty() { - AnalyticsMessage obj = new AnalyticsMessage(); - - TestUtilities.assertObjectJson(obj, master_empty); - } - - @Test - public void fromJson() { - - AnalyticsMessage obj = TestUtilities.readObjectJson(master, AnalyticsMessage.class); - TestUtilities.assertObjectJson(obj, master); - }} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/AssetsReponseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/AssetsReponseTest.java deleted file mode 100644 index 10afc2cd52c..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/AssetsReponseTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.responses; - -import org.testng.annotations.Test; - -import java.io.IOException; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AssetsResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ModuleResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemaTablesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class AssetsReponseTest { - @Test - public void test() throws IOException { - - AssetsResponse obj = new AssetsResponse(); - ResponseContainerAssets assets = TestUtilities.readObjectJson( - JsonMocks.getResponseAssets("guid-1", "guid-2"), ResponseContainerAssets.class); - - obj.setAssetList(assets); - Messages message = new Messages(); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2")); - obj.setMeta(message); - - String response = TestUtilities.readJsonFile("/src/test/resources/", "AssetsReponse"); - TestUtilities.assertObjectJson(obj, response); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/DatabaseReponseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/DatabaseReponseTest.java deleted file mode 100644 index 3844ba7302d..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/DatabaseReponseTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.responses; - -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.DatabasesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class DatabaseReponseTest { - @Test - public void test() throws IOException { - - DatabasesResponse obj = new DatabasesResponse(); - List databases = Arrays.asList( - TestUtilities.readObjectJson(JsonMocks.getResponseDatabase("guid-1", "ProductDB", "DB2", "10.7"), ResponseContainerDatabase.class), - TestUtilities.readObjectJson(JsonMocks.getResponseDatabase("guid-2", "InventoryDB", "OR", "11.0"), ResponseContainerDatabase.class)); - obj.setDatabasesList(databases); - Messages message = new Messages(); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2")); - obj.setMeta(message); - - String response = TestUtilities.readJsonFile("/src/test/resources/", "DatabaseReponse"); - TestUtilities.assertObjectJson(obj, response); - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/ErrorResponseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/ErrorResponseTest.java deleted file mode 100644 index eb225df508c..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/ErrorResponseTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.responses; - -import org.testng.annotations.Test; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ErrorResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ErrorResponseTest { - - - String master = String.format("{%n" + - " \"class\" : \"ErrorResponse\",%n" + - " \"relatedHTTPCode\" : 500,%n" + - " \"errors\" : [ {%n" + - " \"status\" : \"500\",%n" + - " \"code\" : \"OMAS-ANALYTICS-MODELING-007\",%n" + - " \"title\" : \"OMAS-ANALYTICS-MODELING-007 The model for entity guidEntity is not correct: error description\",%n" + - " \"meta\" : {%n" + - " \"severity\" : \"error\"%n" + - " }%n" + - " } ]%n" + - "}"); - - @Test - public void toJson() { - - AnalyticsModelingCheckedException ex = new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.INCORRECT_MODEL_EXCEPTION.getMessageDefinition("guidEntity", "error description"), - "ErrorResponse", - ""); - - ErrorResponse er = new ErrorResponse(ex); - - - TestUtilities.assertObjectJson(er, master); - } - - @Test - public void fromJson() { - - ErrorResponse er = TestUtilities.readObjectJson(master, ErrorResponse.class); - - - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/ModuleReponseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/ModuleReponseTest.java deleted file mode 100644 index 1b366271ee6..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/ModuleReponseTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.responses; - -import org.testng.annotations.Test; - -import java.io.IOException; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ModuleResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class ModuleReponseTest { - @Test - public void test() throws IOException { - - ModuleResponse obj = new ModuleResponse(); - ResponseContainerModule module = new ResponseContainerModule(); - module.setPhysicalModule(new MetadataModule()); - - obj.setModule(module); - Messages message = new Messages(); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2")); - obj.setMeta(message); - - String response = TestUtilities.readJsonFile("/src/test/resources/", "ModuleReponse"); - TestUtilities.assertObjectJson(obj, response); - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/SchemaReponseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/SchemaReponseTest.java deleted file mode 100644 index e77b3e98818..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/SchemaReponseTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.responses; - -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemasResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class SchemaReponseTest { - @Test - public void test() throws IOException { - - SchemasResponse obj = new SchemasResponse(); - List databaseSchemas = Arrays.asList( - TestUtilities.readObjectJson(JsonMocks.getResponseSchema("dbo", "Product", "user"), ResponseContainerDatabaseSchema.class), - TestUtilities.readObjectJson(JsonMocks.getResponseSchema("dbo", "master", "system"), ResponseContainerDatabaseSchema.class)); - obj.setSchemaList(databaseSchemas); - Messages message = new Messages(); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2")); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2"), - "Message of the exception caused the warning."); - obj.setMeta(message); - - String response = TestUtilities.readJsonFile("/src/test/resources/", "SchemasReponse"); - TestUtilities.assertObjectJson(obj, response); - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/SchemaTablesReponseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/SchemaTablesReponseTest.java deleted file mode 100644 index 30335f0387f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/responses/SchemaTablesReponseTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.responses; - -import org.testng.annotations.Test; - -import java.io.IOException; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemaTablesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; - -public class SchemaTablesReponseTest { - @Test - public void test() throws IOException { - - SchemaTablesResponse obj = new SchemaTablesResponse(); - ResponseContainerSchemaTables tables = TestUtilities.readObjectJson( - JsonMocks.getResponseSchemaTables("Country", "Product", "Sales"), ResponseContainerSchemaTables.class); - - obj.setTableList(tables); - Messages message = new Messages(); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2")); - message.addWarning(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK.getMessageDefinition("I1", "I2"), - "Message of the exception caused the warning."); - obj.setMeta(message); - - String response = TestUtilities.readJsonFile("/src/test/resources/", "SchemaTablesReponse"); - TestUtilities.assertObjectJson(obj, response); - } - - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/JsonMocks.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/JsonMocks.java deleted file mode 100644 index 5649ca2edd8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/JsonMocks.java +++ /dev/null @@ -1,150 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils; - -public class JsonMocks { - - public static final String PROPERTY_NAME = "property_name"; - public static final String PROPERTY_VALUE = "property_value"; - public static final String PROPERTY_NAME2 = "property_name2"; - public static final String PROPERTY_VALUE2 = "property_value2"; - - public static String getEmptyJson() { - return "{ }"; - } - - public static String getProperty(String name, String value) { - return String.format( - "{%n" + - " \"name\" : \"%s\",%n" + - " \"value\" : \"%s\"%n" + - "}", name, value); - } - - public static String getBaseObjectType() { - return String.format( - "{%n" + - " \"property\" : [ {%n" + - " \"name\" : \"property_name\",%n" + - " \"value\" : \"property_value\"%n" + - " }, {%n" + - " \"name\" : \"property_name2\",%n" + - " \"value\" : \"property_value2\"%n" + - " } ]%n" + - "}"); - } - - /** - * Body for the request to get module that defines set of tables to include. - * @return the request body - */ - public static String getModuleTableIncludedFilterBody() { - return String.format( - "{%n" + - " \"meta\" : {%n" + - " \"includedTables\" : [ \"ORDERDETAIL\", \"PRODUCT\" ]%n" + - " }%n" + - "}"); - } - /** - * Body for the request to get module that defines set of tables to exclude. - * @return the request body - */ - public static String getModuleTableExcludedFilterBody() { - return String.format( - "{%n" + - " \"meta\" : {%n" + - " \"excludedTables\" : [ \"ORDERDETAIL\", \"PRODUCT\" ]%n" + - " }%n" + - "}"); - } - - /** - * Body for the request to get module that defines set of tables to exclude. - * @param httpStatus of the error. - * @param code of the error. - * @param errorTitle of the error. - * @param errorDetail of the error. - * @param severity of the error. - * @return error json. - */ - public static String getError(String httpStatus, String code, String errorTitle, String errorDetail, String severity) { - return String.format("{%n" + - " \"status\" : \"%s\",%n" + - " \"code\" : \"%s\",%n" + - " \"title\" : \"%s\",%n" + - " \"detail\" : \"%s\",%n" + - " \"meta\" : {%n" + - " \"severity\" : \"%s\"%n" + - " }%n" + - "}", httpStatus, code, errorTitle, errorDetail, severity); - } - - - /** - * Get json of ResponseContainerDatabase object from template. - * @param guid of the database. - * @param name of the database. - * @param type of the database. - * @param version of the database. - * @return ResponseContainerDatabase json - */ - public static String getResponseDatabase(String guid, String name, String type, String version) { - return String.format("{%n" + - " \"attributes\": {%n" + - " \"guid\": \"%s\",%n" + - " \"name\": \"%s\",%n" + - " \"type\": \"%s\",%n" + - " \"version\": \"%s\"%n" + - " },%n" + - " \"type\": \"database\"%n" + - "}", guid, name, type, version); - } - /** - * Get json of ResponseContainerDatabaseSchema object from template. - * @param catalog of the database. - * @param schema of the database. - * @param schemaType of the schema. - * @return ResponseContainerDatabaseSchema json. - */ - public static String getResponseSchema(String catalog, String schema, String schemaType) { - return String.format("{%n" + - " \"attributes\": {%n" + - " \"catalog\": \"%s\",%n" + - " \"schema\": \"%s\",%n" + - " \"schemaType\": \"%s\"%n" + - " },%n" + - " \"type\": \"schema\"%n" + - "}", catalog, schema, schemaType); - } - /** - * Get json of ResponseContainerSchemaTables object from template. - * @param tableNames from the schema - * @return ResponseContainerSchemaTables json. - */ - public static String getResponseSchemaTables(String ...tableName) { - String names = String.join("\", \"", tableName); - return String.format("{%n" + - " \"attributes\": {%n" + - " \"tables\": [\"%s\"]%n" + - " },%n" + - " \"type\": \"tables\"%n" + - "}", names); - } - - /** - * Get json of ResponseContainerAssets object from template. - * @param assetGuids list of guids in the response. - * @return ResponseContainerAssets json - */ - public static String getResponseAssets(String ...assetGuids) { - String names = String.join("\", \"", assetGuids); - return String.format("{%n" + - " \"attributes\": {%n" + - " \"assets\": [\"%s\"]%n" + - " },%n" + - " \"type\": \"assets\"%n" + - "}", names); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/TestUtilities.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/TestUtilities.java deleted file mode 100644 index f2e2bc5eead..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/TestUtilities.java +++ /dev/null @@ -1,167 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.fail; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Collections; -import java.util.HashSet; -import java.util.Optional; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.BaseObjectType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Column; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.DataSource; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PropertyType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Table; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * Class for static function helpers to setup, run, assert junit tests. - * - * - */ -public class TestUtilities { - - - /** - * Assert the object content same as in master. - * @param ds content to test. - * @param master to compare with. - */ - public static void assertObjectJson(Object ds, String master) { - String output = writeObjectJson(ds); - assertEquals(output, master, ds.getClass().getName() + " json failed."); - } - - /** - * Build string with JSON content of the object. - * @param ds object source of the content. - * @return string with JSON. - */ - public static String writeObjectJson(Object ds) { - ObjectMapper om = new ObjectMapper(); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - try { - om.writerWithDefaultPrettyPrinter().writeValue(baos, ds); - } catch (IOException e) { - fail("Can't write JSON for object " + ds.getClass().getName()); - } - return new String(baos.toByteArray(), StandardCharsets.UTF_8); - } - - /** - * Build object from JSON content provided in string. - * @param class of the object to build. - * @param json source of the object content. - * @param cls class to build. - * @return - */ - public static T readObjectJson(String json, Class cls) { - ObjectMapper mapper = new ObjectMapper(); - try { - return mapper.readValue(json, cls); - } catch (JsonProcessingException e) { - fail("Can't read from JSON object " + cls.getName() + ":\n" + e.getMessage()); - } - return null; - } - - /** - * Read file content into a string. - * @param folder location of the file. - * @param fileName without extension, JSON extension is appended. - * @return string with file content. - * @throws IOException - */ - public static String readJsonFile(String folder, String fileName) throws IOException { - String root = Paths.get(".").toAbsolutePath().normalize().toString(); - String input = root + folder + fileName + ".json"; - return new String(Files.readAllBytes(Paths.get(input))); - } - - /** - * Validate GUID uniqueness and replace them to predicted values for junit assert. - * @param moduleResponse to validate. - */ - public static void validateGUIDs(ResponseContainerModule moduleResponse) { - MetadataModule module = moduleResponse.getPhysicalModule(); - HashSet guids = new HashSet<>(); - - fixGUID(module, guids); - - module.getDataSource().forEach(ds->{ - fixGUID(ds, guids); // fix data source guid - - Optional.ofNullable(ds.getTable()).orElse(Collections.emptyList()) - .forEach(tbl->{ - fixGUID(tbl, guids); // fix tables guid - Optional.ofNullable(tbl.getTableItem()).orElse(Collections.emptyList()) - .forEach(item->{ - fixGUID(item.getColumn(), guids); // fix column guid - }); - }); - }); - } - - /** - * Fix GUIDs from random values to guid_'identifier' - * @param object having random GUID - * @param guids values from module - */ - private static void fixGUID(BaseObjectType object, HashSet guids) { - PropertyType guid = object.getPropertyByName("guid"); - - if (guid == null) { - return; - } - - assertFalse(guids.contains(guid.getValue()), "Not unique guid."); - - guids.add(guid.getValue()); // mark as guid that had been processed - guid.setValue(generateGUID(object)); // set predefined guid value - - PropertyType term = object.getPropertyByName("GlossaryTerm"); - if ( term == null) { - return; - } - String value = term.getValue().replaceFirst("\\\"guid\\\":\\\"[0-9abcdef\\-]+\\\"", - String.format("\\\"guid\":\"GlossaryTerm_%s\"", guid.getValue())); - term.setValue(value); - } - - /** - * Generate fake GUID based on class and name. - * @param object whose GUID to generate. - * @return predictable GUID like ClassName@displayName - */ - private static String generateGUID(BaseObjectType object) { - - String prefix = object.getClass().getSimpleName() + "@"; - if (object instanceof Column) { - return prefix + ((Column)object).getName(); - } else if(object instanceof Table) { - return prefix + ((Table)object).getName(); - } else if(object instanceof DataSource) { - return prefix + ((DataSource)object).getName(); - } else if(object instanceof MetadataModule) { - return prefix + ((MetadataModule)object).getIdentifier(); - } - - fail("Unknown class: " + object.getClass().getName()); - return null; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/AssetsReponse.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/AssetsReponse.json deleted file mode 100644 index 7fa1d56bf99..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/AssetsReponse.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "class" : "AssetsResponse", - "relatedHTTPCode" : 200, - "meta" : { - "messages" : [ { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "The system is unable to create metadata link. Review the error message and permissions.", - "meta" : { - "severity" : "warning" - } - } ] - }, - "data" : [ { - "type" : "assets", - "attributes" : { - "assets" : [ "guid-1", "guid-2" ] - } - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/DatabaseReponse.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/DatabaseReponse.json deleted file mode 100644 index 27e8edb132b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/DatabaseReponse.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "class" : "DatabasesResponse", - "relatedHTTPCode" : 200, - "meta" : { - "messages" : [ { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "The system is unable to create metadata link. Review the error message and permissions.", - "meta" : { - "severity" : "warning" - } - } ] - }, - "data" : [ { - "type" : "database", - "attributes" : { - "guid" : "guid-1", - "name" : "ProductDB", - "type" : "DB2", - "version" : "10.7" - } - }, { - "type" : "database", - "attributes" : { - "guid" : "guid-2", - "name" : "InventoryDB", - "type" : "OR", - "version" : "11.0" - } - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/ModuleReponse.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/ModuleReponse.json deleted file mode 100644 index cab5919fcf8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/ModuleReponse.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "class" : "ModuleResponse", - "relatedHTTPCode" : 200, - "meta" : { - "messages" : [ { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "The system is unable to create metadata link. Review the error message and permissions.", - "meta" : { - "severity" : "warning" - } - } ] - }, - "data" : [ { - "type" : "module", - "attributes" : { - "physicalDefinition" : { - "version" : "9.0" - } - } - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/SchemaTablesReponse.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/SchemaTablesReponse.json deleted file mode 100644 index 585524a01e3..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/SchemaTablesReponse.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "class" : "SchemaTablesResponse", - "relatedHTTPCode" : 200, - "meta" : { - "messages" : [ { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "The system is unable to create metadata link. Review the error message and permissions.", - "meta" : { - "severity" : "warning" - } - }, { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "Message of the exception caused the warning.", - "meta" : { - "severity" : "warning" - } - } ] - }, - "data" : [ { - "type" : "tables", - "attributes" : { - "tables" : [ "Country", "Product", "Sales" ] - } - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/SchemasReponse.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/SchemasReponse.json deleted file mode 100644 index cc98bd63921..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/SchemasReponse.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "class" : "SchemasResponse", - "relatedHTTPCode" : 200, - "meta" : { - "messages" : [ { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "The system is unable to create metadata link. Review the error message and permissions.", - "meta" : { - "severity" : "warning" - } - }, { - "status" : "206", - "code" : "OMAS-ANALYTICS-MODELING-313", - "title" : "OMAS-ANALYTICS-MODELING-313 Can not create metadata link between item I1 and item I2.", - "detail" : "Message of the exception caused the warning.", - "meta" : { - "severity" : "warning" - } - } ] - }, - "data" : [ { - "type" : "schema", - "attributes" : { - "catalog" : "dbo", - "schema" : "Product", - "schemaType" : "user" - } - }, { - "type" : "schema", - "attributes" : { - "catalog" : "dbo", - "schema" : "master", - "schemaType" : "system" - } - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/completeModule.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/completeModule.json deleted file mode 100644 index 39c2a1b66b7..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-api/src/test/resources/completeModule.json +++ /dev/null @@ -1,780 +0,0 @@ -{ - "identifier" : "AdventureWorks2014.Person", - "version" : "9.0", - "dataSource" : [ { - "schema" : "Person", - "catalog" : "AdventureWorks2014", - "name" : "AdventureWorks2014.Person", - "table" : [ { - "name" : "Address", - "tableItem" : [ { - "column" : { - "name" : "AddressID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "AddressLine1", - "vendorType" : "nvarchar", - "nullable" : false, - "datatype" : "NVARCHAR(60)" - } - }, { - "column" : { - "name" : "AddressLine2", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(60)" - } - }, { - "column" : { - "name" : "City", - "vendorType" : "nvarchar", - "nullable" : false, - "datatype" : "NVARCHAR(30)" - } - }, { - "column" : { - "name" : "StateProvinceID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "PostalCode", - "vendorType" : "nvarchar", - "nullable" : false, - "datatype" : "NVARCHAR(15)" - } - }, { - "column" : { - "name" : "SpatialLocation", - "vendorType" : "geography", - "nullable" : true, - "datatype" : "VARBINARY(2147483647)" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_Address_StateProvince_StateProvinceID", - "fkColumn" : [ { - "pkColumn" : "StateProvinceID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "StateProvince", - "columnName" : "StateProvinceID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_Address_AddressID", - "keyedColumn" : [ "AddressID" ] - } ] - }, { - "name" : "AddressType", - "tableItem" : [ { - "column" : { - "name" : "AddressTypeID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "primaryKey" : [ { - "name" : "PK_AddressType_AddressTypeID", - "keyedColumn" : [ "AddressTypeID" ] - } ] - }, { - "name" : "BusinessEntity", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "primaryKey" : [ { - "name" : "PK_BusinessEntity_BusinessEntityID", - "keyedColumn" : [ "BusinessEntityID" ] - } ] - }, { - "name" : "BusinessEntityAddress", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "AddressID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "AddressTypeID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_BusinessEntityAddress_Address_AddressID", - "fkColumn" : [ { - "pkColumn" : "AddressID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "Address", - "columnName" : "AddressID" - } ] - }, { - "name" : "FK_BusinessEntityAddress_AddressType_AddressTypeID", - "fkColumn" : [ { - "pkColumn" : "AddressTypeID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "AddressType", - "columnName" : "AddressTypeID" - } ] - }, { - "name" : "FK_BusinessEntityAddress_BusinessEntity_BusinessEntityID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "BusinessEntity", - "columnName" : "BusinessEntityID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_BusinessEntityAddress_BusinessEntityID_AddressID_AddressTypeID", - "keyedColumn" : [ "BusinessEntityID", "AddressID", "AddressTypeID" ] - } ] - }, { - "name" : "BusinessEntityContact", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "PersonID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "ContactTypeID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_BusinessEntityContact_BusinessEntity_BusinessEntityID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "BusinessEntity", - "columnName" : "BusinessEntityID" - } ] - }, { - "name" : "FK_BusinessEntityContact_ContactType_ContactTypeID", - "fkColumn" : [ { - "pkColumn" : "ContactTypeID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "ContactType", - "columnName" : "ContactTypeID" - } ] - }, { - "name" : "FK_BusinessEntityContact_Person_PersonID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "Person", - "columnName" : "PersonID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_BusinessEntityContact_BusinessEntityID_PersonID_ContactTypeID", - "keyedColumn" : [ "BusinessEntityID", "PersonID", "ContactTypeID" ] - } ] - }, { - "name" : "ContactType", - "tableItem" : [ { - "column" : { - "name" : "ContactTypeID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "primaryKey" : [ { - "name" : "PK_ContactType_ContactTypeID", - "keyedColumn" : [ "ContactTypeID" ] - } ] - }, { - "name" : "CountryRegion", - "tableItem" : [ { - "column" : { - "name" : "CountryRegionCode", - "vendorType" : "nvarchar", - "nullable" : false, - "datatype" : "NVARCHAR(3)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "primaryKey" : [ { - "name" : "PK_CountryRegion_CountryRegionCode", - "keyedColumn" : [ "CountryRegionCode" ] - } ] - }, { - "name" : "EmailAddress", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "EmailAddressID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "EmailAddress", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_EmailAddress_Person_BusinessEntityID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "Person", - "columnName" : "BusinessEntityID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_EmailAddress_BusinessEntityID_EmailAddressID", - "keyedColumn" : [ "BusinessEntityID", "EmailAddressID" ] - } ] - }, { - "name" : "Password", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "PasswordHash", - "vendorType" : "varchar", - "nullable" : false, - "datatype" : "VARCHAR(128)" - } - }, { - "column" : { - "name" : "PasswordSalt", - "vendorType" : "varchar", - "nullable" : false, - "datatype" : "VARCHAR(10)" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_Password_Person_BusinessEntityID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "Person", - "columnName" : "BusinessEntityID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_Password_BusinessEntityID", - "keyedColumn" : [ "BusinessEntityID" ] - } ] - }, { - "name" : "Person", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "PersonType", - "vendorType" : "nchar", - "nullable" : false, - "datatype" : "NCHAR(2)" - } - }, { - "column" : { - "name" : "Title", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(8)" - } - }, { - "column" : { - "name" : "Suffix", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(10)" - } - }, { - "column" : { - "name" : "EmailPromotion", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "AdditionalContactInfo", - "vendorType" : "xml", - "nullable" : true, - "datatype" : "SQLXML" - } - }, { - "column" : { - "name" : "Demographics", - "vendorType" : "xml", - "nullable" : true, - "datatype" : "SQLXML" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_Person_BusinessEntity_BusinessEntityID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "BusinessEntity", - "columnName" : "BusinessEntityID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_Person_BusinessEntityID", - "keyedColumn" : [ "BusinessEntityID" ] - } ] - }, { - "name" : "PersonPhone", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "PhoneNumberTypeID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_PersonPhone_Person_BusinessEntityID", - "fkColumn" : [ { - "pkColumn" : "BusinessEntityID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "Person", - "columnName" : "BusinessEntityID" - } ] - }, { - "name" : "FK_PersonPhone_PhoneNumberType_PhoneNumberTypeID", - "fkColumn" : [ { - "pkColumn" : "PhoneNumberTypeID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "PhoneNumberType", - "columnName" : "PhoneNumberTypeID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_PersonPhone_BusinessEntityID_PhoneNumber_PhoneNumberTypeID", - "keyedColumn" : [ "BusinessEntityID", "PhoneNumber", "PhoneNumberTypeID" ] - } ] - }, { - "name" : "PhoneNumberType", - "tableItem" : [ { - "column" : { - "name" : "PhoneNumberTypeID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "primaryKey" : [ { - "name" : "PK_PhoneNumberType_PhoneNumberTypeID", - "keyedColumn" : [ "PhoneNumberTypeID" ] - } ] - }, { - "name" : "StateProvince", - "tableItem" : [ { - "column" : { - "name" : "StateProvinceID", - "vendorType" : "int identity", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "StateProvinceCode", - "vendorType" : "nchar", - "nullable" : false, - "datatype" : "NCHAR(3)" - } - }, { - "column" : { - "name" : "CountryRegionCode", - "vendorType" : "nvarchar", - "nullable" : false, - "datatype" : "NVARCHAR(3)" - } - }, { - "column" : { - "name" : "TerritoryID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "foreignKey" : [ { - "name" : "FK_StateProvince_CountryRegion_CountryRegionCode", - "fkColumn" : [ { - "pkColumn" : "CountryRegionCode", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Person", - "pkTable" : "CountryRegion", - "columnName" : "CountryRegionCode" - } ] - }, { - "name" : "FK_StateProvince_SalesTerritory_TerritoryID", - "fkColumn" : [ { - "pkColumn" : "TerritoryID", - "pkCatalog" : "AdventureWorks2014", - "pkSchema" : "Sales", - "pkTable" : "SalesTerritory", - "columnName" : "TerritoryID" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_StateProvince_StateProvinceID", - "keyedColumn" : [ "StateProvinceID" ] - } ] - }, { - "name" : "vAdditionalContactInfo", - "tableItem" : [ { - "column" : { - "name" : "BusinessEntityID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "TelephoneNumber", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "TelephoneSpecialInstructions", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NCLOB" - } - }, { - "column" : { - "name" : "Street", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "City", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "StateProvince", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "PostalCode", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "CountryRegion", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "HomeAddressSpecialInstructions", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NCLOB" - } - }, { - "column" : { - "name" : "EMailAddress", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(128)" - } - }, { - "column" : { - "name" : "EMailSpecialInstructions", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NCLOB" - } - }, { - "column" : { - "name" : "EMailTelephoneNumber", - "vendorType" : "nvarchar", - "nullable" : true, - "datatype" : "NVARCHAR(50)" - } - }, { - "column" : { - "name" : "rowguid", - "vendorType" : "uniqueidentifier", - "nullable" : false, - "datatype" : "CHAR(36)" - } - }, { - "column" : { - "name" : "ModifiedDate", - "vendorType" : "datetime", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ] - }, { - "name" : "vStateProvinceCountryRegion", - "tableItem" : [ { - "column" : { - "name" : "StateProvinceID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "StateProvinceCode", - "vendorType" : "nchar", - "nullable" : false, - "datatype" : "NCHAR(3)" - } - }, { - "column" : { - "name" : "TerritoryID", - "vendorType" : "int", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "name" : "CountryRegionCode", - "vendorType" : "nvarchar", - "nullable" : false, - "datatype" : "NVARCHAR(3)" - } - } ] - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/build.gradle b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/build.gradle deleted file mode 100644 index 85073e202a7..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright Contributors to the ODPi Egeria project. - */ - -dependencies { - implementation project(':open-metadata-implementation:common-services:ffdc-services') - implementation project(':open-metadata-implementation:frameworks:open-connector-framework') - implementation project(':open-metadata-implementation:frameworks:audit-log-framework') - implementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api') - compileOnly 'com.fasterxml.jackson.core:jackson-annotations' - implementation 'org.springframework:spring-core' -} - -description = 'Analytics Modeling OMAS Client' - -java { - withJavadocJar() -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/AnalyticsModelingRestClient.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/AnalyticsModelingRestClient.java deleted file mode 100644 index c4c0ce5de03..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/AnalyticsModelingRestClient.java +++ /dev/null @@ -1,318 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.client; - - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AnalyticsModelingOMASAPIResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AssetsResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.DatabasesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ModuleResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemaTablesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemasResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler; -import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClient; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; - - -/** - * REST client is responsible for issuing calls to the AnalyticsModeling OMAS REST APIs. - */ -public class AnalyticsModelingRestClient extends FFDCRESTClient -{ - private RESTExceptionHandler restExceptionHandler = new RESTExceptionHandler(); - - - private final String urlTemplateResource = "/servers/{0}/open-metadata/access-services/analytics-modeling/users/{1}/"; - private final String urlTemplateSynchronization = urlTemplateResource + "sync?serverCapability={2}"; - private final String urlTemplateSynchronizationWithGUID = urlTemplateSynchronization + "&serverCapabilityGUID={3}"; - - /** - * Constructor for no authentication with audit log. - * - * @param serverName name of the OMAG Server to call - * @param serverPlatformURLRoot URL root of the server manager where the OMAG Server is running. - * @param auditLog destination for log messages. - * - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public AnalyticsModelingRestClient(String serverName, String serverPlatformURLRoot, AuditLog auditLog) - throws InvalidParameterException - { - super(serverName, serverPlatformURLRoot, auditLog); - } - - - /** - * Constructor for no authentication. - * - * @param serverName name of the OMAG Server to call - * @param serverPlatformURLRoot URL root of the server manager where the OMAG Server is running. - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public AnalyticsModelingRestClient(String serverName, String serverPlatformURLRoot) - throws InvalidParameterException - { - super(serverName, serverPlatformURLRoot); - } - - - /** - * Constructor for simple userId and password authentication with audit log. - * - * @param serverName name of the OMAG Server to call - * @param serverPlatformURLRoot URL root of the server manager where the OMAG Server is running. - * @param userId user id for the HTTP request - * @param password password for the HTTP request - * @param auditLog destination for log messages. - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public AnalyticsModelingRestClient(String serverName, String serverPlatformURLRoot, String userId, String password, AuditLog auditLog) - throws InvalidParameterException - { - super(serverName, serverPlatformURLRoot, userId, password, auditLog); - } - - - /** - * Constructor for simple userId and password authentication. - * - * @param serverName name of the OMAG Server to call - * @param serverPlatformURLRoot URL root of the server manager where the OMAG Server is running. - * @param userId user id for the HTTP request - * @param password password for the HTTP request - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public AnalyticsModelingRestClient(String serverName, String serverPlatformURLRoot, String userId, String password) - throws InvalidParameterException - { - super(serverName, serverPlatformURLRoot, userId, password); - } - - /** - * Get list of available databases. - * @param userId requested the operation. - * @param startFrom this index. - * @param pageSize amount to retrieve. - * @return list of databases. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public List getDatabases(String userId, int startFrom, int pageSize) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "getDatabases"; - String url = serverPlatformURLRoot + urlTemplateResource + "databases?startFrom={2}&pageSize={3}"; - AnalyticsModelingOMASAPIResponse response = - callGetRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, url, serverName, userId, startFrom, pageSize); - - handleFailedResponse(response, methodName); - - return ((DatabasesResponse)response).getDatabasesList(); - } - - - /** - * Get list of available schemas for a databases. - * @param userId requested the operation. - * @param databaseGuid to defined database. - * @param startFrom this index. - * @param pageSize amount to retrieve. - * @return list of schemas. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public List getSchemas(String userId, String databaseGuid, int startFrom, int pageSize) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "getSchemas"; - String url = serverPlatformURLRoot + urlTemplateResource + "{2}/schemas?startFrom={3}&pageSize={4}"; - AnalyticsModelingOMASAPIResponse response = - callGetRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, url, serverName, userId, databaseGuid, startFrom, pageSize); - - handleFailedResponse(response, methodName); - - return ((SchemasResponse) response).getSchemaList(); - } - - - /** - * Get list of tables for database schema. - * @param userId requested the operation. - * @param databaseGuid to defined database. - * @param catalog name. - * @param schema name. - * @return list of tables. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerSchemaTables getTables(String userId, String databaseGuid, String catalog, String schema) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "getTables"; - - String url = serverPlatformURLRoot + urlTemplateResource + "{2}/tables?catalog={3}&schema={4}"; - AnalyticsModelingOMASAPIResponse response = - callPostRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, url, null, serverName, userId, databaseGuid, catalog, schema); - - handleFailedResponse(response, methodName); - - return ((SchemaTablesResponse)response).getTableList(); - } - - - /** - * Get module. - * @param userId requested the operation. - * @param databaseGuid to create module for. - * @param catalog name of the module. - * @param schema name of the module. - * @param request set of tables to include. - * @return created module. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerModule getModule(String userId, String databaseGuid, String catalog, String schema, ModuleTableFilter request) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "getModule"; - String url = serverPlatformURLRoot + urlTemplateResource + "{2}/physicalModule?catalog={3}&schema={4}"; - AnalyticsModelingOMASAPIResponse response = - callPostRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, url, request, serverName, userId, databaseGuid, catalog, schema); - - handleFailedResponse(response, methodName); - - return ((ModuleResponse)response).getModule(); - } - - /** - * Create assets defined by artifact. - * @param user requested the operation. - * @param serverCapability the source of artifact. - * @param serverCapabilityGUID the source of artifact. - * @param artifact definition. - * @return list of GUIDs for created assets. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerAssets createAssets(String user, String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "createAssets"; - - AnalyticsModelingOMASAPIResponse response = serverCapabilityGUID == null - ? callPostRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, - serverPlatformURLRoot + urlTemplateSynchronization, - artifact, serverName, user, serverCapability) - : callPostRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, - serverPlatformURLRoot + urlTemplateSynchronizationWithGUID, - artifact, serverName, user, serverCapability, serverCapabilityGUID); - - handleFailedResponse(response, methodName); - - return ((AssetsResponse) response).getAssetList(); - } - - /** - * Update assets defined by artifact. - * @param user requested the operation. - * @param serverCapability the source of artifact. - * @param serverCapabilityGUID the source of artifact. - * @param artifact definition. - * @return list of GUIDs for updated assets. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerAssets updateAssets(String user, String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "updateAssets"; - AnalyticsModelingOMASAPIResponse response = serverCapabilityGUID == null - ? callPutRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, - serverPlatformURLRoot + urlTemplateSynchronization, - artifact, serverName, user, serverCapability) - : callPutRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, - serverPlatformURLRoot + urlTemplateSynchronizationWithGUID, - artifact, serverName, user, serverCapability, serverCapabilityGUID); - - handleFailedResponse(response, methodName); - - return ((AssetsResponse) response).getAssetList(); - } - - /** - * Delete assets defined by identifier. - * @param user requested the operation. - * @param serverCapability the source of artifact. - * @param serverCapabilityGUID the source of artifact. - * @param identifier defining the assets. - * @return list of GUIDs for deleted assets. - * @throws PropertyServerException in case REST call failed. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - public ResponseContainerAssets deleteAssets(String user, String serverCapability, String serverCapabilityGUID, String identifier) - throws PropertyServerException, AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException - { - String methodName = "deleteAssets"; - - AnalyticsModelingOMASAPIResponse response = serverCapabilityGUID == null - ? callDeleteRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, - serverPlatformURLRoot + urlTemplateSynchronization + "&identifier={3}", - null, - serverName, user, serverCapability, identifier) - : callDeleteRESTCall(methodName, AnalyticsModelingOMASAPIResponse.class, - serverPlatformURLRoot + urlTemplateSynchronizationWithGUID + "&identifier={4}", - null, - serverName, user, serverCapability, serverCapabilityGUID, identifier); - - handleFailedResponse(response, methodName); - - return ((AssetsResponse) response).getAssetList(); - } - - private void handleFailedResponse(AnalyticsModelingOMASAPIResponse response, String methodName) - throws AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException, PropertyServerException - { - restExceptionHandler.detectAndThrowStandardExceptions(methodName, response); - - if (response.getRelatedHTTPCode() != 200) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAIL_REST_CALL.getMessageDefinition(methodName, response.getExceptionErrorMessage()), - this.getClass().getSimpleName(), - methodName); - } - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/ImportClient.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/ImportClient.java deleted file mode 100644 index 6cdaf4eb1c7..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/ImportClient.java +++ /dev/null @@ -1,226 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.client; - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.api.AnalyticsModelingImport; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; - -public class ImportClient implements AnalyticsModelingImport { - - private InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - private AnalyticsModelingRestClient restClient; /* Initialized in constructor */ - - /** - * Create a new client with no authentication embedded in the HTTP request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param auditLog logging destination - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public ImportClient(String serverName, String serverPlatformURLRoot, AuditLog auditLog) - throws InvalidParameterException - { - final String methodName = "Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot, auditLog); - } - - - /** - * Create a new client with no authentication embedded in the HTTP request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public ImportClient(String serverName, String serverPlatformURLRoot) - throws InvalidParameterException - { - final String methodName = "Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot); - } - - - /** - * Create a new client that passes userId and password in each HTTP request. This is the - * userId/password of the calling server. The end user's userId is sent on each request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param userId caller's userId embedded in all HTTP requests - * @param password caller's userId embedded in all HTTP requests - * @param auditLog logging destination - * - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public ImportClient(String serverName, - String serverPlatformURLRoot, - String userId, - String password, - AuditLog auditLog) - throws InvalidParameterException { - final String methodName = "Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot, userId, password, auditLog); - } - - - /** - * Create a new client that passes userId and password in each HTTP request. This is the - * userId/password of the calling server. The end user's userId is sent on each request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param userId caller's userId embedded in all HTTP requests - * @param password caller's userId embedded in all HTTP requests - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public ImportClient(String serverName, String serverPlatformURLRoot, String userId, String password) - throws InvalidParameterException { - final String methodName = "Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot, userId, password); - } - - - /** - * Create a new client that is to be used within an OMAG Server. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param restClient pre-initialized REST client - * @param maxPageSize pre-initialized parameter limit - * @throws InvalidParameterException there is a problem with the information about the remote OMAS - */ - public ImportClient(String serverName, - String serverPlatformURLRoot, - AnalyticsModelingRestClient restClient, - int maxPageSize) - throws InvalidParameterException { - final String methodName = "Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - invalidParameterHandler.setMaxPagingSize(maxPageSize); - - this.restClient = restClient; - } - - /** - * Get databases available on the server for the user. - * - * @param userId of the user. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of databases for the requested server/user. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public List getDatabases(String userId, int startFrom, int pageSize) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - String method = "getDatabases"; - invalidParameterHandler.validateUserId(userId, method); - return restClient.getDatabases(userId, startFrom, pageSize); - } - - /** - * Get schema defined by database GUID. - * - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of schemas for the requested database. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public List getSchemas(String userId, String databaseGuid, int startFrom, int pageSize) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - String method = "getSchemas"; - invalidParameterHandler.validateUserId(userId, method); - invalidParameterHandler.validateGUID(databaseGuid, "databaseGuid", method); - return restClient.getSchemas(userId, databaseGuid, startFrom, pageSize); - } - - /** - * Get tables for the schema. - * - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param catalog name of the database. - * @param schema schema name on the database. - * @return list of tables for the requested schema. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public ResponseContainerSchemaTables getTables(String userId, String databaseGuid, String catalog, String schema) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - String method = "getTables"; - invalidParameterHandler.validateUserId(userId, method); - invalidParameterHandler.validateGUID(databaseGuid, "databaseGuid", method); - return restClient.getTables(userId, databaseGuid, catalog, schema); - } - - /** - * Build module for the schema. - * - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param catalog catalog name of the database. - * @param schema schema name of the database. - * @param request table filter - * @return module for the requested schema. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public ResponseContainerModule getModule(String userId, String databaseGuid, String catalog, String schema, ModuleTableFilter request) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - String method = "getModule"; - invalidParameterHandler.validateUserId(userId, method); - invalidParameterHandler.validateGUID(databaseGuid, "databaseGuid", method); - return restClient.getModule(userId, databaseGuid, catalog, schema, request); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/SynchronizationClient.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/SynchronizationClient.java deleted file mode 100644 index 5c536a9c3c8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/client/SynchronizationClient.java +++ /dev/null @@ -1,197 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.client; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.api.AnalyticsModelingSynchronization; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; - -public class SynchronizationClient implements AnalyticsModelingSynchronization { - - private InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - private AnalyticsModelingRestClient restClient; /* Initialized in constructor */ - - /** - * Create a new client with no authentication embedded in the HTTP request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param auditLog logging destination - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public SynchronizationClient(String serverName, String serverPlatformURLRoot, AuditLog auditLog) - throws InvalidParameterException - { - final String methodName = "Synchronization Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot, auditLog); - } - - - /** - * Create a new client with no authentication embedded in the HTTP request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public SynchronizationClient(String serverName, String serverPlatformURLRoot) - throws InvalidParameterException - { - final String methodName = "Synchronization Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot); - } - - - /** - * Create a new client that passes userId and password in each HTTP request. This is the - * userId/password of the calling server. The end user's userId is sent on each request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param userId caller's userId embedded in all HTTP requests - * @param password caller's userId embedded in all HTTP requests - * @param auditLog logging destination - * - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public SynchronizationClient(String serverName, - String serverPlatformURLRoot, - String userId, - String password, - AuditLog auditLog) throws InvalidParameterException - { - final String methodName = "Synchronization Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot, userId, password, auditLog); - } - - - /** - * Create a new client that passes userId and password in each HTTP request. This is the - * userId/password of the calling server. The end user's userId is sent on each request. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param userId caller's userId embedded in all HTTP requests - * @param password caller's userId embedded in all HTTP requests - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - public SynchronizationClient(String serverName, - String serverPlatformURLRoot, - String userId, - String password) throws InvalidParameterException - { - final String methodName = "Synchronization Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - - this.restClient = new AnalyticsModelingRestClient(serverName, serverPlatformURLRoot, userId, password); - } - - - /** - * Create a new client that is to be used within an OMAG Server. - * - * @param serverName name of the server to connect to - * @param serverPlatformURLRoot the network address of the server running the OMAS REST services - * @param restClient pre-initialized REST client - * @param maxPageSize pre-initialized parameter limit - * @throws InvalidParameterException there is a problem with the information about the remote OMAS - */ - public SynchronizationClient(String serverName, - String serverPlatformURLRoot, - AnalyticsModelingRestClient restClient, - int maxPageSize) throws InvalidParameterException - { - final String methodName = "Synchronization Client Constructor"; - - invalidParameterHandler.validateOMAGServerPlatformURL(serverPlatformURLRoot, serverName, methodName); - invalidParameterHandler.setMaxPagingSize(maxPageSize); - - this.restClient = restClient; - } - - - /** - * Create analytics artifact defined as input. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param artifact definition. - * @return response with artifact or error description. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public ResponseContainerAssets createArtifact(String userId, String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - final String methodName = "createArtifact"; - invalidParameterHandler.validateUserId(userId, methodName); - return restClient.createAssets(userId, serverCapability, serverCapabilityGUID, artifact); - } - - /** - * Update analytics artifact defined as json input. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param artifact definition. - * @return response with artifact or error description. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public ResponseContainerAssets updateArtifact(String userId, String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - final String methodName = "updateArtifact"; - invalidParameterHandler.validateUserId(userId, methodName); - return restClient.updateAssets(userId, serverCapability, serverCapabilityGUID, artifact); - } - - /** - * Delete assets in repository defined by artifact unique identifier. - * @param userId request user - * @param serverCapability where the artifact is stored. - * @param serverCapabilityGUID source where artifact persist. - * @param identifier of the artifact in 3rd party system. - * @return errors or list of created assets. - * @throws AnalyticsModelingCheckedException error executing request. - * @throws PropertyServerException in case REST call failed. - * @throws UserNotAuthorizedException in case user unauthorized to perform operation. - * @throws InvalidParameterException in case any passed parameter is invalid. - */ - @Override - public ResponseContainerAssets deleteArtifact(String userId, String serverCapability, String serverCapabilityGUID, String identifier) - throws AnalyticsModelingCheckedException, PropertyServerException, InvalidParameterException, UserNotAuthorizedException - { - final String methodName = "deleteArtifact"; - invalidParameterHandler.validateUserId(userId, methodName); - return restClient.deleteAssets(userId, serverCapability, serverCapabilityGUID, identifier); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/build.gradle b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/build.gradle deleted file mode 100644 index 64b5311c16f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/build.gradle +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright Contributors to the ODPi Egeria project. - */ - - -dependencies { - implementation project(':open-metadata-implementation:admin-services:admin-services-api') - implementation project(':open-metadata-implementation:admin-services:admin-services-registration') - implementation project(':open-metadata-implementation:common-services:ffdc-services') - implementation project(':open-metadata-implementation:common-services:generic-handlers') - implementation project(':open-metadata-implementation:common-services:metadata-security:metadata-security-server') - implementation project(':open-metadata-implementation:common-services:multi-tenant') - implementation project(':open-metadata-implementation:common-services:repository-handler') - implementation project(':open-metadata-implementation:frameworks:open-connector-framework') - implementation project(':open-metadata-implementation:frameworks:audit-log-framework') - implementation project(':open-metadata-implementation:adapters:open-connectors:repository-services-connectors:open-metadata-collection-store-connectors:inmemory-repository-connector') - implementation project(':open-metadata-implementation:repository-services:repository-services-apis') - implementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api') - - compileOnly 'com.fasterxml.jackson.core:jackson-annotations' - implementation 'com.fasterxml.jackson.core:jackson-databind' - implementation 'org.apache.commons:commons-collections4' - implementation 'org.slf4j:slf4j-api' - - testImplementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api') - testImplementation 'org.mockito:mockito-core' - testImplementation 'org.mockito:mockito-junit-jupiter' - testImplementation 'org.testng:testng' - testImplementation project(':open-metadata-implementation:repository-services:repository-services-implementation') - - //TODO: Special library used in maven build, process needs porting using gradle's test fixtures - should refactor - testImplementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api').sourceSets.test.output - - -} - -description = 'Analytics Modeling OMAS Server-side' - -java { - withJavadocJar() -} - -//TODO: Special library used in maven build, process needs porting using gradle's test fixtures - -test { - useTestNG() - // This will default to standard search pattern - see https://docs.gradle.org/current/userguide/java_testing.html#sec:test_detection - scanForTestClasses = false -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/admin/AnalyticsModelingAdmin.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/admin/AnalyticsModelingAdmin.java deleted file mode 100644 index eb131a585b1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/admin/AnalyticsModelingAdmin.java +++ /dev/null @@ -1,163 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.admin; - - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.auditlog.AnalyticsModelingAuditCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.server.AnalyticsModelingServicesInstance; -import org.odpi.openmetadata.adminservices.configuration.properties.AccessServiceConfig; -import org.odpi.openmetadata.adminservices.registration.AccessServiceAdmin; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.adminservices.ffdc.OMAGAdminErrorCode; -import org.odpi.openmetadata.adminservices.ffdc.exception.OMAGConfigurationErrorException; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; -import org.odpi.openmetadata.repositoryservices.connectors.omrstopic.OMRSTopicConnector; -import org.odpi.openmetadata.repositoryservices.connectors.openmetadatatopic.OpenMetadataTopicConnector; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryConnector; - -/** - * AnalyticsModelingAdmin is the class that is called by the OMAG Server to initialize and terminate - * the Analytics Modeling OMAS. The initialization call provides this OMAS with resources from the - * Open Metadata Repository Services. - * - * - */ -public class AnalyticsModelingAdmin extends AccessServiceAdmin -{ - - private OpenMetadataTopicConnector analyticsModelingOutTopicConnector; - private AuditLog auditLog; - private String serverName = null; - private AnalyticsModelingServicesInstance instance = null; - - - /** - * Initialize the access service. - * - * @param accessServiceConfig specific configuration properties for this access service. - * @param enterpriseOMRSTopicConnector connector for receiving OMRS Events from the cohorts - * @param enterpriseConnector connector for querying the cohort repositories - * @param auditLog audit log component for logging messages. - * @param serverUserName user id to use on OMRS calls where there is no end user. - * @throws OMAGConfigurationErrorException invalid parameters in the configuration properties. - */ - @Override - public void initialize( AccessServiceConfig accessServiceConfig, - OMRSTopicConnector enterpriseOMRSTopicConnector, - OMRSRepositoryConnector enterpriseConnector, - AuditLog auditLog, - String serverUserName) throws OMAGConfigurationErrorException { - - final String actionDescription = "Initialize Analytics Modeling OMAS service."; - - auditLog.logMessage(actionDescription, AnalyticsModelingAuditCode.SERVICE_INITIALIZING.getMessageDefinition()); - this.auditLog = auditLog; - - if (enterpriseConnector != null) { - serverName = enterpriseConnector.getServerName(); - } - - - try { - - if (accessServiceConfig.getAccessServiceOutTopic() != null) { - analyticsModelingOutTopicConnector = super.getTopicConnector(accessServiceConfig.getAccessServiceOutTopic(), - OpenMetadataTopicConnector.class, - auditLog, - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceFullName(), - actionDescription); - - if (analyticsModelingOutTopicConnector != null) { - // initialize Topic Connector - String outTopicName = getTopicName(accessServiceConfig.getAccessServiceOutTopic()); - startConnector(actionDescription, outTopicName, analyticsModelingOutTopicConnector); - } - } - - List supportedZones = this.extractSupportedZones(accessServiceConfig.getAccessServiceOptions(), - accessServiceConfig.getAccessServiceName(), auditLog); - - instance = new AnalyticsModelingServicesInstance(enterpriseConnector, supportedZones, - auditLog, serverUserName, enterpriseConnector.getMaxPageSize()); - - - } catch (OMAGConfigurationErrorException error) { - throw error; - } catch (Exception error) { - auditLog.logException( - actionDescription, - AnalyticsModelingAuditCode.getAuditLogMessageDefinition( - OMAGAdminErrorCode.UNEXPECTED_INITIALIZATION_EXCEPTION.getMessageDefinition(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceFullName(), - error.getClass().getName(), - error.getMessage()), - error); - - super.throwUnexpectedInitializationException(actionDescription, - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceFullName(), - error); - } - - - auditLog.logMessage(actionDescription, AnalyticsModelingAuditCode.SERVICE_INITIALIZED.getMessageDefinition(serverName)); - } - - /** - * Helper method to wrap start connector logic and error processing. - * - * @param actionDescription parent method name providing context for error handling. - * @param topicName to start - * @param topicConnector to start - * @throws OMAGConfigurationErrorException - */ - private void startConnector(String actionDescription, String topicName, OpenMetadataTopicConnector topicConnector) throws OMAGConfigurationErrorException { - - auditLog.logMessage(actionDescription, AnalyticsModelingAuditCode.SERVICE_REGISTERED_WITH_OUT_TOPIC.getMessageDefinition(topicName)); - - try { - topicConnector.start(); - } catch (ConnectorCheckedException e) { - - auditLog.logException(actionDescription, - AnalyticsModelingAuditCode.getAuditLogMessageDefinition( - AnalyticsModelingErrorCode.ERROR_INITIALIZING_ANALYTICS_MODELING_TOPIC_CONNECTION.getMessageDefinition(), topicName, serverName), - e); - - throw new OMAGConfigurationErrorException( - AnalyticsModelingErrorCode.ERROR_INITIALIZING_ANALYTICS_MODELING_TOPIC_CONNECTION - .getMessageDefinition(topicName, serverName), - getClass().getSimpleName(), - actionDescription, - e); - } - } - - /** - * Shutdown the access service. - */ - @Override - public void shutdown() { - - final String actionDescription = "shutdown"; - - try { - analyticsModelingOutTopicConnector.disconnect(); - } catch (ConnectorCheckedException error) { - auditLog.logException(actionDescription, - AnalyticsModelingAuditCode.SERVICE_INSTANCE_TERMINATION_FAILURE.getMessageDefinition(serverName), - error); - } - - if (instance != null) - { - instance.shutdown(); - } - - auditLog.logMessage(actionDescription, AnalyticsModelingAuditCode.SERVICE_SHUTDOWN.getMessageDefinition(serverName)); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/assets/DatabaseContextHandler.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/assets/DatabaseContextHandler.java deleted file mode 100644 index 1ae6b76795b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/assets/DatabaseContextHandler.java +++ /dev/null @@ -1,790 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.assets; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import org.apache.commons.collections4.CollectionUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager.OMEntityDao; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.GlossaryTermConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Database; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.GlossaryTerm; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Schema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.BaseObjectType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Column; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.DataSource; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignColumn; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.ForeignKey; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.MetadataModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.PrimaryKey; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Table; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.TableItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; -import org.odpi.openmetadata.commonservices.generichandlers.GlossaryTermHandler; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; -import org.odpi.openmetadata.commonservices.generichandlers.RelationalDataHandler; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.TreeMap; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -/** - * The class builds data content of the Analytics Modeling OMAS responses.
- * - * This class contains logic about elements required to build responses and their relationships. - * Only methods used to build responses should be public.
- * - *
Here is the exposed functionality: - *
    - *
  • Get databases {@link org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler#getDatabases}
  • - *
  • Get database schemas {@link org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler#getSchemaTables}
  • - *
  • Get schema tables {@link org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler#getSchemaTables}
  • - *
  • Get physical module {@link org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler#getModule}
  • - *
- * Database metadata is retrieved from OMRS using object of type - * {@link org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager.OMEntityDao}
- * All repository logic should be handled there.
- */ -public class DatabaseContextHandler { - - private static final ObjectWriter OBJECT_WRITER = new ObjectMapper().writer(); - - public static final String DATA_SOURCE_GUID = "dataSourceGUID"; - - private RelationalDataHandler relationalDataHandler; - - private GlossaryTermHandler handlerGlossaryTerm; - - private OMEntityDao omEntityDao; - private ExecutionContext ctx; - - - private static HashMap mapTypes = new HashMap<>(); - - static { - mapTypes.put("WVARCHAR", "NVARCHAR"); - } - - public DatabaseContextHandler( - RelationalDataHandler relationalDataHandler, - OMEntityDao omEntityDao, - ExecutionContext ctx) { - - this.relationalDataHandler = relationalDataHandler; - this.omEntityDao = omEntityDao; - this.ctx = ctx; - - handlerGlossaryTerm = new GlossaryTermHandler<>( - new GlossaryTermConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()), - GlossaryTerm.class, ctx.getServiceName(), ctx.getServerName(), - ctx.getInvalidParameterHandler(), ctx.getRepositoryHandler(), ctx.getRepositoryHelper(), - ctx.getLocalServerUserId(), ctx.getSecurityVerifier(), - ctx.getSupportedZones(), ctx.getDefaultZones(), ctx.getPublishZones(), - ctx.getAuditLog()); - } - - /** - * Set context of the execution. - * Every public method should call the method setContext() first to set the context. - * @param context of the execution - top level method. - */ - void setContext(String context) { - omEntityDao.setContext(context); - } - - - /** - * Get list of databases on the server. - * - * @param userId for the call. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of database descriptors. - * @throws AnalyticsModelingCheckedException in case of an repository operation failure. - * @throws UserNotAuthorizedException in case of an error. - */ - public List getDatabases(String userId, Integer startFrom, Integer pageSize) - throws AnalyticsModelingCheckedException, UserNotAuthorizedException { - - String methodName = "getDatabases"; - ctx.initialize(userId); - setContext(methodName); - - List databases = findDatabases(userId, startFrom, pageSize, methodName); - return Optional.ofNullable(databases).map(Collection::stream).orElseGet(Stream::empty) - .parallel() - .map(this::buildDatabase) - .filter(Objects::nonNull).collect(Collectors.toList()); - } - - private List findDatabases(String userId, Integer startFrom, Integer pageSize, String methodName) - throws AnalyticsModelingCheckedException, UserNotAuthorizedException - { - try { - return relationalDataHandler.getDatabases(userId, startFrom, pageSize, false, false, new Date(), methodName); - } catch (org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException | PropertyServerException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_FETCH_DATABASES.getMessageDefinition(), - this.getClass().getSimpleName(), - methodName, - ex); - } - } - - private ResponseContainerDatabase buildDatabase(Database e) { - ResponseContainerDatabase ret = new ResponseContainerDatabase(); - ret.setDbName(e.getName()); - ret.setDbType(e.getType()); - ret.setDbVersion(e.getVersion()); - ret.setGUID(e.getGuid()); - return ret; - } - - - /** - * Retrieve schemas for given database from repository. - * - * @param userId for the call. - * @param guidDatabase defines database - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of schemas attributes. - * @throws AnalyticsModelingCheckedException in case of an repository operation failure. - * @throws InvalidParameterException if passed GUID is invalid. - * @throws UserNotAuthorizedException in case of an error. - */ - public List getDatabaseSchemas(String userId, String guidDatabase, Integer startFrom, Integer pageSize) - throws AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException { - - String methodName = "getDatabaseSchemas"; - ctx.initialize(userId); - setContext(methodName); - - ctx.getInvalidParameterHandler().validateGUID(guidDatabase, DATA_SOURCE_GUID, methodName); - - try { - Database db = relationalDataHandler.getDatabaseByGUID(userId, guidDatabase, false, false, new Date(), methodName); - String dbName = db.getName(); - - List schemas = relationalDataHandler.getSchemasForDatabase(userId, guidDatabase, startFrom, pageSize, false, false, new Date(), methodName); - - return Optional.ofNullable(schemas).map(Collection::stream).orElseGet(Stream::empty) - .map(e->buildSchema(dbName, e)) - .filter(Objects::nonNull).collect(Collectors.toList()); - - } catch (org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException | PropertyServerException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_FETCH_DATABASE_SCHEMAS.getMessageDefinition(guidDatabase), - this.getClass().getSimpleName(), - methodName, - ex); - } - } - - /** - * Helper function to build database schema response object from the schema element. - * @param catalogName the schema belongs to. - * @param dbSchema source of the schema data. - * @return response element. - */ - private ResponseContainerDatabaseSchema buildSchema(String catalogName, Schema dbSchema) { - String schemaName = dbSchema.getName(); - ResponseContainerDatabaseSchema schema = new ResponseContainerDatabaseSchema(); - schema.setCatalog(catalogName); - schema.setSchema(schemaName); - schema.setId(schema.buildId()); - return schema; - } - /** - * Get schema entity from relationship catalog->schema - * @param r relationship - * @return schema entity. - */ - private EntityDetail getSchemaEntityFromRelationship(Relationship r) { - return getEntityByGuidNoThrow(r.getEntityTwoProxy().getGUID()); - } - - /** - * Get tables for schema. - * - * @param userId of the request. - * @param guidDataSource of the schema. - * @param schema name. - * @return list of table names. - * @throws AnalyticsModelingCheckedException if failed - * @throws InvalidParameterException if passed GUID is invalid. - */ - public ResponseContainerSchemaTables getSchemaTables(String userId, String guidDataSource, String schema) - throws AnalyticsModelingCheckedException, InvalidParameterException { - - String context = "getSchemaTables"; - ctx.initialize(userId); - setContext(context); - - ctx.getInvalidParameterHandler().validateGUID(guidDataSource, DATA_SOURCE_GUID, context); - - ResponseContainerSchemaTables ret = new ResponseContainerSchemaTables(); - - EntityDetail dbSchemaEntity = getSchemaEntityByName(guidDataSource, schema); - List tables = getTablesForSchema(dbSchemaEntity) - .parallelStream() - .map(t->getEntityStringProperty(t, Constants.DISPLAY_NAME)) - .filter(Objects::nonNull).collect(Collectors.toList()); - - Collections.sort(tables); - ret.setTablesList(tables); - - return ret; - } - - /** - * Get tables for the schema. - * @param dbSchemaEntity schema entity of the requested tables - * @return list of table entities that belongs to the schema. - * @throws AnalyticsModelingCheckedException - */ - private List getTablesForSchema(EntityDetail dbSchemaEntity) - throws AnalyticsModelingCheckedException - { - - List allDbSchemaToSchemaType = omEntityDao.getRelationshipsForEntity(dbSchemaEntity, Constants.ASSET_SCHEMA_TYPE); - - if (allDbSchemaToSchemaType == null || allDbSchemaToSchemaType.isEmpty()) { - return Collections.emptyList(); // no tables - } - - Relationship dbSchemaToSchemaType = allDbSchemaToSchemaType.get(0); - EntityDetail dbSchemaTypeEntity = omEntityDao.getEntityByGuid(dbSchemaToSchemaType.getEntityTwoProxy().getGUID()); - - List dbSchemaTypeToTableRelationships = omEntityDao.getRelationshipsForEntity(dbSchemaTypeEntity, Constants.ATTRIBUTE_FOR_SCHEMA); - - return Optional.ofNullable(dbSchemaTypeToTableRelationships).map(Collection::stream) - .orElseGet(Stream::empty).map(this::getTableEntity).filter(Objects::nonNull) - .collect(Collectors.toList()); - - } - - private EntityDetail getTableEntity(Relationship relationship) { - String tableGuid = relationship.getEntityTwoProxy().getGUID(); - return getEntityByGuidNoThrow(tableGuid); - } - - /** - * Build Analytics Modeling module for database schema - * @param userId for the request. - * @param databaseGuid of the module - * @param catalog of the module - * @param schema of the module - * @param filter contains optional table filter - * @return module built for defined schema - * @throws AnalyticsModelingCheckedException in case of an repository operation failure. - * @throws InvalidParameterException if passed GUID is invalid. - */ - public ResponseContainerModule getModule(String userId, String databaseGuid, String catalog, String schema, ModuleTableFilter filter) - throws AnalyticsModelingCheckedException, InvalidParameterException { - - String context = "getModule"; - ctx.initialize(userId); - ctx.getInvalidParameterHandler().validateGUID(databaseGuid, DATA_SOURCE_GUID, context); - setContext(context); - - ResponseContainerModule ret = new ResponseContainerModule(); - ret.setId(catalog + "_" + schema); - ret.setPhysicalModule(buildModule(databaseGuid, catalog, schema, filter)); - return ret; - } - - private MetadataModule buildModule(String databaseGuid, String catalog, String schema, ModuleTableFilter filter) - throws AnalyticsModelingCheckedException - { - MetadataModule module = new MetadataModule(); - module.setIdentifier("physicalmodule"); - module.setDataSource(Arrays.asList(buildDataSource(databaseGuid, catalog, schema, filter))); - return module; - } - - private DataSource buildDataSource(String databaseGuid, String catalog, String schema, ModuleTableFilter filter) - throws AnalyticsModelingCheckedException { - DataSource ds = new DataSource(); - ds.setCatalog(catalog); - EntityDetail schemaEntity = getSchemaEntityByName(databaseGuid, schema); - ds.setSchema(getEntityStringProperty(schemaEntity, Constants.ATTRIBUTE_NAME)); - ds.setName(catalog + "." + ds.getSchema()); - ds.setTable(buildTables(databaseGuid, schemaEntity, filter)); - ds.addProperty(Constants.GUID, schemaEntity.getGUID()); - processGlossaryTerms(schemaEntity, ds); - return ds; - } - - private List
buildTables(String databaseGuid, EntityDetail schemaEntity, ModuleTableFilter tblFilter) - throws AnalyticsModelingCheckedException { - - List tables = getTablesForSchema(schemaEntity); - - if (tblFilter != null) { - tables = tables.stream() - .filter(tbl->tblFilter.match(getEntityStringProperty(tbl, Constants.DISPLAY_NAME))) - .collect(Collectors.toList()); - } - - List
ret = tables - .parallelStream() - .map(this::buildSingleTable) - .filter(Objects::nonNull).collect(Collectors.toList()); - - ret.sort(Comparator.comparing(Table::getName)); - - return ret; - } - - private Table buildSingleTable(EntityDetail entityTable) { - - Table ret = new Table(); - ret.setName(getEntityStringProperty(entityTable, Constants.DISPLAY_NAME)); - ret.addProperty(Constants.GUID, entityTable.getGUID()); - - List relationshipsTableColumns; - try { - relationshipsTableColumns = omEntityDao.getRelationshipsForEntity(entityTable, - Constants.NESTED_SCHEMA_ATTRIBUTE); - } catch (AnalyticsModelingCheckedException e) { - // exclude the table - if (e.getReportedCaughtException() != null) { - ctx.addMessage(AnalyticsModelingErrorCode.TABLE_COLUMN_RELATIONSHIPS_EXCEPTION.getMessageDefinition(ret.getName()), - e.getReportedCaughtException().getLocalizedMessage()); - } else { - ctx.addMessage(AnalyticsModelingErrorCode.TABLE_COLUMN_RELATIONSHIPS_EXCEPTION.getMessageDefinition(ret.getName())); - } - return null; - } - - if (relationshipsTableColumns == null || relationshipsTableColumns.isEmpty()) { - // report table without columns, don't create empty table - ctx.addTableWithoutColumns(ret.getName()); - return null; - } - - List items = relationshipsTableColumns.stream() - .parallel() - .map(this::buildTableItems) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - items.sort(Comparator.comparingInt(TableItem::getPosition)); - - if (items.isEmpty()) { - // report table without columns, don't create such table - ctx.addTableWithoutColumns(ret.getName()); - return null; - } - - ret.setTableItem(items); - - processGlossaryTerms(entityTable, ret); - - processPrimaryKeys(ret, items); - - processForeignKeys(ret, items); - - return ret; - } - - private void processGlossaryTerms(EntityDetail entity, BaseObjectType object) - { - String methodName = "processGlossaryTerms"; - try { - RepositoryHandler handler = ctx.getRepositoryHandler(); - List relationships = handler.getRelationshipsByType(ctx.getUserId(), - entity.getGUID(), entity.getType().getTypeDefName(), - OpenMetadataAPIMapper.REFERENCEABLE_TO_MEANING_TYPE_GUID, - OpenMetadataAPIMapper.REFERENCEABLE_TO_MEANING_TYPE_NAME, - methodName); - - if (relationships == null || relationships.isEmpty()) { - return; - } - - for (Relationship r : relationships) { - GlossaryTerm term = handlerGlossaryTerm.getTerm(ctx.getUserId(), r.getEntityTwoProxy().getGUID(), Constants.GUID, false, false, new Date(), methodName); - String value = buildGlossaryTerm(term); - - if (value != null) { - object.addProperty(OpenMetadataAPIMapper.GLOSSARY_TERM_TYPE_NAME, value); - } - } - } catch (UserNotAuthorizedException | PropertyServerException - | org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException e) { - // report warning with business terms - ctx.addMessage(AnalyticsModelingErrorCode.GLOSSARY_TERM_EXCEPTION.getMessageDefinition(entity.getGUID()), - e.getLocalizedMessage()); - } - } - - private String buildGlossaryTerm(GlossaryTerm term) - { - Map json; - if (term.getName() != null && term.getGuid() != null) { - json = new TreeMap<>(); - json.put(Constants.DISPLAY_NAME, term.getName()); - json.put(OpenMetadataAPIMapper.GUID_PROPERTY_NAME, term.getGuid()); - } else { - return null; - } - // long description - if (term.getDescription() != null) { - json.put(OpenMetadataAPIMapper.DESCRIPTION_PROPERTY_NAME, term.getDescription()); - } - // short description - if (term.getSummary() != null) { - json.put(OpenMetadataAPIMapper.SUMMARY_PROPERTY_NAME, term.getSummary()); - } - - try { - return OBJECT_WRITER.writeValueAsString(json); - } catch (JsonProcessingException e) { - // log warning in context - ctx.addMessage(AnalyticsModelingErrorCode.BUILD_GLOSSARY_TERM_EXCEPTION.getMessageDefinition(term.getName()), - e.getLocalizedMessage()); - - return null; - } - } - - private void processPrimaryKeys(Table ret, List items) { - List pk = items.stream().filter(v->v.getPkName() != null).collect(Collectors.toList()); - if (pk != null && !pk.isEmpty()) { - PrimaryKey pKey = new PrimaryKey(); - pKey.setName(pk.get(0).getPkName()); // all PK columns should have same name - pKey.setKeyedColumn(pk.stream().map(v->v.getColumn().getName()).sorted().collect(Collectors.toList())); - ret.setPrimaryKey(Arrays.asList(pKey)); // single primary key assumption - } - } - - /** - * Add foreign keys to the table. - * Several columns can be part of the single foreign key: - * CONSTRAINT FK_Name FOREIGN KEY (column1{, column2, ...}) REFERENCES ParentTable(column1{, column2, ...}) - * Columns referencing a table are combined within single foreign key. - * @param table the foreign keys are added. - * @param items table columns to process. - */ - private void processForeignKeys(Table table, List items) { - // select items referencing other columns: potential foreign keys columns - List fKeys = items.stream().filter(v->v.getReferencedColumns() != null).collect(Collectors.toList()); - - if (fKeys.isEmpty()) { - return; // no FK defined - } - - Map> tablesFKs = new HashMap<>(); // foreign key per table - - fKeys.forEach( v -> { - List columnEntities = v.getReferencedColumns().stream() - .map(this::getEntityByGuidNoThrow) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - if(columnEntities.isEmpty()) { - return; - } - - columnEntities.forEach(ce->{ - ForeignColumn fkColumn = new ForeignColumn(); - fkColumn.setColumnName(v.getColumn().getName()); // column name in child table - // add referenced column and ancestors up to catalog - fkColumn.setPkColumn(getEntityStringProperty(ce, Constants.DISPLAY_NAME)); - try { - // add table - EntityDetail tableEntity; - tableEntity = getParentEntity(ce, Constants.NESTED_SCHEMA_ATTRIBUTE); - fkColumn.setPkTable(getEntityStringProperty(tableEntity, Constants.DISPLAY_NAME)); - - List theTableFKs = tablesFKs.get(tableEntity.getGUID()); - if (theTableFKs == null) { - theTableFKs = new ArrayList<>(); - // use table GUID: same table name can be used in different schemas - tablesFKs.put(tableEntity.getGUID(), theTableFKs); - } - theTableFKs.add(fkColumn); - try { - // add schema - EntityDetail schemaAttributesEntity = getParentEntity(tableEntity, Constants.ATTRIBUTE_FOR_SCHEMA); - EntityDetail schemaEntity = getParentEntity(schemaAttributesEntity, Constants.ASSET_SCHEMA_TYPE); - fkColumn.setPkSchema(getEntityStringProperty(schemaEntity, Constants.ATTRIBUTE_NAME)); - - try { - EntityDetail catalogEntity = getParentEntity(schemaEntity, Constants.DATA_CONTENT_FOR_DATASET); - - fkColumn.setPkCatalog(getEntityStringProperty(catalogEntity, Constants.ATTRIBUTE_NAME)); - } catch (AnalyticsModelingCheckedException exCatalog) { - // log foreign key from unknown catalog - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_FOREIGN_KEY_UNKNOWN_CATALOG - .getMessageDefinition(fkColumn.getColumnName())); - return; - } - - } catch (AnalyticsModelingCheckedException exTable) { - // log foreign key from unknown schema - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_FOREIGN_KEY_UNKNOWN_SCHEMA - .getMessageDefinition(fkColumn.getColumnName())); - return; - } - } catch (AnalyticsModelingCheckedException exSchema) { - // log foreign key from unknown table - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_FOREIGN_KEY_UNKNOWN_TABLE - .getMessageDefinition(fkColumn.getColumnName())); - return; - } - }); - - }); - - tablesFKs.forEach((key, list) -> { - ForeignKey fk = new ForeignKey(); - // FK_ChildTable_ParentTable_PKColumn{_PKColumn} - String parentTable = list.get(0).getPkTable(); - fk.setName("FK_" + table.getName() + "_" + parentTable + "_" - + String.join("_", list.stream().map(v->v.getColumnName()).collect(Collectors.toList()))); - fk.setFkColumn(list); - List fks = table.getForeignKey(); - if (fks == null) { - fks = new ArrayList<>(); - table.setForeignKey(fks); - } - fks.add(fk); - }); - - // sort by names - if (table.getForeignKey() != null && table.getForeignKey().size() > 1) { - table.getForeignKey().sort(Comparator.comparing(e->e.getName())); - } - } - - /** - * Get entity by GUID without throwing. - * Log warning when entity is loaded as part of other object, - * and failing to find the entity is not critical. - * @param guid of the entity. - * @return entity or null if not found. - */ - EntityDetail getEntityByGuidNoThrow(String guid) { - try { - return omEntityDao.getEntityByGuid(guid); - } catch (Exception ex) { - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_ENTITY_NOT_FOUND.getMessageDefinition(guid), - ex.getLocalizedMessage()); - } - return null; - } - - /** - * Get parent entity for the entity. - * @param child whose parent is requested. - * @param propertyName that defines relationship - * @return parent entity. - * @throws AnalyticsModelingCheckedException - */ - private EntityDetail getParentEntity(EntityDetail child, String propertyName) throws AnalyticsModelingCheckedException { - List columnRelationships = omEntityDao.getRelationshipsForEntity(child, propertyName); - - if (columnRelationships == null) { - return null; - } - // relationship table->column - Relationship columnTableRelationship = columnRelationships.stream() - .filter(r->child.getGUID().equals(r.getEntityTwoProxy().getGUID())) - .findFirst().get(); - - EntityDetail tableEntity = omEntityDao.getEntityByGuid(columnTableRelationship.getEntityOneProxy().getGUID()); - return tableEntity; - } - - private TableItem buildTableItems(Relationship tableTypeToColumns) { - - EntityDetail columnEntity; - try { - columnEntity = omEntityDao.getEntityByGuid(tableTypeToColumns.getEntityTwoProxy().getGUID()); - } catch (AnalyticsModelingCheckedException e) { - // skip the item - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_COLUMN_NOT_FOUND - .getMessageDefinition(tableTypeToColumns.getEntityTwoProxy().getGUID()), - e.getReportedCaughtException().getLocalizedMessage()); - return null; - } - TableItem item = new TableItem(); - Column tableColumn = new Column(); - item.setColumn(tableColumn); - - item.setPosition(getEntityIntProperty(columnEntity, Constants.POSITION)); - tableColumn.setName(getEntityStringProperty(columnEntity, Constants.DISPLAY_NAME)); - tableColumn.addProperty(Constants.GUID, columnEntity.getGUID()); - - String pkName = getPrimaryKeyClassification(columnEntity); - if (pkName != null && !pkName.isEmpty()) { - item.setPkName(pkName); - } - - tableColumn.setNullable(getEntityBooleanProperty(columnEntity, Constants.IS_NULLABLE)); - - List fks = getReferencedColumn(columnEntity); - if(fks != null && !fks.isEmpty()) { - item.setReferencedColumns(fks); - } - - try { - EntityDetail columnTypeUniverse = getColumnType(columnEntity); - InstanceProperties ap = getAdditiomalProperty(columnTypeUniverse.getProperties()); - tableColumn.setVendorType(omEntityDao.getStringProperty(Constants.TYPE, ap)); - - String length = omEntityDao.getStringProperty(Constants.LENGTH, ap); - String dt = omEntityDao.getStringProperty(Constants.ODBC_TYPE, ap); - dt = mapDataType(dt); - tableColumn.setDatatype(length == null ? dt : dt + "(" + length + ")"); - - } catch (AnalyticsModelingCheckedException e) { - // column is useless without data type information - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_COLUMN_NOT_FOUND.getMessageDefinition(tableColumn.getName()), - e.getReportedCaughtException().getLocalizedMessage()); - return null; - } - - processGlossaryTerms(columnEntity, tableColumn); - - return item; - } - - private String mapDataType(String dt) { - String newType = mapTypes.get(dt); - return newType == null ? dt : newType; - } - - private String getPrimaryKeyClassification(EntityDetail columnEntity) { - List classifications = columnEntity.getClassifications(); - if (classifications == null || classifications.isEmpty()) { - return null; - } - Classification classification = classifications.stream().filter(e -> e.getName().equals(Constants.PRIMARY_KEY)) - .findFirst().orElse(null); - - return classification == null ? null - : omEntityDao.getStringProperty(Constants.NAME, classification.getProperties()); - } - - /** - * Returns the column type details for a given column - * - * @param column for which the type is retrieved - * @return the column type entity linked to column entity - * @throws AnalyticsModelingCheckedException - */ - private EntityDetail getColumnType(EntityDetail column) throws AnalyticsModelingCheckedException { - - List columnToColumnType = omEntityDao.getRelationshipsForEntity(column, Constants.ATTACHED_NOTE_LOG); - return omEntityDao.getEntityByGuid(columnToColumnType.get(0).getEntityTwoProxy().getGUID()); - } - - private EntityDetail getSchemaEntityByName(String databaseGuid, String schema) throws AnalyticsModelingCheckedException { - - EntityDetail dbEntity = omEntityDao.getEntityByGuid(databaseGuid); - List databaseToDbSchemaRelationships = omEntityDao.getRelationshipsForEntity(dbEntity, Constants.DATA_CONTENT_FOR_DATASET); - - return Optional.ofNullable(databaseToDbSchemaRelationships).map(Collection::stream).orElseGet(Stream::empty) - .map(r -> { - EntityDetail dbSchemaEntity = getSchemaEntityFromRelationship(r); - - if (dbSchemaEntity != null) { // skip the schema in case of an error - String schemaName = getEntityStringProperty(dbSchemaEntity, Constants.ATTRIBUTE_NAME); - - if (schema != null && schema.equals(schemaName)) { // only requested schema - return dbSchemaEntity; - } - } - return null; - }).filter(Objects::nonNull).findFirst() - .orElseThrow(()-> new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.SCHEMA_UNKNOWN.getMessageDefinition(schema), - this.getClass().getSimpleName(), - "getSchemaEntityByName")); - } - - /** - * Get GUIDs of the columns referenced as foreign key - * @param columnEntity for the column. - * @return GUIDs of the referenced columns. - */ - private List getReferencedColumn(EntityDetail columnEntity) { - - List columnForeignKeys; - try { - columnForeignKeys = omEntityDao.getRelationshipsForEntity(columnEntity, Constants.FOREIGN_KEY); - } catch (AnalyticsModelingCheckedException e) { - // no foreign keys - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_FOREIGN_KEY.getMessageDefinition(columnEntity.getGUID()), - e.getReportedCaughtException().getLocalizedMessage()); - return null; - } - - if (columnForeignKeys == null || CollectionUtils.isEmpty(columnForeignKeys)) { - return null; - } - String columnGuid = columnEntity.getGUID(); - return columnForeignKeys.stream() - .filter(v->columnGuid.equals(v.getEntityTwoProxy().getGUID())) - .map(v->v.getEntityOneProxy().getGUID()) - .collect(Collectors.toList()); - } - - private InstanceProperties getAdditiomalProperty(InstanceProperties properties) { - return properties == null ? null : omEntityDao.getMapProperty(properties, Constants.ADDITIONAL_PROPERTIES); - } - - private String getEntityStringProperty(EntityDetail entity, String name) { - return entity == null ? null : omEntityDao.getEntityStringProperty(entity, name); - } - - private Boolean getEntityBooleanProperty(EntityDetail entity, String name) { - return entity == null ? null : omEntityDao.getEntityBooleanProperty(entity, name); - } - - private int getEntityIntProperty(EntityDetail entity, String name) { - return entity == null ? null : omEntityDao.getEntityIntProperty(entity, name); - } - - public Messages getMessages() { - return ctx.getMessages(); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java deleted file mode 100644 index 777d5bfda82..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java +++ /dev/null @@ -1,120 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.auditlog; - - -import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageDefinition; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageSet; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.MessageDefinition; -import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLogRecordSeverity; - -/** - * The AnalyticsModelingAuditCode is used to define the message content for the OMRS Audit Log. - *

- * The 5 fields in the enum are: - *

    - *
  • Log Message Id - to uniquely identify the message
  • - *
  • Severity - is this an event, decision, action, error or exception
  • - *
  • Log Message Text - includes placeholder to allow additional values to be captured
  • - *
  • Additional Information - further parameters and data relating to the audit message (optional)
  • - *
  • SystemAction - describes the result of the situation
  • - *
  • UserAction - describes how a user should correct the situation
  • - *
- */ -public enum AnalyticsModelingAuditCode implements AuditLogMessageSet { - - SERVICE_INITIALIZING("OMAS-ANALYTICS-MODELING-0001", - OMRSAuditLogRecordSeverity.STARTUP, - "The Analytics Modeling Open Metadata Access Service (OMAS) is initializing a new server instance", - "The local server has started up a new instance of the Analytics Modeling OMAS.", - "No action is required. This is part of the normal operation of the server."), - - SERVICE_REGISTERED_WITH_OUT_TOPIC("OMAS-ANALYTICS-MODELING-0004", - OMRSAuditLogRecordSeverity.INFO, - "The Analytics Modeling Open Metadata Access Service (OMAS) is registering a publisher with the Analytics Modeling Out topic {0}", - "The Analytics Modeling OMAS is registering to publish events to Analytics Modeling Out topic.", - "No action is required. This is part of the normal operation of the server."), - - SERVICE_INITIALIZED("OMAS-ANALYTICS-MODELING-0005", - OMRSAuditLogRecordSeverity.INFO, - "The Analytics Modeling Open Metadata Access Service (OMAS) has initialized a new instance for server {0}", - "The Analytics Modeling OMAS has completed initialization.", - "No action is required. This is part of the normal operation of the server."), - - SERVICE_SHUTDOWN("OMAS-ANALYTICS-MODELING-0006", - OMRSAuditLogRecordSeverity.INFO, - "The Analytics Modeling Open Metadata Access Service (OMAS) is shutting down server instance {0}", - "The local server has requested shut down of an Analytics Modeling OMAS server instance.", - "No action is required. This is part of the normal operation of the server."), - - ERROR_INITIALIZING_CONNECTION("OMAS-ANALYTICS-MODELING-0007", - OMRSAuditLogRecordSeverity.EXCEPTION, - "Unable to initialize the Analytics Modeling Open Metadata Access Service (OMAS) topic connection {0} for server instance {1}; error message was: {2}", - "The connection could not be initialized.", - "Review the exception and resolve the configuration. "), - SERVICE_INSTANCE_TERMINATION_FAILURE("OMAS-ANALYTICS-MODELING-0008", - OMRSAuditLogRecordSeverity.EXCEPTION, - "The Analytics Modeling Open Metadata Access Service (OMAS) is unable to terminate an instance {0}", - "The access service detected an error during the shut down of a specific server instance. Its services are not available for the server.", - "Review the error message and any other reported failures to determine the cause of the problem. Once this is resolved, try to shut " + - "down the server."), - FIND_ENTITIES("OMAS-ANALYTICS-MODELING-0009", - OMRSAuditLogRecordSeverity.INFO, - "Retrieving entities of type {0} with properties {1}.", - "The local server has requested find entities operation.", - "No action is required. This is part of the normal operation of the server."), - - ; - - - private final AuditLogMessageDefinition messageDefinition; - - - AnalyticsModelingAuditCode(String logMessageId, OMRSAuditLogRecordSeverity severity, String logMessage, String systemAction, String userAction) { - messageDefinition = new AuditLogMessageDefinition(logMessageId, severity,logMessage, systemAction, userAction); - } - - /** - * Retrieve a message definition object for an exception. - * This method is used when there are no message inserts. - * - * @return message definition object. - */ - @Override - public AuditLogMessageDefinition getMessageDefinition() { - return messageDefinition; - } - - - /** - * Retrieve a message definition object for an exception. - * This method is used when there are values to be inserted into the message. - * - * @param params array of parameters (all strings).They are inserted into the message according to the numbering in the message text. - * @return message definition object. - */ - @Override - public AuditLogMessageDefinition getMessageDefinition(String... params) { - messageDefinition.setMessageParameters(params); - return messageDefinition; - } - - /** - * Build Audit log message from message definition of error code. - * @param msg message definition of the error code source. - * @param params array of parameters (all strings) inserted into the message according to the numbering in the message text. - * @return message that can be logged always is EXCEPTION severity. - * Note: it is often operation to log an exception - make it as AuditLogMessageDefinition interface. - */ - static public AuditLogMessageDefinition getAuditLogMessageDefinition(MessageDefinition msg, String... params) { - AuditLogMessageDefinition message = new AuditLogMessageDefinition( - msg.getMessageId(), // add suffix like "-EX" to distinct from audit message with same id - OMRSAuditLogRecordSeverity.EXCEPTION, - msg.getMessageTemplate(), - msg.getSystemAction(), - msg.getUserAction() - ); - message.setMessageParameters(params); - return message; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/contentmanager/OMEntityDao.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/contentmanager/OMEntityDao.java deleted file mode 100644 index 69efdfbbabb..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/contentmanager/OMEntityDao.java +++ /dev/null @@ -1,274 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager; - - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.auditlog.AnalyticsModelingAuditCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.MatchCriteria; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.SequencingOrder; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceStatus; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryConnector; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityProxyOnlyException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException; - -/** - * The class implements access wrapper to retrieve data OMRS. - * - */ -public class OMEntityDao { - - protected final OMRSRepositoryConnector enterpriseConnector; - protected List supportedZones; - private final AuditLog auditLog; - - private String context; - - private static final List FILTER_ACTIVE = Arrays.asList(InstanceStatus.ACTIVE); - - public OMEntityDao(OMRSRepositoryConnector enterpriseConnector, List supportedZones, AuditLog auditLog) { - this.enterpriseConnector = enterpriseConnector; - this.auditLog = auditLog; - this.supportedZones = supportedZones; - } - - /** - * Set context of the execution for logging. - * @param value high level method/operation requested by user. - */ - public void setContext(String value) { - context = value; - } - - /** - * Find entities matching criteria. - * @param matchProperties filter. - * @param typeName of the requested entity. - * @param fromElement index of the first entity. - * @param pageSize number of entities to return. - * @return list of matching entities - * @throws AnalyticsModelingCheckedException in case repository fails. - */ - public List findEntities(InstanceProperties matchProperties, String typeName, int fromElement, int pageSize) throws AnalyticsModelingCheckedException { - // GDW the matchProperties passed to this method should have already converted any exact match string - // using the getExactMatchRegex repository helper method - OMRSRepositoryHelper repositoryHelper = enterpriseConnector.getRepositoryHelper(); - TypeDef typeDef = repositoryHelper.getTypeDefByName(Constants.ANALYTICS_MODELING_USER_ID, typeName); - List existingEntities; - try { - auditLog.logMessage(context, AnalyticsModelingAuditCode.FIND_ENTITIES.getMessageDefinition(typeDef.getName(), matchProperties.toString())); - existingEntities = enterpriseConnector.getMetadataCollection() - .findEntitiesByProperty(Constants.ANALYTICS_MODELING_USER_ID, - typeDef.getGUID(), - matchProperties, - MatchCriteria.ALL, - fromElement, - Collections.singletonList(InstanceStatus.ACTIVE), - null, - null, - null, - SequencingOrder.ANY, - pageSize); - } catch (InvalidParameterException | PropertyErrorException | TypeErrorException - | FunctionNotSupportedException | UserNotAuthorizedException | RepositoryErrorException - | PagingErrorException ex) { - String keys = String.join(",", matchProperties.getInstanceProperties().keySet()); - String values = matchProperties.getInstanceProperties().values().stream().map(InstancePropertyValue::valueAsString).collect(Collectors.joining(",")); - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.GET_ENTITY_EXCEPTION.getMessageDefinition(keys, values), - this.getClass().getSimpleName(), - "findEntities", - ex); - - } - return existingEntities; - } - - /** - * Returns the properties object for the given pair of key - value that can be used for retrieving - * - * @param properties - all properties to use for matching - * @param zoneRestricted to take into account zones. - * @return properties with the given key - value pair - */ - public InstanceProperties buildMatchingInstanceProperties(Map properties, boolean zoneRestricted) { - InstanceProperties instanceProperties = new InstanceProperties(); - if(properties != null && properties.size() > 0) { - for(Map.Entry entry : properties.entrySet()){ - instanceProperties = enterpriseConnector.getRepositoryHelper().addStringPropertyToInstance(Constants.ANALYTICS_MODELING_OMAS_NAME, instanceProperties, entry.getKey(), entry.getValue(), "throw buildMatchingInstanceProperties"); - } - } - if(zoneRestricted && supportedZones != null && !supportedZones.isEmpty()){ - instanceProperties = enterpriseConnector.getRepositoryHelper().addStringArrayPropertyToInstance(Constants.ANALYTICS_MODELING_OMAS_NAME, instanceProperties, Constants.ZONE_MEMBERSHIP, supportedZones, "throw buildMatchingInstanceProperties"); - } - - return instanceProperties; - } - - /** - * Helper function to fetch entity by GUID from repository. - * - * @param guid of the entity to fetch. - * @return entity with required GUID. - * @throws AnalyticsModelingCheckedException if entity cannot be fetched: failed request to repository or entity not found. - */ - public EntityDetail getEntityByGuid(String guid) throws AnalyticsModelingCheckedException { - EntityDetail entity = null; - try { - entity = enterpriseConnector.getMetadataCollection().getEntityDetail(Constants.ANALYTICS_MODELING_USER_ID, guid); - } catch (InvalidParameterException | RepositoryErrorException | EntityNotKnownException - | EntityProxyOnlyException | UserNotAuthorizedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.GET_ENTITY_EXCEPTION.getMessageDefinition(Constants.GUID, guid), - this.getClass().getSimpleName(), - "getEntityByGuid", - ex); - } - if (entity == null) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.ENTITY_NOT_FOUND_EXCEPTION.getMessageDefinition(Constants.GUID, guid), - this.getClass().getSimpleName(), - "getEntityByGuid"); - } - - return entity; - } - - private String getTypeDefGuidByName(String name) { - return enterpriseConnector.getRepositoryHelper().getTypeDefByName(Constants.ANALYTICS_MODELING_USER_ID, name).getGUID(); - } - - /** - * Get relationships of certain type for the entity. - * @param entity whose relationships are requested. - * @param relationshipType only relationship of the type are requested. All relationships are returned if null. - * @return requested relationships. - * @throws AnalyticsModelingCheckedException in case of repository fails. - */ - public List getRelationshipsForEntity(EntityDetail entity, String relationshipType) throws AnalyticsModelingCheckedException { - String relationshipTypeGuid = relationshipType == null ? null : getTypeDefGuidByName(relationshipType); - try { - return enterpriseConnector.getMetadataCollection().getRelationshipsForEntity(Constants.ANALYTICS_MODELING_USER_ID, - entity.getGUID(), relationshipTypeGuid, 0, FILTER_ACTIVE, null, null, null, 0); - } catch (InvalidParameterException | TypeErrorException | RepositoryErrorException | EntityNotKnownException - | PropertyErrorException | PagingErrorException | FunctionNotSupportedException - | UserNotAuthorizedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.GET_RELATIONSHIP_EXCEPTION.getMessageDefinition(relationshipType, getEntityQName(entity)), - this.getClass().getSimpleName(), - "getRelationshipsForEntity", - ex); - - - } - } - /** - * Get relationships of certain GUID for the entity. - * @param entity whose relationships are requested. - * @param relationshipTypeGUID only relationship of the type are requested. All relationships are returned if null. - * @return requested relationships. - * @throws AnalyticsModelingCheckedException in case of repository fails. - */ - public List getRelationshipsByGUIDForEntity(EntityDetail entity, String relationshipTypeGUID) throws AnalyticsModelingCheckedException { - try { - return enterpriseConnector.getMetadataCollection().getRelationshipsForEntity(Constants.ANALYTICS_MODELING_USER_ID, - entity.getGUID(), relationshipTypeGUID, 0, FILTER_ACTIVE, null, null, null, 0); - } catch (InvalidParameterException | TypeErrorException | RepositoryErrorException | EntityNotKnownException - | PropertyErrorException | PagingErrorException | FunctionNotSupportedException - | UserNotAuthorizedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.GET_RELATIONSHIP_EXCEPTION.getMessageDefinition(relationshipTypeGUID, getEntityQName(entity)), - this.getClass().getSimpleName(), - "getRelationshipsForEntity", - ex); - - - } - } - - /** - * Get qualified name property for the entity. - * @param entity whose qualified name is requested. - * @return qualified name. - */ - public String getEntityQName(EntityDetail entity) { - return enterpriseConnector.getRepositoryHelper() - .getStringProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, Constants.QUALIFIED_NAME, entity.getProperties(), context); - } - /** - * Get entity property of type string. - * @param entity whose property is requested. - * @param name if the requested property. - * @return property value. - */ - public String getEntityStringProperty(EntityDetail entity, String name) { - return enterpriseConnector.getRepositoryHelper() - .getStringProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, name, entity.getProperties(), context); - } - /** - * Get entity property of type boolean. - * @param entity whose property is requested. - * @param name if the requested property. - * @return property value. - */ - public Boolean getEntityBooleanProperty(EntityDetail entity, String name) { - return enterpriseConnector.getRepositoryHelper() - .getBooleanProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, name, entity.getProperties(), context); - } - - /** - * Get entity property of type integer. - * @param entity whose property is requested. - * @param name if the requested property. - * @return property value. - */ - public int getEntityIntProperty(EntityDetail entity, String name) { - return enterpriseConnector.getRepositoryHelper() - .getIntProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, name, entity.getProperties(), context); - } - - /** - * Get property of type string from collection of instance properties. - * @param name if the requested property. - * @param properties collection of instance properties - * @return property value. - */ - public String getStringProperty(String name, InstanceProperties properties) { - return enterpriseConnector.getRepositoryHelper() - .getStringProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, name, properties, context); - } - - /** - * Get map of property from collection of instance properties. - * @param name if the requested property. - * @param properties collection of instance properties - * @return property value. - */ - public InstanceProperties getMapProperty(InstanceProperties properties, String name) { - return enterpriseConnector.getRepositoryHelper() - .getMapProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, name, properties, context); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/DatabaseConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/DatabaseConverter.java deleted file mode 100644 index c3bfd8ce4b0..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/DatabaseConverter.java +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.converter; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Database; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -/** - * DatabaseConverter transfers the relevant properties from an Open Metadata Repository Services (OMRS) - * EntityDetail object into a Database bean. - */ -public class DatabaseConverter extends OpenMetadataAPIGenericConverter -{ - /** - * Constructor - * - * @param repositoryHelper helper object to parse entity/relationship objects - * @param serviceName name of this component - * @param serverName local server name - */ - public DatabaseConverter(OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) - { - super(repositoryHelper, serviceName, serverName); - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public Database getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - Database bean = new Database(); - InstanceProperties instanceProperties = new InstanceProperties(entity.getProperties()); - - bean.setGuid(entity.getGUID()); - bean.setName(this.removeName(instanceProperties)); - bean.setType(removeDatabaseType(instanceProperties)); - bean.setVersion(removeDatabaseVersion(instanceProperties)); - - return bean; - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity and that of a connected relationship. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public Database getNewBean(Class beanClass, - EntityDetail entity, - Relationship relationship, - String methodName) throws PropertyServerException - { - return getNewBean(beanClass, entity, methodName); - } -} - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/EmptyConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/EmptyConverter.java deleted file mode 100644 index 670d74308fe..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/EmptyConverter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.converter; - -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -/** - * EmptyConverter is temporary stab to initialize empty Object bean. - */ -public class EmptyConverter extends OpenMetadataAPIGenericConverter -{ - /** - * Constructor - * - * @param repositoryHelper helper object to parse entity/relationship objects - * @param serviceName name of this component - * @param serverName local server name - */ - public EmptyConverter(OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) - { - super(repositoryHelper, serviceName, serverName); - } - - - /** - * This stub should be never called - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return empty bean - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public Object getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - throw new RuntimeException("Class is not implemented."); - } - - - /** - * This stub should be never called - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public Object getNewBean(Class beanClass, - EntityDetail entity, - Relationship relationship, - String methodName) throws PropertyServerException - { - return getNewBean(beanClass, entity, methodName); - } -} - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/GlossaryTermConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/GlossaryTermConverter.java deleted file mode 100644 index 7c8c55d09b2..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/GlossaryTermConverter.java +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.converter; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.GlossaryTerm; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -/** - * GlossaryTermConverter transfers the relevant properties from an Open Metadata Repository Services (OMRS) - * EntityDetail object into a GlossaryTerm bean. - */ -public class GlossaryTermConverter extends OpenMetadataAPIGenericConverter -{ - /** - * Constructor - * - * @param repositoryHelper helper object to parse entity/relationship objects - * @param serviceName name of this component - * @param serverName local server name - */ - public GlossaryTermConverter(OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) - { - super(repositoryHelper, serviceName, serverName); - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public GlossaryTerm getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - GlossaryTerm bean = new GlossaryTerm(); - InstanceProperties instanceProperties = new InstanceProperties(entity.getProperties()); - - bean.setGuid(entity.getGUID()); - bean.setName(removeDisplayName(instanceProperties)); - bean.setDescription(removeDescription(instanceProperties)); - bean.setSummary(removeSummary(instanceProperties)); - - return bean; - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity and that of a connected relationship. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public GlossaryTerm getNewBean(Class beanClass, - EntityDetail entity, - Relationship relationship, - String methodName) throws PropertyServerException - { - return getNewBean(beanClass, entity, methodName); - } -} - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/SchemaConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/SchemaConverter.java deleted file mode 100644 index 5c4620f279a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/converter/SchemaConverter.java +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.converter; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Schema; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -/** - * DatabaseConverter transfers the relevant properties from an Open Metadata Repository Services (OMRS) - * EntityDetail object into a Database bean. - */ -public class SchemaConverter extends OpenMetadataAPIGenericConverter -{ - /** - * Constructor - * - * @param repositoryHelper helper object to parse entity/relationship objects - * @param serviceName name of this component - * @param serverName local server name - */ - public SchemaConverter(OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) - { - super(repositoryHelper, serviceName, serverName); - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public Schema getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) - { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - Schema bean = new Schema(); - InstanceProperties instanceProperties = new InstanceProperties(entity.getProperties()); - - bean.setGuid(entity.getGUID()); - bean.setName(removeName(instanceProperties)); - bean.setType(removeSchemaType(instanceProperties)); - - return bean; - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity and that of a connected relationship. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public Schema getNewBean(Class beanClass, - EntityDetail entity, - Relationship relationship, - String methodName) throws PropertyServerException - { - return getNewBean(beanClass, entity, methodName); - } -} - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingInstanceHandler.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingInstanceHandler.java deleted file mode 100644 index d9d12c37789..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingInstanceHandler.java +++ /dev/null @@ -1,94 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.server; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.AnalyticsArtifactHandler; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.PropertyServerException; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.UserNotAuthorizedException; -import org.odpi.openmetadata.commonservices.multitenant.OMASServiceInstanceHandler; - -/** - * AnalyticsModelingInstanceHandler retrieves information from the instance map for the - * access service instances. The instance map is thread-safe. Instances are - * added and removed by the AnalyticsModelingAdmin class. - */ -public class AnalyticsModelingInstanceHandler extends OMASServiceInstanceHandler { - - /** - * Default constructor registers the access service - */ - public AnalyticsModelingInstanceHandler() { - super(AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceFullName()); - - AnalyticsModelingOMASRegistration.registerAccessService(); - } - - /** - * Retrieve the handler for retrieving assets details for the access service. - * - * @param serverName name of the server tied to the request - * @param userId of the request - * @param serviceOperationName context - * @return database handler for exclusive use by the requested instance - * @throws AnalyticsModelingCheckedException if server is not initialized. - */ - public DatabaseContextHandler getDatabaseContextHandler(String serverName, String userId, String serviceOperationName) - throws AnalyticsModelingCheckedException { - - try { - AnalyticsModelingServicesInstance instance = (AnalyticsModelingServicesInstance) - super.getServerServiceInstance(userId, serverName, serviceOperationName); - if (instance != null) { - return instance.getContextBuilder(); - } - } catch (InvalidParameterException | UserNotAuthorizedException | PropertyServerException error) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.SERVICE_INSTANCE_FAILURE.getMessageDefinition(serverName, userId, serviceOperationName), - this.getClass().getSimpleName(), - serviceOperationName, - error); - } - - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.SERVICE_NOT_INITIALIZED.getMessageDefinition(serverName), - this.getClass().getSimpleName(), - serviceOperationName); - } - - /** - * Retrieve the handler for Analytics modeling artifacts. - * - * @param serverName name of the server tied to the request - * @param userId of the request - * @param serviceOperationName context - * @return handler for exclusive use by the requested instance - * @throws AnalyticsModelingCheckedException if server is not initialized. - */ - public AnalyticsArtifactHandler getAnalyticsArtifactHandler(String serverName, String userId, String serviceOperationName) - throws AnalyticsModelingCheckedException { - - try { - AnalyticsModelingServicesInstance instance = (AnalyticsModelingServicesInstance) - super.getServerServiceInstance(userId, serverName, serviceOperationName); - if (instance != null) { - return instance.getArtifactHandler(); - } - } catch (InvalidParameterException | UserNotAuthorizedException | PropertyServerException error) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.SERVICE_INSTANCE_FAILURE.getMessageDefinition(serverName, userId, serviceOperationName), - this.getClass().getSimpleName(), - serviceOperationName, - error); - } - - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.SERVICE_NOT_INITIALIZED.getMessageDefinition(serverName), - this.getClass().getSimpleName(), - serviceOperationName); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingOMASRegistration.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingOMASRegistration.java deleted file mode 100644 index f09cd87cf2e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingOMASRegistration.java +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.server; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.admin.AnalyticsModelingAdmin; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceRegistrationEntry; -import org.odpi.openmetadata.adminservices.registration.OMAGAccessServiceRegistration; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.adminservices.configuration.registration.ServiceOperationalStatus; - -/** - * AnalyticsModelingOMASRegistration registers the access service with the OMAG Server - * administration services. This registration must be driven once at server - * start up. The OMAG Server administration services then use this registration - * information as confirmation that there is an implementation of this access - * service in the server and it can be configured and used. - */ -class AnalyticsModelingOMASRegistration { - - /** - * Pass information about this access service to the OMAG Server administration - * services. - */ - static void registerAccessService() { - AccessServiceDescription myDescription = AccessServiceDescription.ANALYTICS_MODELING_OMAS; - AccessServiceRegistrationEntry myRegistration = new AccessServiceRegistrationEntry(myDescription, - ServiceOperationalStatus.ENABLED, AnalyticsModelingAdmin.class.getName()); - - OMAGAccessServiceRegistration.registerAccessService(myRegistration); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingRestServices.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingRestServices.java deleted file mode 100644 index 4b12727577a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingRestServices.java +++ /dev/null @@ -1,387 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.server; - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AnalyticsModelingOMASAPIResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AssetsResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.DatabasesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ErrorResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ModuleResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemaTablesResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.SchemasResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.AnalyticsArtifactHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.ffdc.RESTCallLogger; -import org.odpi.openmetadata.commonservices.ffdc.RESTCallToken; -import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.slf4j.LoggerFactory; - -/** - * Server-side implementation of the Analytics Modeling OMAS interface for modeling. - */ -public class AnalyticsModelingRestServices { - - private static final String DATABASE_GUID = "databaseGUID"; - private AnalyticsModelingInstanceHandler instanceHandler = new AnalyticsModelingInstanceHandler(); - private InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - - private static RESTCallLogger restCallLogger = new RESTCallLogger(LoggerFactory.getLogger(AnalyticsModelingRestServices.class), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceFullName()); - - private RESTExceptionHandler restExceptionHandler = new RESTExceptionHandler(); - - public RESTExceptionHandler getExceptionHandler() { - return restExceptionHandler; - } - - public AnalyticsModelingInstanceHandler getHandler() { - return instanceHandler; - } - - public InvalidParameterHandler getInvalidParameterHandler() { - return invalidParameterHandler; - } - - /** - * Get databases available on the server for the user. - * - * @param serverName of the server. - * @param userId of the user. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of databases for the requested server/user. - */ - public AnalyticsModelingOMASAPIResponse getDatabases(String serverName, String userId, Integer startFrom, Integer pageSize) { - - String methodName = "getDatabases"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - validateUrlParameters(serverName, userId, null, null, startFrom, pageSize, methodName); - - DatabasesResponse response = new DatabasesResponse(); - DatabaseContextHandler handler = getHandler().getDatabaseContextHandler(serverName, userId, methodName); - List databases = handler.getDatabases(userId, startFrom, pageSize); - response.setDatabasesList(databases); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - /** - * Get schema defined by database GUID. - * - * @param serverName of the request. - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return list of schemas for the requested database. - */ - public AnalyticsModelingOMASAPIResponse getSchemas(String serverName, String userId, String databaseGuid, - Integer startFrom, Integer pageSize) { - - String methodName = "getSchemas"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - - validateUrlParameters(serverName, userId, databaseGuid, DATABASE_GUID, startFrom, pageSize, methodName); - - SchemasResponse response = new SchemasResponse(); - DatabaseContextHandler handler = getHandler().getDatabaseContextHandler(serverName, userId, methodName); - List databasesSchemas = handler.getDatabaseSchemas(userId, databaseGuid, startFrom, pageSize); - response.setSchemaList(databasesSchemas); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - /** - * Get tables for the schema. - * - * @param serverName of the request. - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param schema schema name on the database. - * @return list of tables for the requested schema. - */ - public AnalyticsModelingOMASAPIResponse getTables(String serverName, String userId, String databaseGuid, String schema) { - - String methodName = "getTables"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - validateUrlParameters(serverName, userId, databaseGuid, DATABASE_GUID, null, null, methodName); - - SchemaTablesResponse response = new SchemaTablesResponse(); - DatabaseContextHandler handler = getHandler().getDatabaseContextHandler(serverName, userId, methodName); - ResponseContainerSchemaTables tables = handler.getSchemaTables(userId, databaseGuid, schema); - response.setTableList(tables); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - /** - * Build module for the schema. - * - * @param serverName of the request. - * @param userId of the request. - * @param databaseGuid of the requested database. - * @param catalog catalog name of the database. - * @param schema schema name of the database. - * @param request table filter - * @return module for the requested schema. - */ - public AnalyticsModelingOMASAPIResponse getModule(String serverName, String userId, String databaseGuid, String catalog, - String schema, ModuleTableFilter request) { - - String methodName = "getModule"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - - validateUrlParameters(serverName, userId, databaseGuid, DATABASE_GUID, null, null, methodName); - - ModuleResponse response = new ModuleResponse(); - DatabaseContextHandler handler = getHandler().getDatabaseContextHandler(serverName, userId, methodName); - ResponseContainerModule module = handler.getModule(userId, databaseGuid, catalog, schema, request); - response.setModule(module); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - /** - * Create analytics artifact defined as json input. - * @param serverName where to create artifact. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param artifact definition. - * @return response with artifact or error description. - */ - public AnalyticsModelingOMASAPIResponse createArtifact(String serverName, String userId, - String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - { - - String methodName = "createArtifact"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - - validateUrlParameters(serverName, userId, null, null, null, null, methodName); - - AssetsResponse response = new AssetsResponse(); - AnalyticsArtifactHandler handler = getHandler().getAnalyticsArtifactHandler(serverName, userId, methodName); - ResponseContainerAssets assets = handler.createAssets(userId, serverCapability, serverCapabilityGUID, artifact); - response.setAssetList(assets); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - /** - * Update analytics artifact defined as json input. - * @param serverName where to create artifact. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param artifact definition. - * @return response with artifact or error description. - */ - public AnalyticsModelingOMASAPIResponse updateArtifact(String serverName, String userId, - String serverCapability, String serverCapabilityGUID, AnalyticsAsset artifact) - { - String methodName = "updateArtifact"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - - validateUrlParameters(serverName, userId, null, null, null, null, methodName); - - AssetsResponse response = new AssetsResponse(); - AnalyticsArtifactHandler handler = getHandler().getAnalyticsArtifactHandler(serverName, userId, methodName); - ResponseContainerAssets assets = handler.updateAssets(userId, serverCapability, serverCapabilityGUID, artifact); - response.setAssetList(assets); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - /** - * Delete analytics artifact defined by unique identifier. - * @param serverName where to create artifact. - * @param userId requested the operation. - * @param serverCapability source where artifact persist. - * @param serverCapabilityGUID source where artifact persist. - * @param identifier of the artifact in the 3rd party system. - * @return response with status of the operation. - */ - public AnalyticsModelingOMASAPIResponse deleteArtifact(String serverName, String userId, - String serverCapability, String serverCapabilityGUID, String identifier) - { - String methodName = "deleteArtifact"; - AnalyticsModelingOMASAPIResponse ret; - RESTCallToken token = restCallLogger.logRESTCall(serverName, userId, methodName); - - try { - - validateUrlParameters(serverName, userId, null, null, null, null, methodName); - - AssetsResponse response = new AssetsResponse(); - AnalyticsArtifactHandler handler = getHandler().getAnalyticsArtifactHandler(serverName, userId, methodName); - ResponseContainerAssets assets = handler.deleteAssets(userId, serverCapability, serverCapabilityGUID, identifier); - response.setAssetList(assets); - response.setMeta(handler.getMessages()); - ret = response; - } catch (Exception e) { - ret = handleErrorResponse(e, methodName); - } - - restCallLogger.logRESTCallReturn(token, ret.toString()); - return ret; - } - - - /** - * Validate path and query parameters from URL. - * @param serverName mandatory path parameter of the base URL. - * @param userId mandatory path parameter of the base URL. - * @param guid optional path parameter. - * @param guidParamName name of GUID parameter in URL. - * @param startFrom optional query parameter. - * @param pageSize optional query parameter. - * @param methodName for message. - * @throws InvalidParameterException if validation failed. - * - * To validate guid the guidParamName must not be null. - */ - public void validateUrlParameters(String serverName, String userId, String guid, String guidParamName, - Integer startFrom, Integer pageSize, String methodName) throws InvalidParameterException { - - getInvalidParameterHandler().validateUserId(userId, methodName); - getInvalidParameterHandler().validateName(serverName, "serverName", methodName); - - if (guidParamName != null) { - getInvalidParameterHandler().validateGUID(guid, guidParamName, methodName); - } - - if (startFrom != null && pageSize != null) { - getInvalidParameterHandler().validatePaging(startFrom, pageSize, methodName); - } - } - - /** - * Handle error in processing: build error response, and log with standard handler. - * @param exception being thrown - * @param methodName context - * @return response with error definition. - */ - private AnalyticsModelingOMASAPIResponse handleErrorResponse(Exception exception, String methodName) { - AnalyticsModelingCheckedException error = createAnalyticsException(exception, methodName); - AnalyticsModelingOMASAPIResponse ret = new ErrorResponse(error); - getExceptionHandler().captureExceptions(ret, exception, methodName); - return ret; - } - - private AnalyticsModelingCheckedException createAnalyticsException(Exception error, String methodName) { - - if (error instanceof AnalyticsModelingCheckedException) { - return (AnalyticsModelingCheckedException)error; - } - else if (error instanceof UserNotAuthorizedException) - { - UserNotAuthorizedException e = (UserNotAuthorizedException)error; - - return new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.UNAUTHORIZED_USER.getMessageDefinition(e.getUserId(), e.getReportingActionDescription()), - this.getClass().getSimpleName(), - methodName, - error); - } - else if (error instanceof InvalidParameterException) - { - InvalidParameterException e = (InvalidParameterException)error; - - return new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.INVALID_REQUEST_PARAMER.getMessageDefinition(e.getParameterName()), - this.getClass().getSimpleName(), - methodName, - error); - } - else - { - String message = error.getLocalizedMessage(); - - if (message == null) - { - message = "null"; - } - - ExceptionMessageDefinition messageDefinition = - AnalyticsModelingErrorCode.UNEXPECTED_EXCEPTION.getMessageDefinition(error.getClass().getName(), - methodName, - message); - - return new AnalyticsModelingCheckedException( - messageDefinition, - this.getClass().getSimpleName(), - methodName, - error); - } - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingServicesInstance.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingServicesInstance.java deleted file mode 100644 index 4f3254facf0..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/AnalyticsModelingServicesInstance.java +++ /dev/null @@ -1,120 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.server; - - -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager.OMEntityDao; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.DatabaseConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.EmptyConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.SchemaConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Database; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Schema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.AnalyticsArtifactHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.commonservices.generichandlers.RelationalDataHandler; -import org.odpi.openmetadata.commonservices.multitenant.OMASServiceInstance; -import org.odpi.openmetadata.commonservices.multitenant.ffdc.exceptions.NewInstanceException; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryConnector; - -/** - * AnalyticsModelingServicesInstance caches references to OMRS objects for a specific server. - * It is also responsible for registering itself in the instance map. - */ -public class AnalyticsModelingServicesInstance extends OMASServiceInstance -{ - private DatabaseContextHandler databaseContextHandler; - - private AnalyticsArtifactHandler artifactHandler; - - private RelationalDataHandler relationalDataHandler; - - - /** - * Set up the local repository connector that will service the REST Calls - * - * @param repositoryConnector link to the repository responsible for servicing the REST calls - * @param supportedZones list of zones that OMAS is allowed to serve Assets from - * @param auditLog logging destination - * @param localServerUserId userId used for server initiated actions - * @param maxPageSize max number of results to return on single request - * - * @throws NewInstanceException a problem occurred during initialization - */ - public AnalyticsModelingServicesInstance(OMRSRepositoryConnector repositoryConnector, List supportedZones, - AuditLog auditLog, String localServerUserId, int maxPageSize) throws NewInstanceException { - - super(AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceFullName(), repositoryConnector, supportedZones, null, - null, auditLog, localServerUserId, maxPageSize); - - OMEntityDao omEntityDao = new OMEntityDao(repositoryConnector, supportedZones, auditLog); - - this.relationalDataHandler = new RelationalDataHandler<>( - new DatabaseConverter(repositoryHelper, serviceName,serverName), - Database.class, - new SchemaConverter(repositoryHelper, serviceName,serverName), - Schema.class, - new EmptyConverter(repositoryHelper, serviceName,serverName), - Object.class, - new EmptyConverter(repositoryHelper, serviceName,serverName), - Object.class, - new EmptyConverter(repositoryHelper, serviceName, serverName), - Object.class, - new EmptyConverter(repositoryHelper, serviceName, serverName), - Object.class, - serviceName, - serverName, - invalidParameterHandler, - repositoryHandler, - repositoryHelper, - localServerUserId, - securityVerifier, - supportedZones, - defaultZones, - publishZones, - auditLog); - - ExecutionContext ctx = new ExecutionContext( - serviceName, - serverName, - invalidParameterHandler, - repositoryHandler, - repositoryHelper, - localServerUserId, - securityVerifier, - supportedZones, - defaultZones, - publishZones, - auditLog); - - databaseContextHandler = new DatabaseContextHandler(relationalDataHandler, omEntityDao, ctx); - - artifactHandler = new AnalyticsArtifactHandler(ctx); - } - - - /** - * Get the handler that does major work this OMAS is designed for. - * @return Database Context Handler - */ - public DatabaseContextHandler getContextBuilder() { - return databaseContextHandler; - } - - /** - * Get the handler that to create repository assets. - * @return Database Context Handler - */ - public AnalyticsArtifactHandler getArtifactHandler() { - return artifactHandler; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/AnalyticsArtifactHandler.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/AnalyticsArtifactHandler.java deleted file mode 100644 index 4c068d3887f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/AnalyticsArtifactHandler.java +++ /dev/null @@ -1,1339 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Optional; -import java.util.stream.Collectors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaAttribute; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.builders.AnalyticsMetadataBuilder; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.AnalyticsMetadataConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.AssetConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.SchemaTypeConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsMetadata; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AssetReference; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.AnalyticsAssetUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.QualifiedNameUtils; -import org.odpi.openmetadata.commonservices.generichandlers.AssetHandler; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; -import org.odpi.openmetadata.commonservices.generichandlers.SchemaAttributeHandler; -import org.odpi.openmetadata.commonservices.generichandlers.SchemaTypeBuilder; -import org.odpi.openmetadata.commonservices.generichandlers.SchemaTypeHandler; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SoftwareCapability; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceStatus; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; - - -public class AnalyticsArtifactHandler { - - private AssetHandler assetHandler; - private SchemaTypeHandler schemaTypeHandler; - private SchemaAttributeHandler metadataHandler; - private AnalyticsMetadataConverter analyticsMetadataConverter; - - - private ExecutionContext ctx; - - private IdentifierResolver resolver; - private Map newItem; // map identifier to GUID for new items during update operation - private List invalidAliases = new ArrayList<>(); // referenced asset aliases removed or used for other asset during update. - - public AnalyticsArtifactHandler(ExecutionContext ctx) { - - this.ctx = ctx; - - assetHandler = new AssetHandler<>(new AssetConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()), - AnalyticsAsset.class, ctx.getServiceName(), ctx.getServerName(), - ctx.getInvalidParameterHandler(), ctx.getRepositoryHandler(), ctx.getRepositoryHelper(), - ctx.getLocalServerUserId(), ctx.getSecurityVerifier(), - ctx.getSupportedZones(), ctx.getDefaultZones(), ctx.getPublishZones(), ctx.getAuditLog()); - - schemaTypeHandler = new SchemaTypeHandler<>( - new SchemaTypeConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()), - SchemaType.class, ctx.getServiceName(), ctx.getServerName(), - ctx.getInvalidParameterHandler(), ctx.getRepositoryHandler(), ctx.getRepositoryHelper(), - ctx.getLocalServerUserId(), ctx.getSecurityVerifier(), - ctx.getSupportedZones(), ctx.getDefaultZones(), ctx.getPublishZones(), ctx.getAuditLog()); - - analyticsMetadataConverter = new AnalyticsMetadataConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()); - - metadataHandler = new SchemaAttributeHandler<>( - analyticsMetadataConverter, - SchemaAttribute.class, - new SchemaTypeConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()), - SchemaType.class, - ctx.getServiceName(), ctx.getServerName(), - ctx.getInvalidParameterHandler(), ctx.getRepositoryHandler(), ctx.getRepositoryHelper(), - ctx.getLocalServerUserId(), ctx.getSecurityVerifier(), - ctx.getSupportedZones(), ctx.getDefaultZones(), ctx.getPublishZones(), ctx.getAuditLog()); - } - - public AssetHandler getAssetHandler() { - return assetHandler; - } - - /** - * Create assets defined by input. - * @param user making the request. - * @param serverCapability where the artifact is located. - * @param serverCapabilityGUID source of artifact. - * @param asset definition of analytic artifact. - * @return set of asset GUIDs representing the artifact. - * @throws AnalyticsModelingCheckedException in case of error. - * @throws UserNotAuthorizedException in case of error. - */ - public ResponseContainerAssets createAssets(String user, String serverCapability, String serverCapabilityGUID, AnalyticsAsset asset) - throws AnalyticsModelingCheckedException, UserNotAuthorizedException - { - String methodName = "createAssets"; - ctx.initializeSoftwareServerCapability(user, serverCapability, serverCapabilityGUID); - - List guids = new ArrayList<>(); - - try { - - if (AnalyticsAssetUtils.hasMetadataModule(asset) || !AnalyticsAssetUtils.isVisualization(asset)) { - guids.add(createModuleAsset(asset)); - } - - if (AnalyticsAssetUtils.isVisualization(asset)) { - guids.add(createVisualizationAsset(asset)); - } - } catch (InvalidParameterException | PropertyServerException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_CREATE_ARTIFACT.getMessageDefinition(), - this.getClass().getSimpleName(), - methodName, - ex); - } - - ResponseContainerAssets ret = new ResponseContainerAssets(); - ret.setAssetsList(guids); - return ret; - } - - /** - * Create an asset with metadata model. - * - * @param asset definition. - * @return GUID of the created Asset - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - * @throws AnalyticsModelingCheckedException - */ - private String createModuleAsset(AnalyticsAsset asset) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AnalyticsModelingCheckedException - { - resolver = new IdentifierResolver(ctx, asset); - - // create asset - String assetGUID = createAssetEntity(asset, true); - String qualifiedName = asset.getQualifiedName(); - - // create relationships for referenced assets - createAssetReferences(asset, assetGUID); - - String schemaTypeGUID = createSchemaType(asset, assetGUID); - - // create containers - if (asset.getContainer() != null) { - verifyOrder(asset.getContainer()); - for (MetadataContainer container : asset.getContainer()) { - createContainer(container, schemaTypeGUID, assetGUID, false, qualifiedName); - } - } - - // create items - createItems(asset.getItem(), assetGUID, qualifiedName, schemaTypeGUID, false); - - return assetGUID; - } - - /** - * Create relationships of the asset using references to existing assets. - * @param asset - * @param assetGUID - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private void createAssetReferences(AnalyticsAsset asset, String assetGUID) - throws UserNotAuthorizedException, PropertyServerException - { - String methodName = "createAssetReferences"; - List refAssets = asset.getReference(); - - if (refAssets == null) { - return; - } - - for (AssetReference ref : refAssets) { - if (ref.getGuid() != null) { - ctx.getRepositoryHandler().createRelationship(ctx.getUserId(), IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID, - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - assetGUID, ref.getGuid(), null, methodName); - } else { - // unresolved reference - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_UNRESOLVED_REFERENCE - .getMessageDefinition(asset.getDisplayName(), ref.getAlias())); - } - } - } - - /** - * Create SchemaType entity element of the asset. - * - * @param asset parent of the created element. - * @param assetGUID - * @return GUID of the created entity. - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private String createSchemaType(AnalyticsAsset asset, String assetGUID) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String methodName = "createSchemaType"; - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - SchemaTypeBuilder builder = new SchemaTypeBuilder( - QualifiedNameUtils.buildQualifiedName(asset.getQualifiedName(), IdMap.COMPLEX_SCHEMA_TYPE_TYPE_NAME, asset.getType()), - IdMap.COMPLEX_SCHEMA_TYPE_TYPE_GUID, IdMap.COMPLEX_SCHEMA_TYPE_TYPE_NAME, - ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()); - - builder.setAnchors(ctx.getUserId(), assetGUID, methodName); - - String schemaTypeGUID = schemaTypeHandler.addSchemaType(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), builder, null, null, false, false, new Date(), methodName); - - assetHandler.attachSchemaTypeToAsset(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), assetGUID, Constants.PARAM_NAME_ASSET_GUID, - schemaTypeGUID, "schemaTypeGUID", null, null, false, false, new Date(), methodName); - return schemaTypeGUID; - } - - /** - * Create Asset entity. - * @param asset object whose entity to create. - * @param bModuleAsset true for module asset and false for deployed report. - * @return GUID of the created entity. - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private String createAssetEntity(AnalyticsAsset asset, boolean bModuleAsset) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String methodName = "createAsset"; - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - String assetTypeName = bModuleAsset ? IdMap.INFOTMATION_VIEW_TYPE_NAME : IdMap.DEPLOYED_REPORT_TYPE_NAME; - String assetTypeGuid = bModuleAsset ? IdMap.INFOTMATION_VIEW_TYPE_GUID : IdMap.DEPLOYED_REPORT_TYPE_GUID; - String qualifiedName = QualifiedNameUtils.buildQualifiedName(ssc.getQualifiedName(), assetTypeName, asset.getUid()); - - - asset.setQualifiedName(qualifiedName); - String assetGUID = assetHandler.createAssetInRepository(ctx.getUserId(), - ssc.getGUID(), ssc.getSource(), - qualifiedName, asset.getDisplayName(), null, - asset.getDescription(), - ctx.getSupportedZones(), // zoneMembership, - null, // owner - 0, // ownerType (0 = OWNS), - null, //originOrganizationCapabilityGUID, - null, //originBusinessCapabilityGUID, - null, //otherOriginValues, - AnalyticsAssetUtils.buildAdditionalProperties(asset), //additionalProperties, - assetTypeGuid, assetTypeName, - null, //extended properties - null, - null, - InstanceStatus.ACTIVE, - new Date(), - methodName); - - ctx.getRepositoryHandler().createRelationship(ctx.getUserId(), - IdMap.SERVER_ASSET_USE_TYPE_GUID, - ssc.getGUID(), ssc.getSource(), - ssc.getGUID(), assetGUID, null, methodName); - - return assetGUID; - } - - - /** - * Create DeployedReport asset for visualization. - * - * @param report specification. - * @return created asset GUID. - * - * @throws UserNotAuthorizedException - * @throws PropertyServerException - * @throws InvalidParameterException - * - * Note: use resolver from InformationView asset. - * @throws AnalyticsModelingCheckedException - */ - private String createVisualizationAsset(AnalyticsAsset report) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AnalyticsModelingCheckedException - { - if (resolver == null || !AnalyticsAssetUtils.hasMetadataModule(report)) { - resolver = new IdentifierResolver(ctx, report); - } - - // create asset - String assetGUID = createAssetEntity(report, false); - String qualifiedName = report.getQualifiedName(); - - createAssetReferences(report, assetGUID); - - - // create SchemaType - String schemaTypeGUID = createSchemaType(report, assetGUID); - - // create containers - if (report.getVisualization() != null) { - verifyOrder(report.getVisualization()); - for (MetadataContainer container : report.getVisualization()) { - createContainer(container, schemaTypeGUID, assetGUID, false, qualifiedName); - } - } - - return assetGUID; - } - /** - * Update DeployedReport asset for visualization. - * - * @param report specification. - * @return created asset GUID. - * - * @throws UserNotAuthorizedException - * @throws PropertyServerException - * @throws InvalidParameterException - * - * Note: use resolver from InformationView asset. - * @throws AnalyticsModelingCheckedException - */ - private String updateVisualizationAsset(AnalyticsAsset report) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AnalyticsModelingCheckedException - { - String methodName = "updateModuleAsset"; - - if (resolver == null || !AnalyticsAssetUtils.hasMetadataModule(report)) { - resolver = new IdentifierResolver(ctx, report); - } - - // update asset attributes - updateAssetAttributes(report, false); - - // get all entities created for containers and items of the asset - Map assetEntities = new HashMap<>(); - resolver.getSchemaAttributes(report.getQualifiedName(), methodName).forEach( - entity->assetEntities.put(ctx.getStringProperty(Constants.QUALIFIED_NAME, entity.getProperties(), methodName), entity) - ); - - - String schemaTypeGUID = ctx.getRepositoryHandler().getEntityForRelationshipType(ctx.getUserId(), report.getGuid(), IdMap.DEPLOYED_REPORT_TYPE_NAME, - IdMap.ASSET_TO_SCHEMA_TYPE_TYPE_GUID, IdMap.ASSET_TO_SCHEMA_TYPE_TYPE_NAME, methodName).getGUID(); - - // create containers - if (report.getVisualization() != null) { - verifyOrder(report.getVisualization()); - for (MetadataContainer container : report.getVisualization()) { - updateContainer(container, schemaTypeGUID, report.getGuid(), false, report.getQualifiedName(), assetEntities); - } - } - - // remove objects left in repository and missing in new definition. - for(EntityDetail entity : assetEntities.values()) { - removeMetadataObject(entity, methodName); - } - - return report.getGuid(); - } - - - /** - * Set positions of the element within collection. - * @param attributes collection. - */ - private void verifyOrder(List attributes) { - - if (attributes.stream().filter(att->att.getElementPosition() != 0).count() != attributes.size()) { - // not all positions are set within the collection - for (int i = 0; i < attributes.size(); ++i) { - attributes.get(i).setElementPosition(i+1); - } - } - } - - /** - * Create container entity to store container bean. - * - * @param container bean to create. - * @param parentGUID to use as parent entity. - * @param anchorGUID to create anchor classification. - * @param bNested to create nested container. - * @param parentQName of the created container. - * @return created container GUID. - * @throws InvalidParameterException repository access error. - * @throws PropertyServerException repository access error. - * @throws UserNotAuthorizedException repository access error. - */ - public String createContainer(MetadataContainer container, String parentGUID, String anchorGUID, boolean bNested, String parentQName) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String methodName = "createContainer"; - String qualifiedName = QualifiedNameUtils.buildQualifiedName(parentQName, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, container.getIdentifier()); - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - container.setQualifiedName(qualifiedName); - - String guid = bNested - ? metadataHandler.createNestedSchemaAttribute(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - parentGUID, Constants.PARAM_NAME_PARENT_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - IdMap.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_GUID, IdMap.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_NAME, - qualifiedName, "qualifiedName", - createAnalyticsMetadataBuilder(container, anchorGUID, true),null, null, false, false, null, methodName) - : metadataHandler.createBeanInRepository(ctx.getUserId(), null, null, - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - createAnalyticsMetadataBuilder(container, anchorGUID, true), new Date(), methodName); - - if (!bNested) { - // global calculation connects to the schema - assetHandler.linkElementToElement(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - parentGUID, Constants.PARAM_NAME_PARENT_GUID, IdMap.COMPLEX_SCHEMA_TYPE_TYPE_NAME, - guid, "guid", IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, false, false, - IdMap.SCHEMATYPE_TO_SCHEMAATTRIBUTE_GUID, IdMap.SCHEMATYPE_TO_SCHEMAATTRIBUTE_NAME, - (InstanceProperties) null, null, null, new Date(), methodName); - } - - if (newItem != null) { - newItem.put(IdentifierResolver.getIdFromQName(qualifiedName, null), guid); - } - - // create nested containers - if (container.getContainer() != null) { - verifyOrder(container.getContainer()); - for (MetadataContainer subContainer: container.getContainer()) { - createContainer(subContainer, guid, anchorGUID, true, qualifiedName); - } - } - - // create items - createItems(container.getItem(), anchorGUID, qualifiedName, guid, true); - - - return guid; - } - - /** - * Update container. - * - * @param container to update. - * @param parentGUID - * @param anchorGUID - * @param assetEntities - * @return - * @throws InvalidParameterException repository access error. - * @throws PropertyServerException repository access error. - * @throws UserNotAuthorizedException repository access error. - */ - private String updateContainer(MetadataContainer container, String parentGUID, String anchorGUID, - boolean bNested, String parentQName, Map assetEntities) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String methodName = "updateContainer"; - String qualifiedName = QualifiedNameUtils.buildQualifiedName(parentQName, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, container.getIdentifier()); - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - container.setQualifiedName(qualifiedName); - - EntityDetail entity = assetEntities.remove(qualifiedName); - - if (entity == null) { - // new container - return createContainer(container, parentGUID, anchorGUID, bNested, parentQName); - } - - AnalyticsMetadata containerOld = analyticsMetadataConverter.getNewBean(entity, methodName); - AnalyticsMetadataConverter.prepareAnalyticsMetadataProperties(container); - - if (!container.equals(containerOld)) { - metadataHandler.updateSchemaAttribute(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), entity.getGUID(), - createAnalyticsMetadataBuilder(container, null, false).getInstanceProperties(methodName), - false, false, new Date(), methodName); - } - - // update nested containers - if (container.getContainer() != null) { - verifyOrder(container.getContainer()); - for (MetadataContainer subContainer: container.getContainer()) { - updateContainer(subContainer, entity.getGUID(), anchorGUID, true, qualifiedName, assetEntities); - } - } - - // update items - updateItems(container.getItem(), entity.getGUID(), anchorGUID, true, qualifiedName, assetEntities); - - return entity.getGUID(); - } - - /** - * Create item entity to store item bean. - * - * @param item bean to create. - * @param parentGUID to use as parent. - * @param anchorGUID to create classification. - * @param bNested true for child of container or item, not asset. - * @param parentQName to build QName of the item. - * @throws InvalidParameterException repository access error. - * @throws PropertyServerException repository access error. - * @throws UserNotAuthorizedException repository access error. - */ - public void createItem(MetadataItem item, String parentGUID, String anchorGUID, boolean bNested, String parentQName) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String methodName = "createItem"; - String qualifiedName = QualifiedNameUtils.buildQualifiedName(parentQName, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, item.getIdentifier()); - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - item.setQualifiedName(qualifiedName); - - String guid = bNested - ? metadataHandler.createNestedSchemaAttribute(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - parentGUID, Constants.PARAM_NAME_PARENT_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - IdMap.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_GUID, IdMap.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_NAME, - qualifiedName, "qualifiedName", - createAnalyticsMetadataBuilder(item, anchorGUID, true), null, null, false, false, new Date(), methodName) - : metadataHandler.createBeanInRepository(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - createAnalyticsMetadataBuilder(item, anchorGUID, true), new Date(), methodName); - - item.setGuid(guid); - - if (!bNested) { - // top level items connects to the schema - assetHandler.linkElementToElement(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - parentGUID, Constants.PARAM_NAME_PARENT_GUID, IdMap.COMPLEX_SCHEMA_TYPE_TYPE_NAME, - guid, "guid", IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, false, false, - IdMap.SCHEMATYPE_TO_SCHEMAATTRIBUTE_GUID, - IdMap.SCHEMATYPE_TO_SCHEMAATTRIBUTE_NAME, (InstanceProperties) null, null, null, new Date(), methodName); - } - - if (newItem != null) { - newItem.put(IdentifierResolver.getIdFromQName(item.getQualifiedName(), null), guid); - } - - - // create nested items - createItems(item.getItem(), anchorGUID, qualifiedName, guid, true); - - // collect GUIDs for internal identifiers - resolver.addGuidForIdentifier(guid, IdentifierResolver.getIdFromQName(qualifiedName, null)); - } - - /** - * Create items from the list. - * - * @param items list. - * @param anchorGUID GUID of anchor asset - * @param parentQName qualified name of the parent. - * @param parentGUID GUID of the parent. - * @param bNested true if items are children of container or item, not asset. - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private void createItems(List items, String anchorGUID, String parentQName, String parentGUID, boolean bNested) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - if (items == null) { - return; - } - - List guidToItem = new ArrayList<>(); - for (MetadataItem item : items) { - createItem(item, parentGUID, anchorGUID, bNested, parentQName); - guidToItem.add(item); - } - - guidToItem.forEach(this::createMetadataLink); - } - - /** - * Update metadata item. - * - * @param item to update. - * @param parentGUID to attach item entity. - * @param anchorGUID to create anchor classification for new item entity. - * @param bNested true if items are children of container or item, not asset. - * @param parentQName to build qualified name of the item. - * @return true if metadata references must be updated, otherwise false. - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private boolean updateItem(MetadataItem item, String parentGUID, String anchorGUID, boolean bNested, String parentQName, Map assetEntities) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String methodName = "updateItem"; - String qualifiedName = QualifiedNameUtils.buildQualifiedName(parentQName, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, item.getIdentifier()); - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - item.setQualifiedName(qualifiedName); - - EntityDetail entity = assetEntities.remove(qualifiedName); - - if (entity == null) { - // new item - createItem(item, parentGUID, anchorGUID, bNested, parentQName); - return true; - } - - AnalyticsMetadata itemOld = analyticsMetadataConverter.getNewBean(entity, methodName); - AnalyticsMetadataConverter.prepareAnalyticsMetadataProperties(item); - item.setGuid(entity.getGUID()); // after update the item has entity - - if (!item.equals(itemOld)) { - metadataHandler.updateSchemaAttribute(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), entity.getGUID(), - createAnalyticsMetadataBuilder(item, null, false).getInstanceProperties(methodName), false, false, new Date(), methodName); - } - - // update nested items - updateItems(item.getItem(), entity.getGUID(), anchorGUID, true, qualifiedName, assetEntities); - - // collect GUIDs for internal identifiers - resolver.addGuidForIdentifier(entity.getGUID(), IdentifierResolver.getIdFromQName(qualifiedName, null)); - - if (!Objects.equals(item.getSourceId(), itemOld.getSourceId()) || !Objects.equals(item.getSourceGuid(), itemOld.getSourceGuid())) { - return true; - } - - // check if invalid metadata reference is used due to alias is modified - if (item.getSourceId() != null && invalidAliases != null) { - for(String alias : invalidAliases) { - for(String metadata : item.getSourceId()) { - if(metadata.startsWith(alias)) { - return true; - } - } - } - } - - return false; - } - - /** - * Update repository for list of items which can reference items from the list. - * @param items to update - * @param parentGUID GUID of the parent entity. - * @param anchorGUID GUID of asset. - * @param bNested for nested in container or item. - * @param parentQName parent qualified name. - * @param assetEntities from repository mapped by QNames - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private void updateItems(List items, String parentGUID, String anchorGUID, - boolean bNested, String parentQName, Map assetEntities) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - if (items == null) { - return; - } - verifyOrder(items); - List guidToItem = new ArrayList<>(); - for (MetadataItem item : items) { - if (updateItem(item, parentGUID, anchorGUID, bNested, parentQName, assetEntities)) { - guidToItem.add(item); - } - } - - guidToItem.forEach(this::updateMetadataLink); - } - - /** - * Create metadata links for the item. - * - * @param item whose links to create. - */ - private void createMetadataLink(MetadataItem item) { - - String methodName = "createMetadataLink"; - List metadata = resolver.required() ? resolver.getItemGUIDs(item) - : item.getSourceGuid(); - - if (metadata == null || metadata.isEmpty()) { - // expression that does not references any metadata: constants, current time functions, etc. - return; - } - - for (int i = 0; i < metadata.size(); ) { - String srcGUID = metadata.get(i); - try { - ctx.getRepositoryHandler().createRelationship( - ctx.getUserId(), - IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID, - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - item.getGuid(), srcGUID, null, methodName); - metadata.remove(i); // relationship replaced the GUID - } catch (UserNotAuthorizedException | PropertyServerException e) { - // log warning in execution context - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK - .getMessageDefinition(item.getGuid(), srcGUID), e.getLocalizedMessage()); - - ++i; // leave GUID for relationship which was not created - } - - } - } - - /** - * Update metadata links of the item. - * @param item whose links to update. - * Note: item may reference something from its container so - * the links update must be performed after all items updated. - */ - private void updateMetadataLink(MetadataItem item) { - - String methodName = "updateMetadataLink"; - List metadata = resolver.required() ? resolver.getItemGUIDs(item) - : item.getSourceGuid(); - - Map itemReferences = new HashMap<>(); - - try { - List list = ctx.getRepositoryHandler().getRelationshipsByType( - ctx.getUserId(), item.getGuid(), IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID, - IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_NAME, methodName); - - if (list != null) { - // exclude references pointing to this item - list.forEach(relationship->{ - if (relationship.getEntityOneProxy().getGUID().equals(item.getGuid())) { - itemReferences.put(relationship.getEntityTwoProxy().getGUID(), relationship); - } - }); - } - } catch (InvalidParameterException | UserNotAuthorizedException | PropertyServerException e1) { - // log warning in execution context: relationships for item are not fetched from repository. - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_UPDATE_METADATA_LINK - .getMessageDefinition(item.getGuid(), e1.getLocalizedMessage())); - - } - - metadata.forEach(srcGUID->{ - - Relationship relationship = itemReferences.remove(srcGUID); - if (relationship == null) { // new reference to the metadata object - try { - ctx.getRepositoryHandler().createRelationship( - ctx.getUserId(), - IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID, - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - item.getGuid(), srcGUID, null, methodName); - } catch (UserNotAuthorizedException | PropertyServerException e) { - // log warning in execution context: relationship for item is not created - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_CREATE_METADATA_LINK - .getMessageDefinition(item.getGuid(), srcGUID), e.getLocalizedMessage()); - } - } - }); - - // remove old references not used in the new definition - itemReferences.values().forEach(relationship -> { - try { - ctx.getRepositoryHandler().removeRelationship(ctx.getUserId(), - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - relationship, methodName); - } catch (UserNotAuthorizedException | PropertyServerException e) { - // log warning in execution context: old relationship for item is not removed - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_DELETE_METADATA_LINK - .getMessageDefinition(relationship.getGUID(), item.getGuid()), e.getLocalizedMessage()); - } - }); - } - - - /** - * Helper function to create AnalyticsMetadataBuilder for AnalyticMetadata item. - * @param src item to build. - * @param assetGUID to use as anchor. - * @param bCreate true if nested SchemaBuilder is required. - * @return requested builder. - * @throws InvalidParameterException - */ - private AnalyticsMetadataBuilder createAnalyticsMetadataBuilder(AnalyticsMetadata src, String assetGUID, boolean bCreate) - throws InvalidParameterException, PropertyServerException - { - String methodName = "createAnalyticsMetadataBuilder"; - - AnalyticsMetadataConverter.prepareAnalyticsMetadataProperties(src); - - AnalyticsMetadataBuilder builder = new AnalyticsMetadataBuilder(src, null, ctx); - - if (assetGUID != null) { - builder.setAnchors(ctx.getUserId(), assetGUID, methodName); - } - - if (bCreate) { - SchemaTypeBuilder schemaTypeBuilder = new SchemaTypeBuilder(src.getQualifiedName(), - IdMap.PRIMITIVE_SCHEMA_TYPE_TYPE_GUID, IdMap.PRIMITIVE_SCHEMA_TYPE_TYPE_NAME, - ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()); - - builder.setSchemaType(ctx.getUserId(), schemaTypeBuilder, methodName); - } - - return builder; - } - - /** - * Update assets defined by input. - * @param user making the request. - * @param serverCapability where the artifact is located. - * @param serverCapabilityGUID source of artifact. - * @param asset analytic artifact. - * @return set of asset GUIDs representing the artifact. - * @throws AnalyticsModelingCheckedException in case of error. - * @throws UserNotAuthorizedException in case of error. - */ - public ResponseContainerAssets updateAssets(String user, String serverCapability, String serverCapabilityGUID, AnalyticsAsset asset) - throws AnalyticsModelingCheckedException, UserNotAuthorizedException - { - String methodName = "updateAssets"; - ctx.initializeSoftwareServerCapability(user, serverCapability, serverCapabilityGUID); - - List guids = new ArrayList<>(); - - newItem = new HashMap<>(); - - try { - - if (AnalyticsAssetUtils.hasMetadataModule(asset)) { - String guid = updateModuleAsset(asset); - guids.add(guid); - - updateDependentAssets(guid); - - } else if (!AnalyticsAssetUtils.isVisualization(asset)) { - // update empty module: no metadata definitions maybe all were removed - guids.add(updateModuleAsset(asset)); - } - - if (AnalyticsAssetUtils.isVisualization(asset)) { - guids.add(updateVisualizationAsset(asset)); - } - - } catch (InvalidParameterException | PropertyServerException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_UPDATE_ARTIFACT.getMessageDefinition(user, asset.getQualifiedName(), ex.getLocalizedMessage()), - this.getClass().getSimpleName(), - methodName, - ex); - } - - ResponseContainerAssets ret = new ResponseContainerAssets(); - ret.setAssetsList(guids); - return ret; - } - - /** - * Update assets that import asset with the guid. - * @param guid of imported asset. - */ - private void updateDependentAssets(String guid) { - - String methodName = "updateDependentAssets"; - - if (newItem.isEmpty()) { - return; // nothing to update - } - - AnalyticsMetadataConverter converter = new AnalyticsMetadataConverter(ctx.getRepositoryHelper(), ctx.getServerName(), ctx.getServiceName()); - - try { - // select references pointing to asset GUID - List refAssets = ctx.getRepositoryHandler().getRelationshipsByType( - ctx.getUserId(), - guid, - IdMap.ASSET_TYPE_NAME, - IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID, - IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_NAME, - methodName); - - if (refAssets == null) { - return; // base module without dependent artifacts - } - - // select assets GUIDs referencing the asset with the GUID - List filter = refAssets.stream().map(r->r.getEntityOneProxy().getGUID()).filter(g->!guid.equals(g)).collect(Collectors.toList()); - - List dependants = metadataHandler.getAttachedEntities(ctx.getUserId(), guid, "guid", IdMap.ASSET_TYPE_NAME, - IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID, IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_NAME, - IdMap.ASSET_TYPE_NAME, null, null, 0, - false, false, 0, 0, new Date(), methodName); - - for(EntityDetail entity : dependants) { - if (!filter.contains(entity.getGUID())) { - continue; - } - AnalyticsAsset assetRepo = assetHandler.getBeanFromEntity(ctx.getUserId(), entity, "entity", methodName); - Optional reference = assetRepo.getReference().stream().filter(ref->guid.equals(ref.getGuid())).findFirst(); - - if (reference.isPresent()) { - String alias = reference.get().getAlias() + IdentifierResolver.NAME_SEPARATOR; - Map uid2guid = newItem.entrySet().stream().collect(Collectors.toMap(e->alias + e.getKey(), Entry::getValue)); - - List items; - try { - items = resolver.getSchemaAttributes(assetRepo.getQualifiedName(), methodName); - } catch (AnalyticsModelingCheckedException e1) { - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_ASSET_NO_UPDATE - .getMessageDefinition(assetRepo.getDisplayName(),(e1.getReportedErrorMessage()))); - continue; - } - for (EntityDetail item : items) { - updateDependentItemRelationship(item, converter, uid2guid); - } - } else { - // log reference property is not found - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_LINKED_ASSET_NO_REFERENCE - .getMessageDefinition(guid, assetRepo.getDisplayName())); - - } - } - } catch (InvalidParameterException | PropertyServerException | UserNotAuthorizedException e) { - // log to execution context - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_MANUAL_UPDATE_DEPENDENTS - .getMessageDefinition(guid), e.getLocalizedMessage()); - } - - } - - /** - * Update items in asset referencing the initially updated asset. - * @param item entity to update if needed. - * @param converter to get item entity properties. - * @param uid2guid new items in initial asset that be referenced by the updated item. - * @throws PropertyServerException - */ - private void updateDependentItemRelationship(EntityDetail item, AnalyticsMetadataConverter converter, Map uid2guid) - throws PropertyServerException - { - String methodName = "updateDependentItemRelationship"; - AnalyticsMetadata metadata = converter.getNewBean(item, methodName); - - if (!(metadata instanceof MetadataItem)) { - return; // only for items so far - } - - List sources = metadata.getSourceId(); - if (sources != null) { - sources.forEach(uid->{ - String guidReferenced = uid2guid.get(uid); - if (guidReferenced != null) { - // create relationship - try { - ctx.getRepositoryHandler().createRelationship( - ctx.getUserId(), - IdMap.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID, - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - item.getGUID(), guidReferenced, null, methodName); - } catch (UserNotAuthorizedException | PropertyServerException e) { - // log warning in execution context: relationship for item is not created - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_FAILED_RESTORE_METADATA_LINK - .getMessageDefinition(item.getGUID(), guidReferenced), e.getLocalizedMessage()); - } - } - }); - } - } - - /** - * Update an asset from metadata model. - * - * @param asset definition. - * @return GUID of the updated Asset - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - * @throws AnalyticsModelingCheckedException - */ - private String updateModuleAsset(AnalyticsAsset asset) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AnalyticsModelingCheckedException - { - String methodName = "updateModuleAsset"; - - resolver = new IdentifierResolver(ctx, asset); - - // update asset attributes - updateAssetAttributes(asset, true); - - // get all entities created for containers and items of the asset - Map assetEntities = new HashMap<>(); - resolver.getSchemaAttributes(asset.getQualifiedName(), methodName).forEach( - entity->assetEntities.put(ctx.getStringProperty(Constants.QUALIFIED_NAME, entity.getProperties(), methodName), entity) - ); - - - String assetGUID = asset.getGuid(); - String schemaTypeGUID = ctx.getRepositoryHandler().getEntityForRelationshipType(ctx.getUserId(), assetGUID, IdMap.INFOTMATION_VIEW_TYPE_NAME, - IdMap.ASSET_TO_SCHEMA_TYPE_TYPE_GUID, IdMap.ASSET_TO_SCHEMA_TYPE_TYPE_NAME, methodName).getGUID(); - - // update containers - if (asset.getContainer() != null) { - verifyOrder(asset.getContainer()); - for (MetadataContainer container : asset.getContainer()) { - updateContainer(container, schemaTypeGUID, assetGUID, false, asset.getQualifiedName(), assetEntities); - } - } - - // update items - updateItems(asset.getItem(), schemaTypeGUID, assetGUID, false, asset.getQualifiedName(), assetEntities); - - // remove objects left in repository and missing in new definition. - for(EntityDetail entity : assetEntities.values()) { - removeMetadataObject(entity, methodName); - } - - updateNewItemsReferences(asset); - - return assetGUID; - } - - /** - * Update asset metadata links to new items. - * The asset has metadata reference to local missing item. - * The links to the missing items is created for all new items. - * @param asset to update. - */ - private void updateNewItemsReferences(AnalyticsAsset asset) { - - if (newItem.isEmpty()) { - return; // nothing to update - } - - updateNewItemsReferences(asset.getContainer()); - updateNewItemsReferences(asset.getItem()); - updateNewItemsReferences(asset.getVisualization()); - - } - - /** - * Update metadata references to created local items. - * @param lstMetadata identifier storage. - */ - private void updateNewItemsReferences(List lstMetadata) { - - if (lstMetadata == null) { - return; - } - - for (AnalyticsMetadata mtdObject : lstMetadata) { - if (mtdObject instanceof MetadataItem && mtdObject.getSourceId() != null) { - mtdObject.getSourceId().forEach(src->{ - String guid = newItem.get(src); - if(guid != null) { - updateMetadataLink((MetadataItem)mtdObject); - } - }); - } - - if (mtdObject instanceof MetadataContainer) { - updateNewItemsReferences(((MetadataContainer) mtdObject).getContainer()); - updateNewItemsReferences(((MetadataContainer) mtdObject).getItem()); - } else if (mtdObject instanceof MetadataItem) { - updateNewItemsReferences(((MetadataItem) mtdObject).getItem()); - } - } - } - - /** - * Remove metadata entity left after update is completed. - * @param entity to remove - * @param methodName requested removal. - * @throws InvalidParameterException repository access error. - * @throws UserNotAuthorizedException repository access error. - * @throws PropertyServerException repository access error. - */ - public void removeMetadataObject(EntityDetail entity, String methodName) - throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException - { - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - ctx.getRepositoryHandler().removeEntity(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - entity.getGUID(), "entityGuid", - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - null, null, methodName); - } - - /** - * Update asset entity attributes. - * @param asset object whose entity to update. - * @param bModuleAsset true for module asset and false for deployed report. - * @return true if updated, false nothing to update. - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - * @throws AnalyticsModelingCheckedException - */ - private boolean updateAssetAttributes(AnalyticsAsset asset, boolean bModuleAsset) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException, AnalyticsModelingCheckedException - { - String methodName = "updateAssetAttributes"; - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - String assetTypeName = bModuleAsset ? IdMap.INFOTMATION_VIEW_TYPE_NAME : IdMap.DEPLOYED_REPORT_TYPE_NAME; - String assetTypeGuid = bModuleAsset ? IdMap.INFOTMATION_VIEW_TYPE_GUID : IdMap.DEPLOYED_REPORT_TYPE_GUID; - asset.setQualifiedName(QualifiedNameUtils.buildQualifiedName(ssc.getQualifiedName(), assetTypeName, asset.getUid())); - - AnalyticsAsset assetRepo = assetHandler.getBeanByQualifiedName( - ctx.getUserId(), assetTypeGuid, assetTypeName, asset.getQualifiedName(), Constants.QUALIFIED_NAME, - false, - false, - new Date(), methodName); - - if (assetRepo == null) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_UPDATE_UNKNOWN_ARTIFACT.getMessageDefinition(ctx.getUserId(), asset.getUid()), - this.getClass().getSimpleName(), - methodName); - } - - asset.setGuid(assetRepo.getGuid()); // asset is new definition of the assetRepo - - // update relationships for referenced assets - updateAssetReferences(asset, assetRepo); - - - if (!asset.equals(assetRepo)) { - assetHandler.updateAsset(ctx.getUserId(), ssc.getGUID(), ssc.getSource(), - asset.getGuid(), Constants.PARAM_NAME_ASSET_GUID, - asset.getQualifiedName(), asset.getDisplayName(), null, asset.getDescription(), - AnalyticsAssetUtils.buildAdditionalProperties(asset), assetTypeGuid, assetTypeName, null, - null,null, false, false, false, new Date(), methodName); - return true; - } - // nothing changed - return false; - } - - /** - * Update relationships of the asset merging existing and new asset references. - * @param asset updated definition. - * @param assetRepo repository version of the asset. - * @throws InvalidParameterException - * @throws PropertyServerException - * @throws UserNotAuthorizedException - */ - private void updateAssetReferences(AnalyticsAsset asset, AnalyticsAsset assetRepo) - throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException - { - String methodName = "updateAssetReferences"; - List refAssets = asset.getReference(); - - // select references starting from asset GUID - Map mapReferences = selectReferencedAssets(asset); - - if (refAssets != null) { - for (AssetReference ref : refAssets) { - String guid = ref.getGuid(); - if (guid != null) { - String alias = ref.getAlias(); - if (alias == null || alias.isEmpty()) { - // asset reference cannot be used in the module without alias: skip it. - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_REVERENCE_NO_ALIAS - .getMessageDefinition(asset.getDisplayName(), guid)); - continue; - } - - Relationship assetRef = mapReferences.remove(guid); - if (assetRef == null) { - // this is new reference - ctx.getRepositoryHandler().createRelationship(ctx.getUserId(), IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID, - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - asset.getGuid(), guid, null, methodName); - } - // DATA_CONTENT_FOR_DATA_SET_TYPE_GUID has no property - // all reference properties updated as asset additional properties - - } else { - // log unresolved reference - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_REVERENCE_NO_GUID - .getMessageDefinition(asset.getDisplayName(), ref.getAlias())); - } - } - } - - // delete the removed asset references from repository - for (Relationship rel : mapReferences.values()) { - AssetReference reference = AnalyticsAssetUtils.getAssetReferenceByGuid(assetRepo, rel.getEntityTwoProxy().getGUID()); - if (reference != null) { - // old references to this alias are invalid - invalidAliases.add(reference.getAlias() + IdentifierResolver.NAME_SEPARATOR); - } - ctx.getRepositoryHandler().removeRelationship(ctx.getUserId(), - ctx.getServerSoftwareCapability().getGUID(), ctx.getServerSoftwareCapability().getSource(), - rel, methodName); - } - } - - /** - * Build map referenced GUIDs to relationship of the asset reference. - * @param asset whose references are selected. - * @return map referenced GUID to relationship. - * @throws UserNotAuthorizedException - * @throws PropertyServerException - */ - private Map selectReferencedAssets(AnalyticsAsset asset) - throws UserNotAuthorizedException, PropertyServerException, InvalidParameterException - { - List refAssetsOld = ctx.getRepositoryHandler().getRelationshipsByType( - ctx.getUserId(), - asset.getGuid(), - IdMap.ASSET_TYPE_NAME, - IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID, - IdMap.DATA_CONTENT_FOR_DATA_SET_TYPE_NAME, - "selectReferencedAssets"); - - Map mapReferences = new HashMap<>(); - - if (refAssetsOld != null) { // asset may not have references - refAssetsOld.forEach( // select only assets referenced by this asset - r->{ - if (r.getEntityOneProxy().getGUID().equals(asset.getGuid()) ) { - mapReferences.put(r.getEntityTwoProxy().getGUID(), r); - } - } - ); - } - return mapReferences; - } - - /** - * Delete assets representing the artifact defined by identifier. - * The assets are marked as deleted if repository supports soft delete. - * - * @param userId to perform the action. - * @param serverCapability source of artifact. - * @param serverCapabilityGUID source of artifact. - * @param identifier of the artifact. - * @return list of affected GUIDs. - * @throws AnalyticsModelingCheckedException in case of error. - * @throws UserNotAuthorizedException in case of error. - */ - public ResponseContainerAssets deleteAssets(String userId, String serverCapability, String serverCapabilityGUID, String identifier) - throws AnalyticsModelingCheckedException, UserNotAuthorizedException - { - String methodName = "deleteAssets"; - ctx.initializeSoftwareServerCapability(userId, serverCapability, serverCapabilityGUID); - resolver = new IdentifierResolver(ctx, null); - - List guids = new ArrayList<>(); - - try { - List assets = getArtifactAssets(identifier); - SoftwareCapability ssc = ctx.getServerSoftwareCapability(); - - for(EntityDetail asset : assets) { - guids.add(asset.getGUID()); - - String qName = ctx.getStringProperty(Constants.QUALIFIED_NAME, asset.getProperties(), methodName); - List entities = resolver.getSchemaAttributes(qName, methodName); - - for (EntityDetail entity : entities) { - ctx.getRepositoryHandler().removeEntity(userId, - ssc.getGUID(), ssc.getSource(), - entity.getGUID(), Constants.GUID, - entity.getType().getTypeDefGUID(), entity.getType().getTypeDefName(), - null, null, methodName); - } - - assetHandler.deleteBeanInRepository(userId, - ssc.getGUID(), ssc.getSource(), - asset.getGUID(), Constants.PARAM_NAME_ASSET_GUID, - asset.getType().getTypeDefGUID(), asset.getType().getTypeDefName(), - null, null, false, false, new Date(), methodName); - - } - - } catch (InvalidParameterException | PropertyServerException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_DELETE_ARTIFACT.getMessageDefinition(userId, identifier, ex.getLocalizedMessage()), - this.getClass().getSimpleName(), - methodName, - ex); - } - - ResponseContainerAssets ret = new ResponseContainerAssets(); - ret.setAssetsList(guids); - return ret; - } - - /** - * Fetch all assets created for artifact identified by unique identifier. - * - * @param identifier of the artifact. - * @return list assets. - * @throws AnalyticsModelingCheckedException in case of error. - */ - public List getArtifactAssets(String identifier) throws AnalyticsModelingCheckedException { - - String methodName = "getArtifactAssets"; - // like "(SoftwareCapability)=name::(InformationView | DeployedReport)=identifier" - String pattern = ctx.getRepositoryHelper().getEndsWithRegex(")=" + identifier); - - try { - List ret = ctx.getServerSoftwareCapabilityHandler().getEntitiesByValue( - ctx.getUserId(), - pattern, - "pattern", - IdMap.ASSET_TYPE_GUID, - IdMap.ASSET_TYPE_NAME, - Arrays.asList(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME), false, - null, null, false, false,0, - 0, null, methodName); - - if (ret != null) { - // only objects from the requested server - return ret.stream() - .filter(entity->ctx.getRepositoryHelper() - .getStringProperty(ctx.getServerName(), OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, entity.getProperties(), methodName) - .startsWith(ctx.getServerSoftwareCapability().getQualifiedName())).collect(Collectors.toList()); - } - } catch (InvalidParameterException | PropertyServerException | UserNotAuthorizedException e) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_FIND_ARTIFACT_ASSETS.getMessageDefinition(ctx.getUserId(), identifier, e.getLocalizedMessage()), - this.getClass().getSimpleName(), - methodName, - e); - } - return Collections.emptyList(); - } - - /** - * Get messages about non critical action issues. - * @return null if there is no issues, container with messages otherwise. - */ - public Messages getMessages() { - return ctx.getMessages(); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/IdMap.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/IdMap.java deleted file mode 100644 index 6ca41c03915..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/IdMap.java +++ /dev/null @@ -1,56 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization; - -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; - -/** - * The class keeps identifiers used by synchronization feature. - * Any type GUID and name used by the feature should be referenced here to keep track. - */ -public class IdMap { - - public static final String CAPABILITY_TYPE_GUID = OpenMetadataAPIMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_GUID; - public static final String CAPABILITY_TYPE_NAME = OpenMetadataAPIMapper.SOFTWARE_SERVER_CAPABILITY_TYPE_NAME; - - public static final String DEPLOYED_SOFTWARE_COMPONENT_TYPE_NAME = OpenMetadataAPIMapper.DEPLOYED_SOFTWARE_COMPONENT_TYPE_NAME; - - public static final String ASSET_TYPE_GUID = OpenMetadataAPIMapper.ASSET_TYPE_GUID; - public static final String ASSET_TYPE_NAME = OpenMetadataAPIMapper.ASSET_TYPE_NAME; - public static final String SCHEMA_ATTRIBUTE_TYPE_GUID = OpenMetadataAPIMapper.SCHEMA_ATTRIBUTE_TYPE_GUID; - public static final String SCHEMA_ATTRIBUTE_TYPE_NAME = OpenMetadataAPIMapper.SCHEMA_ATTRIBUTE_TYPE_NAME; - public static final String PRIMITIVE_SCHEMA_TYPE_TYPE_GUID = OpenMetadataAPIMapper.PRIMITIVE_SCHEMA_TYPE_TYPE_GUID; - public static final String PRIMITIVE_SCHEMA_TYPE_TYPE_NAME = OpenMetadataAPIMapper.PRIMITIVE_SCHEMA_TYPE_TYPE_NAME; - public static final String COMPLEX_SCHEMA_TYPE_TYPE_GUID = OpenMetadataAPIMapper.COMPLEX_SCHEMA_TYPE_TYPE_GUID; - public static final String COMPLEX_SCHEMA_TYPE_TYPE_NAME = OpenMetadataAPIMapper.COMPLEX_SCHEMA_TYPE_TYPE_NAME; - public static final String ASSET_TO_SCHEMA_TYPE_TYPE_GUID = OpenMetadataAPIMapper.ASSET_TO_SCHEMA_TYPE_TYPE_GUID; - public static final String ASSET_TO_SCHEMA_TYPE_TYPE_NAME = OpenMetadataAPIMapper.ASSET_TO_SCHEMA_TYPE_TYPE_NAME; - - - // next two are from org.odpi.openmetadata.opentypes.OpenMetadataTypesArchive1_2.getInformationViewEntity() - public static final String INFOTMATION_VIEW_TYPE_NAME = "InformationView"; - public static final String INFOTMATION_VIEW_TYPE_GUID = "68d7b905-6438-43be-88cf-5de027b4aaaf"; - // next two are from org.odpi.openmetadata.opentypes.OpenMetadataTypesArchive1_2.getDeployedReportEntity() - public static final String DEPLOYED_REPORT_TYPE_GUID = "e9077f4f-955b-4d7b-b1f7-12ee769ff0c3"; - public static final String DEPLOYED_REPORT_TYPE_NAME = "DeployedReport"; - - - public static final String SERVER_ASSET_USE_TYPE_GUID = OpenMetadataAPIMapper.SERVER_ASSET_USE_TYPE_GUID; - - public static final String SCHEMATYPE_TO_SCHEMAATTRIBUTE_NAME = OpenMetadataAPIMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_NAME; - public static final String SCHEMATYPE_TO_SCHEMAATTRIBUTE_GUID = OpenMetadataAPIMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_GUID; - - public static final String NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_GUID = OpenMetadataAPIMapper.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_GUID; - public static final String NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_NAME = OpenMetadataAPIMapper.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_NAME; - - public static final String SOURCE_GUID = "sourceGuid"; - public static final String SOURCE_ID = "sourceId"; - - public static final String DATA_CONTENT_FOR_DATA_SET_TYPE_NAME = OpenMetadataAPIMapper.DATA_CONTENT_FOR_DATA_SET_TYPE_NAME; - public static final String DATA_CONTENT_FOR_DATA_SET_TYPE_GUID = OpenMetadataAPIMapper.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID; - - public static final String SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID = OpenMetadataAPIMapper.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_GUID; - public static final String SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_NAME = OpenMetadataAPIMapper.SCHEMA_QUERY_TARGET_RELATIONSHIP_TYPE_NAME; - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/IdentifierResolver.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/IdentifierResolver.java deleted file mode 100644 index 69f506c8dbe..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/IdentifierResolver.java +++ /dev/null @@ -1,282 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsMetadata; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AssetReference; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.QualifiedNameUtils; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; - -/** - * Class implements mapping algorithm for external assets elements (containers and items) - * and GUIDs assigned to objects stored in the repository. - * - */ -public class IdentifierResolver { - - private static String CLIENT = org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants.ANALYTICS_MODELING_OMAS_NAME; - public static String NAME_SEPARATOR = "."; - - private ExecutionContext ctx; - - AnalyticsAsset asset; - - Set identifiersToResolve; - - // referenced identifier -> GUID - Map identifierToGuid = new HashMap<>(); - - - /** - * Constructor with initialization of metadata referenced in asset. - * - * @param ctx execution context to access repository. - * @param asset which identifiers to resolve. - * @throws AnalyticsModelingCheckedException in case of an error while asset resolved. - */ - public IdentifierResolver(ExecutionContext ctx, AnalyticsAsset asset) throws AnalyticsModelingCheckedException { - - this.ctx = ctx; - this.asset = asset; - - if (!required()) { - return; - } - - identifiersToResolve = new HashSet<>(); - buildSetOfMetadataSources(); - resolveAssetReferences(); - } - - /** - * Add GUID for identifier that need to be resolved. - * @param guid to add. - * @param id of the identifier. - * @return true if GUID was added for known identifier. - */ - public boolean addGuidForIdentifier(String guid, String id) { - if (identifiersToResolve != null && identifiersToResolve.remove(id)) { - identifierToGuid.put(id, guid); - return true; - } - return false; - } - - - /** - * Resolve GUIDs for source referenced by identifier. - * @param ref of the source. - * @throws AnalyticsModelingCheckedException in case of repository error. - */ - private void resolveSourcesGuids(AssetReference ref) throws AnalyticsModelingCheckedException { - - String methodName = "resolveSourcesGuids"; - String alias = ref.getAlias() + NAME_SEPARATOR; - // number of metadata objects referenced from the referenced asset - long nRefs = identifiersToResolve.stream().filter(id->id.startsWith(alias)).count(); - - if (nRefs == 0) { - // no metadata is referenced from this referenced asset. - return; - } - - String qualifiedName = QualifiedNameUtils.buildQualifiedName( - ctx.getServerSoftwareCapability().getQualifiedName(), IdMap.INFOTMATION_VIEW_TYPE_NAME, ref.getUid()); - - List metadata = getSchemaAttributes(qualifiedName, methodName); - - for (EntityDetail entity : metadata) { - String qName = ctx.getRepositoryHelper().getStringProperty(CLIENT, - OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, entity.getProperties(), methodName); - - String id = getIdFromQName(qName, ref.getAlias()); - - if (addGuidForIdentifier(entity.getGUID(), id)) { - if (--nRefs == 0) { - break; // all references from this import done - } - } - } - } - - - /** - * Get compound identifier from qualified name. - * @param qName source of identifier. - * @param alias optional. - * @return identifier. - */ - public static String getIdFromQName(String qName, String alias) { - List ids = QualifiedNameUtils.extractIdentifiersFromQualifiedName(qName); - if (alias != null) { - ids.add(0, alias); - } - return String.join(NAME_SEPARATOR, ids); - } - - /** - * Select all referenced objects in the asset. - */ - private void buildSetOfMetadataSources() { - addMetadataSources(asset.getContainer()); - addMetadataSources(asset.getItem()); - addMetadataSources(asset.getVisualization()); - } - - - /** - * Select identifiers to resolve. - * @param lstMetadata identifier storage. - */ - private void addMetadataSources(List lstMetadata) { - - if (lstMetadata == null) { - return; - } - - for (AnalyticsMetadata mtdObject : lstMetadata) { - if (mtdObject.getSourceId() != null) { - mtdObject.getSourceId().forEach(src->{ - identifiersToResolve.add(src); - }); - } - - if (mtdObject instanceof MetadataContainer) { - addMetadataSources(((MetadataContainer) mtdObject).getContainer()); - addMetadataSources(((MetadataContainer) mtdObject).getItem()); - } else if (mtdObject instanceof MetadataItem) { - addMetadataSources(((MetadataItem) mtdObject).getItem()); - } - } - } - - /** - * Function augments references to external artifacts with repository GUIDs of corresponding assets. - * @throws AnalyticsModelingCheckedException in case of error. - */ - private void resolveAssetReferences() throws AnalyticsModelingCheckedException { - - String methodName = "resolveAliases"; - - if (asset.getReference() == null) { - return; // base module does not have references: all GUIDs resolved. - } - - // all assets are children of software server capability - for(AssetReference ref : asset.getReference()) { - - String qualifiedName = QualifiedNameUtils.buildQualifiedName( - ctx.getServerSoftwareCapability().getQualifiedName(), IdMap.INFOTMATION_VIEW_TYPE_NAME, ref.getUid()); - - try { - List refAsset = ctx.getServerSoftwareCapabilityHandler().getEntitiesByValue( - ctx.getUserId(), - qualifiedName, - "qualifiedName", - IdMap.INFOTMATION_VIEW_TYPE_GUID, - IdMap.INFOTMATION_VIEW_TYPE_NAME, - Arrays.asList(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME), true, null, null,true, - false, null, 0, 0, null, methodName); - - if (refAsset == null || refAsset.isEmpty()) { - // missing referenced asset: maybe fine if the reference is not used, but log warning - ctx.addMessage(AnalyticsModelingErrorCode.WARNING_ASSET_NO_REVERENCE.getMessageDefinition(asset.getDisplayName())); - } else if (refAsset.size() > 1) { - // qualified name collision: corrupted repository data - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.MULTIPLE_ASSETS_SAME_QUALIFIEDNAME.getMessageDefinition(qualifiedName), - this.getClass().getSimpleName(), - methodName); - - } else { - ref.setGuid(refAsset.get(0).getGUID()); - resolveSourcesGuids(ref); - } - } catch (InvalidParameterException | UserNotAuthorizedException | PropertyServerException e) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_GET_ASSET_BY_QUALIFIEDNAME.getMessageDefinition(qualifiedName, e.getReportedErrorMessage()), - this.getClass().getSimpleName(), - methodName, e); - } - } - } - - /** - * Fetch all schema elements of the asset by asset qualified name. - * - * @param assetQualifiedName of the asset. - * @param methodName for logging. - * @return list of elements. - * @throws AnalyticsModelingCheckedException in case of repository error. - */ - public List getSchemaAttributes(String assetQualifiedName, String methodName) - throws AnalyticsModelingCheckedException - { - List metadata = new ArrayList<>(); - String pattern = ctx.getRepositoryHelper().getStartsWithRegex(assetQualifiedName + "::"); - - try { - List metadataPage; - while ( - (metadataPage = ctx.getServerSoftwareCapabilityHandler().getEntitiesByValue( - ctx.getUserId(), - pattern, - "pattern", - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, - IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - Arrays.asList(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME), false, - null, null, false, false, metadata.size(), 0, null, methodName)) != null) - { - metadata.addAll(metadataPage); - } - } catch (InvalidParameterException | PropertyServerException | UserNotAuthorizedException e) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_GET_SCHEMA_ATTRIBUTES_BY_QUALIFIEDNAME.getMessageDefinition(pattern, e.getReportedErrorMessage()), - this.getClass().getSimpleName(), - methodName, e); - } - return metadata; - } - - /** - * Check when asset identifiers need to be resolved. - * @return if asset references something then identifiers need to be resolved. - */ - public boolean required() { - return asset != null && asset.getReference() != null && !asset.getReference().isEmpty(); - } - - /** - * Get GUIDs of the identifiers listed as sources of metadata. - * @param item referencing metadata - * @return list of GUIDs. - */ - public List getItemGUIDs(AnalyticsMetadata item) { - List list = item.getSourceId(); - return list == null || list.isEmpty() - ? Collections.emptyList() - : list.stream().map(id->identifierToGuid.get(id)).collect(Collectors.toList()); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/SoftwareServerCapabilityHandler.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/SoftwareServerCapabilityHandler.java deleted file mode 100644 index 036470f9019..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/SoftwareServerCapabilityHandler.java +++ /dev/null @@ -1,140 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization; - -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.builders.SoftwareServerCapabilityBuilder; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.commonservices.generichandlers.ReferenceableHandler; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SoftwareCapability; -import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataServerSecurityVerifier; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - - -/** - * Handler for SoftwareCapability object. - */ -public class SoftwareServerCapabilityHandler extends ReferenceableHandler { - /** - * Construct the collection handler. - * - * @param converter specific for SoftwareCapability bean class - * @param serviceName name of this service - * @param serverName name of the local server - * @param invalidParameterHandler handler for managing parameter errors - * @param repositoryHandler manages calls to the repository services - * @param repositoryHelper provides utilities for manipulating the repository services objects - * @param localServerUserId userId for this server - * @param securityVerifier open metadata security services verifier - * @param supportedZones list of zones that the access service is allowed to serve Asset instances from. - * @param defaultZones list of zones that the access service should set in all new Asset instances. - * @param publishZones list of zones that the access service sets up in published Asset instances. - * @param auditLog destination for audit log events. - */ - public SoftwareServerCapabilityHandler( OpenMetadataAPIGenericConverter converter, - String serviceName, - String serverName, - InvalidParameterHandler invalidParameterHandler, - RepositoryHandler repositoryHandler, - OMRSRepositoryHelper repositoryHelper, - String localServerUserId, - OpenMetadataServerSecurityVerifier securityVerifier, - List supportedZones, - List defaultZones, - List publishZones, - AuditLog auditLog) { - super(converter, SoftwareCapability.class, serviceName, serverName, invalidParameterHandler, repositoryHandler, - repositoryHelper, localServerUserId, securityVerifier, supportedZones, defaultZones, publishZones, - auditLog); - } - - /** - * Create a new metadata element to represent a SoftwareCapability. - * - * @param userId calling user - * @param source identifier of the server capability (url of the service) - * @param methodName calling method - * - * @return unique identifier of the created collection. - * - * @throws InvalidParameterException one of the parameters is invalid - * @throws UserNotAuthorizedException the user is not authorized to issue this request - * @throws PropertyServerException there is a problem reported in the open metadata server(s) - */ - public String createSoftwareServerCapability( - String userId, - String source, - String methodName) throws InvalidParameterException, UserNotAuthorizedException, PropertyServerException { - invalidParameterHandler.validateUserId(userId, methodName); - - SoftwareServerCapabilityBuilder builder = new SoftwareServerCapabilityBuilder(source, null, null, repositoryHelper, serviceName, serverName); - - // create SoftwareCapability - String guid = createBeanInRepository(userId, null, null, IdMap.CAPABILITY_TYPE_GUID, - IdMap.CAPABILITY_TYPE_NAME, builder, new Date(), methodName); - - return guid; - } - - /** - * Returns the software server capability object corresponding to the requested identifier. - * - * @param userId String - userId of user making request - * @param identifier the identifier for the requested object - * @param methodName calling method - * - * @return software server capability - * @throws InvalidParameterException one of the properties (probably the GUID) is invalid - * @throws PropertyServerException the repository services hit an unexpected problem - * @throws UserNotAuthorizedException the user is not permitted to access this entity - */ - public SoftwareCapability findSoftwareServerCapability( - String userId, - String identifier, - String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - return this.getBeanByValue(userId, identifier, - "identifier", - IdMap.CAPABILITY_TYPE_GUID, - IdMap.CAPABILITY_TYPE_NAME, - Arrays.asList("source"), - false, - false, - new Date(), - methodName); - } - - /** - * Returns the SoftwareCapability object corresponding to the supplied GUID. - * - * @param userId String - userId of user making request - * @param guid the unique id for the SoftwareCapability - * @param guidParameter name of parameter supplying the guid - * @param methodName calling method - * - * @return SoftwareCapability retrieved from the repository - * @throws InvalidParameterException one of the properties (probably the GUID) is invalid - * @throws PropertyServerException the repository services hit an unexpected problem - * @throws UserNotAuthorizedException the user is not permitted to access this entity - */ - public SoftwareCapability getSoftwareServerCapability( - String userId, - String guid, - String guidParameter, - String methodName) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - return this.getBeanFromRepository(userId, guid, guidParameter, IdMap.CAPABILITY_TYPE_NAME, false, false, new Date(), - methodName); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/builders/AnalyticsMetadataBuilder.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/builders/AnalyticsMetadataBuilder.java deleted file mode 100644 index 6f5ffdc4f3b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/builders/AnalyticsMetadataBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.builders; - -import java.util.Map; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsMetadata; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.commonservices.generichandlers.SchemaAttributeBuilder; - -public class AnalyticsMetadataBuilder extends SchemaAttributeBuilder { - - /** - * Constructor initialized from source object and . - * - * @param src source of the properties - * @param extendedProperties properties from the subtype. - * @param ctx execution context to access repository - */ - public AnalyticsMetadataBuilder( - AnalyticsMetadata src, - Map extendedProperties, - ExecutionContext ctx) - { - super(src.getQualifiedName(), src.getDisplayName(), src.getDescription(), src.getElementPosition(), - 0, // minCardinality, - 0, // maxCardinality, - false, // isDeprecated, - null, // defaultValueOverride, - false, // allowsDuplicateValues, - false, // orderedValues, - 0, // sortOrder, - 0, // minimumLength, - 0, // length, - 0, // significantDigits, - false, // isNullable, - src.getClass().getName(), // nativeJavaClass, - null, // aliases, - src.getAdditionalProperties(), - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, - IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - extendedProperties, - ctx.getRepositoryHelper(), - ctx.getServiceName(), - ctx.getServerName()); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/builders/SoftwareServerCapabilityBuilder.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/builders/SoftwareServerCapabilityBuilder.java deleted file mode 100644 index 34d72a0770f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/builders/SoftwareServerCapabilityBuilder.java +++ /dev/null @@ -1,64 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.builders; - -import java.util.Map; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.QualifiedNameUtils; -import org.odpi.openmetadata.commonservices.generichandlers.ReferenceableBuilder; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceStatus; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -public class SoftwareServerCapabilityBuilder extends ReferenceableBuilder { - - private String source; - - /** - * Constructor supporting all properties. - * - * @param source new value for the name. - * @param additionalProperties additional properties - * @param extendedProperties properties from the subtype. - * @param repositoryHelper helper methods - * @param serviceName name of this OMAS - * @param serverName name of local server - */ - public SoftwareServerCapabilityBuilder( - String source, - Map additionalProperties, - Map extendedProperties, - OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) { - super( QualifiedNameUtils.buildQualifiedName(null, IdMap.CAPABILITY_TYPE_NAME, source), - additionalProperties, IdMap.CAPABILITY_TYPE_GUID, - IdMap.CAPABILITY_TYPE_NAME, extendedProperties, InstanceStatus.ACTIVE, repositoryHelper, - serviceName, serverName); - - this.source = source; - } - - /** - * Return the supplied bean properties in an InstanceProperties object. - * - * @param methodName name of the calling method - * @return InstanceProperties object - * @throws InvalidParameterException there is a problem with the properties - */ - public InstanceProperties getInstanceProperties( - String methodName) throws InvalidParameterException { - InstanceProperties properties = super.getInstanceProperties(methodName); - - if (source != null) { - properties = repositoryHelper.addStringPropertyToInstance(serviceName, properties, - "source", source, methodName); - } - - return properties; - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/AnalyticsMetadataConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/AnalyticsMetadataConverter.java deleted file mode 100644 index 931de52141c..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/AnalyticsMetadataConverter.java +++ /dev/null @@ -1,181 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaAttribute; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsMetadata; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -public class AnalyticsMetadataConverter extends OpenMetadataAPIGenericConverter { - - public AnalyticsMetadataConverter(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) { - super(repositoryHelper, serviceName, serverName); - } - - /** - * Helper function for specific template class. - * - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - public AnalyticsMetadata getNewBean(EntityDetail entity, String methodName) throws PropertyServerException - { - return getNewBean(SchemaAttribute.class, entity, methodName); - } - - /** - * Using the supplied entity, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public AnalyticsMetadata getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - InstanceProperties instanceProperties = entity.getProperties(); - if (instanceProperties != null) { - String nativeClass = this.removeNativeClass(instanceProperties); - - if (nativeClass == null) { - throw new PropertyServerException( - AnalyticsModelingErrorCode.MISSING_BEAN_CLASS.getMessageDefinition(entity.getGUID()), - this.getClass().getSimpleName(), - methodName); - } - - Object object = null; - try { - Class c = Class.forName(nativeClass); - Constructor cons = c.getConstructor(); - object = cons.newInstance(); - - } catch (ClassNotFoundException // forName - | NoSuchMethodException | SecurityException // getConstructor - | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - throw new PropertyServerException( - AnalyticsModelingErrorCode.FAILED_CREATE_BEAN.getMessageDefinition(nativeClass), - this.getClass().getSimpleName(), - methodName); - } - - if (object instanceof AnalyticsMetadata) { - - AnalyticsMetadata bean = (AnalyticsMetadata) object; - - bean.setDisplayName(this.removeDisplayName(instanceProperties)); - bean.setDescription(this.removeDescription(instanceProperties)); - bean.setQualifiedName(this.removeQualifiedName(instanceProperties)); - bean.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); - bean.setElementPosition(this.getPosition(instanceProperties)); - - bean.setNativeJavaClass(bean.getClass().getName()); - - convertAnalyticsMetadataProperties(bean); - - return bean; - } - - throw new PropertyServerException( - AnalyticsModelingErrorCode.UNEXPECTED_CLASS.getMessageDefinition(object.getClass().getSimpleName(), entity.getGUID()), - this.getClass().getSimpleName(), - methodName); - } - - throw new PropertyServerException( - AnalyticsModelingErrorCode.MISSING_BEAN_PROPERTIES.getMessageDefinition(entity.getGUID()), - this.getClass().getSimpleName(), - methodName); - } - - /** - * Convert bean properties from additional properties to members. - * - * @param bean being processed. - */ - protected void convertAnalyticsMetadataProperties(AnalyticsMetadata bean) - { - Map properties = bean.getAdditionalProperties(); - - if (properties != null) { - if (properties.get(IdMap.SOURCE_ID) != null) { - bean.setSourceId(Arrays.asList(properties.get(IdMap.SOURCE_ID).split(Constants.SYNC_ID_LIST_DELIMITER))); - } - - if (properties.get(IdMap.SOURCE_GUID) != null) { - bean.setSourceGuid(Arrays.asList(properties.get(IdMap.SOURCE_GUID).split(Constants.SYNC_ID_LIST_DELIMITER))); - } - - bean.setType(properties.get(Constants.TYPE)); - bean.setIdentifier(properties.get(Constants.SYNC_IDENTIFIER)); - - if (bean instanceof MetadataItem) { - MetadataItem item = (MetadataItem)bean; - item.setExpression(properties.get(Constants.SYNC_EXPRESSION)); - item.setDataType(properties.get(Constants.SYNC_DATA_TYPE)); - } - } - } - - /** - * Helper function to preserve common properties as additional properties. - * - * @param bean being prepared. - */ - public static void prepareAnalyticsMetadataProperties(AnalyticsMetadata bean) { - - Map additionalProperties = bean.getAdditionalProperties(); - - if (additionalProperties == null) { - additionalProperties = new HashMap<>(); - bean.setAdditionalProperties(additionalProperties); - } - - if (bean.getSourceId() != null) { - additionalProperties.put(IdMap.SOURCE_ID, String.join(Constants.SYNC_ID_LIST_DELIMITER, bean.getSourceId())); - } - - if (bean.getSourceGuid() != null) { - additionalProperties.put(IdMap.SOURCE_GUID, String.join(Constants.SYNC_ID_LIST_DELIMITER, bean.getSourceGuid())); - } - - additionalProperties.put(Constants.TYPE, bean.getType()); - additionalProperties.put(Constants.SYNC_IDENTIFIER, bean.getIdentifier()); - - if (bean instanceof MetadataItem) { - MetadataItem item = (MetadataItem)bean; - additionalProperties.put(Constants.SYNC_EXPRESSION, item.getExpression()); - additionalProperties.put(Constants.SYNC_DATA_TYPE, item.getDataType()); - } - - bean.setAdditionalProperties(additionalProperties); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/AssetConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/AssetConverter.java deleted file mode 100644 index d044912957f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/AssetConverter.java +++ /dev/null @@ -1,80 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AssetReference; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -public class AssetConverter extends OpenMetadataAPIGenericConverter { - - private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); - - public AssetConverter(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) { - super(repositoryHelper, serviceName, serverName); - } - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public AnalyticsAsset getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - AnalyticsAsset bean = new AnalyticsAsset(); - InstanceProperties instanceProperties = entity.getProperties(); - bean.setGuid(entity.getGUID()); - if (instanceProperties != null) { - bean.setDisplayName(this.removeName(instanceProperties)); - bean.setDescription(this.removeDescription(instanceProperties)); - bean.setQualifiedName(this.removeQualifiedName(instanceProperties)); - Map props = this.removeAdditionalProperties(instanceProperties); - bean.setAdditionalProperties(props); - - if (props != null) { - bean.setUid(props.get(Constants.UID)); - bean.setType(props.get(Constants.TYPE)); - bean.setLocation(props.get(Constants.LOCATION)); - bean.setLastModified(props.get(Constants.LASTMODIFIED)); - String jsonReference = props.get(Constants.REFERENCE); - if (jsonReference != null && !jsonReference.isEmpty()) { - try { - bean.setReference(OBJECT_MAPPER - .readValue(jsonReference.getBytes(), new TypeReference>(){})); - } catch (IOException e) { - // log warning into execution context - } - } else { - bean.setReference(null); - } - } - } - - return bean; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/SchemaTypeConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/SchemaTypeConverter.java deleted file mode 100644 index a1409679ffd..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/SchemaTypeConverter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaType; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -public class SchemaTypeConverter extends OpenMetadataAPIGenericConverter { - - public SchemaTypeConverter(OMRSRepositoryHelper repositoryHelper, String serviceName, String serverName) { - super(repositoryHelper, serviceName, serverName); - } - - /** - * Using the supplied entity, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public SchemaType getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - SchemaType bean = new SchemaType(); - InstanceProperties instanceProperties = entity.getProperties(); - if (instanceProperties != null) { - bean.setDisplayName(this.removeDisplayName(instanceProperties)); - bean.setDescription(this.removeDescription(instanceProperties)); - bean.setQualifiedName(this.removeQualifiedName(instanceProperties)); - bean.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties)); - } - - return bean; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/SoftwareServerCapabilityConverter.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/SoftwareServerCapabilityConverter.java deleted file mode 100644 index e59b44e4d87..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/synchronization/converters/SoftwareServerCapabilityConverter.java +++ /dev/null @@ -1,87 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters; - - -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericConverter; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SoftwareCapability; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - - -/** - * CollectionConverter transfers the relevant properties from an Open Metadata Repository Services (OMRS) - * EntityDetail object into a Collection bean. - */ -public class SoftwareServerCapabilityConverter extends OpenMetadataAPIGenericConverter -{ - /** - * Constructor - * - * @param repositoryHelper helper object to parse entity/relationship objects - * @param serviceName name of this component - * @param serverName local server name - */ - public SoftwareServerCapabilityConverter(OMRSRepositoryHelper repositoryHelper, - String serviceName, - String serverName) - { - super(repositoryHelper, serviceName, serverName); - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public SoftwareCapability getNewBean(Class beanClass, - EntityDetail entity, - String methodName) throws PropertyServerException - { - if (entity == null) { - handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName); - } - - SoftwareCapability bean = new SoftwareCapability(); - InstanceProperties instanceProperties = entity.getProperties(); - if (instanceProperties != null) { - bean.setSource(this.removeSource(instanceProperties)); - bean.setQualifiedName(this.removeQualifiedName(instanceProperties)); - } - - bean.setGUID(entity.getGUID()); - - return bean; - } - - - /** - * Using the supplied instances, return a new instance of the bean. This is used for beans that - * contain a combination of the properties from an entity and that of a connected relationship. - * - * @param beanClass name of the class to create - * @param entity entity containing the properties - * @param relationship relationship containing the properties - * @param methodName calling method - * @return bean populated with properties from the instances supplied - * @throws PropertyServerException there is a problem instantiating the bean - */ - @Override - public SoftwareCapability getNewBean(Class beanClass, - EntityDetail entity, - Relationship relationship, - String methodName) throws PropertyServerException - { - return getNewBean(beanClass, entity, methodName); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/AnalyticsAssetUtils.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/AnalyticsAssetUtils.java deleted file mode 100644 index 6d0dd87a616..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/AnalyticsAssetUtils.java +++ /dev/null @@ -1,158 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.utils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AssetReference; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -/** - * Class provides useful operations with bean class - * {@link org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset}. - * - */ -public class AnalyticsAssetUtils { - - private static final ObjectWriter OBJECT_WRITER = new ObjectMapper().writer(); - - private AnalyticsAssetUtils() { - } - - /** - * Add container to the asset. - * @param asset to add new container to. - * @param container to add. - */ - public static void addContainer(AnalyticsAsset asset, MetadataContainer container) { - if (asset.getContainer() == null) { - asset.setContainer(new ArrayList<>()); - } - asset.getContainer().add(container); - } - - /** - * Remove container from asset at defined index. - * @param asset to remove container from. - * @param index to remove. - * @return removed container or null if requested container does not exists. - */ - public static MetadataContainer removeContainer(AnalyticsAsset asset, int index) { - if (asset.getContainer() != null && asset.getContainer().size() > index) { - return asset.getContainer().remove(index); - } - return null; - } - - /** - * get container from asset at defined index. - * @param asset to get container from. - * @param index to get. - * @return requested container or null if it does not exist. - */ - public static MetadataContainer getContainer(AnalyticsAsset asset, int index) { - if (asset.getContainer() != null && asset.getContainer().size() > index) { - return asset.getContainer().get(index); - } - return null; - } - - /** - * Add item to the asset. - * @param asset to add new item to. - * @param item to add. - */ - public static void addItem(AnalyticsAsset asset, MetadataItem item) { - if (asset.getItem() == null) { - asset.setItem(new ArrayList<>()); - } - asset.getItem().add(item); - } - - /** - * Add source GUID to the asset. - * @param asset to add new GUID to. - * @param guid to add. - */ - public static void addSourceGuid(AnalyticsAsset asset, String guid) { - if (asset.getSourceGuid() == null) { - asset.setSourceGuid(new ArrayList<>()); - } - asset.getSourceGuid().add(guid); - } - - /** - * Add reference to the asset. - * @param asset to add new reference to. - * @param reference to add. - */ - public static void addReference(AnalyticsAsset asset, AssetReference reference) { - if (asset.getReference() == null) { - asset.setReference(new ArrayList<>()); - } - asset.getReference().add(reference); - } - - /** - * Check if asset is visualization. - * @param asset to check. - * @return true if asset has any visualization. - */ - public static boolean isVisualization(AnalyticsAsset asset) { - return asset.getVisualization() != null; - } - - /** - * Check if asset is metadata module. - * @param asset to check. - * @return true if asset has any metadata element. - */ - public static boolean hasMetadataModule(AnalyticsAsset asset) { - return (asset.getContainer() != null && !asset.getContainer().isEmpty()) - || (asset.getItem() != null && !asset.getItem().isEmpty()); - } - - /** - * Build additional properties of the bean from asset content. - * @param asset provides property values. - * @return map of properties by name. - */ - public static Map buildAdditionalProperties(AnalyticsAsset asset) { - Map additionalProperties = new HashMap<>(); - additionalProperties.put(Constants.UID, asset.getUid()); - additionalProperties.put(Constants.TYPE, asset.getType()); - additionalProperties.put(Constants.LASTMODIFIED, asset.getLastModified()); - additionalProperties.put(Constants.LOCATION, asset.getLocation()); - - if (asset.getReference() != null ) { - try { - String references = OBJECT_WRITER.writeValueAsString(asset.getReference()); - additionalProperties.put(Constants.REFERENCE, references); - } catch (JsonProcessingException e) { - // log to execution context - } - } - return additionalProperties; - } - - /** - * Find reference to asset with GUID. - * @param asset owner of the reference. - * @param guid of the referenced asset to search. - * @return referencing asset or null. - */ - public static AssetReference getAssetReferenceByGuid(AnalyticsAsset asset, String guid) { - if (asset.getReference() == null) { - return null; - } - return asset.getReference().stream().filter(r->guid.equals(r.getGuid())).findFirst().orElse(null); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/Constants.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/Constants.java deleted file mode 100644 index 5ccf684d69e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/Constants.java +++ /dev/null @@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.utils; - -public class Constants { - - public static final Integer PAGE_SIZE = 100; - public static final Integer START_FROM = 0; - public static final String ADDITIONAL_PROPERTIES = "additionalProperties"; - public static final String ANALYTICS_MODELING_OMAS_NAME = "AnalyticsModelingOmas"; - public static final String ANALYTICS_MODELING_USER_ID = "AnalyticsModelingOmas"; - public static final String ASSET_SCHEMA_TYPE = "AssetSchemaType"; - public static final String ATTACHED_NOTE_LOG = "AttachedNoteLog"; - public static final String ATTRIBUTE_FOR_SCHEMA = "AttributeForSchema"; - public static final String ATTRIBUTE_NAME = "name"; - public static final String DATABASE = "Database"; - public static final String DATA_CONTENT_FOR_DATASET = "DataContentForDataSet"; - public static final String DATA_UNDERSCORE_TYPE = "data_type"; - public static final String DEPLOYED_DATABASE_SCHEMA = "DeployedDatabaseSchema"; - public static final String DISPLAY_NAME = "displayName"; - public static final String FOREIGN_KEY = "ForeignKey"; - public static final String GUID = "guid"; - public static final String IS_NULLABLE = "isNullable"; - public static final String LASTMODIFIED = "lastModified"; - public static final String LENGTH = "length"; - public static final String LOCATION = "location"; - public static final String NAME = "name"; - public static final String NESTED_SCHEMA_ATTRIBUTE = "NestedSchemaAttribute"; - public static final String NOTE_LOG = "NoteLog"; - public static final String ODBC_TYPE = "odbc_type"; - public static final String OWNER_TYPE = "ownerType"; - public static final String PARAM_NAME_ASSET_GUID = "assetGUID"; - public static final String PARAM_NAME_PARENT_GUID = "parentGUID"; - public static final String PATCH_LEVEL = "patchLevel"; - public static final String POSITION = "position"; - public static final String PRIMARY_KEY = "PrimaryKey"; - public static final String QUALIFIED_NAME = "qualifiedName"; - public static final String REFERENCE = "reference"; - public static final String RELATIONAL_COLUMN = "RelationalColumn"; - public static final String RELATIONAL_COLUMN_TYPE = "RelationalColumnType"; - public static final String RELATIONAL_DB_SCHEMA_TYPE = "RelationalDBSchemaType"; - public static final String RELATIONAL_TABLE = "RelationalTable"; - public static final String SCHEMA_ASSET = "SchemaAsset"; - public static final String SOURCE = "source"; - public static final String SYNC_DATA_TYPE = "datatype"; - public static final String SYNC_DESCRIPTION = "description"; - public static final String SYNC_EXPRESSION = "expression"; - public static final String SYNC_IDENTIFIER = "identifier"; - public static final String SYNC_ID_LIST_DELIMITER = "\t"; - public static final String SYNC_NATIVE_CLASS = "nativeClass"; - public static final String TYPE = "type"; - public static final String TYPE_SUFFIX = "_type"; - public static final String UID = "uid"; - public static final String USER_ID = "userId"; - public static final String VERSION = "version"; - public static final String ZONE_MEMBERSHIP = "zoneMembership"; -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/ExecutionContext.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/ExecutionContext.java deleted file mode 100644 index 1956f998266..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/ExecutionContext.java +++ /dev/null @@ -1,295 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.utils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.response.Messages; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.SoftwareServerCapabilityHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.SoftwareServerCapabilityConverter; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SoftwareCapability; -import org.odpi.openmetadata.metadatasecurity.server.OpenMetadataServerSecurityVerifier; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; - -/** - * Context container class to hold all parts involved in execution. - * It makes code cleaner to pass less parameters where they needed. - */ -public class ExecutionContext { - private String userId; - private String serviceName; - private String serverName; - private InvalidParameterHandler invalidParameterHandler; - private RepositoryHandler repositoryHandler; - private OMRSRepositoryHelper repositoryHelper; - private String localServerUserId; - private OpenMetadataServerSecurityVerifier securityVerifier; - private List supportedZones; - private List defaultZones; - private List publishZones; - private AuditLog auditLog; - - private SoftwareServerCapabilityHandler softwareServerCapabilityHandler; - private SoftwareCapability softwareServerCapability; - - private Messages messages = new Messages(); - private List tablesWithoutColumns = new ArrayList<>(); - private Map> tableColumnsIgnored = new TreeMap<>(); - - - public ExecutionContext( - String serviceName, - String serverName, - InvalidParameterHandler invalidParameterHandler, - RepositoryHandler repositoryHandler, - OMRSRepositoryHelper repositoryHelper, - String localServerUserId, - OpenMetadataServerSecurityVerifier securityVerifier, - List supportedZones, - List defaultZones, - List publishZones, - AuditLog auditLog) - { - this.serviceName = serviceName; - this.serverName = serverName; - this.invalidParameterHandler = invalidParameterHandler; - this.repositoryHandler = repositoryHandler; - this.repositoryHelper = repositoryHelper; - this.localServerUserId = localServerUserId; - this.securityVerifier = securityVerifier; - this.supportedZones = supportedZones; - this.defaultZones = defaultZones; - this.publishZones = publishZones; - this.auditLog = auditLog; - } - - public void initialize(String userId) - { - messages = new Messages(); - this.userId = userId; - } - - /** - * Get software server capability by GUID, name, or create. - * @param userId of the request. - * @param softwareServerCapabilityName to get. - * @param softwareServerCapabilityGUID to get. - * @throws AnalyticsModelingCheckedException in case of an errors. - */ - public void initializeSoftwareServerCapability(String userId, String softwareServerCapabilityName, String softwareServerCapabilityGUID) - throws AnalyticsModelingCheckedException - { - - String methodName = "InitializeExecutionContext"; - - initialize(userId); - - softwareServerCapabilityHandler = new SoftwareServerCapabilityHandler( - new SoftwareServerCapabilityConverter(repositoryHelper, serviceName, serverName), - serviceName, serverName, invalidParameterHandler, repositoryHandler, repositoryHelper, - localServerUserId, securityVerifier, supportedZones, defaultZones, publishZones, auditLog); - - // first try to use GUID - try { - if (softwareServerCapabilityGUID != null) { - softwareServerCapability = softwareServerCapabilityHandler - .getSoftwareServerCapability(userId, softwareServerCapabilityGUID, "guid", methodName); - } - } catch (InvalidParameterException | PropertyServerException | UserNotAuthorizedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_GET_SERVER_CAPABILITY_GUID.getMessageDefinition(userId, - softwareServerCapabilityName, ex.getLocalizedMessage()), - this.getClass().getSimpleName(), - methodName, - ex); - } - - try { - if (softwareServerCapability == null) { - softwareServerCapability = softwareServerCapabilityHandler - .findSoftwareServerCapability(userId, softwareServerCapabilityName, methodName); - } - } catch (InvalidParameterException | PropertyServerException | UserNotAuthorizedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_GET_SERVER_CAPABILITY_NAME.getMessageDefinition(userId, - softwareServerCapabilityName, ex.getLocalizedMessage()), - this.getClass().getSimpleName(), - methodName, - ex); - } - - try { - if (softwareServerCapability == null) { - String guid = softwareServerCapabilityHandler.createSoftwareServerCapability(userId, softwareServerCapabilityName, methodName); - softwareServerCapability = softwareServerCapabilityHandler.getSoftwareServerCapability(userId, guid, "guid", methodName); - } - - } catch (InvalidParameterException | PropertyServerException | UserNotAuthorizedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.FAILED_CREATE_SERVER_CAPABILITY.getMessageDefinition(userId, - softwareServerCapabilityName, ex.getLocalizedMessage()), - this.getClass().getSimpleName(), - methodName, - ex); - } - } - - - public SoftwareCapability getServerSoftwareCapability() { - return softwareServerCapability; - } - - public SoftwareServerCapabilityHandler getServerSoftwareCapabilityHandler() { - return softwareServerCapabilityHandler; - } - - /** - * @return the userId - */ - public String getUserId() { - return userId; - } - /** - * Set the userId. - * @param value to set. - */ - public void setUserId(String value) { - userId = value; - } - /** - * Get service name. - * @return the serviceName - */ - public String getServiceName() { - return serviceName; - } - /** - * Get server name. - * @return the serverName - */ - public String getServerName() { - return serverName; - } - /** - * Get invalid parameter handler. - * @return the invalidParameterHandler - */ - public InvalidParameterHandler getInvalidParameterHandler() { - return invalidParameterHandler; - } - /** - * Get repository handler. - * @return the repositoryHandler - */ - public RepositoryHandler getRepositoryHandler() { - return repositoryHandler; - } - /** - * Get repository helper. - * @return the repositoryHelper - */ - public OMRSRepositoryHelper getRepositoryHelper() { - return repositoryHelper; - } - /** - * @return the localServerUserId - */ - public String getLocalServerUserId() { - return localServerUserId; - } - /** - * @return the securityVerifier - */ - public OpenMetadataServerSecurityVerifier getSecurityVerifier() { - return securityVerifier; - } - /** - * @return the supportedZones - */ - public List getSupportedZones() { - return supportedZones; - } - /** - * @return the defaultZones - */ - public List getDefaultZones() { - return defaultZones; - } - /** - * @return the publishZones - */ - public List getPublishZones() { - return publishZones; - } - /** - * @return the auditLog - */ - public AuditLog getAuditLog() { - return auditLog; - } - - /** - * Helper function to get string property from property collection of the entity. - * @param propName property name to retrieve. - * @param properties collection. - * @param methodName requested the operation. - * @return property value. - */ - public String getStringProperty(String propName, InstanceProperties properties, String methodName) - { - return repositoryHelper.getStringProperty(serviceName, propName, properties, methodName); - } - - public synchronized void addTableWithoutColumns(String name) { - tablesWithoutColumns.add(name); - } - - public synchronized void addIgnoredTableColumn(String nameTable, String nameColumn) { - List columns = tableColumnsIgnored.get(nameTable); - if (columns == null) { - columns = new ArrayList<>(); - tableColumnsIgnored.put(nameTable, columns); - } - columns.add(nameColumn); - } - - public Messages getMessages() { - - if (!tablesWithoutColumns.isEmpty()) { - ExceptionMessageDefinition def; - if (tablesWithoutColumns.size() == 1) { - def = AnalyticsModelingErrorCode.WARNING_TABLE_NO_COLUMNS.getMessageDefinition(tablesWithoutColumns.get(0)); - } else { - tablesWithoutColumns.sort(null); // sort by names helps to find table in question and preserves order. - def = AnalyticsModelingErrorCode.WARNING_TABLES_NO_COLUMNS.getMessageDefinition(String.join(", ", tablesWithoutColumns)); - } - messages.addWarning(def); - tablesWithoutColumns.clear(); - } - - return (messages.getMessages() == null || messages.getMessages().isEmpty()) ? null : messages; - } - - public void addMessage(ExceptionMessageDefinition message, String detail) { - messages.addWarning(message, detail); - } - - public void addMessage(ExceptionMessageDefinition message) { - messages.addWarning(message); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/QualifiedNameUtils.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/QualifiedNameUtils.java deleted file mode 100644 index 91b27c16936..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/utils/QualifiedNameUtils.java +++ /dev/null @@ -1,66 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.utils; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; - -public class QualifiedNameUtils { - - public static final String SEPARATOR = "::"; - public static final String EQUALS = "="; - public static final String OPEN_BRACKET = "("; - public static final String CLOSE_BRACKET = ")"; - - private static final String ID_SEPARATOR_REGEX = escapeQualifiedNameRegExPattern( - new StringBuilder() - .append(SEPARATOR) - .append(OPEN_BRACKET) - .append(IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME) - .append(CLOSE_BRACKET) - .append(EQUALS) - .toString() - ); - - public static String buildQualifiedName(String parentQualifiedName, String typeName, String value) { - StringBuilder sb = new StringBuilder(); - sb.append((parentQualifiedName == null || parentQualifiedName.isEmpty()) ? "" : (parentQualifiedName + SEPARATOR)) - .append(OPEN_BRACKET) - .append(typeName) - .append(CLOSE_BRACKET) - .append(EQUALS) - .append(value); - - return sb.toString(); - } - - - /** - * Extract identifiers from qualified name. - * @param qualifiedName like "(SoftwareCapability)=xxx::(Asset)=yyy::(SchemaAttribute)=NAME1::(SchemaAttribute)=NAME2" - * @return stack of identifiers. - */ - public static List extractIdentifiersFromQualifiedName(String qualifiedName) { - - if (qualifiedName == null || qualifiedName.isEmpty()) { - return Collections.emptyList(); // throw exception ? - } - - return Arrays.stream(qualifiedName.split(ID_SEPARATOR_REGEX)) - .skip(1).collect(Collectors.toList()); - } - - /** - * Escape meta characters in qualifies name. - * @param input with qualified name. - * @return escaped regex. - */ - public static String escapeQualifiedNameRegExPattern(String input) { - return input.replace("(", "\\(").replace(")", "\\)"); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/DatabaseContextHandlerTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/DatabaseContextHandlerTest.java deleted file mode 100644 index 25781a4eb3e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/DatabaseContextHandlerTest.java +++ /dev/null @@ -1,439 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.expectThrows; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.assets.DatabaseContextHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager.OMEntityDao; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.DatabaseConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.EmptyConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.converter.SchemaConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Database; -import org.odpi.openmetadata.accessservices.analyticsmodeling.metadata.Schema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.module.Table; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; -import org.odpi.openmetadata.commonservices.generichandlers.RelationalDataHandler; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryErrorHandler; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -public class DatabaseContextHandlerTest extends InMemoryRepositoryTest { - - private static final String TBL_LOCATION = "Location"; - private static final String TBL_DATE = "Date"; - private static final String DATABASE_ADVENTURE_WORKS = "AdventureWorks"; - private static final String DATABASE_GOSALES = "GOSALES"; - private static final String DATA_TYPE_DECIMAL = "DECIMAL"; - private static final String DATA_TYPE_INTEGER = "INTEGER"; - private static final String DATA_TYPE_VARCHAR = "VARCHAR"; - private static final String PRIMARY_KEY_PREFIX = "PK"; - private static final String SCHEMA_DBO = "dbo"; - private static final String SERVER_TYPE_MS_SQL = "MS SQL"; - private static final String VENDOR_TYPE_INT32 = "INT32"; - private static final String VENDOR_TYPE_STRING = "STRING"; - private static final Integer FROM_INDEX = 0; - private static final Integer PAGE_SIZE = 20; - - private DatabaseContextHandler databaseContextHandler; - private InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - - @BeforeMethod - public void setup() throws Exception { - super.setup(); - OMEntityDao omEntityDaoReal = new OMEntityDao(enterpriseConnector, Collections.emptyList(), auditLog); - String serviceName = "serviceName"; - String serverName = "serverName"; - - RepositoryHandler repositoryHandler = new RepositoryHandler(auditLog, - omrsRepositoryHelper, - new RepositoryErrorHandler(omrsRepositoryHelper, serviceName, serverName, auditLog), - metadataCollection, - PAGE_SIZE); - - RelationalDataHandler relationalDataHandler = - new RelationalDataHandler<>( - new DatabaseConverter(omrsRepositoryHelper, serviceName,serverName), - Database.class, - new SchemaConverter(omrsRepositoryHelper, serviceName,serverName), - Schema.class, - new EmptyConverter(omrsRepositoryHelper, serviceName,serverName), - Object.class, - new EmptyConverter(omrsRepositoryHelper, serviceName,serverName), - Object.class, - new EmptyConverter(omrsRepositoryHelper, serviceName,serverName), - Object.class, - new EmptyConverter(omrsRepositoryHelper, serviceName,serverName), - Object.class, - serviceName, - serverName, - invalidParameterHandler, - repositoryHandler, - omrsRepositoryHelper, - "localServerUserId", - null, // securityVerifier, - null, // supportedZones, - null, // defaultZones, - null, // publishZones, - auditLog); - - ExecutionContext ctx = new ExecutionContext( - serviceName, - serverName, - invalidParameterHandler, - repositoryHandler, - enterpriseConnector.getRepositoryHelper(), - LOCAL_SERVER_USER_ID, - null, // securityVerifier, - null, // supportedZones, - null, // defaultZones, - null, // publishZones, - auditLog); - - - databaseContextHandler = new DatabaseContextHandler(relationalDataHandler, omEntityDaoReal, ctx); - } - - @Test - public void getDatabases() throws AnalyticsModelingCheckedException, UserNotAuthorizedException { - // setup repository - createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - createDatabaseEntity(DATABASE_ADVENTURE_WORKS, SERVER_TYPE_MS_SQL, "2.0"); - - // test - List databases = databaseContextHandler.getDatabases(USER_ID, FROM_INDEX, PAGE_SIZE); - assertNotNull(databases); - assertTrue(databases.size() == 2, "Failed retrieve databases."); - - ResponseContainerDatabase gs = databases.stream().filter(ds -> DATABASE_GOSALES.equals(ds.getDbName())) - .findFirst().orElse(null); - assertNotNull(gs); - assertNotNull(gs.getGUID()); - assertEquals(SERVER_TYPE_MS_SQL, gs.getDbType()); - assertEquals("1.0", gs.getDbVersion()); - } - - @Test - public void getDatabasesPage() throws AnalyticsModelingCheckedException, UserNotAuthorizedException { - // setup repository with four databases sorted: AdventureWorks, DB_3, DB_4, DB_5, GOSALES - createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - createDatabaseEntity(DATABASE_ADVENTURE_WORKS, SERVER_TYPE_MS_SQL, "2.0"); - createDatabaseEntity("DB_3", SERVER_TYPE_MS_SQL, "1.0"); - createDatabaseEntity("DB_4", SERVER_TYPE_MS_SQL, "2.0"); - createDatabaseEntity("DB_5", SERVER_TYPE_MS_SQL, "2.0"); - - List page1 = databaseContextHandler.getDatabases(USER_ID, 0, 2); - assertNotNull(page1); - assertTrue(page1.size() == 2, "Failed retrieve databases first page 1."); - List page2 = databaseContextHandler.getDatabases(USER_ID, 2, 2); - assertNotNull(page2); - assertTrue(page2.size() == 2, "Failed retrieve databases internal page 2."); - List page3 = databaseContextHandler.getDatabases(USER_ID, 4, 2); - assertNotNull(page3); - assertTrue(page3.size() == 1, "Failed retrieve databases last not full page 3."); - - page1.addAll(page2); - page1.addAll(page3); - - assertEquals(String.join(";", page1.stream().map(ResponseContainerDatabase::getDbName).sorted().collect(Collectors.toList())), - "AdventureWorks;DB_3;DB_4;DB_5;GOSALES", - "All five databases should be fetched"); - } - - @Test - public void getDatabasesEmptyRepository() throws AnalyticsModelingCheckedException, UserNotAuthorizedException { - List databases = databaseContextHandler.getDatabases(USER_ID, FROM_INDEX, PAGE_SIZE); - assertTrue(databases.size() == 0, "Database list expected to be empty."); - } - - @Test - public void getDatabaseSchemasWithEmptyCatalog() - throws AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - String guidDataSource = entityDB.getGUID(); - // test - List schemas = databaseContextHandler - .getDatabaseSchemas(USER_ID, guidDataSource, FROM_INDEX, PAGE_SIZE); - assertTrue(schemas.isEmpty(), "Schemas list expected to be empty."); - - } - - @Test - public void getDatabaseSchemas() throws AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - String guidDataSource = entityDB.getGUID(); - createDatabaseSchemaEntity(guidDataSource, SCHEMA_DBO); - createDatabaseSchemaEntity(guidDataSource, "sys"); - - List schemas = databaseContextHandler - .getDatabaseSchemas(USER_ID, guidDataSource,FROM_INDEX, PAGE_SIZE); - assertNotNull(schemas); - assertTrue(schemas.size() == 2, "Failed to retrieve database schemas."); - - ResponseContainerDatabaseSchema schema = schemas.stream().filter(s -> SCHEMA_DBO.equals(s.getSchema())) - .findFirst().orElse(null); - assertNotNull(schema); - assertEquals(DATABASE_GOSALES, schema.getCatalog()); - assertEquals("user", schema.getSchemaType()); - } - - @Test - public void getDatabaseSchemasPage() throws AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException { - // setup repository with four schemas sorted: dbo, s1, s2, s3, sys - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - String guidDataSource = entityDB.getGUID(); - createDatabaseSchemaEntity(guidDataSource, SCHEMA_DBO); - createDatabaseSchemaEntity(guidDataSource, "s1"); - createDatabaseSchemaEntity(guidDataSource, "s2"); - createDatabaseSchemaEntity(guidDataSource, "s3"); - createDatabaseSchemaEntity(guidDataSource, "sys"); - - List schemas = databaseContextHandler - .getDatabaseSchemas(USER_ID, guidDataSource, 0, 2); - assertNotNull(schemas); - assertTrue(schemas.size() == 2, "Failed to retrieve database schemas first page."); - - List schemas2 = databaseContextHandler - .getDatabaseSchemas(USER_ID, guidDataSource, 2, 2); - assertNotNull(schemas2); - assertTrue(schemas2.size() == 2, "Failed to retrieve database schemas full page."); - - List schemas3 = databaseContextHandler - .getDatabaseSchemas(USER_ID, guidDataSource, 4, 2); - assertNotNull(schemas3); - assertTrue(schemas3.size() == 1, "Failed to retrieve database schemas last incomplete page."); - - schemas.addAll(schemas2); - schemas.addAll(schemas3); - - assertEquals(String.join(";", schemas.stream().map(ResponseContainerDatabaseSchema::getSchema).sorted().collect(Collectors.toList())), - "dbo;s1;s2;s3;sys", - "All five schemas should be fetched"); - } - - @Test - public void getDatabaseSchemasSameNameForTwoCatalogs() - throws AnalyticsModelingCheckedException, InvalidParameterException, UserNotAuthorizedException { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - createDatabaseSchemaEntity(entityDB.getGUID(), SCHEMA_DBO); - entityDB = createDatabaseEntity(DATABASE_ADVENTURE_WORKS, SERVER_TYPE_MS_SQL, "1.0"); - createDatabaseSchemaEntity(entityDB.getGUID(), SCHEMA_DBO); - - List schemas = databaseContextHandler - .getDatabaseSchemas(USER_ID, entityDB.getGUID(),FROM_INDEX, PAGE_SIZE); - assertNotNull(schemas); - assertTrue(schemas.size() == 1, "Failed to retrieve database schema."); - assertEquals(DATABASE_ADVENTURE_WORKS, schemas.get(0).getCatalog()); - } - - @Test - public void getSchemaTablesForEmptySchema() throws AnalyticsModelingCheckedException, InvalidParameterException { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - createDatabaseSchemaEntity(entityDB.getGUID(), SCHEMA_DBO); - - ResponseContainerSchemaTables tables = databaseContextHandler.getSchemaTables(USER_ID, entityDB.getGUID(), SCHEMA_DBO); - assertTrue(tables.getTablesList().isEmpty(), "Table list expected to be empty."); - } - - @Test - public void getSchemaTablesForUnknownSchema() { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - String schemaName = "NonExistingSchemaName"; - - AnalyticsModelingCheckedException thrown = expectThrows(AnalyticsModelingCheckedException.class, - () -> databaseContextHandler.getSchemaTables(USER_ID, entityDB.getGUID(), schemaName)); - - assertEquals(AnalyticsModelingErrorCode.SCHEMA_UNKNOWN.getMessageDefinition().getMessageId(), - thrown.getReportedErrorMessageId(), "Message Id is not correct"); - - assertTrue(thrown.getMessage().contains(schemaName), "Failed schema name should be in the message."); - } - - @Test - public void getSchemaTables() throws AnalyticsModelingCheckedException, InvalidParameterException { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - EntityDetail entitySchema = createDatabaseSchemaEntity(entityDB.getGUID(), SCHEMA_DBO); - createSchemaTable(entitySchema, "A"); - createSchemaTable(entitySchema, "B"); - - ResponseContainerSchemaTables tableResponse = databaseContextHandler.getSchemaTables(USER_ID, entityDB.getGUID(), - SCHEMA_DBO); - assertNotNull(tableResponse); - List tables = tableResponse.getTablesList(); - - assertTrue(tables.size() == 2, "Failed to retrieve tables."); - Collections.sort(tables); - assertEquals("A,B", String.join(",", tables), "All table names are correct."); - } - - @Test - public void getModule() throws Exception { - // setup repository - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - EntityDetail entitySchema = createDatabaseSchemaEntity(entityDB.getGUID(), SCHEMA_DBO); - addGlossaryTerm(entitySchema, "Go Sales", null, null); - - EntityDetail entityTableDate = createSchemaTable(entitySchema, TBL_DATE); - EntityDetail pkDate = addColumn(entityTableDate, "DateKey", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - setColumnPrimaryKey(pkDate, buildKey(PRIMARY_KEY_PREFIX, TBL_DATE, "DateKey")); - addColumn(entityTableDate, TBL_DATE, "TIMESTAMP", "DATETIME"); - - addGlossaryTerm(entityTableDate, "Calendar", null, null); - addGlossaryTerm(pkDate, "Date Key", "Primary key for Date used in sales orders.", "Primary key for Date."); - - // table "Location" has combined primary key with two fields - EntityDetail entityTableLocation = createSchemaTable(entitySchema, TBL_LOCATION); - EntityDetail pkLatitude = addColumn(entityTableLocation, "Latitude", DATA_TYPE_DECIMAL, DATA_TYPE_DECIMAL); - setColumnPrimaryKey(pkLatitude, buildKey(PRIMARY_KEY_PREFIX, TBL_LOCATION, "Latitude", "Longitude")); - EntityDetail pkLongitude = addColumn(entityTableLocation, "Longitude", DATA_TYPE_DECIMAL, DATA_TYPE_DECIMAL); - setColumnPrimaryKey(pkLongitude, buildKey(PRIMARY_KEY_PREFIX, TBL_LOCATION, "Latitude", "Longitude")); - addColumn(entityTableLocation, "Destination", DATA_TYPE_VARCHAR, VENDOR_TYPE_STRING); - - EntityDetail entityTableA = createSchemaTable(entitySchema, "Product"); - EntityDetail pkProduct = addColumn(entityTableA, "ProductId", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - setColumnPrimaryKey(pkProduct, buildKey(PRIMARY_KEY_PREFIX, "Product", "ProductId")); - addColumn(entityTableA, "ProductName", DATA_TYPE_VARCHAR, VENDOR_TYPE_STRING); - EntityDetail columnEntity = addColumn(entityTableA, "ProductDescription", DATA_TYPE_VARCHAR, - VENDOR_TYPE_STRING); - - setColumnProperty(columnEntity, Constants.IS_NULLABLE, Boolean.TRUE); // only test of nullable field - - columnEntity = addColumn(entityTableA, "ProductIntroductionDate", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - defineColumnForeignKey(columnEntity, pkDate); - columnEntity = addColumn(entityTableA, "ProductTerminationDate", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - defineColumnForeignKey(columnEntity, pkDate); - - // fact table tests multiple foreign keys - EntityDetail entityTableSales = createSchemaTable(entitySchema, "Sales"); - columnEntity = addColumn(entityTableSales, "ProductId", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - defineColumnForeignKey(columnEntity, pkProduct); - columnEntity = addColumn(entityTableSales, "DateKey", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - defineColumnForeignKey(columnEntity, pkDate); - addColumn(entityTableSales, "Quantity", DATA_TYPE_INTEGER, VENDOR_TYPE_INT32); - - columnEntity = addColumn(entityTableSales, "Price", DATA_TYPE_DECIMAL, DATA_TYPE_DECIMAL); - setColumnNoteLogProperty(columnEntity, Constants.LENGTH, "19"); - - columnEntity = addColumn(entityTableSales, "Discount", DATA_TYPE_DECIMAL, DATA_TYPE_DECIMAL); - setColumnNoteLogProperty(columnEntity, Constants.LENGTH, "19"); - - columnEntity = addColumn(entityTableSales, "ShipmentDestinationLatitude", DATA_TYPE_DECIMAL, DATA_TYPE_DECIMAL); - defineColumnForeignKey(columnEntity, pkLatitude); - columnEntity = addColumn(entityTableSales, "ShipmentDestinationLongitude", DATA_TYPE_DECIMAL, - DATA_TYPE_DECIMAL); - defineColumnForeignKey(columnEntity, pkLongitude); - - // testing is done here - ResponseContainerModule moduleResponse = databaseContextHandler.getModule(USER_ID, entityDB.getGUID(), DATABASE_GOSALES, - SCHEMA_DBO, null); - - // assert result - assertNotNull(moduleResponse); - List
tables = moduleResponse.getPhysicalModule().getDataSource().get(0).getTable(); - - assertEquals(tables.size(), 4, "Failed to retrieve tables."); - - String module = TestUtilities.readJsonFile("/src/test/resources/", "getModule"); - TestUtilities.validateGUIDs(moduleResponse); - TestUtilities.assertObjectJson(moduleResponse, module); - - // test table filter include - ModuleTableFilter filter = new ModuleTableFilter(); - filter.getMeta().setIncludedTables(Arrays.asList(TBL_DATE, TBL_LOCATION)); - moduleResponse = databaseContextHandler.getModule(USER_ID, entityDB.getGUID(), DATABASE_GOSALES, SCHEMA_DBO, filter); - assertNotNull(moduleResponse); - tables = moduleResponse.getPhysicalModule().getDataSource().get(0).getTable(); - assertEquals(tables.size(), 2, "Two tables should pass the filter."); - - // test table filter exclude - filter = new ModuleTableFilter(); - filter.getMeta().setExcludedTables(Arrays.asList(TBL_DATE)); - moduleResponse = databaseContextHandler.getModule(USER_ID, entityDB.getGUID(), DATABASE_GOSALES, SCHEMA_DBO, filter); - assertNotNull(moduleResponse); - tables = moduleResponse.getPhysicalModule().getDataSource().get(0).getTable(); - assertEquals(tables.size(), 3, "Three tables should pass the filter."); -} - - @Test - public void getModuleFailure_BadDataSourceGuid() { - - String badGuid = "BadGuid"; - AnalyticsModelingCheckedException thrown = expectThrows(AnalyticsModelingCheckedException.class, - () -> databaseContextHandler.getModule(USER_ID, badGuid, DATABASE_GOSALES, SCHEMA_DBO, null)); - assertEquals(AnalyticsModelingErrorCode.GET_ENTITY_EXCEPTION.getMessageDefinition(Constants.GUID, badGuid).getMessageId(), - thrown.getReportedErrorMessageId(), "Message Id is not correct"); - - assertTrue(thrown.getMessage().contains(badGuid), "GUID should be in the message."); - } - - @Test - public void getModuleFailure_UnknownSchemaName() { - - EntityDetail entityDB = createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - - String badSchema = "schemaUnknown"; - AnalyticsModelingCheckedException thrown = expectThrows(AnalyticsModelingCheckedException.class, - () -> databaseContextHandler.getModule(USER_ID, entityDB.getGUID(), DATABASE_GOSALES, badSchema, null)); - - assertEquals(AnalyticsModelingErrorCode.SCHEMA_UNKNOWN.getMessageDefinition().getMessageId(), - thrown.getReportedErrorMessageId(), "Message Id is not correct"); - - assertTrue(thrown.getMessage().contains(badSchema), "Failed schema name should be in the message."); - } - - @Test - public void getDatabaseSchemasInvalidParameter() { - - InvalidParameterException thrown = expectThrows(InvalidParameterException.class, - () -> databaseContextHandler.getDatabaseSchemas(USER_ID, null, FROM_INDEX, PAGE_SIZE)); - assertEquals(thrown.getParameterName(), DatabaseContextHandler.DATA_SOURCE_GUID, "Incorrect parameter name."); - } - - @Test - public void getSchemaTablesInvalidParameter() { - - InvalidParameterException thrown = expectThrows(InvalidParameterException.class, - () -> databaseContextHandler.getSchemaTables(USER_ID, null, SCHEMA_DBO)); - assertEquals(thrown.getParameterName(), DatabaseContextHandler.DATA_SOURCE_GUID, "Incorrect parameter name."); - } - - @Test - public void getModuleInvalidParameter() { - - InvalidParameterException thrown = expectThrows(InvalidParameterException.class, - () -> databaseContextHandler.getModule(USER_ID, null, DATABASE_GOSALES, SCHEMA_DBO, null)); - assertEquals(thrown.getParameterName(), DatabaseContextHandler.DATA_SOURCE_GUID, "Incorrect parameter name."); - } - - private String buildKey(String... param) { - return String.join("_", param); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/InMemoryRepositoryTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/InMemoryRepositoryTest.java deleted file mode 100644 index 76ec2eaff65..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/InMemoryRepositoryTest.java +++ /dev/null @@ -1,375 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test; - -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.EntityPropertiesBuilder; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.contentmanager.OMEntityDaoForTests; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.QualifiedNameUtils; -import org.odpi.openmetadata.adapters.repositoryservices.inmemory.repositoryconnector.InMemoryOMRSRepositoryConnectorProvider; -import org.odpi.openmetadata.adminservices.configuration.properties.OpenMetadataExchangeRule; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryErrorHandler; -import org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler; -import org.odpi.openmetadata.frameworks.connectors.Connector; -import org.odpi.openmetadata.frameworks.connectors.ConnectorBroker; -import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectionCheckedException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.ConnectorCheckedException; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.Connection; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.ConnectorType; -import org.odpi.openmetadata.repositoryservices.archivemanager.OMRSArchiveManager; -import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLog; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryConnector; -import org.odpi.openmetadata.repositoryservices.eventmanagement.OMRSRepositoryEventExchangeRule; -import org.odpi.openmetadata.repositoryservices.eventmanagement.OMRSRepositoryEventManager; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.OMRSCheckedExceptionBase; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.StatusNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.localrepository.repositoryconnector.LocalOMRSConnectorProvider; -import org.odpi.openmetadata.repositoryservices.localrepository.repositoryconnector.LocalOMRSRepositoryConnector; -import org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentHelper; -import org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentManager; -import org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentValidator; - -import java.util.Collections; -import java.util.List; - -import static org.mockito.Mockito.when; -import static org.testng.Assert.fail; - -public class InMemoryRepositoryTest { - - protected static final String USER_ID = "userId"; - protected static final String LOCAL_SERVER_USER_ID = "localServerUserId"; - protected static final String serviceName = "serviceName"; - protected static final String serverName = "serverName"; - protected static final Integer PAGE_SIZE = 20; - - - - @Mock - protected OMRSRepositoryConnector enterpriseConnector; - protected OMRSRepositoryContentHelper omrsRepositoryHelper; - @Mock - protected OMRSAuditLog auditLog; - private OMRSRepositoryContentManager localRepositoryContentManager = null; - protected OMEntityDaoForTests omEntityDao; - - protected RepositoryHandler repositoryHandler; - protected OMRSMetadataCollection metadataCollection; - protected InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - - final private String context = "Analytics Modeling OMAS test"; - - public void setup() throws Exception { - MockitoAnnotations.openMocks(this); - omEntityDao = new OMEntityDaoForTests(enterpriseConnector, Collections.emptyList(), auditLog); - omEntityDao.setContext("JUnitTest"); - - OMRSRepositoryConnector repositoryConnector = initializeInMemoryRepositoryConnector(); - - metadataCollection = repositoryConnector.getMetadataCollection(); - - repositoryHandler = new RepositoryHandler(auditLog, - omrsRepositoryHelper, - new RepositoryErrorHandler(omrsRepositoryHelper, serviceName, serverName, auditLog), - metadataCollection, - PAGE_SIZE); - - when(enterpriseConnector.getMetadataCollection()).thenReturn(repositoryConnector.getMetadataCollection()); - when(enterpriseConnector.getRepositoryHelper()).thenReturn(repositoryConnector.getRepositoryHelper()); - - } - - - private OMRSRepositoryConnector initializeInMemoryRepositoryConnector() throws ConnectorCheckedException, - ConnectionCheckedException { - - Connection connection = new Connection(); - ConnectorType connectorType = new ConnectorType(); - connection.setConnectorType(connectorType); - connectorType.setConnectorProviderClassName(InMemoryOMRSRepositoryConnectorProvider.class.getName()); - ConnectorBroker connectorBroker = new ConnectorBroker(); - Connector connector = connectorBroker.getConnector(connection); - OMRSRepositoryConnector repositoryConnector = (OMRSRepositoryConnector) connector; - - localRepositoryContentManager = new OMRSRepositoryContentManager(USER_ID, auditLog); - omrsRepositoryHelper = new OMRSRepositoryContentHelper(localRepositoryContentManager); - - - OMRSRepositoryEventManager localRepositoryEventManager = new OMRSRepositoryEventManager("local repository outbound", - new OMRSRepositoryEventExchangeRule(OpenMetadataExchangeRule.ALL, null), - new OMRSRepositoryContentValidator(localRepositoryContentManager), - auditLog); - - LocalOMRSRepositoryConnector localOMRSRepositoryConnector = (LocalOMRSRepositoryConnector) new LocalOMRSConnectorProvider("testLocalMetadataCollectionId", - connection, - null, - localRepositoryEventManager, - localRepositoryContentManager, - new OMRSRepositoryEventExchangeRule(OpenMetadataExchangeRule.ALL, null)) - .getConnector(connection); - - - localOMRSRepositoryConnector.setRepositoryHelper(new OMRSRepositoryContentHelper(localRepositoryContentManager)); - localOMRSRepositoryConnector.setRepositoryValidator(new OMRSRepositoryContentValidator(localRepositoryContentManager)); - localOMRSRepositoryConnector.setAuditLog(auditLog); - localOMRSRepositoryConnector.setMetadataCollectionId("1234"); - localRepositoryContentManager.setupEventProcessor(localOMRSRepositoryConnector, localRepositoryEventManager); - - - repositoryConnector.setRepositoryHelper(new OMRSRepositoryContentHelper(localRepositoryContentManager)); - repositoryConnector.setRepositoryValidator(new OMRSRepositoryContentValidator(localRepositoryContentManager)); - repositoryConnector.setMetadataCollectionId("testMetadataCollectionId"); - repositoryConnector.start(); - localRepositoryEventManager.start(); - localOMRSRepositoryConnector.start(); - new OMRSArchiveManager(null, auditLog).setLocalRepository("testLocalMetadataCollectionId", localRepositoryContentManager, null); - - return localOMRSRepositoryConnector; - } - - /** - * Get entity property of type string. - * @param entity whose property is requested. - * @param name if the requested property. - * @return property value. - */ - public String getStringProperty(EntityDetail entity, String name) { - return omEntityDao.getEntityStringProperty(entity, name); - } - - protected EntityDetail createDatabaseEntity(String dbName, String type, String version ) { - String qualifiedName = QualifiedNameUtils.buildQualifiedName("", Constants.DATABASE, dbName); - InstanceProperties properties = new EntityPropertiesBuilder(context, "createDatabaseEntity", null) - .withStringProperty(Constants.QUALIFIED_NAME, qualifiedName) - .withStringProperty(Constants.NAME, dbName) - .withStringProperty(Constants.TYPE, type) - .withStringProperty(Constants.VERSION, version) - .build(); - - try { - return omEntityDao.addEntity(Constants.DATABASE, qualifiedName, properties, true); - } catch (InvalidParameterException | PropertyErrorException | RepositoryErrorException | EntityNotKnownException - | FunctionNotSupportedException | PagingErrorException | ClassificationErrorException - | UserNotAuthorizedException | TypeErrorException | StatusNotSupportedException - | AnalyticsModelingCheckedException e) { - fail("Failed create database entity."); - } - return null; - } - - protected EntityDetail createDatabaseSchemaEntity(String guidDB, String schemaName) throws AnalyticsModelingCheckedException { - EntityDetail db = omEntityDao.getEntityByGuid(guidDB); - String qualifiedName = QualifiedNameUtils.buildQualifiedName( - omEntityDao.getEntityStringProperty(db, Constants.QUALIFIED_NAME), - Constants.DEPLOYED_DATABASE_SCHEMA, schemaName); - InstanceProperties properties = new EntityPropertiesBuilder(context, "createDatabaseSchemaEntity", null) - .withStringProperty(Constants.QUALIFIED_NAME, qualifiedName) - .withStringProperty(Constants.NAME, schemaName) - .build(); - - try { - EntityDetail schema = omEntityDao.addEntity(Constants.DEPLOYED_DATABASE_SCHEMA, qualifiedName, properties, true); - // add relationship catalog->schema - omEntityDao.addRelationship(Constants.DATA_CONTENT_FOR_DATASET, guidDB, schema.getGUID(), null); - - return schema; - } catch (InvalidParameterException | PropertyErrorException | RepositoryErrorException | EntityNotKnownException - | FunctionNotSupportedException | PagingErrorException | ClassificationErrorException - | UserNotAuthorizedException | TypeErrorException | StatusNotSupportedException e) { - fail("Failed create schema entity."); - } - return null; - - } - - String getEntityQName(EntityDetail entity) { - return omEntityDao.getEntityStringProperty(entity, Constants.QUALIFIED_NAME); - } - - protected EntityDetail createSchemaTable(EntityDetail schema, String tableName) throws AnalyticsModelingCheckedException { - - String method = "createSchemaTable"; - List relationshipsRDBSchemaList = omEntityDao.getRelationships(Constants.ASSET_SCHEMA_TYPE, schema.getGUID()); - - if (relationshipsRDBSchemaList == null || relationshipsRDBSchemaList.isEmpty()) { - String qualifiedName = QualifiedNameUtils.buildQualifiedName( - getEntityQName(schema), - Constants.RELATIONAL_DB_SCHEMA_TYPE, Constants.SCHEMA_ASSET); - InstanceProperties properties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(Constants.QUALIFIED_NAME, qualifiedName) - .build(); - - try { - EntityDetail relationalDBSchemaType = omEntityDao.addEntity(Constants.RELATIONAL_DB_SCHEMA_TYPE, qualifiedName, properties, true); - // add relationship schema->RelationalDBSchemaType - omEntityDao.addRelationship(Constants.ASSET_SCHEMA_TYPE, schema.getGUID(), relationalDBSchemaType.getGUID(), null); - } catch (OMRSCheckedExceptionBase e) { - fail("Failed create RelationalDBSchemaType entity."); - } - relationshipsRDBSchemaList = omEntityDao.getRelationships(Constants.ASSET_SCHEMA_TYPE, schema.getGUID()); - - } - - Relationship relRDBSchema = relationshipsRDBSchemaList.get(0); - EntityDetail entityRDBSchema = omEntityDao.getEntityByGuid(relRDBSchema.getEntityTwoProxy().getGUID()); - - try { - String qualifiedName = QualifiedNameUtils.buildQualifiedName( - omEntityDao.getEntityStringProperty(schema, Constants.QUALIFIED_NAME), - Constants.RELATIONAL_DB_SCHEMA_TYPE, tableName); - InstanceProperties properties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(Constants.QUALIFIED_NAME, qualifiedName) - .withStringProperty(Constants.DISPLAY_NAME, tableName) - .build(); - - EntityDetail entityTable = omEntityDao.addEntity(Constants.RELATIONAL_TABLE, qualifiedName, properties, true); - // add relationship RelationalDBSchemaType->table - omEntityDao.addRelationship(Constants.ATTRIBUTE_FOR_SCHEMA, entityRDBSchema.getGUID(), entityTable.getGUID(), null); - return entityTable; - } catch (OMRSCheckedExceptionBase e) { - fail("Failed create table entity: " + tableName); - } - return null; - } - - protected EntityDetail addColumn(EntityDetail tableEntity, String columnName, String dataType, String vendorType) throws Exception { - - String method = "addColumn"; - int position = getColumnPosition(tableEntity); - String columnQName = QualifiedNameUtils.buildQualifiedName(getEntityQName(tableEntity), Constants.RELATIONAL_COLUMN, columnName); - InstanceProperties columnTypeProperties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(Constants.QUALIFIED_NAME, columnQName) - .withStringProperty(Constants.DISPLAY_NAME, columnName) - .withIntegerProperty(Constants.POSITION, position) - .build(); - EntityDetail columnEntity = omEntityDao.addEntity(Constants.RELATIONAL_COLUMN, - columnQName, - columnTypeProperties, - false); - - omEntityDao.addRelationship(Constants.NESTED_SCHEMA_ATTRIBUTE, tableEntity.getGUID(), columnEntity.getGUID(), null); - - if (dataType != null) { - setColumnNoteLogProperty(columnEntity, Constants.ODBC_TYPE, dataType); - } - - if (vendorType != null) { - setColumnNoteLogProperty(columnEntity, Constants.TYPE, vendorType); - } - - return columnEntity; - } - - protected void addGlossaryTerm(EntityDetail entity, String name, String description, String summary) throws Exception { - - String method = "addGlossaryTerm"; - - String termQName = QualifiedNameUtils.buildQualifiedName(getEntityQName(entity), Constants.RELATIONAL_COLUMN, name); - InstanceProperties termProperties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(Constants.QUALIFIED_NAME, termQName) - .withStringProperty(Constants.DISPLAY_NAME, name) - .withStringProperty(OpenMetadataAPIMapper.DESCRIPTION_PROPERTY_NAME, description) - .withStringProperty(OpenMetadataAPIMapper.SUMMARY_PROPERTY_NAME, summary) - .build(); - EntityDetail termEntity = omEntityDao.addEntity(OpenMetadataAPIMapper.GLOSSARY_TERM_TYPE_NAME, - termQName, - termProperties, - false); - - omEntityDao.addRelationship(OpenMetadataAPIMapper.REFERENCEABLE_TO_MEANING_TYPE_NAME, entity.getGUID(), termEntity.getGUID(), null); - } - - public void setColumnProperty(EntityDetail columnEntity, String propName, Boolean propValue ) throws Exception { - InstanceProperties properties = columnEntity.getProperties(); - properties = new EntityPropertiesBuilder(context, "setColumnProperty", properties) - .withBooleanProperty(propName, propValue) - .build(); - omEntityDao.updateEntityProperty(columnEntity, properties); - } - - public void setColumnPrimaryKey(EntityDetail columnEntity, String primaryKeyName) throws Exception { - - InstanceProperties classificationProperties = new EntityPropertiesBuilder(context, "setColumnPrimaryKey", null) - .withStringProperty(Constants.NAME, primaryKeyName).build(); - - omEntityDao.classifyEntity(columnEntity, Constants.PRIMARY_KEY, classificationProperties); - } - - public void defineColumnForeignKey(EntityDetail columnEntity, EntityDetail referencedColumnEntity) throws Exception { - omEntityDao.addRelationship(Constants.FOREIGN_KEY, referencedColumnEntity.getGUID(), columnEntity.getGUID(), null); - } - - public void setColumnNoteLogProperty(EntityDetail columnEntity, String propName, String propValue ) throws Exception { - - EntityDetail columnTypeEntity = getColumnType(columnEntity); - InstanceProperties ap = omEntityDao.getMapProperty(columnTypeEntity.getProperties(), Constants.ADDITIONAL_PROPERTIES); - - if (ap == null) { - ap = new InstanceProperties(); - } - - EntityPropertiesBuilder pb = new EntityPropertiesBuilder(context, "setColumnNoteLogProperty", ap); - pb.withStringProperty(propName, propValue); - MapPropertyValue mpv = new MapPropertyValue(); - mpv.setMapValues(ap); - InstanceProperties properties = columnTypeEntity.getProperties(); - properties.setProperty(Constants.ADDITIONAL_PROPERTIES, mpv); - omEntityDao.updateEntityProperty(columnTypeEntity, properties); - } - - - /** - * Calculate position of the column. - * @param tableEntity for this table - * @return column position in order of adding to the table. - * @throws AnalyticsModelingCheckedException - */ - private int getColumnPosition(EntityDetail tableEntity) throws AnalyticsModelingCheckedException { - List columnToColumnType = omEntityDao.getRelationshipsForEntity(tableEntity, Constants.NESTED_SCHEMA_ATTRIBUTE); - return columnToColumnType == null ? 0 : columnToColumnType.size(); - } - - - private EntityDetail getColumnType(EntityDetail columnEntity) throws Exception { - - List columnToColumnType = omEntityDao.getRelationshipsForEntity(columnEntity, Constants.ATTACHED_NOTE_LOG); - - if (columnToColumnType != null && !columnToColumnType.isEmpty()) { - return omEntityDao.getEntityByGuid(columnToColumnType.get(0).getEntityTwoProxy().getGUID()); - } - - // create - String columnName = omEntityDao.getEntityStringProperty(columnEntity, Constants.DISPLAY_NAME); - String columnTypeQName = QualifiedNameUtils.buildQualifiedName(getEntityQName(columnEntity), - Constants.RELATIONAL_COLUMN_TYPE, columnName + Constants.TYPE_SUFFIX ); - InstanceProperties columnTypeProperties = new EntityPropertiesBuilder(context, "getColumnType", null) - .withStringProperty(Constants.QUALIFIED_NAME, columnTypeQName) - .build(); - - EntityDetail columnNoteLogEntity = omEntityDao.addEntity(Constants.NOTE_LOG, columnTypeQName, columnTypeProperties, false); - - omEntityDao.addRelationship(Constants.ATTACHED_NOTE_LOG, columnEntity.getGUID(), columnNoteLogEntity.getGUID(), null); - - return columnNoteLogEntity; - - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/QualifiedNameUtilsTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/QualifiedNameUtilsTest.java deleted file mode 100644 index 61dc05895b5..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/QualifiedNameUtilsTest.java +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test; - -import static org.testng.Assert.assertTrue; - -import org.testng.annotations.Test; - -class QualifiedNameUtilsTest { - - @Test - void testPatternAllAssetEntities() { - - String regex = "\\(SoftwareServerCapability\\)=http://localhost:9300/p2pd/servlet::\\(Asset\\)=i5061E09451574F9290412133FEE9BB5A.*"; - String test = "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(Asset)=i5061E09451574F9290412133FEE9BB5A::(SchemaAttribute)=Country"; - assertTrue(test.matches(regex)); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactDeleteTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactDeleteTest.java deleted file mode 100644 index 987e98a2755..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactDeleteTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNull; - -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; - -import org.testng.annotations.Test; - -/** - * The class contains tests related to DELETE artifact operation. - * - * Tests handling other operation after the DELETE operation should be placed here as well. - * - */ -class AnalyticsArtifactDeleteTest extends SynchronizationBaseTest { - - - /** - * Test the delete base module case. - * 1. All elements of the module is removed from repository (use QName) - * 2. Elements referenced by the deleted module are in repository. - * - * @throws Exception - */ - @Test - void testDeleteBaseModule() throws Exception { - - String methodName = "testDeleteBaseModule"; - String baseModule = getBaseModuleJson("baseModule"); // base module definition with fixed GUIDs - AnalyticsAsset assetBaseModule = TestUtilities.readObjectJson(baseModule, AnalyticsAsset.class); - - ResponseContainerAssets guids = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, assetBaseModule); - - //--------------------------------------------------- - // Verify structure and content of the built asset. - //--------------------------------------------------- - String guid = guids.getAssetsList().get(0); - assertSubgraph(guid, "baseModuleSubgraph"); - - EntityDetail asset = omEntityDao.getEntityByGuid(guid); - String assetQName = omEntityDao.getEntityQName(asset); - - guids = obj.deleteAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, null, UID_STOREID); - - List elements = getAssetEntities(assetQName, methodName); - - assertNull(elements, "All elements of baseModule should be removed from repository."); - - // delete should not remove entities referenced by the deleted asset - // thus relationships to the entities created outside of the module should be created again - guids = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, null, - TestUtilities.readObjectJson(baseModule, AnalyticsAsset.class)); - assertSubgraph(guids.getAssetsList().get(0), "baseModuleSubgraph"); - } - - - private List getAssetEntities(String assetQName, String methodName) - throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException - { - String pattern = ctx.getRepositoryHelper().getStartsWithRegex(assetQName); - - return ctx.getServerSoftwareCapabilityHandler().getEntitiesByValue( - ctx.getUserId(), - pattern, - "pattern", - null, - null, - Arrays.asList(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME), false, - null, null, false, - false,0, 0, null, methodName); - } - - - /** - * The delete asset referencing and referenced other assets. - * - * 1. All elements of the module is removed from repository (use QName) - * 2. Elements referenced by the deleted module are in repository. - * - * @throws Exception - */ - @Test - void testDeleteModule() throws Exception { - - String methodName = "testDeleteModule"; - - AnalyticsAsset assetBaseModule = getBaseModuleAsset("baseModule"); - - ResponseContainerAssets guidsBModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, assetBaseModule); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - - assertSubgraph(guidsModule.getAssetsList().get(0), "moduleSubgraph"); - - ResponseContainerAssets guidsDashBoard = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("dashboard")); - - assertSubgraph(guidsDashBoard.getAssetsList().get(0), "dashboardSubgraph"); - - String assetQName = omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(guidsModule.getAssetsList().get(0))); - - // delete an asset (module) referencing and referenced other assets. - obj.deleteAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, UID_STOREID_MODULE); - - //--------------------------------------------------- - // Verify structure and content of the deleted and related assets. - //--------------------------------------------------- - assertNull(getAssetEntities(assetQName, methodName), "All elements of module should be removed from repository."); - - assertSubgraph(guidsBModule.getAssetsList().get(0), "baseModuleSubgraph"); - assertSubgraph(guidsDashBoard.getAssetsList().get(0), "dashboardDisconnectedSubgraph"); - } - - /** - * The asset delete operation removes artifact represented by two assets. - * - * @throws Exception - */ - @Test - void testDeleteVisualizationWithModule() throws Exception { - - String methodName = "testDeleteVisualizationWithModule"; - - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("module")); - - ResponseContainerAssets guidsReport = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("report")); - - assertSubgraph(guidsReport.getAssetsList().get(1), "reportSubgraph"); - - String assetQName1 = omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(guidsReport.getAssetsList().get(0))); - String assetQName2 = omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(guidsReport.getAssetsList().get(1))); - - // delete report assets - guidsReport = obj.deleteAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, UID_STOREID_REPORT); - - //--------------------------------------------------- - // Verify repository does not have entities for artifact elements - //--------------------------------------------------- - assertEquals(guidsReport.getAssetsList().size(), 2, "Two assets should be reported as deleted."); - assertNull(getAssetEntities(assetQName1, methodName), "All elements of module should be removed from repository."); - assertNull(getAssetEntities(assetQName2, methodName), "All elements of visualization should be removed from repository."); - - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactHandlerTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactHandlerTest.java deleted file mode 100644 index cb23f3361bf..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactHandlerTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - - -import static org.testng.Assert.assertEquals; - -import java.util.Arrays; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.AnalyticsAssetUtils; -import org.testng.annotations.Test; - - -class AnalyticsArtifactHandlerTest extends SynchronizationBaseTest { - - - @Test - void testBuildBaseModule() throws Exception { - AnalyticsAsset obj = new AnalyticsAsset(); - obj.setUid(UID_STOREID); - obj.setDisplayName("dbo"); - obj.setLocation(UID_PATH); - obj.setSourceGuid(Arrays.asList("databaseGUID:dbo")); - - MetadataContainer qs = TestUtilities.readObjectJson( - JsonMocks.getEmptyQuerySubject("Country", "COUNTRY", 1, "tableGUID:COUNTRY@dbo"), - MetadataContainer.class); - - MetadataItem qi = TestUtilities.readObjectJson( - JsonMocks.getBaseModuleQueryItem("Country", "COUNTRY", "COUNTRY", 1, "VARCHAR", "columnGUID:COUNTRY@COUNTRY@dbo"), - MetadataItem.class); - qs.addItem(qi); - - qi = TestUtilities.readObjectJson( - JsonMocks.getBaseModuleQueryItem("Country Code", "COUNTRYCODE", "COUNTRYCODE", 2, "INTEGER", "columnGUID:COUNTRYCODE@COUNTRY@dbo"), - MetadataItem.class); - qs.addItem(qi); - - AnalyticsAssetUtils.addContainer(obj, qs); - - qs = TestUtilities.readObjectJson( - JsonMocks.getEmptyQuerySubject("Sales", "SALES", 2, "tableGUID:@SALES@dbo"), - MetadataContainer.class); - MetadataItem [] items = { - TestUtilities.readObjectJson(JsonMocks.getBaseModuleQueryItem( - "Sales Country Code", "SALESCOUNTRYCODE", "SALESCOUNTRYCODE", 1, "INTEGER", "columnGUID:SALESCOUNTRYCODE@SALES@dbo"), MetadataItem.class), - TestUtilities.readObjectJson(JsonMocks.getBaseModuleQueryItem( - "Quantity", "QUANTITY", "QUANTITY", 2, "INTEGER", "columnGUID:QUANTITY@SALES@dbo"), MetadataItem.class), - }; - qs.setItem(Arrays.asList(items)); - AnalyticsAssetUtils.addContainer(obj, qs); - - TestUtilities.assertObjectJson(obj, TestUtilities.readJsonFile(FOLDER_MASTER, "baseModuleAsset")); - } - - @Test - void testReadBaseModule() throws Exception { - createBeanWithAssertion("baseModule"); - } - - /** - * Base module has GUIDs used to connect to original asset. - * Identifier resolution is not required. - * - * @throws Exception - */ - @Test - void testCreateBaseModule() throws Exception { - - String input = "baseModule"; - AnalyticsAsset baseModule = getBaseModuleAsset(input); - - ResponseContainerAssets guids = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, baseModule); - - assertEquals(guids.getAssetsList().size(), 1, "Single asset should be created."); - - //--------------------------------------------------- - // Verify structure and content of the built asset. - //--------------------------------------------------- - String guid = guids.getAssetsList().get(0); - - assertSubgraph(guid, "baseModuleSubgraph"); - } - - /** - * Module has identifiers used to connect to existing asset. - * Identifier resolution is required. - * - * @throws Exception - */ - @Test - void testCreateModule() throws Exception { - - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - - //--------------------------------------------------- - // Verify structure and content of the built asset. - //--------------------------------------------------- - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be created."); - String guid = guidsModule.getAssetsList().get(0); - - assertSubgraph(guid, "moduleSubgraph"); - } - - /** - * Report has module and visualization parts used to create two asset. - * Identifier resolution is not required in both assets. - * - * @throws Exception - */ - @Test - void testCreateReport() throws Exception { - - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("module")); - - - ResponseContainerAssets guidsReport = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("report")); - - //--------------------------------------------------- - // Verify structure and content of the built asset. - //--------------------------------------------------- - assertEquals(guidsReport.getAssetsList().size(), 2, "Module and Visualization assets should be created."); - String guid = guidsReport.getAssetsList().get(1); - - assertSubgraph(guid, "reportSubgraph"); - } - - /** - * Dash board has only visualization part. - * Identifiers should point to referenced module entities. - * - * @throws Exception - */ - @Test - void testCreateDashboard() throws Exception { - - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("module")); - - ResponseContainerAssets guidsDashBoard = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("dashboard")); - - //--------------------------------------------------- - // Verify structure and content of the built asset. - //--------------------------------------------------- - assertEquals(guidsDashBoard.getAssetsList().size(), 1, "Visualization only asset should be created."); - String guid = guidsDashBoard.getAssetsList().get(0); - - assertSubgraph(guid, "dashboardSubgraph"); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactUpdateTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactUpdateTest.java deleted file mode 100644 index 39ebeb1d4a6..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsArtifactUpdateTest.java +++ /dev/null @@ -1,352 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.testng.Assert.assertEquals; - -import java.util.Arrays; -import java.util.Date; - -import org.mockito.Mockito; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.AnalyticsArtifactHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.AssetConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; -import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.testng.annotations.Test; - - -public class AnalyticsArtifactUpdateTest extends SynchronizationBaseTest { - - - /** - * Test update unchanged module. - * - * @throws Exception - */ - @Test - void testModuleNotChanged() throws Exception { - - // prepare for test - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - - // Verify structure before test - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be created."); - String guid = guidsModule.getAssetsList().get(0); - assertSubgraph(guid, "moduleSubgraph"); - - - AnalyticsArtifactHandler objSpy = Mockito.spy(obj); - - guidsModule = objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, - TestUtilities.readObjectJson(TestUtilities.readJsonFile(FOLDER_INPUT, "module"), AnalyticsAsset.class)); - - // Verify structure and content of the updated asset. - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be updated."); - guid = guidsModule.getAssetsList().get(0); - - assertSubgraph(guid, "moduleSubgraph"); - - verify(objSpy, never()).createContainer(any(MetadataContainer.class), anyString(), anyString(), anyBoolean(), anyString()); - verify(objSpy, never()).createItem(any(MetadataItem.class), anyString(), anyString(), anyBoolean(), anyString()); - - } - - /** - * Test removed first container with two items, first item in the module, first item in second container. - * - * @throws Exception - */ - @Test - void testRemoveObjects() throws Exception { - - // prepare for test - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - - // Verify structure before test - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be created."); - String guid = guidsModule.getAssetsList().get(0); - assertSubgraph(guid, "moduleSubgraph"); - - - AnalyticsArtifactHandler objSpy = Mockito.spy(obj); - - guidsModule = objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, - TestUtilities.readObjectJson(TestUtilities.readJsonFile(FOLDER_INPUT, "moduleShort"), AnalyticsAsset.class)); - - //--------------------------------------------------- - // Verify structure and content of the updated asset. - //--------------------------------------------------- - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be updated."); - guid = guidsModule.getAssetsList().get(0); - - - assertSubgraph(guid, "moduleShortSubgraph"); - - verify(objSpy, never()).createContainer(any(MetadataContainer.class), anyString(), anyString(), anyBoolean(), anyString()); - verify(objSpy, never()).createItem(any(MetadataItem.class), anyString(), anyString(), anyBoolean(), anyString()); - - // new definition is missing module item, module container with two items, and item in second container. - verify(objSpy, times(5)).removeMetadataObject(any(EntityDetail.class), anyString()); - } - - /** - * Test added elements: - * first container with two items, - * first item in the module, - * first item in second container. - * - * @throws Exception - */ - @Test - void testAddedObjects() throws Exception { - - // prepare for test - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("moduleShort")); - - // Verify structure before test - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be created."); - String guid = guidsModule.getAssetsList().get(0); - assertSubgraph(guid, "moduleShortSubgraph"); - - AnalyticsArtifactHandler objSpy = Mockito.spy(obj); - - guidsModule = objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, - TestUtilities.readObjectJson(TestUtilities.readJsonFile(FOLDER_INPUT, "module"), AnalyticsAsset.class)); - - //--------------------------------------------------- - // Verify structure and content of the updated asset. - //--------------------------------------------------- - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be updated."); - guid = guidsModule.getAssetsList().get(0); - - assertSubgraph(guid, "moduleSubgraph"); - - verify(objSpy, times(1)).createContainer(any(MetadataContainer.class), anyString(), anyString(), anyBoolean(), anyString()); - verify(objSpy, times(4)).createItem(any(MetadataItem.class), anyString(), anyString(), anyBoolean(), anyString()); - - } - - /** - * Test sourceId added, deleted, modified - * - * @throws Exception - */ - @Test - void testUpdateReferences() throws Exception { - - // prepare for test - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - - // Verify structure before test - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be created."); - String guid = guidsModule.getAssetsList().get(0); - assertSubgraph(guid, "moduleSubgraph"); - - guidsModule = obj.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, - TestUtilities.readObjectJson(TestUtilities.readJsonFile(FOLDER_INPUT, "moduleReferences"), AnalyticsAsset.class)); - - //--------------------------------------------------- - // Verify structure and content of the updated asset. - //--------------------------------------------------- - assertEquals(guidsModule.getAssetsList().size(), 1, "Single asset should be updated."); - guid = guidsModule.getAssetsList().get(0); - - assertSubgraph(guid, "moduleReferencesSubgraph"); - } - - /** - * Test restore reference scenario. - * Asset M1 is referenced by asset M2, and there is relationship R(M2.C1.I1->M1.C1.I1). - * Update M1 where M1.C1.I1 is removed will remove relationship R(). - * Next asset M1 update with defined M1.C1.I1 should restore the relationship R(). - * - * @throws Exception - */ - @Test - void testRestoreReferences() throws Exception { - - // prepare for test - String baseModule = getBaseModuleJson("baseModule"); // base module definition with fixed GUIDs - AnalyticsAsset assetBaseModule = TestUtilities.readObjectJson(baseModule, AnalyticsAsset.class); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, assetBaseModule); - String guidBase = guidsModule.getAssetsList().get(0); - - guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - - // Verify structure before test - String guidModule = guidsModule.getAssetsList().get(0); - assertSubgraph(guidBase, "baseModuleSubgraph"); - assertSubgraph(guidModule, "moduleSubgraph"); - - // identifier change removes old object and creates new one with the new identifier - AnalyticsAsset updatedBM = TestUtilities.readObjectJson(baseModule, AnalyticsAsset.class); - updatedBM.getContainer().get(0).setIdentifier("COUNTRY1"); - - obj.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, updatedBM); - // Verify structure and content of the updated asset and dependent asset. - assertSubgraph(guidBase, "baseModuleNewIdentifierSubgraph"); - assertSubgraph(guidModule, "moduleRemovedReferenceSubgraph"); // two relationships were removed from moduleSubgraph.json - - // update with original definition: roll back - obj.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, - TestUtilities.readObjectJson(baseModule, AnalyticsAsset.class)); - // Verify structure and content of the updated asset and dependent asset. - assertSubgraph(guidBase, "baseModuleSubgraph"); - assertSubgraph(guidModule, "moduleSubgraph"); - } - - /** - * Test update properties of a module asset. - * - * @throws Exception - */ - @Test - void testUpdateModuleAssetObject() throws Exception { - - AssetConverter assetConverter = new AssetConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()); - - String UPDATED = "UPDATED: "; - String TIMESTAMP = "TimeStamp"; - String DBO_GUID = "databaseGUID:dbo"; - String testName = "testUpdateModuleAssetObject"; - - // prepare for test - AnalyticsAsset module = new AnalyticsAsset(); - module.setUid(UID_STOREID); - module.setDisplayName(MODULE_NAME); - module.setLocation(UID_PATH); - module.setSourceGuid(Arrays.asList(DBO_GUID)); - module.setLastModified(TIMESTAMP); - module.setType("baseModule"); - module.setDescription(TEST_DESCRIPTION); - - ResponseContainerAssets guidsModule = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, module); - String guid = guidsModule.getAssetsList().get(0); - - AnalyticsArtifactHandler objSpy = Mockito.spy(obj); - - // property updates one by one confirm that each update is completed - module.setDisplayName(UPDATED + MODULE_NAME); - objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, module); - assertEquals(getAsset(assetConverter, guid, testName).getDisplayName(), UPDATED + MODULE_NAME, "Module name update failed"); - - module.setDescription(UPDATED + TEST_DESCRIPTION); - objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, module); - assertEquals(getAsset(assetConverter, guid, testName).getDescription(), UPDATED + TEST_DESCRIPTION, "Description update failed"); - - module.setLocation(UPDATED + UID_PATH); - objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, module); - assertEquals(getAsset(assetConverter, guid, testName).getLocation(), UPDATED + UID_PATH, "Location update failed"); - - module.setLastModified(UPDATED + TIMESTAMP); - objSpy.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, module); - AnalyticsAsset repositoryAsset = getAsset(assetConverter, guid, testName); - assertEquals(repositoryAsset.getLastModified(), UPDATED + TIMESTAMP, "Last modified update failed"); - - repositoryAsset.setGuid(GUID_TO_COMPARE); // replace random GUID with predefined value to compare - TestUtilities.assertObjectJson(repositoryAsset, TestUtilities.readJsonFile(FOLDER_MASTER, "baseModuleAssetUpdate")); - } - - /** - * Test update report. - * @throws Exception - */ - @Test - void testUpdateVisualization() throws Exception { - - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("module")); - - ResponseContainerAssets guidsReport = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("report")); - String guidModule = guidsReport.getAssetsList().get(0); - String guidReport = guidsReport.getAssetsList().get(1); - - // Verify structure and content of the built asset before test. - assertEquals(guidsReport.getAssetsList().size(), 2, "Module and Visualization assets should be created."); - assertSubgraph(guidModule, "reportModuleSubgraph"); - assertSubgraph(guidReport, "reportSubgraph"); - - // update report - obj.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, - TestUtilities.readObjectJson(TestUtilities.readJsonFile(FOLDER_INPUT, "report2"), AnalyticsAsset.class)); - assertSubgraph(guidReport, "report2Subgraph"); - } - - - /** - * Test update modified reference to module. - * Module M2 references module M1A as M1 alias and has relationships to its items. - * When M2 changes reference from M1A to M1B but alias remains M1, the definitions of items (sourceIds) stay the same (M1.C1.I1). - * But because M2 points to M1B instead M1A the relationships must be modified to point to correct entities in repository. - * @throws Exception - */ - @Test - void testUpdateModifiedModuleReference() throws Exception { - - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule")); - obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, createBean("baseModule2")); - - ResponseContainerAssets guidsReport = obj.createAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, - SoftwareServerCapability_GUID, createBean("module")); - String guidModule = guidsReport.getAssetsList().get(0); - - // Verify structure and content of the built asset before test. - assertSubgraph(guidModule, "moduleSubgraph"); - - // modify reference from baseModule to baseModule2 - String module = TestUtilities.readJsonFile(FOLDER_INPUT, "module") - .replaceAll("iBASEMODULE", "iBASEMODULE2") - .replaceAll("_GOSALES_Egeria", "_GOSALES_Egeria2"); - - AnalyticsAsset asset = TestUtilities.readObjectJson(module, AnalyticsAsset.class); - - // update report - obj.updateAssets(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, SoftwareServerCapability_GUID, asset); - assertSubgraph(guidModule, "module2Subgraph"); - } - /** - * Helper function to get Analytics Asset object. - * @param assetConverter to convert entity to bean. - * @param guid of the entity. - * @param test name for logging. - * @return - * @throws PropertyServerException - * @throws InvalidParameterException - * @throws UserNotAuthorizedException - */ - private AnalyticsAsset getAsset(AssetConverter assetConverter, String guid, String test) throws PropertyServerException, InvalidParameterException, UserNotAuthorizedException { - return assetConverter.getNewBean(AnalyticsAsset.class, - ctx.getRepositoryHandler().getEntityByGUID(ctx.getUserId(), guid, "guid", IdMap.ASSET_TYPE_NAME, false, false, new Date(), test), test); - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsMetadataPersistenceTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsMetadataPersistenceTest.java deleted file mode 100644 index 749be11455e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/AnalyticsMetadataPersistenceTest.java +++ /dev/null @@ -1,219 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaAttribute; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.beans.SchemaType; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.builders.AnalyticsMetadataBuilder; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.AnalyticsMetadataConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.converters.SchemaTypeConverter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.InMemoryRepositoryTest; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.commonservices.generichandlers.SchemaAttributeHandler; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -class AnalyticsMetadataPersistenceTest extends InMemoryRepositoryTest { - - private static final List SOURCE_LIST = Arrays.asList("uid1", "uid2"); - private static final String ITEM_DATA_TYPE = "VARCHAR"; - private static final String ITEM_EXPRESSION = "qiExpression"; - private static final String ITEM_ID = "qiID"; - private static final String ITEM_DISPLAY_NAME = "displayName"; - private static final String ITEM_QNAME = "PARENT::(SchemaAttribute)=qiID"; - private static final String TEST_ANALYTICS_METADATA_TYPE = "TEST_ANALYTICS_METADATA_TYPE"; - private static final String CONTAINER_DISPLAY_NAME = "displayNameQS"; - private static final String CONTAINER_ID = "qsID"; - private static final String CONTAINER_QNAME = "PARENT::(SchemaAttribute)=qsID"; - private static final String HTTP_LOCALHOST_9300_P2PD_SERVLET = "http://localhost:9300/p2pd/servlet"; - private static final String TEST_DESCRIPTION = "TEST_DESCRIPTION"; - - // initialize execution context - ExecutionContext ctx; - - SchemaAttributeHandler metadataHandler; - - @BeforeMethod - public void setup() throws Exception { - super.setup(); - - ctx = new ExecutionContext( - serviceName, - serverName, - invalidParameterHandler, - repositoryHandler, - enterpriseConnector.getRepositoryHelper(), - LOCAL_SERVER_USER_ID, - null, // securityVerifier, - null, // supportedZones, - null, // defaultZones, - null, // publishZones, - auditLog); - - ctx.initializeSoftwareServerCapability(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, null); - - metadataHandler = new SchemaAttributeHandler<>( - new AnalyticsMetadataConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()), - SchemaAttribute.class, - new SchemaTypeConverter(ctx.getRepositoryHelper(), ctx.getServiceName(), ctx.getServerName()), - SchemaType.class, - ctx.getServiceName(), ctx.getServerName(), - ctx.getInvalidParameterHandler(), ctx.getRepositoryHandler(), ctx.getRepositoryHelper(), - ctx.getLocalServerUserId(), ctx.getSecurityVerifier(), - ctx.getSupportedZones(), ctx.getDefaultZones(), ctx.getPublishZones(), ctx.getAuditLog()); - - } - - /** - * Test builder to save attributes in repository from bean - * and converter to load from repository into a bean for container - */ - @Test - void testContainerPersistence() throws IOException { - - String methodName = "testContainerPersistance"; - - // test builder to save bean into repository - MetadataContainer obj = TestUtilities.readObjectJson( - JsonMocks.getContainer(CONTAINER_QNAME, CONTAINER_DISPLAY_NAME, CONTAINER_ID), - MetadataContainer.class); - - obj.setDescription(TEST_DESCRIPTION); - obj.setType(TEST_ANALYTICS_METADATA_TYPE); - - AnalyticsMetadataConverter.prepareAnalyticsMetadataProperties(obj); - - - AnalyticsMetadataBuilder builder = new AnalyticsMetadataBuilder(obj, null, ctx); - try { - String guid = metadataHandler.createBeanInRepository(ctx.getUserId(), null, null, - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - builder, new Date(), methodName); - - EntityDetail entity = omEntityDao.getEntityByGuid(guid); - - assertEquals(omEntityDao.getEntityQName(entity), CONTAINER_QNAME); - assertEquals(omEntityDao.getEntityStringProperty(entity, Constants.DISPLAY_NAME), CONTAINER_DISPLAY_NAME); - assertEquals(omEntityDao.getEntityStringProperty(entity, Constants.SYNC_DESCRIPTION), TEST_DESCRIPTION); - assertEquals(omEntityDao.getEntityStringProperty(entity, Constants.SYNC_NATIVE_CLASS), obj.getClass().getName()); - - InstanceProperties props = omEntityDao.getMapProperty(entity.getProperties(), Constants.ADDITIONAL_PROPERTIES); - assertEquals(omEntityDao.getStringProperty(Constants.SYNC_IDENTIFIER, props), CONTAINER_ID); - assertEquals(omEntityDao.getStringProperty(Constants.TYPE, props), TEST_ANALYTICS_METADATA_TYPE); - assertEquals(omEntityDao.getStringProperty(IdMap.SOURCE_ID, props), "uid1" + Constants.SYNC_ID_LIST_DELIMITER +"uid2"); - - } catch (Exception e) { - fail("Test failed with exception: " + e.getLocalizedMessage()); - } - - // test converter to fetch bean from repository - try { - SchemaAttribute sa = metadataHandler.getBeanByQualifiedName(ctx.getUserId(), - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - CONTAINER_QNAME, "CONTAINER_QNAME", - false, - false, - new Date(), methodName); - - assertEquals(sa.getClass().getName(), obj.getClass().getName()); // fetched the same type as saved - - MetadataContainer objLoaded = (MetadataContainer) sa; - assertEquals(objLoaded.getQualifiedName(), CONTAINER_QNAME); - assertEquals(objLoaded.getDisplayName(), CONTAINER_DISPLAY_NAME); - assertEquals(objLoaded.getDescription(), TEST_DESCRIPTION); - assertEquals(objLoaded.getNativeJavaClass(), obj.getClass().getName()); - - assertEquals(objLoaded.getIdentifier(), CONTAINER_ID); - assertEquals(objLoaded.getType(), TEST_ANALYTICS_METADATA_TYPE); - assertEquals(objLoaded.getSourceId(), SOURCE_LIST); - - } catch (Exception e) { - fail("Test failed with exception: " + e.getLocalizedMessage()); - } - } - - /** - * Test builder to save attributes in repository from bean - * and converter to load from repository into a bean for item - */ - @Test - void testItemPersistence() throws IOException { - - String methodName = "testItemPersistance"; - - // test builder to save bean into repository - MetadataItem obj = TestUtilities.readObjectJson( - JsonMocks.getItem(ITEM_QNAME, ITEM_DISPLAY_NAME, ITEM_ID, ITEM_EXPRESSION, ITEM_DATA_TYPE), - MetadataItem.class); - - obj.setDescription(TEST_DESCRIPTION); - obj.setType(TEST_ANALYTICS_METADATA_TYPE); - - AnalyticsMetadataConverter.prepareAnalyticsMetadataProperties(obj); - - AnalyticsMetadataBuilder builder = new AnalyticsMetadataBuilder(obj, null, ctx); - try { - String guid = metadataHandler.createBeanInRepository(ctx.getUserId(), null, null, - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - builder, new Date(), methodName); - - EntityDetail entity = omEntityDao.getEntityByGuid(guid); - - assertEquals(omEntityDao.getEntityQName(entity), ITEM_QNAME); - assertEquals(omEntityDao.getEntityStringProperty(entity, Constants.DISPLAY_NAME), ITEM_DISPLAY_NAME); - assertEquals(omEntityDao.getEntityStringProperty(entity, Constants.SYNC_DESCRIPTION), TEST_DESCRIPTION); - assertEquals(omEntityDao.getEntityStringProperty(entity, Constants.SYNC_NATIVE_CLASS), obj.getClass().getName()); - - InstanceProperties props = omEntityDao.getMapProperty(entity.getProperties(), Constants.ADDITIONAL_PROPERTIES); - assertEquals(omEntityDao.getStringProperty(Constants.SYNC_IDENTIFIER, props), ITEM_ID); - assertEquals(omEntityDao.getStringProperty(Constants.TYPE, props), TEST_ANALYTICS_METADATA_TYPE); - assertEquals(omEntityDao.getStringProperty(IdMap.SOURCE_ID, props), "uid1" + Constants.SYNC_ID_LIST_DELIMITER +"uid2"); - - } catch (Exception e) { - fail("Test failed with exception: " + e.getLocalizedMessage()); - } - - // test converter to fetch bean from repository - try { - SchemaAttribute sa = metadataHandler.getBeanByQualifiedName(ctx.getUserId(), - IdMap.SCHEMA_ATTRIBUTE_TYPE_GUID, IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, - ITEM_QNAME, "ITEM_QNAME", - false, false, new Date(), methodName); - - assertEquals(sa.getClass().getName(), obj.getClass().getName()); // fetched the same type as saved - - MetadataItem objLoaded = (MetadataItem) sa; - assertEquals(objLoaded.getQualifiedName(), ITEM_QNAME); - assertEquals(objLoaded.getDisplayName(), ITEM_DISPLAY_NAME); - assertEquals(objLoaded.getDescription(), TEST_DESCRIPTION); - assertEquals(objLoaded.getNativeJavaClass(), obj.getClass().getName()); - - assertEquals(objLoaded.getIdentifier(), ITEM_ID); - assertEquals(objLoaded.getType(), TEST_ANALYTICS_METADATA_TYPE); - assertEquals(objLoaded.getSourceId(), SOURCE_LIST); - assertEquals(objLoaded.getDataType(), ITEM_DATA_TYPE); - assertEquals(objLoaded.getExpression(), ITEM_EXPRESSION); - - } catch (Exception e) { - fail("Test failed with exception: " + e.getLocalizedMessage()); - } - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/MetadataContainerTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/MetadataContainerTest.java deleted file mode 100644 index 6f8477384db..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/MetadataContainerTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - - -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Map; -import java.util.TreeMap; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.QualifiedNameUtils; - -class MetadataContainerTest { - - private static final String FOLDER_MASTER = "/src/test/resources/synchronization/master/"; - - @Test - void testBuildContainer() throws IOException { - MetadataContainer obj = new MetadataContainer(); - String id = "qsID"; - - // from Referenceable - obj.setQualifiedName(QualifiedNameUtils.buildQualifiedName("PARENT", IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, id)); - Map props = new TreeMap<>(); - props.put("p1", "v1"); - props.put("p2", "v2"); - obj.setAdditionalProperties(props); - - // from SchemaElement - obj.setDisplayName("displayNameQS"); - obj.setDescription("Query Subject description"); - - // from SchemaAttribute - obj.setElementPosition(1); - - // from QuerySubject - obj.setIdentifier(id); - obj.setSourceGuid(Arrays.asList("guid1", "guid2")); - obj.setSourceId(Arrays.asList("uid1", "uid2")); - - MetadataItem qi1 = TestUtilities.readObjectJson( - JsonMocks.getItem( - QualifiedNameUtils.buildQualifiedName(obj.getQualifiedName(), IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, "qiID1"), - "qiName1", "qiID1", "qiExpression1", "VARCHAR(1)"), MetadataItem.class); - - MetadataItem qi2 = TestUtilities.readObjectJson( - JsonMocks.getItem( - QualifiedNameUtils.buildQualifiedName(obj.getQualifiedName(), IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, "qiID2"), - "qiName2", "qiID2", "qiExpression2", "VARCHAR(2)"), MetadataItem.class); - - obj.setItem(Arrays.asList(qi1, qi2)); - - TestUtilities.assertObjectJson(obj, TestUtilities.readJsonFile(FOLDER_MASTER, "container")); - } - - @Test - void testContainerFromJson() throws IOException { - MetadataContainer obj = TestUtilities.readObjectJson( - JsonMocks.getContainer("PARENT::(SchemaAttribute)=qsID", "displayNameQS", "qsID"), - MetadataContainer.class); - - TestUtilities.assertObjectJson(obj, TestUtilities.readJsonFile(FOLDER_MASTER, "containerPartial")); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/MetadataItemTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/MetadataItemTest.java deleted file mode 100644 index ff48d609adf..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/MetadataItemTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - - -import org.testng.annotations.Test; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Map; -import java.util.TreeMap; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.IdMap; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.QualifiedNameUtils; - -class MetadataItemTest { - - private static final String FOLDER_MASTER = "/src/test/resources/synchronization/master/"; - - @Test - void testBuildMetadataItem() throws IOException { - MetadataItem obj = new MetadataItem(); - String id = "qiID"; - - // from Referenceable - obj.setQualifiedName(QualifiedNameUtils.buildQualifiedName("PARENT", IdMap.SCHEMA_ATTRIBUTE_TYPE_NAME, id)); - Map props = new TreeMap<>(); - props.put("p1", "v1"); - props.put("p2", "v2"); - obj.setAdditionalProperties(props); - - // from SchemaElement - obj.setDisplayName("displayName"); - obj.setDescription("Query Item description"); - - // from SchemaAttribute - obj.setElementPosition(1); - - // from QueryItem - obj.setIdentifier(id); - obj.setExpression("qiExpression"); - obj.setDataType("VARCHAR"); - obj.setSourceGuid(Arrays.asList("guid1", "guid2")); - obj.setSourceId(Arrays.asList("uid1", "uid2")); - - TestUtilities.assertObjectJson(obj, TestUtilities.readJsonFile(FOLDER_MASTER, "item")); - } - - @Test - void testMetadataItemFromJson() throws IOException { - MetadataItem obj = TestUtilities.readObjectJson( - JsonMocks.getItem("PARENT::(SchemaAttribute)=qiID", "displayName", "qiID", "qiExpression", "VARCHAR"), - MetadataItem.class); - - TestUtilities.assertObjectJson(obj, TestUtilities.readJsonFile(FOLDER_MASTER, "itemPartial")); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/SynchronizationBaseTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/SynchronizationBaseTest.java deleted file mode 100644 index 351bdbaee8b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/synchronization/SynchronizationBaseTest.java +++ /dev/null @@ -1,362 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.synchronization; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.fail; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.stream.Collectors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.AnalyticsArtifactHandler; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsMetadata; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.InMemoryRepositoryTest; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.EntityPropertiesBuilder; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.JsonMocks; -import org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.TestUtilities; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.ExecutionContext; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; -import org.testng.annotations.BeforeMethod; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * Base class for synchronization tests. - * - */ -public class SynchronizationBaseTest extends InMemoryRepositoryTest -{ - - protected static final String FOLDER_INPUT = "/src/test/resources/synchronization/input/"; - protected static final String FOLDER_MASTER = "/src/test/resources/synchronization/master/"; - - protected static final String HTTP_LOCALHOST_9300_P2PD_SERVLET = "http://localhost:9300/p2pd/servlet"; - - protected static final String UID_PATH = "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']" - + "/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']"; - - protected static final String UID_STOREID = "iBASEMODULE"; - protected static final String UID_STOREID_MODULE = "iMODULE"; - protected static final String UID_STOREID_REPORT = "iREPORT"; - protected static final String MODULE_NAME = "dbo"; - protected static final String TEST_DESCRIPTION = "This is for testing description persistance."; - - protected static final String GUID_TO_COMPARE= "bce54b72-afa8-4ee6-b7d0-b2bb7632e8bd"; - - protected String SoftwareServerCapability_GUID; - - // initialize execution context - ExecutionContext ctx; - - // handler to test functionality - AnalyticsArtifactHandler obj; - - @BeforeMethod - public void setup() throws Exception { - super.setup(); - - ctx = new ExecutionContext( - serviceName, - serverName, - invalidParameterHandler, - repositoryHandler, - enterpriseConnector.getRepositoryHelper(), - LOCAL_SERVER_USER_ID, - null, // securityVerifier, - null, // supportedZones, - null, // defaultZones, - null, // publishZones, - auditLog); - - ctx.initializeSoftwareServerCapability(USER_ID, HTTP_LOCALHOST_9300_P2PD_SERVLET, null); - - SoftwareServerCapability_GUID = ctx.getServerSoftwareCapability().getGUID(); - - obj = new AnalyticsArtifactHandler(ctx); - } - - //---------------------------------------------------------------------------------- - // Verify structure and content of the built asset as graph with nodes and edges. - //---------------------------------------------------------------------------------- - protected void assertSubgraph(String guid, String fileMaster) throws IOException, AnalyticsModelingCheckedException { - - ArrayList nodes = new ArrayList<>(); - ArrayList edges = new ArrayList<>(); - - EntityDetail asset = omEntityDao.getEntityByGuid(guid); - String assetQName = omEntityDao.getEntityQName(asset); - - try { - - collectRelatedNodes(nodes, edges, guid, assetQName); - orderNodes(nodes); - orderEdges(edges); - - String output = printGraph(nodes, edges); - - String master = TestUtilities.readJsonFile(FOLDER_MASTER, fileMaster); - - assertEquals(output, master); - - } catch (AnalyticsModelingCheckedException e) { - fail(e.getLocalizedMessage()); - } - - } - - private String printGraph(ArrayList nodes, ArrayList edges) { - - StringBuilder content = new StringBuilder(); - content.append("{") - .append(buildJsonArray("node", nodes)) - .append(",") - .append(buildJsonArray("edge", edges)) - .append("}"); - - try { - ObjectMapper mapper = new ObjectMapper(); - JsonNode jn = mapper.readTree(content.toString().getBytes()); - return jn.toPrettyString(); - } catch (IOException e) { - return content.toString(); - } - } - - private String buildJsonArray(String name, List list) { - - if (list == null) { - return String.format("\"%s\":[]", name); - } - - StringBuilder content = new StringBuilder(); - for ( Object element : list) { - if (content.length() != 0) { - content.append(","); - } - if (element instanceof EntityDetail) { - content.append(printNode((EntityDetail)element)); - } else if (element instanceof Relationship) { - content.append(printEdge((Relationship)element)); - } else if (element instanceof Classification) { - content.append(printClassification((Classification)element)); - } - } - return String.format("\"%s\":[%s]", name, content.toString()); - } - - private Object printClassification(Classification element) { - return String.format("\"%s\"", element.getName()); - } - - private String printEdge(Relationship edge) { - try { - return JsonMocks.getEdge(omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(edge.getEntityOneProxy().getGUID())), - omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(edge.getEntityTwoProxy().getGUID())), - edge.getType().getTypeDefName()); - } catch (AnalyticsModelingCheckedException e) { - return composeRelationshipQName(edge); - } - } - - private String printNode(EntityDetail node) { - InstanceProperties props = omEntityDao.getMapProperty(node.getProperties(), Constants.ADDITIONAL_PROPERTIES); - List list = node.getClassifications(); - - String displayName = omEntityDao.getEntityStringProperty(node, Constants.DISPLAY_NAME); - - if (displayName == null) { - // for asset entity - displayName = omEntityDao.getEntityStringProperty(node, Constants.NAME); - } - - return JsonMocks.getNode(displayName, - omEntityDao.getEntityQName(node), - omEntityDao.getStringProperty(Constants.TYPE, props), - buildJsonArray("classification", list)); - } - - private String composeRelationshipQName(Relationship r) { - try { - return String.format("{%s->%s}", - omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(r.getEntityOneProxy().getGUID())), - omEntityDao.getEntityQName(omEntityDao.getEntityByGuid(r.getEntityTwoProxy().getGUID())) - ); - } catch (AnalyticsModelingCheckedException e) { - return r.getGUID(); - } - } - - private void orderEdges(ArrayList edges) { - - Collections.sort(edges, new Comparator() { - @Override - public int compare(Relationship lhs, Relationship rhs) { - return composeRelationshipQName(lhs).compareTo(composeRelationshipQName(rhs)); - } - }); - } - - /** - * Order nodes by qualified name. - * @param nodes to sort. - */ - private void orderNodes(ArrayList nodes) { - Collections.sort(nodes, new Comparator() { - @Override - public int compare(EntityDetail lhs, EntityDetail rhs) { - return omEntityDao.getEntityQName(lhs).compareTo(omEntityDao.getEntityQName(rhs)); - } - }); - } - - /** - * Collect nodes of the graph following the edges from the specified node. - * @param nodes collected - * @param edges followed - * @param guid of the specified node - * @param assetQName - * @throws AnalyticsModelingCheckedException - */ - private void collectRelatedNodes(ArrayList nodes, ArrayList edges, String guid, String assetQName) - throws AnalyticsModelingCheckedException { - - if (nodes.stream() - .map(node->node.getGUID()) - .filter(nodeGuid->guid.equals(nodeGuid)) - .findFirst().isPresent()) - { - // already in the list - return; - } - - EntityDetail start = omEntityDao.getEntityByGuid(guid); - String qName = omEntityDao.getEntityQName(start); - - if (assetQName != null && !qName.startsWith(assetQName)) { - return; // node out of boundaries of the request - } - - nodes.add(start); - - // collect all nodes connected to the start as second end of a relationship - List rels = omEntityDao.getRelationshipsForEntity(start, null) - .stream() - .filter(r->r.getEntityOneProxy().getGUID().equals(guid)) - .collect(Collectors.toList()); - - for (Relationship r : rels) { - String relGuid = r.getGUID(); - - if (edges.stream() - .map(edge->edge.getGUID()) - .filter(edgeGuid->edgeGuid.equals(relGuid)) - .findFirst().isPresent()) - { - // already in the list - continue; - } - - edges.add(r); - collectRelatedNodes(nodes, edges, r.getEntityTwoProxy().getGUID(), assetQName); - } - } - - //---------------------------------------------------------------------------------------------------------------- - // Tests support functions. - //---------------------------------------------------------------------------------------------------------------- - private void createReferencedEntitiesForMetadataLinks(List list, Map guidMap ) - { - if (list == null) { - return; - } - - for (AnalyticsMetadata mtdObject : list) { - - if (mtdObject instanceof MetadataItem) { - if (mtdObject.getSourceGuid() != null) { - for( String orgGuid : mtdObject.getSourceGuid()) { - try { - InstanceProperties columnTypeProperties = new EntityPropertiesBuilder("JUnitTest", "createReferencedEntitiesForMetadataLinks", null) - .withStringProperty(Constants.QUALIFIED_NAME, orgGuid).build(); - - String guid = omEntityDao.createOrUpdateEntity(Constants.RELATIONAL_COLUMN_TYPE, orgGuid, columnTypeProperties, null, false, false) - .getEntityDetail().getGUID(); - - guidMap.put(orgGuid, guid); - } catch (Exception e) { - fail("Failed create referenced entity: " + orgGuid); - } - } - } - } - - if (mtdObject instanceof MetadataContainer) { - createReferencedEntitiesForMetadataLinks(((MetadataContainer) mtdObject).getContainer(), guidMap); - createReferencedEntitiesForMetadataLinks(((MetadataContainer) mtdObject).getItem(), guidMap); - } else if (mtdObject instanceof MetadataItem) { - createReferencedEntitiesForMetadataLinks(((MetadataItem) mtdObject).getItem(), guidMap); - } - } - } - - protected AnalyticsAsset createBean(String input) throws IOException { - String json = TestUtilities.readJsonFile(FOLDER_INPUT, input); - return TestUtilities.readObjectJson(json, AnalyticsAsset.class); - } - - protected AnalyticsAsset createBeanWithAssertion(String input) throws IOException { - AnalyticsAsset asset = createBean(input); - // confirm data read successful - TestUtilities.assertObjectJson(asset, TestUtilities.readJsonFile(FOLDER_MASTER, input)); - return asset; - } - - /** - * Helper function to create JSON definition of the module - * connected to created entities defined by source GUID list. - * @param input - file name to read. - * @return module definition in JSON format - * @throws IOException - */ - protected String getBaseModuleJson(String input) throws IOException { - AnalyticsAsset baseModule = createBean(input); - - // create entities for columns referenced in base module - MapguidMap = new HashMap<>(); - createReferencedEntitiesForMetadataLinks(baseModule.getContainer(), guidMap); - String json = TestUtilities.readJsonFile(FOLDER_INPUT, input); - // replace GUIDs from input with real GUIDs of created entities - for (Entry pair : guidMap.entrySet()) { - json = json.replace(pair.getKey(), pair.getValue()); - } - return json; - } - - /** - * Helper function to create asset definition of the module - * connected to created entities defined by source GUID list. - * @param input - file name to read. - * @return module definition in JSON format - * @throws IOException - */ - protected AnalyticsAsset getBaseModuleAsset(String input) throws IOException { - return TestUtilities.readObjectJson(getBaseModuleJson(input), AnalyticsAsset.class); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/EntityPropertiesBuilder.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/EntityPropertiesBuilder.java deleted file mode 100644 index 477c90857f1..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/EntityPropertiesBuilder.java +++ /dev/null @@ -1,82 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils; - - -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesUtilities; - - -public class EntityPropertiesBuilder { - - private OMRSRepositoryPropertiesUtilities propertyUtils; - - private InstanceProperties instanceProperties; - - String context; - String method; - - - /** - * Default constructor. - * @param context the builder is called from. - * @param method the builder is called from. - * @param properties to build. - */ - public EntityPropertiesBuilder(String context, String method, InstanceProperties properties) { - this.context = context; - this.method = method; - propertyUtils = new OMRSRepositoryPropertiesUtilities(); - instanceProperties = properties; - } - - /** - * Returns the same builder - * - * @param key - name of the property - * @param value - value of the property - * @return the builder to use to return - */ - public EntityPropertiesBuilder withStringProperty(String key, String value) { - - instanceProperties = propertyUtils.addStringPropertyToInstance(context, instanceProperties, key, value, method); - - return this; - } - - /** - * Returns the same builder - * - * @param key - name of the property - * @param value - value of the property - * @return the builder to use to return - */ - public EntityPropertiesBuilder withBooleanProperty(String key, Boolean value) { - - instanceProperties = propertyUtils.addBooleanPropertyToInstance(context, instanceProperties, key, value, method); - - return this; - } - - /** - * Returns the same builder - * - * @param key - name of the property - * @param value - value of the property - * @return the builder to use to return - */ - public EntityPropertiesBuilder withIntegerProperty(String key, Integer value) { - instanceProperties = propertyUtils.addIntPropertyToInstance(context, instanceProperties, key, value, method); - return this; - } - - /** - * Returns the instance properties object - * - * @return properties - */ - public InstanceProperties build() { - return instanceProperties; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/JsonMocks.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/JsonMocks.java deleted file mode 100644 index a99d5d84ae9..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/JsonMocks.java +++ /dev/null @@ -1,97 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils; - -public class JsonMocks { - - public static String getItem(String qName, String name, String id, String exp, String dType) { - return String.format( - "{%n" + - " \"qualifiedName\" : \"%s\",%n" + - " \"additionalProperties\" : {%n" + - " \"p1\" : \"v1\",%n" + - " \"p2\" : \"v2\"%n" + - " },%n" + - " \"displayName\" : \"%s\",%n" + - " \"description\" : \"Query Item description\",%n" + - " \"identifier\" : \"%s\",%n" + - " \"expression\" : \"%s\",%n" + - " \"dataType\" : \"%s\",%n" + - " \"sourceId\" : [ \"uid1\", \"uid2\" ]%n" + - "}", qName, name, id, exp, dType); - } - public static String getBaseModuleQueryItem(String name, String id, String exp, int pos, String dataType, String guid) { - return String.format( - "{%n" + - " \"displayName\" : \"%s\",%n" + - " \"identifier\" : \"%s\",%n" + - " \"elementPosition\" : %d,%n" + - " \"expression\" : \"%s\",%n" + - " \"dataType\" : \"%s\",%n" + - " \"sourceGuid\" : [ \"%s\" ],%n" + - " \"type\" : \"queryItem\"%n" + - "}", name, id, pos, exp, dataType, guid); - } - - public static String getContainer(String qName, String name, String id) { - return String.format( - "{%n" + - " \"qualifiedName\" : \"%s\",%n" + - " \"displayName\" : \"%s\",%n" + - " \"description\" : \"Query Subject description\",%n" + - " \"elementPosition\" : 1,%n" + - " \"identifier\" : \"%s\",%n" + - " \"sourceGuid\" : [ \"guid1\", \"guid2\" ],%n" + - " \"sourceId\" : [ \"uid1\", \"uid2\" ],%n" + - " \"item\" : [ {%n" + - " \"qualifiedName\" : \"PARENT::(SchemaAttribute)=qsID::(SchemaAttribute)=qiID1\",%n" + - " \"displayName\" : \"qiName1\",%n" + - " \"description\" : \"Query Item 1 description\",%n" + - " \"elementPosition\" : 1,%n" + - " \"identifier\" : \"qiID1\",%n" + - " \"expression\" : \"qiExpression1\",%n" + - " \"dataType\" : \"VARCHAR\",%n" + - " \"sourceId\" : [ \"uid1\", \"uid2\" ]%n" + - " }, {%n" + - " \"qualifiedName\" : \"PARENT::(SchemaAttribute)=qsID::(SchemaAttribute)=qiID2\",%n" + - " \"displayName\" : \"qiName2\",%n" + - " \"description\" : \"Query Item 2 description\",%n" + - " \"elementPosition\" : 2,%n" + - " \"identifier\" : \"qiID2\",%n" + - " \"expression\" : \"qiExpression2\",%n" + - " \"dataType\" : \"VARCHAR\",%n" + - " \"sourceId\" : [ \"uid1\", \"uid2\" ]%n" + - " } ]%n" + - "}", qName, name, id); - } - - public static String getEmptyQuerySubject(String name, String id, int position, String guid) { - return String.format( - "{%n" + - " \"displayName\" : \"%s\",%n" + - " \"elementPosition\" : %d,%n" + - " \"identifier\" : \"%s\",%n" + - " \"sourceGuid\" : [ \"%s\" ],%n" + - " \"type\" : \"querySubject\"%n" + - "}", name, position, id, guid); - } - - public static String getNode(String name, String qName, String type, String classification) { - return String.format( - "{%n" + - " \"displayName\" : \"%s\",%n" + - " \"qName\" : \"%s\",%n" + - " \"type\" : \"%s\",%n" + - "%s" + - "}", name, qName, type, classification); - } - - public static String getEdge(String from, String to, String type) { - return String.format( - "{%n" + - " \"from\" : \"%s\",%n" + - " \"to\" : \"%s\",%n" + - " \"type\" : \"%s\"%n" + - "}", from, to, type); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/contentmanager/OMEntityDaoForTests.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/contentmanager/OMEntityDaoForTests.java deleted file mode 100644 index 475a0e24a97..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/contentmanager/OMEntityDaoForTests.java +++ /dev/null @@ -1,374 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.contentmanager; - - -import org.odpi.openmetadata.accessservices.analyticsmodeling.contentmanager.OMEntityDao; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.utils.Constants; -import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLog; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryConnector; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class OMEntityDaoForTests extends OMEntityDao { - - private static final Logger log = LoggerFactory.getLogger(OMEntityDaoForTests.class); - - public OMEntityDaoForTests(OMRSRepositoryConnector enterpriseConnector, List supportedZones, OMRSAuditLog auditLog) { - super (enterpriseConnector, supportedZones, auditLog); - } - - /** - * Returns the newly created entity with the specified properties - * - * @param metadataCollectionId unique identifier for the metadata collection used for adding entities - * @param userName name of the user performing the add operation - * @param typeName of the entity type def - * @param instanceProperties specific to the entity - * @param zoneRestricted - * @return the new entity added to the metadata collection - * @throws ClassificationErrorException - * @throws StatusNotSupportedException - * @throws UserNotAuthorizedException - * @throws InvalidParameterException - * @throws RepositoryErrorException - * @throws PropertyErrorException - * @throws TypeErrorException - */ - private EntityDetail addEntity(String metadataCollectionId, - String userName, - String typeName, - InstanceProperties instanceProperties, - List classifications, - boolean zoneRestricted) throws ClassificationErrorException, StatusNotSupportedException, - UserNotAuthorizedException, InvalidParameterException, - RepositoryErrorException, PropertyErrorException, - TypeErrorException, FunctionNotSupportedException { - EntityDetail entity; - entity = enterpriseConnector.getRepositoryHelper().getSkeletonEntity(Constants.ANALYTICS_MODELING_OMAS_NAME, - metadataCollectionId, - InstanceProvenanceType.LOCAL_COHORT, - userName, - typeName); - entity.setClassifications(classifications); - if(zoneRestricted && supportedZones != null && !supportedZones.isEmpty()){ - instanceProperties = enterpriseConnector.getRepositoryHelper().addStringArrayPropertyToInstance(Constants.ANALYTICS_MODELING_OMAS_NAME, instanceProperties, Constants.ZONE_MEMBERSHIP, supportedZones, "addEntity"); - } - - return enterpriseConnector.getMetadataCollection().addEntity(userName, - entity.getType().getTypeDefGUID(), - instanceProperties, - entity.getClassifications(), - entity.getStatus()); - } - - /** - * Returns the newly created relationship between 2 entities with the specified properties - * - * @param metadataCollectionId unique identifier for the metadata collection used for adding relationships - * @param typeName name of the relationship type def - * @param instanceProperties properties for the relationship - * @param entityOneGUID giud of the first end of the relationship - * @param entityTwoGUID giud of the second end of the relationship - * @return the created relationship - * @throws AnalyticsModelingCheckedException in case of error - */ - private Relationship addRelationship(String metadataCollectionId, - String typeName, - InstanceProperties instanceProperties, - String entityOneGUID, - String entityTwoGUID) throws AnalyticsModelingCheckedException { - - Relationship relationship = null; - try { - relationship = enterpriseConnector.getRepositoryHelper() - .getSkeletonRelationship(Constants.ANALYTICS_MODELING_OMAS_NAME, - metadataCollectionId, - InstanceProvenanceType.LOCAL_COHORT, - Constants.ANALYTICS_MODELING_USER_ID, - typeName); - return enterpriseConnector.getMetadataCollection() - .addRelationship(Constants.ANALYTICS_MODELING_USER_ID, - relationship.getType().getTypeDefGUID(), - instanceProperties, - entityOneGUID, - entityTwoGUID, - InstanceStatus.ACTIVE); - } catch (StatusNotSupportedException | UserNotAuthorizedException | EntityNotKnownException - | InvalidParameterException | RepositoryErrorException | PropertyErrorException - | TypeErrorException | FunctionNotSupportedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.ADD_RELATIONSHIP_EXCEPTION.getMessageDefinition(typeName), - this.getClass().getSimpleName(), - "addRelationship", - ex); - } - } - - public void updateEntityProperty(EntityDetail entity, InstanceProperties newProperties) throws AnalyticsModelingCheckedException { - try { - enterpriseConnector.getMetadataCollection().updateEntityProperties(Constants.ANALYTICS_MODELING_USER_ID, - entity.getGUID(), - newProperties); - } catch (InvalidParameterException | RepositoryErrorException | EntityNotKnownException - | PropertyErrorException | UserNotAuthorizedException | FunctionNotSupportedException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.UPDATE_PROPERTY_EXCEPTION.getMessageDefinition(getEntityQName(entity), newProperties.toString()), - this.getClass().getSimpleName(), - "updateEntityProperty", - ex); - - - } - } - - public void classifyEntity(EntityDetail entity, String classificationName, InstanceProperties classificationProperties) throws AnalyticsModelingCheckedException { - try { - enterpriseConnector.getMetadataCollection().classifyEntity(Constants.ANALYTICS_MODELING_USER_ID, - entity.getGUID(), - classificationName, - classificationProperties); - } catch (InvalidParameterException | RepositoryErrorException | EntityNotKnownException - | PropertyErrorException | UserNotAuthorizedException | FunctionNotSupportedException - | ClassificationErrorException ex) { - throw new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.CLASSIFICATION_EXCEPTION.getMessageDefinition(getEntityQName(entity), classificationName), - this.getClass().getSimpleName(), - "classifyEntity", - ex); - - } - } - - - /** - * Returns the entity of the specified type retrieved based on qualified name - * - * @param typeName name of the type def for the entity to be retrieved - * @param qualifiedName qualified name property of the entity to be retrieved - * @param zoneRestricted - * @return the existing entity with the given qualified name or null if it doesn't exist - * @throws AnalyticsModelingCheckedException - */ - public EntityDetail getEntity(String typeName, String qualifiedName, boolean zoneRestricted) throws AnalyticsModelingCheckedException { - Map properties = new HashMap<>(); - // GDW - need to convert qualifiedName to exactMatchRegex - String qualifiedNameRegex = enterpriseConnector.getRepositoryHelper().getExactMatchRegex(qualifiedName); - properties.put(Constants.QUALIFIED_NAME, qualifiedNameRegex); - InstanceProperties matchProperties = buildMatchingInstanceProperties(properties, zoneRestricted); - List existingEntities; - existingEntities = findEntities(matchProperties, typeName, Constants.START_FROM, Constants.PAGE_SIZE); - return checkEntities(existingEntities, qualifiedName); - } - - /** - * Returns the entity filtered out from entities list based on qualified name - * - * @param existingEntities the list of entities to search in - * @param qualifiedName qualified name based on which the entity is retrieved - * @return the entity that has the specified qualified name - */ - private EntityDetail checkEntities(List existingEntities, String qualifiedName) { - if (existingEntities == null || existingEntities.isEmpty()) { - return null; - } - return existingEntities.stream().filter(e -> qualifiedName.equals(enterpriseConnector.getRepositoryHelper().getStringProperty(Constants.ANALYTICS_MODELING_OMAS_NAME, Constants.QUALIFIED_NAME, e.getProperties(), "checkEntities"))).findFirst().orElse(null); - } - - /** - * Returns the relationship of the given type between the 2 entities - * - * @param relationshipType is the name of the relationship type - * @param guid1 is guid of first end of relationship - * @param guid2 is guid of the second end f relationship - * @return the relationship of the given type between the two entities; null if it doesn't exist - * @throws AnalyticsModelingCheckedException - */ - private Relationship checkRelationshipExists(String relationshipType, - String guid1, - String guid2) throws AnalyticsModelingCheckedException { - List relationships = getRelationships(relationshipType, guid2); - if (relationships == null || relationships.isEmpty()) { - return null; - } - - return relationships.stream().filter(relationship -> relationship.getType().getTypeDefName().equals(relationshipType) - && checkRelationshipEnds(relationship, guid1, guid2)).findFirst().orElse(null); - } - - public List getRelationships(String relationshipType, String guid) throws AnalyticsModelingCheckedException { - - if (log.isDebugEnabled()) { - log.debug("Retrieving relationships of type {} for entity {}", relationshipType, guid); - } - try { - String relationshipTypeGuid = enterpriseConnector.getRepositoryHelper() - .getTypeDefByName(Constants.ANALYTICS_MODELING_USER_ID, relationshipType) - .getGUID(); - - return enterpriseConnector.getMetadataCollection().getRelationshipsForEntity(Constants.ANALYTICS_MODELING_USER_ID, - guid, - relationshipTypeGuid, - Constants.START_FROM, - Collections.singletonList(InstanceStatus.ACTIVE), - null, - null, - null, - Constants.PAGE_SIZE); - } catch (RepositoryErrorException | UserNotAuthorizedException | EntityNotKnownException | FunctionNotSupportedException | InvalidParameterException | PropertyErrorException | TypeErrorException | PagingErrorException e) { - throw buildRetrieveRelationshipException(guid, relationshipType, e, this.getClass().getName()); - } - } - - private AnalyticsModelingCheckedException buildRetrieveRelationshipException(String guid, String relationshipType, - OMRSCheckedExceptionBase e, String name) { - - return new AnalyticsModelingCheckedException( - AnalyticsModelingErrorCode.GET_RELATIONSHIP_EXCEPTION.getMessageDefinition(relationshipType, guid, name), - this.getClass().getSimpleName(), - "deleteEntity", - e); - } - - /** - * Returns true if the provided relationship is between the 2 specified entities - * - * @param relationship - the relationship instance to be checked - * @param guid1 is the guid of one end - * @param guid2 is the guid of the second end - * @return boolean - */ - private boolean checkRelationshipEnds(Relationship relationship, String guid1, String guid2) { - String end1Guid = relationship.getEntityOneProxy().getGUID(); - String end2Guid = relationship.getEntityTwoProxy().getGUID(); - return (end1Guid.equals(guid1) && end2Guid.equals(guid2)) || (end1Guid.equals(guid2) && end2Guid.equals(guid1)); - } - - /** - * Returns the entity of the given type with the specified qualified name; if it doesn't already exists, it is created with the provided instance properties - * - * @param typeName is the entity type - * @param qualifiedName - qualified name property of the entity, unique for the same entity type - * @param properties specific to the entity type - * @return the existing entity with the given qualified name or the newly created entity with the given qualified name - * @throws InvalidParameterException - * @throws PropertyErrorException - * @throws RepositoryErrorException - * @throws EntityNotKnownException - * @throws FunctionNotSupportedException - * @throws PagingErrorException - * @throws ClassificationErrorException - * @throws UserNotAuthorizedException - * @throws TypeErrorException - * @throws StatusNotSupportedException - * @throws AnalyticsModelingCheckedException - */ - public EntityDetail addEntity(String typeName, - String qualifiedName, - InstanceProperties properties, - boolean zoneRestricted) throws InvalidParameterException, PropertyErrorException, RepositoryErrorException, EntityNotKnownException, FunctionNotSupportedException, PagingErrorException, ClassificationErrorException, UserNotAuthorizedException, TypeErrorException, StatusNotSupportedException, AnalyticsModelingCheckedException { - return addEntity(typeName, qualifiedName, properties, null, zoneRestricted); - } - - - /** - * Returns the entity of the given type with the specified qualified name; if it doesn't already exists, it is created with the provided instance properties - * - * @param typeName is the entity type - * @param qualifiedName - qualified name property of the entity, unique for the same entity type - * @param properties specific to the entity type - * @param classifications classifications to be added to entity - * @param zoneRestricted - * @return the existing entity with the given qualified name or the newly created entity with the given qualified name - * @throws InvalidParameterException - * @throws StatusNotSupportedException - * @throws PropertyErrorException - * @throws EntityNotKnownException - * @throws TypeErrorException - * @throws FunctionNotSupportedException - * @throws PagingErrorException - * @throws ClassificationErrorException - * @throws UserNotAuthorizedException - * @throws RepositoryErrorException - * @throws AnalyticsModelingCheckedException - */ - public EntityDetail addEntity(String typeName, - String qualifiedName, - InstanceProperties properties, - List classifications, - boolean zoneRestricted) throws InvalidParameterException, StatusNotSupportedException, PropertyErrorException, EntityNotKnownException, TypeErrorException, FunctionNotSupportedException, PagingErrorException, ClassificationErrorException, UserNotAuthorizedException, RepositoryErrorException, AnalyticsModelingCheckedException { - - OMEntityWrapper wrapper = createOrUpdateEntity(typeName, - qualifiedName, - properties, - classifications, - false, - zoneRestricted); - return wrapper != null ? wrapper.getEntityDetail() : null; - } - - public OMEntityWrapper createOrUpdateEntity(String typeName, - String qualifiedName, - InstanceProperties properties, - List classifications, - boolean update, - boolean zoneRestricted) throws UserNotAuthorizedException, FunctionNotSupportedException, - InvalidParameterException, RepositoryErrorException, - PropertyErrorException, TypeErrorException, - PagingErrorException, ClassificationErrorException, - StatusNotSupportedException, EntityNotKnownException, AnalyticsModelingCheckedException { - EntityDetail entityDetail; - OMEntityWrapper wrapper; - entityDetail = getEntity(typeName, qualifiedName, zoneRestricted); - if (entityDetail == null) { - entityDetail = addEntity("", Constants.ANALYTICS_MODELING_USER_ID, typeName, properties, classifications, zoneRestricted); - log.debug("Entity with qualified name {} added", qualifiedName); - if(log.isDebugEnabled()) { - log.debug("Entity: {}", entityDetail); - } - wrapper = new OMEntityWrapper(entityDetail, OMEntityWrapper.EntityStatus.NEW); - } else { - log.debug("Entity with qualified name {} already exists", qualifiedName); - if(log.isDebugEnabled()) { - log.debug("Entity: {}", entityDetail); - } - wrapper = new OMEntityWrapper(entityDetail, OMEntityWrapper.EntityStatus.EXISTING); - - } - - return wrapper; - } - - /** - * Returns the relationship of the given type with the specified qualified name; - * if it doesn't already exists, it is created with the provided instance properties - * - * @param relationshipType is the relationship type name - * @param guid1 first end of the relationship - * @param guid2 second end of the relationship - * @param instanceProperties specific to the relationship type - * @return the existing relationship with the given qualified name or the newly created relationship with the given qualified name - * @throws AnalyticsModelingCheckedException - */ - public Relationship addRelationship(String relationshipType, - String guid1, - String guid2, - InstanceProperties instanceProperties) throws AnalyticsModelingCheckedException { - Relationship relationship = checkRelationshipExists(relationshipType, guid1, guid2); - if (relationship == null) { - relationship = addRelationship("", relationshipType, instanceProperties, guid1, guid2); - } - - return relationship; - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/contentmanager/OMEntityWrapper.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/contentmanager/OMEntityWrapper.java deleted file mode 100644 index 281ffaf1805..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/test/utils/contentmanager/OMEntityWrapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.test.utils.contentmanager; - - -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; - -public class OMEntityWrapper { - - private EntityDetail entityDetail; - private EntityStatus entityStatus; - - - public OMEntityWrapper(EntityDetail entityDetail, EntityStatus entityStatus) { - this.entityDetail = entityDetail; - this.entityStatus = entityStatus; - } - - public EntityDetail getEntityDetail() { - return entityDetail; - } - - public void setEntityDetail(EntityDetail entityDetail) { - this.entityDetail = entityDetail; - } - - public EntityStatus getEntityStatus() { - return entityStatus; - } - - public void setEntityStatus(EntityStatus entityStatus) { - this.entityStatus = entityStatus; - } - - public enum EntityStatus { - NEW, - EXISTING, - UPDATED, - DELETED - - } - -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/getModule.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/getModule.json deleted file mode 100644 index fbec60ed6e8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/getModule.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "id" : "GOSALES_dbo", - "type" : "module", - "attributes" : { - "physicalDefinition" : { - "identifier" : "physicalmodule", - "version" : "9.0", - "dataSource" : [ { - "property" : [ { - "name" : "guid", - "value" : "DataSource@GOSALES.dbo" - }, { - "name" : "GlossaryTerm", - "value" : "{\"displayName\":\"Go Sales\",\"guid\":\"GlossaryTerm_DataSource@GOSALES.dbo\"}" - } ], - "schema" : "dbo", - "catalog" : "GOSALES", - "name" : "GOSALES.dbo", - "table" : [ { - "property" : [ { - "name" : "guid", - "value" : "Table@Date" - }, { - "name" : "GlossaryTerm", - "value" : "{\"displayName\":\"Calendar\",\"guid\":\"GlossaryTerm_Table@Date\"}" - } ], - "name" : "Date", - "tableItem" : [ { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@DateKey" - }, { - "name" : "GlossaryTerm", - "value" : "{\"description\":\"Primary key for Date used in sales orders.\",\"displayName\":\"Date Key\",\"guid\":\"GlossaryTerm_Column@DateKey\",\"summary\":\"Primary key for Date.\"}" - } ], - "name" : "DateKey", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Date" - } ], - "name" : "Date", - "vendorType" : "DATETIME", - "nullable" : false, - "datatype" : "TIMESTAMP" - } - } ], - "primaryKey" : [ { - "name" : "PK_Date_DateKey", - "keyedColumn" : [ "DateKey" ] - } ] - }, { - "property" : [ { - "name" : "guid", - "value" : "Table@Location" - } ], - "name" : "Location", - "tableItem" : [ { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Latitude" - } ], - "name" : "Latitude", - "vendorType" : "DECIMAL", - "nullable" : false, - "datatype" : "DECIMAL" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Longitude" - } ], - "name" : "Longitude", - "vendorType" : "DECIMAL", - "nullable" : false, - "datatype" : "DECIMAL" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Destination" - } ], - "name" : "Destination", - "vendorType" : "STRING", - "nullable" : false, - "datatype" : "VARCHAR" - } - } ], - "primaryKey" : [ { - "name" : "PK_Location_Latitude_Longitude", - "keyedColumn" : [ "Latitude", "Longitude" ] - } ] - }, { - "property" : [ { - "name" : "guid", - "value" : "Table@Product" - } ], - "name" : "Product", - "tableItem" : [ { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ProductId" - } ], - "name" : "ProductId", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ProductName" - } ], - "name" : "ProductName", - "vendorType" : "STRING", - "nullable" : false, - "datatype" : "VARCHAR" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ProductDescription" - } ], - "name" : "ProductDescription", - "vendorType" : "STRING", - "nullable" : true, - "datatype" : "VARCHAR" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ProductIntroductionDate" - } ], - "name" : "ProductIntroductionDate", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ProductTerminationDate" - } ], - "name" : "ProductTerminationDate", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - } ], - "foreignKey" : [ { - "name" : "FK_Product_Date_ProductIntroductionDate_ProductTerminationDate", - "fkColumn" : [ { - "pkColumn" : "DateKey", - "pkCatalog" : "GOSALES", - "pkSchema" : "dbo", - "pkTable" : "Date", - "columnName" : "ProductIntroductionDate" - }, { - "pkColumn" : "DateKey", - "pkCatalog" : "GOSALES", - "pkSchema" : "dbo", - "pkTable" : "Date", - "columnName" : "ProductTerminationDate" - } ] - } ], - "primaryKey" : [ { - "name" : "PK_Product_ProductId", - "keyedColumn" : [ "ProductId" ] - } ] - }, { - "property" : [ { - "name" : "guid", - "value" : "Table@Sales" - } ], - "name" : "Sales", - "tableItem" : [ { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ProductId" - } ], - "name" : "ProductId", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@DateKey" - } ], - "name" : "DateKey", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Quantity" - } ], - "name" : "Quantity", - "vendorType" : "INT32", - "nullable" : false, - "datatype" : "INTEGER" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Price" - } ], - "name" : "Price", - "vendorType" : "DECIMAL", - "nullable" : false, - "datatype" : "DECIMAL(19)" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@Discount" - } ], - "name" : "Discount", - "vendorType" : "DECIMAL", - "nullable" : false, - "datatype" : "DECIMAL(19)" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ShipmentDestinationLatitude" - } ], - "name" : "ShipmentDestinationLatitude", - "vendorType" : "DECIMAL", - "nullable" : false, - "datatype" : "DECIMAL" - } - }, { - "column" : { - "property" : [ { - "name" : "guid", - "value" : "Column@ShipmentDestinationLongitude" - } ], - "name" : "ShipmentDestinationLongitude", - "vendorType" : "DECIMAL", - "nullable" : false, - "datatype" : "DECIMAL" - } - } ], - "foreignKey" : [ { - "name" : "FK_Sales_Date_DateKey", - "fkColumn" : [ { - "pkColumn" : "DateKey", - "pkCatalog" : "GOSALES", - "pkSchema" : "dbo", - "pkTable" : "Date", - "columnName" : "DateKey" - } ] - }, { - "name" : "FK_Sales_Location_ShipmentDestinationLatitude_ShipmentDestinationLongitude", - "fkColumn" : [ { - "pkColumn" : "Latitude", - "pkCatalog" : "GOSALES", - "pkSchema" : "dbo", - "pkTable" : "Location", - "columnName" : "ShipmentDestinationLatitude" - }, { - "pkColumn" : "Longitude", - "pkCatalog" : "GOSALES", - "pkSchema" : "dbo", - "pkTable" : "Location", - "columnName" : "ShipmentDestinationLongitude" - } ] - }, { - "name" : "FK_Sales_Product_ProductId", - "fkColumn" : [ { - "pkColumn" : "ProductId", - "pkCatalog" : "GOSALES", - "pkSchema" : "dbo", - "pkTable" : "Product", - "columnName" : "ProductId" - } ] - } ] - } ] - } ] - } - } -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/logback-test.xml b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/logback-test.xml deleted file mode 100644 index 66bb9ee0431..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/logback-test.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/baseModule.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/baseModule.json deleted file mode 100644 index 305e9915e93..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/baseModule.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "displayName" : "dbo", - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "sourceGuid" : [ "databaseGUID:dbo" ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceGuid" : [ "tableGUID:COUNTRY@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "expression" : "COUNTRY", - "dataType" : "VARCHAR", - "sourceGuid" : [ "columnGUID:COUNTRY@COUNTRY@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:COUNTRYCODE@COUNTRY@dbo" ], - "type" : "queryItem" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "sourceGuid" : [ "tableGUID:@SALES@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:SALESCOUNTRYCODE@SALES@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "expression" : "QUANTITY", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:QUANTITY@SALES@dbo" ], - "type" : "queryItem" - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/baseModule2.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/baseModule2.json deleted file mode 100644 index de952e4c0e2..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/baseModule2.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "displayName" : "dbo", - "uid" : "iBASEMODULE2", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria2']/dataSourceConnection[@name='_GOSALES_Egeria2']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "sourceGuid" : [ "databaseGUID:dbo" ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceGuid" : [ "tableGUID:COUNTRY@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "expression" : "COUNTRY", - "dataType" : "VARCHAR", - "sourceGuid" : [ "columnGUID:COUNTRY@COUNTRY@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:COUNTRYCODE@COUNTRY@dbo" ], - "type" : "queryItem" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "sourceGuid" : [ "tableGUID:@SALES@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:SALESCOUNTRYCODE@SALES@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "expression" : "QUANTITY", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:QUANTITY@SALES@dbo" ], - "type" : "queryItem" - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/dashboard.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/dashboard.json deleted file mode 100644 index 820cdaf9af0..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/dashboard.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "displayName" : "EgeriaReport", - "uid" : "iDASHBOARD", - "location": "/content/folder[@name='Egeria']/exploration[@name='CountryMapDashboard']", - "type" : "dashboard", - "reference" : [ { - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "alias" : "M1" - } ], - "visualization" : [ { - "displayName" : "Country Page", - "identifier" : "COUNTRY_PAGE", - "type" : "page", - "container" : [ { - "displayName" : "Country List", - "identifier" : "List1", - "type" : "widget", - "widgetType" : "List", - "item" : [ { - "displayName" : "Country", - "identifier" : "Country", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "type" : "dataItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "expression" : "QUANTITY", - "type" : "dataItem" - } ] - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/module.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/module.json deleted file mode 100644 index ab62675f5d8..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/module.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "displayName" : "_DM_Egeria", - "uid" : "iMODULE", - "location": "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "type" : "module", - "reference" : [ { - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "alias" : "M1" - } ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "type" : "queryItem", - "expression" : "COUNTRY", - "dataType" : "VARCHAR(40)" - - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "sourceId" : [ "M1.SALES" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "type" : "queryItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ], - "item" : [ { - "displayName" : "Adjusted Quantity", - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "0.95*SALES.QUANTITY", - "dataType" : "INTEGER" - }, { - "displayName" : "Country Name", - "identifier" : "COUNTRYNAME", - "sourceId" : [ "COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "upper(COUNTRY.COUNTRYCODE)", - "dataType" : "VARCHAR(40)" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/moduleReferences.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/moduleReferences.json deleted file mode 100644 index d57b1c1548f..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/moduleReferences.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "displayName" : "_DM_Egeria", - "uid" : "iMODULE", - "location": "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "type" : "module", - "reference" : [ { - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "alias" : "M1" - } ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "type" : "queryItem", - "expression" : "promptForCountry()", - "dataType" : "VARCHAR(40)" - - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRY", "M1.COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "COUNTRYCODE + COUNTRY", - "dataType" : "INTEGER" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "sourceId" : [ "M1.SALES" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "type" : "queryItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ], - "item" : [ { - "displayName" : "Adjusted Quantity", - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY", "SALES.SALESCOUNTRYCODE" ], - "type" : "queryItem", - "expression" : "if (SALES.SALESCOUNTRYCODE == 'CAN') then 0.95*SALES.QUANTITY else SALES.QUANTITY end", - "dataType" : "INTEGER" - }, { - "displayName" : "Country Name", - "identifier" : "COUNTRYNAME", - "sourceId" : [ "COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "upper(COUNTRY.COUNTRYCODE)", - "dataType" : "VARCHAR(40)" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/moduleShort.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/moduleShort.json deleted file mode 100644 index d6b1e0be5b3..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/moduleShort.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "displayName" : "_DM_Egeria", - "uid" : "iMODULE", - "location": "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "type" : "module", - "reference" : [ { - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "alias" : "M1" - } ], - "container" : [ { - "displayName" : "Sales", - "identifier" : "SALES", - "sourceId" : [ "M1.SALES" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ], - "item" : [ { - "displayName" : "Country Name", - "identifier" : "COUNTRYNAME", - "sourceId" : [ "COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "upper(COUNTRY.COUNTRYCODE)", - "dataType" : "VARCHAR(40)" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/report.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/report.json deleted file mode 100644 index 13f97184280..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/report.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "displayName" : "EgeriaReport", - "uid" : "iREPORT", - "location": "/content/folder[@name='Egeria']/report[@name='EgeriaReport']", - "type" : "report", - "reference" : [ { - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "alias" : "M1" - } ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "additionalProperties" : { - "autoSummary" : "true" - }, - "type" : "query", - "sourceId" : [ "M1.COUNTRY" ], - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "expression" : "COUNTRY", - "dataType" : "VARCHAR(40)", - "additionalProperties" : { - "aggregate" : "none" - }, - "type" : "dataItem" - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRYCODE" ], - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER", - "additionalProperties" : { - "aggregate" : "none" - }, - "type" : "dataItem" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "type" : "query", - "sourceId" : [ "M1.SALES" ], - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER", - "additionalProperties" : { - "aggregate" : "none" - }, - "type" : "dataItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "expression" : "QUANTITY", - "dataType" : "INTEGER", - "additionalProperties" : { - "aggregate" : "total" - }, - "type" : "dataItem" - } ] - } ], - "item" : [ { - "displayName" : "Adjusted Quantity", - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "expression" : "0.95*SALES.QUANTITY", - "dataType" : "INTEGER", - "type" : "dataItem" - } ], - "visualization" : [ { - "displayName" : "Country Page", - "identifier" : "COUNTRY_PAGE", - "type" : "page", - "container" : [ { - "displayName" : "Country List", - "identifier" : "List1", - "type" : "widget", - "widgetType" : "List", - "item" : [ { - "displayName" : "Country", - "identifier" : "Country", - "sourceId" : [ "COUNTRY.COUNTRY" ], - "type" : "dataItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "expression" : "QUANTITY", - "type" : "dataItem" - } ] - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/report2.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/report2.json deleted file mode 100644 index 1d4eb3d42d3..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/input/report2.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "displayName" : "EgeriaReport", - "uid" : "iREPORT", - "location": "/content/folder[@name='Egeria']/report[@name='EgeriaReport']", - "type" : "report", - "reference" : [ { - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "alias" : "M1" - } ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "additionalProperties" : { - "autoSummary" : "true" - }, - "type" : "query", - "sourceId" : [ "M1.COUNTRY" ], - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "expression" : "COUNTRY", - "dataType" : "VARCHAR(40)", - "additionalProperties" : { - "aggregate" : "none" - }, - "type" : "dataItem" - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRYCODE" ], - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER", - "additionalProperties" : { - "aggregate" : "none" - }, - "type" : "dataItem" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "type" : "query", - "sourceId" : [ "M1.SALES" ], - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER", - "additionalProperties" : { - "aggregate" : "none" - }, - "type" : "dataItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "expression" : "QUANTITY", - "dataType" : "INTEGER", - "additionalProperties" : { - "aggregate" : "total" - }, - "type" : "dataItem" - } ] - } ], - "item" : [ { - "displayName" : "Adjusted Quantity", - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "expression" : "0.95*SALES.QUANTITY", - "dataType" : "INTEGER", - "type" : "dataItem" - } ], - "visualization" : [ { - "displayName" : "Country Page", - "identifier" : "COUNTRY_PAGE", - "type" : "page", - "container" : [ { - "displayName" : "Country List", - "identifier" : "List1", - "type" : "widget", - "widgetType" : "List", - "item" : [ { - "displayName" : "Country", - "identifier" : "Country", - "sourceId" : [ "COUNTRY.COUNTRY" ], - "type" : "dataItem" - }, { - "displayName" : "Quantity Adjusted", - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "ADJUSTEDQUANTITY" ], - "expression" : "ADJUSTEDQUANTITY", - "type" : "dataItem" - } ] - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModule.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModule.json deleted file mode 100644 index df9aaa3c6b2..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModule.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "displayName" : "dbo", - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "sourceGuid" : [ "databaseGUID:dbo" ], - "container" : [ { - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "COUNTRY", - "sourceGuid" : [ "tableGUID:COUNTRY@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "COUNTRY", - "sourceGuid" : [ "columnGUID:COUNTRY@COUNTRY@dbo" ], - "type" : "queryItem", - "expression" : "COUNTRY", - "dataType" : "VARCHAR" - }, { - "displayName" : "Country Code", - "elementPosition" : 0, - "identifier" : "COUNTRYCODE", - "sourceGuid" : [ "columnGUID:COUNTRYCODE@COUNTRY@dbo" ], - "type" : "queryItem", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER" - } ] - }, { - "displayName" : "Sales", - "elementPosition" : 0, - "identifier" : "SALES", - "sourceGuid" : [ "tableGUID:@SALES@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "elementPosition" : 0, - "identifier" : "SALESCOUNTRYCODE", - "sourceGuid" : [ "columnGUID:SALESCOUNTRYCODE@SALES@dbo" ], - "type" : "queryItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "displayName" : "Quantity", - "elementPosition" : 0, - "identifier" : "QUANTITY", - "sourceGuid" : [ "columnGUID:QUANTITY@SALES@dbo" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleAsset.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleAsset.json deleted file mode 100644 index 0109ead1a64..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleAsset.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "displayName" : "dbo", - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "sourceGuid" : [ "databaseGUID:dbo" ], - "container" : [ { - "displayName" : "Country", - "elementPosition" : 1, - "identifier" : "COUNTRY", - "sourceGuid" : [ "tableGUID:COUNTRY@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "elementPosition" : 1, - "identifier" : "COUNTRY", - "sourceGuid" : [ "columnGUID:COUNTRY@COUNTRY@dbo" ], - "type" : "queryItem", - "expression" : "COUNTRY", - "dataType" : "VARCHAR" - }, { - "displayName" : "Country Code", - "elementPosition" : 2, - "identifier" : "COUNTRYCODE", - "sourceGuid" : [ "columnGUID:COUNTRYCODE@COUNTRY@dbo" ], - "type" : "queryItem", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER" - } ] - }, { - "displayName" : "Sales", - "elementPosition" : 2, - "identifier" : "SALES", - "sourceGuid" : [ "tableGUID:@SALES@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "elementPosition" : 1, - "identifier" : "SALESCOUNTRYCODE", - "sourceGuid" : [ "columnGUID:SALESCOUNTRYCODE@SALES@dbo" ], - "type" : "queryItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "displayName" : "Quantity", - "elementPosition" : 2, - "identifier" : "QUANTITY", - "sourceGuid" : [ "columnGUID:QUANTITY@SALES@dbo" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleAssetUpdate.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleAssetUpdate.json deleted file mode 100644 index 4d8d7090e07..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleAssetUpdate.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "additionalProperties" : { - "uid" : "iBASEMODULE", - "location" : "UPDATED: CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "lastModified" : "UPDATED: TimeStamp", - "type" : "baseModule" - }, - "guid" : "bce54b72-afa8-4ee6-b7d0-b2bb7632e8bd", - "displayName" : "UPDATED: dbo", - "description" : "UPDATED: This is for testing description persistance.", - "uid" : "iBASEMODULE", - "location" : "UPDATED: CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "type" : "baseModule", - "lastModified" : "UPDATED: TimeStamp" -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleNewIdentifierSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleNewIdentifierSubgraph.json deleted file mode 100644 index 1b1b1943821..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleNewIdentifierSubgraph.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "node" : [ { - "displayName" : "dbo", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "type" : "null", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1::(SchemaAttribute)=COUNTRY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1::(SchemaAttribute)=COUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1::(SchemaAttribute)=COUNTRY", - "to" : "columnGUID:COUNTRY@COUNTRY@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY1::(SchemaAttribute)=COUNTRYCODE", - "to" : "columnGUID:COUNTRYCODE@COUNTRY@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "columnGUID:QUANTITY@SALES@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "columnGUID:SALESCOUNTRYCODE@SALES@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleSubgraph.json deleted file mode 100644 index ffe22df768d..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/baseModuleSubgraph.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "node" : [ { - "displayName" : "dbo", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "type" : "null", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(ComplexSchemaType)=null", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "to" : "columnGUID:COUNTRY@COUNTRY@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "to" : "columnGUID:COUNTRYCODE@COUNTRY@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "columnGUID:QUANTITY@SALES@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "columnGUID:SALESCOUNTRYCODE@SALES@dbo", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/container.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/container.json deleted file mode 100644 index 626dfed4e7b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/container.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "qualifiedName" : "PARENT::(SchemaAttribute)=qsID", - "additionalProperties" : { - "p1" : "v1", - "p2" : "v2" - }, - "displayName" : "displayNameQS", - "description" : "Query Subject description", - "elementPosition" : 1, - "identifier" : "qsID", - "sourceGuid" : [ "guid1", "guid2" ], - "sourceId" : [ "uid1", "uid2" ], - "item" : [ { - "qualifiedName" : "PARENT::(SchemaAttribute)=qsID::(SchemaAttribute)=qiID1", - "additionalProperties" : { - "p1" : "v1", - "p2" : "v2" - }, - "displayName" : "qiName1", - "description" : "Query Item description", - "elementPosition" : 0, - "identifier" : "qiID1", - "sourceId" : [ "uid1", "uid2" ], - "expression" : "qiExpression1", - "dataType" : "VARCHAR(1)" - }, { - "qualifiedName" : "PARENT::(SchemaAttribute)=qsID::(SchemaAttribute)=qiID2", - "additionalProperties" : { - "p1" : "v1", - "p2" : "v2" - }, - "displayName" : "qiName2", - "description" : "Query Item description", - "elementPosition" : 0, - "identifier" : "qiID2", - "sourceId" : [ "uid1", "uid2" ], - "expression" : "qiExpression2", - "dataType" : "VARCHAR(2)" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/containerPartial.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/containerPartial.json deleted file mode 100644 index 9c80fa75392..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/containerPartial.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "qualifiedName" : "PARENT::(SchemaAttribute)=qsID", - "displayName" : "displayNameQS", - "description" : "Query Subject description", - "elementPosition" : 1, - "identifier" : "qsID", - "sourceGuid" : [ "guid1", "guid2" ], - "sourceId" : [ "uid1", "uid2" ], - "item" : [ { - "qualifiedName" : "PARENT::(SchemaAttribute)=qsID::(SchemaAttribute)=qiID1", - "displayName" : "qiName1", - "description" : "Query Item 1 description", - "elementPosition" : 1, - "identifier" : "qiID1", - "sourceId" : [ "uid1", "uid2" ], - "expression" : "qiExpression1", - "dataType" : "VARCHAR" - }, { - "qualifiedName" : "PARENT::(SchemaAttribute)=qsID::(SchemaAttribute)=qiID2", - "displayName" : "qiName2", - "description" : "Query Item 2 description", - "elementPosition" : 2, - "identifier" : "qiID2", - "sourceId" : [ "uid1", "uid2" ], - "expression" : "qiExpression2", - "dataType" : "VARCHAR" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboard.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboard.json deleted file mode 100644 index 95abc64e229..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboard.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "displayName" : "EgeriaReport", - "uid" : "iDASHBOARD", - "location" : "/content/folder[@name='Egeria']/exploration[@name='CountryMapDashboard']", - "type" : "dashboard", - "reference" : [ { - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "alias" : "M1" - } ], - "visualization" : [ { - "displayName" : "Country Page", - "elementPosition" : 0, - "identifier" : "COUNTRY_PAGE", - "type" : "page", - "container" : [ { - "displayName" : "Country List", - "elementPosition" : 0, - "identifier" : "List1", - "type" : "widget", - "item" : [ { - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "Country", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "type" : "dataItem" - }, { - "displayName" : "Quantity", - "elementPosition" : 0, - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "dataItem", - "expression" : "QUANTITY" - } ] - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboardDisconnectedSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboardDisconnectedSubgraph.json deleted file mode 100644 index e126757ea3a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboardDisconnectedSubgraph.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "node" : [ { - "displayName" : "EgeriaReport", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD", - "type" : "dashboard", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(ComplexSchemaType)=dashboard", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country Page", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "page", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country List", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "widget", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(ComplexSchemaType)=dashboard", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(ComplexSchemaType)=dashboard", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboardSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboardSubgraph.json deleted file mode 100644 index 34e94c1f930..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/dashboardSubgraph.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "node" : [ { - "displayName" : "EgeriaReport", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD", - "type" : "dashboard", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(ComplexSchemaType)=dashboard", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country Page", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "page", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country List", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "widget", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(ComplexSchemaType)=dashboard", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(ComplexSchemaType)=dashboard", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iDASHBOARD::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/item.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/item.json deleted file mode 100644 index dd970880994..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/item.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "qualifiedName" : "PARENT::(SchemaAttribute)=qiID", - "additionalProperties" : { - "p1" : "v1", - "p2" : "v2" - }, - "displayName" : "displayName", - "description" : "Query Item description", - "elementPosition" : 1, - "identifier" : "qiID", - "sourceGuid" : [ "guid1", "guid2" ], - "sourceId" : [ "uid1", "uid2" ], - "expression" : "qiExpression", - "dataType" : "VARCHAR" -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/itemPartial.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/itemPartial.json deleted file mode 100644 index 195f3ce6334..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/itemPartial.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "qualifiedName" : "PARENT::(SchemaAttribute)=qiID", - "additionalProperties" : { - "p1" : "v1", - "p2" : "v2" - }, - "displayName" : "displayName", - "description" : "Query Item description", - "elementPosition" : 0, - "identifier" : "qiID", - "sourceId" : [ "uid1", "uid2" ], - "expression" : "qiExpression", - "dataType" : "VARCHAR" -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/module2Subgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/module2Subgraph.json deleted file mode 100644 index bc7403a5de4..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/module2Subgraph.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "node" : [ { - "displayName" : "_DM_Egeria", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "module", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Adjusted Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Name", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE2", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE2::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE2::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE2::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE2::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleAsset.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleAsset.json deleted file mode 100644 index ecdcb4b7273..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleAsset.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "displayName" : "_DM_Egeria", - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "type" : "module", - "reference" : [ { - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "guid" : "XXX-YYY", - "alias" : "M1" - } ], - "container" : [ { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "displayName" : "Country", - "elementPosition" : 1, - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY" ], - "type" : "querySubject", - "item" : [ { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "displayName" : "Country", - "elementPosition" : 1, - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "type" : "queryItem", - "expression" : "COUNTRY", - "dataType" : "VARCHAR(40)" - }, { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "displayName" : "Country Code", - "elementPosition" : 2, - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER" - } ] - }, { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "displayName" : "Sales", - "elementPosition" : 2, - "identifier" : "SALES", - "sourceId" : [ "M1.SALES" ], - "type" : "querySubject", - "item" : [ { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "displayName" : "Sales Country Code", - "elementPosition" : 1, - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "type" : "queryItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "displayName" : "Quantity", - "elementPosition" : 2, - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ], - "item" : [ { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "displayName" : "Adjusted Quantity", - "elementPosition" : 1, - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "0.95*SALES.QUANTITY", - "dataType" : "INTEGER" - }, { - "qualifiedName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "displayName" : "Country Name", - "elementPosition" : 2, - "identifier" : "COUNTRYNAME", - "sourceId" : [ "COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "upper(COUNTRY.COUNTRYCODE)", - "dataType" : "VARCHAR(40)" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleAssetRaw.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleAssetRaw.json deleted file mode 100644 index 6d0162db887..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleAssetRaw.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "displayName" : "_DM_Egeria", - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "type" : "module", - "reference" : [ { - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "alias" : "M1" - } ], - "container" : [ { - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "type" : "queryItem", - "expression" : "COUNTRY", - "dataType" : "VARCHAR(40)" - }, { - "displayName" : "Country Code", - "elementPosition" : 0, - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER" - } ] - }, { - "displayName" : "Sales", - "elementPosition" : 0, - "identifier" : "SALES", - "sourceId" : [ "M1.SALES" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "elementPosition" : 0, - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "type" : "queryItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "displayName" : "Quantity", - "elementPosition" : 0, - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ], - "item" : [ { - "displayName" : "Adjusted Quantity", - "elementPosition" : 0, - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "type" : "queryItem", - "expression" : "0.95*SALES.QUANTITY", - "dataType" : "INTEGER" - }, { - "displayName" : "Country Name", - "elementPosition" : 0, - "identifier" : "COUNTRYNAME", - "sourceId" : [ "COUNTRY.COUNTRYCODE" ], - "type" : "queryItem", - "expression" : "upper(COUNTRY.COUNTRYCODE)", - "dataType" : "VARCHAR(40)" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleReferencesSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleReferencesSubgraph.json deleted file mode 100644 index 4940afae3fa..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleReferencesSubgraph.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "node" : [ { - "displayName" : "_DM_Egeria", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "module", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Adjusted Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Name", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleRemovedReferenceSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleRemovedReferenceSubgraph.json deleted file mode 100644 index fc997d9df2a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleRemovedReferenceSubgraph.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "node" : [ { - "displayName" : "_DM_Egeria", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "module", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Adjusted Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Name", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleShortSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleShortSubgraph.json deleted file mode 100644 index c90236f515e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleShortSubgraph.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "node" : [ { - "displayName" : "_DM_Egeria", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "module", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country Name", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleSubgraph.json deleted file mode 100644 index e6aee50c078..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/moduleSubgraph.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "node" : [ { - "displayName" : "_DM_Egeria", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "module", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Adjusted Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Name", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "querySubject", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "queryItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(ComplexSchemaType)=module", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRYNAME", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iBASEMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/report.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/report.json deleted file mode 100644 index afa35048290..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/report.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "displayName" : "EgeriaReport", - "uid" : "iREPORT", - "location" : "/content/folder[@name='Egeria']/report[@name='EgeriaReport']", - "type" : "report", - "reference" : [ { - "uid" : "iMODULE", - "location" : "CAMID(\"::Anonymous\")/folder[@name='My Folders']/folder[@name='Egeria']/module[@name='_DM_Egeria']", - "alias" : "M1" - } ], - "container" : [ { - "additionalProperties" : { - "autoSummary" : "true" - }, - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY" ], - "type" : "query", - "item" : [ { - "additionalProperties" : { - "aggregate" : "none" - }, - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "COUNTRY", - "sourceId" : [ "M1.COUNTRY.COUNTRY" ], - "type" : "dataItem", - "expression" : "COUNTRY", - "dataType" : "VARCHAR(40)" - }, { - "additionalProperties" : { - "aggregate" : "none" - }, - "displayName" : "Country Code", - "elementPosition" : 0, - "identifier" : "COUNTRYCODE", - "sourceId" : [ "M1.COUNTRY.COUNTRYCODE" ], - "type" : "dataItem", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER" - } ] - }, { - "displayName" : "Sales", - "elementPosition" : 0, - "identifier" : "SALES", - "sourceId" : [ "M1.SALES" ], - "item" : [ { - "additionalProperties" : { - "aggregate" : "none" - }, - "displayName" : "Sales Country Code", - "elementPosition" : 0, - "identifier" : "SALESCOUNTRYCODE", - "sourceId" : [ "M1.SALES.SALESCOUNTRYCODE" ], - "type" : "dataItem", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER" - }, { - "additionalProperties" : { - "aggregate" : "total" - }, - "displayName" : "Quantity", - "elementPosition" : 0, - "identifier" : "QUANTITY", - "sourceId" : [ "M1.SALES.QUANTITY" ], - "type" : "dataItem", - "expression" : "QUANTITY", - "dataType" : "INTEGER" - } ] - } ], - "item" : [ { - "displayName" : "Adjusted Quantity", - "elementPosition" : 0, - "identifier" : "ADJUSTEDQUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "type" : "dataItem", - "expression" : "0.95*SALES.QUANTITY", - "dataType" : "INTEGER" - } ], - "visualization" : [ { - "displayName" : "Country Page", - "elementPosition" : 0, - "identifier" : "COUNTRY_PAGE", - "type" : "page", - "container" : [ { - "displayName" : "Country List", - "elementPosition" : 0, - "identifier" : "List1", - "type" : "widget", - "item" : [ { - "displayName" : "Country", - "elementPosition" : 0, - "identifier" : "Country", - "sourceId" : [ "COUNTRY.COUNTRY" ], - "type" : "dataItem" - }, { - "displayName" : "Quantity", - "elementPosition" : 0, - "identifier" : "QUANTITY", - "sourceId" : [ "SALES.QUANTITY" ], - "type" : "dataItem", - "expression" : "QUANTITY" - } ] - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/report2Subgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/report2Subgraph.json deleted file mode 100644 index f6e09a9e86e..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/report2Subgraph.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "node" : [ { - "displayName" : "EgeriaReport", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT", - "type" : "report", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(ComplexSchemaType)=report", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country Page", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "page", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country List", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "widget", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity Adjusted", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(ComplexSchemaType)=report", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(ComplexSchemaType)=report", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/reportModuleSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/reportModuleSubgraph.json deleted file mode 100644 index d7bef3fa238..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/reportModuleSubgraph.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "node" : [ { - "displayName" : "EgeriaReport", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT", - "type" : "report", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(ComplexSchemaType)=report", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Adjusted Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY", - "type" : "query", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES", - "type" : "query", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Sales Country Code", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(ComplexSchemaType)=report", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(ComplexSchemaType)=report", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=ADJUSTEDQUANTITY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(ComplexSchemaType)=report", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(ComplexSchemaType)=report", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=ADJUSTEDQUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE::(SchemaAttribute)=SALES::(SchemaAttribute)=SALESCOUNTRYCODE", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/reportSubgraph.json b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/reportSubgraph.json deleted file mode 100644 index 097c8649ffe..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/test/resources/synchronization/master/reportSubgraph.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "node" : [ { - "displayName" : "EgeriaReport", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT", - "type" : "report", - "classification" : [ "LatestChange" ] - }, { - "displayName" : "null", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(ComplexSchemaType)=report", - "type" : "null", - "classification" : [ "Anchors" ] - }, { - "displayName" : "Country Page", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "page", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country List", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "widget", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Country", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - }, { - "displayName" : "Quantity", - "qName" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "type" : "dataItem", - "classification" : [ "Anchors", "TypeEmbeddedAttribute" ] - } ], - "edge" : [ { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(ComplexSchemaType)=report", - "type" : "AssetSchemaType" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iMODULE", - "type" : "DataContentForDataSet" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(ComplexSchemaType)=report", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE", - "type" : "AttributeForSchema" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "type" : "NestedSchemaAttribute" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=Country", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=COUNTRY::(SchemaAttribute)=COUNTRY", - "type" : "DerivedSchemaTypeQueryTarget" - }, { - "from" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(DeployedReport)=iREPORT::(SchemaAttribute)=COUNTRY_PAGE::(SchemaAttribute)=List1::(SchemaAttribute)=QUANTITY", - "to" : "(SoftwareServerCapability)=http://localhost:9300/p2pd/servlet::(InformationView)=iREPORT::(SchemaAttribute)=SALES::(SchemaAttribute)=QUANTITY", - "type" : "DerivedSchemaTypeQueryTarget" - } ] -} \ No newline at end of file diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/build.gradle b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/build.gradle deleted file mode 100644 index 68c30c0519a..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright Contributors to the ODPi Egeria project. - */ - - -dependencies { - implementation 'org.springframework:spring-web' - implementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-server') - implementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api') - implementation 'javax.validation:validation-api' - implementation 'io.swagger.core.v3:swagger-annotations' - testImplementation 'org.junit.jupiter:junit-jupiter-engine' - testImplementation 'org.junit.jupiter:junit-jupiter-api' - testImplementation 'org.mockito:mockito-core' - testImplementation 'org.mockito:mockito-junit-jupiter' - compileOnly 'com.fasterxml.jackson.core:jackson-annotations' - testImplementation project(':open-metadata-implementation:frameworks:open-connector-framework') - testImplementation project(':open-metadata-implementation:frameworks:audit-log-framework') - testImplementation project(':open-metadata-implementation:common-services:ffdc-services') - testImplementation project(':open-metadata-implementation:common-services:multi-tenant') - -} - -description = 'Analytics Modeling OMAS Spring' - -java { - withJavadocJar() -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/spring/AnalyticsModelingOMASResource.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/spring/AnalyticsModelingOMASResource.java deleted file mode 100644 index b83e6cdb1ff..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/spring/AnalyticsModelingOMASResource.java +++ /dev/null @@ -1,197 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.server.spring; - -import io.swagger.v3.oas.annotations.ExternalDocumentation; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; - -import javax.validation.constraints.PositiveOrZero; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AnalyticsModelingOMASAPIResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.server.AnalyticsModelingRestServices; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - - - -@RestController -@RequestMapping("/servers/{serverName}/open-metadata/access-services/analytics-modeling/users/{userId}/") - -@Tag(name="Analytics Modeling OMAS", - description="The Analytics Modeling OMAS queries RDBMS metadata from repository and creates module for database schema.", - externalDocs=@ExternalDocumentation(description="Analytics Modeling Open Metadata Access Service (OMAS)", - url="https://egeria-project.org/services/omas/analytics-modeling/overview/")) - - -public class AnalyticsModelingOMASResource { - - private AnalyticsModelingRestServices restAPI = new AnalyticsModelingRestServices(); - - /** - * Get list of databases. - * @param serverName unique identifier for requested server. - * @param userId the unique identifier for the user - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return Analytics Modeling response contains list of databases. - */ - @Operation(summary = "Get list of databases") - @GetMapping(path = "/databases") - public AnalyticsModelingOMASAPIResponse getDatabases( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @PositiveOrZero(message = "startFrom should be a positive number") - @RequestParam Integer startFrom, - @PositiveOrZero(message = "pageSize should be a positive number") - @RequestParam Integer pageSize - ) - { - return restAPI.getDatabases(serverName, userId, startFrom, pageSize); - } - - /** - * Get list of schemas of a given database. - * @param serverName unique identifier for requested server. - * @param userId the unique identifier for the user - * @param database database GUID. - * @param startFrom starting element (used in paging through large result sets) - * @param pageSize maximum number of results to return - * @return Analytics Modeling response contains list of database schemas. - */ - @Operation(summary = "Get list of schemas of a given database") - @GetMapping(path = "/{databaseGUID}/schemas") - public AnalyticsModelingOMASAPIResponse getSchemas( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @PathVariable("databaseGUID") String database, - @PositiveOrZero(message = "startFrom should be a positive number") - @RequestParam Integer startFrom, - @PositiveOrZero(message = "pageSize should be a positive number") - @RequestParam Integer pageSize - ) - { - return restAPI.getSchemas(serverName, userId, database, startFrom, pageSize); - } - - /** - * Get list of tables of a given database, catalog and schema. - * @param serverName unique identifier for requested server. - * @param userId the unique identifier for the user - * @param database data source id. - * @param catalog of the db. - * @param schema of the db. - * @return Analytics Modeling response contains list of tables in the database schema. - */ - @Operation(summary = "Get list of tables of a given database, catalog and schema") - @PostMapping(path = "/{databaseGUID}/tables") - public AnalyticsModelingOMASAPIResponse getTables( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @PathVariable("databaseGUID") String database, - @RequestParam(required = false) String catalog, - @RequestParam(required = true) String schema - ) - { - return restAPI.getTables(serverName, userId, database, schema); - } - - /** - * Get physical module of a given database, catalog and schema. - * @param serverName unique identifier for requested server. - * @param userId the unique identifier for the user - * @param database database guid. - * @param catalog of the db. - * @param schema of the db. - * @param request body. - * @return Analytics Modeling module for the database schema. - */ - @Operation(summary = "Get physical module of a given database, catalog and schema") - @PostMapping(path = "/{databaseGUID}/physicalModule") - public AnalyticsModelingOMASAPIResponse getPhysicalModule( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @PathVariable("databaseGUID") String database, - @RequestParam(required=false) String catalog, - @RequestParam(required=true) String schema, - @RequestBody(required=false) ModuleTableFilter request - ) { - - return restAPI.getModule(serverName, userId, database, catalog, schema, request); - } - - - /** - * Create assets in repository defined by artifact (body of the request). - * @param serverName unique identifier for requested server. - * @param userId request user - * @param serverCapability where the artifact is stored. - * @param serverCapabilityGUID where the artifact is stored. - * @param artifact definition json. - * @return errors or list of created assets. - */ - @Operation(summary = "Create assets representing analytics artifact.") - @PostMapping(path = "/sync") - public AnalyticsModelingOMASAPIResponse createArtifact( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @RequestParam(required=true) String serverCapability, - @RequestParam(required=false) String serverCapabilityGUID, - @RequestBody(required=true) AnalyticsAsset artifact - ) { - - return restAPI.createArtifact(serverName, userId, serverCapability, serverCapabilityGUID, artifact); - } - - /** - * Update assets in repository defined by artifact (body of the request). - * @param serverName unique identifier for requested server. - * @param userId request user - * @param serverCapability where the artifact is stored. - * @param serverCapabilityGUID where the artifact is stored. - * @param artifact from json definition. - * @return errors or list of created assets. - */ - @Operation(summary = "Update assets representing analytics artifact.") - @PutMapping(path = "/sync") - public AnalyticsModelingOMASAPIResponse updateArtifact( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @RequestParam(required=true) String serverCapability, - @RequestParam(required=false) String serverCapabilityGUID, - @RequestBody(required=true) AnalyticsAsset artifact - ) { - - return restAPI.updateArtifact(serverName, userId, serverCapability, serverCapabilityGUID, artifact); - } - - /** - * Delete assets in repository defined by artifact unique identifier. - * @param serverName unique identifier for requested server. - * @param userId request user - * @param serverCapability where the artifact is stored. - * @param serverCapabilityGUID where the artifact is stored. - * @param identifier of the artifact in 3rd party system. - * @return errors or list of created assets. - */ - @Operation(summary = "Delete assets that represent analytics artifact.") - @DeleteMapping(path = "/sync") - public AnalyticsModelingOMASAPIResponse deleteArtifact( - @PathVariable("serverName") String serverName, - @PathVariable("userId") String userId, - @RequestParam(required=true) String serverCapability, - @RequestParam(required=false) String serverCapabilityGUID, - @RequestParam(required=true) String identifier) - { - return restAPI.deleteArtifact(serverName, userId, serverCapability, serverCapabilityGUID, identifier); - } -} diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/spring/AnalyticsModelingOMASResourceTest.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/spring/AnalyticsModelingOMASResourceTest.java deleted file mode 100644 index 03cac2b233b..00000000000 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-spring/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/server/spring/AnalyticsModelingOMASResourceTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.server.spring; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.ArgumentMatchers.*; -import static org.mockito.Mockito.doCallRealMethod; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Answers; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.AnalyticsModelingErrorCode; -import org.odpi.openmetadata.accessservices.analyticsmodeling.ffdc.exceptions.AnalyticsModelingCheckedException; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.AnalyticsModelingOMASAPIResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.responses.ErrorResponse; -import org.odpi.openmetadata.accessservices.analyticsmodeling.server.AnalyticsModelingRestServices; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; - -/** - * The test class verifies proper use of AnalyticsModelingRestServices to handle requests. - */ -@ExtendWith(MockitoExtension.class) -public class AnalyticsModelingOMASResourceTest { - - private static final String REPORT_WRONG_ERROR_DETAILS = "Wrong error details."; - private static final String REPORT_WRONG_ERROR_TITLE = "Wrong error title."; - private static final String REPORT_WRONG_ERROR_CODE = "Wrong error code."; - private static final String REPORT_WRONG_HTTP_STATUS = "'Bad request' http status 400 is expected"; - private static final String REPORT_WRONG_SEVERITY = "Wrong severity."; - - private static final String USER = "user"; - private static final String SERVER_NAME = "serverName"; - private static final Integer FROM = 0; - private static final Integer PAGE_SIZE = 10; - private static final String GUID = "b1c497ce.60641b50.0v9mgsb1m.9vbkmkr"; - private static final String SCHEMA = "schema_name"; - private static final String CATALOG = "catalog_name"; - private static final String DATABASE_GUID = "databaseGUID"; - private static final String HTTP_400= "400"; - - - @InjectMocks - private AnalyticsModelingOMASResource resource = new AnalyticsModelingOMASResource(); - - @Mock(answer = Answers.RETURNS_DEEP_STUBS) - private AnalyticsModelingRestServices restAPI; - - @Test - void getDatabases() { - when(restAPI.getDatabases(SERVER_NAME, USER, FROM, PAGE_SIZE)).thenReturn(null); - resource.getDatabases(SERVER_NAME, USER, FROM, PAGE_SIZE); - verify(restAPI, times(1)).getDatabases(SERVER_NAME, USER, FROM, PAGE_SIZE); - } - - @Test - void getSchemas() { - when(restAPI.getSchemas(SERVER_NAME, USER, GUID, FROM, PAGE_SIZE)).thenReturn(null); - resource.getSchemas(SERVER_NAME, USER, GUID, FROM, PAGE_SIZE); - verify(restAPI, times(1)).getSchemas(SERVER_NAME, USER, GUID, FROM, PAGE_SIZE); - } - - @Test - void getTables() { - when(restAPI.getTables(SERVER_NAME, USER, GUID, SCHEMA)).thenReturn(null); - resource.getTables(SERVER_NAME, USER, GUID, null, SCHEMA); - verify(restAPI, times(1)).getTables(SERVER_NAME, USER, GUID, SCHEMA); - } - - @Test - void getModule() { - when(restAPI.getModule(SERVER_NAME, USER, GUID, CATALOG, SCHEMA, null)).thenReturn(null); - resource.getPhysicalModule(SERVER_NAME, USER, GUID, CATALOG, SCHEMA, null); - verify(restAPI, times(1)).getModule(SERVER_NAME, USER, GUID, CATALOG, SCHEMA, null); - } - - @Test - void getModuleInvalidGUIDParameter() throws AnalyticsModelingCheckedException, InvalidParameterException { - InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - when(restAPI.getModule(SERVER_NAME, USER, null, CATALOG, SCHEMA, null)).thenCallRealMethod(); - when(restAPI.getInvalidParameterHandler()).thenReturn(invalidParameterHandler); - doCallRealMethod().when(restAPI).validateUrlParameters(SERVER_NAME, USER, null, DATABASE_GUID, null, null, "getModule"); - - AnalyticsModelingOMASAPIResponse response = resource.getPhysicalModule(SERVER_NAME, USER, null, CATALOG, SCHEMA, null); - - assertTrue(response instanceof ErrorResponse); - ErrorResponse errResponse = (ErrorResponse)response; - assertEquals( 400, errResponse.getRelatedHTTPCode(), REPORT_WRONG_HTTP_STATUS); - - assertError(errResponse, HTTP_400, - AnalyticsModelingErrorCode.INVALID_REQUEST_PARAMER.getMessageDefinition().getMessageId(), - "OMAS-ANALYTICS-MODELING-015 The request parameter databaseGUID has invalid value.", - "OMAG-COMMON-400-005 The unique identifier (guid) passed on the databaseGUID parameter of the getModule operation is null"); - - verify(restAPI, times(1)).validateUrlParameters(SERVER_NAME, USER, null, DATABASE_GUID, null, null, "getModule"); - } - - private void assertError(ErrorResponse errResponse, String status, String code, String title, String detail) { - assertEquals( status, errResponse.getErrors().get(0).getStatus(), REPORT_WRONG_HTTP_STATUS); - assertEquals( code, errResponse.getErrors().get(0).getCode(), REPORT_WRONG_ERROR_CODE); - assertEquals( title, errResponse.getErrors().get(0).getTitle(), REPORT_WRONG_ERROR_TITLE); - assertEquals( detail, errResponse.getErrors().get(0).getDetail(), REPORT_WRONG_ERROR_DETAILS); - assertEquals( "error", errResponse.getErrors().get(0).getMeta().get("severity"), REPORT_WRONG_SEVERITY); - } - - @Test - void getDatabasesInvalidPageParameter() throws AnalyticsModelingCheckedException, InvalidParameterException { - InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - when(restAPI.getDatabases(anyString(), anyString(), anyInt(), anyInt())).thenCallRealMethod(); - when(restAPI.getInvalidParameterHandler()).thenReturn(invalidParameterHandler); - doCallRealMethod().when(restAPI).validateUrlParameters(anyString(), anyString(), eq(null), eq(null), anyInt(), anyInt(), eq("getDatabases")); - when(restAPI.getInvalidParameterHandler()).thenReturn(invalidParameterHandler); - - AnalyticsModelingOMASAPIResponse response = resource.getDatabases(SERVER_NAME, USER, -1, PAGE_SIZE); - - assertTrue(response instanceof ErrorResponse); - ErrorResponse errResponse = (ErrorResponse)response; - assertEquals( 400, errResponse.getRelatedHTTPCode(), REPORT_WRONG_HTTP_STATUS); - - assertError( errResponse, HTTP_400, - AnalyticsModelingErrorCode.INVALID_REQUEST_PARAMER.getMessageDefinition().getMessageId(), - "OMAS-ANALYTICS-MODELING-015 The request parameter startFrom has invalid value.", - "OMAG-COMMON-400-008 The starting point for the results -1, passed on the startFrom parameter of the getDatabases operation, is negative"); - - response = resource.getDatabases(SERVER_NAME, USER, FROM, -1); - - assertTrue(response instanceof ErrorResponse); - errResponse = (ErrorResponse)response; - assertEquals( 400, errResponse.getRelatedHTTPCode(), REPORT_WRONG_HTTP_STATUS); - assertError( errResponse, HTTP_400, - AnalyticsModelingErrorCode.INVALID_REQUEST_PARAMER.getMessageDefinition().getMessageId(), - "OMAS-ANALYTICS-MODELING-015 The request parameter pageSize has invalid value.", - "OMAG-COMMON-400-009 The page size -1 for the results, passed on the pageSize parameter of the getDatabases operation, is negative"); - - verify(restAPI, times(2)).validateUrlParameters(eq(SERVER_NAME), eq(USER), eq(null), eq(null), anyInt(), anyInt(), eq("getDatabases")); - } - - @Test - void getSchemasInvalidUserIdParameter() throws AnalyticsModelingCheckedException, InvalidParameterException { - InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - when(restAPI.getSchemas(SERVER_NAME, null, GUID, FROM, PAGE_SIZE)).thenCallRealMethod(); - when(restAPI.getInvalidParameterHandler()).thenReturn(invalidParameterHandler); - doCallRealMethod().when(restAPI).validateUrlParameters(SERVER_NAME, null, GUID, DATABASE_GUID, FROM, PAGE_SIZE, "getSchemas"); - - AnalyticsModelingOMASAPIResponse response = resource.getSchemas(SERVER_NAME, null, GUID, FROM, PAGE_SIZE); - - assertTrue(response instanceof ErrorResponse); - ErrorResponse errResponse = (ErrorResponse)response; - assertEquals( 400, errResponse.getRelatedHTTPCode(), REPORT_WRONG_HTTP_STATUS); - assertError( errResponse, HTTP_400, - AnalyticsModelingErrorCode.INVALID_REQUEST_PARAMER.getMessageDefinition().getMessageId(), - "OMAS-ANALYTICS-MODELING-015 The request parameter userId has invalid value.", - "OMAG-COMMON-400-004 The user identifier (user id) passed on the getSchemas operation is null"); - - verify(restAPI, times(1)).validateUrlParameters(SERVER_NAME, null, GUID, DATABASE_GUID, FROM, PAGE_SIZE, "getSchemas"); - } - - @Test - void getTablesInvalidServerParameter() throws AnalyticsModelingCheckedException, InvalidParameterException { - InvalidParameterHandler invalidParameterHandler = new InvalidParameterHandler(); - when(restAPI.getTables(null, USER, GUID, SCHEMA)).thenCallRealMethod(); - when(restAPI.getInvalidParameterHandler()).thenReturn(invalidParameterHandler); - doCallRealMethod().when(restAPI).validateUrlParameters(null, USER, GUID, DATABASE_GUID, null, null, "getTables"); - - AnalyticsModelingOMASAPIResponse response = resource.getTables(null, USER, GUID, CATALOG, SCHEMA); - - assertTrue(response instanceof ErrorResponse); - ErrorResponse errResponse = (ErrorResponse)response; - assertEquals( 400, errResponse.getRelatedHTTPCode(), REPORT_WRONG_HTTP_STATUS); - assertError( errResponse, HTTP_400, - AnalyticsModelingErrorCode.INVALID_REQUEST_PARAMER.getMessageDefinition().getMessageId(), - "OMAS-ANALYTICS-MODELING-015 The request parameter serverName has invalid value.", - "OMAG-COMMON-400-006 The name passed on the serverName parameter of the getTables operation is null"); - - verify(restAPI, times(1)).validateUrlParameters(null, USER, GUID, DATABASE_GUID, null, null, "getTables"); - } - -} diff --git a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/AccessServiceDescription.java b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/AccessServiceDescription.java index a559b785f9e..d5907ad9514 100644 --- a/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/AccessServiceDescription.java +++ b/open-metadata-implementation/admin-services/admin-services-api/src/main/java/org/odpi/openmetadata/adminservices/configuration/registration/AccessServiceDescription.java @@ -47,12 +47,12 @@ public enum AccessServiceDescription implements Serializable "Manage an asset", "https://egeria-project.org/services/omas/asset-owner/overview/"), ANALYTICS_MODELING_OMAS (206, - ComponentDevelopmentStatus.IN_DEVELOPMENT, + ComponentDevelopmentStatus.DEPRECATED, "Analytics Modeling", "Analytics Modeling OMAS", "analytics-modeling", "Provides metadata information for Analytics Modeling.", - "https://egeria-project.org/services/omas/analytics-modeling/overview/"), + ""), COMMUNITY_PROFILE_OMAS (207, ComponentDevelopmentStatus.IN_DEVELOPMENT, "Community Profile", diff --git a/open-metadata-implementation/integration-services/analytics-integrator/README.md b/open-metadata-implementation/integration-services/analytics-integrator/README.md index 391e687b82f..cf834c11340 100644 --- a/open-metadata-implementation/integration-services/analytics-integrator/README.md +++ b/open-metadata-implementation/integration-services/analytics-integrator/README.md @@ -28,7 +28,7 @@ integration connector is able to run under this service. * [analytics-integrator-client](analytics-integrator-client) - implements a Java client for the REST API. -This integration service is paired with the [Analytics Modeling](../../access-services/analytics-modeling) +This integration service is paired with the [Data Science](../../access-services/data-science) Open Metadata Access Service (OMAS). ---- diff --git a/open-metadata-implementation/integration-services/analytics-integrator/analytics-integrator-api/README.md b/open-metadata-implementation/integration-services/analytics-integrator/analytics-integrator-api/README.md index b7f89869c75..48f09a0b49e 100644 --- a/open-metadata-implementation/integration-services/analytics-integrator/analytics-integrator-api/README.md +++ b/open-metadata-implementation/integration-services/analytics-integrator/analytics-integrator-api/README.md @@ -8,7 +8,7 @@ the specific context for an integration connector that is managed by this integr The context is the means that the connector has to exchange metadata with the open metadata ecosystem. Its methods closely follow the methods of the integration service's partner Open Metadata Access Service (OMAS). -That is the [Analytics Modeling OMAS](../../../access-services/analytics-modeling) in this case. +That is the [Data Science OMAS](../../../access-services/data-science) in this case. ---- diff --git a/open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle b/open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle index 9bfd389a8a6..179b1cb32ac 100644 --- a/open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle +++ b/open-metadata-implementation/server-chassis/server-chassis-spring/build.gradle @@ -48,7 +48,6 @@ dependencies { runtimeOnly project(':open-metadata-implementation:access-services:asset-lineage:asset-lineage-spring') runtimeOnly project(':open-metadata-implementation:access-services:data-engine:data-engine-spring') runtimeOnly project(':open-metadata-implementation:access-services:subject-area:subject-area-spring') - runtimeOnly project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-spring') runtimeOnly project(':open-metadata-implementation:access-services:asset-catalog:asset-catalog-spring') runtimeOnly project(':open-metadata-implementation:access-services:governance-program:governance-program-spring') runtimeOnly project(':open-metadata-implementation:access-services:governance-engine:governance-engine-spring') diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/README.md b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/README.md deleted file mode 100644 index 430e99703fb..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/README.md +++ /dev/null @@ -1,42 +0,0 @@ - - - -# Analytics Modeling OMAS FVT Suite - -The Analytics Modeling OMAS FVT Suite drives the -[Analytics Modeling OMAS](../../../../open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-client) -Java clients through the -full range of its API calls both with the server activated and with it not present. -It uses an OMAG Metadata Server. - -To run the test, start the server and call the test suite as follows: - -```bash -$ FVTSuite serverURLRoot serverName userId -``` - -Where: -* `serverURLRoot` is the hostname and port name for the OMAG Server Platform where the -metadata server is running. If no `serverURLRoot` is supplied, it defaults to `https://localhost:9443`. - -* `serverName` is the name for the Metadata Server that is called during the tests. -If no `serverName` is supplied, it defaults to `fvtMDS`. - -* `userId` is the name for the user that is issuing the calls to the Metadata Server that is called during the tests. -If no `userId` is supplied, it defaults to `testUser`. - - -The tests aim to be self-contained. This means they create any metadata -they use and delete it at the end. Metadata will only be left in the repository -if one of the test fails. - - -## Running in the build - -These tests are also configured to run in the build using the failsafe plugin. - - - ----- -License: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), -Copyright Contributors to the ODPi Egeria project. \ No newline at end of file diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/build.gradle deleted file mode 100644 index 6630bc1e15c..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/build.gradle +++ /dev/null @@ -1,127 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright Contributors to the ODPi Egeria project. - */ - -plugins { - // Include plug-in for starting a new process - id 'com.github.psxpaul.execfork' - id 'java' -} - -apply plugin: "com.github.psxpaul.execfork" -apply plugin: 'groovy' - -dependencies { - implementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api') - implementation project(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-client') - implementation project(':open-metadata-implementation:frameworks:audit-log-framework') - implementation project(':open-metadata-implementation:frameworks:open-connector-framework') - implementation project(':open-metadata-implementation:repository-services:repository-services-apis') - implementation project(':open-metadata-implementation:repository-services:repository-services-client') - implementation project(':open-metadata-implementation:admin-services:admin-services-api') - implementation project(':open-metadata-implementation:common-services:ffdc-services') - implementation project(':open-metadata-test:open-metadata-fvt:fvt-utilities') - implementation project(':open-metadata-implementation:common-services:generic-handlers') - implementation 'com.fasterxml.jackson.core:jackson-databind' - implementation 'commons-io:commons-io' - - testImplementation project(':open-metadata-distribution:open-metadata-assemblies') - testImplementation 'org.junit.jupiter:junit-jupiter-api' - testImplementation 'org.junit.jupiter:junit-jupiter-engine' - testImplementation("org.junit.jupiter:junit-jupiter-params") - testImplementation localGroovy() - implementation project(':open-metadata-implementation:adapters:authentication-plugins:http-helper') - testImplementation 'org.apache.commons:commons-lang3' -} - -configurations { - all { - exclude module: 'org.glassfish:jakarta.json' - } -} - -description = 'Analytics Modeling OMAS FVT' - -// JavaDoc is needed for Publishing POMS to Maven Central -java { - withJavadocJar() -} - -// Local properties to use -ext - { - distdir="../../../../../../open-metadata-distribution/open-metadata-assemblies/build/unpacked/egeria-${project.version}-distribution.tar.gz" - } - - -// Build the groovy test script -sourceSets.test.java.srcDirs = [] -sourceSets.test.groovy.srcDirs = ["src/test/java", "src/test/script"] - -// Initially we launch as an app -- though there may be a better way of running this in the existing jvm -task startServer(dependsOn: ['cleanData',':open-metadata-distribution:open-metadata-assemblies:unzip','prepareDirs'], type: com.github.psxpaul.task.ExecFork) { - // Start some external service - executable = System.properties.'java.home' + '/bin/java' - workingDir = layout.buildDirectory.dir('run') - - args = [ "-Dserver.port=10453", - "-Dloader.path=${distdir}/server/lib", - "-Dspringdoc.api-docs.enabled=false", - "-Djavax.net.ssl.trustStore=${distdir}/truststore.p12", - "-Dserver.ssl.trust-store=${distdir}/truststore.p12", - "-jar", - "${distdir}/server/server-chassis-spring-${project.version}.jar" ] - // Setting the output directories to be the same for ALL FVTs acts as a synchronization mechanism - // - alternatively we need to ensure the server port is unique per test - standardOutput = layout.buildDirectory.file("chassis.log") - errorOutput = layout.buildDirectory.file("chassis-error.log") - stopAfter = test - waitForPort = 10453 - timeout = 180 - //waitForOutput = 'has started' -} - -// Configuration of the platform -task configServer(dependsOn: ['startServer','classes'], type: JavaExec) { - mainClass = 'configureStartServer' - classpath = sourceSets.test.runtimeClasspath - //TODO: These parms aren't currently correctly passed. We rely on defaults in the script - systemProperties = [ - 'name': 'Egeria chassis', - 'baseURL': 'https://localhost:10453', - 'servermem': 'serverinmem', - 'delay': '2', - 'user': 'testUser' - ] -} - -task prepareDirs { - mustRunAfter clean - doLast { - mkdir layout.buildDirectory.dir('run') - } -} - -task cleanData(type: Delete) { - delete files("${buildDir}/run/data") -} - -// The actual tests (Integration only) -test { - description 'Run Integration Tests' - group = 'verification' - outputs.upToDateWhen {return false} - systemProperties = [ - 'fvt.url': 'https://localhost:10453', - 'junit.jupiter.testclass.order.default': 'org.junit.jupiter.api.ClassOrderer$ClassName' - ] - useJUnitPlatform() - testLogging.showStandardStreams = true - dependsOn configServer -} - -// Resolves logging conflict with Jena -loggingCapabilities { - enforceLogback()// Configuration goes here -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/AnalyticsModelingOMASFVTSuite.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/AnalyticsModelingOMASFVTSuite.java deleted file mode 100644 index 007b976529a..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/AnalyticsModelingOMASFVTSuite.java +++ /dev/null @@ -1,104 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.clientconstructors.ClientConstructorTest; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.errorhandling.InvalidParameterTest; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.imports.ImportsTest; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.synchronization.SynchronizationTest; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.fvt.utilities.FVTSuiteBase; -import org.odpi.openmetadata.http.HttpHelper; - -import java.io.IOException; - -import static java.lang.System.exit; - - -/** - * AnalyticsModelingOMASFVTSuite provides the main program for the Analytics Modeling OMAS - * Functional Verification Tests (FVTs). It is used when running the test suite standalone - * (ie outside the failsafe test framework). - */ -public class AnalyticsModelingOMASFVTSuite extends FVTSuiteBase -{ - /** - * Run the FVT Suite. - * - * @param args user input - */ - public static void main(String[] args) - { - int exitCode; - - try - { - String url = getUrl(args); - String serverName = getServerName(args); - String userId = getUserId(args); - - AnalyticsModelingOMASFVTSuite fvtSuite = new AnalyticsModelingOMASFVTSuite(); - - exitCode = fvtSuite.performFVT(serverName, url, userId); - } - catch (IOException error) - { - System.out.println("Error getting user input"); - error.printStackTrace(); - exitCode = -99; - } - - exit(exitCode); - } - - - /** - * Run all the defined tests and capture the results. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @return combined results of running test - */ - @Override - public int performFVT(String serverName, - String serverPlatformRootURL, - String userId) - { - HttpHelper.noStrictSSL(); - - int returnCode = 0; - - FVTResults results; - - results = ClientConstructorTest.performFVT(serverName, serverPlatformRootURL); - if (! results.isSuccessful()) - { - returnCode --; - } - results.printResults(serverName); - - results = InvalidParameterTest.performFVT(serverName, serverPlatformRootURL, userId); - if (! results.isSuccessful()) - { - returnCode --; - } - results.printResults(serverName); - - results = ImportsTest.performFVT(serverName, serverPlatformRootURL, userId); - if (! results.isSuccessful()) - { - returnCode --; - } - results.printResults(serverName); - - results = SynchronizationTest.performFVT(serverName, serverPlatformRootURL, userId); - if (! results.isSuccessful()) - { - returnCode --; - } - results.printResults(serverName); - - return returnCode; - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/EntityPropertiesBuilder.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/EntityPropertiesBuilder.java deleted file mode 100644 index 0a2f00db205..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/EntityPropertiesBuilder.java +++ /dev/null @@ -1,82 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt; - - -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesUtilities; - - -public class EntityPropertiesBuilder { - - private OMRSRepositoryPropertiesUtilities propertyUtils; - - private InstanceProperties instanceProperties; - - String context; - String method; - - - /** - * Default constructor. - * @param context the builder is called from. - * @param method the builder is called from. - * @param properties to build. - */ - public EntityPropertiesBuilder(String context, String method, InstanceProperties properties) { - this.context = context; - this.method = method; - propertyUtils = new OMRSRepositoryPropertiesUtilities(); - instanceProperties = properties; - } - - /** - * Returns the same builder - * - * @param key - name of the property - * @param value - value of the property - * @return the builder to use to return - */ - public EntityPropertiesBuilder withStringProperty(String key, String value) { - - instanceProperties = propertyUtils.addStringPropertyToInstance(context, instanceProperties, key, value, method); - - return this; - } - - /** - * Returns the same builder - * - * @param key - name of the property - * @param value - value of the property - * @return the builder to use to return - */ - public EntityPropertiesBuilder withBooleanProperty(String key, Boolean value) { - - instanceProperties = propertyUtils.addBooleanPropertyToInstance(context, instanceProperties, key, value, method); - - return this; - } - - /** - * Returns the same builder - * - * @param key - name of the property - * @param value - value of the property - * @return the builder to use to return - */ - public EntityPropertiesBuilder withIntegerProperty(String key, Integer value) { - instanceProperties = propertyUtils.addIntPropertyToInstance(context, instanceProperties, key, value, method); - return this; - } - - /** - * Returns the instance properties object - * - * @return properties - */ - public InstanceProperties build() { - return instanceProperties; - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/RepositoryService.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/RepositoryService.java deleted file mode 100644 index 778d11cd856..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/RepositoryService.java +++ /dev/null @@ -1,383 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt; - - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsMetadata; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataContainer; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.MetadataItem; -import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper; -import org.odpi.openmetadata.repositoryservices.clients.LocalRepositoryServicesClient; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceStatus; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.MapPropertyValue; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesUtilities; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotDeletedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityProxyOnlyException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.StatusNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException; - -/** - * This class aims to offer support for the FVT in regards to calling the LocalRepositoryServicesClient. - * It is used to build Database object in the repository to test import functionality. - */ -public class RepositoryService { - - - private static final String ODBC_TYPE = "odbc_type"; - public static final String TYPE_SUFFIX = "_type"; - private final String context; - - HashMap uid2guid = new HashMap<>(); - - private final String userId; - private final LocalRepositoryServicesClient client; - protected OMRSRepositoryPropertiesUtilities propertyUtils = new OMRSRepositoryPropertiesUtilities(); - - public RepositoryService(String serverName, String userId, String serverPlatformRootURL, String context) - throws InvalidParameterException { - this.context = context; - this.userId = userId; - this.client = new LocalRepositoryServicesClient("repository", serverPlatformRootURL + - "/servers/" + serverName); - } - - public void createRequiredEntities(AnalyticsAsset artifact) - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, - PropertyErrorException, ClassificationErrorException, StatusNotSupportedException, - FunctionNotSupportedException, UserNotAuthorizedException - { - createReferencedEntitiesForMetadataLinks(artifact.getQualifiedName(), artifact.getContainer()); - } - - - private void createReferencedEntitiesForMetadataLinks(String parentQName, List list) - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, UserNotAuthorizedException, - PropertyErrorException, ClassificationErrorException, StatusNotSupportedException, FunctionNotSupportedException - { - if (list == null) { - return; - } - - for (int i = 0; i < list.size(); ++i) { - AnalyticsMetadata mtdObject = list.get(i); - if (mtdObject instanceof MetadataItem) { - createReferencedColumns(parentQName, i + 1, mtdObject); - createReferencedEntitiesForMetadataLinks(mtdObject.getQualifiedName(), ((MetadataItem) mtdObject).getItem()); - } else if (mtdObject instanceof MetadataContainer) { - createReferencedEntitiesForMetadataLinks(mtdObject.getQualifiedName(), ((MetadataContainer) mtdObject).getContainer()); - createReferencedEntitiesForMetadataLinks(mtdObject.getQualifiedName(), ((MetadataContainer) mtdObject).getItem()); - } - } - } - - private void createReferencedColumns(String parentQName, int position, AnalyticsMetadata mtdObject) - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, PropertyErrorException, - ClassificationErrorException, StatusNotSupportedException, FunctionNotSupportedException, UserNotAuthorizedException - { - if (mtdObject.getSourceGuid() == null) { - return; - } - - for( int j = 0; j < mtdObject.getSourceGuid().size(); ++j) { - String id = mtdObject.getSourceGuid().get(j); - String guid; - if (!uid2guid.containsKey(id)) { - EntityDetail entity = createReferencedColumn(parentQName, ((MetadataItem) mtdObject).getExpression(), position); - guid = entity.getGUID(); - uid2guid.put(id, entity.getGUID()); - } else { - guid = uid2guid.get(id); - } - mtdObject.getSourceGuid().set(j, guid); - } - } - - protected EntityDetail createReferencedColumn(String parentQName, String columnName, int position) - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, - PropertyErrorException, ClassificationErrorException, StatusNotSupportedException, - FunctionNotSupportedException, UserNotAuthorizedException - { - String method = "createReferencedColumn"; - - String columnQName = buildQualifiedName(parentQName, - OpenMetadataAPIMapper.RELATIONAL_COLUMN_TYPE_NAME, columnName); - - InstanceProperties properties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, columnQName) - .withStringProperty(OpenMetadataAPIMapper.DISPLAY_NAME_PROPERTY_NAME, columnName) - .withIntegerProperty(OpenMetadataAPIMapper.POSITION_PROPERTY_NAME, position) - .build(); - - return client.addEntity(userId, OpenMetadataAPIMapper.RELATIONAL_COLUMN_TYPE_GUID, - properties, null, InstanceStatus.ACTIVE); - } - - /** - * Clean repository from previous test setup. - * @throws InvalidParameterException in case of the error. - * @throws RepositoryErrorException in case of the error. - * @throws TypeErrorException in case of the error. - * @throws PropertyErrorException in case of the error. - * @throws FunctionNotSupportedException in case of the error. - * @throws UserNotAuthorizedException in case of the error. - * @throws PagingErrorException in case of the error. - * @throws EntityNotKnownException in case of the error. - * @throws EntityNotDeletedException in case of the error. - */ - public void cleanRepository() - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, - PropertyErrorException, FunctionNotSupportedException, UserNotAuthorizedException, - PagingErrorException, EntityNotKnownException, EntityNotDeletedException - { - // order is important: follows tree hierarchy of the Relational schema structure. - String [] types = { - OpenMetadataAPIMapper.DATABASE_TYPE_GUID, - OpenMetadataAPIMapper.DEPLOYED_DATABASE_SCHEMA_TYPE_GUID, - OpenMetadataAPIMapper.RELATIONAL_DB_SCHEMA_TYPE_TYPE_GUID, - OpenMetadataAPIMapper.RELATIONAL_TABLE_TYPE_GUID, - OpenMetadataAPIMapper.RELATIONAL_COLUMN_TYPE_GUID, - OpenMetadataAPIMapper.NOTE_LOG_TYPE_GUID - }; - - for (String type : types) { - if (!deleteEntitiesByType(type)) - break; - } - } - - /** - * Delete entity of the certain type from repository. - * @param entityTypeGUID to be deleted. - * @return true if any entity was deleted. - * @throws InvalidParameterException in case of the error. - * @throws RepositoryErrorException in case of the error. - * @throws TypeErrorException in case of the error. - * @throws PropertyErrorException in case of the error. - * @throws FunctionNotSupportedException in case of the error. - * @throws UserNotAuthorizedException in case of the error. - * @throws PagingErrorException in case of the error. - * @throws EntityNotKnownException in case of the error. - * @throws EntityNotDeletedException in case of the error. - */ - private boolean deleteEntitiesByType(String entityTypeGUID) - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, - PropertyErrorException, FunctionNotSupportedException, UserNotAuthorizedException, - PagingErrorException, EntityNotKnownException, EntityNotDeletedException - { - List entities = client.findEntities(userId, entityTypeGUID, null, null, 0, null, null, null, null, null, 0); - - if (entities != null && !entities.isEmpty()) { - for (EntityDetail entity : entities) { - client.deleteEntity(userId, entityTypeGUID, entity.getType().getTypeDefName(), entity.getGUID()); - client.purgeEntity(userId, entityTypeGUID, entity.getType().getTypeDefName(), entity.getGUID()); - } - return true; - } - return false; - } - - public EntityDetail createDatabaseEntity(String dbName, String type, String version ) - throws InvalidParameterException, RepositoryErrorException, TypeErrorException, - PropertyErrorException, ClassificationErrorException, StatusNotSupportedException, - FunctionNotSupportedException, UserNotAuthorizedException - { - String qualifiedName = buildQualifiedName("", OpenMetadataAPIMapper.DATABASE_TYPE_NAME, dbName); - InstanceProperties properties = new EntityPropertiesBuilder(context, "createDatabaseEntity", null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName) - .withStringProperty(OpenMetadataAPIMapper.NAME_PROPERTY_NAME, dbName) - .withStringProperty(OpenMetadataAPIMapper.DATABASE_TYPE_PROPERTY_NAME_DEP, type) - .withStringProperty(OpenMetadataAPIMapper.DATABASE_VERSION_PROPERTY_NAME_DEP, version) - .build(); - - return client.addEntity(userId, OpenMetadataAPIMapper.DATABASE_TYPE_GUID, properties, null, InstanceStatus.ACTIVE); - } - - public EntityDetail createDatabaseSchemaEntity(String guidDB, String schemaName) - throws InvalidParameterException, RepositoryErrorException, FunctionNotSupportedException, - EntityNotKnownException, EntityProxyOnlyException, UserNotAuthorizedException, TypeErrorException, - PropertyErrorException, ClassificationErrorException, StatusNotSupportedException - { - String methodName = "createDatabaseSchemaEntity"; - EntityDetail db = client.getEntityDetail(userId, guidDB); - String dbQName = getEntityQName(db, methodName); - String qualifiedName = buildQualifiedName(dbQName, OpenMetadataAPIMapper.DEPLOYED_DATABASE_SCHEMA_TYPE_NAME, schemaName); - InstanceProperties properties = new EntityPropertiesBuilder(context, methodName, null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, qualifiedName) - .withStringProperty(OpenMetadataAPIMapper.NAME_PROPERTY_NAME, schemaName) - .build(); - - EntityDetail schema = client.addEntity(userId, OpenMetadataAPIMapper.DEPLOYED_DATABASE_SCHEMA_TYPE_GUID, - properties, null, InstanceStatus.ACTIVE); - // add relationship catalog->schema - client.addRelationship(userId, OpenMetadataAPIMapper.DATA_CONTENT_FOR_DATA_SET_TYPE_GUID, - null, db.getGUID(), schema.getGUID(), InstanceStatus.ACTIVE); - - return schema; - } - - String getEntityQName(EntityDetail entity, String methodName) { - return propertyUtils.getStringProperty(context, OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, entity.getProperties(), methodName); - } - - public EntityDetail createSchemaTable(EntityDetail schema, String tableName) - throws InvalidParameterException, TypeErrorException, EntityProxyOnlyException, ClassificationErrorException, - RepositoryErrorException, EntityNotKnownException, PropertyErrorException, PagingErrorException, - FunctionNotSupportedException, UserNotAuthorizedException, StatusNotSupportedException - { - - String method = "createSchemaTable"; - List relationshipsRDBSchemaList = client.getRelationshipsForEntity(userId, schema.getGUID(), - OpenMetadataAPIMapper.ASSET_TO_SCHEMA_TYPE_TYPE_GUID, 0, - Collections.singletonList(InstanceStatus.ACTIVE), null, null, null, 0); - String schemaQName = getEntityQName(schema, method); - - if (relationshipsRDBSchemaList == null || relationshipsRDBSchemaList.isEmpty()) { - String relationalSchemaQName = buildQualifiedName(schemaQName, OpenMetadataAPIMapper.RELATIONAL_DB_SCHEMA_TYPE_TYPE_NAME, tableName); - InstanceProperties properties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, relationalSchemaQName) - .build(); - - EntityDetail relationalDBSchemaType = client.addEntity(userId, OpenMetadataAPIMapper.RELATIONAL_DB_SCHEMA_TYPE_TYPE_GUID, - properties, null, null); - - // add relationship schema->RelationalDBSchemaType - Relationship relationship = client.addRelationship(userId, OpenMetadataAPIMapper.ASSET_TO_SCHEMA_TYPE_TYPE_GUID, null, - schema.getGUID(), relationalDBSchemaType.getGUID(), null); - - relationshipsRDBSchemaList = Arrays.asList(relationship); - } - - Relationship relRDBSchema = relationshipsRDBSchemaList.get(0); - EntityDetail entityRDBSchema = client.getEntityDetail(userId, relRDBSchema.getEntityTwoProxy().getGUID()); - - String tableQName = buildQualifiedName(getEntityQName(entityRDBSchema, method), - OpenMetadataAPIMapper.RELATIONAL_TABLE_TYPE_NAME, tableName); - InstanceProperties properties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, tableQName) - .withStringProperty(OpenMetadataAPIMapper.DISPLAY_NAME_PROPERTY_NAME, tableName) - .build(); - - EntityDetail entityTable = client.addEntity(userId, OpenMetadataAPIMapper.RELATIONAL_TABLE_TYPE_GUID, properties, null, null); - - // add relationship RelationalDBSchemaType->table - client.addRelationship(userId, OpenMetadataAPIMapper.TYPE_TO_ATTRIBUTE_RELATIONSHIP_TYPE_GUID, - null, entityRDBSchema.getGUID(), entityTable.getGUID(), null); - - return entityTable; - } - - public EntityDetail addColumn(EntityDetail tableEntity, String columnName, String dataType, String vendorType, int position) - throws InvalidParameterException, TypeErrorException, RepositoryErrorException, EntityNotKnownException, - PropertyErrorException, PagingErrorException, FunctionNotSupportedException, UserNotAuthorizedException, - ClassificationErrorException, StatusNotSupportedException, EntityProxyOnlyException - { - String method = "addColumn"; - String columnQName = buildQualifiedName(getEntityQName(tableEntity, method), OpenMetadataAPIMapper.RELATIONAL_COLUMN_TYPE_NAME, columnName); - InstanceProperties columnTypeProperties = new EntityPropertiesBuilder(context, method, null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, columnQName) - .withStringProperty(OpenMetadataAPIMapper.DISPLAY_NAME_PROPERTY_NAME, columnName) - .withIntegerProperty(OpenMetadataAPIMapper.POSITION_PROPERTY_NAME, position) - .build(); - EntityDetail columnEntity = client.addEntity(userId, OpenMetadataAPIMapper.RELATIONAL_COLUMN_TYPE_GUID, columnTypeProperties, null, null); - - client.addRelationship(userId, OpenMetadataAPIMapper.NESTED_ATTRIBUTE_RELATIONSHIP_TYPE_GUID, - null, tableEntity.getGUID(), columnEntity.getGUID(), null); - - if (dataType != null) { - setColumnNoteLogProperty(columnEntity, ODBC_TYPE, dataType); - } - - if (vendorType != null) { - setColumnNoteLogProperty(columnEntity, OpenMetadataAPIMapper.COMMENT_TYPE_PROPERTY_NAME_DEP, vendorType); - } - - return columnEntity; - } - - public void setColumnNoteLogProperty(EntityDetail columnEntity, String propName, String propValue) - throws InvalidParameterException, TypeErrorException, RepositoryErrorException, EntityNotKnownException, - PropertyErrorException, PagingErrorException, FunctionNotSupportedException, UserNotAuthorizedException, - EntityProxyOnlyException, ClassificationErrorException, StatusNotSupportedException - { - String methodName = "setColumnNoteLogProperty"; - EntityDetail columnTypeEntity = getColumnType(columnEntity); - InstanceProperties ap = propertyUtils.getMapProperty(context, OpenMetadataAPIMapper.ADDITIONAL_PROPERTIES_PROPERTY_NAME, - columnTypeEntity.getProperties(), methodName); - - if (ap == null) { - ap = new InstanceProperties(); - } - - EntityPropertiesBuilder pb = new EntityPropertiesBuilder(context, methodName, ap); - pb.withStringProperty(propName, propValue); - MapPropertyValue mpv = new MapPropertyValue(); - mpv.setMapValues(ap); - InstanceProperties properties = columnTypeEntity.getProperties(); - properties.setProperty(OpenMetadataAPIMapper.ADDITIONAL_PROPERTIES_PROPERTY_NAME, mpv); - client.updateEntityProperties(userId, columnTypeEntity.getGUID(), properties); - } - - private EntityDetail getColumnType(EntityDetail columnEntity) - throws InvalidParameterException, TypeErrorException, RepositoryErrorException, EntityNotKnownException, - PropertyErrorException, PagingErrorException, FunctionNotSupportedException, UserNotAuthorizedException, - EntityProxyOnlyException, ClassificationErrorException, StatusNotSupportedException - { - - String method = "getColumnType"; - List columnToColumnType = client.getRelationshipsForEntity(userId, columnEntity.getGUID(), - OpenMetadataAPIMapper.REFERENCEABLE_TO_NOTE_LOG_TYPE_GUID, 0, - Collections.singletonList(InstanceStatus.ACTIVE), null, null, null, 0); - - if (columnToColumnType != null && !columnToColumnType.isEmpty()) { - return client.getEntityDetail(userId, columnToColumnType.get(0).getEntityTwoProxy().getGUID()); - } - - // create - String columnName = propertyUtils.getStringProperty(context, OpenMetadataAPIMapper.DISPLAY_NAME_PROPERTY_NAME, - columnEntity.getProperties(), method); - - String columnTypeQName = buildQualifiedName(getEntityQName(columnEntity, method), - OpenMetadataAPIMapper.RELATIONAL_COLUMN_TYPE_NAME, columnName + TYPE_SUFFIX ); - InstanceProperties columnTypeProperties = new EntityPropertiesBuilder(context, "getColumnType", null) - .withStringProperty(OpenMetadataAPIMapper.QUALIFIED_NAME_PROPERTY_NAME, columnTypeQName) - .build(); - - EntityDetail columnNoteLogEntity = client.addEntity(userId, OpenMetadataAPIMapper.NOTE_LOG_TYPE_GUID, columnTypeProperties, - null, null); - - client.addRelationship(userId, OpenMetadataAPIMapper.REFERENCEABLE_TO_NOTE_LOG_TYPE_GUID, - null, columnEntity.getGUID(), columnNoteLogEntity.getGUID(), null); - - return columnNoteLogEntity; - } - - private static String buildQualifiedName(String parentQualifiedName, String typeName, String value) { - StringBuilder sb = new StringBuilder(); - sb.append((parentQualifiedName == null || parentQualifiedName.isEmpty()) ? "" : (parentQualifiedName + "::")) - .append("(") - .append(typeName) - .append(")") - .append("=") - .append(value); - - return sb.toString(); - } - -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/clientconstructors/ClientConstructorTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/clientconstructors/ClientConstructorTest.java deleted file mode 100644 index 82c70d14e8e..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/clientconstructors/ClientConstructorTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.clientconstructors; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.AnalyticsModelingRestClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.ImportClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.SynchronizationClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.common.AnalyticsModelingTestBase; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; - - -/** - * ClientConstructorTest provides the methods to verify that all of the clients can be constructed with - * or without security - */ -public class ClientConstructorTest extends AnalyticsModelingTestBase -{ - private final static String testCaseName = "ClientConstructorTest"; - private final static String serverUserId = "TestNPA"; - private final static String serverPassword = "TestNPAPassword"; - - /** - * Run all of the defined tests and capture the results. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @return results of running test - */ - public static FVTResults performFVT(String serverName, - String serverPlatformRootURL) - { - FVTResults results = new FVTResults(testCaseName); - - results.incrementNumberOfTests(); - try - { - ClientConstructorTest.runIt(serverPlatformRootURL, serverName, results.getAuditLogDestination()); - results.incrementNumberOfSuccesses(); - } - catch (Exception error) - { - results.addCapturedError(error); - } - - return results; - } - - - /** - * Run all of the tests in this class. - * - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param auditLogDestination logging destination - * @throws InvalidParameterException one of the tests failed - */ - private static void runIt(String serverPlatformRootURL, - String serverName, - FVTAuditLogDestination auditLogDestination) throws InvalidParameterException - { - ClientConstructorTest thisTest = new ClientConstructorTest(); - - AuditLog auditLog = new AuditLog(auditLogDestination, - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceCode(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDevelopmentStatus(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceName(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDescription(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceWiki()); - - thisTest.testImportClient(serverName, serverPlatformRootURL, auditLog); - thisTest.testSynchronizationClient(serverName, serverPlatformRootURL, auditLog); - } - - - - /** - * Create a client using each of its constructors. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param auditLog logging destination - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - private void testImportClient(String serverName, - String serverPlatformRootURL, - AuditLog auditLog) throws InvalidParameterException - { - new ImportClient(serverName, serverPlatformRootURL, auditLog); - new ImportClient(serverName, serverPlatformRootURL); - new ImportClient(serverName, serverPlatformRootURL, serverUserId, serverPassword, auditLog); - new ImportClient(serverName, serverPlatformRootURL, serverUserId, serverPassword); - - AnalyticsModelingRestClient restClient = new AnalyticsModelingRestClient(serverName, serverPlatformRootURL); - - new ImportClient(serverName, serverPlatformRootURL, restClient, maxPageSize); - } - - - /** - * Create a client using each of its constructors. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param auditLog logging destination - * @throws InvalidParameterException there is a problem creating the client-side components to issue any - * REST API calls. - */ - private void testSynchronizationClient(String serverName, - String serverPlatformRootURL, - AuditLog auditLog) throws InvalidParameterException - { - new SynchronizationClient(serverName, serverPlatformRootURL, auditLog); - new SynchronizationClient(serverName, serverPlatformRootURL); - new SynchronizationClient(serverName, serverPlatformRootURL, serverUserId, serverPassword, auditLog); - new SynchronizationClient(serverName, serverPlatformRootURL, serverUserId, serverPassword); - - AnalyticsModelingRestClient restClient = new AnalyticsModelingRestClient(serverName, serverPlatformRootURL); - - new SynchronizationClient(serverName, serverPlatformRootURL, restClient, maxPageSize); - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/common/AnalyticsModelingTestBase.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/common/AnalyticsModelingTestBase.java deleted file mode 100644 index 3a1db79595d..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/common/AnalyticsModelingTestBase.java +++ /dev/null @@ -1,106 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.common; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.AnalyticsModelingRestClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.ImportClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.SynchronizationClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.RepositoryService; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; - -import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; - -/** - * AnalyticsModelingTestBase provides common functions for test cases. - */ -public class AnalyticsModelingTestBase -{ - protected final static int maxPageSize = 100; - - /** - * Create and return a asset manager client. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param auditLog logging destination - * @param testCaseName name of calling test case - * @return client - * @throws FVTUnexpectedCondition the test case failed - */ - protected ImportClient getImportClient(String serverName, - String serverPlatformRootURL, - AuditLog auditLog, - String testCaseName) throws FVTUnexpectedCondition - { - final String activityName = "getImportClient"; - - try - { - AnalyticsModelingRestClient restClient = new AnalyticsModelingRestClient(serverName, serverPlatformRootURL); - - return new ImportClient(serverName, serverPlatformRootURL, restClient, maxPageSize); - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); - } - } - - - /** - * Create and return a glossary exchange client. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param auditLog logging destination - * @param testCaseName name of calling test case - * @return client - * @throws FVTUnexpectedCondition the test case failed - */ - protected SynchronizationClient getSynchronizationClient(String serverName, - String serverPlatformRootURL, - AuditLog auditLog, - String testCaseName) throws FVTUnexpectedCondition - { - final String activityName = "getSynchronizationClient"; - - try - { - AnalyticsModelingRestClient restClient = new AnalyticsModelingRestClient(serverName, serverPlatformRootURL); - - return new SynchronizationClient(serverName, serverPlatformRootURL, restClient, maxPageSize); - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); - } - } - - /** - * Create repository client. - * @param serverName name of the server to connect to - * @param userId to run queries. - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param testCaseName name of calling test case - * @return client - * @throws FVTUnexpectedCondition the test case failed - */ - protected RepositoryService getRepositoryServiceClient(String serverName, String userId, String serverPlatformRootURL, String testCaseName) - throws FVTUnexpectedCondition - { - - final String activityName = "getRepositoryServiceClient"; - - try - { - return new RepositoryService(serverName, userId, serverPlatformRootURL, activityName); - - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(testCaseName, activityName, unexpectedError); - } - } - -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/errorhandling/InvalidParameterTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/errorhandling/InvalidParameterTest.java deleted file mode 100644 index 667c003c51f..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/errorhandling/InvalidParameterTest.java +++ /dev/null @@ -1,490 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.errorhandling; - - -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.ImportClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.SynchronizationClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.common.AnalyticsModelingTestBase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; -import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; - -/** - * InvalidParameterTest calls each non-constructor method with a series of null or invalid parameters. - * It ensures that InvalidParameterException is thrown. - */ -public class InvalidParameterTest extends AnalyticsModelingTestBase -{ - private static final AnalyticsAsset ARTIFACT = new AnalyticsAsset(); - private static final int INVALID_PAGE_SIZE = -5; - private static final int INVALID_START_FROM = -4; - private static final String EXCEPTION_EXPECTED = "(exception expected)"; - private static final String GUID_DB = "12345"; - private static final String TESTCASENAME = "InvalidParameterTest"; - - /** - * Run all of the defined tests and capture the results. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @return results of running test - */ - public static FVTResults performFVT(String serverName, - String serverPlatformRootURL, - String userId) - { - FVTResults results = new FVTResults(TESTCASENAME); - - results.incrementNumberOfTests(); - try - { - InvalidParameterTest.runIt(serverPlatformRootURL, serverName, userId, results.getAuditLogDestination()); - results.incrementNumberOfSuccesses(); - } - catch (Exception error) - { - results.addCapturedError(error); - } - - return results; - } - - - /** - * Run all of the tests in this class. - * - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLogDestination logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private static void runIt(String serverPlatformRootURL, - String serverName, - String userId, - FVTAuditLogDestination auditLogDestination) throws FVTUnexpectedCondition - { - InvalidParameterTest thisTest = new InvalidParameterTest(); - - AuditLog auditLog = new AuditLog(auditLogDestination, - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceCode(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDevelopmentStatus(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceName(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDescription(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceWiki()); - - thisTest.testImportClient_getDatabase(serverName, serverPlatformRootURL, userId, auditLog); - thisTest.testImportClient_getSchema(serverName, serverPlatformRootURL, userId, auditLog); - thisTest.testImportClient_getTables(serverName, serverPlatformRootURL, userId, auditLog); - thisTest.testImportClient_getModule(serverName, serverPlatformRootURL, userId, auditLog); - thisTest.testSynchronizationClient_CreateArtifact(serverName, serverPlatformRootURL, userId, auditLog); - } - - - - /** - * Validate all parameters of getDatabase REST function. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testImportClient_getDatabase(String serverName, - String serverPlatformRootURL, - String userId, - AuditLog auditLog) throws FVTUnexpectedCondition - { - ImportClient client = getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - testInvalidUser_getDatabase(client); - testStartFrom_getDatabase(userId, client); - testPageSize_getDatabase(userId, client); - } - - private void testPageSize_getDatabase(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testPageSize_getDatabase"; - try - { - client.getDatabases(userId, 0, INVALID_PAGE_SIZE); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - private void testStartFrom_getDatabase(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testStartFrom_getDatabase"; - try - { - client.getDatabases(userId, INVALID_START_FROM, 0); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - - private void testInvalidUser_getDatabase(ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_getDatabase"; - try - { - client.getDatabases(null, 0, 0); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - /** - * Validate all parameters of getSchema REST function. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testImportClient_getSchema(String serverName, - String serverPlatformRootURL, - String userId, - AuditLog auditLog) throws FVTUnexpectedCondition - { - ImportClient client = getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - testInvalidUser_getSchemas(client); - testInvalidGuid_getSchemas(userId, client); - testStartFrom_getSchemas(userId, client); - testPageSize_getSchemas(userId, client); - } - - private void testPageSize_getSchemas(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testPageSize_getSchemas"; - try - { - client.getSchemas(userId, GUID_DB, 0, INVALID_PAGE_SIZE); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - private void testStartFrom_getSchemas(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testStartFrom_getSchemas"; - try - { - client.getSchemas(userId, GUID_DB, INVALID_START_FROM, 0); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - private void testInvalidGuid_getSchemas(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidGuid_getSchemas"; - try - { - client.getSchemas(userId, null, 0, 0); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - - private void testInvalidUser_getSchemas(ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_getSchemas"; - try - { - client.getSchemas(null, GUID_DB, 0, 0); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - /** - * Validate all parameters of getTables REST function. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testImportClient_getTables(String serverName, - String serverPlatformRootURL, - String userId, - AuditLog auditLog) throws FVTUnexpectedCondition - { - ImportClient client = getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - testInvalidUser_getTables(client); - testInvalidGuid_getTables(userId, client); - } - - - private void testInvalidGuid_getTables(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidGuid_getTables"; - try - { - client.getTables(userId, null, "catalog", "schema"); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - - private void testInvalidUser_getTables(ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_getTables"; - try - { - client.getTables(null, GUID_DB, "catalog", "schema"); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - /** - * Validate all parameters of getModule REST function. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testImportClient_getModule(String serverName, - String serverPlatformRootURL, - String userId, - AuditLog auditLog) throws FVTUnexpectedCondition - { - ImportClient client = getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - testInvalidUser_getModule(client); - testInvalidGuid_getModule(userId, client); - } - - private void testInvalidGuid_getModule(String userId, ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidGuid_getModule"; - try - { - client.getModule(userId, null, "catalog", "schema", null); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - - private void testInvalidUser_getModule(ImportClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_getModule"; - try - { - client.getModule(null, GUID_DB, "catalog", "schema", null); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - - /** - * Validate all parameters of synchronization REST functions. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testSynchronizationClient_CreateArtifact(String serverName, - String serverPlatformRootURL, - String userId, - AuditLog auditLog) throws FVTUnexpectedCondition - { - - SynchronizationClient client = getSynchronizationClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - testInvalidUser_CreateArtifact(client); - testInvalidUser_UpdateArtifact(client); - testInvalidUser_DeleteArtifact(client); - } - - - private void testInvalidUser_CreateArtifact(SynchronizationClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_CreateModule"; - try - { - client.createArtifact(null, "serverCapability", null, ARTIFACT); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - private void testInvalidUser_UpdateArtifact(SynchronizationClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_UpdateArtifact"; - try - { - client.updateArtifact(null, "serverCapability", null, ARTIFACT); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } - private void testInvalidUser_DeleteArtifact(SynchronizationClient client) - throws FVTUnexpectedCondition - { - final String activityName = "testInvalidUser_DeleteArtifact"; - try - { - client.deleteArtifact(null, "serverCapability", null, "identifier"); - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + EXCEPTION_EXPECTED); - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - if (!(unexpectedError instanceof InvalidParameterException)) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/imports/ImportsTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/imports/ImportsTest.java deleted file mode 100644 index 2c7d24b7a17..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/imports/ImportsTest.java +++ /dev/null @@ -1,300 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.imports; - -import java.util.Arrays; -import java.util.List; - -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.ImportClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.RepositoryService; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.common.AnalyticsModelingTestBase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ModuleTableFilter; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerDatabaseSchema; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerModule; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerSchemaTables; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; -import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotDeletedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityProxyOnlyException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.FunctionNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PagingErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.StatusNotSupportedException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.TypeErrorException; -import org.odpi.openmetadata.repositoryservices.ffdc.exception.UserNotAuthorizedException; - -/** - * ImportsTest calls the AnalyticsModelingClient to ensure it is possible to - * get information about relational database schema. - */ -public class ImportsTest extends AnalyticsModelingTestBase -{ - private static final String TBL_DATE = "Date"; - private static final String TBL_LOCATION = "Location"; - private static final String TBL_PRODUCT = "Product"; - private static final String COL_DATE = "Date"; - private static final String COL_DESTINATION = "Destination"; - private static final String COL_PRODUCT_NAME = "ProductName"; - private static final String DATETIME = "DATETIME"; - private static final String TIMESTAMP = "TIMESTAMP"; - private static final String TESTCASENAME = "ImportsTest"; - private static final String DATABASE_GOSALES = "GOSALES"; - private static final String DATA_TYPE_VARCHAR = "VARCHAR"; - private static final String SCHEMA_DBO = "dbo"; - private static final String SERVER_TYPE_MS_SQL = "MS SQL"; - private static final String VENDOR_TYPE_STRING = "STRING"; - - static String guidDB; - - - /** - * Run all of the defined tests and capture the results. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @return results of running test - */ - public static FVTResults performFVT(String serverName, - String serverPlatformRootURL, - String userId) - { - FVTResults results = new FVTResults(TESTCASENAME); - - results.incrementNumberOfTests(); - try - { - ImportsTest.runIt(serverPlatformRootURL, serverName, userId, results.getAuditLogDestination()); - results.incrementNumberOfSuccesses(); - } - catch (Exception error) - { - results.addCapturedError(error); - } - - return results; - } - - - /** - * Run all of the tests in this class. - * - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLogDestination logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private static void runIt(String serverPlatformRootURL, - String serverName, - String userId, - FVTAuditLogDestination auditLogDestination) throws FVTUnexpectedCondition - { - ImportsTest thisTest = new ImportsTest(); - - AuditLog auditLog = new AuditLog(auditLogDestination, - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceCode(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDevelopmentStatus(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceName(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDescription(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceWiki()); - - // prepare repository - RepositoryService repositoryClient = thisTest.getRepositoryServiceClient(serverName, userId, serverPlatformRootURL, TESTCASENAME); - - try { - repositoryClient.cleanRepository(); - repositoryClient.createDatabaseEntity("FirstDB", "DB2", "11.3"); // to test two DBs in the response - EntityDetail entityDB = repositoryClient.createDatabaseEntity(DATABASE_GOSALES, SERVER_TYPE_MS_SQL, "1.0"); - guidDB = entityDB.getGUID(); - EntityDetail entitySchema = repositoryClient.createDatabaseSchemaEntity(guidDB, SCHEMA_DBO); - repositoryClient.createDatabaseSchemaEntity(entityDB.getGUID(), "system"); // to test two schemas in the response - - EntityDetail entityTableDate = repositoryClient.createSchemaTable(entitySchema, TBL_DATE); - repositoryClient.addColumn(entityTableDate, COL_DATE, TIMESTAMP, DATETIME, 1); - EntityDetail entityTableLocation = repositoryClient.createSchemaTable(entitySchema, TBL_LOCATION); - repositoryClient.addColumn(entityTableLocation, COL_DESTINATION, DATA_TYPE_VARCHAR, VENDOR_TYPE_STRING, 1); - EntityDetail entityTableA = repositoryClient.createSchemaTable(entitySchema, TBL_PRODUCT); - repositoryClient.addColumn(entityTableA, COL_PRODUCT_NAME, DATA_TYPE_VARCHAR, VENDOR_TYPE_STRING, 1); - } catch (InvalidParameterException | RepositoryErrorException | TypeErrorException | PropertyErrorException - | ClassificationErrorException | StatusNotSupportedException | FunctionNotSupportedException - | UserNotAuthorizedException | EntityNotKnownException | EntityProxyOnlyException | PagingErrorException - | EntityNotDeletedException e) { - throw new FVTUnexpectedCondition(TESTCASENAME, "Test Setup failed", e); - - } - - thisTest.testGetDatabases(repositoryClient, serverPlatformRootURL, serverName, userId, auditLog); - thisTest.testGetSchemas(repositoryClient, serverPlatformRootURL, serverName, userId, auditLog); - thisTest.testGetTables(repositoryClient, serverPlatformRootURL, serverName, userId, auditLog); - thisTest.testGetModule(repositoryClient, serverPlatformRootURL, serverName, userId, auditLog); - - } - - - /** - * Get list of databases. - * - * @param repositoryClient to setup repository for the test - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testGetDatabases(RepositoryService repositoryClient, String serverPlatformRootURL, - String serverName, String userId, AuditLog auditLog) throws FVTUnexpectedCondition - { - String activityName = "testGetDatabases"; - - ImportClient client = this.getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - try - { - List retrievedElement = client.getDatabases(userId, 0, 0); - - if (retrievedElement == null) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(no database found)"); - } - if (retrievedElement.size() != 2) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(two databases expected)"); - } - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - - /** - * Get list of database schemas. - * - * @param repositoryClient to setup repository for the test - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testGetSchemas(RepositoryService repositoryClient, String serverPlatformRootURL, - String serverName, String userId, AuditLog auditLog) throws FVTUnexpectedCondition - { - String activityName = "testGetSchemas"; - - ImportClient client = this.getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - try - { - List retrievedElement = client.getSchemas(userId, guidDB, 0, 0); - - if (retrievedElement == null) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(no schemas for database found)"); - } - if (retrievedElement.size() != 2) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(two schemas for databases expected)"); - } - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - - /** - * Get list of tables for database schemas. - * - * @param repositoryClient to setup repository for the test - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testGetTables(RepositoryService repositoryClient, String serverPlatformRootURL, - String serverName, String userId, AuditLog auditLog) throws FVTUnexpectedCondition - { - String activityName = "testGetTables"; - - ImportClient client = this.getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - try - { - - ResponseContainerSchemaTables retrievedElement = client.getTables(userId, guidDB, "GOSALES", "dbo"); - - if (retrievedElement == null) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(no tables for database schema found)"); - } - if (retrievedElement.getTablesList().size() != 3) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(three tables for database schema expected)"); - } - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - - /** - * Get module for database schemas. - * - * @param repositoryClient to setup repository for the test - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLog logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private void testGetModule(RepositoryService repositoryClient, String serverPlatformRootURL, - String serverName, String userId, AuditLog auditLog) throws FVTUnexpectedCondition - { - String activityName = "testGetModule"; - - ImportClient client = this.getImportClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - try - { - // test table filter include - ModuleTableFilter filter = new ModuleTableFilter(); - filter.getMeta().setIncludedTables(Arrays.asList(TBL_DATE, TBL_LOCATION)); - ResponseContainerModule retrievedElement = client.getModule(userId, guidDB, DATABASE_GOSALES, SCHEMA_DBO, filter); - - if (retrievedElement == null) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(failed to generate module)"); - } - if (retrievedElement.getPhysicalModule().getDataSource().get(0).getTable().size() != 2) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + "(two tables should pass the filter.)"); - } - } - catch (FVTUnexpectedCondition testCaseError) - { - throw testCaseError; - } - catch (Exception unexpectedError) - { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/synchronization/SynchronizationTest.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/synchronization/SynchronizationTest.java deleted file mode 100644 index f0a4f16aa27..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/synchronization/SynchronizationTest.java +++ /dev/null @@ -1,196 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.synchronization; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectReader; -import org.apache.commons.io.FilenameUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.client.SynchronizationClient; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.RepositoryService; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.common.AnalyticsModelingTestBase; -import org.odpi.openmetadata.accessservices.analyticsmodeling.model.ResponseContainerAssets; -import org.odpi.openmetadata.accessservices.analyticsmodeling.synchronization.model.AnalyticsAsset; -import org.odpi.openmetadata.adminservices.configuration.registration.AccessServiceDescription; -import org.odpi.openmetadata.frameworks.auditlog.AuditLog; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.fvt.utilities.auditlog.FVTAuditLogDestination; -import org.odpi.openmetadata.fvt.utilities.exceptions.FVTUnexpectedCondition; - -import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; - - -/** - * SynchronizationTest calls the SynchronizationClient to create, update, delete analytic artifacts. - */ -public class SynchronizationTest extends AnalyticsModelingTestBase -{ - private static final String RESPONSE_DOES_NOT_CONTAIN_GUID_OF_THE_AFFECTED_ARTIFACT = - ": (response does not contain GUID of the affected artifact)"; - - private static final String TESTCASENAME = "SynchronizationTest"; - - /* - * The server software capability source used for artifact operations. - */ - private static final String SERVERCAPABILITY = "ServerCapabilityAnalytiscModelingFVT_26"; - - private static final String INPUT_FOLDER = "/src/test/resources/synchronization/input/"; - - private static final ObjectReader OBJECT_READER = new ObjectMapper().reader(); - - /** - * Run all of the defined tests and capture the results. - * - * @param serverName name of the server to connect to - * @param serverPlatformRootURL the network address of the server running the OMAS REST servers - * @param userId calling user - * @return results of running test - */ - public static FVTResults performFVT(String serverName, - String serverPlatformRootURL, - String userId) - { - FVTResults results = new FVTResults(TESTCASENAME); - - results.incrementNumberOfTests(); - try - { - SynchronizationTest.runIt(serverPlatformRootURL, serverName, userId, results.getAuditLogDestination()); - results.incrementNumberOfSuccesses(); - } - catch (Exception error) - { - results.addCapturedError(error); - } - - return results; - } - - - /** - * Run all of the tests in this class. - * - * @param serverPlatformRootURL root url of the server - * @param serverName name of the server - * @param userId calling user - * @param auditLogDestination logging destination - * @throws FVTUnexpectedCondition the test case failed - */ - private static void runIt(String serverPlatformRootURL, - String serverName, - String userId, - FVTAuditLogDestination auditLogDestination) throws FVTUnexpectedCondition - { - SynchronizationTest thisTest = new SynchronizationTest(); - - AuditLog auditLog = new AuditLog(auditLogDestination, - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceCode(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDevelopmentStatus(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceName(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceDescription(), - AccessServiceDescription.ANALYTICS_MODELING_OMAS.getAccessServiceWiki()); - - SynchronizationClient client = thisTest.getSynchronizationClient(serverName, serverPlatformRootURL, auditLog, TESTCASENAME); - - RepositoryService repositoryClient = thisTest.getRepositoryServiceClient(serverName, userId, serverPlatformRootURL, TESTCASENAME); - - testCreateArtifact(repositoryClient, client, userId); - testUpdateArtifact(repositoryClient, client, userId); - testDeleteArtifact(client, userId); - - } - - /** - * Method to test create artifact operation. - * @param repositoryClient - * @param client to use for test. - * @param userId for tests. - * @throws FVTUnexpectedCondition if the test case failed. - */ - private static void testCreateArtifact(RepositoryService repositoryClient, SynchronizationClient client, String userId) - throws FVTUnexpectedCondition - { - String activityName = "testCreateArtifact"; - try { - AnalyticsAsset artifact = readObjectJson(INPUT_FOLDER, "create", AnalyticsAsset.class); - repositoryClient.createRequiredEntities(artifact); - ResponseContainerAssets assets = client.createArtifact(userId, SERVERCAPABILITY, null, artifact); - - if (assets.getAssetsList().size() != 1) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + RESPONSE_DOES_NOT_CONTAIN_GUID_OF_THE_AFFECTED_ARTIFACT); - } - - } - catch (Exception unexpectedError) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - - /** - * Method to test update artifact operation. - * @param client to use for test. - * @param userId for tests. - * @throws FVTUnexpectedCondition if the test case failed. - */ - private static void testUpdateArtifact(RepositoryService repositoryClient, SynchronizationClient client, String userId) - throws FVTUnexpectedCondition - { - String activityName = "testUpdateArtifact"; - try { - AnalyticsAsset artifact = readObjectJson(INPUT_FOLDER, "update", AnalyticsAsset.class); - repositoryClient.createRequiredEntities(artifact); - ResponseContainerAssets assets = client.updateArtifact(userId, SERVERCAPABILITY, null, artifact); - - if (assets.getAssetsList().size() != 1) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + RESPONSE_DOES_NOT_CONTAIN_GUID_OF_THE_AFFECTED_ARTIFACT); - } - } - catch (Exception unexpectedError) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - - - /** - * Method to test delete artifact operation. - * @param client to use for test. - * @param userId for tests. - * @throws FVTUnexpectedCondition if the test case failed. - */ - private static void testDeleteArtifact(SynchronizationClient client, String userId) - throws FVTUnexpectedCondition - { - String activityName = "testDeleteArtifact"; - try { - ResponseContainerAssets assets = client.deleteArtifact(userId, SERVERCAPABILITY, null, "iBASEMODULE"); // id from create operation - - if (assets.getAssetsList().size() != 1) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName + RESPONSE_DOES_NOT_CONTAIN_GUID_OF_THE_AFFECTED_ARTIFACT); - } - } - catch (Exception unexpectedError) { - throw new FVTUnexpectedCondition(TESTCASENAME, activityName, unexpectedError); - } - } - - /** - * Build object from JSON content provided in file. - * @param class of the object to build. - * @param folder location of the file. - * @param fileName without extension, JSON extension is appended. - * @param cls class to build. - * @return object created from json file. - * @throws IOException if input file cannot be read. - */ - public static T readObjectJson(String folder, String fileName, Class cls) - throws IOException - { - String root = Paths.get(".").toAbsolutePath().normalize().toString(); - String input = root + folder + FilenameUtils.getName(fileName) + ".json"; - return OBJECT_READER.readValue(Files.readString(Paths.get(input).normalize(), Charset.defaultCharset()), cls); - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASClientConstructorIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASClientConstructorIT.java deleted file mode 100644 index 1da07fb7448..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASClientConstructorIT.java +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.execution; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.apache.commons.lang3.StringUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.clientconstructors.ClientConstructorTest; -import org.odpi.openmetadata.fvt.utilities.FVTConstants; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.http.HttpHelper; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * AnalyticsModelingOMASClientConstructorIT is the failsafe wrapper for ClientConstructorTest. - */ -public class AnalyticsModelingOMASClientConstructorIT -{ - @BeforeAll - public static void disableStrictSSL(){ - HttpHelper.noStrictSSL(); - } - - @ParameterizedTest - @ValueSource(strings = {FVTConstants.IN_MEMORY_SERVER}) - public void testClientConstructors(String serverName) - { - FVTResults results = ClientConstructorTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"),FVTConstants.SERVER_PLATFORM_URL_ROOT)); - - results.printResults(serverName); - assertTrue(results.isSuccessful()); - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASImportIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASImportIT.java deleted file mode 100644 index 2cc398119d0..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASImportIT.java +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.execution; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.apache.commons.lang3.StringUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.imports.ImportsTest; -import org.odpi.openmetadata.fvt.utilities.FVTConstants; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.http.HttpHelper; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * AnalyticsModelingOMASImportIT is the failsafe wrapper for ImportsTest. - */ -public class AnalyticsModelingOMASImportIT -{ - @BeforeAll - public static void disableStrictSSL(){ - HttpHelper.noStrictSSL(); - } - - @ParameterizedTest - @ValueSource(strings = {FVTConstants.IN_MEMORY_SERVER}) - public void testImport(String serverName) - { - FVTResults results = ImportsTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"),FVTConstants.SERVER_PLATFORM_URL_ROOT), FVTConstants.USERID); - - results.printResults(serverName); - assertTrue(results.isSuccessful()); - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASInvalidParameterIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASInvalidParameterIT.java deleted file mode 100644 index bb1fd313be4..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASInvalidParameterIT.java +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.execution; - -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.apache.commons.lang3.StringUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.errorhandling.InvalidParameterTest; -import org.odpi.openmetadata.fvt.utilities.FVTConstants; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.fvt.utilities.exceptions.FVTTestFailureException; -import org.odpi.openmetadata.http.HttpHelper; - -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - -/** - * AnalyticsModelingOMASInvalidParameterIT is the failsafe wrapper for InvalidParameterTest. - */ -public class AnalyticsModelingOMASInvalidParameterIT -{ - @BeforeAll - public static void disableStrictSSL(){ - HttpHelper.noStrictSSL(); - } - - @ParameterizedTest - @ValueSource(strings = {"serverinmem"}) - public void testInvalidParameters(String server) - { - assertDoesNotThrow(() -> runInvalidParameters(server)); - } - - - public void runInvalidParameters(String serverName) throws FVTTestFailureException - { - FVTResults results = InvalidParameterTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"),FVTConstants.SERVER_PLATFORM_URL_ROOT), FVTConstants.USERID); - - results.printResults(serverName); - if (! results.isSuccessful()) - { - throw new FVTTestFailureException(results); - } - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASSynchronizationIT.java b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASSynchronizationIT.java deleted file mode 100644 index d319c990d08..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/java/org/odpi/openmetadata/accessservices/analyticsmodeling/fvt/execution/AnalyticsModelingOMASSynchronizationIT.java +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 */ -/* Copyright Contributors to the ODPi Egeria project. */ - -package org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.execution; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; -import org.apache.commons.lang3.StringUtils; -import org.odpi.openmetadata.accessservices.analyticsmodeling.fvt.synchronization.SynchronizationTest; -import org.odpi.openmetadata.fvt.utilities.FVTConstants; -import org.odpi.openmetadata.fvt.utilities.FVTResults; -import org.odpi.openmetadata.http.HttpHelper; - -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * AnalyticsModelingOMASSynchronizationIT is the failsafe wrapper for SynchronizationTest. - */ -public class AnalyticsModelingOMASSynchronizationIT -{ - @BeforeAll - public static void disableStrictSSL(){ - HttpHelper.noStrictSSL(); - } - - @ParameterizedTest - @ValueSource(strings = {FVTConstants.IN_MEMORY_SERVER}) - public void testSynchronization(String serverName) - { - FVTResults results = SynchronizationTest.performFVT(serverName, StringUtils.defaultIfEmpty(System.getProperty("fvt.url"),FVTConstants.SERVER_PLATFORM_URL_ROOT), FVTConstants.USERID); - - results.printResults(serverName); - assertTrue(results.isSuccessful()); - } -} diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/resources/synchronization/input/create.json b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/resources/synchronization/input/create.json deleted file mode 100644 index 305e9915e93..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/resources/synchronization/input/create.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "displayName" : "dbo", - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "sourceGuid" : [ "databaseGUID:dbo" ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceGuid" : [ "tableGUID:COUNTRY@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "expression" : "COUNTRY", - "dataType" : "VARCHAR", - "sourceGuid" : [ "columnGUID:COUNTRY@COUNTRY@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:COUNTRYCODE@COUNTRY@dbo" ], - "type" : "queryItem" - } ] - }, { - "displayName" : "Sales", - "identifier" : "SALES", - "sourceGuid" : [ "tableGUID:@SALES@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:SALESCOUNTRYCODE@SALES@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "expression" : "QUANTITY", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:QUANTITY@SALES@dbo" ], - "type" : "queryItem" - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/resources/synchronization/input/update.json b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/resources/synchronization/input/update.json deleted file mode 100644 index 450d3592723..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/resources/synchronization/input/update.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "displayName" : "dbo", - "uid" : "iBASEMODULE", - "location" : "CAMID(\":\")/dataSource[@name='_GOSALES_Egeria']/dataSourceConnection[@name='_GOSALES_Egeria']/dataSourceSchema[@name='GOSALES/dbo']/baseModule[@name='dbo']", - "sourceGuid" : [ "databaseGUID:dbo" ], - "container" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "sourceGuid" : [ "tableGUID:COUNTRY@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Country", - "identifier" : "COUNTRY", - "expression" : "COUNTRY", - "dataType" : "VARCHAR", - "sourceGuid" : [ "columnGUID:COUNTRY@COUNTRY@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Country Code", - "identifier" : "COUNTRYCODE", - "expression" : "COUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:COUNTRYCODE@COUNTRY@dbo" ], - "type" : "queryItem" - } ] - }, { - "displayName" : "Sales America", - "identifier" : "SALES_AMERICA", - "sourceGuid" : [ "tableGUID:@SALES@dbo" ], - "type" : "querySubject", - "item" : [ { - "displayName" : "Sales Country Code", - "identifier" : "SALESCOUNTRYCODE", - "expression" : "SALESCOUNTRYCODE", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:SALESCOUNTRYCODE@SALES@dbo" ], - "type" : "queryItem" - }, { - "displayName" : "Quantity", - "identifier" : "QUANTITY", - "expression" : "QUANTITY", - "dataType" : "INTEGER", - "sourceGuid" : [ "columnGUID:QUANTITY@SALES@dbo" ], - "type" : "queryItem" - } ] - } ] -} \ No newline at end of file diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/script/configureStartServer.groovy b/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/script/configureStartServer.groovy deleted file mode 100644 index d6675b444a4..00000000000 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/analytics-modeling-fvt/src/test/script/configureStartServer.groovy +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/local/bin/groovy -import javax.net.ssl.HttpsURLConnection - -// SPDX-License-Identifier: Apache-2.0 -// Copyright Contributors to the ODPi Egeria project. - -// Function to convert array to String - -// Will configure a server chassis - which should already be running - for FVT testing - -import javax.net.ssl.SSLContext -import javax.net.ssl.TrustManager -import javax.net.ssl.X509TrustManager -import java.security.cert.CertificateException -import java.security.cert.X509Certificate - -// Retrieve configuration - with defaults to aid in local testing (using default ports) -// Maven plugin works best with properties, gradle with system properties, so use either -user=(properties["user"] ?: System.properties["user"]) ?: "garygeeke"; -baseURL=(properties["baseURL"] ?: System.properties["baseURL"]) ?: "https://localhost:9443"; -serverMem=(properties["servermem"] ?: System.properties["servermem"]) ?: "serverinmem"; -retries=(properties["retries"] ?: System.properties["retries"]) ?: 50; -delay=(properties["delay"] ?: System.properties["delay"]) ?: 2; - -// SSL setup to avoid self-signed errors for testing -def trustAllCerts = [ - new X509TrustManager() { - public X509Certificate[] getAcceptedIssuers() { - return null - } - - public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException { - } - - public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException { - } - } -] as TrustManager[] - -try -{ - SSLContext sc = SSLContext.getInstance("SSL"); - sc.init(null, trustAllCerts, new java.security.SecureRandom()); - HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); -} -catch (Exception e) -{ - System.out.println(e); - System.exit(-1); -} - -// Wait until the platform is ready -connected=false; -i=retries; -while (!connected && i>0) -{ - try { - - System.out.println("=== Checking platform at " + baseURL + " is available (" + i + " attempts remaining) ==="); - post0 = new java.net.URL(baseURL + "/open-metadata/platform-services/users/" + user + "/server-platform/origin").openConnection(); - post0RC = post0.getResponseCode(); - println(post0RC); - if (post0RC.equals(200)) { - connected = true; - println(post0.getInputStream().getText()); - } else { - i--; - Thread.sleep(1000 * delay); - } - } catch (Throwable t) - { - // TODO: look at whether some exceptions should be deemed irrecoverable rather than retry - i--; - Thread.sleep(1000 * delay); - } -} - -// -- Inmemory - -// --- Configure the platform - any errors here and we exit -System.out.println("=== Configuring server: " + serverMem + " ==="); -post1 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/local-repository/mode/in-memory-repository" ).openConnection() -post1.setRequestMethod("POST") -post1.setRequestProperty("Content-Type", "application/json") -postRC1 = post1.getResponseCode(); -println(postRC1); -if(postRC1.equals(200)) { - println(post1.getInputStream().getText()); -} - -// --- Enable OMAS - any errors here and we exit -System.out.println("=== Enabling Analytics Modeling OMAS: " + serverMem + " ==="); -post2 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/access-services/analytics-modeling/no-topics" ).openConnection() - -post2.setRequestMethod("POST") -post2.setRequestProperty("Content-Type", "application/json") -postRC2 = post2.getResponseCode(); -println(postRC2); -if(postRC2.equals(200)) { - println(post2.getInputStream().getText()); -} - - -// --- Launch the server - any errors here and we exit -System.out.println("=== Starting server: " + serverMem + " ==="); -post3 = new URL(baseURL + "/open-metadata/admin-services/users/" + user + "/servers/" + serverMem + "/instance" ).openConnection() -post3.setRequestMethod("POST") -post3.setRequestProperty("Content-Type", "application/json") -postRC3 = post3.getResponseCode(); -println(postRC3); -if(postRC3.equals(200)) { - println(post3.getInputStream().getText()); -} - -// --- We're done -System.out.println("=== Configuration complete ===") diff --git a/settings.gradle b/settings.gradle index 71b45f6cab2..e74d6409189 100644 --- a/settings.gradle +++ b/settings.gradle @@ -107,10 +107,6 @@ include(':open-metadata-implementation:repository-services:repository-services-a include(':open-metadata-implementation:repository-services:repository-services-client') include(':open-metadata-implementation:repository-services:repository-services-implementation') include(':open-metadata-implementation:repository-services:repository-services-spring') -include(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-client') -include(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-server') -include(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-spring') -include(':open-metadata-implementation:access-services:analytics-modeling:analytics-modeling-api') include(':open-metadata-implementation:access-services:asset-catalog:asset-catalog-api') include(':open-metadata-implementation:access-services:asset-catalog:asset-catalog-client') include(':open-metadata-implementation:access-services:asset-catalog:asset-catalog-server') @@ -346,7 +342,6 @@ include(':open-metadata-resources:open-metadata-samples:open-metadata-security-s include(':open-metadata-resources:open-metadata-samples:governance-services-sample') include(':open-metadata-resources:open-metadata-deployment') include(':open-metadata-test:open-metadata-ut') -include(':open-metadata-test:open-metadata-fvt:access-services-fvt:analytics-modeling-fvt') include(':open-metadata-test:open-metadata-fvt:access-services-fvt:asset-consumer-fvt') include(':open-metadata-test:open-metadata-fvt:access-services-fvt:asset-manager-fvt') include(':open-metadata-test:open-metadata-fvt:access-services-fvt:asset-owner-fvt')